pcsx2, zzogl-pg: allow to change some default path with compilation flags.

cmake: Add PLUGIN_DIR and GAMEINDEX_DIR options to easily select install directory. Install GameIndex.dbt during install phase.


git-svn-id: http://pcsx2.googlecode.com/svn/trunk@4811 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
gregory.hainaut@gmail.com 2011-07-17 11:25:17 +00:00
parent 465dbc9203
commit 5adba505e7
17 changed files with 97 additions and 51 deletions

View File

@ -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)

View File

@ -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)

View File

@ -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()

View File

@ -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) {

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -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;
}
}
}