2010-06-22 13:30:36 +00:00
|
|
|
# Check that people use the good file
|
|
|
|
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)
|
|
|
|
|
2012-04-17 17:06:58 +00:00
|
|
|
# Allow to build the shader files
|
2012-05-01 10:54:52 +00:00
|
|
|
if(EXISTS "${PROJECT_SOURCE_DIR}/plugins/zzogl-pg/opengl/ZeroGSShaders" AND REBUILD_SHADER AND NOT GLSL_API)
|
2012-04-17 17:06:58 +00:00
|
|
|
add_subdirectory(ZeroGSShaders)
|
2012-05-01 10:54:52 +00:00
|
|
|
endif(EXISTS "${PROJECT_SOURCE_DIR}/plugins/zzogl-pg/opengl/ZeroGSShaders" AND REBUILD_SHADER AND NOT GLSL_API)
|
2010-05-12 09:51:46 +00:00
|
|
|
|
|
|
|
# plugin name
|
2012-04-19 21:53:00 +00:00
|
|
|
set(Output zzogl-0.4.0)
|
2010-05-12 09:51:46 +00:00
|
|
|
|
2010-05-13 11:03:39 +00:00
|
|
|
set(CommonFlags
|
|
|
|
-pthread
|
2010-08-09 19:05:02 +00:00
|
|
|
-DZEROGS_SSE2
|
|
|
|
-fno-regmove
|
|
|
|
-fno-strict-aliasing
|
2010-09-15 16:54:19 +00:00
|
|
|
-Wstrict-aliasing # Allow to track strict aliasing issue.
|
2010-05-13 11:03:39 +00:00
|
|
|
-Wunused-variable
|
|
|
|
)
|
|
|
|
|
2010-06-03 15:12:29 +00:00
|
|
|
set(OptimizationFlags
|
|
|
|
-O2
|
2010-06-05 11:56:52 +00:00
|
|
|
-DNDEBUG
|
2010-06-03 15:12:29 +00:00
|
|
|
)
|
2010-05-13 11:03:39 +00:00
|
|
|
|
2010-05-12 09:51:46 +00:00
|
|
|
# Debug - Build
|
|
|
|
if(CMAKE_BUILD_TYPE STREQUAL Debug)
|
|
|
|
# add defines
|
2012-05-07 19:51:58 +00:00
|
|
|
add_definitions(${CommonFlags} -g -Wall -D_DEBUG)
|
2010-05-12 09:51:46 +00:00
|
|
|
endif(CMAKE_BUILD_TYPE STREQUAL Debug)
|
|
|
|
|
|
|
|
# Devel - Build
|
|
|
|
if(CMAKE_BUILD_TYPE STREQUAL Devel)
|
|
|
|
# add defines
|
2010-06-03 15:12:29 +00:00
|
|
|
add_definitions(${CommonFlags} ${OptimizationFlags} -g -W -DZEROGS_DEVBUILD)
|
2010-05-12 09:51:46 +00:00
|
|
|
endif(CMAKE_BUILD_TYPE STREQUAL Devel)
|
|
|
|
|
|
|
|
# Release - Build
|
|
|
|
if(CMAKE_BUILD_TYPE STREQUAL Release)
|
|
|
|
# add defines
|
2010-06-03 15:12:29 +00:00
|
|
|
add_definitions(${CommonFlags} ${OptimizationFlags} -W)
|
2010-05-12 09:51:46 +00:00
|
|
|
endif(CMAKE_BUILD_TYPE STREQUAL Release)
|
|
|
|
|
2012-04-19 21:22:08 +00:00
|
|
|
# Select the shader API
|
|
|
|
if(GLSL_API)
|
2012-08-08 17:44:03 +00:00
|
|
|
add_definitions(-DGLSL4_API -DOGL4_LOG)
|
2012-05-07 19:51:58 +00:00
|
|
|
#add_definitions(-DGLSL_API)
|
2012-04-19 21:22:08 +00:00
|
|
|
else(GLSL_API)
|
|
|
|
add_definitions(-DNVIDIA_CG_API)
|
|
|
|
endif(GLSL_API)
|
|
|
|
|
2012-09-23 18:52:44 +00:00
|
|
|
# Select the EGL API
|
2012-10-21 18:10:13 +00:00
|
|
|
if(EGL_API AND EGL_GL_CONTEXT_SUPPORT)
|
2012-09-23 18:52:44 +00:00
|
|
|
add_definitions(-DEGL_API)
|
2012-10-21 18:10:13 +00:00
|
|
|
else()
|
|
|
|
message(WARNING "Current EGL implementation doesn't support openGL context. Fallback to standard GLX.")
|
2012-09-23 18:52:44 +00:00
|
|
|
endif()
|
|
|
|
|
2012-04-19 21:22:08 +00:00
|
|
|
|
2010-05-12 09:51:46 +00:00
|
|
|
# zzogl sources
|
|
|
|
set(zzoglSources
|
|
|
|
GifTransfer.cpp
|
|
|
|
GLWin32.cpp
|
|
|
|
GLWinX11.cpp
|
2012-04-07 21:23:01 +00:00
|
|
|
GSDump.cpp
|
2010-05-12 09:51:46 +00:00
|
|
|
GSmain.cpp
|
2010-07-10 08:08:36 +00:00
|
|
|
HostMemory.cpp
|
2010-05-12 09:51:46 +00:00
|
|
|
Mem.cpp
|
|
|
|
Mem_Swizzle.cpp
|
|
|
|
Mem_Tables.cpp
|
|
|
|
Profile.cpp
|
|
|
|
rasterfont.cpp
|
|
|
|
Regs.cpp
|
|
|
|
targets.cpp
|
|
|
|
zerogs.cpp
|
|
|
|
zpipe.cpp
|
2012-04-19 21:22:08 +00:00
|
|
|
ZZDepthTargets.cpp
|
|
|
|
ZZMemoryTargets.cpp
|
|
|
|
ZZRenderTargets.cpp
|
2010-10-20 09:09:31 +00:00
|
|
|
ZZClut.cpp
|
2010-11-07 04:45:10 +00:00
|
|
|
ZZHacks.cpp
|
2010-10-20 09:09:31 +00:00
|
|
|
ZZKeyboard.cpp
|
2010-11-23 03:35:01 +00:00
|
|
|
ZZoglDrawing.cpp
|
2010-10-20 09:09:31 +00:00
|
|
|
ZZLog.cpp
|
2010-05-12 09:51:46 +00:00
|
|
|
ZZoglCreate.cpp
|
|
|
|
ZZoglCRTC.cpp
|
|
|
|
ZZoglFlush.cpp
|
2010-08-17 13:38:57 +00:00
|
|
|
ZZoglFlushHack.cpp
|
2012-04-19 21:22:08 +00:00
|
|
|
ZZoglMem.cpp
|
2010-05-12 09:51:46 +00:00
|
|
|
ZZoglSave.cpp
|
|
|
|
ZZoglShaders.cpp
|
2012-04-19 21:22:08 +00:00
|
|
|
ZZoglShadersGLSL.cpp
|
2012-05-07 19:51:58 +00:00
|
|
|
ZZoglShadersGLSL4.cpp
|
2010-05-12 09:51:46 +00:00
|
|
|
ZZoglShoots.cpp
|
2010-07-02 09:32:04 +00:00
|
|
|
ZZoglVB.cpp
|
2010-10-20 09:09:31 +00:00
|
|
|
)
|
2010-05-12 09:51:46 +00:00
|
|
|
|
|
|
|
# zzogl headers
|
|
|
|
set(zzoglHeaders
|
|
|
|
common.h
|
2010-06-11 11:48:07 +00:00
|
|
|
CRC.h
|
2010-05-12 09:51:46 +00:00
|
|
|
GifTransfer.h
|
2010-10-15 09:32:41 +00:00
|
|
|
# glprocs.h
|
2010-05-12 09:51:46 +00:00
|
|
|
GS.h
|
2012-04-07 21:23:01 +00:00
|
|
|
GSDump.h
|
2010-10-17 10:03:12 +00:00
|
|
|
HostMemory.h
|
2010-05-12 09:51:46 +00:00
|
|
|
Mem.h
|
|
|
|
Mem_Swizzle.h
|
|
|
|
Mem_Transmit.h
|
|
|
|
Profile.h
|
|
|
|
rasterfont.h
|
|
|
|
Regs.h
|
|
|
|
targets.h
|
|
|
|
Util.h
|
|
|
|
x86.h
|
|
|
|
zerogs.h
|
2010-06-28 19:46:54 +00:00
|
|
|
zpipe.h
|
2010-10-20 09:09:31 +00:00
|
|
|
ZZClut.h
|
2012-04-19 21:22:08 +00:00
|
|
|
ZZoglFlush.h
|
2010-10-20 09:09:31 +00:00
|
|
|
ZZGl.h
|
2010-11-07 04:45:10 +00:00
|
|
|
ZZHacks.h
|
2010-11-23 03:35:01 +00:00
|
|
|
ZZoglDrawing.h
|
2010-10-20 09:09:31 +00:00
|
|
|
ZZLog.h
|
|
|
|
ZZoglCRTC.h
|
2010-09-19 08:01:48 +00:00
|
|
|
ZZoglMath.h
|
2012-04-19 21:22:08 +00:00
|
|
|
ZZoglMem.h
|
2010-09-15 16:54:19 +00:00
|
|
|
ZZoglShaders.h
|
2010-10-17 09:07:16 +00:00
|
|
|
ZZoglShoots.h
|
2010-10-23 08:15:39 +00:00
|
|
|
ZZoglVB.h
|
2010-10-20 09:09:31 +00:00
|
|
|
)
|
2010-05-12 09:51:46 +00:00
|
|
|
|
|
|
|
# zzogl shader sources
|
|
|
|
set(zzoglShaderSources
|
|
|
|
ctx0/ps2hw_ctx.fx
|
|
|
|
ctx1/ps2hw_ctx.fx)
|
|
|
|
|
|
|
|
# zzogl Linux sources
|
|
|
|
set(zzoglLinuxSources
|
|
|
|
Linux/Conf.cpp
|
|
|
|
Linux/Linux.cpp)
|
|
|
|
|
|
|
|
# zzogl Linux headers
|
|
|
|
set(zzoglLinuxHeaders
|
|
|
|
Linux/Linux.h)
|
|
|
|
|
|
|
|
# add additional include directories
|
|
|
|
include_directories(.
|
|
|
|
Linux)
|
|
|
|
|
|
|
|
# add library
|
2010-07-25 13:54:26 +00:00
|
|
|
add_library(${Output} SHARED
|
2010-05-12 09:51:46 +00:00
|
|
|
${zzoglSources}
|
|
|
|
${zzoglHeaders}
|
|
|
|
${zzoglShaderSources}
|
|
|
|
${zzoglLinuxSources}
|
|
|
|
${zzoglLinuxHeaders})
|
|
|
|
|
2012-04-07 21:23:01 +00:00
|
|
|
# Trick that allow to compile zzogl with GSOPEN2 and the replayer with GSOPEN
|
|
|
|
set_target_properties(${Output} PROPERTIES COMPILE_DEFINITIONS USE_GSOPEN2)
|
|
|
|
|
2010-05-12 09:51:46 +00:00
|
|
|
# link target with project internal libraries
|
2010-07-25 13:54:26 +00:00
|
|
|
target_link_libraries(${Output} Utilities)
|
2010-05-12 09:51:46 +00:00
|
|
|
|
|
|
|
# link target with Cg
|
2012-05-01 10:54:52 +00:00
|
|
|
if(NOT GLSL_API)
|
2012-04-19 21:22:08 +00:00
|
|
|
target_link_libraries(${Output} ${CG_LIBRARIES})
|
2012-05-01 10:54:52 +00:00
|
|
|
endif(NOT GLSL_API)
|
2010-05-12 09:51:46 +00:00
|
|
|
|
|
|
|
# link target with glew
|
2010-07-25 13:54:26 +00:00
|
|
|
target_link_libraries(${Output} ${GLEW_LIBRARY})
|
2010-05-12 09:51:46 +00:00
|
|
|
|
|
|
|
# link target with opengl
|
2010-07-25 13:54:26 +00:00
|
|
|
target_link_libraries(${Output} ${OPENGL_LIBRARIES})
|
2012-10-21 18:10:13 +00:00
|
|
|
if (EGL_API AND EGL_GL_CONTEXT_SUPPORT)
|
2012-09-23 18:52:44 +00:00
|
|
|
target_link_libraries(${Output} ${EGL_LIBRARIES})
|
|
|
|
endif()
|
2010-05-12 09:51:46 +00:00
|
|
|
|
|
|
|
# link target with X11
|
2010-07-25 13:54:26 +00:00
|
|
|
target_link_libraries(${Output} ${X11_LIBRARIES})
|
2010-05-12 09:51:46 +00:00
|
|
|
|
2010-09-15 16:54:19 +00:00
|
|
|
# link target with jpeg
|
|
|
|
target_link_libraries(${Output} ${JPEG_LIBRARIES})
|
|
|
|
|
2012-04-16 15:36:16 +00:00
|
|
|
if(Linux)
|
|
|
|
# link target with gtk2
|
|
|
|
target_link_libraries(${Output} ${GTK2_LIBRARIES})
|
|
|
|
endif(Linux)
|
|
|
|
|
|
|
|
# link target with zlib
|
|
|
|
target_link_libraries(${Output} ${ZLIB_LIBRARIES})
|
|
|
|
|
2010-07-25 14:20:03 +00:00
|
|
|
# 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 "")
|
2011-07-14 09:02:37 +00:00
|
|
|
|
|
|
|
if(PACKAGE_MODE)
|
2011-07-17 11:25:17 +00:00
|
|
|
install(TARGETS ${Output} DESTINATION ${PLUGIN_DIR})
|
2012-04-19 21:22:08 +00:00
|
|
|
if(GLSL_API)
|
2012-05-07 19:51:58 +00:00
|
|
|
install(FILES ${PROJECT_SOURCE_DIR}/plugins/zzogl-pg/opengl/ps2hw.glsl DESTINATION ${GLSL_SHADER_DIR})
|
|
|
|
install(FILES ${PROJECT_SOURCE_DIR}/plugins/zzogl-pg/opengl/ps2hw_gl4.glsl DESTINATION ${GLSL_SHADER_DIR})
|
2012-04-19 21:22:08 +00:00
|
|
|
else(GLSL_API)
|
2012-05-01 10:54:52 +00:00
|
|
|
if(NOT REBUILD_SHADER)
|
|
|
|
install(FILES ${PROJECT_SOURCE_DIR}/plugins/zzogl-pg/opengl/ps2hw.dat DESTINATION ${PLUGIN_DIR})
|
|
|
|
endif(NOT REBUILD_SHADER)
|
2012-04-19 21:22:08 +00:00
|
|
|
endif(GLSL_API)
|
2011-07-14 09:02:37 +00:00
|
|
|
else(PACKAGE_MODE)
|
|
|
|
install(TARGETS ${Output} DESTINATION ${CMAKE_SOURCE_DIR}/bin/plugins)
|
2012-04-19 21:22:08 +00:00
|
|
|
if(GLSL_API)
|
|
|
|
install(FILES ${PROJECT_SOURCE_DIR}/plugins/zzogl-pg/opengl/ps2hw.glsl DESTINATION ${CMAKE_SOURCE_DIR}/bin/plugins)
|
2012-05-07 19:51:58 +00:00
|
|
|
install(FILES ${PROJECT_SOURCE_DIR}/plugins/zzogl-pg/opengl/ps2hw_gl4.glsl DESTINATION ${CMAKE_SOURCE_DIR}/bin/plugins)
|
2012-04-19 21:22:08 +00:00
|
|
|
else(GLSL_API)
|
2012-05-01 10:54:52 +00:00
|
|
|
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)
|
2012-04-19 21:22:08 +00:00
|
|
|
endif(GLSL_API)
|
2011-07-14 09:02:37 +00:00
|
|
|
endif(PACKAGE_MODE)
|
2012-04-07 21:23:01 +00:00
|
|
|
|
|
|
|
################################### Replay Loader
|
2012-05-01 10:54:52 +00:00
|
|
|
if(BUILD_REPLAY_LOADERS)
|
|
|
|
set(Replay pcsx2_ZZReplayLoader)
|
|
|
|
set(Static zzogl-static)
|
|
|
|
|
|
|
|
add_library(${Static} STATIC
|
|
|
|
${zzoglSources}
|
|
|
|
${zzoglHeaders}
|
|
|
|
${zzoglSSources}
|
|
|
|
${zzoglShaderSources}
|
|
|
|
${zzoglLinuxSources}
|
|
|
|
${zzoglLinuxHeaders})
|
|
|
|
|
|
|
|
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})
|
2012-10-21 18:10:13 +00:00
|
|
|
if (EGL_API AND EGL_GL_CONTEXT_SUPPORT)
|
2012-09-23 18:52:44 +00:00
|
|
|
target_link_libraries(${Static} ${EGL_LIBRARIES})
|
|
|
|
endif()
|
2012-05-01 10:54:52 +00:00
|
|
|
target_link_libraries(${Static} ${X11_LIBRARIES})
|
|
|
|
target_link_libraries(${Static} ${JPEG_LIBRARIES})
|
|
|
|
|
|
|
|
add_executable(${Replay} linux_replay.cpp)
|
|
|
|
|
|
|
|
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})
|
|
|
|
|
|
|
|
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)
|
|
|
|
endif(BUILD_REPLAY_LOADERS)
|