2014-09-14 16:41:26 +00:00
|
|
|
if (openSUSE)
|
|
|
|
# openSUSE don't install wx in a standard library system
|
2014-08-30 21:36:29 +00:00
|
|
|
# path. Let's bypass the dynamic linker and hardcode the path.
|
|
|
|
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH ON)
|
|
|
|
endif()
|
|
|
|
|
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
|
2014-03-30 14:28:59 +00:00
|
|
|
if(EXISTS "${CMAKE_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)
|
2014-03-30 14:28:59 +00:00
|
|
|
endif(EXISTS "${CMAKE_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
|
2010-08-09 19:05:02 +00:00
|
|
|
-DZEROGS_SSE2
|
|
|
|
-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
|
|
|
|
)
|
|
|
|
|
2014-07-12 16:52:27 +00:00
|
|
|
#Clang doesn't support a few common flags that GCC does.
|
|
|
|
if(NOT USE_CLANG)
|
2014-08-04 16:42:40 +00:00
|
|
|
set(zzoglFinalFlags
|
|
|
|
${zzoglFinalFlags}
|
|
|
|
${CommonFlags} -fno-regmove
|
|
|
|
)
|
2014-07-12 16:52:27 +00:00
|
|
|
endif(NOT USE_CLANG)
|
|
|
|
|
2010-05-12 09:51:46 +00:00
|
|
|
if(CMAKE_BUILD_TYPE STREQUAL Debug)
|
2014-08-04 16:42:40 +00:00
|
|
|
set(zzoglFinalFlags
|
|
|
|
${zzoglFinalFlags}
|
|
|
|
${CommonFlags} -g -Wall -D_DEBUG
|
|
|
|
)
|
2014-12-14 13:00:20 +00:00
|
|
|
elseif(CMAKE_BUILD_TYPE STREQUAL Devel)
|
2014-08-04 16:42:40 +00:00
|
|
|
set(zzoglFinalFlags
|
|
|
|
${zzoglFinalFlags}
|
2015-08-08 13:25:17 +00:00
|
|
|
${CommonFlags} -g -W -DZEROGS_DEVBUILD
|
2014-08-04 16:42:40 +00:00
|
|
|
)
|
2014-12-14 13:00:20 +00:00
|
|
|
elseif(CMAKE_BUILD_TYPE STREQUAL Release)
|
2014-08-04 16:42:40 +00:00
|
|
|
set(zzoglFinalFlags
|
|
|
|
${zzoglFinalFlags}
|
2015-08-08 13:25:17 +00:00
|
|
|
${CommonFlags} -W
|
2014-08-04 16:42:40 +00:00
|
|
|
)
|
2014-12-14 13:00:20 +00:00
|
|
|
endif()
|
2010-05-12 09:51:46 +00:00
|
|
|
|
2012-04-19 21:22:08 +00:00
|
|
|
# Select the shader API
|
|
|
|
if(GLSL_API)
|
2014-08-04 16:42:40 +00:00
|
|
|
set(zzoglFinalFlags
|
|
|
|
${zzoglFinalFlags}
|
|
|
|
-DGLSL4_API -DOGL4_LOG
|
|
|
|
)
|
|
|
|
#-DGLSL_API
|
2012-04-19 21:22:08 +00:00
|
|
|
else(GLSL_API)
|
2014-08-04 16:42:40 +00:00
|
|
|
set(zzoglFinalFlags
|
|
|
|
${zzoglFinalFlags}
|
|
|
|
-DNVIDIA_CG_API
|
|
|
|
)
|
2012-04-19 21:22:08 +00:00
|
|
|
endif(GLSL_API)
|
|
|
|
|
2012-09-23 18:52:44 +00:00
|
|
|
# Select the EGL API
|
2012-10-23 19:59:00 +00:00
|
|
|
if(EGL_API AND EGL_FOUND)
|
|
|
|
if (EGL_GL_CONTEXT_SUPPORT)
|
2014-08-04 16:42:40 +00:00
|
|
|
set(zzoglFinalFlags
|
|
|
|
${zzoglFinalFlags}
|
|
|
|
-DEGL_API
|
|
|
|
)
|
2012-10-23 19:59:00 +00:00
|
|
|
else()
|
|
|
|
message(WARNING "Current EGL implementation doesn't support openGL context. Fallback to standard GLX.")
|
|
|
|
endif()
|
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
|
2013-07-06 09:42:46 +00:00
|
|
|
ps2hw_gl4.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)
|
|
|
|
|
2014-08-04 16:42:40 +00:00
|
|
|
set(zzoglFinalSources
|
2010-05-12 09:51:46 +00:00
|
|
|
${zzoglSources}
|
|
|
|
${zzoglHeaders}
|
|
|
|
${zzoglShaderSources}
|
|
|
|
${zzoglLinuxSources}
|
2014-08-04 16:42:40 +00:00
|
|
|
${zzoglLinuxHeaders}
|
|
|
|
)
|
2010-05-12 09:51:46 +00:00
|
|
|
|
2014-08-04 16:42:40 +00:00
|
|
|
set(zzoglFinalLibs
|
2014-12-08 21:26:46 +00:00
|
|
|
Utilities_NO_TLS
|
2014-08-04 16:42:40 +00:00
|
|
|
${OPENGL_LIBRARIES}
|
|
|
|
)
|
2012-04-07 21:23:01 +00:00
|
|
|
|
2014-08-04 16:42:40 +00:00
|
|
|
# add additional include directories
|
|
|
|
include_directories(Linux)
|
|
|
|
|
|
|
|
# Generate Glsl header file. Protect with REBUILD_SHADER to avoid build-dependency on PERL
|
|
|
|
if (REBUILD_SHADER)
|
|
|
|
add_custom_command(OUTPUT ps2hw_gl4.h COMMAND perl ${CMAKE_SOURCE_DIR}/linux_various/glsl2h.pl)
|
|
|
|
endif()
|
2010-05-12 09:51:46 +00:00
|
|
|
|
2013-07-06 09:42:46 +00:00
|
|
|
if(EGL_API AND EGL_FOUND AND EGL_GL_CONTEXT_SUPPORT)
|
2014-08-04 16:42:40 +00:00
|
|
|
set(zzoglFinalLibs
|
|
|
|
${zzoglFinalLibs}
|
|
|
|
${EGL_LIBRARIES}
|
|
|
|
)
|
2013-07-06 09:42:46 +00:00
|
|
|
endif()
|
2014-08-04 16:42:40 +00:00
|
|
|
|
2012-05-01 10:54:52 +00:00
|
|
|
if(NOT GLSL_API)
|
2014-08-04 16:42:40 +00:00
|
|
|
set(zzoglFinalLibs
|
|
|
|
${zzoglFinalLibs}
|
|
|
|
${CG_LIBRARIES}
|
|
|
|
)
|
2012-05-01 10:54:52 +00:00
|
|
|
endif(NOT GLSL_API)
|
2010-05-12 09:51:46 +00:00
|
|
|
|
2014-08-04 16:42:40 +00:00
|
|
|
set(zzoglFinalLibs
|
|
|
|
${zzoglFinalLibs}
|
|
|
|
${GLEW_LIBRARY}
|
|
|
|
${X11_LIBRARIES}
|
|
|
|
${JPEG_LIBRARIES}
|
|
|
|
${GTK2_LIBRARIES}
|
|
|
|
${ZLIB_LIBRARIES}
|
|
|
|
${LIBC_LIBRARIES}
|
|
|
|
)
|
2010-09-15 16:54:19 +00:00
|
|
|
|
2014-08-04 16:42:40 +00:00
|
|
|
add_pcsx2_plugin(${Output} "${zzoglFinalSources}" "${zzoglFinalLibs}" "${zzoglFinalFlags}")
|
2012-04-16 15:36:16 +00:00
|
|
|
|
2014-08-04 16:42:40 +00:00
|
|
|
# Trick that allow to compile zzogl with GSOPEN2 and the replayer with GSOPEN
|
|
|
|
set_target_properties(${Output} PROPERTIES COMPILE_DEFINITIONS USE_GSOPEN2)
|
2013-07-06 09:42:46 +00:00
|
|
|
|
|
|
|
if(NOT GLSL_API AND NOT REBUILD_SHADER)
|
|
|
|
if(PACKAGE_MODE)
|
2014-03-30 14:28:59 +00:00
|
|
|
install(FILES ${CMAKE_SOURCE_DIR}/plugins/zzogl-pg/opengl/ps2hw.dat DESTINATION ${PLUGIN_DIR})
|
2013-07-06 09:42:46 +00:00
|
|
|
else()
|
2014-03-30 14:28:59 +00:00
|
|
|
install(FILES ${CMAKE_SOURCE_DIR}/plugins/zzogl-pg/opengl/ps2hw.dat DESTINATION ${CMAKE_SOURCE_DIR}/bin/plugins)
|
2013-07-06 09:42:46 +00:00
|
|
|
endif()
|
|
|
|
endif()
|
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)
|
2014-08-04 16:42:40 +00:00
|
|
|
set(zzoglReplayLoaderFinalSources
|
|
|
|
${zzoglFinalSources}
|
|
|
|
linux_replay.cpp
|
|
|
|
)
|
|
|
|
add_pcsx2_executable(${Replay} "${zzoglReplayLoaderFinalSources}" "${zzoglFinalLibs}" "${zzoglFinalFlags}")
|
2012-05-01 10:54:52 +00:00
|
|
|
endif(BUILD_REPLAY_LOADERS)
|