From 20716e13e49afe98ec46b4f358e24688b095adb7 Mon Sep 17 00:00:00 2001 From: uyjulian Date: Mon, 4 Aug 2014 11:01:00 -0500 Subject: [PATCH 1/8] change .gitignore --- .gitignore | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.gitignore b/.gitignore index 66112e2069..692355cfb0 100644 --- a/.gitignore +++ b/.gitignore @@ -20,6 +20,10 @@ postBuild.cmd svnrev.h build + +.DS_Store +Thumbs.db + Debug Release Devel From 5f4fc4701f7d5e0eaa51e108f604cab49c0da051 Mon Sep 17 00:00:00 2001 From: uyjulian Date: Mon, 4 Aug 2014 11:05:13 -0500 Subject: [PATCH 2/8] Add CheckLib.cmake --- cmake/CheckLib.cmake | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 cmake/CheckLib.cmake diff --git a/cmake/CheckLib.cmake b/cmake/CheckLib.cmake new file mode 100644 index 0000000000..6a39847659 --- /dev/null +++ b/cmake/CheckLib.cmake @@ -0,0 +1,36 @@ +include(FindPkgConfig OPTIONAL) + +macro(_internal_message msg) + message("${msg}") +endmacro() + +macro(check_lib var lib) + set(_arg_list ${ARGN}) + + if(PKG_CONFIG_FOUND AND NOT ${var}_FOUND) + string(TOLOWER ${lib} lower_lib) + pkg_search_module(${var} QUIET ${lower_lib}) + endif() + + if(${var}_FOUND) + include_directories(${${var}_INCLUDE_DIRS}) + # Make sure include directories for headers found using find_path below + # are re-added when reconfiguring + include_directories(${${var}_INCLUDE}) + _internal_message("${lib} found") + else() + find_library(${var} ${lib}) + if(_arg_list) + find_path(${var}_INCLUDE ${_arg_list}) + else() + set(${var}_INCLUDE FALSE) + endif() + if(${var} AND ${var}_INCLUDE) + include_directories(${${var}_INCLUDE}) + _internal_message("${lib} found") + set(${var}_FOUND 1 CACHE INTERNAL "") + else() + _internal_message("${lib} not found") + endif() + endif() +endmacro() From dde94da94ff14b8d6ad83b94d1eb253fd1cea46d Mon Sep 17 00:00:00 2001 From: uyjulian Date: Mon, 4 Aug 2014 11:08:00 -0500 Subject: [PATCH 3/8] Add cleaner svnrev.h code, add macros --- cmake/Pcsx2Utils.cmake | 85 +++++++++++++++++++++++++++++++++++------- 1 file changed, 72 insertions(+), 13 deletions(-) diff --git a/cmake/Pcsx2Utils.cmake b/cmake/Pcsx2Utils.cmake index 87edf0c276..ffd5ec6558 100644 --- a/cmake/Pcsx2Utils.cmake +++ b/cmake/Pcsx2Utils.cmake @@ -28,6 +28,7 @@ function(detectOperatingSystem) # check if we are on MacOSX if(APPLE) + message(WARNING "Mac OS X isn't supported, build will most likely fail") set(MacOSX TRUE PARENT_SCOPE) endif(APPLE) @@ -38,23 +39,18 @@ function(detectOperatingSystem) endfunction(detectOperatingSystem) function(write_svnrev_h) + find_package(Git) if (GIT_FOUND) - execute_process(COMMAND git -C ${CMAKE_SOURCE_DIR} show -s --format=%ci HEAD - OUTPUT_VARIABLE tmpvar_WC_INFO + EXECUTE_PROCESS(WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} COMMAND ${GIT_EXECUTABLE} show -s --format=%ci HEAD + OUTPUT_VARIABLE PCSX2_WC_TIME OUTPUT_STRIP_TRAILING_WHITESPACE) - # %2014-03-25 16:36:29 +0100 - string(REGEX REPLACE "[%:\\-]" "" tmpvar_WC_INFO "${tmpvar_WC_INFO}") - string(REGEX REPLACE "([0-9]+) ([0-9]+).*" "\\1\\2" tmpvar_WC_INFO "${tmpvar_WC_INFO}") - - if ("${tmpvar_WC_INFO}" STREQUAL "") - # For people with an older GIT version that migth not support '-C' - file(WRITE ${CMAKE_BINARY_DIR}/common/include/svnrev.h "#define SVN_REV 0ll \n#define SVN_MODS 0") - else() - file(WRITE ${CMAKE_BINARY_DIR}/common/include/svnrev.h "#define SVN_REV ${tmpvar_WC_INFO}ll \n#define SVN_MODS 0") - endif() + # Output: "YYYY-MM-DD HH:MM:SS +HHMM" (last part is time zone, offset from UTC) + string(REGEX REPLACE "[%:\\-]" "" PCSX2_WC_TIME "${PCSX2_WC_TIME}") + string(REGEX REPLACE "([0-9]+) ([0-9]+).*" "\\1\\2" PCSX2_WC_TIME "${PCSX2_WC_TIME}") else() - file(WRITE ${CMAKE_BINARY_DIR}/common/include/svnrev.h "#define SVN_REV_UNKNOWN\n#define SVN_REV 0ll \n#define SVN_MODS 0") + set(PCSX2_WC_TIME 0) endif() + file(WRITE ${CMAKE_BINARY_DIR}/common/include/svnrev.h "#define SVN_REV ${PCSX2_WC_TIME}ll \n#define SVN_MODS 0") endfunction() function(check_compiler_version version_warn version_err) @@ -78,3 +74,66 @@ function(check_no_parenthesis_in_path) message(FATAL_ERROR "Your path contains some parenthesis. Unfortunately Cmake doesn't support them correctly.\nPlease rename your directory to avoid '(' and ')' characters\n") endif() endfunction() + +#NOTE: this macro is used to get rid of whitespace and newlines. +macro(append_flags target flags) + if(flags STREQUAL "") + set(flags " ") # set to space to avoid error + endif() + get_target_property(TEMP ${target} COMPILE_FLAGS) + if(TEMP STREQUAL "TEMP-NOTFOUND") + set(TEMP "") # set to empty string + else() + set(TEMP "${TEMP} ") # a space to cleanly separate from existing content + endif() + # append our values + set(TEMP "${TEMP}${flags}") + # fix arg list + set(TEMP2 "") + foreach(_arg ${TEMP}) + set(TEMP2 "${TEMP2} ${_arg}") + endforeach() + set_target_properties(${target} PROPERTIES COMPILE_FLAGS "${TEMP2}") +endmacro(append_flags) + +macro(add_pcsx2_plugin lib srcs libs flags) + include_directories(.) + add_library(${lib} MODULE ${srcs}) + target_link_libraries(${lib} ${libs}) + append_flags(${lib} "${flags}") + if(NOT USER_CMAKE_LD_FLAGS STREQUAL "") + target_link_libraries(${lib} "${USER_CMAKE_LD_FLAGS}") + endif(NOT USER_CMAKE_LD_FLAGS STREQUAL "") + if(PACKAGE_MODE) + install(TARGETS ${lib} DESTINATION ${PLUGIN_DIR}) + else(PACKAGE_MODE) + install(TARGETS ${lib} DESTINATION ${CMAKE_SOURCE_DIR}/bin/plugins) + endif(PACKAGE_MODE) +endmacro(add_pcsx2_plugin) + +macro(add_pcsx2_lib lib srcs libs flags) + include_directories(.) + add_library(${lib} STATIC ${srcs}) + target_link_libraries(${lib} ${libs}) + append_flags(${lib} "${flags}") + if(NOT USER_CMAKE_LD_FLAGS STREQUAL "") + target_link_libraries(${lib} "${USER_CMAKE_LD_FLAGS}") + endif(NOT USER_CMAKE_LD_FLAGS STREQUAL "") +endmacro(add_pcsx2_lib) + +macro(add_pcsx2_executable exe srcs libs flags) + add_definitions(${flags}) + include_directories(.) + add_executable(${exe} ${srcs}) + target_link_libraries(${exe} ${libs}) + append_flags(${exe} "${flags}") + if(NOT USER_CMAKE_LD_FLAGS STREQUAL "") + target_link_libraries(${lib} "${USER_CMAKE_LD_FLAGS}") + endif(NOT USER_CMAKE_LD_FLAGS STREQUAL "") + if(PACKAGE_MODE) + install(TARGETS ${exe} DESTINATION bin) + else(PACKAGE_MODE) + install(TARGETS ${exe} DESTINATION ${CMAKE_SOURCE_DIR}/bin) + endif(PACKAGE_MODE) +endmacro(add_pcsx2_executable) + From 53e57766c9ad1fe2c49dbff247f3cda72ef2f283 Mon Sep 17 00:00:00 2001 From: uyjulian Date: Mon, 4 Aug 2014 11:15:10 -0500 Subject: [PATCH 4/8] Use CheckLib for some libs --- cmake/SearchForStuff.cmake | 41 +++++++++++++------------------------- 1 file changed, 14 insertions(+), 27 deletions(-) diff --git a/cmake/SearchForStuff.cmake b/cmake/SearchForStuff.cmake index 2b4329c4c8..0f391b1082 100644 --- a/cmake/SearchForStuff.cmake +++ b/cmake/SearchForStuff.cmake @@ -33,17 +33,24 @@ find_package(wxWidgets COMPONENTS base core adv) find_package(ZLIB) ## Use pcsx2 package to find module -include(FindAio) +#include(FindAio) ## Include cg because of zzogl-cg and zerogs #if(NOT GLSL_API) - include(FindCg) -#endif() -include(FindEGL) -include(FindGLES2) +include(FindCg) +#include(FindEGL) +#include(FindGLES2) include(FindGlew) include(FindLibc) -include(FindPortAudio) -include(FindSoundTouch) +#include(FindPortAudio) +#include(FindSoundTouch) + +## Use CheckLib package to find module +include(CheckLib) +check_lib(AIO aio aio.h) +check_lib(EGL egl EGL/egl.h) +check_lib(GLESV2 GLESv2 GLES2/gl2.h) +check_lib(PORTAUDIO portaudio portaudio.h pa_linux_alsa.h) +check_lib(SOUNDTOUCH SoundTouch soundtouch/SoundTouch.h) # Note for include_directory: The order is important to avoid a mess between include file from your system and the one of pcsx2 # If you include first 3rdparty, all 3rdpary include will have a higer priority... @@ -69,10 +76,6 @@ if(Linux) endif() endif() -if(AIO_FOUND) - include_directories(${AIO_INCLUDE_DIR}) -endif() - if(ALSA_FOUND) include_directories(${ALSA_INCLUDE_DIRS}) endif() @@ -85,10 +88,6 @@ if(CG_FOUND) include_directories(${CG_INCLUDE_DIRS}) endif() -if (EGL_FOUND) - include_directories(${EGL_INCLUDE_DIR}) -endif() - if(JPEG_FOUND) include_directories(${JPEG_INCLUDE_DIR}) endif() @@ -97,26 +96,14 @@ if(GLEW_FOUND) include_directories(${GLEW_INCLUDE_DIR}) endif() -if(GLESV2_FOUND) - include_directories(${GLESV2_INCLUDE_DIR}) -endif() - if(OPENGL_FOUND) include_directories(${OPENGL_INCLUDE_DIR}) endif() -if(PORTAUDIO_FOUND) - include_directories(${PORTAUDIO_INCLUDE_DIR}) -endif() - if(SDL_FOUND) include_directories(${SDL_INCLUDE_DIR}) endif() -if(SOUNDTOUCH_FOUND) - include_directories(${SOUNDTOUCH_INCLUDE_DIR}) -endif() - if(wxWidgets_FOUND) if(Linux) # Force the use of 32 bit library configuration on From 82dfed15128b79392b92479047caa428bd0be1cd Mon Sep 17 00:00:00 2001 From: uyjulian Date: Mon, 4 Aug 2014 11:16:36 -0500 Subject: [PATCH 5/8] Remove unneeded Check*.cmake --- cmake/FindAio.cmake | 25 ------------------------- cmake/FindEGL.cmake | 27 --------------------------- cmake/FindGLES2.cmake | 27 --------------------------- cmake/FindPortAudio.cmake | 27 --------------------------- cmake/FindSoundTouch.cmake | 29 ----------------------------- 5 files changed, 135 deletions(-) delete mode 100644 cmake/FindAio.cmake delete mode 100644 cmake/FindEGL.cmake delete mode 100644 cmake/FindGLES2.cmake delete mode 100644 cmake/FindPortAudio.cmake delete mode 100644 cmake/FindSoundTouch.cmake diff --git a/cmake/FindAio.cmake b/cmake/FindAio.cmake deleted file mode 100644 index c3e8f69935..0000000000 --- a/cmake/FindAio.cmake +++ /dev/null @@ -1,25 +0,0 @@ -# Try to find AIO -# Once done, this will define -# -# AIO_FOUND - system has AIO -# AIO_INCLUDE_DIR - the AIO include directories -# AIO_LIBRARIES - link these to use AIO - -if(AIO_INCLUDE_DIR AND AIO_LIBRARIES) - set(AIO_FIND_QUIETLY TRUE) -endif(AIO_INCLUDE_DIR AND AIO_LIBRARIES) - -# include dir -find_path(AIO_INCLUDE_DIR libaio.h) - -# finally the library itself -find_library(LIBAIO NAMES aio) -set(AIO_LIBRARIES ${LIBAIO}) - -# handle the QUIETLY and REQUIRED arguments and set AIO_FOUND to TRUE if -# all listed variables are TRUE -include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(AIO DEFAULT_MSG AIO_LIBRARIES AIO_INCLUDE_DIR) - -mark_as_advanced(AIO_LIBRARIES AIO_INCLUDE_DIR) - diff --git a/cmake/FindEGL.cmake b/cmake/FindEGL.cmake deleted file mode 100644 index ea9bb76db1..0000000000 --- a/cmake/FindEGL.cmake +++ /dev/null @@ -1,27 +0,0 @@ -# Try to find EGL -# Once done, this will define -# -# EGL_FOUND - system has EGL -# EGL_INCLUDE_DIR - the EGL include directories -# EGL_LIBRARIES - link these to use EGL - -if(EGL_INCLUDE_DIR AND EGL_LIBRARIES) - set(EGL_FIND_QUIETLY TRUE) -endif(EGL_INCLUDE_DIR AND EGL_LIBRARIES) - -INCLUDE(CheckCXXSymbolExists) - -# include dir -find_path(EGL_INCLUDE_DIR EGL/eglext.h) - -# finally the library itself -find_library(libEGL NAMES EGL) -set(EGL_LIBRARIES ${libEGL}) - -# handle the QUIETLY and REQUIRED arguments and set EGL_FOUND to TRUE if -# all listed variables are TRUE -include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(EGL DEFAULT_MSG EGL_LIBRARIES EGL_INCLUDE_DIR) - -mark_as_advanced(EGL_LIBRARIES EGL_INCLUDE_DIR) - diff --git a/cmake/FindGLES2.cmake b/cmake/FindGLES2.cmake deleted file mode 100644 index 4bfa9d8477..0000000000 --- a/cmake/FindGLES2.cmake +++ /dev/null @@ -1,27 +0,0 @@ -# Try to find GLESV2 -# Once done, this will define -# -# GLESV2_FOUND - system has GLESV2 -# GLESV2_INCLUDE_DIR - the GLESV2 include directories -# GLESV2_LIBRARIES - link these to use GLESV2 - -if(GLESV2_INCLUDE_DIR AND GLESV2_LIBRARIES) - set(GLESV2_FIND_QUIETLY TRUE) -endif(GLESV2_INCLUDE_DIR AND GLESV2_LIBRARIES) - -INCLUDE(CheckCXXSymbolExists) - -# include dir -find_path(GLESV2_INCLUDE_DIR GLES3/gl3ext.h) - -# finally the library itself -find_library(libGLESV2 NAMES GLESv2) -set(GLESV2_LIBRARIES ${libGLESV2}) - -# handle the QUIETLY and REQUIRED arguments and set GLESV2_FOUND to TRUE if -# all listed variables are TRUE -include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(GLESV2 DEFAULT_MSG GLESV2_LIBRARIES GLESV2_INCLUDE_DIR) - -mark_as_advanced(GLESV2_LIBRARIES GLESV2_INCLUDE_DIR) - diff --git a/cmake/FindPortAudio.cmake b/cmake/FindPortAudio.cmake deleted file mode 100644 index 7a3ef677e4..0000000000 --- a/cmake/FindPortAudio.cmake +++ /dev/null @@ -1,27 +0,0 @@ -# Try to find PortAudio -# Once done, this will define -# -# PORTAUDIO_FOUND - system has PortAudio -# PORTAUDIO_INCLUDE_DIR - the PortAudio include directories -# PORTAUDIO_LIBRARIES - link these to use PortAudio - -if(PORTAUDIO_INCLUDE_DIR AND PORTAUDIO_LIBRARIES) - set(PORTAUDIO_FIND_QUIETLY TRUE) -endif(PORTAUDIO_INCLUDE_DIR AND PORTAUDIO_LIBRARIES) - -# Search both portaudio.h and pa_linux_alsa.h to ensure the user gets -# the include of the V2 API (V1 have only portaudio.h) -find_path(PORTAUDIO_INCLUDE_DIR NAMES portaudio.h pa_linux_alsa.h) - -# finally the library itself -find_library(libPortAudio NAMES portaudio) -# Run OK without libportaudiocpp so do not pull additional dependency -set(PORTAUDIO_LIBRARIES ${libPortAudio}) - -# handle the QUIETLY and REQUIRED arguments and set PORTAUDIO_FOUND to TRUE if -# all listed variables are TRUE -include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(PortAudio DEFAULT_MSG PORTAUDIO_LIBRARIES PORTAUDIO_INCLUDE_DIR) - -mark_as_advanced(PORTAUDIO_LIBRARIES PORTAUDIO_INCLUDE_DIR) - diff --git a/cmake/FindSoundTouch.cmake b/cmake/FindSoundTouch.cmake deleted file mode 100644 index f4a4373f5c..0000000000 --- a/cmake/FindSoundTouch.cmake +++ /dev/null @@ -1,29 +0,0 @@ -# Try to find SoundTouch -# Once done, this will define -# -# SOUNDTOUCH_FOUND - system has SoundTouch -# SOUNDTOUCH_INCLUDE_DIR - the SoundTouch include directories -# SOUNDTOUCH_LIBRARIES - link these to use SoundTouch - -if(SOUNDTOUCH_INCLUDE_DIR AND SOUNDTOUCH_LIBRARIES) - set(SOUNDTOUCH_FIND_QUIETLY TRUE) -endif(SOUNDTOUCH_INCLUDE_DIR AND SOUNDTOUCH_LIBRARIES) - -# include dir -#find_path(SOUNDTOUCH_INCLUDE_DIR SoundTouch.h -# /usr/include/soundtouch -# /usr/local/include/soundtouch -# ) -find_path(SOUNDTOUCH_INCLUDE_DIR soundtouch/SoundTouch.h) - -# finally the library itself -find_library(libSoundTouch NAMES SoundTouch) -set(SOUNDTOUCH_LIBRARIES ${libSoundTouch}) - -# handle the QUIETLY and REQUIRED arguments and set SOUNDTOUCH_FOUND to TRUE if -# all listed variables are TRUE -include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(SoundTouch DEFAULT_MSG SOUNDTOUCH_LIBRARIES SOUNDTOUCH_INCLUDE_DIR) - -mark_as_advanced(SOUNDTOUCH_LIBRARIES SOUNDTOUCH_INCLUDE_DIR) - From 1290d0b1a37f9039ed96b134fe229be75eb6e4b1 Mon Sep 17 00:00:00 2001 From: uyjulian Date: Mon, 4 Aug 2014 11:16:58 -0500 Subject: [PATCH 6/8] Remove unneeded comments --- cmake/SearchForStuff.cmake | 7 ------- 1 file changed, 7 deletions(-) diff --git a/cmake/SearchForStuff.cmake b/cmake/SearchForStuff.cmake index 0f391b1082..e37283201e 100644 --- a/cmake/SearchForStuff.cmake +++ b/cmake/SearchForStuff.cmake @@ -33,16 +33,9 @@ find_package(wxWidgets COMPONENTS base core adv) find_package(ZLIB) ## Use pcsx2 package to find module -#include(FindAio) -## Include cg because of zzogl-cg and zerogs -#if(NOT GLSL_API) include(FindCg) -#include(FindEGL) -#include(FindGLES2) include(FindGlew) include(FindLibc) -#include(FindPortAudio) -#include(FindSoundTouch) ## Use CheckLib package to find module include(CheckLib) From f3a50a01a7616ce8dd350a39b7b0f71a1ebe536a Mon Sep 17 00:00:00 2001 From: uyjulian Date: Mon, 4 Aug 2014 11:42:40 -0500 Subject: [PATCH 7/8] cmake: Use previous macros in CMakeLists.txt files Gregory: add a c lib for zzogl-pg-cg replayer --- cmake/Pcsx2Utils.cmake | 1 - common/src/Utilities/CMakeLists.txt | 43 +++-- common/src/x86emitter/CMakeLists.txt | 38 ++-- pcsx2/CMakeLists.txt | 76 ++++---- plugins/CDVDiso/src/CMakeLists.txt | 46 +++-- plugins/CDVDlinuz/Src/CMakeLists.txt | 37 ++-- plugins/CDVDnull/CMakeLists.txt | 42 ++--- plugins/FWnull/CMakeLists.txt | 45 ++--- plugins/GSdx/CMakeLists.txt | 97 +++++----- plugins/GSnull/CMakeLists.txt | 53 +++--- plugins/PadNull/CMakeLists.txt | 49 +++-- plugins/SPU2null/CMakeLists.txt | 45 ++--- plugins/USBnull/CMakeLists.txt | 45 ++--- plugins/dev9null/CMakeLists.txt | 45 ++--- plugins/onepad/CMakeLists.txt | 63 ++++--- plugins/spu2-x/src/CMakeLists.txt | 83 +++++---- plugins/zerospu2/CMakeLists.txt | 49 +++-- plugins/zzogl-pg-cg/opengl/CMakeLists.txt | 126 ++++--------- .../opengl/ZeroGSShaders/CMakeLists.txt | 38 ++-- plugins/zzogl-pg/opengl/CMakeLists.txt | 170 ++++++++---------- .../opengl/ZeroGSShaders/CMakeLists.txt | 38 ++-- tools/bin2cpp/CMakeLists.txt | 19 +- 22 files changed, 572 insertions(+), 676 deletions(-) diff --git a/cmake/Pcsx2Utils.cmake b/cmake/Pcsx2Utils.cmake index ffd5ec6558..3785bf8ab9 100644 --- a/cmake/Pcsx2Utils.cmake +++ b/cmake/Pcsx2Utils.cmake @@ -136,4 +136,3 @@ macro(add_pcsx2_executable exe srcs libs flags) install(TARGETS ${exe} DESTINATION ${CMAKE_SOURCE_DIR}/bin) endif(PACKAGE_MODE) endmacro(add_pcsx2_executable) - diff --git a/common/src/Utilities/CMakeLists.txt b/common/src/Utilities/CMakeLists.txt index 4bc3b7d0b4..89ad223ab6 100644 --- a/common/src/Utilities/CMakeLists.txt +++ b/common/src/Utilities/CMakeLists.txt @@ -57,28 +57,40 @@ set(OptimizationFlags #Clang doesn't support a few common flags that GCC does. if(NOT USE_CLANG) - add_definitions(${CommonFlags} -fno-guess-branch-probability -fno-dse -fno-tree-dse) + set(UtilitiesFinalFlags + ${UtilitiesFinalFlags} + ${CommonFlags} -fno-guess-branch-probability -fno-dse -fno-tree-dse + ) endif(NOT USE_CLANG) # Debug - Build if(CMAKE_BUILD_TYPE STREQUAL Debug) # add defines - add_definitions(${CommonFlags} -DPCSX2_DEBUG -DPCSX2_DEVBUILD) + set(UtilitiesFinalFlags + ${UtilitiesFinalFlags} + ${CommonFlags} -DPCSX2_DEBUG -DPCSX2_DEVBUILD + ) endif(CMAKE_BUILD_TYPE STREQUAL Debug) # Devel - Build if(CMAKE_BUILD_TYPE STREQUAL Devel) # add defines - add_definitions(${CommonFlags} ${OptimizationFlags} -DPCSX2_DEVBUILD) + set(UtilitiesFinalFlags + ${UtilitiesFinalFlags} + ${CommonFlags} ${OptimizationFlags} -DPCSX2_DEVBUILD + ) endif(CMAKE_BUILD_TYPE STREQUAL Devel) # Release - Build if(CMAKE_BUILD_TYPE STREQUAL Release) # add defines - add_definitions(${CommonFlags} ${OptimizationFlags}) + set(UtilitiesFinalFlags + ${UtilitiesFinalFlags} + ${CommonFlags} ${OptimizationFlags} + ) endif(CMAKE_BUILD_TYPE STREQUAL Release) # variable with all sources of this library @@ -159,22 +171,17 @@ set(UtilitiesHeaders ../../include/Utilities/wxGuiTools.h PrecompiledHeader.h) -include_directories(.) - # change language of .S-files to c++ set_source_files_properties(${UtilitiesSSources} PROPERTIES LANGUAGE CXX) -# add library -add_library(${Output} STATIC ${UtilitiesSources} ${UtilitiesHeaders} ${UtilitiesSSources}) +set(UtilitiesFinalSources + ${UtilitiesSources} + ${UtilitiesHeaders} + ${UtilitiesSSources} +) -# link target with wx -target_link_libraries(${Output} ${wxWidgets_LIBRARIES}) +set(UtilitiesFinalLibs + ${wxWidgets_LIBRARIES} +) -# Gold (new linux linker) does not get automatically dependency of dependency so you must add -# them manually. -target_link_libraries(${Output} ${LIBC_LIBRARIES}) - -# 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 "") +add_pcsx2_lib(${Output} "${UtilitiesFinalSources}" "${UtilitiesFinalLibs}" "${UtilitiesFinalFlags}") \ No newline at end of file diff --git a/common/src/x86emitter/CMakeLists.txt b/common/src/x86emitter/CMakeLists.txt index cc7c6ae472..4743bf81fd 100644 --- a/common/src/x86emitter/CMakeLists.txt +++ b/common/src/x86emitter/CMakeLists.txt @@ -57,28 +57,38 @@ set(OptimizationFlags #Clang doesn't support a few common flags that GCC does. if(NOT USE_CLANG) - add_definitions(${CommonFlags} -fno-guess-branch-probability -fno-dse -fno-tree-dse) + set(x86emitterFinalFlags + ${x86emitterFinalFlags} + ${CommonFlags} -fno-guess-branch-probability -fno-dse -fno-tree-dse + ) endif(NOT USE_CLANG) # Debug - Build if(CMAKE_BUILD_TYPE STREQUAL Debug) - # add defines - add_definitions(${CommonFlags} -DPCSX2_DEVBUILD -DPCSX2_DEBUG) + set(x86emitterFinalFlags + ${x86emitterFinalFlags} + ${CommonFlags} -DPCSX2_DEBUG -DPCSX2_DEVBUILD + ) endif(CMAKE_BUILD_TYPE STREQUAL Debug) # Devel - Build if(CMAKE_BUILD_TYPE STREQUAL Devel) - # add defines - add_definitions(${CommonFlags} ${OptimizationFlags} -DPCSX2_DEVBUILD) + set(x86emitterFinalFlags + ${x86emitterFinalFlags} + ${CommonFlags} ${OptimizationFlags} -DPCSX2_DEVBUILD + ) endif(CMAKE_BUILD_TYPE STREQUAL Devel) # Release - Build if(CMAKE_BUILD_TYPE STREQUAL Release) # add defines - add_definitions(${CommonFlags} ${OptimizationFlags}) + set(x86emitterFinalFlags + ${x86emitterFinalFlags} + ${CommonFlags} ${OptimizationFlags} + ) endif(CMAKE_BUILD_TYPE STREQUAL Release) # variable with all sources of this library @@ -127,13 +137,13 @@ set(x86emitterHeaders ../../include/x86emitter/x86types.h PrecompiledHeader.h) -# add library -add_library(${Output} STATIC ${x86emitterSources} ${x86emitterHeaders}) +set(x86emitterFinalSources + ${x86emitterSources} + ${x86emitterHeaders} +) -# link target with wx -target_link_libraries(${Output} ${wxWidgets_LIBRARIES}) +set(x86emitterFinalLibs + ${wxWidgets_LIBRARIES} +) -# 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 "") +add_pcsx2_lib(${Output} "${x86emitterFinalSources}" "${x86emitterFinalLibs}" "${x86emitterFinalFlags}") diff --git a/pcsx2/CMakeLists.txt b/pcsx2/CMakeLists.txt index 88b197efbd..fa5bd9199f 100644 --- a/pcsx2/CMakeLists.txt +++ b/pcsx2/CMakeLists.txt @@ -63,32 +63,46 @@ set(OptimizationFlags #Clang doesn't support a few common flags that GCC does. if(NOT USE_CLANG) - add_definitions(${CommonFlags} -fno-guess-branch-probability -fno-dse -fno-tree-dse) + set(pcsx2FinalFlags + ${CommonFlags} -fno-guess-branch-probability -fno-dse -fno-tree-dse + ) endif(NOT USE_CLANG) # Debug - Build if(CMAKE_BUILD_TYPE STREQUAL Debug) set(Output pcsx2-dbg) - add_definitions(${CommonFlags} -DPCSX2_DEVBUILD -DPCSX2_DEBUG -DWX_PRECOMP) + set(pcsx2FinalFlags + ${pcsx2FinalFlags} + ${CommonFlags} -DPCSX2_DEVBUILD -DPCSX2_DEBUG -DWX_PRECOMP + ) endif(CMAKE_BUILD_TYPE STREQUAL Debug) # Devel - Build if(CMAKE_BUILD_TYPE STREQUAL Devel) set(Output pcsx2-dev) - add_definitions(${CommonFlags} ${OptimizationFlags} -DPCSX2_DEVBUILD -DWX_PRECOMP -DNDEBUG) + set(pcsx2FinalFlags + ${pcsx2FinalFlags} + ${CommonFlags} ${OptimizationFlags} -DPCSX2_DEVBUILD -DWX_PRECOMP -DNDEBUG + ) endif(CMAKE_BUILD_TYPE STREQUAL Devel) # Release - Build if(CMAKE_BUILD_TYPE STREQUAL Release) set(Output pcsx2) - add_definitions(${CommonFlags} ${OptimizationFlags} -DWX_PRECOMP -DNDEBUG) + set(pcsx2FinalFlags + ${pcsx2FinalFlags} + ${CommonFlags} ${OptimizationFlags} -DWX_PRECOMP -DNDEBUG + ) endif(CMAKE_BUILD_TYPE STREQUAL Release) if(XDG_STD) - add_definitions(-DXDG_STD) + set(pcsx2FinalFlags + ${pcsx2FinalFlags} + -DXDG_STD + ) endif(XDG_STD) # In package mode always use pcsx2 @@ -655,21 +669,30 @@ endif(Windows) # MacOSX if(MacOSX) - set(PlatformSources + set(Platform ) endif(MacOSX) +set(pcsx2FinalSources + ${Common} + ${Platform} +) + +set(pcsx2FinalLibs + Utilities + x86emitter + ${wxWidgets_LIBRARIES} + ${GTK2_LIBRARIES} + ${ZLIB_LIBRARIES} + aio +) + # additonal include directories -include_directories(. +include_directories( gui x86 ${CMAKE_BINARY_DIR}/pcsx2/gui - ) - -# add executable -add_executable(${Output} - ${Common} - ${Platform}) +) ### Generate the resources files file(MAKE_DIRECTORY ${res_bin}) @@ -690,29 +713,4 @@ if(PACKAGE_MODE) SET_SOURCE_FILES_PROPERTIES(gui/AppConfig.cpp PROPERTIES COMPILE_FLAGS "-Wp,-ansi,-U__STRICT_ANSI__") endif(PACKAGE_MODE) -# link target with project internal libraries -target_link_libraries(${Output} Utilities x86emitter) - -# link target with wx -target_link_libraries(${Output} ${wxWidgets_LIBRARIES}) - -if(Linux) - # link target with gtk2 - target_link_libraries(${Output} ${GTK2_LIBRARIES}) -endif(Linux) - -# link target with zlib -target_link_libraries(${Output} ${ZLIB_LIBRARIES}) - -target_link_libraries(${Output} ${AIO_LIBRARIES}) - -# 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 bin) -else(PACKAGE_MODE) - install(TARGETS ${Output} DESTINATION ${CMAKE_SOURCE_DIR}/bin) -endif(PACKAGE_MODE) +add_pcsx2_executable(${Output} "${pcsx2FinalSources}" "${pcsx2FinalLibs}" "${pcsx2FinalFlags}") diff --git a/plugins/CDVDiso/src/CMakeLists.txt b/plugins/CDVDiso/src/CMakeLists.txt index edb6f1ca5c..714b63440e 100644 --- a/plugins/CDVDiso/src/CMakeLists.txt +++ b/plugins/CDVDiso/src/CMakeLists.txt @@ -22,19 +22,25 @@ set(OptimizationFlags # Debug - Build if(CMAKE_BUILD_TYPE STREQUAL Debug) # add defines - add_definitions(${CommonFlags} -g) + set(CDVDisoFinalFlags + ${CommonFlags} -g + ) endif(CMAKE_BUILD_TYPE STREQUAL Debug) # Devel - Build if(CMAKE_BUILD_TYPE STREQUAL Devel) # add defines - add_definitions(${CommonFlags} ${OptimizationFlags}) + set(CDVDisoFinalFlags + ${CommonFlags} ${OptimizationFlags} + ) endif(CMAKE_BUILD_TYPE STREQUAL Devel) # Release - Build if(CMAKE_BUILD_TYPE STREQUAL Release) # add defines - add_definitions(${CommonFlags} ${OptimizationFlags}) + set(CDVDisoFinalFlags + ${CommonFlags} ${OptimizationFlags} + ) endif(CMAKE_BUILD_TYPE STREQUAL Release) # CDVDiso sources @@ -61,28 +67,18 @@ set(CDVDisoLinuxHeaders Linux/interface.h Linux/support.h) +set(CDVDisoFinalSources + ${CDVDisoSources} + ${CDVDisoHeaders} + ${CDVDisoLinuxSources} + ${CDVDisoLinuxHeaders} +) + +set(CDVDisoFinalLibs + ${BZIP2_LIBRARIES} +) # add additional include directories -include_directories(. - Linux) +include_directories(Linux) -# add library -add_library(${Output} SHARED - ${CDVDisoSources} - ${CDVDisoHeaders} - ${CDVDisoLinuxSources} - ${CDVDisoLinuxHeaders}) - -# Link with bz2 -target_link_libraries(${Output} ${BZIP2_LIBRARIES}) - -# 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) +add_pcsx2_plugin(${Output} "${CDVDisoFinalSources}" "${CDVDisoFinalLibs}" "${CDVDisoFinalFlags}") diff --git a/plugins/CDVDlinuz/Src/CMakeLists.txt b/plugins/CDVDlinuz/Src/CMakeLists.txt index cdb7ab603a..254aeb7191 100644 --- a/plugins/CDVDlinuz/Src/CMakeLists.txt +++ b/plugins/CDVDlinuz/Src/CMakeLists.txt @@ -17,19 +17,25 @@ set(OptimizationFlags # Debug - Build if(CMAKE_BUILD_TYPE STREQUAL Debug) # add defines - add_definitions(${CommonFlags} -g) + set(CDVDlinuzFinalFlags + ${CommonFlags} -g + ) endif(CMAKE_BUILD_TYPE STREQUAL Debug) # Devel - Build if(CMAKE_BUILD_TYPE STREQUAL Devel) # add defines - add_definitions(${CommonFlags} ${OptimizationFlags}) + set(CDVDlinuzFinalFlags + ${CommonFlags} ${OptimizationFlags} + ) endif(CMAKE_BUILD_TYPE STREQUAL Devel) # Release - Build if(CMAKE_BUILD_TYPE STREQUAL Release) # add defines - add_definitions(${CommonFlags} ${OptimizationFlags}) + set(CDVDlinuzFinalFlags + ${CommonFlags} ${OptimizationFlags} + ) endif(CMAKE_BUILD_TYPE STREQUAL Release) # CDVDlinuz sources @@ -76,24 +82,17 @@ set(CDVDlinuzLinuxHeaders Linux/logfile.h Linux/mainbox.h) -# add additional include directories -include_directories(. - Linux) - -# add library -add_library(${Output} SHARED +set(CDVDlinuzFinalSources ${CDVDlinuzSources} ${CDVDlinuzHeaders} ${CDVDlinuzLinuxSources} - ${CDVDlinuzLinuxHeaders}) + ${CDVDlinuzLinuxHeaders} +) -# 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 "") +set(CDVDlinuzFinalLibs +) -if(PACKAGE_MODE) - install(TARGETS ${Output} DESTINATION ${PLUGIN_DIR}) -else(PACKAGE_MODE) - install(TARGETS ${Output} DESTINATION ${CMAKE_SOURCE_DIR}/bin/plugins) -endif(PACKAGE_MODE) +# add additional include directories +include_directories(Linux) + +add_pcsx2_plugin(${Output} "${CDVDlinuzFinalSources}" "${CDVDlinuzFinalLibs}" "${CDVDlinuzFinalFlags}") \ No newline at end of file diff --git a/plugins/CDVDnull/CMakeLists.txt b/plugins/CDVDnull/CMakeLists.txt index 27a72d14fb..8dbac89a16 100644 --- a/plugins/CDVDnull/CMakeLists.txt +++ b/plugins/CDVDnull/CMakeLists.txt @@ -22,19 +22,25 @@ set(OptimizationFlags # Debug - Build if(CMAKE_BUILD_TYPE STREQUAL Debug) # add defines - add_definitions(${CommonFlags} -g) + set(CDVDnullFinalFlags + ${CommonFlags} -g + ) endif(CMAKE_BUILD_TYPE STREQUAL Debug) # Devel - Build if(CMAKE_BUILD_TYPE STREQUAL Devel) # add defines - add_definitions(${CommonFlags} ${OptimizationFlags}) + set(CDVDnullFinalFlags + ${CommonFlags} ${OptimizationFlags} + ) endif(CMAKE_BUILD_TYPE STREQUAL Devel) # Release - Build if(CMAKE_BUILD_TYPE STREQUAL Release) # add defines - add_definitions(${CommonFlags} ${OptimizationFlags}) + set(CDVDnullFinalFlags + ${CommonFlags} ${OptimizationFlags} + ) endif(CMAKE_BUILD_TYPE STREQUAL Release) # CDVDnull sources @@ -54,27 +60,13 @@ set(CDVDnullWindowsSources set(CDVDnullWindowsHeaders ) -# add additional include directories -include_directories(.) +set(CDVDnullFinalSources + ${CDVDnullSources} + ${CDVDnullHeaders} +) -# add library -add_library(${Output} SHARED - ${CDVDnullSources} - ${CDVDnullHeaders} - ) +set(CDVDnullFinalLibs + ${GTK2_LIBRARIES} +) -if(Linux) - # link target with gtk2 - target_link_libraries(${Output} ${GTK2_LIBRARIES}) -endif(Linux) - -# 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) +add_pcsx2_plugin(${Output} "${CDVDnullFinalSources}" "${CDVDnullFinalLibs}" "${CDVDnullFinalFlags}") diff --git a/plugins/FWnull/CMakeLists.txt b/plugins/FWnull/CMakeLists.txt index 0d8a7ba36c..d786c271b1 100644 --- a/plugins/FWnull/CMakeLists.txt +++ b/plugins/FWnull/CMakeLists.txt @@ -21,19 +21,25 @@ set(OptimizationFlags # Debug - Build if(CMAKE_BUILD_TYPE STREQUAL Debug) # add defines - add_definitions(${CommonFlags} -g) + set(FWnullFinalFlags + ${CommonFlags} -g + ) endif(CMAKE_BUILD_TYPE STREQUAL Debug) # Devel - Build if(CMAKE_BUILD_TYPE STREQUAL Devel) # add defines - add_definitions(${CommonFlags} ${OptimizationFlags}) + set(FWnullFinalFlags + ${CommonFlags} ${OptimizationFlags} + ) endif(CMAKE_BUILD_TYPE STREQUAL Devel) # Release - Build if(CMAKE_BUILD_TYPE STREQUAL Release) # add defines - add_definitions(${CommonFlags} ${OptimizationFlags}) + set(FWnullFinalFlags + ${CommonFlags} ${OptimizationFlags} + ) endif(CMAKE_BUILD_TYPE STREQUAL Release) # FWnull sources @@ -65,28 +71,15 @@ set(FWnullWindowsSources set(FWnullWindowsHeaders Windows/resource.h) -# add additional include directories -include_directories(.) +set(FWnullFinalSources + ${FWnullSources} + ${FWnullHeaders} + ${FWnullLinuxSources} + ${FWnullLinuxHeaders} +) -# add library -add_library(${Output} SHARED - ${FWnullSources} - ${FWnullHeaders} - ${FWnullLinuxSources} - ${FWnullLinuxHeaders}) +set(FWnullFinalLibs + ${GTK2_LIBRARIES} +) -if(Linux) - # link target with gtk2 - target_link_libraries(${Output} ${GTK2_LIBRARIES}) -endif(Linux) - -# 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) +add_pcsx2_plugin(${Output} "${FWnullFinalSources}" "${FWnullFinalLibs}" "${FWnullFinalFlags}") \ No newline at end of file diff --git a/plugins/GSdx/CMakeLists.txt b/plugins/GSdx/CMakeLists.txt index c7e4618be1..f87270b227 100644 --- a/plugins/GSdx/CMakeLists.txt +++ b/plugins/GSdx/CMakeLists.txt @@ -28,30 +28,42 @@ set(OptimizationFlags #Clang doesn't support a few common flags that GCC does. if(NOT USE_CLANG AND _M_X86_32) - add_definitions(${CommonFlags} -mpreferred-stack-boundary=2) + set(GSdxFinalFlags + ${GSdxFinalFlags} ${CommonFlags} -mpreferred-stack-boundary=2 + ) endif() # Debug - Build if(CMAKE_BUILD_TYPE STREQUAL Debug) - add_definitions(${CommonFlags} -D_DEBUG -g -Wall) + set(GSdxFinalFlags + ${GSdxFinalFlags} ${CommonFlags} -D_DEBUG -g -Wall + ) endif() # Devel - Build if(CMAKE_BUILD_TYPE STREQUAL Devel) - add_definitions(${CommonFlags} ${OptimizationFlags} -D_DEVEL -g) + set(GSdxFinalFlags + ${GSdxFinalFlags} ${CommonFlags} ${OptimizationFlags} -D_DEVEL -g + ) endif() # Release - Build if(CMAKE_BUILD_TYPE STREQUAL Release) - add_definitions(${CommonFlags} ${OptimizationFlags} -W) + set(GSdxFinalFlags + ${GSdxFinalFlags} ${CommonFlags} ${OptimizationFlags} -W + ) endif() if(XDG_STD) - add_definitions(-DXDG_STD) + set(GSdxFinalFlags + ${GSdxFinalFlags} -DXDG_STD + ) endif() if(GLES_API AND GLESV2_FOUND) - add_definitions(-DENABLE_GLES) + set(GSdxFinalFlags + ${GSdxFinalFlags} -DENABLE_GLES + ) endif() set(GSdxSources @@ -190,54 +202,47 @@ set(GSdxHeaders xbyak/xbyak_util.h ) -include_directories(.) +set(GSdxFinalSources + ${GSdxSources} + ${GSdxHeaders} +) + +set(GSdxFinalLibs + ${X11_LIBRARIES} +) + +if(GLES_API AND GLESV2_FOUND) + set(GSdxFinalLibs + ${GSdxFinalLibs} + ${GLESV2_LIBRARIES} + ) +else() + set(GSdxFinalLibs + ${GSdxFinalLibs} + ${OPENGL_LIBRARIES} + ) +endif() + +set(GSdxFinalLibs + ${GSdxFinalLibs} + ${EGL_LIBRARIES} + ${GTK2_LIBRARIES} + ${LIBC_LIBRARIES} +) # Generate Glsl header file. Protect with REBUILD_SHADER to avoid build-dependency on PERL if (REBUILD_SHADER) add_custom_command(OUTPUT res/glsl_source.h COMMAND perl ${CMAKE_SOURCE_DIR}/linux_various/glsl2h.pl) endif() -add_library(${Output} SHARED ${GSdxSources} ${GSdxHeaders}) - -target_link_libraries(${Output} ${X11_LIBRARIES}) - -if(GLES_API AND GLESV2_FOUND) - target_link_libraries(${Output} ${GLESV2_LIBRARIES}) -else() - target_link_libraries(${Output} ${OPENGL_LIBRARIES}) -endif() - -target_link_libraries(${Output} ${EGL_LIBRARIES}) - -if(Linux) - target_link_libraries(${Output} ${GTK2_LIBRARIES}) -endif(Linux) - -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) +add_pcsx2_plugin(${Output} "${GSdxFinalSources}" "${GSdxFinalLibs}" "${GSdxFinalFlags}") ################################### Replay Loader if(BUILD_REPLAY_LOADERS) set(Replay pcsx2_GSReplayLoader) - - add_executable(${Replay} linux_replay.cpp) - - target_link_libraries(${Replay} ${LIBC_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) + set(GSdxReplayLoaderFinalSources + ${GSdxFinalSources} + linux_replay.cpp + ) + add_pcsx2_executable(${Replay} "${GSdxReplayLoaderFinalSources}" "${GSdxFinalLibs}" "${GSdxFinalFlags}") endif(BUILD_REPLAY_LOADERS) diff --git a/plugins/GSnull/CMakeLists.txt b/plugins/GSnull/CMakeLists.txt index 15bfa9a875..b16914bbbe 100644 --- a/plugins/GSnull/CMakeLists.txt +++ b/plugins/GSnull/CMakeLists.txt @@ -22,19 +22,25 @@ set(OptimizationFlags # Debug - Build if(CMAKE_BUILD_TYPE STREQUAL Debug) # add defines - add_definitions(${CommonFlags} -g) + set(GSnullFinalFlags + ${CommonFlags} -g + ) endif(CMAKE_BUILD_TYPE STREQUAL Debug) # Devel - Build if(CMAKE_BUILD_TYPE STREQUAL Devel) # add defines - add_definitions(${CommonFlags} ${OptimizationFlags}) + set(GSnullFinalFlags + ${CommonFlags} ${OptimizationFlags} + ) endif(CMAKE_BUILD_TYPE STREQUAL Devel) # Release - Build if(CMAKE_BUILD_TYPE STREQUAL Release) # add defines - add_definitions(${CommonFlags} ${OptimizationFlags}) + set(GSnullFinalFlags + ${CommonFlags} ${OptimizationFlags} + ) endif(CMAKE_BUILD_TYPE STREQUAL Release) # GSnull sources @@ -82,33 +88,18 @@ set(GSnullWindowsSources set(GSnullWindowsHeaders ) -# add additional include directories -include_directories(.) +set(GSnullFinalSources + ${GSnullSources} + ${GSnullHeaders} + ${GSnullnullSources} + ${GSnullnullHeaders} + ${GSnullLinuxSources} + ${GSnullLinuxHeaders} +) -# add library -add_library(${Output} SHARED - ${GSnullSources} - ${GSnullHeaders} - ${GSnullnullSources} - ${GSnullnullHeaders} - ${GSnullLinuxSources} - ${GSnullLinuxHeaders}) +set(GSnullFinalLibs + ${GTK2_LIBRARIES} + ${X11_LIBRARIES} +) -if(Linux) - # link target with gtk2 - target_link_libraries(${Output} ${GTK2_LIBRARIES}) -endif(Linux) - -# link target with X11 -target_link_libraries(${Output} ${X11_LIBRARIES}) - -# 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) +add_pcsx2_plugin(${Output} "${GSnullFinalSources}" "${GSnullFinalLibs}" "${GSnullFinalFlags}") diff --git a/plugins/PadNull/CMakeLists.txt b/plugins/PadNull/CMakeLists.txt index 2cba99fd5d..9e729c8247 100644 --- a/plugins/PadNull/CMakeLists.txt +++ b/plugins/PadNull/CMakeLists.txt @@ -21,19 +21,25 @@ set(OptimizationFlags # Debug - Build if(CMAKE_BUILD_TYPE STREQUAL Debug) # add defines - add_definitions(${CommonFlags} -g) + set(PadNullFinalFlags + ${CommonFlags} -g + ) endif(CMAKE_BUILD_TYPE STREQUAL Debug) # Devel - Build if(CMAKE_BUILD_TYPE STREQUAL Devel) # add defines - add_definitions(${CommonFlags} ${OptimizationFlags}) + set(PadNullFinalFlags + ${CommonFlags} ${OptimizationFlags} + ) endif(CMAKE_BUILD_TYPE STREQUAL Devel) # Release - Build if(CMAKE_BUILD_TYPE STREQUAL Release) # add defines - add_definitions(${CommonFlags} ${OptimizationFlags}) + set(PadNullFinalFlags + ${CommonFlags} ${OptimizationFlags} + ) endif(CMAKE_BUILD_TYPE STREQUAL Release) # PadNull sources @@ -67,31 +73,18 @@ set(PadNullWindowsHeaders Windows/resource.h) # add additional include directories -include_directories(. - Linux) +include_directories(Linux) -# add library -add_library(${Output} SHARED - ${PadNullSources} - ${PadNullHeaders} - ${PadNullLinuxSources} - ${PadNullLinuxHeaders}) +set(PadNullFinalSources + ${PadNullSources} + ${PadNullHeaders} + ${PadNullLinuxSources} + ${PadNullLinuxHeaders} +) -if(Linux) - # link target with gtk2 - target_link_libraries(${Output} ${GTK2_LIBRARIES}) -endif(Linux) +set(PadNullFinalLibs + ${GTK2_LIBRARIES} + ${X11_LIBRARIES} +) -# link target with X11 -target_link_libraries(${Output} ${X11_LIBRARIES}) - -# 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) +add_pcsx2_plugin(${Output} "${PadNullFinalSources}" "${PadNullFinalLibs}" "${PadNullFinalFlags}") diff --git a/plugins/SPU2null/CMakeLists.txt b/plugins/SPU2null/CMakeLists.txt index 08271ef5f7..f7eb8d2c47 100644 --- a/plugins/SPU2null/CMakeLists.txt +++ b/plugins/SPU2null/CMakeLists.txt @@ -22,19 +22,25 @@ set(OptimizationFlags # Debug - Build if(CMAKE_BUILD_TYPE STREQUAL Debug) # add defines - add_definitions(${CommonFlags} -g) + set(SPU2nullFinalFlags + ${CommonFlags} -g + ) endif(CMAKE_BUILD_TYPE STREQUAL Debug) # Devel - Build if(CMAKE_BUILD_TYPE STREQUAL Devel) # add defines - add_definitions(${CommonFlags} ${OptimizationFlags}) + set(SPU2nullFinalFlags + ${CommonFlags} ${OptimizationFlags} + ) endif(CMAKE_BUILD_TYPE STREQUAL Devel) # Release - Build if(CMAKE_BUILD_TYPE STREQUAL Release) # add defines - add_definitions(${CommonFlags} ${OptimizationFlags}) + set(SPU2nullFinalFlags + ${CommonFlags} ${OptimizationFlags} + ) endif(CMAKE_BUILD_TYPE STREQUAL Release) # SPU2null sources @@ -64,28 +70,15 @@ set(SPU2nullWindowsSources set(SPU2nullWindowsHeaders Windows/resource.h) -# add additional include directories -include_directories(.) +set(SPU2nullFinalSources + ${SPU2nullSources} + ${SPU2nullHeaders} + ${SPU2nullLinuxSources} + ${SPU2nullLinuxHeaders} +) -# add library -add_library(${Output} SHARED - ${SPU2nullSources} - ${SPU2nullHeaders} - ${SPU2nullLinuxSources} - ${SPU2nullLinuxHeaders}) +set(SPU2nullFinalLibs + ${GTK2_LIBRARIES} +) -if(Linux) - # link target with gtk2 - target_link_libraries(${Output} ${GTK2_LIBRARIES}) -endif(Linux) - -# 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) +add_pcsx2_plugin(${Output} "${SPU2nullFinalSources}" "${SPU2nullFinalLibs}" "${SPU2nullFinalFlags}") diff --git a/plugins/USBnull/CMakeLists.txt b/plugins/USBnull/CMakeLists.txt index 55cfa8aefe..9ef8b9a53e 100644 --- a/plugins/USBnull/CMakeLists.txt +++ b/plugins/USBnull/CMakeLists.txt @@ -22,19 +22,25 @@ set(OptimizationFlags # Debug - Build if(CMAKE_BUILD_TYPE STREQUAL Debug) # add defines - add_definitions(${CommonFlags} -g) + set(USBnullFinalFlags + ${CommonFlags} -g + ) endif(CMAKE_BUILD_TYPE STREQUAL Debug) # Devel - Build if(CMAKE_BUILD_TYPE STREQUAL Devel) # add defines - add_definitions(${CommonFlags} ${OptimizationFlags}) + set(USBnullFinalFlags + ${CommonFlags} ${OptimizationFlags} + ) endif(CMAKE_BUILD_TYPE STREQUAL Devel) # Release - Build if(CMAKE_BUILD_TYPE STREQUAL Release) # add defines - add_definitions(${CommonFlags} ${OptimizationFlags}) + set(USBnullFinalFlags + ${CommonFlags} ${OptimizationFlags} + ) endif(CMAKE_BUILD_TYPE STREQUAL Release) # USBnull sources @@ -66,28 +72,15 @@ set(USBnullWindowsSources set(USBnullWindowsHeaders Windows/resource.h) -# additonal include directories -include_directories(.) +set(USBnullFinalSources + ${USBnullSources} + ${USBnullHeaders} + ${USBnullLinuxSources} + ${USBnullLinuxHeaders} +) -# add library -add_library(${Output} SHARED - ${USBnullSources} - ${USBnullHeaders} - ${USBnullLinuxSources} - ${USBnullLinuxHeaders}) +set(USBnullFinalLibs + ${GTK2_LIBRARIES} +) -if(Linux) - # link target with gtk2 - target_link_libraries(${Output} ${GTK2_LIBRARIES}) -endif(Linux) - -# 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) +add_pcsx2_plugin(${Output} "${USBnullFinalSources}" "${USBnullFinalLibs}" "${USBnullFinalFlags}") diff --git a/plugins/dev9null/CMakeLists.txt b/plugins/dev9null/CMakeLists.txt index 3d53e81212..4a58bde2af 100644 --- a/plugins/dev9null/CMakeLists.txt +++ b/plugins/dev9null/CMakeLists.txt @@ -22,19 +22,25 @@ set(OptimizationFlags # Debug - Build if(CMAKE_BUILD_TYPE STREQUAL Debug) # add defines - add_definitions(${CommonFlags} -g) + set(dev9nullFinalFlags + ${CommonFlags} -g + ) endif(CMAKE_BUILD_TYPE STREQUAL Debug) # Devel - Build if(CMAKE_BUILD_TYPE STREQUAL Devel) # add defines - add_definitions(${CommonFlags} ${OptimizationFlags}) + set(dev9nullFinalFlags + ${CommonFlags} ${OptimizationFlags} + ) endif(CMAKE_BUILD_TYPE STREQUAL Devel) # Release - Build if(CMAKE_BUILD_TYPE STREQUAL Release) # add defines - add_definitions(${CommonFlags} ${OptimizationFlags}) + set(dev9nullFinalFlags + ${CommonFlags} ${OptimizationFlags} + ) endif(CMAKE_BUILD_TYPE STREQUAL Release) # dev9null sources @@ -63,28 +69,15 @@ set(dev9nullWindowsSources set(dev9nullWindowsHeaders ) -# additional include directories -include_directories(.) +set(dev9nullFinalSources + ${dev9nullSources} + ${dev9nullHeaders} + ${dev9nullLinuxSources} + ${dev9nullLinuxHeaders} +) -# add library -add_library(${Output} SHARED - ${dev9nullSources} - ${dev9nullHeaders} - ${dev9nullLinuxSources} - ${dev9nullLinuxHeaders}) +set(dev9nullFinalLibs + ${GTK2_LIBRARIES} +) -if(Linux) - # link target with gtk2 - target_link_libraries(${Output} ${GTK2_LIBRARIES}) -endif(Linux) - -# 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) +add_pcsx2_plugin(${Output} "${dev9nullFinalSources}" "${dev9nullFinalLibs}" "${dev9nullFinalFlags}") diff --git a/plugins/onepad/CMakeLists.txt b/plugins/onepad/CMakeLists.txt index b0626bbe89..1dba75d852 100644 --- a/plugins/onepad/CMakeLists.txt +++ b/plugins/onepad/CMakeLists.txt @@ -21,19 +21,28 @@ set(OptimizationFlags ) if(CMAKE_BUILD_TYPE STREQUAL Debug) - add_definitions(${CommonFlags} -g) + set(onepadFinalFlags + ${CommonFlags} -g + ) endif(CMAKE_BUILD_TYPE STREQUAL Debug) if(CMAKE_BUILD_TYPE STREQUAL Devel) - add_definitions(${CommonFlags} ${OptimizationFlags}) + set(onepadFinalFlags + ${CommonFlags} ${OptimizationFlags} + ) endif(CMAKE_BUILD_TYPE STREQUAL Devel) if(CMAKE_BUILD_TYPE STREQUAL Release) - add_definitions(${CommonFlags} ${OptimizationFlags}) + set(onepadFinalFlags + ${CommonFlags} ${OptimizationFlags} + ) endif(CMAKE_BUILD_TYPE STREQUAL Release) if (SDL2_API) - add_definitions(-DONEPAD_SDL2) + set(onepadFinalFlags + ${onepadFinalFlags} + -DONEPAD_SDL2 + ) endif() # onepad sources @@ -71,37 +80,27 @@ set(onepadWindowsSources set(onepadWindowsHeaders ) -# add additional include directories -include_directories(.) - -# add library -add_library(${Output} SHARED - ${onepadSources} - ${onepadHeaders} - ${onepadLinuxSources} - ${onepadLinuxHeaders}) - if (SDL2_API) - target_link_libraries(${Output} ${SDL2_LIBRARY}) + set(onepadFinalLibs + ${SDL2_LIBRARY} + ) else() - target_link_libraries(${Output} ${SDL_LIBRARY}) + set(onepadFinalLibs + ${SDL_LIBRARY} + ) endif() -if(Linux) - # link target with gtk2 - target_link_libraries(${Output} ${GTK2_LIBRARIES}) -endif(Linux) +set(onepadFinalLibs + ${onepadFinalLibs} + ${GTK2_LIBRARIES} + ${X11_LIBRARIES} +) -# link target with X11 -target_link_libraries(${Output} ${X11_LIBRARIES}) +set(onepadFinalSources + ${onepadSources} + ${onepadHeaders} + ${onepadLinuxSources} + ${onepadLinuxHeaders} +) -# 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) +add_pcsx2_plugin(${Output} "${onepadFinalSources}" "${onepadFinalLibs}" "${onepadFinalFlags}") diff --git a/plugins/spu2-x/src/CMakeLists.txt b/plugins/spu2-x/src/CMakeLists.txt index a8399ddfd1..9a6088ddf4 100644 --- a/plugins/spu2-x/src/CMakeLists.txt +++ b/plugins/spu2-x/src/CMakeLists.txt @@ -22,19 +22,25 @@ set(OptimizationFlags # Debug - Build if(CMAKE_BUILD_TYPE STREQUAL Debug) # add defines - add_definitions(${CommonFlags} -g) + set(spu2xFinalFlags + ${CommonFlags} -g + ) endif(CMAKE_BUILD_TYPE STREQUAL Debug) # Devel - Build if(CMAKE_BUILD_TYPE STREQUAL Devel) # add defines - add_definitions(${CommonFlags} ${OptimizationFlags}) + set(spu2xFinalFlags + ${CommonFlags} ${OptimizationFlags} + ) endif(CMAKE_BUILD_TYPE STREQUAL Devel) # Release - Build if(CMAKE_BUILD_TYPE STREQUAL Release) # add defines - add_definitions(${CommonFlags} ${OptimizationFlags}) + set(spu2xFinalFlags + ${CommonFlags} ${OptimizationFlags} + ) endif(CMAKE_BUILD_TYPE STREQUAL Release) # spu2x sources @@ -97,7 +103,7 @@ set(spu2xLinuxHeaders Linux/Dialogs.h) # add additional include directories -include_directories(. Linux) +include_directories(Linux) ### Don't use yet c11 feature. I will bump gcc requirement to 4.7 when 4.9 is out. ### Note: actually it might work on 4.6 too @@ -112,49 +118,48 @@ include_directories(. Linux) if(SDL_FOUND) list(APPEND spu2xSources SndOut_SDL.cpp) - if(SDL2_API) - add_definitions(-DSPU2X_SDL2) + if (SDL2_API) + set(spu2xFinalFlags + ${spu2xFinalFlags} + -DSPU2X_SDL2 + ) else() - add_definitions(-DSPU2X_SDL) + set(spu2xFinalFlags + ${spu2xFinalFlags} + -DSPU2X_SDL + ) endif() - #elseif(SDL2_FOUND) - # add_definitions(-DSPU2X_SDL2) endif() -# add library -add_library(${Output} SHARED - ${spu2xSources} - ${spu2xHeaders} - ${spu2xLinuxSources} - ${spu2xLinuxHeaders}) +set(spu2xFinalSources + ${spu2xSources} + ${spu2xHeaders} + ${spu2xLinuxSources} + ${spu2xLinuxHeaders} +) -# link target with project internal libraries -target_link_libraries(${Output} Utilities) +set(spu2xFinalLibs + Utilities + ${ALSA_LIBRARIES} + portaudio +) -# link target with various backend -target_link_libraries(${Output} ${ALSA_LIBRARIES}) -target_link_libraries(${Output} ${PORTAUDIO_LIBRARIES}) if (SDL2_API) - target_link_libraries(${Output} ${SDL2_LIBRARY}) + set(spu2xFinalLibs + ${spu2xFinalLibs} + ${SDL2_LIBRARY} + ) else() - target_link_libraries(${Output} ${SDL_LIBRARY}) + set(spu2xFinalLibs + ${spu2xFinalLibs} + ${SDL_LIBRARY} + ) endif() -# link target with SoundTouch -target_link_libraries(${Output} ${SOUNDTOUCH_LIBRARIES}) +set(spu2xFinalLibs + ${spu2xFinalLibs} + SoundTouch + ${GTK2_LIBRARIES} +) -if(Linux) - # link target with gtk2 - target_link_libraries(${Output} ${GTK2_LIBRARIES}) -endif(Linux) - -# 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) +add_pcsx2_plugin(${Output} "${spu2xFinalSources}" "${spu2xFinalLibs}" "${spu2xFinalFlags}") diff --git a/plugins/zerospu2/CMakeLists.txt b/plugins/zerospu2/CMakeLists.txt index 3bc60c0e82..6421bbce89 100644 --- a/plugins/zerospu2/CMakeLists.txt +++ b/plugins/zerospu2/CMakeLists.txt @@ -21,19 +21,25 @@ set(OptimizationFlags # Debug - Build if(CMAKE_BUILD_TYPE STREQUAL Debug) # add defines - add_definitions(${CommonFlags} -g) + set(zerospu2FinalFlags + ${CommonFlags} -g + ) endif(CMAKE_BUILD_TYPE STREQUAL Debug) # Devel - Build if(CMAKE_BUILD_TYPE STREQUAL Devel) # add defines - add_definitions(${CommonFlags} ${OptimizationFlags}) + set(zerospu2FinalFlags + ${CommonFlags} ${OptimizationFlags} + ) endif(CMAKE_BUILD_TYPE STREQUAL Devel) # Release - Build if(CMAKE_BUILD_TYPE STREQUAL Release) # add defines - add_definitions(${CommonFlags} ${OptimizationFlags}) + set(zerospu2FinalFlags + ${CommonFlags} ${OptimizationFlags} + ) endif(CMAKE_BUILD_TYPE STREQUAL Release) # zerospu2 sources @@ -82,35 +88,24 @@ set(zerospu2WindowsHeaders Targets/dsound51.h) # add additional include directories -include_directories(. - Linux - Targets) +include_directories(Linux Targets) -# add library -add_library(${Output} SHARED - ${zerospu2Sources} - ${zerospu2Headers} - ${zerospu2LinuxSources} - ${zerospu2LinuxHeaders}) +set(zerospu2FinalSources + ${zerospu2Sources} + ${zerospu2Headers} + ${zerospu2LinuxSources} + ${zerospu2LinuxHeaders} +) -# link target with ALSA -target_link_libraries(${Output} ${ALSA_LIBRARIES}) +set(zerospu2FinalLibs + ${ALSA_LIBRARIES} + # PortAudio would go here. + ${SOUNDTOUCH_LIBRARIES} +) if(PORTAUDIO_FOUND) # link target with PortAudio #target_link_libraries(${Output} ${PORTAUDIO_LIBRARIES}) endif(PORTAUDIO_FOUND) -# link target with SoundTouch -target_link_libraries(${Output} ${SOUNDTOUCH_LIBRARIES}) - -# 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) +add_pcsx2_plugin(${Output} "${zerospu2FinalSources}" "${zerospu2FinalLibs}" "${zerospu2FinalFlags}") diff --git a/plugins/zzogl-pg-cg/opengl/CMakeLists.txt b/plugins/zzogl-pg-cg/opengl/CMakeLists.txt index 2630cf1bb2..462186897c 100644 --- a/plugins/zzogl-pg-cg/opengl/CMakeLists.txt +++ b/plugins/zzogl-pg-cg/opengl/CMakeLists.txt @@ -25,19 +25,25 @@ set(OptimizationFlags # Debug - Build if(CMAKE_BUILD_TYPE STREQUAL Debug) # add defines - add_definitions(${CommonFlags} -g -Wall -D_DEBUG) + set(zzoglFinalFlags + ${CommonFlags} -g -Wall -D_DEBUG + ) endif(CMAKE_BUILD_TYPE STREQUAL Debug) # Devel - Build if(CMAKE_BUILD_TYPE STREQUAL Devel) # add defines - add_definitions(${CommonFlags} ${OptimizationFlags} -g -W -DZEROGS_DEVBUILD) + set(zzoglFinalFlags + ${CommonFlags} ${OptimizationFlags} -g -W -DZEROGS_DEVBUILD + ) endif(CMAKE_BUILD_TYPE STREQUAL Devel) # Release - Build if(CMAKE_BUILD_TYPE STREQUAL Release) # add defines - add_definitions(${CommonFlags} ${OptimizationFlags} -W) + set(zzoglFinalFlags + ${CommonFlags} ${OptimizationFlags} -W + ) endif(CMAKE_BUILD_TYPE STREQUAL Release) # zzogl sources @@ -126,102 +132,44 @@ set(zzoglLinuxSources set(zzoglLinuxHeaders Linux/Linux.h) -# change language of .S-files to c++ -set_source_files_properties(${zzoglSSources} PROPERTIES LANGUAGE CXX) - -# add additional include directories -include_directories(. - Linux) - -# add library -add_library(${Output} SHARED +set(zzoglFinalSources ${zzoglSources} ${zzoglHeaders} ${zzoglSSources} ${zzoglShaderSources} ${zzoglLinuxSources} - ${zzoglLinuxHeaders}) + ${zzoglLinuxHeaders} +) + +set(zzoglFinalLibs + Utilities + ${CG_LIBRARIES} + ${GLEW_LIBRARY} + ${OPENGL_LIBRARIES} + ${X11_LIBRARIES} + ${JPEG_LIBRARIES} + ${GTK2_LIBRARIES} + ${ZLIB_LIBRARIES} + ${LIBC_LIBRARIES} +) + +# change language of .S-files to c++ +set_source_files_properties(${zzoglSSources} PROPERTIES LANGUAGE CXX) + +# add additional include directories +include_directories(Linux) + +add_pcsx2_plugin(${Output} "${zzoglFinalSources}" "${zzoglFinalLibs}" "${zzoglFinalFlags}") # Trick that allow to compile zzogl with GSOPEN2 and the replayer with GSOPEN set_target_properties(${Output} PROPERTIES COMPILE_DEFINITIONS USE_GSOPEN2) -# link target with project internal libraries -target_link_libraries(${Output} Utilities) - -# link target with Cg -target_link_libraries(${Output} ${CG_LIBRARIES}) - -# link target with glew -target_link_libraries(${Output} ${GLEW_LIBRARY}) - -# link target with opengl -target_link_libraries(${Output} ${OPENGL_LIBRARIES}) - -# link target with X11 -target_link_libraries(${Output} ${X11_LIBRARIES}) - -# link target with jpeg -target_link_libraries(${Output} ${JPEG_LIBRARIES}) - -if(Linux) - # link target with gtk2 - target_link_libraries(${Output} ${GTK2_LIBRARIES}) -endif(Linux) - -# link target with zlib -target_link_libraries(${Output} ${ZLIB_LIBRARIES}) - -# 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) - ################################### Replay Loader if(BUILD_REPLAY_LOADERS) set(Replay pcsx2_ZZCGReplayLoader) - set(Static zzogl-cg-static) - - 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}) - - 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} ${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) + set(zzoglReplayLoaderFinalSources + ${zzoglFinalSources} + linux_replay.cpp + ) + add_pcsx2_executable(${Replay} "${zzoglReplayLoaderFinalSources}" "${zzoglFinalLibs}" "${zzoglFinalFlags}") endif(BUILD_REPLAY_LOADERS) diff --git a/plugins/zzogl-pg-cg/opengl/ZeroGSShaders/CMakeLists.txt b/plugins/zzogl-pg-cg/opengl/ZeroGSShaders/CMakeLists.txt index 370468e02c..4093c51444 100644 --- a/plugins/zzogl-pg-cg/opengl/ZeroGSShaders/CMakeLists.txt +++ b/plugins/zzogl-pg-cg/opengl/ZeroGSShaders/CMakeLists.txt @@ -26,36 +26,36 @@ set(OptimizationFlags # Debug - Build if(CMAKE_BUILD_TYPE STREQUAL Debug) # add defines - add_definitions(${CommonFlags} -g -Wall -D_DEBUG) + set(zerogsshadersFinalFlags + ${CommonFlags} -g -Wall -D_DEBUG + ) endif(CMAKE_BUILD_TYPE STREQUAL Debug) # Devel - Build if(CMAKE_BUILD_TYPE STREQUAL Devel) # add defines - add_definitions(${CommonFlags} ${OptimizationFlags} -g -W -DZEROGS_DEVBUILD) + set(zerogsshadersFinalFlags + ${CommonFlags} ${OptimizationFlags} -g -W -DZEROGS_DEVBUILD + ) endif(CMAKE_BUILD_TYPE STREQUAL Devel) # Release - Build if(CMAKE_BUILD_TYPE STREQUAL Release) # add defines - add_definitions(${CommonFlags} ${OptimizationFlags} -W) + set(zerogsshadersFinalFlags + ${CommonFlags} ${OptimizationFlags} -W + ) endif(CMAKE_BUILD_TYPE STREQUAL Release) -include_directories(.) +set(zerogsshadersFinalSources + zerogsshaders.cpp + zpipe.cpp +) -# add library -add_executable(${Output} zerogsshaders.cpp zpipe.cpp) +set(zerogsshadersFinalLibs + ${ZLIB_LIBRARIES} + ${CG_LIBRARIES} + ${OPENGL_LIBRARIES} +) -# link target with zlib -target_link_libraries(${Output} ${ZLIB_LIBRARIES}) - -# link target with Cg -target_link_libraries(${Output} ${CG_LIBRARIES}) - -# link target with opengl -target_link_libraries(${Output} ${OPENGL_LIBRARIES}) - -# 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 "") +add_pcsx2_executable(${Output} "${zerogsshadersFinalSources}" "${zerogsshadersFinalLibs}" "${zerogsshadersFinalFlags}") diff --git a/plugins/zzogl-pg/opengl/CMakeLists.txt b/plugins/zzogl-pg/opengl/CMakeLists.txt index bfbd3e881e..4a2aea095b 100644 --- a/plugins/zzogl-pg/opengl/CMakeLists.txt +++ b/plugins/zzogl-pg/opengl/CMakeLists.txt @@ -28,39 +28,60 @@ set(OptimizationFlags #Clang doesn't support a few common flags that GCC does. if(NOT USE_CLANG) - add_definitions(${CommonFlags} -fno-regmove) + set(zzoglFinalFlags + ${zzoglFinalFlags} + ${CommonFlags} -fno-regmove + ) endif(NOT USE_CLANG) # Debug - Build if(CMAKE_BUILD_TYPE STREQUAL Debug) # add defines - add_definitions(${CommonFlags} -g -Wall -D_DEBUG) + set(zzoglFinalFlags + ${zzoglFinalFlags} + ${CommonFlags} -g -Wall -D_DEBUG + ) endif(CMAKE_BUILD_TYPE STREQUAL Debug) # Devel - Build if(CMAKE_BUILD_TYPE STREQUAL Devel) # add defines - add_definitions(${CommonFlags} ${OptimizationFlags} -g -W -DZEROGS_DEVBUILD) + set(zzoglFinalFlags + ${zzoglFinalFlags} + ${CommonFlags} ${OptimizationFlags} -g -W -DZEROGS_DEVBUILD + ) endif(CMAKE_BUILD_TYPE STREQUAL Devel) # Release - Build if(CMAKE_BUILD_TYPE STREQUAL Release) # add defines - add_definitions(${CommonFlags} ${OptimizationFlags} -W) + set(zzoglFinalFlags + ${zzoglFinalFlags} + ${CommonFlags} ${OptimizationFlags} -W + ) endif(CMAKE_BUILD_TYPE STREQUAL Release) # Select the shader API if(GLSL_API) - add_definitions(-DGLSL4_API -DOGL4_LOG) - #add_definitions(-DGLSL_API) + set(zzoglFinalFlags + ${zzoglFinalFlags} + -DGLSL4_API -DOGL4_LOG + ) + #-DGLSL_API else(GLSL_API) - add_definitions(-DNVIDIA_CG_API) + set(zzoglFinalFlags + ${zzoglFinalFlags} + -DNVIDIA_CG_API + ) endif(GLSL_API) # Select the EGL API if(EGL_API AND EGL_FOUND) if (EGL_GL_CONTEXT_SUPPORT) - add_definitions(-DEGL_API) + set(zzoglFinalFlags + ${zzoglFinalFlags} + -DEGL_API + ) else() message(WARNING "Current EGL implementation doesn't support openGL context. Fallback to standard GLX.") endif() @@ -154,60 +175,56 @@ set(zzoglLinuxSources set(zzoglLinuxHeaders Linux/Linux.h) +set(zzoglFinalSources + ${zzoglSources} + ${zzoglHeaders} + ${zzoglShaderSources} + ${zzoglLinuxSources} + ${zzoglLinuxHeaders} +) + +set(zzoglFinalLibs + Utilities + ${OPENGL_LIBRARIES} +) + # add additional include directories -include_directories(. - Linux) +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() -# add library -add_library(${Output} SHARED - ${zzoglSources} - ${zzoglHeaders} - ${zzoglShaderSources} - ${zzoglLinuxSources} - ${zzoglLinuxHeaders}) +if(EGL_API AND EGL_FOUND AND EGL_GL_CONTEXT_SUPPORT) + set(zzoglFinalLibs + ${zzoglFinalLibs} + ${EGL_LIBRARIES} + ) +endif() + +if(NOT GLSL_API) + set(zzoglFinalLibs + ${zzoglFinalLibs} + ${CG_LIBRARIES} + ) +endif(NOT GLSL_API) + +set(zzoglFinalLibs + ${zzoglFinalLibs} + ${GLEW_LIBRARY} + ${X11_LIBRARIES} + ${JPEG_LIBRARIES} + ${GTK2_LIBRARIES} + ${ZLIB_LIBRARIES} + ${LIBC_LIBRARIES} +) + +add_pcsx2_plugin(${Output} "${zzoglFinalSources}" "${zzoglFinalLibs}" "${zzoglFinalFlags}") # Trick that allow to compile zzogl with GSOPEN2 and the replayer with GSOPEN set_target_properties(${Output} PROPERTIES COMPILE_DEFINITIONS USE_GSOPEN2) -# link target with project internal libraries -target_link_libraries(${Output} Utilities) - -# link target with the various opengl flavor -target_link_libraries(${Output} ${OPENGL_LIBRARIES}) -if(EGL_API AND EGL_FOUND AND EGL_GL_CONTEXT_SUPPORT) - target_link_libraries(${Output} ${EGL_LIBRARIES}) -endif() -if(NOT GLSL_API) - target_link_libraries(${Output} ${CG_LIBRARIES}) -endif(NOT GLSL_API) - -target_link_libraries(${Output} ${GLEW_LIBRARY}) - -target_link_libraries(${Output} ${X11_LIBRARIES}) -target_link_libraries(${Output} ${JPEG_LIBRARIES}) - -if(Linux) - target_link_libraries(${Output} ${GTK2_LIBRARIES}) -endif(Linux) - -target_link_libraries(${Output} ${ZLIB_LIBRARIES}) - -# 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() - install(TARGETS ${Output} DESTINATION ${CMAKE_SOURCE_DIR}/bin/plugins) -endif() - if(NOT GLSL_API AND NOT REBUILD_SHADER) if(PACKAGE_MODE) install(FILES ${CMAKE_SOURCE_DIR}/plugins/zzogl-pg/opengl/ps2hw.dat DESTINATION ${PLUGIN_DIR}) @@ -219,50 +236,9 @@ endif() ################################### Replay Loader 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}) -if(EGL_API AND EGL_FOUND AND EGL_GL_CONTEXT_SUPPORT) - target_link_libraries(${Static} ${EGL_LIBRARIES}) -endif() - 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) + set(zzoglReplayLoaderFinalSources + ${zzoglFinalSources} + linux_replay.cpp + ) + add_pcsx2_executable(${Replay} "${zzoglReplayLoaderFinalSources}" "${zzoglFinalLibs}" "${zzoglFinalFlags}") endif(BUILD_REPLAY_LOADERS) diff --git a/plugins/zzogl-pg/opengl/ZeroGSShaders/CMakeLists.txt b/plugins/zzogl-pg/opengl/ZeroGSShaders/CMakeLists.txt index 143a487c94..4b428bd9f8 100644 --- a/plugins/zzogl-pg/opengl/ZeroGSShaders/CMakeLists.txt +++ b/plugins/zzogl-pg/opengl/ZeroGSShaders/CMakeLists.txt @@ -26,39 +26,39 @@ set(OptimizationFlags # Debug - Build if(CMAKE_BUILD_TYPE STREQUAL Debug) # add defines - add_definitions(${CommonFlags} -g -Wall -D_DEBUG) + set(zerogsshadersFinalFlags + ${CommonFlags} -g -Wall -D_DEBUG + ) endif(CMAKE_BUILD_TYPE STREQUAL Debug) # Devel - Build if(CMAKE_BUILD_TYPE STREQUAL Devel) # add defines - add_definitions(${CommonFlags} ${OptimizationFlags} -g -W -DZEROGS_DEVBUILD) + set(zerogsshadersFinalFlags + ${CommonFlags} ${OptimizationFlags} -g -W -DZEROGS_DEVBUILD + ) endif(CMAKE_BUILD_TYPE STREQUAL Devel) # Release - Build if(CMAKE_BUILD_TYPE STREQUAL Release) # add defines - add_definitions(${CommonFlags} ${OptimizationFlags} -W) + set(zerogsshadersFinalFlags + ${CommonFlags} ${OptimizationFlags} -W + ) endif(CMAKE_BUILD_TYPE STREQUAL Release) -include_directories(.) +set(zerogsshadersFinalSources + zerogsshaders.cpp + zpipe.cpp +) -# add library -add_executable(${Output} zerogsshaders.cpp zpipe.cpp) +set(zerogsshadersFinalLibs + ${ZLIB_LIBRARIES} + ${CG_LIBRARIES} + ${OPENGL_LIBRARIES} +) -# link target with zlib -target_link_libraries(${Output} ${ZLIB_LIBRARIES}) - -# link target with Cg -target_link_libraries(${Output} ${CG_LIBRARIES}) - -# link target with opengl -target_link_libraries(${Output} ${OPENGL_LIBRARIES}) - -# 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 "") +add_pcsx2_executable(${Output} "${zerogsshadersFinalSources}" "${zerogsshadersFinalLibs}" "${zerogsshadersFinalFlags}") # Now build the shader add_custom_command(TARGET ${Output} POST_BUILD diff --git a/tools/bin2cpp/CMakeLists.txt b/tools/bin2cpp/CMakeLists.txt index db42d98f59..16896200d9 100644 --- a/tools/bin2cpp/CMakeLists.txt +++ b/tools/bin2cpp/CMakeLists.txt @@ -6,19 +6,25 @@ set(bin2cppName bin2cpp) # Debug - Build if(CMAKE_BUILD_TYPE STREQUAL Debug) # add defines - add_definitions(-O2 -s -Wall -fexceptions) + set(bin2cppFinalFlags + -O2 -s -Wall -fexceptions + ) endif(CMAKE_BUILD_TYPE STREQUAL Debug) # Devel - Build if(CMAKE_BUILD_TYPE STREQUAL Devel) # add defines - add_definitions(-O2 -s -Wall -fexceptions) + set(bin2cppFinalFlags + -O2 -s -Wall -fexceptions + ) endif(CMAKE_BUILD_TYPE STREQUAL Devel) # Release - Build if(CMAKE_BUILD_TYPE STREQUAL Release) # add defines - add_definitions(-O2 -s -Wall -fexceptions) + set(bin2cppFinalFlags + -O2 -s -Wall -fexceptions + ) endif(CMAKE_BUILD_TYPE STREQUAL Release) # variable with all sources of this executable @@ -29,7 +35,12 @@ set(bin2cppHeaders ) # add executable -add_executable(${bin2cppName} ${bin2cppSources} ${bin2cppHeaders}) +set(bin2cppFinalSources + ${bin2cppSources} + ${bin2cppHeaders} +) + +add_pcsx2_executable(${bin2cppName} "${bin2cppFinalSources}" "" "${bin2cppFinalFlags}") # set output directory # set_target_properties(${bin2cppName} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/tools/bin) From e8d13090b01cc1dff851102b185482d13d885ff3 Mon Sep 17 00:00:00 2001 From: uyjulian Date: Sun, 31 Aug 2014 07:23:33 -0500 Subject: [PATCH 8/8] Look for GLESv3 header instead of GLESv2 header --- cmake/SearchForStuff.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/SearchForStuff.cmake b/cmake/SearchForStuff.cmake index e37283201e..87e9fccb39 100644 --- a/cmake/SearchForStuff.cmake +++ b/cmake/SearchForStuff.cmake @@ -41,7 +41,7 @@ include(FindLibc) include(CheckLib) check_lib(AIO aio aio.h) check_lib(EGL egl EGL/egl.h) -check_lib(GLESV2 GLESv2 GLES2/gl2.h) +check_lib(GLESV2 GLESv2 GLES3/gl3ext.h) # NOTE: looking for GLESv3, not GLESv2 check_lib(PORTAUDIO portaudio portaudio.h pa_linux_alsa.h) check_lib(SOUNDTOUCH SoundTouch soundtouch/SoundTouch.h)