diff --git a/CMakeLists.txt b/CMakeLists.txt index 2a095dfc0d..fee2ec2117 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -87,3 +87,9 @@ endif(EXISTS "${PROJECT_SOURCE_DIR}/pcsx2" AND pcsx2_core) if(EXISTS "${PROJECT_SOURCE_DIR}/plugins") add_subdirectory(plugins) endif(EXISTS "${PROJECT_SOURCE_DIR}/plugins") + +#------------------------------------------------------------------------------- +# Install some files to ease package creation +if(PACKAGE_MODE) + INSTALL(FILES "${PROJECT_SOURCE_DIR}/bin/GameIndex.dbf" DESTINATION ${GAMEINDEX_DIR}) +endif(PACKAGE_MODE) diff --git a/cmake/BuildParameters.cmake b/cmake/BuildParameters.cmake index cf0ca5b973..710574d8f2 100644 --- a/cmake/BuildParameters.cmake +++ b/cmake/BuildParameters.cmake @@ -6,13 +6,14 @@ # Use soundtouch internal lib: -DFORCE_INTERNAL_SOUNDTOUCH=TRUE # Use zlib internal lib: -DFORCE_INTERNAL_ZLIB=TRUE # Use sdl1.3 internal lib: -DFORCE_INTERNAL_SDL=TRUE # Not supported yet -### Miscellaneous -# Select install dir of l10n : -DL10N_PORTABLE=TRUE(bin/Langs)|FALSE(FHS, /usr...) -### Add some flags to the build process +### GCC optimization options # control C flags : -DUSER_CMAKE_C_FLAGS="cflags" # control C++ flags : -DUSER_CMAKE_CXX_FLAGS="cxxflags" # control link flags : -DUSER_CMAKE_LD_FLAGS="ldflags" -# Special mode to ease package: -DPACKAGE_MODE=TRUE(follow FHS)|FALSE(local bin/) +### Packaging options +# Installation path : -DPACKAGE_MODE=TRUE(follow FHS)|FALSE(local bin/) +# Plugin installation path : -DPLUGIN_DIR="/usr/lib/pcsx2" +# Game DB installation path : -DGAMEINDEX_DIR="/var/games/pcsx2" #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- @@ -24,11 +25,8 @@ if(NOT CMAKE_BUILD_TYPE MATCHES "Debug|Devel|Release") set(CMAKE_BUILD_TYPE Devel) message(STATUS "BuildType set to ${CMAKE_BUILD_TYPE} by default") endif(NOT CMAKE_BUILD_TYPE MATCHES "Debug|Devel|Release") -#------------------------------------------------------------------------------- -#------------------------------------------------------------------------------- # Set default strip option. Can be set with -DCMAKE_BUILD_STRIP=TRUE/FALSE -#------------------------------------------------------------------------------- if(NOT DEFINED CMAKE_BUILD_STRIP) if(CMAKE_BUILD_TYPE STREQUAL "Release") set(CMAKE_BUILD_STRIP TRUE) @@ -39,6 +37,35 @@ if(NOT DEFINED CMAKE_BUILD_STRIP) endif(CMAKE_BUILD_TYPE STREQUAL "Release") endif(NOT DEFINED CMAKE_BUILD_STRIP) +#------------------------------------------------------------------------------- +# Select library system vs 3rdparty +#------------------------------------------------------------------------------- +if(FORCE_INTERNAL_ALL) + set(FORCE_INTERNAL_SOUNDTOUCH TRUE) + set(FORCE_INTERNAL_ZLIB TRUE) + set(FORCE_INTERNAL_SDL TRUE) +endif(FORCE_INTERNAL_ALL) + +if(NOT DEFINED FORCE_INTERNAL_SOUNDTOUCH) + set(FORCE_INTERNAL_SOUNDTOUCH TRUE) + message(STATUS "Use internal version of Soundtouch by default. + Note: There have been issues in the past with sound quality depending on the version of Soundtouch + Use -DFORCE_INTERNAL_SOUNDTOUCH=FALSE at your own risk") + # set(FORCE_INTERNAL_SOUNDTOUCH FALSE) +endif(NOT DEFINED FORCE_INTERNAL_SOUNDTOUCH) + +if(NOT DEFINED FORCE_INTERNAL_ZLIB) + set(FORCE_INTERNAL_ZLIB FALSE) +endif(NOT DEFINED FORCE_INTERNAL_ZLIB) + +if(NOT DEFINED FORCE_INTERNAL_SDL) + set(FORCE_INTERNAL_SDL FALSE) +endif(NOT DEFINED FORCE_INTERNAL_SDL) +if (FORCE_INTERNAL_SDL) + message(STATUS "Internal SDL is a development snapshot of libsdl 1.3 + Crashes can be expected and no support will be provided") +endif (FORCE_INTERNAL_SDL) + #------------------------------------------------------------------------------- # Control GCC flags #------------------------------------------------------------------------------- @@ -117,37 +144,21 @@ endif(DEFINED USER_CMAKE_CXX_FLAGS) string(STRIP "${CMAKE_CXX_FLAGS} -m32 -msse -msse2 -march=i686 -pthread" CMAKE_CXX_FLAGS) #------------------------------------------------------------------------------- -# By default use the standard compilation mode +# Default package option #------------------------------------------------------------------------------- if(NOT DEFINED PACKAGE_MODE) set(PACKAGE_MODE FALSE) endif(NOT DEFINED PACKAGE_MODE) -#------------------------------------------------------------------------------- -# Select library system vs 3rdparty -#------------------------------------------------------------------------------- -if(FORCE_INTERNAL_ALL) - set(FORCE_INTERNAL_SOUNDTOUCH TRUE) - set(FORCE_INTERNAL_ZLIB TRUE) - set(FORCE_INTERNAL_SDL TRUE) -endif(FORCE_INTERNAL_ALL) +if(PACKAGE_MODE) + if(NOT DEFINED PLUGIN_DIR) + set(PLUGIN_DIR "${CMAKE_INSTALL_PREFIX}/lib/games/pcsx2") + endif(NOT DEFINED PLUGIN_DIR) -if(NOT DEFINED FORCE_INTERNAL_SOUNDTOUCH) - set(FORCE_INTERNAL_SOUNDTOUCH TRUE) - message(STATUS "Use internal version of Soundtouch by default. - Note: There have been issues in the past with sound quality depending on the version of Soundtouch - Use -DFORCE_INTERNAL_SOUNDTOUCH=FALSE at your own risk") - # set(FORCE_INTERNAL_SOUNDTOUCH FALSE) -endif(NOT DEFINED FORCE_INTERNAL_SOUNDTOUCH) + if(NOT DEFINED GAMEINDEX_DIR) + set(GAMEINDEX_DIR "/var/games/pcsx2") + endif(NOT DEFINED GAMEINDEX_DIR) -if(NOT DEFINED FORCE_INTERNAL_ZLIB) - set(FORCE_INTERNAL_ZLIB FALSE) -endif(NOT DEFINED FORCE_INTERNAL_ZLIB) - -if(NOT DEFINED FORCE_INTERNAL_SDL) - set(FORCE_INTERNAL_SDL FALSE) -endif(NOT DEFINED FORCE_INTERNAL_SDL) -if (FORCE_INTERNAL_SDL) - message(STATUS "Internal SDL is a development snapshot of libsdl 1.3 - Crashes can be expected and no support will be provided") -endif (FORCE_INTERNAL_SDL) + # Compile all source codes with these 2 defines + add_definitions(-DPLUGIN_DIR_COMPILATION=${PLUGIN_DIR} -DGAMEINDEX_DIR_COMPILATION=${GAMEINDEX_DIR}) +endif(PACKAGE_MODE) diff --git a/pcsx2/gui/AppConfig.cpp b/pcsx2/gui/AppConfig.cpp index e7fdb25056..14f08bc5d5 100644 --- a/pcsx2/gui/AppConfig.cpp +++ b/pcsx2/gui/AppConfig.cpp @@ -169,7 +169,15 @@ namespace PathDefs wxDirName GetPlugins() { + // Each linux distributions have his rules for path so we give them the possibility to + // change it with compilation flags. -- Gregory +#ifndef PLUGIN_DIR_COMPILATION return AppRoot() + Base::Plugins(); +#else +#define xPLUGIN_DIR_str(s) PLUGIN_DIR_str(s) +#define PLUGIN_DIR_str(s) #s + return wxDirName( xPLUGIN_DIR_str(PLUGIN_DIR_COMPILATION) ); +#endif } wxDirName GetThemes() diff --git a/pcsx2/gui/AppGameDatabase.h b/pcsx2/gui/AppGameDatabase.h index fa5ac59b5d..63961b95a6 100644 --- a/pcsx2/gui/AppGameDatabase.h +++ b/pcsx2/gui/AppGameDatabase.h @@ -51,8 +51,17 @@ public: Console.WriteLn( "(GameDB) Unloading..." ); } + // Each linux distributions have his rules for path so we give them the possibility to + // change it with compilation flags. -- Gregory +#ifndef GAMEINDEX_DIR_COMPILATION AppGameDatabase& LoadFromFile(const wxString& file = L"GameIndex.dbf", const wxString& key = L"Serial" ); void SaveToFile(const wxString& file = L"GameIndex.dbf"); +#else +#define xGAMEINDEX_str(s) GAMEINDEX_DIR_str(s) +#define GAMEINDEX_DIR_str(s) #s + AppGameDatabase& LoadFromFile(const wxString& file = Path::Combine( wxString(xGAMEINDEX_str(GAMEINDEX_DIR_COMPILATION), wxConvUTF8) , L"GameIndex.dbf" ), const wxString& key = L"Serial" ); + void SaveToFile(const wxString& file = Path::Combine( wxString(xGAMEINDEX_str(GAMEINDEX_DIR_COMPILATION), wxConvUTF8) , L"GameIndex.dbf") ); +#endif }; static wxString compatToStringWX(int compat) { diff --git a/plugins/CDVDiso/src/CMakeLists.txt b/plugins/CDVDiso/src/CMakeLists.txt index 4abfabfb7d..edb6f1ca5c 100644 --- a/plugins/CDVDiso/src/CMakeLists.txt +++ b/plugins/CDVDiso/src/CMakeLists.txt @@ -82,7 +82,7 @@ if(NOT USER_CMAKE_LD_FLAGS STREQUAL "") endif(NOT USER_CMAKE_LD_FLAGS STREQUAL "") if(PACKAGE_MODE) - install(TARGETS ${Output} DESTINATION lib/games/pcsx2) + install(TARGETS ${Output} DESTINATION ${PLUGIN_DIR}) else(PACKAGE_MODE) install(TARGETS ${Output} DESTINATION ${CMAKE_SOURCE_DIR}/bin/plugins) endif(PACKAGE_MODE) diff --git a/plugins/CDVDlinuz/Src/CMakeLists.txt b/plugins/CDVDlinuz/Src/CMakeLists.txt index ff5357f715..cdb7ab603a 100644 --- a/plugins/CDVDlinuz/Src/CMakeLists.txt +++ b/plugins/CDVDlinuz/Src/CMakeLists.txt @@ -87,11 +87,13 @@ add_library(${Output} SHARED ${CDVDlinuzLinuxSources} ${CDVDlinuzLinuxHeaders}) -# set output directory -set_target_properties(${Output} PROPERTIES - LIBRARY_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/bin/plugins) - # User flags options if(NOT USER_CMAKE_LD_FLAGS STREQUAL "") target_link_libraries(${Output} "${USER_CMAKE_LD_FLAGS}") endif(NOT USER_CMAKE_LD_FLAGS STREQUAL "") + +if(PACKAGE_MODE) + install(TARGETS ${Output} DESTINATION ${PLUGIN_DIR}) +else(PACKAGE_MODE) + install(TARGETS ${Output} DESTINATION ${CMAKE_SOURCE_DIR}/bin/plugins) +endif(PACKAGE_MODE) diff --git a/plugins/CDVDnull/CMakeLists.txt b/plugins/CDVDnull/CMakeLists.txt index 297a2bcde8..10d245b5ad 100644 --- a/plugins/CDVDnull/CMakeLists.txt +++ b/plugins/CDVDnull/CMakeLists.txt @@ -69,7 +69,7 @@ if(NOT USER_CMAKE_LD_FLAGS STREQUAL "") endif(NOT USER_CMAKE_LD_FLAGS STREQUAL "") if(PACKAGE_MODE) - install(TARGETS ${Output} DESTINATION lib/games/pcsx2) + install(TARGETS ${Output} DESTINATION ${PLUGIN_DIR}) else(PACKAGE_MODE) install(TARGETS ${Output} DESTINATION ${CMAKE_SOURCE_DIR}/bin/plugins) endif(PACKAGE_MODE) diff --git a/plugins/FWnull/CMakeLists.txt b/plugins/FWnull/CMakeLists.txt index 2301fb0b55..4e3c93d110 100644 --- a/plugins/FWnull/CMakeLists.txt +++ b/plugins/FWnull/CMakeLists.txt @@ -81,7 +81,7 @@ if(NOT USER_CMAKE_LD_FLAGS STREQUAL "") endif(NOT USER_CMAKE_LD_FLAGS STREQUAL "") if(PACKAGE_MODE) - install(TARGETS ${Output} DESTINATION lib/games/pcsx2) + install(TARGETS ${Output} DESTINATION ${PLUGIN_DIR}) else(PACKAGE_MODE) install(TARGETS ${Output} DESTINATION ${CMAKE_SOURCE_DIR}/bin/plugins) endif(PACKAGE_MODE) diff --git a/plugins/GSdx/CMakeLists.txt b/plugins/GSdx/CMakeLists.txt index f66acb66e2..34d001a9e5 100644 --- a/plugins/GSdx/CMakeLists.txt +++ b/plugins/GSdx/CMakeLists.txt @@ -188,7 +188,7 @@ if(NOT USER_CMAKE_LD_FLAGS STREQUAL "") endif(NOT USER_CMAKE_LD_FLAGS STREQUAL "") if(PACKAGE_MODE) - install(TARGETS ${Output} DESTINATION lib/games/pcsx2) + install(TARGETS ${Output} DESTINATION ${PLUGIN_DIR}) else(PACKAGE_MODE) install(TARGETS ${Output} DESTINATION ${CMAKE_SOURCE_DIR}/bin/plugins) endif(PACKAGE_MODE) diff --git a/plugins/PadNull/CMakeLists.txt b/plugins/PadNull/CMakeLists.txt index 5e195f3e57..6c454922a4 100644 --- a/plugins/PadNull/CMakeLists.txt +++ b/plugins/PadNull/CMakeLists.txt @@ -83,7 +83,7 @@ if(NOT USER_CMAKE_LD_FLAGS STREQUAL "") endif(NOT USER_CMAKE_LD_FLAGS STREQUAL "") if(PACKAGE_MODE) - install(TARGETS ${Output} DESTINATION lib/games/pcsx2) + install(TARGETS ${Output} DESTINATION ${PLUGIN_DIR}) else(PACKAGE_MODE) install(TARGETS ${Output} DESTINATION ${CMAKE_SOURCE_DIR}/bin/plugins) endif(PACKAGE_MODE) diff --git a/plugins/SPU2null/CMakeLists.txt b/plugins/SPU2null/CMakeLists.txt index 8633ba7c8e..8c1c1eb6e1 100644 --- a/plugins/SPU2null/CMakeLists.txt +++ b/plugins/SPU2null/CMakeLists.txt @@ -80,7 +80,7 @@ if(NOT USER_CMAKE_LD_FLAGS STREQUAL "") endif(NOT USER_CMAKE_LD_FLAGS STREQUAL "") if(PACKAGE_MODE) - install(TARGETS ${Output} DESTINATION lib/games/pcsx2) + install(TARGETS ${Output} DESTINATION ${PLUGIN_DIR}) else(PACKAGE_MODE) install(TARGETS ${Output} DESTINATION ${CMAKE_SOURCE_DIR}/bin/plugins) endif(PACKAGE_MODE) diff --git a/plugins/USBnull/CMakeLists.txt b/plugins/USBnull/CMakeLists.txt index ff3154a7ce..cec09e425e 100644 --- a/plugins/USBnull/CMakeLists.txt +++ b/plugins/USBnull/CMakeLists.txt @@ -82,7 +82,7 @@ if(NOT USER_CMAKE_LD_FLAGS STREQUAL "") endif(NOT USER_CMAKE_LD_FLAGS STREQUAL "") if(PACKAGE_MODE) - install(TARGETS ${Output} DESTINATION lib/games/pcsx2) + install(TARGETS ${Output} DESTINATION ${PLUGIN_DIR}) else(PACKAGE_MODE) install(TARGETS ${Output} DESTINATION ${CMAKE_SOURCE_DIR}/bin/plugins) endif(PACKAGE_MODE) diff --git a/plugins/dev9null/CMakeLists.txt b/plugins/dev9null/CMakeLists.txt index 4005fb84cb..e21929d0fa 100644 --- a/plugins/dev9null/CMakeLists.txt +++ b/plugins/dev9null/CMakeLists.txt @@ -79,7 +79,7 @@ if(NOT USER_CMAKE_LD_FLAGS STREQUAL "") endif(NOT USER_CMAKE_LD_FLAGS STREQUAL "") if(PACKAGE_MODE) - install(TARGETS ${Output} DESTINATION lib/games/pcsx2) + install(TARGETS ${Output} DESTINATION ${PLUGIN_DIR}) else(PACKAGE_MODE) install(TARGETS ${Output} DESTINATION ${CMAKE_SOURCE_DIR}/bin/plugins) endif(PACKAGE_MODE) diff --git a/plugins/onepad/CMakeLists.txt b/plugins/onepad/CMakeLists.txt index bf3da05eec..12247e384c 100644 --- a/plugins/onepad/CMakeLists.txt +++ b/plugins/onepad/CMakeLists.txt @@ -91,7 +91,7 @@ if(NOT USER_CMAKE_LD_FLAGS STREQUAL "") endif(NOT USER_CMAKE_LD_FLAGS STREQUAL "") if(PACKAGE_MODE) - install(TARGETS ${Output} DESTINATION lib/games/pcsx2) + install(TARGETS ${Output} DESTINATION ${PLUGIN_DIR}) else(PACKAGE_MODE) install(TARGETS ${Output} DESTINATION ${CMAKE_SOURCE_DIR}/bin/plugins) endif(PACKAGE_MODE) diff --git a/plugins/spu2-x/src/CMakeLists.txt b/plugins/spu2-x/src/CMakeLists.txt index cf377041ba..7b23467154 100644 --- a/plugins/spu2-x/src/CMakeLists.txt +++ b/plugins/spu2-x/src/CMakeLists.txt @@ -126,7 +126,7 @@ if(NOT USER_CMAKE_LD_FLAGS STREQUAL "") endif(NOT USER_CMAKE_LD_FLAGS STREQUAL "") if(PACKAGE_MODE) - install(TARGETS ${Output} DESTINATION lib/games/pcsx2) + install(TARGETS ${Output} DESTINATION ${PLUGIN_DIR}) else(PACKAGE_MODE) install(TARGETS ${Output} DESTINATION ${CMAKE_SOURCE_DIR}/bin/plugins) endif(PACKAGE_MODE) diff --git a/plugins/zzogl-pg/opengl/CMakeLists.txt b/plugins/zzogl-pg/opengl/CMakeLists.txt index 14d68f9354..e24d6095ae 100644 --- a/plugins/zzogl-pg/opengl/CMakeLists.txt +++ b/plugins/zzogl-pg/opengl/CMakeLists.txt @@ -168,7 +168,7 @@ if(NOT USER_CMAKE_LD_FLAGS STREQUAL "") endif(NOT USER_CMAKE_LD_FLAGS STREQUAL "") if(PACKAGE_MODE) - install(TARGETS ${Output} DESTINATION lib/games/pcsx2) + install(TARGETS ${Output} DESTINATION ${PLUGIN_DIR}) install(FILES ${PROJECT_SOURCE_DIR}/plugins/zzogl-pg/opengl/ps2hw.dat DESTINATION share/games/pcsx2/shaders) else(PACKAGE_MODE) install(TARGETS ${Output} DESTINATION ${CMAKE_SOURCE_DIR}/bin/plugins) diff --git a/plugins/zzogl-pg/opengl/ZZoglCreate.cpp b/plugins/zzogl-pg/opengl/ZZoglCreate.cpp index 1ca3d15280..a142878d53 100644 --- a/plugins/zzogl-pg/opengl/ZZoglCreate.cpp +++ b/plugins/zzogl-pg/opengl/ZZoglCreate.cpp @@ -299,8 +299,18 @@ __forceinline bool LoadShadersFromDat() if (fres == NULL) { - ZZLog::Error_Log("Cannot find ps2hw.dat in working directory. Exiting."); - return false; + // Each linux distributions have his rules for path so we give them the possibility to + // change it with compilation flags. -- Gregory +#ifdef PLUGIN_DIR_COMPILATION +#define xPLUGIN_DIR_str(s) PLUGIN_DIR_str(s) +#define PLUGIN_DIR_str(s) #s + fres = fopen( xPLUGIN_DIR_str(PLUGIN_DIR_COMPILATION), "rb"); +#endif + if (fres == NULL) + { + ZZLog::Error_Log("Cannot find ps2hw.dat in working directory. Exiting."); + return false; + } } }