cmake: add a bunch of Micove patch. Thanks.

* Add 2 new dev options: REBUILD_SHADER (nvidia cg) & BUILD_REPLAY_LOADERS
* zzogl-pg-cg will use the shader of zzogl-pg.


git-svn-id: http://pcsx2.googlecode.com/svn/trunk@5190 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
gregory.hainaut 2012-05-01 10:54:52 +00:00
parent 8396c49eb5
commit bce948d820
9 changed files with 149 additions and 135 deletions

View File

@ -2,6 +2,8 @@
# Use Release/Devel/Debug : -DCMAKE_BUILD_TYPE=Release|Devel|Debug
# Enable/disable the stripping : -DCMAKE_BUILD_STRIP=TRUE|FALSE
# generation .po based on src : -DCMAKE_BUILD_PO=TRUE|FALSE
# Rebuild the ps2hw.dat file : -DREBUILD_SHADER=TRUE
# Build the Replay Loaders : -DBUILD_REPLAY_LOADERS=TRUE|FALSE
### Force the choice of 3rd party library in pcsx2 over system libraries
# Use all internal lib: -DFORCE_INTERNAL_ALL=TRUE
@ -191,3 +193,17 @@ endif(PACKAGE_MODE)
if(NOT DEFINED GLSL_API)
set(GLSL_API FALSE)
endif(NOT DEFINED GLSL_API)
#-------------------------------------------------------------------------------
# Use the precompiled shader file by default
#-------------------------------------------------------------------------------
if(NOT DEFINED REBUILD_SHADER)
set(REBUILD_SHADER FALSE)
endif(NOT DEFINED REBUILD_SHADER)
#-------------------------------------------------------------------------------
# Build the replay loaders by default
#-------------------------------------------------------------------------------
if(NOT DEFINED BUILD_REPLAY_LOADERS)
set(BUILD_REPLAY_LOADERS TRUE)
endif(NOT DEFINED BUILD_REPLAY_LOADERS)

View File

@ -53,7 +53,7 @@ if(NOT FORCE_INTERNAL_ZLIB)
endif(NOT FORCE_INTERNAL_ZLIB)
## Use pcsx2 package to find module
## Include cg because of zzogl-cg
## Include cg because of zzogl-cg and zerogs
#if(NOT GLSL_API)
include(FindCg)
#endif(NOT GLSL_API)

View File

@ -5,16 +5,16 @@ set(msg_dep_common_libs "check these libraries -> wxWidgets (>=2.8.10), sparseha
set(msg_dep_pcsx2 "check these libraries -> wxWidgets (>=2.8.10), gtk2 (>=2.16), zlib (>=1.2.4), pcsx2 common libs")
set(msg_dep_cdvdiso "check these libraries -> bzip2 (>=1.0.5), gtk2 (>=2.16)")
set(msg_dep_zerogs "check these libraries -> glew (>=1.5), opengl, X11, nvidia-cg-toolkit (>=2.1)")
set(msg_dep_gsdx "check these libraries -> opengl, X11, pcsx2 SDL")
set(msg_dep_gsdx "check these libraries -> opengl, X11")
set(msg_dep_onepad "check these libraries -> sdl (>=1.2)")
set(msg_dep_zeropad "check these libraries -> sdl (>=1.2)")
set(msg_dep_spu2x "check these libraries -> soundtouch (>=1.5), alsa, portaudio (>=1.9), pcsx2 common libs")
set(msg_dep_zerospu2 "check these libraries -> soundtouch (>=1.5), alsa")
if(GLSP_API)
if(GLSL_API)
set(msg_dep_zzogl "check these libraries -> glew (>=1.5), jpeg (>=6.2), opengl, X11, pcsx2 common libs")
else(GLSP_API)
else(GLSL_API)
set(msg_dep_zzogl "check these libraries -> glew (>=1.5), jpeg (>=6.2), opengl, X11, nvidia-cg-toolkit (>=2.1), pcsx2 common libs")
endif(GLSP_API)
endif(GLSL_API)
#-------------------------------------------------------------------------------
# Pcsx2 core & common libs
@ -163,8 +163,15 @@ endif(GLEW_FOUND AND OPENGL_FOUND AND X11_FOUND AND CG_FOUND)
#---------------------------------------
if((GLEW_FOUND AND OPENGL_FOUND AND X11_FOUND AND JPEG_FOUND AND common_libs) AND (CG_FOUND OR GLSL_API))
set(zzogl TRUE)
if(CG_FOUND AND NOT GLSL_API)
set(zzoglcg TRUE)
else(CG_FOUND AND NOT GLSL_API)
set(zzoglcg FALSE)
endif(CG_FOUND AND NOT GLSL_API)
else((GLEW_FOUND AND OPENGL_FOUND AND X11_FOUND AND JPEG_FOUND AND common_libs) AND (CG_FOUND OR GLSL_API))
set(zzogl FALSE)
set(zzoglcg FALSE)
set(REBUILD_SHADER FALSE)
message(STATUS "Skip build of zzogl: miss some dependencies")
message(STATUS "${msg_dep_zzogl}")
endif((GLEW_FOUND AND OPENGL_FOUND AND X11_FOUND AND JPEG_FOUND AND common_libs) AND (CG_FOUND OR GLSL_API))

View File

@ -117,9 +117,9 @@ if(EXISTS "${PROJECT_SOURCE_DIR}/plugins/zzogl-pg" AND zzogl)
endif(EXISTS "${PROJECT_SOURCE_DIR}/plugins/zzogl-pg" AND zzogl)
# make zzogl-pg
if(EXISTS "${PROJECT_SOURCE_DIR}/plugins/zzogl-pg-cg" AND zzogl)
if(EXISTS "${PROJECT_SOURCE_DIR}/plugins/zzogl-pg-cg" AND zzoglcg AND EXISTS "${PROJECT_SOURCE_DIR}/plugins/zzogl-pg" AND zzogl)
add_subdirectory(zzogl-pg-cg/opengl)
endif(EXISTS "${PROJECT_SOURCE_DIR}/plugins/zzogl-pg-cg" AND zzogl)
endif(EXISTS "${PROJECT_SOURCE_DIR}/plugins/zzogl-pg-cg" AND zzoglcg AND EXISTS "${PROJECT_SOURCE_DIR}/plugins/zzogl-pg" AND zzogl)
# make zeropad
if(EXISTS "${PROJECT_SOURCE_DIR}/plugins/zeropad" AND zeropad)

View File

@ -212,42 +212,44 @@ else(PACKAGE_MODE)
endif(PACKAGE_MODE)
################################### Replay Loader
set(Replay pcsx2_GSReplayLoader)
set(Static GSdx-static)
if(BUILD_REPLAY_LOADERS)
set(Replay pcsx2_GSReplayLoader)
set(Static GSdx-static)
# We can have separate option for gsdx inside the player. It will only
# cost a 2nd rebuild of gsdx...
#add_definitions(${CommonFlags} ${SDLFlags} ${OptimizationFlags} -W)
# We can have separate option for gsdx inside the player. It will only
# cost a 2nd rebuild of gsdx...
#add_definitions(${CommonFlags} ${SDLFlags} ${OptimizationFlags} -W)
add_library(${Static} STATIC ${GSdxSources} ${GSdxHeaders})
add_library(${Static} STATIC ${GSdxSources} ${GSdxHeaders})
add_executable(${Replay} linux_replay.cpp)
add_executable(${Replay} linux_replay.cpp)
target_link_libraries(${Static} ${OPENGL_LIBRARIES})
target_link_libraries(${Static} ${X11_LIBRARIES})
target_link_libraries(${Static} ${GLEW_LIBRARY})
target_link_libraries(${Static} ${GTK2_LIBRARIES})
if(projectSDL)
target_link_libraries(${Static} ${SDL_LIBRARY})
endif(projectSDL)
target_link_libraries(${Static} ${OPENGL_LIBRARIES})
target_link_libraries(${Static} ${X11_LIBRARIES})
target_link_libraries(${Static} ${GLEW_LIBRARY})
target_link_libraries(${Static} ${GTK2_LIBRARIES})
if(projectSDL)
target_link_libraries(${Static} ${SDL_LIBRARY})
endif(projectSDL)
target_link_libraries(${Replay} ${Static})
# Warning others lib must be linked after GSdx...
target_link_libraries(${Replay} ${OPENGL_LIBRARIES})
target_link_libraries(${Replay} ${X11_LIBRARIES})
target_link_libraries(${Replay} ${GLEW_LIBRARY})
target_link_libraries(${Replay} ${GTK2_LIBRARIES})
if(projectSDL)
target_link_libraries(${Replay} ${SDL_LIBRARY})
endif(projectSDL)
target_link_libraries(${Replay} ${Static})
# Warning others lib must be linked after GSdx...
target_link_libraries(${Replay} ${OPENGL_LIBRARIES})
target_link_libraries(${Replay} ${X11_LIBRARIES})
target_link_libraries(${Replay} ${GLEW_LIBRARY})
target_link_libraries(${Replay} ${GTK2_LIBRARIES})
if(projectSDL)
target_link_libraries(${Replay} ${SDL_LIBRARY})
endif(projectSDL)
if(NOT USER_CMAKE_LD_FLAGS STREQUAL "")
target_link_libraries(${Replay} "${USER_CMAKE_LD_FLAGS}")
endif(NOT USER_CMAKE_LD_FLAGS STREQUAL "")
if(NOT USER_CMAKE_LD_FLAGS STREQUAL "")
target_link_libraries(${Replay} "${USER_CMAKE_LD_FLAGS}")
endif(NOT USER_CMAKE_LD_FLAGS STREQUAL "")
if(PACKAGE_MODE)
install(TARGETS ${Replay} DESTINATION bin)
else(PACKAGE_MODE)
install(TARGETS ${Replay} DESTINATION ${CMAKE_SOURCE_DIR}/bin)
endif(PACKAGE_MODE)
if(PACKAGE_MODE)
install(TARGETS ${Replay} DESTINATION bin)
else(PACKAGE_MODE)
install(TARGETS ${Replay} DESTINATION ${CMAKE_SOURCE_DIR}/bin)
endif(PACKAGE_MODE)
endif(BUILD_REPLAY_LOADERS)

View File

@ -5,11 +5,6 @@ if(NOT TOP_CMAKE_WAS_SOURCED)
It is advice to delete all wrongly generated cmake stuff => CMakeFiles & CMakeCache.txt")
endif(NOT TOP_CMAKE_WAS_SOURCED)
# Allow to build the shader files
if(EXISTS "${PROJECT_SOURCE_DIR}/plugins/zzogl-pg/opengl/ZeroGSShaders")
add_subdirectory(ZeroGSShaders)
endif(EXISTS "${PROJECT_SOURCE_DIR}/plugins/zzogl-pg/opengl/ZeroGSShaders")
# plugin name
set(Output zzogl-cg-0.3.0)
@ -183,50 +178,50 @@ endif(NOT USER_CMAKE_LD_FLAGS STREQUAL "")
if(PACKAGE_MODE)
install(TARGETS ${Output} DESTINATION ${PLUGIN_DIR})
install(FILES ${PROJECT_SOURCE_DIR}/plugins/zzogl-pg/opengl/ps2hw.dat DESTINATION ${PLUGIN_DIR})
else(PACKAGE_MODE)
install(TARGETS ${Output} DESTINATION ${CMAKE_SOURCE_DIR}/bin/plugins)
install(FILES ${PROJECT_SOURCE_DIR}/plugins/zzogl-pg/opengl/ps2hw.dat DESTINATION ${CMAKE_SOURCE_DIR}/bin/plugins)
endif(PACKAGE_MODE)
################################### Replay Loader
set(Replay pcsx2_ZZCGReplayLoader)
set(Static zzogl-cg-static)
if(BUILD_REPLAY_LOADERS)
set(Replay pcsx2_ZZCGReplayLoader)
set(Static zzogl-cg-static)
add_library(${Static} STATIC
${zzoglSources}
${zzoglHeaders}
${zzoglSSources}
${zzoglShaderSources}
${zzoglLinuxSources}
${zzoglLinuxHeaders})
add_library(${Static} STATIC
${zzoglSources}
${zzoglHeaders}
${zzoglSSources}
${zzoglShaderSources}
${zzoglLinuxSources}
${zzoglLinuxHeaders})
target_link_libraries(${Static} Utilities)
target_link_libraries(${Static} ${CG_LIBRARIES})
target_link_libraries(${Static} ${GLEW_LIBRARY})
target_link_libraries(${Static} ${OPENGL_LIBRARIES})
target_link_libraries(${Static} ${X11_LIBRARIES})
target_link_libraries(${Static} ${JPEG_LIBRARIES})
target_link_libraries(${Static} Utilities)
target_link_libraries(${Static} ${CG_LIBRARIES})
target_link_libraries(${Static} ${GLEW_LIBRARY})
target_link_libraries(${Static} ${OPENGL_LIBRARIES})
target_link_libraries(${Static} ${X11_LIBRARIES})
target_link_libraries(${Static} ${JPEG_LIBRARIES})
add_executable(${Replay} linux_replay.cpp)
add_executable(${Replay} linux_replay.cpp)
target_link_libraries(${Replay} ${Static})
target_link_libraries(${Replay} Utilities)
target_link_libraries(${Replay} ${CG_LIBRARIES})
target_link_libraries(${Replay} ${GLEW_LIBRARY})
target_link_libraries(${Replay} ${OPENGL_LIBRARIES})
target_link_libraries(${Replay} ${X11_LIBRARIES})
target_link_libraries(${Replay} ${JPEG_LIBRARIES})
target_link_libraries(${Replay} ${Static})
target_link_libraries(${Replay} Utilities)
target_link_libraries(${Replay} ${CG_LIBRARIES})
target_link_libraries(${Replay} ${GLEW_LIBRARY})
target_link_libraries(${Replay} ${OPENGL_LIBRARIES})
target_link_libraries(${Replay} ${X11_LIBRARIES})
target_link_libraries(${Replay} ${JPEG_LIBRARIES})
target_link_libraries(${Replay} ${GTK2_LIBRARIES})
target_link_libraries(${Replay} ${ZLIB_LIBRARIES})
target_link_libraries(${Replay} ${GTK2_LIBRARIES})
target_link_libraries(${Replay} ${ZLIB_LIBRARIES})
if(NOT USER_CMAKE_LD_FLAGS STREQUAL "")
target_link_libraries(${Replay} "${USER_CMAKE_LD_FLAGS}")
endif(NOT USER_CMAKE_LD_FLAGS STREQUAL "")
if(NOT USER_CMAKE_LD_FLAGS STREQUAL "")
target_link_libraries(${Replay} "${USER_CMAKE_LD_FLAGS}")
endif(NOT USER_CMAKE_LD_FLAGS STREQUAL "")
if(PACKAGE_MODE)
install(TARGETS ${Replay} DESTINATION bin)
else(PACKAGE_MODE)
install(TARGETS ${Replay} DESTINATION ${CMAKE_SOURCE_DIR}/bin)
endif(PACKAGE_MODE)
if(PACKAGE_MODE)
install(TARGETS ${Replay} DESTINATION bin)
else(PACKAGE_MODE)
install(TARGETS ${Replay} DESTINATION ${CMAKE_SOURCE_DIR}/bin)
endif(PACKAGE_MODE)
endif(BUILD_REPLAY_LOADERS)

View File

@ -59,17 +59,3 @@ target_link_libraries(${Output} ${OPENGL_LIBRARIES})
if(NOT USER_CMAKE_LD_FLAGS STREQUAL "")
target_link_libraries(${Output} "${USER_CMAKE_LD_FLAGS}")
endif(NOT USER_CMAKE_LD_FLAGS STREQUAL "")
# Now build the shader
add_custom_command(TARGET ${Output} POST_BUILD
COMMAND ${Output} ps2hw.fx ${CMAKE_CURRENT_BINARY_DIR}/ps2hw_cmake.dat
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/plugins/zzogl-pg/opengl
)
if(PACKAGE_MODE)
install(TARGETS ${Output} DESTINATION bin)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/ps2hw_cmake.dat DESTINATION ${PLUGIN_DIR})
else(PACKAGE_MODE)
install(TARGETS ${Output} DESTINATION ${CMAKE_SOURCE_DIR}/bin)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/ps2hw_cmake.dat DESTINATION ${CMAKE_SOURCE_DIR}/bin/plugins)
endif(PACKAGE_MODE)

View File

@ -6,9 +6,9 @@ if(NOT TOP_CMAKE_WAS_SOURCED)
endif(NOT TOP_CMAKE_WAS_SOURCED)
# Allow to build the shader files
if(EXISTS "${PROJECT_SOURCE_DIR}/plugins/zzogl-pg/opengl/ZeroGSShaders")
if(EXISTS "${PROJECT_SOURCE_DIR}/plugins/zzogl-pg/opengl/ZeroGSShaders" AND REBUILD_SHADER AND NOT GLSL_API)
add_subdirectory(ZeroGSShaders)
endif(EXISTS "${PROJECT_SOURCE_DIR}/plugins/zzogl-pg/opengl/ZeroGSShaders")
endif(EXISTS "${PROJECT_SOURCE_DIR}/plugins/zzogl-pg/opengl/ZeroGSShaders" AND REBUILD_SHADER AND NOT GLSL_API)
# plugin name
set(Output zzogl-0.4.0)
@ -158,9 +158,9 @@ set_target_properties(${Output} PROPERTIES COMPILE_DEFINITIONS USE_GSOPEN2)
target_link_libraries(${Output} Utilities)
# link target with Cg
if(NOT GLSP_API)
if(NOT GLSL_API)
target_link_libraries(${Output} ${CG_LIBRARIES})
endif(NOT GLSP_API)
endif(NOT GLSL_API)
# link target with glew
target_link_libraries(${Output} ${GLEW_LIBRARY})
@ -192,55 +192,65 @@ if(PACKAGE_MODE)
if(GLSL_API)
install(FILES ${PROJECT_SOURCE_DIR}/plugins/zzogl-pg/opengl/ps2hw.glsl DESTINATION ${PLUGIN_DIR})
else(GLSL_API)
install(FILES ${PROJECT_SOURCE_DIR}/plugins/zzogl-pg/opengl/ps2hw.dat DESTINATION ${PLUGIN_DIR})
if(NOT REBUILD_SHADER)
install(FILES ${PROJECT_SOURCE_DIR}/plugins/zzogl-pg/opengl/ps2hw.dat DESTINATION ${PLUGIN_DIR})
endif(NOT REBUILD_SHADER)
endif(GLSL_API)
else(PACKAGE_MODE)
install(TARGETS ${Output} DESTINATION ${CMAKE_SOURCE_DIR}/bin/plugins)
if(GLSL_API)
install(FILES ${PROJECT_SOURCE_DIR}/plugins/zzogl-pg/opengl/ps2hw.glsl DESTINATION ${CMAKE_SOURCE_DIR}/bin/plugins)
else(GLSL_API)
install(FILES ${PROJECT_SOURCE_DIR}/plugins/zzogl-pg/opengl/ps2hw.dat DESTINATION ${CMAKE_SOURCE_DIR}/bin/plugins)
if(NOT REBUILD_SHADER)
install(FILES ${PROJECT_SOURCE_DIR}/plugins/zzogl-pg/opengl/ps2hw.dat DESTINATION ${CMAKE_SOURCE_DIR}/bin/plugins)
endif(NOT REBUILD_SHADER)
endif(GLSL_API)
endif(PACKAGE_MODE)
################################### Replay Loader
set(Replay pcsx2_ZZReplayLoader)
set(Static zzogl-static)
if(BUILD_REPLAY_LOADERS)
set(Replay pcsx2_ZZReplayLoader)
set(Static zzogl-static)
add_library(${Static} STATIC
${zzoglSources}
${zzoglHeaders}
${zzoglSSources}
${zzoglShaderSources}
${zzoglLinuxSources}
${zzoglLinuxHeaders})
add_library(${Static} STATIC
${zzoglSources}
${zzoglHeaders}
${zzoglSSources}
${zzoglShaderSources}
${zzoglLinuxSources}
${zzoglLinuxHeaders})
target_link_libraries(${Static} Utilities)
target_link_libraries(${Static} ${CG_LIBRARIES})
target_link_libraries(${Static} ${GLEW_LIBRARY})
target_link_libraries(${Static} ${OPENGL_LIBRARIES})
target_link_libraries(${Static} ${X11_LIBRARIES})
target_link_libraries(${Static} ${JPEG_LIBRARIES})
target_link_libraries(${Static} Utilities)
if(NOT GLSL_API)
target_link_libraries(${Static} ${CG_LIBRARIES})
endif(NOT GLSL_API)
target_link_libraries(${Static} ${GLEW_LIBRARY})
target_link_libraries(${Static} ${OPENGL_LIBRARIES})
target_link_libraries(${Static} ${X11_LIBRARIES})
target_link_libraries(${Static} ${JPEG_LIBRARIES})
add_executable(${Replay} linux_replay.cpp)
add_executable(${Replay} linux_replay.cpp)
target_link_libraries(${Replay} ${Static})
target_link_libraries(${Replay} Utilities)
target_link_libraries(${Replay} ${CG_LIBRARIES})
target_link_libraries(${Replay} ${GLEW_LIBRARY})
target_link_libraries(${Replay} ${OPENGL_LIBRARIES})
target_link_libraries(${Replay} ${X11_LIBRARIES})
target_link_libraries(${Replay} ${JPEG_LIBRARIES})
target_link_libraries(${Replay} ${Static})
target_link_libraries(${Replay} Utilities)
if(NOT GLSL_API)
target_link_libraries(${Replay} ${CG_LIBRARIES})
endif(NOT GLSL_API)
target_link_libraries(${Replay} ${GLEW_LIBRARY})
target_link_libraries(${Replay} ${OPENGL_LIBRARIES})
target_link_libraries(${Replay} ${X11_LIBRARIES})
target_link_libraries(${Replay} ${JPEG_LIBRARIES})
target_link_libraries(${Replay} ${GTK2_LIBRARIES})
target_link_libraries(${Replay} ${ZLIB_LIBRARIES})
target_link_libraries(${Replay} ${GTK2_LIBRARIES})
target_link_libraries(${Replay} ${ZLIB_LIBRARIES})
if(NOT USER_CMAKE_LD_FLAGS STREQUAL "")
target_link_libraries(${Replay} "${USER_CMAKE_LD_FLAGS}")
endif(NOT USER_CMAKE_LD_FLAGS STREQUAL "")
if(NOT USER_CMAKE_LD_FLAGS STREQUAL "")
target_link_libraries(${Replay} "${USER_CMAKE_LD_FLAGS}")
endif(NOT USER_CMAKE_LD_FLAGS STREQUAL "")
if(PACKAGE_MODE)
install(TARGETS ${Replay} DESTINATION bin)
else(PACKAGE_MODE)
install(TARGETS ${Replay} DESTINATION ${CMAKE_SOURCE_DIR}/bin)
endif(PACKAGE_MODE)
if(PACKAGE_MODE)
install(TARGETS ${Replay} DESTINATION bin)
else(PACKAGE_MODE)
install(TARGETS ${Replay} DESTINATION ${CMAKE_SOURCE_DIR}/bin)
endif(PACKAGE_MODE)
endif(BUILD_REPLAY_LOADERS)

View File

@ -67,9 +67,7 @@ add_custom_command(TARGET ${Output} POST_BUILD
)
if(PACKAGE_MODE)
install(TARGETS ${Output} DESTINATION bin)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/ps2hw_cmake.dat DESTINATION ${PLUGIN_DIR})
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/ps2hw_cmake.dat DESTINATION ${PLUGIN_DIR} RENAME ps2hw.dat)
else(PACKAGE_MODE)
install(TARGETS ${Output} DESTINATION ${CMAKE_SOURCE_DIR}/bin)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/ps2hw_cmake.dat DESTINATION ${CMAKE_SOURCE_DIR}/bin/plugins)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/ps2hw_cmake.dat DESTINATION ${CMAKE_SOURCE_DIR}/bin/plugins RENAME ps2hw.dat)
endif(PACKAGE_MODE)