From 0c17d67fa58cf8624c1327fa4a84f6e7f67b7c58 Mon Sep 17 00:00:00 2001 From: Gregory Hainaut Date: Sun, 21 Dec 2014 16:48:41 +0100 Subject: [PATCH] cmake: add a new option to select the doc path in package mode DOC_DIR_COMPILATION=/usr/share/doc/pcsx2 close issue #402 --- CMakeLists.txt | 10 +++++----- cmake/BuildParameters.cmake | 16 ++++++++++------ pcsx2/CMakeLists.txt | 10 +++++----- pcsx2/gui/Dialogs/FirstTimeWizard.cpp | 11 +++++++++-- 4 files changed, 29 insertions(+), 18 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3e02431ad3..69c9b6f98e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -67,23 +67,23 @@ write_svnrev_h() # make the translation if(EXISTS "${CMAKE_SOURCE_DIR}/locales") add_subdirectory(locales) -endif(EXISTS "${CMAKE_SOURCE_DIR}/locales") +endif() # make common if(common_libs) add_subdirectory(common/src/Utilities) add_subdirectory(common/src/x86emitter) -endif(common_libs) +endif() # make pcsx2 if(EXISTS "${CMAKE_SOURCE_DIR}/pcsx2" AND pcsx2_core) add_subdirectory(pcsx2) -endif(EXISTS "${CMAKE_SOURCE_DIR}/pcsx2" AND pcsx2_core) +endif() # make plugins if(EXISTS "${CMAKE_SOURCE_DIR}/plugins") add_subdirectory(plugins) -endif(EXISTS "${CMAKE_SOURCE_DIR}/plugins") +endif() #------------------------------------------------------------------------------- # Install some files to ease package creation @@ -104,4 +104,4 @@ if(PACKAGE_MODE) INSTALL(FILES "${CMAKE_SOURCE_DIR}/bin/docs/PCSX2_FAQ.pdf" DESTINATION "${CMAKE_INSTALL_PREFIX}/share/doc/pcsx2") INSTALL(FILES "${CMAKE_SOURCE_DIR}/bin/docs/PCSX2_Readme.pdf" DESTINATION "${CMAKE_INSTALL_PREFIX}/share/doc/pcsx2") INSTALL(FILES "${CMAKE_SOURCE_DIR}/bin/docs/pcsx2.1" DESTINATION "${CMAKE_INSTALL_PREFIX}/share/man/man1/") -endif(PACKAGE_MODE) +endif() diff --git a/cmake/BuildParameters.cmake b/cmake/BuildParameters.cmake index 30ff069f95..3caab734af 100644 --- a/cmake/BuildParameters.cmake +++ b/cmake/BuildParameters.cmake @@ -39,19 +39,23 @@ option(GTK3_API "Use GTK3 api (experimental/wxWidget must be built with GTK3 sup if(PACKAGE_MODE) if(NOT DEFINED PLUGIN_DIR) set(PLUGIN_DIR "${CMAKE_INSTALL_PREFIX}/lib/games/pcsx2") - endif(NOT DEFINED PLUGIN_DIR) + endif() if(NOT DEFINED GAMEINDEX_DIR) set(GAMEINDEX_DIR "${CMAKE_INSTALL_PREFIX}/share/games/pcsx2") - endif(NOT DEFINED GAMEINDEX_DIR) + endif() if(NOT DEFINED BIN_DIR) set(BIN_DIR "${CMAKE_INSTALL_PREFIX}/bin") - endif(NOT DEFINED BIN_DIR) + endif() - # Compile all source codes with these 2 defines - add_definitions(-DPLUGIN_DIR_COMPILATION=${PLUGIN_DIR} -DGAMEINDEX_DIR_COMPILATION=${GAMEINDEX_DIR}) -endif(PACKAGE_MODE) + if(NOT DEFINED DOC_DIR) + set(DOC_DIR "${CMAKE_INSTALL_PREFIX}/share/doc/pcsx2") + endif() + + # Compile all source codes with those defines + add_definitions(-DPLUGIN_DIR_COMPILATION=${PLUGIN_DIR} -DGAMEINDEX_DIR_COMPILATION=${GAMEINDEX_DIR} -DDOC_DIR_COMPILATION=${DOC_DIR}) +endif() #------------------------------------------------------------------------------- # Compiler extra diff --git a/pcsx2/CMakeLists.txt b/pcsx2/CMakeLists.txt index eb702bddb9..71243866e6 100644 --- a/pcsx2/CMakeLists.txt +++ b/pcsx2/CMakeLists.txt @@ -9,7 +9,7 @@ if(NOT TOP_CMAKE_WAS_SOURCED) message(FATAL_ERROR " You did not 'cmake' the good CMakeLists.txt file. Use the one in the top dir. It is advice to delete all wrongly generated cmake stuff => CMakeFiles & CMakeCache.txt") -endif(NOT TOP_CMAKE_WAS_SOURCED) +endif() # set common flags @@ -650,20 +650,20 @@ if(Linux) set(Platform ${pcsx2LinuxSources} ${pcsx2LinuxHeaders}) -endif(Linux) +endif() # Windows if(Windows) set(Platform ${pcsx2WindowsSources} ${pcsx2WindowsHeaders}) -endif(Windows) +endif() # MacOSX if(MacOSX) set(Platform ) -endif(MacOSX) +endif() set(pcsx2FinalSources ${Common} @@ -703,6 +703,6 @@ endforeach() # See issue: 1233 if(PACKAGE_MODE) SET_SOURCE_FILES_PROPERTIES(gui/AppConfig.cpp PROPERTIES COMPILE_FLAGS "-Wp,-ansi,-U__STRICT_ANSI__") -endif(PACKAGE_MODE) +endif() add_pcsx2_executable(${Output} "${pcsx2FinalSources}" "${pcsx2FinalLibs}" "${pcsx2FinalFlags}") diff --git a/pcsx2/gui/Dialogs/FirstTimeWizard.cpp b/pcsx2/gui/Dialogs/FirstTimeWizard.cpp index cb1fb5fc6b..e071e853eb 100644 --- a/pcsx2/gui/Dialogs/FirstTimeWizard.cpp +++ b/pcsx2/gui/Dialogs/FirstTimeWizard.cpp @@ -70,8 +70,15 @@ Panels::FirstTimeIntroPanel::FirstTimeIntroPanel( wxWindow* parent ) SetMinWidth( 600 ); FastFormatUnicode faqFile; - faqFile.Write( L"file:///%s/Docs/PCSX2_FAQ.pdf", - WX_STR(InstallFolder.ToString()) ); +#ifndef DOC_DIR_COMPILATION + faqFile.Write( L"file:///%s/Docs/PCSX2_FAQ.pdf", WX_STR(InstallFolder.ToString()) ); +#else + // Each linux distributions have his rules for path so we give them the possibility to + // change it with compilation flags. -- Gregory +#define xDOC_str(s) DOC_str(s) +#define DOC_str(s) #s + faqFile.Write( L"file://%s/PCSX2_FAQ.pdf", xDOC_str(DOC_DIR_COMPILATION) ); +#endif wxStaticBoxSizer& langSel = *new wxStaticBoxSizer( wxVERTICAL, this, _("Language selector") );