diff --git a/CMakeLists.txt b/CMakeLists.txt index c143a877d3..07fa4b5bc7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -35,58 +35,58 @@ get_git_version_info() write_svnrev_h() if(NOT NO_TRANSLATION) - # make the translation - if(EXISTS "${CMAKE_SOURCE_DIR}/locales") - add_subdirectory(locales) - endif() + # make the translation + if(EXISTS "${CMAKE_SOURCE_DIR}/locales") + add_subdirectory(locales) + endif() endif() # make common if(common_libs) - add_subdirectory(common/src/Utilities) - add_subdirectory(common/src/x86emitter) + add_subdirectory(common/src/Utilities) + add_subdirectory(common/src/x86emitter) endif() # make pcsx2 if(EXISTS "${CMAKE_SOURCE_DIR}/pcsx2" AND pcsx2_core) - add_subdirectory(pcsx2) + add_subdirectory(pcsx2) endif() # tests if(ACTUALLY_ENABLE_TESTS) - add_subdirectory(3rdparty/gtest EXCLUDE_FROM_ALL) - add_subdirectory(tests/ctest) + add_subdirectory(3rdparty/gtest EXCLUDE_FROM_ALL) + add_subdirectory(tests/ctest) endif() #------------------------------------------------------------------------------- # Install some files to ease package creation if(PACKAGE_MODE) - if(NOT DISABLE_CHEATS_ZIP) - INSTALL(FILES "${CMAKE_SOURCE_DIR}/bin/cheats_ws.zip" DESTINATION "${CMAKE_INSTALL_DATADIR}/PCSX2") - endif() - INSTALL(FILES "${CMAKE_SOURCE_DIR}/bin/GameIndex.yaml" DESTINATION "${CMAKE_INSTALL_DATADIR}/PCSX2") + if(NOT DISABLE_CHEATS_ZIP) + INSTALL(FILES "${CMAKE_SOURCE_DIR}/bin/cheats_ws.zip" DESTINATION "${CMAKE_INSTALL_DATADIR}/PCSX2") + endif() + INSTALL(FILES "${CMAKE_SOURCE_DIR}/bin/GameIndex.yaml" DESTINATION "${CMAKE_INSTALL_DATADIR}/PCSX2") - # set categories depending on system/distribution in pcsx2.desktop - if(openSUSE) - set(PCSX2_MENU_CATEGORIES "System;Emulator;") - else() - set(PCSX2_MENU_CATEGORIES "Game;Emulator;") - endif() - configure_file("${CMAKE_SOURCE_DIR}/linux_various/PCSX2.desktop.in" "${CMAKE_BINARY_DIR}/linux_various/PCSX2.desktop" @ONLY) + # set categories depending on system/distribution in pcsx2.desktop + if(openSUSE) + set(PCSX2_MENU_CATEGORIES "System;Emulator;") + else() + set(PCSX2_MENU_CATEGORIES "Game;Emulator;") + endif() + configure_file("${CMAKE_SOURCE_DIR}/linux_various/PCSX2.desktop.in" "${CMAKE_BINARY_DIR}/linux_various/PCSX2.desktop" @ONLY) - INSTALL(FILES "${CMAKE_BINARY_DIR}/linux_various/PCSX2.desktop" DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/applications") - INSTALL(FILES "${CMAKE_SOURCE_DIR}/linux_various/PCSX2.xpm" DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/pixmaps") - INSTALL(FILES "${CMAKE_SOURCE_DIR}/bin/docs/PCSX2_FAQ.pdf" DESTINATION "${CMAKE_INSTALL_DOCDIR}") - INSTALL(FILES "${CMAKE_SOURCE_DIR}/bin/docs/Configuration_Guide.pdf" DESTINATION "${CMAKE_INSTALL_DOCDIR}") - INSTALL(FILES "${CMAKE_SOURCE_DIR}/bin/docs/PCSX2.1" DESTINATION "${CMAKE_INSTALL_MANDIR}/man1") - if(NOT DISABLE_PCSX2_WRAPPER) - INSTALL(FILES "${CMAKE_SOURCE_DIR}/linux_various/PCSX2-linux.sh" DESTINATION "${CMAKE_INSTALL_BINDIR}") - endif() + INSTALL(FILES "${CMAKE_BINARY_DIR}/linux_various/PCSX2.desktop" DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/applications") + INSTALL(FILES "${CMAKE_SOURCE_DIR}/linux_various/PCSX2.xpm" DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/pixmaps") + INSTALL(FILES "${CMAKE_SOURCE_DIR}/bin/docs/PCSX2_FAQ.pdf" DESTINATION "${CMAKE_INSTALL_DOCDIR}") + INSTALL(FILES "${CMAKE_SOURCE_DIR}/bin/docs/Configuration_Guide.pdf" DESTINATION "${CMAKE_INSTALL_DOCDIR}") + INSTALL(FILES "${CMAKE_SOURCE_DIR}/bin/docs/PCSX2.1" DESTINATION "${CMAKE_INSTALL_MANDIR}/man1") + if(NOT DISABLE_PCSX2_WRAPPER) + INSTALL(FILES "${CMAKE_SOURCE_DIR}/linux_various/PCSX2-linux.sh" DESTINATION "${CMAKE_INSTALL_BINDIR}") + endif() else() - if(NOT DISABLE_PCSX2_WRAPPER) - # special case to avoid having linux files in windows - INSTALL(FILES "${CMAKE_SOURCE_DIR}/linux_various/PCSX2-linux.sh" DESTINATION "${CMAKE_SOURCE_DIR}/bin") - endif() + if(NOT DISABLE_PCSX2_WRAPPER) + # special case to avoid having linux files in windows + INSTALL(FILES "${CMAKE_SOURCE_DIR}/linux_various/PCSX2-linux.sh" DESTINATION "${CMAKE_SOURCE_DIR}/bin") + endif() endif() diff --git a/cmake/ApiValidation.cmake b/cmake/ApiValidation.cmake index f93bc67fcd..10051fcf2a 100644 --- a/cmake/ApiValidation.cmake +++ b/cmake/ApiValidation.cmake @@ -7,7 +7,7 @@ set(wx_sdl_c_code " int main() { - return 0; + return 0; } ") @@ -20,7 +20,7 @@ set(gcc7_mmx_code " class alignas(16) GSVector4i { public: - __m128i m; + __m128i m; explicit GSVector4i(__m128i m) { @@ -59,7 +59,7 @@ void GIFRegHandlerTRXPOS(const GIFRegTRXPOS& p) { if(p != TRXPOS) { - printf(\"foo\"); + printf(\"foo\"); } TRXPOS = (GSVector4i)p; @@ -67,77 +67,77 @@ void GIFRegHandlerTRXPOS(const GIFRegTRXPOS& p) int main() { - GIFRegTRXPOS r = {}; - GIFRegHandlerTRXPOS(r); + GIFRegTRXPOS r = {}; + GIFRegHandlerTRXPOS(r); - uint16_t fpu[16] = {0}; - __asm__ __volatile__(\"fstenv %0\" : \"=m\"(fpu)); + uint16_t fpu[16] = {0}; + __asm__ __volatile__(\"fstenv %0\" : \"=m\"(fpu)); - bool ok = fpu[4] == 0xFFFF; + bool ok = fpu[4] == 0xFFFF; - if (!ok) { - printf(\"Wrong MMX state !\"); - exit(1); - } + if (!ok) { + printf(\"Wrong MMX state !\"); + exit(1); + } - return 0; + return 0; } ") function(WX_vs_SDL) - file(WRITE "${CMAKE_BINARY_DIR}/wx_sdl.c" "${wx_sdl_c_code}") - enable_language(C) + file(WRITE "${CMAKE_BINARY_DIR}/wx_sdl.c" "${wx_sdl_c_code}") + enable_language(C) - try_compile( - wx_linked_to_sdl - "${CMAKE_BINARY_DIR}" - "${CMAKE_BINARY_DIR}/wx_sdl.c" - CMAKE_FLAGS "-DINCLUDE_DIRECTORIES:STRING=${wxWidgets_INCLUDE_DIRS}" - LINK_LIBRARIES "${wxWidgets_LIBRARIES}" - COPY_FILE "${CMAKE_BINARY_DIR}/wx_sdl" - ) + try_compile( + wx_linked_to_sdl + "${CMAKE_BINARY_DIR}" + "${CMAKE_BINARY_DIR}/wx_sdl.c" + CMAKE_FLAGS "-DINCLUDE_DIRECTORIES:STRING=${wxWidgets_INCLUDE_DIRS}" + LINK_LIBRARIES "${wxWidgets_LIBRARIES}" + COPY_FILE "${CMAKE_BINARY_DIR}/wx_sdl" + ) - if (NOT wx_linked_to_sdl) - return() - endif() + if (NOT wx_linked_to_sdl) + return() + endif() - execute_process( - COMMAND ldd "${CMAKE_BINARY_DIR}/wx_sdl" - COMMAND grep -c SDL2 - OUTPUT_VARIABLE sdl2_count - ) + execute_process( + COMMAND ldd "${CMAKE_BINARY_DIR}/wx_sdl" + COMMAND grep -c SDL2 + OUTPUT_VARIABLE sdl2_count + ) - if (SDL2_API AND sdl2_count STREQUAL "0") - message(FATAL_ERROR "wxWidgets is linked to SDL1.2. Please use -DSDL2_API=FALSE.") - elseif (NOT SDL2_API AND NOT sdl2_count STREQUAL "0") - message(FATAL_ERROR "wxWidgets is linked to SDL2. Please use -DSDL2_API=TRUE") - endif() + if (SDL2_API AND sdl2_count STREQUAL "0") + message(FATAL_ERROR "wxWidgets is linked to SDL1.2. Please use -DSDL2_API=FALSE.") + elseif (NOT SDL2_API AND NOT sdl2_count STREQUAL "0") + message(FATAL_ERROR "wxWidgets is linked to SDL2. Please use -DSDL2_API=TRUE") + endif() endfunction() function(GCC7_BUG) - # try_run doesn't work when cross-compiling is enabled. It is completely silly in our case - # as i386 binaries are 100% fine on x64. - set(OLD_CMAKE_CROSSCOMPILING ${CMAKE_CROSSCOMPILING}) - set(CMAKE_CROSSCOMPILING 0) + # try_run doesn't work when cross-compiling is enabled. It is completely silly in our case + # as i386 binaries are 100% fine on x64. + set(OLD_CMAKE_CROSSCOMPILING ${CMAKE_CROSSCOMPILING}) + set(CMAKE_CROSSCOMPILING 0) - set(IN "${CMAKE_BINARY_DIR}/gcc7_mmx.cpp") - file(WRITE "${IN}" "${gcc7_mmx_code}") + set(IN "${CMAKE_BINARY_DIR}/gcc7_mmx.cpp") + file(WRITE "${IN}" "${gcc7_mmx_code}") - enable_language(CXX) + enable_language(CXX) - try_run( - run_result - compile_result_unused - "${CMAKE_BINARY_DIR}" - "${IN}" - CMAKE_FLAGS "-DCOMPILE_DEFINITIONS:STRING=-msse -msse2 -O2 -m32 -march=i686" - ) + try_run( + run_result + compile_result_unused + "${CMAKE_BINARY_DIR}" + "${IN}" + CMAKE_FLAGS "-DCOMPILE_DEFINITIONS:STRING=-msse -msse2 -O2 -m32 -march=i686" + ) - if (${run_result}) - message(FATAL_ERROR "GCC 7.0/7.1 generates invalid code => https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80799\n" - "You can either backport the fix or swith to another version of GCC.") - endif() + if (${run_result}) + message(FATAL_ERROR "GCC 7.0/7.1 generates invalid code => https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80799\n" + "You can either backport the fix or swith to another version of GCC.") + endif() - set(CMAKE_CROSSCOMPILING ${OLD_CMAKE_CROSSCOMPILING}) + set(CMAKE_CROSSCOMPILING ${OLD_CMAKE_CROSSCOMPILING}) endfunction() diff --git a/cmake/BuildParameters.cmake b/cmake/BuildParameters.cmake index 8b96060cff..55f0ed3e45 100644 --- a/cmake/BuildParameters.cmake +++ b/cmake/BuildParameters.cmake @@ -17,8 +17,8 @@ option(ENABLE_TESTS "Enables building the unit tests" ON) option(USE_SYSTEM_YAML "Uses a system version of yaml, if found") if(DISABLE_BUILD_DATE OR openSUSE) - message(STATUS "Disabling the inclusion of the binary compile date.") - add_definitions(-DDISABLE_BUILD_DATE) + message(STATUS "Disabling the inclusion of the binary compile date.") + add_definitions(-DDISABLE_BUILD_DATE) endif() option(USE_VTUNE "Plug VTUNE to profile GS JIT.") @@ -42,17 +42,17 @@ option(SDL2_API "Use SDL2 on SPU2 and PAD Linux (wxWidget mustn't be built with option(GTK2_API "Use GTK2 api (legacy)") if(PACKAGE_MODE) - # Compile all source codes with those defines - add_definitions( - -DPLUGIN_DIR_COMPILATION=${CMAKE_INSTALL_FULL_LIBDIR}/PCSX2 - -DGAMEINDEX_DIR_COMPILATION=${CMAKE_INSTALL_FULL_DATADIR}/PCSX2 - -DDOC_DIR_COMPILATION=${CMAKE_INSTALL_FULL_DOCDIR} - ) + # Compile all source codes with those defines + add_definitions( + -DPLUGIN_DIR_COMPILATION=${CMAKE_INSTALL_FULL_LIBDIR}/PCSX2 + -DGAMEINDEX_DIR_COMPILATION=${CMAKE_INSTALL_FULL_DATADIR}/PCSX2 + -DDOC_DIR_COMPILATION=${CMAKE_INSTALL_FULL_DOCDIR} + ) endif() if(APPLE) - option(OSX_USE_DEFAULT_SEARCH_PATH "Don't prioritize system library paths" OFF) - option(SKIP_POSTPROCESS_BUNDLE "Skip postprocessing bundle for redistributability" OFF) + option(OSX_USE_DEFAULT_SEARCH_PATH "Don't prioritize system library paths" OFF) + option(SKIP_POSTPROCESS_BUNDLE "Skip postprocessing bundle for redistributability" OFF) endif() #------------------------------------------------------------------------------- @@ -61,16 +61,16 @@ endif() option(USE_ASAN "Enable address sanitizer") if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang") - set(USE_CLANG TRUE) - message(STATUS "Building with Clang/LLVM.") + set(USE_CLANG TRUE) + message(STATUS "Building with Clang/LLVM.") elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Intel") - set(USE_ICC TRUE) - message(STATUS "Building with Intel's ICC.") + set(USE_ICC TRUE) + message(STATUS "Building with Intel's ICC.") elseif(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") - set(USE_GCC TRUE) - message(STATUS "Building with GNU GCC") + set(USE_GCC TRUE) + message(STATUS "Building with GNU GCC") else() - message(FATAL_ERROR "Unknown compiler: ${CMAKE_CXX_COMPILER_ID}") + message(FATAL_ERROR "Unknown compiler: ${CMAKE_CXX_COMPILER_ID}") endif() #------------------------------------------------------------------------------- @@ -82,13 +82,13 @@ option(BUILTIN_USB "Disable support of USB plugin (developer option)") set(PLUGIN_SUPPORT "") if(BUILTIN_GS) - set(PLUGIN_SUPPORT "${PLUGIN_SUPPORT} -DBUILTIN_GS_PLUGIN") + set(PLUGIN_SUPPORT "${PLUGIN_SUPPORT} -DBUILTIN_GS_PLUGIN") endif() if(BUILTIN_PAD) - set(PLUGIN_SUPPORT "${PLUGIN_SUPPORT} -DBUILTIN_PAD_PLUGIN") + set(PLUGIN_SUPPORT "${PLUGIN_SUPPORT} -DBUILTIN_PAD_PLUGIN") endif() if(BUILTIN_USB) - set(PLUGIN_SUPPORT "${PLUGIN_SUPPORT} -DBUILTIN_USB_PLUGIN") + set(PLUGIN_SUPPORT "${PLUGIN_SUPPORT} -DBUILTIN_USB_PLUGIN") endif() #------------------------------------------------------------------------------- @@ -102,7 +102,7 @@ if(NOT CMAKE_BUILD_TYPE MATCHES "Debug|Devel|Release|Prof") endif() # AVX2 doesn't play well with gdb if(CMAKE_BUILD_TYPE MATCHES "Debug") - SET(DISABLE_ADVANCE_SIMD ON) + SET(DISABLE_ADVANCE_SIMD ON) endif() # Initially strip was disabled on release build but it is not stackstrace friendly! @@ -110,13 +110,13 @@ endif() option(CMAKE_BUILD_STRIP "Srip binaries to save a couple of MB (developer option)") if(NOT DEFINED CMAKE_BUILD_PO) - if(CMAKE_BUILD_TYPE STREQUAL "Release") - set(CMAKE_BUILD_PO TRUE) - message(STATUS "Enable the building of po files by default in ${CMAKE_BUILD_TYPE} build !!!") - else() - set(CMAKE_BUILD_PO FALSE) - message(STATUS "Disable the building of po files by default in ${CMAKE_BUILD_TYPE} build !!!") - endif() + if(CMAKE_BUILD_TYPE STREQUAL "Release") + set(CMAKE_BUILD_PO TRUE) + message(STATUS "Enable the building of po files by default in ${CMAKE_BUILD_TYPE} build !!!") + else() + set(CMAKE_BUILD_PO FALSE) + message(STATUS "Disable the building of po files by default in ${CMAKE_BUILD_TYPE} build !!!") + endif() endif() #------------------------------------------------------------------------------- @@ -126,9 +126,9 @@ option(DISABLE_ADVANCE_SIMD "Disable advance use of SIMD (SSE2+ & AVX)" OFF) # Print if we are cross compiling. if(CMAKE_CROSSCOMPILING) - message(STATUS "Cross compilation is enabled.") + message(STATUS "Cross compilation is enabled.") else() - message(STATUS "Cross compilation is disabled.") + message(STATUS "Cross compilation is disabled.") endif() # Architecture bitness detection @@ -141,57 +141,57 @@ else() endif() if(${PCSX2_TARGET_ARCHITECTURES} MATCHES "i386") - # * -fPIC option was removed for multiple reasons. - # - Code only supports the x86 architecture. - # - code uses the ebx register so it's not compliant with PIC. - # - Impacts the performance too much. - # - Only plugins. No package will link to them. - set(CMAKE_POSITION_INDEPENDENT_CODE OFF) + # * -fPIC option was removed for multiple reasons. + # - Code only supports the x86 architecture. + # - code uses the ebx register so it's not compliant with PIC. + # - Impacts the performance too much. + # - Only plugins. No package will link to them. + set(CMAKE_POSITION_INDEPENDENT_CODE OFF) - if(NOT DEFINED ARCH_FLAG) - if (DISABLE_ADVANCE_SIMD) - if (USE_ICC) - set(ARCH_FLAG "-msse2 -msse4.1") - else() - set(ARCH_FLAG "-msse -msse2 -msse4.1 -mfxsr -march=i686") - endif() - else() - # AVX requires some fix of the ABI (mangling) (default 2) - # Note: V6 requires GCC 4.7 - #set(ARCH_FLAG "-march=native -fabi-version=6") - set(ARCH_FLAG "-mfxsr -march=native") - endif() - endif() + if(NOT DEFINED ARCH_FLAG) + if (DISABLE_ADVANCE_SIMD) + if (USE_ICC) + set(ARCH_FLAG "-msse2 -msse4.1") + else() + set(ARCH_FLAG "-msse -msse2 -msse4.1 -mfxsr -march=i686") + endif() + else() + # AVX requires some fix of the ABI (mangling) (default 2) + # Note: V6 requires GCC 4.7 + #set(ARCH_FLAG "-march=native -fabi-version=6") + set(ARCH_FLAG "-mfxsr -march=native") + endif() + endif() - add_definitions(-D_ARCH_32=1 -D_M_X86=1 -D_M_X86_32=1) - set(_ARCH_32 1) - set(_M_X86 1) - set(_M_X86_32 1) + add_definitions(-D_ARCH_32=1 -D_M_X86=1 -D_M_X86_32=1) + set(_ARCH_32 1) + set(_M_X86 1) + set(_M_X86_32 1) elseif(${PCSX2_TARGET_ARCHITECTURES} MATCHES "x86_64") - # x86_64 requires -fPIC - set(CMAKE_POSITION_INDEPENDENT_CODE ON) + # x86_64 requires -fPIC + set(CMAKE_POSITION_INDEPENDENT_CODE ON) - if(NOT DEFINED ARCH_FLAG) - if (DISABLE_ADVANCE_SIMD) - if (USE_ICC) - set(ARCH_FLAG "-msse2 -msse4.1") - else() - set(ARCH_FLAG "-msse -msse2 -msse4.1 -mfxsr") - endif() - else() - #set(ARCH_FLAG "-march=native -fabi-version=6") - set(ARCH_FLAG "-march=native") - endif() - endif() - add_definitions(-D_ARCH_64=1 -D_M_X86=1 -D_M_X86_64=1 -D__M_X86_64=1) - set(_ARCH_64 1) - set(_M_X86 1) - set(_M_X86_64 1) + if(NOT DEFINED ARCH_FLAG) + if (DISABLE_ADVANCE_SIMD) + if (USE_ICC) + set(ARCH_FLAG "-msse2 -msse4.1") + else() + set(ARCH_FLAG "-msse -msse2 -msse4.1 -mfxsr") + endif() + else() + #set(ARCH_FLAG "-march=native -fabi-version=6") + set(ARCH_FLAG "-march=native") + endif() + endif() + add_definitions(-D_ARCH_64=1 -D_M_X86=1 -D_M_X86_64=1 -D__M_X86_64=1) + set(_ARCH_64 1) + set(_M_X86 1) + set(_M_X86_64 1) else() - # All but i386 requires -fPIC - set(CMAKE_POSITION_INDEPENDENT_CODE ON) + # All but i386 requires -fPIC + set(CMAKE_POSITION_INDEPENDENT_CODE ON) - message(FATAL_ERROR "Unsupported architecture: ${PCSX2_TARGET_ARCHITECTURES}") + message(FATAL_ERROR "Unsupported architecture: ${PCSX2_TARGET_ARCHITECTURES}") endif() #------------------------------------------------------------------------------- @@ -244,7 +244,7 @@ option(USE_PGO_OPTIMIZE "Enable PGO optimization (use profile)") set(COMMON_FLAG "-pipe -fvisibility=hidden -pthread -fno-builtin-strcmp -fno-builtin-memcmp -mfpmath=sse -fno-operator-names") if(USE_VTUNE) - set(COMMON_FLAG "${COMMON_FLAG} -DENABLE_VTUNE") + set(COMMON_FLAG "${COMMON_FLAG} -DENABLE_VTUNE") endif() # Remove FORTIFY_SOURCE when compiling as debug, because it spams a lot of warnings on clang due to no optimization. @@ -268,11 +268,11 @@ endif() set(DEFAULT_WARNINGS "-Wall -Wextra -Wno-attributes -Wno-unused-function -Wno-unused-parameter -Wno-missing-field-initializers -Wno-deprecated-declarations -Wno-format -Wno-format-security -Wno-overloaded-virtual") if (NOT USE_ICC) - set(DEFAULT_WARNINGS "${DEFAULT_WARNINGS} -Wno-unused-value ") + set(DEFAULT_WARNINGS "${DEFAULT_WARNINGS} -Wno-unused-value ") endif() if (USE_CLANG) - set(DEFAULT_WARNINGS "${DEFAULT_WARNINGS} -Wno-overloaded-virtual ") + set(DEFAULT_WARNINGS "${DEFAULT_WARNINGS} -Wno-overloaded-virtual ") endif() if (USE_GCC) @@ -282,85 +282,85 @@ endif() # -Wstrict-aliasing=n: to fix one day aliasing issue. n=1/2/3 if (USE_ICC) - set(AGGRESSIVE_WARNING "-Wstrict-aliasing ") + set(AGGRESSIVE_WARNING "-Wstrict-aliasing ") else() - set(AGGRESSIVE_WARNING "-Wstrict-aliasing -Wstrict-overflow=1 ") + set(AGGRESSIVE_WARNING "-Wstrict-aliasing -Wstrict-overflow=1 ") endif() if (USE_CLANG) - # -Wno-deprecated-register: glib issue... - set(DEFAULT_WARNINGS "${DEFAULT_WARNINGS} -Wno-deprecated-register -Wno-c++14-extensions") - set(DBG "-g -fno-omit-frame-pointer") + # -Wno-deprecated-register: glib issue... + set(DEFAULT_WARNINGS "${DEFAULT_WARNINGS} -Wno-deprecated-register -Wno-c++14-extensions") + set(DBG "-g -fno-omit-frame-pointer") elseif (USE_ICC) - set(DBG "-g -fno-omit-frame-pointer") + set(DBG "-g -fno-omit-frame-pointer") elseif (USE_GCC) - set(DBG "-ggdb3 -fno-omit-frame-pointer") + set(DBG "-ggdb3 -fno-omit-frame-pointer") endif() if (USE_LTO) - include(ProcessorCount) - ProcessorCount(ncpu) - set(LTO_FLAGS "-fuse-linker-plugin -flto=${ncpu}") - set(DBG "") # not supported with LTO - set(CMAKE_AR /usr/bin/gcc-ar CACHE STRING "Archiver" FORCE) - set(CMAKE_RANLIB /usr/bin/gcc-ranlib CACHE STRING "ranlib" FORCE) - set(CMAKE_NM /usr/bin/gcc-nm CACHE STRING "nm" FORCE) + include(ProcessorCount) + ProcessorCount(ncpu) + set(LTO_FLAGS "-fuse-linker-plugin -flto=${ncpu}") + set(DBG "") # not supported with LTO + set(CMAKE_AR /usr/bin/gcc-ar CACHE STRING "Archiver" FORCE) + set(CMAKE_RANLIB /usr/bin/gcc-ranlib CACHE STRING "ranlib" FORCE) + set(CMAKE_NM /usr/bin/gcc-nm CACHE STRING "nm" FORCE) else() - set(LTO_FLAGS "") + set(LTO_FLAGS "") endif() if (USE_PGO_GENERATE OR USE_PGO_OPTIMIZE) - set(PGO_FLAGS "-fprofile-dir=${CMAKE_SOURCE_DIR}/profile") + set(PGO_FLAGS "-fprofile-dir=${CMAKE_SOURCE_DIR}/profile") endif() if (USE_PGO_GENERATE) - set(PGO_FLAGS "${PGO_FLAGS} -fprofile-generate") + set(PGO_FLAGS "${PGO_FLAGS} -fprofile-generate") endif() if(USE_PGO_OPTIMIZE) - set(PGO_FLAGS "${PGO_FLAGS} -fprofile-use") + set(PGO_FLAGS "${PGO_FLAGS} -fprofile-use") endif() if(CMAKE_BUILD_TYPE MATCHES "Debug") - set(DEBUG_FLAG "${DBG} -DPCSX2_DEVBUILD -DPCSX2_DEBUG -D_DEBUG") + set(DEBUG_FLAG "${DBG} -DPCSX2_DEVBUILD -DPCSX2_DEBUG -D_DEBUG") elseif(CMAKE_BUILD_TYPE MATCHES "Devel") - set(DEBUG_FLAG "${DBG} -DNDEBUG -DPCSX2_DEVBUILD -D_DEVEL") + set(DEBUG_FLAG "${DBG} -DNDEBUG -DPCSX2_DEVBUILD -D_DEVEL") elseif(CMAKE_BUILD_TYPE MATCHES "Release") - set(DEBUG_FLAG "-DNDEBUG") + set(DEBUG_FLAG "-DNDEBUG") elseif(CMAKE_BUILD_TYPE MATCHES "Prof") - # Keep frame pointer and debug information for profiler tool - set(DEBUG_FLAG "-g -fno-omit-frame-pointer -DNDEBUG") + # Keep frame pointer and debug information for profiler tool + set(DEBUG_FLAG "-g -fno-omit-frame-pointer -DNDEBUG") endif() if (USE_ASAN) - set(ASAN_FLAG "-fsanitize=address ${DBG} -DASAN_WORKAROUND") + set(ASAN_FLAG "-fsanitize=address ${DBG} -DASAN_WORKAROUND") else() - set(ASAN_FLAG "") + set(ASAN_FLAG "") endif() if(NOT DEFINED OPTIMIZATION_FLAG) - if (CMAKE_BUILD_TYPE STREQUAL Debug) - if (USE_GCC) - set(OPTIMIZATION_FLAG -Og) - else() - set(OPTIMIZATION_FLAG -O0) - endif() - else() - set(OPTIMIZATION_FLAG -O2) - endif() + if (CMAKE_BUILD_TYPE STREQUAL Debug) + if (USE_GCC) + set(OPTIMIZATION_FLAG -Og) + else() + set(OPTIMIZATION_FLAG -O0) + endif() + else() + set(OPTIMIZATION_FLAG -O2) + endif() endif() if (NOT DEFINED PGO) - set(PGO "none") - set(GCOV_LIBRARIES "") + set(PGO "none") + set(GCOV_LIBRARIES "") else() - set(GCOV_LIBRARIES "-lgcov") + set(GCOV_LIBRARIES "-lgcov") endif() if(USE_CLANG) - if(TIMETRACE) - set(COMMON_FLAG "${COMMON_FLAG} -ftime-trace ") - endif() + if(TIMETRACE) + set(COMMON_FLAG "${COMMON_FLAG} -ftime-trace ") + endif() endif() # Note: -DGTK_DISABLE_DEPRECATED can be used to test a build without gtk deprecated feature. It could be useful to port to a newer API @@ -377,15 +377,15 @@ set(DEFAULT_CPP_FLAG "${DEFAULT_GCC_FLAG} -Wno-invalid-offsetof") # TODO: once we completely clean all flags management, this mess could be cleaned ;) ### linker flags if(DEFINED USER_CMAKE_LD_FLAGS) - message(STATUS "Pcsx2 is very sensible with gcc flags, so use USER_CMAKE_LD_FLAGS at your own risk !!!") - string(STRIP "${USER_CMAKE_LD_FLAGS}" USER_CMAKE_LD_FLAGS) + message(STATUS "Pcsx2 is very sensible with gcc flags, so use USER_CMAKE_LD_FLAGS at your own risk !!!") + string(STRIP "${USER_CMAKE_LD_FLAGS}" USER_CMAKE_LD_FLAGS) else() - set(USER_CMAKE_LD_FLAGS "") + set(USER_CMAKE_LD_FLAGS "") endif() # ask the linker to strip the binary if(CMAKE_BUILD_STRIP) - string(STRIP "${USER_CMAKE_LD_FLAGS} -s" USER_CMAKE_LD_FLAGS) + string(STRIP "${USER_CMAKE_LD_FLAGS} -s" USER_CMAKE_LD_FLAGS) endif() @@ -393,8 +393,8 @@ endif() # Note CMAKE_C_FLAGS is also send to the linker. # By default allow build on amd64 machine if(DEFINED USER_CMAKE_C_FLAGS) - message(STATUS "Pcsx2 is very sensible with gcc flags, so use USER_CMAKE_C_FLAGS at your own risk !!!") - string(STRIP "${USER_CMAKE_C_FLAGS}" CMAKE_C_FLAGS) + message(STATUS "Pcsx2 is very sensible with gcc flags, so use USER_CMAKE_C_FLAGS at your own risk !!!") + string(STRIP "${USER_CMAKE_C_FLAGS}" CMAKE_C_FLAGS) endif() # Use some default machine flags string(STRIP "${CMAKE_C_FLAGS} ${DEFAULT_GCC_FLAG}" CMAKE_C_FLAGS) @@ -404,8 +404,8 @@ string(STRIP "${CMAKE_C_FLAGS} ${DEFAULT_GCC_FLAG}" CMAKE_C_FLAGS) # Note CMAKE_CXX_FLAGS is also send to the linker. # By default allow build on amd64 machine if(DEFINED USER_CMAKE_CXX_FLAGS) - message(STATUS "Pcsx2 is very sensible with gcc flags, so use USER_CMAKE_CXX_FLAGS at your own risk !!!") - string(STRIP "${USER_CMAKE_CXX_FLAGS}" CMAKE_CXX_FLAGS) + message(STATUS "Pcsx2 is very sensible with gcc flags, so use USER_CMAKE_CXX_FLAGS at your own risk !!!") + string(STRIP "${USER_CMAKE_CXX_FLAGS}" CMAKE_CXX_FLAGS) endif() # Use some default machine flags string(STRIP "${CMAKE_CXX_FLAGS} ${DEFAULT_CPP_FLAG}" CMAKE_CXX_FLAGS) @@ -417,31 +417,31 @@ string(STRIP "${CMAKE_CXX_FLAGS} ${DEFAULT_CPP_FLAG}" CMAKE_CXX_FLAGS) set(CMAKE_OSX_DEPLOYMENT_TARGET 10.9) if (APPLE AND ${CMAKE_OSX_DEPLOYMENT_TARGET} VERSION_LESS 10.14) - # Older versions of the macOS stdlib don't have operator new(size_t, align_val_t) - # Disable use of them with this flag - # Not great, but also no worse that what we were getting before we turned on C++17 - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-aligned-allocation") + # Older versions of the macOS stdlib don't have operator new(size_t, align_val_t) + # Disable use of them with this flag + # Not great, but also no worse that what we were getting before we turned on C++17 + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-aligned-allocation") endif() # CMake defaults the suffix for modules to .so on macOS but wx tells us that the # extension is .dylib (so that's what we search for) if(APPLE) - set(CMAKE_SHARED_MODULE_SUFFIX ".dylib") + set(CMAKE_SHARED_MODULE_SUFFIX ".dylib") endif() if(CMAKE_SYSTEM_NAME MATCHES "Darwin") - if(NOT OSX_USE_DEFAULT_SEARCH_PATH) - # Hack up the path to prioritize the path to built-in OS libraries to - # increase the chance of not depending on a bunch of copies of them - # installed by MacPorts, Fink, Homebrew, etc, and ending up copying - # them into the bundle. Since we depend on libraries which are not - # part of OS X (wx, etc.), however, don't remove the default path - # entirely. This is still kinda evil, since it defeats the user's - # path settings... - # See http://www.cmake.org/cmake/help/v3.0/command/find_program.html - list(APPEND CMAKE_PREFIX_PATH "/usr") - endif() + if(NOT OSX_USE_DEFAULT_SEARCH_PATH) + # Hack up the path to prioritize the path to built-in OS libraries to + # increase the chance of not depending on a bunch of copies of them + # installed by MacPorts, Fink, Homebrew, etc, and ending up copying + # them into the bundle. Since we depend on libraries which are not + # part of OS X (wx, etc.), however, don't remove the default path + # entirely. This is still kinda evil, since it defeats the user's + # path settings... + # See http://www.cmake.org/cmake/help/v3.0/command/find_program.html + list(APPEND CMAKE_PREFIX_PATH "/usr") + endif() - set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-dead_strip,-dead_strip_dylibs") - set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -Wl,-dead_strip,-dead_strip_dylibs") + set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-dead_strip,-dead_strip_dylibs") + set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -Wl,-dead_strip,-dead_strip_dylibs") endif() diff --git a/cmake/CheckLib.cmake b/cmake/CheckLib.cmake index 9884728fab..d36daf39e6 100644 --- a/cmake/CheckLib.cmake +++ b/cmake/CheckLib.cmake @@ -19,23 +19,23 @@ macro(check_lib var lib) include_directories(${${var}_INCLUDE}) _internal_message("-- ${var} found pkg") else() - find_library(${var}_LIBRARIES ${lib}) + find_library(${var}_LIBRARIES ${lib}) if(_arg_list) find_path(${var}_INCLUDE ${_arg_list}) else() set(${var}_INCLUDE FALSE) endif() - if(${var}_LIBRARIES AND ${var}_INCLUDE) - include_directories(${${var}_INCLUDE}) - _internal_message("-- ${var} found") - set(${var}_FOUND 1 CACHE INTERNAL "") - elseif(${var}_LIBRARIES) - _internal_message("-- ${var} not found (miss include)") - elseif(${var}_INCLUDE) - _internal_message("-- ${var} not found (miss lib)") - else() - _internal_message("-- ${var} not found") - endif() + if(${var}_LIBRARIES AND ${var}_INCLUDE) + include_directories(${${var}_INCLUDE}) + _internal_message("-- ${var} found") + set(${var}_FOUND 1 CACHE INTERNAL "") + elseif(${var}_LIBRARIES) + _internal_message("-- ${var} not found (miss include)") + elseif(${var}_INCLUDE) + _internal_message("-- ${var} not found (miss lib)") + else() + _internal_message("-- ${var} not found") + endif() endif() endmacro() diff --git a/cmake/FindGTK3.cmake b/cmake/FindGTK3.cmake index 78e8266729..f391703190 100644 --- a/cmake/FindGTK3.cmake +++ b/cmake/FindGTK3.cmake @@ -198,28 +198,28 @@ include(SelectLibraryConfigurations) include(CMakeParseArguments) function(_GTK3_GET_VERSION _OUT_major _OUT_minor _OUT_micro _gtkversion_hdr) - file(STRINGS ${_gtkversion_hdr} _contents REGEX "#define GTK_M[A-Z]+_VERSION[ \t]+") - if(_contents) - string(REGEX REPLACE ".*#define GTK_MAJOR_VERSION[ \t]+\\(([0-9]+)\\).*" "\\1" ${_OUT_major} "${_contents}") - string(REGEX REPLACE ".*#define GTK_MINOR_VERSION[ \t]+\\(([0-9]+)\\).*" "\\1" ${_OUT_minor} "${_contents}") - string(REGEX REPLACE ".*#define GTK_MICRO_VERSION[ \t]+\\(([0-9]+)\\).*" "\\1" ${_OUT_micro} "${_contents}") + file(STRINGS ${_gtkversion_hdr} _contents REGEX "#define GTK_M[A-Z]+_VERSION[ \t]+") + if(_contents) + string(REGEX REPLACE ".*#define GTK_MAJOR_VERSION[ \t]+\\(([0-9]+)\\).*" "\\1" ${_OUT_major} "${_contents}") + string(REGEX REPLACE ".*#define GTK_MINOR_VERSION[ \t]+\\(([0-9]+)\\).*" "\\1" ${_OUT_minor} "${_contents}") + string(REGEX REPLACE ".*#define GTK_MICRO_VERSION[ \t]+\\(([0-9]+)\\).*" "\\1" ${_OUT_micro} "${_contents}") - if(NOT ${_OUT_major} MATCHES "[0-9]+") - message(FATAL_ERROR "Version parsing failed for GTK3_MAJOR_VERSION!") - endif() - if(NOT ${_OUT_minor} MATCHES "[0-9]+") - message(FATAL_ERROR "Version parsing failed for GTK3_MINOR_VERSION!") - endif() - if(NOT ${_OUT_micro} MATCHES "[0-9]+") - message(FATAL_ERROR "Version parsing failed for GTK3_MICRO_VERSION!") - endif() + if(NOT ${_OUT_major} MATCHES "[0-9]+") + message(FATAL_ERROR "Version parsing failed for GTK3_MAJOR_VERSION!") + endif() + if(NOT ${_OUT_minor} MATCHES "[0-9]+") + message(FATAL_ERROR "Version parsing failed for GTK3_MINOR_VERSION!") + endif() + if(NOT ${_OUT_micro} MATCHES "[0-9]+") + message(FATAL_ERROR "Version parsing failed for GTK3_MICRO_VERSION!") + endif() - set(${_OUT_major} ${${_OUT_major}} PARENT_SCOPE) - set(${_OUT_minor} ${${_OUT_minor}} PARENT_SCOPE) - set(${_OUT_micro} ${${_OUT_micro}} PARENT_SCOPE) - else() - message(FATAL_ERROR "Include file ${_gtkversion_hdr} does not exist") - endif() + set(${_OUT_major} ${${_OUT_major}} PARENT_SCOPE) + set(${_OUT_minor} ${${_OUT_minor}} PARENT_SCOPE) + set(${_OUT_micro} ${${_OUT_micro}} PARENT_SCOPE) + else() + message(FATAL_ERROR "Include file ${_gtkversion_hdr} does not exist") + endif() endfunction() #============================================================= @@ -230,89 +230,89 @@ endfunction() #============================================================= function(_GTK3_FIND_INCLUDE_DIR _var _hdr) - if(GTK3_DEBUG) - message(STATUS "[FindGTK3.cmake:${CMAKE_CURRENT_LIST_LINE}] " - "_GTK3_FIND_INCLUDE_DIR( ${_var} ${_hdr} )") - endif() + if(GTK3_DEBUG) + message(STATUS "[FindGTK3.cmake:${CMAKE_CURRENT_LIST_LINE}] " + "_GTK3_FIND_INCLUDE_DIR( ${_var} ${_hdr} )") + endif() - set(_gtk3_packages - # If these ever change, things will break. - ${GTK3_ADDITIONAL_SUFFIXES} - glibmm-2.4 - glib-2.0 - atk-1.0 - atkmm-1.6 - cairo - cairomm-1.0 - gdk-pixbuf-2.0 - gdkmm-3.0 - giomm-2.4 - gtk-3.0 - gtkmm-3.0 - libglade-2.0 - libglademm-2.4 - pango-1.0 - pangomm-1.4 - sigc++-2.0 - ) + set(_gtk3_packages + # If these ever change, things will break. + ${GTK3_ADDITIONAL_SUFFIXES} + glibmm-2.4 + glib-2.0 + atk-1.0 + atkmm-1.6 + cairo + cairomm-1.0 + gdk-pixbuf-2.0 + gdkmm-3.0 + giomm-2.4 + gtk-3.0 + gtkmm-3.0 + libglade-2.0 + libglademm-2.4 + pango-1.0 + pangomm-1.4 + sigc++-2.0 + ) - # - # NOTE: The following suffixes cause searching for header files in both of - # these directories: - # /usr/include/ - # /usr/lib//include - # + # + # NOTE: The following suffixes cause searching for header files in both of + # these directories: + # /usr/include/ + # /usr/lib//include + # - set(_suffixes) - foreach(_d ${_gtk3_packages}) - list(APPEND _suffixes ${_d}) - list(APPEND _suffixes ${_d}/include) # for /usr/lib/gtk-3.0/include - endforeach() + set(_suffixes) + foreach(_d ${_gtk3_packages}) + list(APPEND _suffixes ${_d}) + list(APPEND _suffixes ${_d}/include) # for /usr/lib/gtk-3.0/include + endforeach() - if(GTK3_DEBUG) - message(STATUS "[FindGTK3.cmake:${CMAKE_CURRENT_LIST_LINE}] " - "include suffixes = ${_suffixes}") - endif() + if(GTK3_DEBUG) + message(STATUS "[FindGTK3.cmake:${CMAKE_CURRENT_LIST_LINE}] " + "include suffixes = ${_suffixes}") + endif() - if(CMAKE_LIBRARY_ARCHITECTURE) - set(_gtk3_arch_dir /usr/lib/${CMAKE_LIBRARY_ARCHITECTURE}) - if(GTK3_DEBUG) - message(STATUS "Adding ${_gtk3_arch_dir} to search path for multiarch support") - endif() - endif() - find_path(GTK3_${_var}_INCLUDE_DIR ${_hdr} - PATHS - ${_gtk3_arch_dir} - /usr/local/lib64 - /usr/local/lib - /usr/lib64 - /usr/lib - /usr/X11R6/include - /usr/X11R6/lib - /opt/gnome/include - /opt/gnome/lib - /opt/openwin/include - /usr/openwin/lib - /sw/include - /sw/lib - /opt/local/include - /opt/local/lib - /usr/pkg/lib - /usr/pkg/include/glib - $ENV{GTKMM_BASEPATH}/include - $ENV{GTKMM_BASEPATH}/lib - [HKEY_CURRENT_USER\\SOFTWARE\\gtkmm\\3.0;Path]/include - [HKEY_CURRENT_USER\\SOFTWARE\\gtkmm\\3.0;Path]/lib - [HKEY_LOCAL_MACHINE\\SOFTWARE\\gtkmm\\3.0;Path]/include - [HKEY_LOCAL_MACHINE\\SOFTWARE\\gtkmm\\3.0;Path]/lib - PATH_SUFFIXES - ${_suffixes} - ) - mark_as_advanced(GTK3_${_var}_INCLUDE_DIR) + if(CMAKE_LIBRARY_ARCHITECTURE) + set(_gtk3_arch_dir /usr/lib/${CMAKE_LIBRARY_ARCHITECTURE}) + if(GTK3_DEBUG) + message(STATUS "Adding ${_gtk3_arch_dir} to search path for multiarch support") + endif() + endif() + find_path(GTK3_${_var}_INCLUDE_DIR ${_hdr} + PATHS + ${_gtk3_arch_dir} + /usr/local/lib64 + /usr/local/lib + /usr/lib64 + /usr/lib + /usr/X11R6/include + /usr/X11R6/lib + /opt/gnome/include + /opt/gnome/lib + /opt/openwin/include + /usr/openwin/lib + /sw/include + /sw/lib + /opt/local/include + /opt/local/lib + /usr/pkg/lib + /usr/pkg/include/glib + $ENV{GTKMM_BASEPATH}/include + $ENV{GTKMM_BASEPATH}/lib + [HKEY_CURRENT_USER\\SOFTWARE\\gtkmm\\3.0;Path]/include + [HKEY_CURRENT_USER\\SOFTWARE\\gtkmm\\3.0;Path]/lib + [HKEY_LOCAL_MACHINE\\SOFTWARE\\gtkmm\\3.0;Path]/include + [HKEY_LOCAL_MACHINE\\SOFTWARE\\gtkmm\\3.0;Path]/lib + PATH_SUFFIXES + ${_suffixes} + ) + mark_as_advanced(GTK3_${_var}_INCLUDE_DIR) - if(GTK3_${_var}_INCLUDE_DIR) - set(GTK3_INCLUDE_DIRS ${GTK3_INCLUDE_DIRS} ${GTK3_${_var}_INCLUDE_DIR} PARENT_SCOPE) - endif() + if(GTK3_${_var}_INCLUDE_DIR) + set(GTK3_INCLUDE_DIRS ${GTK3_INCLUDE_DIRS} ${GTK3_${_var}_INCLUDE_DIR} PARENT_SCOPE) + endif() endfunction() @@ -323,189 +323,189 @@ endfunction() #============================================================= function(_GTK3_FIND_LIBRARY _var _lib _expand_vc _append_version) - if(GTK3_DEBUG) - message(STATUS "[FindGTK3.cmake:${CMAKE_CURRENT_LIST_LINE}] " - "_GTK3_FIND_LIBRARY( ${_var} ${_lib} ${_expand_vc} ${_append_version} )") - endif() + if(GTK3_DEBUG) + message(STATUS "[FindGTK3.cmake:${CMAKE_CURRENT_LIST_LINE}] " + "_GTK3_FIND_LIBRARY( ${_var} ${_lib} ${_expand_vc} ${_append_version} )") + endif() - # Not GTK versions per se but the versions encoded into Windows - # import libraries (GtkMM 2.14.1 has a gtkmm-vc80-2_4.lib for example) - # Also the MSVC libraries use _ for . (this is handled below) - set(_versions 3.0 3 2.20 2.18 2.16 2.14 2.12 - 2.10 2.8 2.6 2.4 2.2 2.0 - 1.20 1.18 1.16 1.14 1.12 - 1.10 1.8 1.6 1.4 1.2 1.0) + # Not GTK versions per se but the versions encoded into Windows + # import libraries (GtkMM 2.14.1 has a gtkmm-vc80-2_4.lib for example) + # Also the MSVC libraries use _ for . (this is handled below) + set(_versions 3.0 3 2.20 2.18 2.16 2.14 2.12 + 2.10 2.8 2.6 2.4 2.2 2.0 + 1.20 1.18 1.16 1.14 1.12 + 1.10 1.8 1.6 1.4 1.2 1.0) - set(_library) - set(_library_d) + set(_library) + set(_library_d) - set(_library ${_lib}) + set(_library ${_lib}) - if(_expand_vc AND MSVC) - # Add vc80/vc90/vc100 midfixes - if(MSVC80) - set(_library ${_library}-vc80) - elseif(MSVC90) - set(_library ${_library}-vc90) - elseif(MSVC10) - set(_library ${_library}-vc100) - elseif(MSVC11) - # Up to gtkmm-win 2.22.0-2 there are no vc110 libraries but vc100 can be used - set(_library ${_library}-vc100) - endif() - set(_library_d ${_library}-d) - endif() + if(_expand_vc AND MSVC) + # Add vc80/vc90/vc100 midfixes + if(MSVC80) + set(_library ${_library}-vc80) + elseif(MSVC90) + set(_library ${_library}-vc90) + elseif(MSVC10) + set(_library ${_library}-vc100) + elseif(MSVC11) + # Up to gtkmm-win 2.22.0-2 there are no vc110 libraries but vc100 can be used + set(_library ${_library}-vc100) + endif() + set(_library_d ${_library}-d) + endif() - if(GTK3_DEBUG) - message(STATUS "[FindGTK3.cmake:${CMAKE_CURRENT_LIST_LINE}] " - "After midfix addition = ${_library} and ${_library_d}") - endif() + if(GTK3_DEBUG) + message(STATUS "[FindGTK3.cmake:${CMAKE_CURRENT_LIST_LINE}] " + "After midfix addition = ${_library} and ${_library_d}") + endif() - set(_lib_list) - set(_libd_list) - if(_append_version) - foreach(_ver ${_versions}) - list(APPEND _lib_list "${_library}-${_ver}") - list(APPEND _libd_list "${_library_d}-${_ver}") - endforeach() - else() - set(_lib_list ${_library}) - set(_libd_list ${_library_d}) - endif() + set(_lib_list) + set(_libd_list) + if(_append_version) + foreach(_ver ${_versions}) + list(APPEND _lib_list "${_library}-${_ver}") + list(APPEND _libd_list "${_library_d}-${_ver}") + endforeach() + else() + set(_lib_list ${_library}) + set(_libd_list ${_library_d}) + endif() - if(GTK3_DEBUG) - message(STATUS "[FindGTK3.cmake:${CMAKE_CURRENT_LIST_LINE}] " - "library list = ${_lib_list} and library debug list = ${_libd_list}") - endif() + if(GTK3_DEBUG) + message(STATUS "[FindGTK3.cmake:${CMAKE_CURRENT_LIST_LINE}] " + "library list = ${_lib_list} and library debug list = ${_libd_list}") + endif() - # For some silly reason the MSVC libraries use _ instead of . - # in the version fields - if(_expand_vc AND MSVC) - set(_no_dots_lib_list) - set(_no_dots_libd_list) - foreach(_l ${_lib_list}) - string(REPLACE "." "_" _no_dots_library ${_l}) - list(APPEND _no_dots_lib_list ${_no_dots_library}) - endforeach() - # And for debug - set(_no_dots_libsd_list) - foreach(_l ${_libd_list}) - string(REPLACE "." "_" _no_dots_libraryd ${_l}) - list(APPEND _no_dots_libd_list ${_no_dots_libraryd}) - endforeach() + # For some silly reason the MSVC libraries use _ instead of . + # in the version fields + if(_expand_vc AND MSVC) + set(_no_dots_lib_list) + set(_no_dots_libd_list) + foreach(_l ${_lib_list}) + string(REPLACE "." "_" _no_dots_library ${_l}) + list(APPEND _no_dots_lib_list ${_no_dots_library}) + endforeach() + # And for debug + set(_no_dots_libsd_list) + foreach(_l ${_libd_list}) + string(REPLACE "." "_" _no_dots_libraryd ${_l}) + list(APPEND _no_dots_libd_list ${_no_dots_libraryd}) + endforeach() - # Copy list back to original names - set(_lib_list ${_no_dots_lib_list}) - set(_libd_list ${_no_dots_libd_list}) - endif() + # Copy list back to original names + set(_lib_list ${_no_dots_lib_list}) + set(_libd_list ${_no_dots_libd_list}) + endif() - if(GTK3_DEBUG) - message(STATUS "[FindGTK3.cmake:${CMAKE_CURRENT_LIST_LINE}] " - "While searching for GTK3_${_var}_LIBRARY, our proposed library list is ${_lib_list}") - endif() + if(GTK3_DEBUG) + message(STATUS "[FindGTK3.cmake:${CMAKE_CURRENT_LIST_LINE}] " + "While searching for GTK3_${_var}_LIBRARY, our proposed library list is ${_lib_list}") + endif() - find_library(GTK3_${_var}_LIBRARY_RELEASE - NAMES ${_lib_list} - PATHS - /opt/gnome/lib - /usr/openwin/lib - /sw/lib - $ENV{GTKMM_BASEPATH}/lib - [HKEY_CURRENT_USER\\SOFTWARE\\gtkmm\\3.0;Path]/lib - [HKEY_LOCAL_MACHINE\\SOFTWARE\\gtkmm\\3.0;Path]/lib - ) + find_library(GTK3_${_var}_LIBRARY_RELEASE + NAMES ${_lib_list} + PATHS + /opt/gnome/lib + /usr/openwin/lib + /sw/lib + $ENV{GTKMM_BASEPATH}/lib + [HKEY_CURRENT_USER\\SOFTWARE\\gtkmm\\3.0;Path]/lib + [HKEY_LOCAL_MACHINE\\SOFTWARE\\gtkmm\\3.0;Path]/lib + ) - if(_expand_vc AND MSVC) - if(GTK3_DEBUG) - message(STATUS "[FindGTK3.cmake:${CMAKE_CURRENT_LIST_LINE}] " - "While searching for GTK3_${_var}_LIBRARY_DEBUG our proposed library list is ${_libd_list}") - endif() + if(_expand_vc AND MSVC) + if(GTK3_DEBUG) + message(STATUS "[FindGTK3.cmake:${CMAKE_CURRENT_LIST_LINE}] " + "While searching for GTK3_${_var}_LIBRARY_DEBUG our proposed library list is ${_libd_list}") + endif() - find_library(GTK3_${_var}_LIBRARY_DEBUG - NAMES ${_libd_list} - PATHS - $ENV{GTKMM_BASEPATH}/lib - [HKEY_CURRENT_USER\\SOFTWARE\\gtkmm\\3.0;Path]/lib - [HKEY_LOCAL_MACHINE\\SOFTWARE\\gtkmm\\3.0;Path]/lib - ) - endif() + find_library(GTK3_${_var}_LIBRARY_DEBUG + NAMES ${_libd_list} + PATHS + $ENV{GTKMM_BASEPATH}/lib + [HKEY_CURRENT_USER\\SOFTWARE\\gtkmm\\3.0;Path]/lib + [HKEY_LOCAL_MACHINE\\SOFTWARE\\gtkmm\\3.0;Path]/lib + ) + endif() - select_library_configurations(GTK3_${_var}) + select_library_configurations(GTK3_${_var}) - set(GTK3_${_var}_LIBRARY ${GTK3_${_var}_LIBRARY} PARENT_SCOPE) - set(GTK3_${_var}_FOUND ${GTK3_${_var}_FOUND} PARENT_SCOPE) + set(GTK3_${_var}_LIBRARY ${GTK3_${_var}_LIBRARY} PARENT_SCOPE) + set(GTK3_${_var}_FOUND ${GTK3_${_var}_FOUND} PARENT_SCOPE) - if(GTK3_${_var}_FOUND) - set(GTK3_LIBRARIES ${GTK3_LIBRARIES} ${GTK3_${_var}_LIBRARY}) - set(GTK3_LIBRARIES ${GTK3_LIBRARIES} PARENT_SCOPE) - endif() + if(GTK3_${_var}_FOUND) + set(GTK3_LIBRARIES ${GTK3_LIBRARIES} ${GTK3_${_var}_LIBRARY}) + set(GTK3_LIBRARIES ${GTK3_LIBRARIES} PARENT_SCOPE) + endif() - if(GTK3_DEBUG) - message(STATUS "[FindGTK3.cmake:${CMAKE_CURRENT_LIST_LINE}] " - "GTK3_${_var}_LIBRARY_RELEASE = \"${GTK3_${_var}_LIBRARY_RELEASE}\"") - message(STATUS "[FindGTK3.cmake:${CMAKE_CURRENT_LIST_LINE}] " - "GTK3_${_var}_LIBRARY_DEBUG = \"${GTK3_${_var}_LIBRARY_DEBUG}\"") - message(STATUS "[FindGTK3.cmake:${CMAKE_CURRENT_LIST_LINE}] " - "GTK3_${_var}_LIBRARY = \"${GTK3_${_var}_LIBRARY}\"") - message(STATUS "[FindGTK3.cmake:${CMAKE_CURRENT_LIST_LINE}] " - "GTK3_${_var}_FOUND = \"${GTK3_${_var}_FOUND}\"") - endif() + if(GTK3_DEBUG) + message(STATUS "[FindGTK3.cmake:${CMAKE_CURRENT_LIST_LINE}] " + "GTK3_${_var}_LIBRARY_RELEASE = \"${GTK3_${_var}_LIBRARY_RELEASE}\"") + message(STATUS "[FindGTK3.cmake:${CMAKE_CURRENT_LIST_LINE}] " + "GTK3_${_var}_LIBRARY_DEBUG = \"${GTK3_${_var}_LIBRARY_DEBUG}\"") + message(STATUS "[FindGTK3.cmake:${CMAKE_CURRENT_LIST_LINE}] " + "GTK3_${_var}_LIBRARY = \"${GTK3_${_var}_LIBRARY}\"") + message(STATUS "[FindGTK3.cmake:${CMAKE_CURRENT_LIST_LINE}] " + "GTK3_${_var}_FOUND = \"${GTK3_${_var}_FOUND}\"") + endif() endfunction() function(_GTK3_ADD_TARGET_DEPENDS_INTERNAL _var _property) - if(GTK3_DEBUG) - message(STATUS "[FindGTK3.cmake:${CMAKE_CURRENT_LIST_LINE}] " - "_GTK3_ADD_TARGET_DEPENDS_INTERNAL( ${_var} ${_property} )") - endif() + if(GTK3_DEBUG) + message(STATUS "[FindGTK3.cmake:${CMAKE_CURRENT_LIST_LINE}] " + "_GTK3_ADD_TARGET_DEPENDS_INTERNAL( ${_var} ${_property} )") + endif() - string(TOLOWER "${_var}" _basename) + string(TOLOWER "${_var}" _basename) - if (TARGET GTK3::${_basename}) - foreach(_depend ${ARGN}) - set(_valid_depends) - if (TARGET GTK3::${_depend}) - list(APPEND _valid_depends GTK3::${_depend}) - endif() - if (_valid_depends) - set_property(TARGET GTK3::${_basename} APPEND PROPERTY ${_property} "${_valid_depends}") - endif() - set(_valid_depends) - endforeach() - endif() + if (TARGET GTK3::${_basename}) + foreach(_depend ${ARGN}) + set(_valid_depends) + if (TARGET GTK3::${_depend}) + list(APPEND _valid_depends GTK3::${_depend}) + endif() + if (_valid_depends) + set_property(TARGET GTK3::${_basename} APPEND PROPERTY ${_property} "${_valid_depends}") + endif() + set(_valid_depends) + endforeach() + endif() endfunction() function(_GTK3_ADD_TARGET_DEPENDS _var) - if(GTK3_DEBUG) - message(STATUS "[FindGTK3.cmake:${CMAKE_CURRENT_LIST_LINE}] " - "_GTK3_ADD_TARGET_DEPENDS( ${_var} )") - endif() + if(GTK3_DEBUG) + message(STATUS "[FindGTK3.cmake:${CMAKE_CURRENT_LIST_LINE}] " + "_GTK3_ADD_TARGET_DEPENDS( ${_var} )") + endif() - string(TOLOWER "${_var}" _basename) + string(TOLOWER "${_var}" _basename) - if(TARGET GTK3::${_basename}) - get_target_property(_configs GTK3::${_basename} IMPORTED_CONFIGURATIONS) - _GTK3_ADD_TARGET_DEPENDS_INTERNAL(${_var} INTERFACE_LINK_LIBRARIES ${ARGN}) - foreach(_config ${_configs}) - _GTK3_ADD_TARGET_DEPENDS_INTERNAL(${_var} IMPORTED_LINK_INTERFACE_LIBRARIES_${_config} ${ARGN}) - endforeach() - endif() + if(TARGET GTK3::${_basename}) + get_target_property(_configs GTK3::${_basename} IMPORTED_CONFIGURATIONS) + _GTK3_ADD_TARGET_DEPENDS_INTERNAL(${_var} INTERFACE_LINK_LIBRARIES ${ARGN}) + foreach(_config ${_configs}) + _GTK3_ADD_TARGET_DEPENDS_INTERNAL(${_var} IMPORTED_LINK_INTERFACE_LIBRARIES_${_config} ${ARGN}) + endforeach() + endif() endfunction() function(_GTK3_ADD_TARGET_INCLUDE_DIRS _var) - if(GTK3_DEBUG) - message(STATUS "[FindGTK3.cmake:${CMAKE_CURRENT_LIST_LINE}] " - "_GTK3_ADD_TARGET_INCLUDE_DIRS( ${_var} )") - endif() + if(GTK3_DEBUG) + message(STATUS "[FindGTK3.cmake:${CMAKE_CURRENT_LIST_LINE}] " + "_GTK3_ADD_TARGET_INCLUDE_DIRS( ${_var} )") + endif() - string(TOLOWER "${_var}" _basename) + string(TOLOWER "${_var}" _basename) - if(TARGET GTK3::${_basename}) - foreach(_include ${ARGN}) - set_property(TARGET GTK3::${_basename} APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${_include}") - endforeach() - endif() + if(TARGET GTK3::${_basename}) + foreach(_include ${ARGN}) + set_property(TARGET GTK3::${_basename} APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${_include}") + endforeach() + endif() endfunction() #============================================================= @@ -514,64 +514,64 @@ endfunction() # _var = target to create #============================================================= function(_GTK3_ADD_TARGET _var) - if(GTK3_DEBUG) - message(STATUS "[FindGTK3.cmake:${CMAKE_CURRENT_LIST_LINE}] " - "_GTK3_ADD_TARGET( ${_var} )") - endif() + if(GTK3_DEBUG) + message(STATUS "[FindGTK3.cmake:${CMAKE_CURRENT_LIST_LINE}] " + "_GTK3_ADD_TARGET( ${_var} )") + endif() - string(TOLOWER "${_var}" _basename) + string(TOLOWER "${_var}" _basename) - cmake_parse_arguments(_${_var} "" "" "GTK3_DEPENDS;GTK3_OPTIONAL_DEPENDS;OPTIONAL_INCLUDES" ${ARGN}) + cmake_parse_arguments(_${_var} "" "" "GTK3_DEPENDS;GTK3_OPTIONAL_DEPENDS;OPTIONAL_INCLUDES" ${ARGN}) - if(GTK3_${_var}_FOUND AND NOT TARGET GTK3::${_basename}) - # Do not create the target if dependencies are missing - foreach(_dep ${_${_var}_GTK3_DEPENDS}) - if(NOT TARGET GTK3::${_dep}) - return() - endif() - endforeach() + if(GTK3_${_var}_FOUND AND NOT TARGET GTK3::${_basename}) + # Do not create the target if dependencies are missing + foreach(_dep ${_${_var}_GTK3_DEPENDS}) + if(NOT TARGET GTK3::${_dep}) + return() + endif() + endforeach() - add_library(GTK3::${_basename} UNKNOWN IMPORTED) + add_library(GTK3::${_basename} UNKNOWN IMPORTED) - if(GTK3_${_var}_LIBRARY_RELEASE) - set_property(TARGET GTK3::${_basename} APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE) - set_property(TARGET GTK3::${_basename} PROPERTY IMPORTED_LOCATION_RELEASE "${GTK3_${_var}_LIBRARY_RELEASE}" ) - endif() + if(GTK3_${_var}_LIBRARY_RELEASE) + set_property(TARGET GTK3::${_basename} APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE) + set_property(TARGET GTK3::${_basename} PROPERTY IMPORTED_LOCATION_RELEASE "${GTK3_${_var}_LIBRARY_RELEASE}" ) + endif() - if(GTK3_${_var}_LIBRARY_DEBUG) - set_property(TARGET GTK3::${_basename} APPEND PROPERTY IMPORTED_CONFIGURATIONS DEBUG) - set_property(TARGET GTK3::${_basename} PROPERTY IMPORTED_LOCATION_DEBUG "${GTK3_${_var}_LIBRARY_DEBUG}" ) - endif() + if(GTK3_${_var}_LIBRARY_DEBUG) + set_property(TARGET GTK3::${_basename} APPEND PROPERTY IMPORTED_CONFIGURATIONS DEBUG) + set_property(TARGET GTK3::${_basename} PROPERTY IMPORTED_LOCATION_DEBUG "${GTK3_${_var}_LIBRARY_DEBUG}" ) + endif() - if(GTK3_${_var}_INCLUDE_DIR) - set_property(TARGET GTK3::${_basename} APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${GTK3_${_var}_INCLUDE_DIR}") - endif() + if(GTK3_${_var}_INCLUDE_DIR) + set_property(TARGET GTK3::${_basename} APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${GTK3_${_var}_INCLUDE_DIR}") + endif() - if(GTK3_${_var}CONFIG_INCLUDE_DIR AND NOT "x${GTK3_${_var}CONFIG_INCLUDE_DIR}" STREQUAL "x${GTK3_${_var}_INCLUDE_DIR}") - set_property(TARGET GTK3::${_basename} APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${GTK3_${_var}CONFIG_INCLUDE_DIR}") - endif() + if(GTK3_${_var}CONFIG_INCLUDE_DIR AND NOT "x${GTK3_${_var}CONFIG_INCLUDE_DIR}" STREQUAL "x${GTK3_${_var}_INCLUDE_DIR}") + set_property(TARGET GTK3::${_basename} APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${GTK3_${_var}CONFIG_INCLUDE_DIR}") + endif() - if(GTK3_DEFINITIONS) - set_property(TARGET GTK3::${_basename} PROPERTY INTERFACE_COMPILE_DEFINITIONS "${GTK3_DEFINITIONS}") - endif() + if(GTK3_DEFINITIONS) + set_property(TARGET GTK3::${_basename} PROPERTY INTERFACE_COMPILE_DEFINITIONS "${GTK3_DEFINITIONS}") + endif() - if(_${_var}_GTK3_DEPENDS) - _GTK3_ADD_TARGET_DEPENDS(${_var} ${_${_var}_GTK3_DEPENDS} ${_${_var}_GTK3_OPTIONAL_DEPENDS}) - endif() + if(_${_var}_GTK3_DEPENDS) + _GTK3_ADD_TARGET_DEPENDS(${_var} ${_${_var}_GTK3_DEPENDS} ${_${_var}_GTK3_OPTIONAL_DEPENDS}) + endif() - if(_${_var}_OPTIONAL_INCLUDES) - foreach(_D ${_${_var}_OPTIONAL_INCLUDES}) - if(_D) - _GTK3_ADD_TARGET_INCLUDE_DIRS(${_var} ${_D}) - endif() - endforeach() - endif() + if(_${_var}_OPTIONAL_INCLUDES) + foreach(_D ${_${_var}_OPTIONAL_INCLUDES}) + if(_D) + _GTK3_ADD_TARGET_INCLUDE_DIRS(${_var} ${_D}) + endif() + endforeach() + endif() - if(GTK3_USE_IMPORTED_TARGETS) - set(GTK3_${_var}_LIBRARY GTK3::${_basename} PARENT_SCOPE) - endif() + if(GTK3_USE_IMPORTED_TARGETS) + set(GTK3_${_var}_LIBRARY GTK3::${_basename} PARENT_SCOPE) + endif() - endif() + endif() endfunction() @@ -588,57 +588,57 @@ set(GTK3_LIBRARIES) set(GTK3_DEFINITIONS) if(NOT GTK3_FIND_COMPONENTS) - # Assume they only want GTK - set(GTK3_FIND_COMPONENTS gtk) + # Assume they only want GTK + set(GTK3_FIND_COMPONENTS gtk) endif() # # If specified, enforce version number # if(GTK3_FIND_VERSION) - set(GTK3_FAILED_VERSION_CHECK true) - if(GTK3_DEBUG) - message(STATUS "[FindGTK3.cmake:${CMAKE_CURRENT_LIST_LINE}] " - "Searching for version ${GTK3_FIND_VERSION}") - endif() - _GTK3_FIND_INCLUDE_DIR(GTK gtk/gtk.h) - if(GTK3_GTK_INCLUDE_DIR) - _GTK3_GET_VERSION(GTK3_MAJOR_VERSION - GTK3_MINOR_VERSION - GTK3_PATCH_VERSION - ${GTK3_GTK_INCLUDE_DIR}/gtk/gtkversion.h) - set(GTK3_VERSION - ${GTK3_MAJOR_VERSION}.${GTK3_MINOR_VERSION}.${GTK3_PATCH_VERSION}) - if(GTK3_FIND_VERSION_EXACT) - if(GTK3_VERSION VERSION_EQUAL GTK3_FIND_VERSION) - set(GTK3_FAILED_VERSION_CHECK false) - endif() - else() - if(GTK3_VERSION VERSION_EQUAL GTK3_FIND_VERSION OR - GTK3_VERSION VERSION_GREATER GTK3_FIND_VERSION) - set(GTK3_FAILED_VERSION_CHECK false) - endif() - endif() - else() - # If we can't find the GTK include dir, we can't do version checking - if(GTK3_FIND_REQUIRED AND NOT GTK3_FIND_QUIETLY) - message(FATAL_ERROR "Could not find GTK3 include directory") - endif() - return() - endif() + set(GTK3_FAILED_VERSION_CHECK true) + if(GTK3_DEBUG) + message(STATUS "[FindGTK3.cmake:${CMAKE_CURRENT_LIST_LINE}] " + "Searching for version ${GTK3_FIND_VERSION}") + endif() + _GTK3_FIND_INCLUDE_DIR(GTK gtk/gtk.h) + if(GTK3_GTK_INCLUDE_DIR) + _GTK3_GET_VERSION(GTK3_MAJOR_VERSION + GTK3_MINOR_VERSION + GTK3_PATCH_VERSION + ${GTK3_GTK_INCLUDE_DIR}/gtk/gtkversion.h) + set(GTK3_VERSION + ${GTK3_MAJOR_VERSION}.${GTK3_MINOR_VERSION}.${GTK3_PATCH_VERSION}) + if(GTK3_FIND_VERSION_EXACT) + if(GTK3_VERSION VERSION_EQUAL GTK3_FIND_VERSION) + set(GTK3_FAILED_VERSION_CHECK false) + endif() + else() + if(GTK3_VERSION VERSION_EQUAL GTK3_FIND_VERSION OR + GTK3_VERSION VERSION_GREATER GTK3_FIND_VERSION) + set(GTK3_FAILED_VERSION_CHECK false) + endif() + endif() + else() + # If we can't find the GTK include dir, we can't do version checking + if(GTK3_FIND_REQUIRED AND NOT GTK3_FIND_QUIETLY) + message(FATAL_ERROR "Could not find GTK3 include directory") + endif() + return() + endif() - if(GTK3_FAILED_VERSION_CHECK) - if(GTK3_FIND_REQUIRED AND NOT GTK3_FIND_QUIETLY) - if(GTK3_FIND_VERSION_EXACT) - message(FATAL_ERROR "GTK3 version check failed. Version ${GTK3_VERSION} was found, version ${GTK3_FIND_VERSION} is needed exactly.") - else() - message(FATAL_ERROR "GTK3 version check failed. Version ${GTK3_VERSION} was found, at least version ${GTK3_FIND_VERSION} is required") - endif() - endif() + if(GTK3_FAILED_VERSION_CHECK) + if(GTK3_FIND_REQUIRED AND NOT GTK3_FIND_QUIETLY) + if(GTK3_FIND_VERSION_EXACT) + message(FATAL_ERROR "GTK3 version check failed. Version ${GTK3_VERSION} was found, version ${GTK3_FIND_VERSION} is needed exactly.") + else() + message(FATAL_ERROR "GTK3 version check failed. Version ${GTK3_VERSION} was found, at least version ${GTK3_FIND_VERSION} is required") + endif() + endif() - # If the version check fails, exit out of the module here - return() - endif() + # If the version check fails, exit out of the module here + return() + endif() endif() # @@ -646,13 +646,13 @@ endif() # passed to the compiler in order to use gtkmm # if(MSVC) - foreach(_GTK3_component ${GTK3_FIND_COMPONENTS}) - if(_GTK3_component STREQUAL "gtkmm") - set(GTK3_DEFINITIONS "/vd2") - elseif(_GTK3_component STREQUAL "glademm") - set(GTK3_DEFINITIONS "/vd2") - endif() - endforeach() + foreach(_GTK3_component ${GTK3_FIND_COMPONENTS}) + if(_GTK3_component STREQUAL "gtkmm") + set(GTK3_DEFINITIONS "/vd2") + elseif(_GTK3_component STREQUAL "glademm") + set(GTK3_DEFINITIONS "/vd2") + endif() + endforeach() endif() # @@ -661,181 +661,181 @@ endif() find_package(Freetype QUIET) if(FREETYPE_INCLUDE_DIR_ft2build AND FREETYPE_INCLUDE_DIR_freetype2) - list(APPEND GTK3_INCLUDE_DIRS ${FREETYPE_INCLUDE_DIR_ft2build} ${FREETYPE_INCLUDE_DIR_freetype2}) + list(APPEND GTK3_INCLUDE_DIRS ${FREETYPE_INCLUDE_DIR_ft2build} ${FREETYPE_INCLUDE_DIR_freetype2}) endif() foreach(_GTK3_component ${GTK3_FIND_COMPONENTS}) - if(_GTK3_component STREQUAL "gtk") - # Left for compatibility with previous versions. - _GTK3_FIND_INCLUDE_DIR(FONTCONFIG fontconfig/fontconfig.h) - _GTK3_FIND_INCLUDE_DIR(X11 X11/Xlib.h) + if(_GTK3_component STREQUAL "gtk") + # Left for compatibility with previous versions. + _GTK3_FIND_INCLUDE_DIR(FONTCONFIG fontconfig/fontconfig.h) + _GTK3_FIND_INCLUDE_DIR(X11 X11/Xlib.h) - _GTK3_FIND_INCLUDE_DIR(GLIB glib.h) - _GTK3_FIND_INCLUDE_DIR(GLIBCONFIG glibconfig.h) - _GTK3_FIND_LIBRARY (GLIB glib false true) - _GTK3_ADD_TARGET (GLIB) + _GTK3_FIND_INCLUDE_DIR(GLIB glib.h) + _GTK3_FIND_INCLUDE_DIR(GLIBCONFIG glibconfig.h) + _GTK3_FIND_LIBRARY (GLIB glib false true) + _GTK3_ADD_TARGET (GLIB) - _GTK3_FIND_INCLUDE_DIR(GOBJECT glib-object.h) - _GTK3_FIND_LIBRARY (GOBJECT gobject false true) - _GTK3_ADD_TARGET (GOBJECT GTK3_DEPENDS glib) + _GTK3_FIND_INCLUDE_DIR(GOBJECT glib-object.h) + _GTK3_FIND_LIBRARY (GOBJECT gobject false true) + _GTK3_ADD_TARGET (GOBJECT GTK3_DEPENDS glib) - _GTK3_FIND_INCLUDE_DIR(ATK atk/atk.h) - _GTK3_FIND_LIBRARY (ATK atk false true) - _GTK3_ADD_TARGET (ATK GTK3_DEPENDS gobject glib) + _GTK3_FIND_INCLUDE_DIR(ATK atk/atk.h) + _GTK3_FIND_LIBRARY (ATK atk false true) + _GTK3_ADD_TARGET (ATK GTK3_DEPENDS gobject glib) - _GTK3_FIND_LIBRARY (GIO gio false true) - _GTK3_ADD_TARGET (GIO GTK3_DEPENDS gobject glib) + _GTK3_FIND_LIBRARY (GIO gio false true) + _GTK3_ADD_TARGET (GIO GTK3_DEPENDS gobject glib) - _GTK3_FIND_LIBRARY (GTHREAD gthread false true) - _GTK3_ADD_TARGET (GTHREAD GTK3_DEPENDS glib) + _GTK3_FIND_LIBRARY (GTHREAD gthread false true) + _GTK3_ADD_TARGET (GTHREAD GTK3_DEPENDS glib) - _GTK3_FIND_LIBRARY (GMODULE gmodule false true) - _GTK3_ADD_TARGET (GMODULE GTK3_DEPENDS glib) + _GTK3_FIND_LIBRARY (GMODULE gmodule false true) + _GTK3_ADD_TARGET (GMODULE GTK3_DEPENDS glib) - _GTK3_FIND_INCLUDE_DIR(GDK_PIXBUF gdk-pixbuf/gdk-pixbuf.h) - _GTK3_FIND_LIBRARY (GDK_PIXBUF gdk_pixbuf false true) - _GTK3_ADD_TARGET (GDK_PIXBUF GTK3_DEPENDS gobject glib) + _GTK3_FIND_INCLUDE_DIR(GDK_PIXBUF gdk-pixbuf/gdk-pixbuf.h) + _GTK3_FIND_LIBRARY (GDK_PIXBUF gdk_pixbuf false true) + _GTK3_ADD_TARGET (GDK_PIXBUF GTK3_DEPENDS gobject glib) - _GTK3_FIND_INCLUDE_DIR(CAIRO cairo.h) - _GTK3_FIND_LIBRARY (CAIRO cairo false false) - _GTK3_ADD_TARGET (CAIRO) + _GTK3_FIND_INCLUDE_DIR(CAIRO cairo.h) + _GTK3_FIND_LIBRARY (CAIRO cairo false false) + _GTK3_ADD_TARGET (CAIRO) - _GTK3_FIND_INCLUDE_DIR(CAIRO_GOBJECT cairo-gobject.h) - _GTK3_FIND_LIBRARY (CAIRO_GOBJECT cairo-gobject false false) - _GTK3_ADD_TARGET (CAIRO_GOBJECT GTK3_DEPENDS cairo gobject glib) + _GTK3_FIND_INCLUDE_DIR(CAIRO_GOBJECT cairo-gobject.h) + _GTK3_FIND_LIBRARY (CAIRO_GOBJECT cairo-gobject false false) + _GTK3_ADD_TARGET (CAIRO_GOBJECT GTK3_DEPENDS cairo gobject glib) - _GTK3_FIND_INCLUDE_DIR(PANGO pango/pango.h) - _GTK3_FIND_LIBRARY (PANGO pango false true) - _GTK3_ADD_TARGET (PANGO GTK3_DEPENDS gobject glib) + _GTK3_FIND_INCLUDE_DIR(PANGO pango/pango.h) + _GTK3_FIND_LIBRARY (PANGO pango false true) + _GTK3_ADD_TARGET (PANGO GTK3_DEPENDS gobject glib) - _GTK3_FIND_LIBRARY (PANGOCAIRO pangocairo false true) - _GTK3_ADD_TARGET (PANGOCAIRO GTK3_DEPENDS pango cairo gobject glib) + _GTK3_FIND_LIBRARY (PANGOCAIRO pangocairo false true) + _GTK3_ADD_TARGET (PANGOCAIRO GTK3_DEPENDS pango cairo gobject glib) - _GTK3_FIND_LIBRARY (PANGOFT2 pangoft2 false true) - _GTK3_ADD_TARGET (PANGOFT2 GTK3_DEPENDS pango gobject glib - OPTIONAL_INCLUDES ${FREETYPE_INCLUDE_DIR_ft2build} ${FREETYPE_INCLUDE_DIR_freetype2} - ${GTK3_FONTCONFIG_INCLUDE_DIR} - ${GTK3_X11_INCLUDE_DIR}) + _GTK3_FIND_LIBRARY (PANGOFT2 pangoft2 false true) + _GTK3_ADD_TARGET (PANGOFT2 GTK3_DEPENDS pango gobject glib + OPTIONAL_INCLUDES ${FREETYPE_INCLUDE_DIR_ft2build} ${FREETYPE_INCLUDE_DIR_freetype2} + ${GTK3_FONTCONFIG_INCLUDE_DIR} + ${GTK3_X11_INCLUDE_DIR}) - _GTK3_FIND_LIBRARY (PANGOXFT pangoxft false true) - _GTK3_ADD_TARGET (PANGOXFT GTK3_DEPENDS pangoft2 pango gobject glib - OPTIONAL_INCLUDES ${FREETYPE_INCLUDE_DIR_ft2build} ${FREETYPE_INCLUDE_DIR_freetype2} - ${GTK3_FONTCONFIG_INCLUDE_DIR} - ${GTK3_X11_INCLUDE_DIR}) + _GTK3_FIND_LIBRARY (PANGOXFT pangoxft false true) + _GTK3_ADD_TARGET (PANGOXFT GTK3_DEPENDS pangoft2 pango gobject glib + OPTIONAL_INCLUDES ${FREETYPE_INCLUDE_DIR_ft2build} ${FREETYPE_INCLUDE_DIR_freetype2} + ${GTK3_FONTCONFIG_INCLUDE_DIR} + ${GTK3_X11_INCLUDE_DIR}) - _GTK3_FIND_INCLUDE_DIR(GDK gdk/gdk.h) - _GTK3_FIND_INCLUDE_DIR(GDKCONFIG gdk/gdkconfig.h) - if(UNIX) - if(APPLE) - _GTK3_FIND_LIBRARY (GDK gdk-quartz false true) - endif() - if(NOT GTK3_GDK_FOUND) - _GTK3_FIND_LIBRARY (GDK gdk false true) - endif() - else() - _GTK3_FIND_LIBRARY (GDK gdk-win32 false true) - endif() - _GTK3_ADD_TARGET (GDK GTK3_DEPENDS pangocairo pango cairo-gobject cairo gdk_pixbuf gobject glib) + _GTK3_FIND_INCLUDE_DIR(GDK gdk/gdk.h) + _GTK3_FIND_INCLUDE_DIR(GDKCONFIG gdk/gdkconfig.h) + if(UNIX) + if(APPLE) + _GTK3_FIND_LIBRARY (GDK gdk-quartz false true) + endif() + if(NOT GTK3_GDK_FOUND) + _GTK3_FIND_LIBRARY (GDK gdk false true) + endif() + else() + _GTK3_FIND_LIBRARY (GDK gdk-win32 false true) + endif() + _GTK3_ADD_TARGET (GDK GTK3_DEPENDS pangocairo pango cairo-gobject cairo gdk_pixbuf gobject glib) - _GTK3_FIND_INCLUDE_DIR(GTK gtk/gtk.h) - if(UNIX) - if(APPLE) - _GTK3_FIND_LIBRARY (GTK gtk-quartz false true) - endif() - if(NOT GTK3_GTK_FOUND) - _GTK3_FIND_LIBRARY (GTK gtk false true) - endif() - else() - _GTK3_FIND_LIBRARY (GTK gtk-win32 false true) - endif() - _GTK3_ADD_TARGET (GTK GTK3_DEPENDS gdk atk pangocairo pango cairo-gobject cairo gdk_pixbuf gio gobject glib) + _GTK3_FIND_INCLUDE_DIR(GTK gtk/gtk.h) + if(UNIX) + if(APPLE) + _GTK3_FIND_LIBRARY (GTK gtk-quartz false true) + endif() + if(NOT GTK3_GTK_FOUND) + _GTK3_FIND_LIBRARY (GTK gtk false true) + endif() + else() + _GTK3_FIND_LIBRARY (GTK gtk-win32 false true) + endif() + _GTK3_ADD_TARGET (GTK GTK3_DEPENDS gdk atk pangocairo pango cairo-gobject cairo gdk_pixbuf gio gobject glib) - elseif(_GTK3_component STREQUAL "gtkmm") + elseif(_GTK3_component STREQUAL "gtkmm") - _GTK3_FIND_INCLUDE_DIR(SIGC++ sigc++/sigc++.h) - _GTK3_FIND_INCLUDE_DIR(SIGC++CONFIG sigc++config.h) - _GTK3_FIND_LIBRARY (SIGC++ sigc true true) - _GTK3_ADD_TARGET (SIGC++) + _GTK3_FIND_INCLUDE_DIR(SIGC++ sigc++/sigc++.h) + _GTK3_FIND_INCLUDE_DIR(SIGC++CONFIG sigc++config.h) + _GTK3_FIND_LIBRARY (SIGC++ sigc true true) + _GTK3_ADD_TARGET (SIGC++) - _GTK3_FIND_INCLUDE_DIR(GLIBMM glibmm.h) - _GTK3_FIND_INCLUDE_DIR(GLIBMMCONFIG glibmmconfig.h) - _GTK3_FIND_LIBRARY (GLIBMM glibmm true true) - _GTK3_ADD_TARGET (GLIBMM GTK3_DEPENDS gobject sigc++ glib) + _GTK3_FIND_INCLUDE_DIR(GLIBMM glibmm.h) + _GTK3_FIND_INCLUDE_DIR(GLIBMMCONFIG glibmmconfig.h) + _GTK3_FIND_LIBRARY (GLIBMM glibmm true true) + _GTK3_ADD_TARGET (GLIBMM GTK3_DEPENDS gobject sigc++ glib) - _GTK3_FIND_INCLUDE_DIR(GIOMM giomm.h) - _GTK3_FIND_INCLUDE_DIR(GIOMMCONFIG giommconfig.h) - _GTK3_FIND_LIBRARY (GIOMM giomm true true) - _GTK3_ADD_TARGET (GIOMM GTK3_DEPENDS gio glibmm gobject sigc++ glib) + _GTK3_FIND_INCLUDE_DIR(GIOMM giomm.h) + _GTK3_FIND_INCLUDE_DIR(GIOMMCONFIG giommconfig.h) + _GTK3_FIND_LIBRARY (GIOMM giomm true true) + _GTK3_ADD_TARGET (GIOMM GTK3_DEPENDS gio glibmm gobject sigc++ glib) - _GTK3_FIND_INCLUDE_DIR(ATKMM atkmm.h) - _GTK3_FIND_LIBRARY (ATKMM atkmm true true) - _GTK3_ADD_TARGET (ATKMM GTK3_DEPENDS atk glibmm gobject sigc++ glib) + _GTK3_FIND_INCLUDE_DIR(ATKMM atkmm.h) + _GTK3_FIND_LIBRARY (ATKMM atkmm true true) + _GTK3_ADD_TARGET (ATKMM GTK3_DEPENDS atk glibmm gobject sigc++ glib) - _GTK3_FIND_INCLUDE_DIR(CAIROMM cairomm/cairomm.h) - _GTK3_FIND_INCLUDE_DIR(CAIROMMCONFIG cairommconfig.h) - _GTK3_FIND_LIBRARY (CAIROMM cairomm true true) - _GTK3_ADD_TARGET (CAIROMM GTK3_DEPENDS cairo sigc++ - OPTIONAL_INCLUDES ${FREETYPE_INCLUDE_DIR_ft2build} ${FREETYPE_INCLUDE_DIR_freetype2} - ${GTK3_FONTCONFIG_INCLUDE_DIR} - ${GTK3_X11_INCLUDE_DIR}) + _GTK3_FIND_INCLUDE_DIR(CAIROMM cairomm/cairomm.h) + _GTK3_FIND_INCLUDE_DIR(CAIROMMCONFIG cairommconfig.h) + _GTK3_FIND_LIBRARY (CAIROMM cairomm true true) + _GTK3_ADD_TARGET (CAIROMM GTK3_DEPENDS cairo sigc++ + OPTIONAL_INCLUDES ${FREETYPE_INCLUDE_DIR_ft2build} ${FREETYPE_INCLUDE_DIR_freetype2} + ${GTK3_FONTCONFIG_INCLUDE_DIR} + ${GTK3_X11_INCLUDE_DIR}) - _GTK3_FIND_INCLUDE_DIR(PANGOMM pangomm.h) - _GTK3_FIND_INCLUDE_DIR(PANGOMMCONFIG pangommconfig.h) - _GTK3_FIND_LIBRARY (PANGOMM pangomm true true) - _GTK3_ADD_TARGET (PANGOMM GTK3_DEPENDS glibmm cairomm sigc++ pangocairo pango cairo gobject glib - OPTIONAL_INCLUDES ${FREETYPE_INCLUDE_DIR_ft2build} ${FREETYPE_INCLUDE_DIR_freetype2} - ${GTK3_FONTCONFIG_INCLUDE_DIR} - ${GTK3_X11_INCLUDE_DIR}) + _GTK3_FIND_INCLUDE_DIR(PANGOMM pangomm.h) + _GTK3_FIND_INCLUDE_DIR(PANGOMMCONFIG pangommconfig.h) + _GTK3_FIND_LIBRARY (PANGOMM pangomm true true) + _GTK3_ADD_TARGET (PANGOMM GTK3_DEPENDS glibmm cairomm sigc++ pangocairo pango cairo gobject glib + OPTIONAL_INCLUDES ${FREETYPE_INCLUDE_DIR_ft2build} ${FREETYPE_INCLUDE_DIR_freetype2} + ${GTK3_FONTCONFIG_INCLUDE_DIR} + ${GTK3_X11_INCLUDE_DIR}) - _GTK3_FIND_INCLUDE_DIR(GDKMM gdkmm.h) - _GTK3_FIND_INCLUDE_DIR(GDKMMCONFIG gdkmmconfig.h) - _GTK3_FIND_LIBRARY (GDKMM gdkmm true true) - _GTK3_ADD_TARGET (GDKMM GTK3_DEPENDS pangomm giomm glibmm cairomm sigc++ gtk gdk atk pangocairo pango cairo-gobject cairo gdk_pixbuf gio gobject glib - OPTIONAL_INCLUDES ${FREETYPE_INCLUDE_DIR_ft2build} ${FREETYPE_INCLUDE_DIR_freetype2} - ${GTK3_FONTCONFIG_INCLUDE_DIR} - ${GTK3_X11_INCLUDE_DIR}) + _GTK3_FIND_INCLUDE_DIR(GDKMM gdkmm.h) + _GTK3_FIND_INCLUDE_DIR(GDKMMCONFIG gdkmmconfig.h) + _GTK3_FIND_LIBRARY (GDKMM gdkmm true true) + _GTK3_ADD_TARGET (GDKMM GTK3_DEPENDS pangomm giomm glibmm cairomm sigc++ gtk gdk atk pangocairo pango cairo-gobject cairo gdk_pixbuf gio gobject glib + OPTIONAL_INCLUDES ${FREETYPE_INCLUDE_DIR_ft2build} ${FREETYPE_INCLUDE_DIR_freetype2} + ${GTK3_FONTCONFIG_INCLUDE_DIR} + ${GTK3_X11_INCLUDE_DIR}) - _GTK3_FIND_INCLUDE_DIR(GTKMM gtkmm.h) - _GTK3_FIND_INCLUDE_DIR(GTKMMCONFIG gtkmmconfig.h) - _GTK3_FIND_LIBRARY (GTKMM gtkmm true true) - _GTK3_ADD_TARGET (GTKMM GTK3_DEPENDS atkmm gdkmm pangomm giomm glibmm cairomm sigc++ gtk gdk atk pangocairo pango cairo-gobject cairo gdk_pixbuf gio gobject glib - OPTIONAL_INCLUDES ${FREETYPE_INCLUDE_DIR_ft2build} ${FREETYPE_INCLUDE_DIR_freetype2} - ${GTK3_FONTCONFIG_INCLUDE_DIR} - ${GTK3_X11_INCLUDE_DIR}) + _GTK3_FIND_INCLUDE_DIR(GTKMM gtkmm.h) + _GTK3_FIND_INCLUDE_DIR(GTKMMCONFIG gtkmmconfig.h) + _GTK3_FIND_LIBRARY (GTKMM gtkmm true true) + _GTK3_ADD_TARGET (GTKMM GTK3_DEPENDS atkmm gdkmm pangomm giomm glibmm cairomm sigc++ gtk gdk atk pangocairo pango cairo-gobject cairo gdk_pixbuf gio gobject glib + OPTIONAL_INCLUDES ${FREETYPE_INCLUDE_DIR_ft2build} ${FREETYPE_INCLUDE_DIR_freetype2} + ${GTK3_FONTCONFIG_INCLUDE_DIR} + ${GTK3_X11_INCLUDE_DIR}) - elseif(_GTK3_component STREQUAL "glade") + elseif(_GTK3_component STREQUAL "glade") - _GTK3_FIND_INCLUDE_DIR(GLADE glade/glade.h) - _GTK3_FIND_LIBRARY (GLADE glade false true) - _GTK3_ADD_TARGET (GLADE GTK3_DEPENDS gtk gdk atk pangocairo pango cairo-gobject cairo gdk_pixbuf gio gobject glib - OPTIONAL_INCLUDES ${FREETYPE_INCLUDE_DIR_ft2build} ${FREETYPE_INCLUDE_DIR_freetype2} - ${GTK3_FONTCONFIG_INCLUDE_DIR} - ${GTK3_X11_INCLUDE_DIR}) + _GTK3_FIND_INCLUDE_DIR(GLADE glade/glade.h) + _GTK3_FIND_LIBRARY (GLADE glade false true) + _GTK3_ADD_TARGET (GLADE GTK3_DEPENDS gtk gdk atk pangocairo pango cairo-gobject cairo gdk_pixbuf gio gobject glib + OPTIONAL_INCLUDES ${FREETYPE_INCLUDE_DIR_ft2build} ${FREETYPE_INCLUDE_DIR_freetype2} + ${GTK3_FONTCONFIG_INCLUDE_DIR} + ${GTK3_X11_INCLUDE_DIR}) - elseif(_GTK3_component STREQUAL "glademm") + elseif(_GTK3_component STREQUAL "glademm") - _GTK3_FIND_INCLUDE_DIR(GLADEMM libglademm.h) - _GTK3_FIND_INCLUDE_DIR(GLADEMMCONFIG libglademmconfig.h) - _GTK3_FIND_LIBRARY (GLADEMM glademm true true) - _GTK3_ADD_TARGET (GLADEMM GTK3_DEPENDS gtkmm glade atkmm gdkmm pangomm giomm glibmm cairomm sigc++ gtk gdk atk pangocairo pango cairo-gobject cairo gdk_pixbuf gio gobject glib - OPTIONAL_INCLUDES ${FREETYPE_INCLUDE_DIR_ft2build} ${FREETYPE_INCLUDE_DIR_freetype2} - ${GTK3_FONTCONFIG_INCLUDE_DIR} - ${GTK3_X11_INCLUDE_DIR}) + _GTK3_FIND_INCLUDE_DIR(GLADEMM libglademm.h) + _GTK3_FIND_INCLUDE_DIR(GLADEMMCONFIG libglademmconfig.h) + _GTK3_FIND_LIBRARY (GLADEMM glademm true true) + _GTK3_ADD_TARGET (GLADEMM GTK3_DEPENDS gtkmm glade atkmm gdkmm pangomm giomm glibmm cairomm sigc++ gtk gdk atk pangocairo pango cairo-gobject cairo gdk_pixbuf gio gobject glib + OPTIONAL_INCLUDES ${FREETYPE_INCLUDE_DIR_ft2build} ${FREETYPE_INCLUDE_DIR_freetype2} + ${GTK3_FONTCONFIG_INCLUDE_DIR} + ${GTK3_X11_INCLUDE_DIR}) - else() - message(FATAL_ERROR "Unknown GTK3 component ${_component}") - endif() + else() + message(FATAL_ERROR "Unknown GTK3 component ${_component}") + endif() endforeach() # # Solve for the GTK3 version if we haven't already # if(NOT GTK3_FIND_VERSION AND GTK3_GTK_INCLUDE_DIR) - _GTK3_GET_VERSION(GTK3_MAJOR_VERSION - GTK3_MINOR_VERSION - GTK3_PATCH_VERSION - ${GTK3_GTK_INCLUDE_DIR}/gtk/gtkversion.h) - set(GTK3_VERSION ${GTK3_MAJOR_VERSION}.${GTK3_MINOR_VERSION}.${GTK3_PATCH_VERSION}) + _GTK3_GET_VERSION(GTK3_MAJOR_VERSION + GTK3_MINOR_VERSION + GTK3_PATCH_VERSION + ${GTK3_GTK_INCLUDE_DIR}/gtk/gtkversion.h) + set(GTK3_VERSION ${GTK3_MAJOR_VERSION}.${GTK3_MINOR_VERSION}.${GTK3_PATCH_VERSION}) endif() # @@ -847,73 +847,73 @@ set(_GTK3_did_we_find_everything true) # This gets set to GTK3_FOUND include(FindPackageHandleStandardArgs) foreach(_GTK3_component ${GTK3_FIND_COMPONENTS}) - string(TOUPPER ${_GTK3_component} _COMPONENT_UPPER) + string(TOUPPER ${_GTK3_component} _COMPONENT_UPPER) - set(GTK3_${_COMPONENT_UPPER}_FIND_QUIETLY ${GTK3_FIND_QUIETLY}) + set(GTK3_${_COMPONENT_UPPER}_FIND_QUIETLY ${GTK3_FIND_QUIETLY}) - if(_GTK3_component STREQUAL "gtk") - FIND_PACKAGE_HANDLE_STANDARD_ARGS(GTK3_${_COMPONENT_UPPER} "Some or all of the gtk libraries were not found." - GTK3_GTK_LIBRARY - GTK3_GTK_INCLUDE_DIR + if(_GTK3_component STREQUAL "gtk") + FIND_PACKAGE_HANDLE_STANDARD_ARGS(GTK3_${_COMPONENT_UPPER} "Some or all of the gtk libraries were not found." + GTK3_GTK_LIBRARY + GTK3_GTK_INCLUDE_DIR - GTK3_GDK_INCLUDE_DIR - GTK3_GDKCONFIG_INCLUDE_DIR - GTK3_GDK_LIBRARY + GTK3_GDK_INCLUDE_DIR + GTK3_GDKCONFIG_INCLUDE_DIR + GTK3_GDK_LIBRARY - GTK3_GLIB_INCLUDE_DIR - GTK3_GLIBCONFIG_INCLUDE_DIR - GTK3_GLIB_LIBRARY - ) - elseif(_GTK3_component STREQUAL "gtkmm") - FIND_PACKAGE_HANDLE_STANDARD_ARGS(GTK3_${_COMPONENT_UPPER} "Some or all of the gtkmm libraries were not found." - GTK3_GTKMM_LIBRARY - GTK3_GTKMM_INCLUDE_DIR - GTK3_GTKMMCONFIG_INCLUDE_DIR + GTK3_GLIB_INCLUDE_DIR + GTK3_GLIBCONFIG_INCLUDE_DIR + GTK3_GLIB_LIBRARY + ) + elseif(_GTK3_component STREQUAL "gtkmm") + FIND_PACKAGE_HANDLE_STANDARD_ARGS(GTK3_${_COMPONENT_UPPER} "Some or all of the gtkmm libraries were not found." + GTK3_GTKMM_LIBRARY + GTK3_GTKMM_INCLUDE_DIR + GTK3_GTKMMCONFIG_INCLUDE_DIR - GTK3_GDKMM_INCLUDE_DIR - GTK3_GDKMMCONFIG_INCLUDE_DIR - GTK3_GDKMM_LIBRARY + GTK3_GDKMM_INCLUDE_DIR + GTK3_GDKMMCONFIG_INCLUDE_DIR + GTK3_GDKMM_LIBRARY - GTK3_GLIBMM_INCLUDE_DIR - GTK3_GLIBMMCONFIG_INCLUDE_DIR - GTK3_GLIBMM_LIBRARY + GTK3_GLIBMM_INCLUDE_DIR + GTK3_GLIBMMCONFIG_INCLUDE_DIR + GTK3_GLIBMM_LIBRARY - FREETYPE_INCLUDE_DIR_ft2build - FREETYPE_INCLUDE_DIR_freetype2 - ) - elseif(_GTK3_component STREQUAL "glade") - FIND_PACKAGE_HANDLE_STANDARD_ARGS(GTK3_${_COMPONENT_UPPER} "The glade library was not found." - GTK3_GLADE_LIBRARY - GTK3_GLADE_INCLUDE_DIR - ) - elseif(_GTK3_component STREQUAL "glademm") - FIND_PACKAGE_HANDLE_STANDARD_ARGS(GTK3_${_COMPONENT_UPPER} "The glademm library was not found." - GTK3_GLADEMM_LIBRARY - GTK3_GLADEMM_INCLUDE_DIR - GTK3_GLADEMMCONFIG_INCLUDE_DIR - ) - endif() + FREETYPE_INCLUDE_DIR_ft2build + FREETYPE_INCLUDE_DIR_freetype2 + ) + elseif(_GTK3_component STREQUAL "glade") + FIND_PACKAGE_HANDLE_STANDARD_ARGS(GTK3_${_COMPONENT_UPPER} "The glade library was not found." + GTK3_GLADE_LIBRARY + GTK3_GLADE_INCLUDE_DIR + ) + elseif(_GTK3_component STREQUAL "glademm") + FIND_PACKAGE_HANDLE_STANDARD_ARGS(GTK3_${_COMPONENT_UPPER} "The glademm library was not found." + GTK3_GLADEMM_LIBRARY + GTK3_GLADEMM_INCLUDE_DIR + GTK3_GLADEMMCONFIG_INCLUDE_DIR + ) + endif() - if(NOT GTK3_${_COMPONENT_UPPER}_FOUND) - set(_GTK3_did_we_find_everything false) - endif() + if(NOT GTK3_${_COMPONENT_UPPER}_FOUND) + set(_GTK3_did_we_find_everything false) + endif() endforeach() if(_GTK3_did_we_find_everything AND NOT GTK3_VERSION_CHECK_FAILED) - set(GTK3_FOUND true) + set(GTK3_FOUND true) else() - # Unset our variables. - set(GTK3_FOUND false) - set(GTK3_VERSION) - set(GTK3_VERSION_MAJOR) - set(GTK3_VERSION_MINOR) - set(GTK3_VERSION_PATCH) - set(GTK3_INCLUDE_DIRS) - set(GTK3_LIBRARIES) - set(GTK3_DEFINITIONS) + # Unset our variables. + set(GTK3_FOUND false) + set(GTK3_VERSION) + set(GTK3_VERSION_MAJOR) + set(GTK3_VERSION_MINOR) + set(GTK3_VERSION_PATCH) + set(GTK3_INCLUDE_DIRS) + set(GTK3_LIBRARIES) + set(GTK3_DEFINITIONS) endif() if(GTK3_INCLUDE_DIRS) - list(REMOVE_DUPLICATES GTK3_INCLUDE_DIRS) + list(REMOVE_DUPLICATES GTK3_INCLUDE_DIRS) endif() diff --git a/cmake/FindHarfBuzz.cmake b/cmake/FindHarfBuzz.cmake index 57a3b89ff2..8433780016 100644 --- a/cmake/FindHarfBuzz.cmake +++ b/cmake/FindHarfBuzz.cmake @@ -72,110 +72,110 @@ set(HarfBuzz_COMPILE_OPTIONS ${PC_HARFBUZZ_CFLAGS_OTHER}) set(HarfBuzz_VERSION ${PC_HARFBUZZ_CFLAGS_VERSION}) find_path(HarfBuzz_INCLUDE_DIR - NAMES hb.h - HINTS ${PC_HARFBUZZ_INCLUDEDIR} ${PC_HARFBUZZ_INCLUDE_DIRS} - PATH_SUFFIXES harfbuzz + NAMES hb.h + HINTS ${PC_HARFBUZZ_INCLUDEDIR} ${PC_HARFBUZZ_INCLUDE_DIRS} + PATH_SUFFIXES harfbuzz ) find_library(HarfBuzz_LIBRARY - NAMES ${HarfBuzz_NAMES} harfbuzz - HINTS ${PC_HARFBUZZ_LIBDIR} ${PC_HARFBUZZ_LIBRARY_DIRS} + NAMES ${HarfBuzz_NAMES} harfbuzz + HINTS ${PC_HARFBUZZ_LIBDIR} ${PC_HARFBUZZ_LIBRARY_DIRS} ) if (HarfBuzz_INCLUDE_DIR AND NOT HarfBuzz_VERSION) - if (EXISTS "${HarfBuzz_INCLUDE_DIR}/hb-version.h") - file(READ "${HarfBuzz_INCLUDE_DIR}/hb-version.h" _harfbuzz_version_content) + if (EXISTS "${HarfBuzz_INCLUDE_DIR}/hb-version.h") + file(READ "${HarfBuzz_INCLUDE_DIR}/hb-version.h" _harfbuzz_version_content) - string(REGEX MATCH "#define +HB_VERSION_STRING +\"([0-9]+\\.[0-9]+\\.[0-9]+)\"" _dummy "${_harfbuzz_version_content}") - set(HarfBuzz_VERSION "${CMAKE_MATCH_1}") - endif () + string(REGEX MATCH "#define +HB_VERSION_STRING +\"([0-9]+\\.[0-9]+\\.[0-9]+)\"" _dummy "${_harfbuzz_version_content}") + set(HarfBuzz_VERSION "${CMAKE_MATCH_1}") + endif () endif () if ("${HarfBuzz_FIND_VERSION}" VERSION_GREATER "${HarfBuzz_VERSION}") - message(FATAL_ERROR "Required version (" ${HarfBuzz_FIND_VERSION} ") is higher than found version (" ${HarfBuzz_VERSION} ")") + message(FATAL_ERROR "Required version (" ${HarfBuzz_FIND_VERSION} ") is higher than found version (" ${HarfBuzz_VERSION} ")") endif () # Find components if (HarfBuzz_INCLUDE_DIR AND HarfBuzz_LIBRARY) - set(_HarfBuzz_REQUIRED_LIBS_FOUND ON) - set(HarfBuzz_LIBS_FOUND "HarfBuzz (required): ${HarfBuzz_LIBRARY}") + set(_HarfBuzz_REQUIRED_LIBS_FOUND ON) + set(HarfBuzz_LIBS_FOUND "HarfBuzz (required): ${HarfBuzz_LIBRARY}") else () - set(_HarfBuzz_REQUIRED_LIBS_FOUND OFF) - set(HarfBuzz_LIBS_NOT_FOUND "HarfBuzz (required)") + set(_HarfBuzz_REQUIRED_LIBS_FOUND OFF) + set(HarfBuzz_LIBS_NOT_FOUND "HarfBuzz (required)") endif () if ("ICU" IN_LIST HarfBuzz_FIND_COMPONENTS) - pkg_check_modules(PC_HARFBUZZ_ICU QUIET harfbuzz-icu) - set(HarfBuzz_ICU_COMPILE_OPTIONS ${PC_HARFBUZZ_ICU_CFLAGS_OTHER}) + pkg_check_modules(PC_HARFBUZZ_ICU QUIET harfbuzz-icu) + set(HarfBuzz_ICU_COMPILE_OPTIONS ${PC_HARFBUZZ_ICU_CFLAGS_OTHER}) - find_library(HarfBuzz_ICU_LIBRARY - NAMES ${HarfBuzz_ICU_NAMES} harfbuzz-icu - HINTS ${PC_HARFBUZZ_ICU_LIBDIR} ${PC_HARFBUZZ_ICU_LIBRARY_DIRS} - ) + find_library(HarfBuzz_ICU_LIBRARY + NAMES ${HarfBuzz_ICU_NAMES} harfbuzz-icu + HINTS ${PC_HARFBUZZ_ICU_LIBDIR} ${PC_HARFBUZZ_ICU_LIBRARY_DIRS} + ) - if (HarfBuzz_ICU_LIBRARY) - if (HarfBuzz_FIND_REQUIRED_ICU) - list(APPEND HarfBuzz_LIBS_FOUND "ICU (required): ${HarfBuzz_ICU_LIBRARY}") - else () - list(APPEND HarfBuzz_LIBS_FOUND "ICU (optional): ${HarfBuzz_ICU_LIBRARY}") - endif () - else () - if (HarfBuzz_FIND_REQUIRED_ICU) - set(_HarfBuzz_REQUIRED_LIBS_FOUND OFF) - list(APPEND HarfBuzz_LIBS_NOT_FOUND "ICU (required)") - else () - list(APPEND HarfBuzz_LIBS_NOT_FOUND "ICU (optional)") - endif () - endif () + if (HarfBuzz_ICU_LIBRARY) + if (HarfBuzz_FIND_REQUIRED_ICU) + list(APPEND HarfBuzz_LIBS_FOUND "ICU (required): ${HarfBuzz_ICU_LIBRARY}") + else () + list(APPEND HarfBuzz_LIBS_FOUND "ICU (optional): ${HarfBuzz_ICU_LIBRARY}") + endif () + else () + if (HarfBuzz_FIND_REQUIRED_ICU) + set(_HarfBuzz_REQUIRED_LIBS_FOUND OFF) + list(APPEND HarfBuzz_LIBS_NOT_FOUND "ICU (required)") + else () + list(APPEND HarfBuzz_LIBS_NOT_FOUND "ICU (optional)") + endif () + endif () endif () if (NOT HarfBuzz_FIND_QUIETLY) - if (HarfBuzz_LIBS_FOUND) - message(STATUS "Found the following HarfBuzz libraries:") - foreach (found ${HarfBuzz_LIBS_FOUND}) - message(STATUS " ${found}") - endforeach () - endif () - if (HarfBuzz_LIBS_NOT_FOUND) - message(STATUS "The following HarfBuzz libraries were not found:") - foreach (found ${HarfBuzz_LIBS_NOT_FOUND}) - message(STATUS " ${found}") - endforeach () - endif () + if (HarfBuzz_LIBS_FOUND) + message(STATUS "Found the following HarfBuzz libraries:") + foreach (found ${HarfBuzz_LIBS_FOUND}) + message(STATUS " ${found}") + endforeach () + endif () + if (HarfBuzz_LIBS_NOT_FOUND) + message(STATUS "The following HarfBuzz libraries were not found:") + foreach (found ${HarfBuzz_LIBS_NOT_FOUND}) + message(STATUS " ${found}") + endforeach () + endif () endif () include(FindPackageHandleStandardArgs) find_package_handle_standard_args(HarfBuzz - FOUND_VAR HarfBuzz_FOUND - REQUIRED_VARS HarfBuzz_INCLUDE_DIR HarfBuzz_LIBRARY _HarfBuzz_REQUIRED_LIBS_FOUND - VERSION_VAR HarfBuzz_VERSION + FOUND_VAR HarfBuzz_FOUND + REQUIRED_VARS HarfBuzz_INCLUDE_DIR HarfBuzz_LIBRARY _HarfBuzz_REQUIRED_LIBS_FOUND + VERSION_VAR HarfBuzz_VERSION ) if (HarfBuzz_LIBRARY AND NOT TARGET HarfBuzz::HarfBuzz) - add_library(HarfBuzz::HarfBuzz UNKNOWN IMPORTED GLOBAL) - set_target_properties(HarfBuzz::HarfBuzz PROPERTIES - IMPORTED_LOCATION "${HarfBuzz_LIBRARY}" - INTERFACE_COMPILE_OPTIONS "${HarfBuzz_COMPILE_OPTIONS}" - INTERFACE_INCLUDE_DIRECTORIES "${HarfBuzz_INCLUDE_DIR}" - ) + add_library(HarfBuzz::HarfBuzz UNKNOWN IMPORTED GLOBAL) + set_target_properties(HarfBuzz::HarfBuzz PROPERTIES + IMPORTED_LOCATION "${HarfBuzz_LIBRARY}" + INTERFACE_COMPILE_OPTIONS "${HarfBuzz_COMPILE_OPTIONS}" + INTERFACE_INCLUDE_DIRECTORIES "${HarfBuzz_INCLUDE_DIR}" + ) endif () if (HarfBuzz_ICU_LIBRARY AND NOT TARGET HarfBuzz::ICU) - add_library(HarfBuzz::ICU UNKNOWN IMPORTED GLOBAL) - set_target_properties(HarfBuzz::ICU PROPERTIES - IMPORTED_LOCATION "${HarfBuzz_ICU_LIBRARY}" - INTERFACE_COMPILE_OPTIONS "${HarfBuzz_ICU_COMPILE_OPTIONS}" - INTERFACE_INCLUDE_DIRECTORIES "${HarfBuzz_INCLUDE_DIR}" - ) + add_library(HarfBuzz::ICU UNKNOWN IMPORTED GLOBAL) + set_target_properties(HarfBuzz::ICU PROPERTIES + IMPORTED_LOCATION "${HarfBuzz_ICU_LIBRARY}" + INTERFACE_COMPILE_OPTIONS "${HarfBuzz_ICU_COMPILE_OPTIONS}" + INTERFACE_INCLUDE_DIRECTORIES "${HarfBuzz_INCLUDE_DIR}" + ) endif () mark_as_advanced( - HarfBuzz_INCLUDE_DIR - HarfBuzz_LIBRARY - HarfBuzz_ICU_LIBRARY + HarfBuzz_INCLUDE_DIR + HarfBuzz_LIBRARY + HarfBuzz_ICU_LIBRARY ) if (HarfBuzz_FOUND) - set(HarfBuzz_LIBRARIES ${HarfBuzz_LIBRARY} ${HarfBuzz_ICU_LIBRARY}) - set(HarfBuzz_INCLUDE_DIRS ${HarfBuzz_INCLUDE_DIR}) + set(HarfBuzz_LIBRARIES ${HarfBuzz_LIBRARY} ${HarfBuzz_ICU_LIBRARY}) + set(HarfBuzz_INCLUDE_DIRS ${HarfBuzz_INCLUDE_DIR}) endif () diff --git a/cmake/FindLibc.cmake b/cmake/FindLibc.cmake index 35642e52d1..81921280c0 100644 --- a/cmake/FindLibc.cmake +++ b/cmake/FindLibc.cmake @@ -4,7 +4,7 @@ # LIBC_LIBRARIES - link these to use libc if(LIBC_LIBRARIES) - set(LIBC_FIND_QUIETLY TRUE) + set(LIBC_FIND_QUIETLY TRUE) endif(LIBC_LIBRARIES) find_library(libm NAMES m) diff --git a/cmake/FindPCAP.cmake b/cmake/FindPCAP.cmake index e5049bfb36..90fab58067 100644 --- a/cmake/FindPCAP.cmake +++ b/cmake/FindPCAP.cmake @@ -20,23 +20,23 @@ # HAVE_PF_RING If a found version of libpcap supports PF_RING find_path(PCAP_ROOT_DIR - NAMES include/pcap.h + NAMES include/pcap.h ) find_path(PCAP_INCLUDE_DIR - NAMES pcap.h - HINTS ${PCAP_ROOT_DIR}/include + NAMES pcap.h + HINTS ${PCAP_ROOT_DIR}/include ) find_library(PCAP_LIBRARY - NAMES pcap - HINTS ${PCAP_ROOT_DIR}/lib + NAMES pcap + HINTS ${PCAP_ROOT_DIR}/lib ) include(FindPackageHandleStandardArgs) find_package_handle_standard_args(PCAP DEFAULT_MSG - PCAP_LIBRARY - PCAP_INCLUDE_DIR + PCAP_LIBRARY + PCAP_INCLUDE_DIR ) include(CheckCSourceCompiles) @@ -46,20 +46,20 @@ set(CMAKE_REQUIRED_LIBRARIES) # check if linking against libpcap also needs to link against a thread library if (NOT PCAP_LINKS_SOLO) - find_package(Threads) - if (THREADS_FOUND) - set(CMAKE_REQUIRED_LIBRARIES ${PCAP_LIBRARY} ${CMAKE_THREAD_LIBS_INIT}) - check_c_source_compiles("int main() { return 0; }" PCAP_NEEDS_THREADS) - set(CMAKE_REQUIRED_LIBRARIES) - endif () - if (THREADS_FOUND AND PCAP_NEEDS_THREADS) - set(_tmp ${PCAP_LIBRARY} ${CMAKE_THREAD_LIBS_INIT}) - list(REMOVE_DUPLICATES _tmp) - set(PCAP_LIBRARY ${_tmp} - CACHE STRING "Libraries needed to link against libpcap" FORCE) - else () - message(FATAL_ERROR "Couldn't determine how to link against libpcap") - endif () + find_package(Threads) + if (THREADS_FOUND) + set(CMAKE_REQUIRED_LIBRARIES ${PCAP_LIBRARY} ${CMAKE_THREAD_LIBS_INIT}) + check_c_source_compiles("int main() { return 0; }" PCAP_NEEDS_THREADS) + set(CMAKE_REQUIRED_LIBRARIES) + endif () + if (THREADS_FOUND AND PCAP_NEEDS_THREADS) + set(_tmp ${PCAP_LIBRARY} ${CMAKE_THREAD_LIBS_INIT}) + list(REMOVE_DUPLICATES _tmp) + set(PCAP_LIBRARY ${_tmp} + CACHE STRING "Libraries needed to link against libpcap" FORCE) + else () + message(FATAL_ERROR "Couldn't determine how to link against libpcap") + endif () endif () include(CheckFunctionExists) @@ -68,7 +68,7 @@ check_function_exists(pcap_get_pfring_id HAVE_PF_RING) set(CMAKE_REQUIRED_LIBRARIES) mark_as_advanced( - PCAP_ROOT_DIR - PCAP_INCLUDE_DIR - PCAP_LIBRARY + PCAP_ROOT_DIR + PCAP_INCLUDE_DIR + PCAP_LIBRARY ) diff --git a/cmake/FindPulseAudio.cmake b/cmake/FindPulseAudio.cmake index 1f6f843a1d..c2548aec4d 100644 --- a/cmake/FindPulseAudio.cmake +++ b/cmake/FindPulseAudio.cmake @@ -21,23 +21,23 @@ find_library(PULSEAUDIO_LIBRARY ) if(PULSEAUDIO_INCLUDE_DIR AND EXISTS "${PULSEAUDIO_INCLUDE_DIR}/pulse/version.h") - file(STRINGS "${PULSEAUDIO_INCLUDE_DIR}/pulse/version.h" pulse_version_str - REGEX "^#define[\t ]+pa_get_headers_version\\(\\)[\t ]+\\(\".*\"\\)") + file(STRINGS "${PULSEAUDIO_INCLUDE_DIR}/pulse/version.h" pulse_version_str + REGEX "^#define[\t ]+pa_get_headers_version\\(\\)[\t ]+\\(\".*\"\\)") - string(REGEX REPLACE "^.*pa_get_headers_version\\(\\)[\t ]+\\(\"([^\"]*)\"\\).*$" "\\1" - PULSEAUDIO_VERSION_STRING "${pulse_version_str}") - unset(pulse_version_str) + string(REGEX REPLACE "^.*pa_get_headers_version\\(\\)[\t ]+\\(\"([^\"]*)\"\\).*$" "\\1" + PULSEAUDIO_VERSION_STRING "${pulse_version_str}") + unset(pulse_version_str) endif() include(FindPackageHandleStandardArgs) find_package_handle_standard_args(PulseAudio - REQUIRED_VARS PULSEAUDIO_LIBRARY PULSEAUDIO_INCLUDE_DIR - VERSION_VAR PULSEAUDIO_VERSION_STRING + REQUIRED_VARS PULSEAUDIO_LIBRARY PULSEAUDIO_INCLUDE_DIR + VERSION_VAR PULSEAUDIO_VERSION_STRING ) if(PULSEAUDIO_FOUND) - set(PULSEAUDIO_LIBRARIES ${PULSEAUDIO_LIBRARY}) - set(PULSEAUDIO_INCLUDE_DIRS ${PULSEAUDIO_INCLUDE_DIR}) + set(PULSEAUDIO_LIBRARIES ${PULSEAUDIO_LIBRARY}) + set(PULSEAUDIO_INCLUDE_DIRS ${PULSEAUDIO_INCLUDE_DIR}) endif() mark_as_advanced(PULSEAUDIO_INCLUDE_DIR PULSEAUDIO_LIBRARY) diff --git a/cmake/FindVtune.cmake b/cmake/FindVtune.cmake index dc5c0a14a5..be885270e8 100644 --- a/cmake/FindVtune.cmake +++ b/cmake/FindVtune.cmake @@ -1,27 +1,27 @@ # Find Intel's VTUNE tool -# VTUNE_FOUND found Vtune -# VTUNE_INCLUDE_DIRS include path to jitprofiling.h -# VTUNE_LIBRARIES path to vtune libs +# VTUNE_FOUND found Vtune +# VTUNE_INCLUDE_DIRS include path to jitprofiling.h +# VTUNE_LIBRARIES path to vtune libs find_path(VTUNE_INCLUDE_DIRS NAMES jitprofiling.h PATHS - /opt/intel/vtune_amplifier_xe_2018/include - /opt/intel/vtune_amplifier_xe_2017/include - /opt/intel/vtune_amplifier_xe_2016/include - ) + /opt/intel/vtune_amplifier_xe_2018/include + /opt/intel/vtune_amplifier_xe_2017/include + /opt/intel/vtune_amplifier_xe_2016/include +) if(${PCSX2_TARGET_ARCHITECTURES} MATCHES "i386") - find_library(VTUNE_LIBRARIES NAMES libjitprofiling.a PATHS - /opt/intel/vtune_amplifier_xe_2018/lib32 - /opt/intel/vtune_amplifier_xe_2017/lib32 - /opt/intel/vtune_amplifier_xe_2016/lib32 - ) + find_library(VTUNE_LIBRARIES NAMES libjitprofiling.a PATHS + /opt/intel/vtune_amplifier_xe_2018/lib32 + /opt/intel/vtune_amplifier_xe_2017/lib32 + /opt/intel/vtune_amplifier_xe_2016/lib32 + ) else() - find_library(VTUNE_LIBRARIES NAMES libjitprofiling.a PATHS - /opt/intel/vtune_amplifier_xe_2018/lib64 - /opt/intel/vtune_amplifier_xe_2017/lib64 - /opt/intel/vtune_amplifier_xe_2016/lib64 - ) + find_library(VTUNE_LIBRARIES NAMES libjitprofiling.a PATHS + /opt/intel/vtune_amplifier_xe_2018/lib64 + /opt/intel/vtune_amplifier_xe_2017/lib64 + /opt/intel/vtune_amplifier_xe_2016/lib64 + ) endif() # handle the QUIETLY and REQUIRED arguments and set VTUNE_FOUND to TRUE if diff --git a/cmake/FindXCB.cmake b/cmake/FindXCB.cmake index 98445bc07c..c17669bcaa 100644 --- a/cmake/FindXCB.cmake +++ b/cmake/FindXCB.cmake @@ -31,8 +31,8 @@ include(FeatureSummary) set_package_properties(XCB PROPERTIES - URL "http://xcb.freedesktop.org/" - DESCRIPTION "X protocol C-language Binding") + URL "http://xcb.freedesktop.org/" + DESCRIPTION "X protocol C-language Binding") find_package(PkgConfig) pkg_check_modules(PC_XCB QUIET xcb ${XCB_FIND_COMPONENTS}) diff --git a/cmake/Findlibsamplerate.cmake b/cmake/Findlibsamplerate.cmake index cda5f2caa5..a23d25ec97 100644 --- a/cmake/Findlibsamplerate.cmake +++ b/cmake/Findlibsamplerate.cmake @@ -7,14 +7,14 @@ find_package(PkgConfig) if(PKG_CONFIG_FOUND) - pkg_check_modules (LIBSAMPLERATE samplerate) - list(APPEND LIBSAMPLERATE_INCLUDE_DIRS ${LIBSAMPLERATE_INCLUDEDIR}) + pkg_check_modules (LIBSAMPLERATE samplerate) + list(APPEND LIBSAMPLERATE_INCLUDE_DIRS ${LIBSAMPLERATE_INCLUDEDIR}) endif() if(NOT LIBSAMPLERATE_FOUND) - find_path( LIBSAMPLERATE_INCLUDE_DIRS "samplerate.h" - PATH_SUFFIXES "samplerate" ) - find_library( LIBSAMPLERATE_LIBRARIES samplerate) + find_path( LIBSAMPLERATE_INCLUDE_DIRS "samplerate.h" + PATH_SUFFIXES "samplerate" ) + find_library( LIBSAMPLERATE_LIBRARIES samplerate) endif() # handle the QUIETLY and REQUIRED arguments and set SAMPLERATE_FOUND to TRUE if diff --git a/cmake/Pcsx2Utils.cmake b/cmake/Pcsx2Utils.cmake index 5cac6283b3..e54b2ca6e6 100644 --- a/cmake/Pcsx2Utils.cmake +++ b/cmake/Pcsx2Utils.cmake @@ -1,5 +1,5 @@ #------------------------------------------------------------------------------- -# detectOperatingSystem +# detectOperatingSystem #------------------------------------------------------------------------------- # This function detects on which OS cmake is run and set a flag to control the # build process. Supported OS: Linux, MacOSX, Windows @@ -7,176 +7,176 @@ # On linux, it also set a flag for specific distribution (ie Fedora) #------------------------------------------------------------------------------- function(detectOperatingSystem) - if(WIN32) - set(Windows TRUE PARENT_SCOPE) - elseif(UNIX AND APPLE) - # No easy way to filter out iOS. - message(WARNING "OS X/iOS isn't supported, the build will most likely fail") - set(MacOSX TRUE PARENT_SCOPE) - elseif(UNIX) - if(CMAKE_SYSTEM_NAME MATCHES "Linux") - set(Linux TRUE PARENT_SCOPE) - if (EXISTS /etc/os-release) - # Read the file without CR character - file(STRINGS /etc/os-release OS_RELEASE) - if("${OS_RELEASE}" MATCHES "^.*ID=fedora.*$") - set(Fedora TRUE PARENT_SCOPE) - message(STATUS "Build Fedora specific") - elseif("${OS_RELEASE}" MATCHES "^.*ID=.*suse.*$") - set(openSUSE TRUE PARENT_SCOPE) - message(STATUS "Build openSUSE specific") - endif() - endif() - elseif(CMAKE_SYSTEM_NAME MATCHES "kFreeBSD") - set(kFreeBSD TRUE PARENT_SCOPE) - elseif(CMAKE_SYSTEM_NAME STREQUAL "GNU") - set(GNU TRUE PARENT_SCOPE) - endif() - endif() + if(WIN32) + set(Windows TRUE PARENT_SCOPE) + elseif(UNIX AND APPLE) + # No easy way to filter out iOS. + message(WARNING "OS X/iOS isn't supported, the build will most likely fail") + set(MacOSX TRUE PARENT_SCOPE) + elseif(UNIX) + if(CMAKE_SYSTEM_NAME MATCHES "Linux") + set(Linux TRUE PARENT_SCOPE) + if (EXISTS /etc/os-release) + # Read the file without CR character + file(STRINGS /etc/os-release OS_RELEASE) + if("${OS_RELEASE}" MATCHES "^.*ID=fedora.*$") + set(Fedora TRUE PARENT_SCOPE) + message(STATUS "Build Fedora specific") + elseif("${OS_RELEASE}" MATCHES "^.*ID=.*suse.*$") + set(openSUSE TRUE PARENT_SCOPE) + message(STATUS "Build openSUSE specific") + endif() + endif() + elseif(CMAKE_SYSTEM_NAME MATCHES "kFreeBSD") + set(kFreeBSD TRUE PARENT_SCOPE) + elseif(CMAKE_SYSTEM_NAME STREQUAL "GNU") + set(GNU TRUE PARENT_SCOPE) + endif() + endif() endfunction() function(get_git_version_info) - set(PCSX2_WC_TIME 0) - set(PCSX2_GIT_REV "") - if (GIT_FOUND AND EXISTS ${PROJECT_SOURCE_DIR}/.git) - EXECUTE_PROCESS(WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} COMMAND ${GIT_EXECUTABLE} show -s --format=%ci HEAD - OUTPUT_VARIABLE PCSX2_WC_TIME - OUTPUT_STRIP_TRAILING_WHITESPACE) - # 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}") + set(PCSX2_WC_TIME 0) + set(PCSX2_GIT_REV "") + if (GIT_FOUND AND EXISTS ${PROJECT_SOURCE_DIR}/.git) + EXECUTE_PROCESS(WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} COMMAND ${GIT_EXECUTABLE} show -s --format=%ci HEAD + OUTPUT_VARIABLE PCSX2_WC_TIME + OUTPUT_STRIP_TRAILING_WHITESPACE) + # 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}") - EXECUTE_PROCESS(WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} COMMAND ${GIT_EXECUTABLE} describe --always - OUTPUT_VARIABLE PCSX2_GIT_REV - OUTPUT_STRIP_TRAILING_WHITESPACE) - endif() - if(PCSX2_GIT_REV) - set(PCSX2_VERSION_LONG "${PCSX2_GIT_REV}") - string(REGEX MATCH "[0-9]+\\.[0-9]+(\\.[0-9]+)?(-[a-z][a-z0-9]+)?" PCSX2_VERSION_SHORT "${PCSX2_VERSION_LONG}") - else() - set(PCSX2_VERSION_LONG "Unknown (git unavailable)") - set(PCSX2_VERSION_SHORT "Unknown") - endif() - if ("${PCSX2_WC_TIME}" STREQUAL "") - set(PCSX2_WC_TIME 0) - endif() + EXECUTE_PROCESS(WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} COMMAND ${GIT_EXECUTABLE} describe --always + OUTPUT_VARIABLE PCSX2_GIT_REV + OUTPUT_STRIP_TRAILING_WHITESPACE) + endif() + if(PCSX2_GIT_REV) + set(PCSX2_VERSION_LONG "${PCSX2_GIT_REV}") + string(REGEX MATCH "[0-9]+\\.[0-9]+(\\.[0-9]+)?(-[a-z][a-z0-9]+)?" PCSX2_VERSION_SHORT "${PCSX2_VERSION_LONG}") + else() + set(PCSX2_VERSION_LONG "Unknown (git unavailable)") + set(PCSX2_VERSION_SHORT "Unknown") + endif() + if ("${PCSX2_WC_TIME}" STREQUAL "") + set(PCSX2_WC_TIME 0) + endif() - set(PCSX2_WC_TIME "${PCSX2_WC_TIME}" PARENT_SCOPE) - set(PCSX2_GIT_REV "${PCSX2_GIT_REV}" PARENT_SCOPE) - set(PCSX2_VERSION_LONG "${PCSX2_VERSION_LONG}" PARENT_SCOPE) - set(PCSX2_VERSION_SHORT "${PCSX2_VERSION_SHORT}" PARENT_SCOPE) + set(PCSX2_WC_TIME "${PCSX2_WC_TIME}" PARENT_SCOPE) + set(PCSX2_GIT_REV "${PCSX2_GIT_REV}" PARENT_SCOPE) + set(PCSX2_VERSION_LONG "${PCSX2_VERSION_LONG}" PARENT_SCOPE) + set(PCSX2_VERSION_SHORT "${PCSX2_VERSION_SHORT}" PARENT_SCOPE) endfunction() function(write_svnrev_h) - file(WRITE ${CMAKE_BINARY_DIR}/common/include/svnrev.h "#define SVN_REV ${PCSX2_WC_TIME}ll \n#define SVN_MODS 0\n#define GIT_REV \"${PCSX2_GIT_REV}\"") + file(WRITE ${CMAKE_BINARY_DIR}/common/include/svnrev.h "#define SVN_REV ${PCSX2_WC_TIME}ll \n#define SVN_MODS 0\n#define GIT_REV \"${PCSX2_GIT_REV}\"") endfunction() function(check_compiler_version version_warn version_err) - if(CMAKE_COMPILER_IS_GNUCXX) - execute_process(COMMAND ${CMAKE_C_COMPILER} -dumpversion OUTPUT_VARIABLE GCC_VERSION) - string(STRIP "${GCC_VERSION}" GCC_VERSION) - if(GCC_VERSION VERSION_LESS ${version_err}) - message(FATAL_ERROR "PCSX2 doesn't support your old GCC ${GCC_VERSION}! Please upgrade it! + if(CMAKE_COMPILER_IS_GNUCXX) + execute_process(COMMAND ${CMAKE_C_COMPILER} -dumpversion OUTPUT_VARIABLE GCC_VERSION) + string(STRIP "${GCC_VERSION}" GCC_VERSION) + if(GCC_VERSION VERSION_LESS ${version_err}) + message(FATAL_ERROR "PCSX2 doesn't support your old GCC ${GCC_VERSION}! Please upgrade it! - The minimum supported version is ${version_err} but ${version_warn} is warmly recommended") - else() - if(GCC_VERSION VERSION_LESS ${version_warn}) - message(WARNING "PCSX2 will stop supporting GCC ${GCC_VERSION} in the near future. Please upgrade to at least GCC ${version_warn}.") - endif() - endif() + The minimum supported version is ${version_err} but ${version_warn} is warmly recommended") + else() + if(GCC_VERSION VERSION_LESS ${version_warn}) + message(WARNING "PCSX2 will stop supporting GCC ${GCC_VERSION} in the near future. Please upgrade to at least GCC ${version_warn}.") + endif() + endif() - set(GCC_VERSION "${GCC_VERSION}" PARENT_SCOPE) - endif() + set(GCC_VERSION "${GCC_VERSION}" PARENT_SCOPE) + endif() endfunction() function(check_no_parenthesis_in_path) - if ("${CMAKE_BINARY_DIR}" MATCHES "[()]" OR "${CMAKE_SOURCE_DIR}" MATCHES "[()]") - 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() + if ("${CMAKE_BINARY_DIR}" MATCHES "[()]" OR "${CMAKE_SOURCE_DIR}" MATCHES "[()]") + 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}") + 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 ${CMAKE_INSTALL_LIBDIR}/PCSX2) - else(PACKAGE_MODE) - install(TARGETS ${lib} DESTINATION ${CMAKE_SOURCE_DIR}/bin/plugins) - endif(PACKAGE_MODE) - if (APPLE) - # Output to app bundle - set_target_properties(${lib} PROPERTIES LIBRARY_OUTPUT_DIRECTORY "$/plugins") - add_dependencies(pcsx2-postprocess-bundle ${lib}) - endif() + 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 ${CMAKE_INSTALL_LIBDIR}/PCSX2) + else(PACKAGE_MODE) + install(TARGETS ${lib} DESTINATION ${CMAKE_SOURCE_DIR}/bin/plugins) + endif(PACKAGE_MODE) + if (APPLE) + # Output to app bundle + set_target_properties(${lib} PROPERTIES LIBRARY_OUTPUT_DIRECTORY "$/plugins") + add_dependencies(pcsx2-postprocess-bundle ${lib}) + endif() 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 "") + 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(${exe} "${USER_CMAKE_LD_FLAGS}") - endif(NOT USER_CMAKE_LD_FLAGS STREQUAL "") - if(PACKAGE_MODE) - install(TARGETS ${exe} DESTINATION ${CMAKE_INSTALL_BINDIR}) - else(PACKAGE_MODE) - install(TARGETS ${exe} DESTINATION ${CMAKE_SOURCE_DIR}/bin) - endif(PACKAGE_MODE) + 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(${exe} "${USER_CMAKE_LD_FLAGS}") + endif(NOT USER_CMAKE_LD_FLAGS STREQUAL "") + if(PACKAGE_MODE) + install(TARGETS ${exe} DESTINATION ${CMAKE_INSTALL_BINDIR}) + else(PACKAGE_MODE) + install(TARGETS ${exe} DESTINATION ${CMAKE_SOURCE_DIR}/bin) + endif(PACKAGE_MODE) endmacro(add_pcsx2_executable) # Helper macro to generate resources on linux (based on glib) macro(add_custom_glib_res out xml prefix) - set(RESOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/res") - set(RESOURCE_FILES "${ARGN}") - # Note: trying to combine --generate-source and --generate-header doesn't work. - # It outputs whichever one comes last into the file named by the first - add_custom_command( - OUTPUT ${out}.h - COMMAND glib-compile-resources --sourcedir "${RESOURCE_DIR}" --generate-header - --c-name ${prefix} "${RESOURCE_DIR}/${xml}" --target=${out}.h - DEPENDS res/${xml} ${RESOURCE_FILES}) + set(RESOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/res") + set(RESOURCE_FILES "${ARGN}") + # Note: trying to combine --generate-source and --generate-header doesn't work. + # It outputs whichever one comes last into the file named by the first + add_custom_command( + OUTPUT ${out}.h + COMMAND glib-compile-resources --sourcedir "${RESOURCE_DIR}" --generate-header + --c-name ${prefix} "${RESOURCE_DIR}/${xml}" --target=${out}.h + DEPENDS res/${xml} ${RESOURCE_FILES}) - add_custom_command( - OUTPUT ${out}.cpp - COMMAND glib-compile-resources --sourcedir "${RESOURCE_DIR}" --generate-source - --c-name ${prefix} "${RESOURCE_DIR}/${xml}" --target=${out}.cpp - DEPENDS res/${xml} ${RESOURCE_FILES}) + add_custom_command( + OUTPUT ${out}.cpp + COMMAND glib-compile-resources --sourcedir "${RESOURCE_DIR}" --generate-source + --c-name ${prefix} "${RESOURCE_DIR}/${xml}" --target=${out}.cpp + DEPENDS res/${xml} ${RESOURCE_FILES}) endmacro() diff --git a/cmake/SearchForStuff.cmake b/cmake/SearchForStuff.cmake index cced5a0aaa..d134c8aaf9 100644 --- a/cmake/SearchForStuff.cmake +++ b/cmake/SearchForStuff.cmake @@ -1,16 +1,16 @@ #------------------------------------------------------------------------------- -# Search all libraries on the system +# Search all libraries on the system #------------------------------------------------------------------------------- ## Use cmake package to find module if (Linux) - find_package(ALSA) + find_package(ALSA) endif() find_package(PCAP) find_package(LibXml2) find_package(Freetype) # GS OSD find_package(Gettext) # translation tool if(EXISTS ${PROJECT_SOURCE_DIR}/.git) - find_package(Git) + find_package(Git) endif() find_package(LibLZMA) @@ -30,9 +30,9 @@ find_package(Vtune) # They do uname -m if missing so only fix for cross compilations. # http://pkgs.fedoraproject.org/cgit/wxGTK.git/plain/wx-config if(Fedora AND CMAKE_CROSSCOMPILING) - set(wxWidgets_CONFIG_OPTIONS --arch ${PCSX2_TARGET_ARCHITECTURES} --unicode=yes) + set(wxWidgets_CONFIG_OPTIONS --arch ${PCSX2_TARGET_ARCHITECTURES} --unicode=yes) else() - set(wxWidgets_CONFIG_OPTIONS --unicode=yes) + set(wxWidgets_CONFIG_OPTIONS --unicode=yes) endif() # I'm removing the version check, because it excludes newer versions and requires specifically 3.0. @@ -41,9 +41,9 @@ endif() # The wx version must be specified so a mix of gtk2 and gtk3 isn't used # as that can cause compile errors. if(GTK2_API AND NOT APPLE) - list(APPEND wxWidgets_CONFIG_OPTIONS --toolkit=gtk2) + list(APPEND wxWidgets_CONFIG_OPTIONS --toolkit=gtk2) elseif(NOT APPLE) - list(APPEND wxWidgets_CONFIG_OPTIONS --toolkit=gtk3) + list(APPEND wxWidgets_CONFIG_OPTIONS --toolkit=gtk3) endif() # wx2.8 => /usr/bin/wx-config-2.8 @@ -53,37 +53,37 @@ endif() # lib32-wx3.0 => /usr/bin/wx-config32-3.0 # FindwxWidgets only searches for wx-config. if(CMAKE_CROSSCOMPILING) - # May need to fix the filenames for lib32-wx3.0. - if(${PCSX2_TARGET_ARCHITECTURES} MATCHES "i386") - if (Fedora AND EXISTS "/usr/bin/wx-config-3.0") - set(wxWidgets_CONFIG_EXECUTABLE "/usr/bin/wx-config-3.0") - endif() - if (EXISTS "/usr/bin/wx-config32") - set(wxWidgets_CONFIG_EXECUTABLE "/usr/bin/wx-config32") - endif() - if (EXISTS "/usr/bin/wx-config32-3.0") - set(wxWidgets_CONFIG_EXECUTABLE "/usr/bin/wx-config32-3.0") - endif() - endif() + # May need to fix the filenames for lib32-wx3.0. + if(${PCSX2_TARGET_ARCHITECTURES} MATCHES "i386") + if (Fedora AND EXISTS "/usr/bin/wx-config-3.0") + set(wxWidgets_CONFIG_EXECUTABLE "/usr/bin/wx-config-3.0") + endif() + if (EXISTS "/usr/bin/wx-config32") + set(wxWidgets_CONFIG_EXECUTABLE "/usr/bin/wx-config32") + endif() + if (EXISTS "/usr/bin/wx-config32-3.0") + set(wxWidgets_CONFIG_EXECUTABLE "/usr/bin/wx-config32-3.0") + endif() + endif() else() - if (${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD") - set(wxWidgets_CONFIG_EXECUTABLE "/usr/local/bin/wxgtk3u-3.0-config") - endif() - if(EXISTS "/usr/bin/wx-config-3.2") - set(wxWidgets_CONFIG_EXECUTABLE "/usr/bin/wx-config-3.2") - endif() - if(EXISTS "/usr/bin/wx-config-3.1") - set(wxWidgets_CONFIG_EXECUTABLE "/usr/bin/wx-config-3.1") - endif() - if(EXISTS "/usr/bin/wx-config-3.0") - set(wxWidgets_CONFIG_EXECUTABLE "/usr/bin/wx-config-3.0") - endif() - if(EXISTS "/usr/bin/wx-config") - set(wxWidgets_CONFIG_EXECUTABLE "/usr/bin/wx-config") - endif() - if(NOT GTK2_API AND EXISTS "/usr/bin/wx-config-gtk3") - set(wxWidgets_CONFIG_EXECUTABLE "/usr/bin/wx-config-gtk3") - endif() + if (${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD") + set(wxWidgets_CONFIG_EXECUTABLE "/usr/local/bin/wxgtk3u-3.0-config") + endif() + if(EXISTS "/usr/bin/wx-config-3.2") + set(wxWidgets_CONFIG_EXECUTABLE "/usr/bin/wx-config-3.2") + endif() + if(EXISTS "/usr/bin/wx-config-3.1") + set(wxWidgets_CONFIG_EXECUTABLE "/usr/bin/wx-config-3.1") + endif() + if(EXISTS "/usr/bin/wx-config-3.0") + set(wxWidgets_CONFIG_EXECUTABLE "/usr/bin/wx-config-3.0") + endif() + if(EXISTS "/usr/bin/wx-config") + set(wxWidgets_CONFIG_EXECUTABLE "/usr/bin/wx-config") + endif() + if(NOT GTK2_API AND EXISTS "/usr/bin/wx-config-gtk3") + set(wxWidgets_CONFIG_EXECUTABLE "/usr/bin/wx-config-gtk3") + endif() endif() find_package(wxWidgets COMPONENTS base core adv) @@ -101,57 +101,57 @@ include(FindPulseAudio) ## Use CheckLib package to find module include(CheckLib) if(Linux) - check_lib(EGL EGL EGL/egl.h) - check_lib(X11_XCB X11-xcb X11/Xlib-xcb.h) - check_lib(AIO aio libaio.h) - # There are two udev pkg config files - udev.pc (wrong), libudev.pc (correct) - # When cross compiling, pkg-config will be skipped so we have to look for - # udev (it'll automatically be prefixed with lib). But when not cross - # compiling, we have to look for libudev.pc. Argh. Hence the silliness below. - if(CMAKE_CROSSCOMPILING) - check_lib(LIBUDEV udev libudev.h) - else() - check_lib(LIBUDEV libudev libudev.h) - endif() + check_lib(EGL EGL EGL/egl.h) + check_lib(X11_XCB X11-xcb X11/Xlib-xcb.h) + check_lib(AIO aio libaio.h) + # There are two udev pkg config files - udev.pc (wrong), libudev.pc (correct) + # When cross compiling, pkg-config will be skipped so we have to look for + # udev (it'll automatically be prefixed with lib). But when not cross + # compiling, we have to look for libudev.pc. Argh. Hence the silliness below. + if(CMAKE_CROSSCOMPILING) + check_lib(LIBUDEV udev libudev.h) + else() + check_lib(LIBUDEV libudev libudev.h) + endif() endif() if(PORTAUDIO_API) - check_lib(PORTAUDIO portaudio portaudio.h pa_linux_alsa.h) + check_lib(PORTAUDIO portaudio portaudio.h pa_linux_alsa.h) endif() check_lib(SOUNDTOUCH SoundTouch soundtouch/SoundTouch.h) if(SDL2_API) - check_lib(SDL2 SDL2 SDL.h PATH_SUFFIXES SDL2) + check_lib(SDL2 SDL2 SDL.h PATH_SUFFIXES SDL2) else() - # Tell cmake that we use SDL as a library and not as an application - set(SDL_BUILDING_LIBRARY TRUE) - find_package(SDL) + # Tell cmake that we use SDL as a library and not as an application + set(SDL_BUILDING_LIBRARY TRUE) + find_package(SDL) endif() if(UNIX) - find_package(X11) - # Most plugins (if not all) and PCSX2 core need gtk2, so set the required flags - if (GTK2_API) - find_package(GTK2 REQUIRED gtk) - else() - if(CMAKE_CROSSCOMPILING) - find_package(GTK3 REQUIRED gtk) - else() - check_lib(GTK3 gtk+-3.0 gtk/gtk.h) - endif() - endif() - find_package(XCB) + find_package(X11) + # Most plugins (if not all) and PCSX2 core need gtk2, so set the required flags + if (GTK2_API) + find_package(GTK2 REQUIRED gtk) + else() + if(CMAKE_CROSSCOMPILING) + find_package(GTK3 REQUIRED gtk) + else() + check_lib(GTK3 gtk+-3.0 gtk/gtk.h) + endif() + endif() + find_package(XCB) endif() #---------------------------------------- -# Use system include +# Use system include #---------------------------------------- if(UNIX) if(GTK3_FOUND) - include_directories(${GTK3_INCLUDE_DIRS}) - # A lazy solution - set(GTK2_LIBRARIES ${GTK3_LIBRARIES}) - elseif(GTK2_FOUND) - include_directories(${GTK2_INCLUDE_DIRS}) + include_directories(${GTK3_INCLUDE_DIRS}) + # A lazy solution + set(GTK2_LIBRARIES ${GTK3_LIBRARIES}) + elseif(GTK2_FOUND) + include_directories(${GTK2_INCLUDE_DIRS}) endif() if(X11_FOUND) @@ -172,7 +172,7 @@ if(JPEG_FOUND) endif() if(GLEW_FOUND) - include_directories(${GLEW_INCLUDE_DIR}) + include_directories(${GLEW_INCLUDE_DIR}) endif() if(OPENGL_FOUND) @@ -184,7 +184,7 @@ if(SDL_FOUND AND NOT SDL2_API) endif() if(USE_VTUNE AND VTUNE_FOUND) - include_directories(${VTUNE_INCLUDE_DIRS}) + include_directories(${VTUNE_INCLUDE_DIRS}) endif() if(wxWidgets_FOUND) @@ -196,11 +196,11 @@ if(PCAP_FOUND) endif() if(LIBSAMPLERATE_FOUND) - include_directories(${LIBSAMPLERATE_INCLUDE_DIR}) + include_directories(${LIBSAMPLERATE_INCLUDE_DIR}) endif() if(PULSEAUDIO_FOUND) - include_directories(${PULSEAUDIO_INCLUDE_DIR}) + include_directories(${PULSEAUDIO_INCLUDE_DIR}) endif() if(LIBXML2_FOUND) @@ -228,12 +228,13 @@ endif() #---------------------------------------- # Use project-wide include directories #---------------------------------------- -include_directories(${CMAKE_SOURCE_DIR}/common/include - ${CMAKE_SOURCE_DIR}/common/include/Utilities - ${CMAKE_SOURCE_DIR}/common/include/x86emitter - # File generated by Cmake - ${CMAKE_BINARY_DIR}/common/include - ) +include_directories( + ${CMAKE_SOURCE_DIR}/common/include + ${CMAKE_SOURCE_DIR}/common/include/Utilities + ${CMAKE_SOURCE_DIR}/common/include/x86emitter + # File generated by Cmake + ${CMAKE_BINARY_DIR}/common/include +) #---------------------------------------- # Check correctness of the parameter @@ -245,48 +246,48 @@ WX_vs_SDL() # Blacklist bad GCC if(GCC_VERSION VERSION_EQUAL "7.0" OR GCC_VERSION VERSION_EQUAL "7.1") - GCC7_BUG() + GCC7_BUG() endif() if((GCC_VERSION VERSION_EQUAL "9.0" OR GCC_VERSION VERSION_GREATER "9.0") AND GCC_VERSION LESS "9.2") - message(WARNING " - It looks like you are compiling with 9.0.x or 9.1.x. Using these versions is not recommended, - as there is a bug known to cause the compiler to segfault while compiling. See patch - https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=275ab714637a64672c6630cfd744af2c70957d5a - Even with that patch, compiling with LTO may still segfault. Use at your own risk! - This text being in a compile log in an open issue may cause it to be closed.") + message(WARNING " + It looks like you are compiling with 9.0.x or 9.1.x. Using these versions is not recommended, + as there is a bug known to cause the compiler to segfault while compiling. See patch + https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=275ab714637a64672c6630cfd744af2c70957d5a + Even with that patch, compiling with LTO may still segfault. Use at your own risk! + This text being in a compile log in an open issue may cause it to be closed.") endif() find_package(fmt "7.1.3" QUIET) if(NOT fmt_FOUND) - if(EXISTS "${CMAKE_SOURCE_DIR}/3rdparty/fmt/fmt/CMakeLists.txt") - message(STATUS "No system fmt was found. Using bundled") - add_subdirectory(3rdparty/fmt/fmt) - else() - message(FATAL_ERROR "No system or bundled fmt was found") - endif() + if(EXISTS "${CMAKE_SOURCE_DIR}/3rdparty/fmt/fmt/CMakeLists.txt") + message(STATUS "No system fmt was found. Using bundled") + add_subdirectory(3rdparty/fmt/fmt) + else() + message(FATAL_ERROR "No system or bundled fmt was found") + endif() else() - message(STATUS "Found fmt: ${fmt_VERSION}") + message(STATUS "Found fmt: ${fmt_VERSION}") endif() if(USE_SYSTEM_YAML) - find_package(yaml-cpp "0.6.3" QUIET) - if(NOT yaml-cpp_FOUND) - message(STATUS "No system yaml-cpp was found") - set(USE_SYSTEM_YAML OFF) - else() - message(STATUS "Found yaml-cpp: ${yaml-cpp_VERSION}") - message(STATUS "Note that the latest release of yaml-cpp is very outdated, and the bundled submodule in the repo has over a year of bug fixes and as such is preferred.") - endif() + find_package(yaml-cpp "0.6.3" QUIET) + if(NOT yaml-cpp_FOUND) + message(STATUS "No system yaml-cpp was found") + set(USE_SYSTEM_YAML OFF) + else() + message(STATUS "Found yaml-cpp: ${yaml-cpp_VERSION}") + message(STATUS "Note that the latest release of yaml-cpp is very outdated, and the bundled submodule in the repo has over a year of bug fixes and as such is preferred.") + endif() endif() if(NOT USE_SYSTEM_YAML) - if(EXISTS "${CMAKE_SOURCE_DIR}/3rdparty/yaml-cpp/yaml-cpp/CMakeLists.txt") - message(STATUS "Using bundled yaml-cpp") - add_subdirectory(3rdparty/yaml-cpp/yaml-cpp EXCLUDE_FROM_ALL) - else() - message(FATAL_ERROR "No bundled yaml-cpp was found") - endif() + if(EXISTS "${CMAKE_SOURCE_DIR}/3rdparty/yaml-cpp/yaml-cpp/CMakeLists.txt") + message(STATUS "Using bundled yaml-cpp") + add_subdirectory(3rdparty/yaml-cpp/yaml-cpp EXCLUDE_FROM_ALL) + else() + message(FATAL_ERROR "No bundled yaml-cpp was found") + endif() endif() add_subdirectory(3rdparty/libchdr/libchdr EXCLUDE_FROM_ALL) @@ -301,61 +302,61 @@ set(msg_dep_common_libs "check these libraries -> wxWidgets (>=3.0), aio") set(msg_dep_pcsx2 "check these libraries -> wxWidgets (>=3.0), gtk2, zlib (>=1.2.4), pcsx2 common libs") macro(print_dep str dep) - if (PACKAGE_MODE) - message(FATAL_ERROR "${str}:${dep}") - else() - message(STATUS "${str}:${dep}") - endif() + if (PACKAGE_MODE) + message(FATAL_ERROR "${str}:${dep}") + else() + message(STATUS "${str}:${dep}") + endif() endmacro(print_dep) #------------------------------------------------------------------------------- -# Pcsx2 core & common libs +# Pcsx2 core & common libs #------------------------------------------------------------------------------- # Check for additional dependencies. # If all dependencies are available, including OS, build it #------------------------------------------------------------------------------- if (GTK2_FOUND OR GTK3_FOUND) - set(GTKn_FOUND TRUE) + set(GTKn_FOUND TRUE) elseif(APPLE) # Not we have but that we don't change all if(gtkn) entries - set(GTKn_FOUND TRUE) + set(GTKn_FOUND TRUE) else() - set(GTKn_FOUND FALSE) + set(GTKn_FOUND FALSE) endif() if(SDL_FOUND OR SDL2_FOUND) - set(SDLn_FOUND TRUE) + set(SDLn_FOUND TRUE) else() - set(SDLn_FOUND FALSE) + set(SDLn_FOUND FALSE) endif() if(wxWidgets_FOUND) - set(common_libs TRUE) + set(common_libs TRUE) elseif(NOT EXISTS "${CMAKE_SOURCE_DIR}/common/src") - set(common_libs FALSE) + set(common_libs FALSE) else() - set(common_libs FALSE) - print_dep("Skip build of common libraries: missing dependencies" "${msg_dep_common_libs}") + set(common_libs FALSE) + print_dep("Skip build of common libraries: missing dependencies" "${msg_dep_common_libs}") endif() # Common dependancy if(wxWidgets_FOUND AND ZLIB_FOUND AND common_libs AND NOT (Linux AND NOT AIO_FOUND)) - if(OPENGL_FOUND AND X11_FOUND AND GTKn_FOUND AND ZLIB_FOUND AND PNG_FOUND AND FREETYPE_FOUND AND LIBLZMA_FOUND AND ((EGL_FOUND AND X11_XCB_FOUND) OR APPLE)) - set(pcsx2_core TRUE) - else() - print_dep("Skip build of pcsx2 core: missing dependencies" "${msg_dep_pcsx2}") - set(pcsx2_core FALSE) - endif() + if(OPENGL_FOUND AND X11_FOUND AND GTKn_FOUND AND ZLIB_FOUND AND PNG_FOUND AND FREETYPE_FOUND AND LIBLZMA_FOUND AND ((EGL_FOUND AND X11_XCB_FOUND) OR APPLE)) + set(pcsx2_core TRUE) + else() + print_dep("Skip build of pcsx2 core: missing dependencies" "${msg_dep_pcsx2}") + set(pcsx2_core FALSE) + endif() elseif(NOT EXISTS "${CMAKE_SOURCE_DIR}/pcsx2") - set(pcsx2_core FALSE) + set(pcsx2_core FALSE) else() - set(pcsx2_core FALSE) - print_dep("Skip build of pcsx2 core: missing dependencies" "${msg_dep_pcsx2}") + set(pcsx2_core FALSE) + print_dep("Skip build of pcsx2 core: missing dependencies" "${msg_dep_pcsx2}") endif() # Linux, BSD, use gtk2, but not OSX if(UNIX AND pcsx2_core AND NOT GTKn_FOUND AND NOT APPLE) - set(pcsx2_core FALSE) - print_dep("Skip build of pcsx2 core: missing dependencies" "${msg_dep_pcsx2}") + set(pcsx2_core FALSE) + print_dep("Skip build of pcsx2 core: missing dependencies" "${msg_dep_pcsx2}") endif() diff --git a/cmake/TargetArch.cmake b/cmake/TargetArch.cmake index ee144bc1fd..442bc81c34 100644 --- a/cmake/TargetArch.cmake +++ b/cmake/TargetArch.cmake @@ -32,41 +32,41 @@ set(archdetect_c_code " #if defined(__arm__) || defined(__TARGET_ARCH_ARM) - #if defined(__ARM_ARCH_7__) \\ - || defined(__ARM_ARCH_7A__) \\ - || defined(__ARM_ARCH_7R__) \\ - || defined(__ARM_ARCH_7M__) \\ - || (defined(__TARGET_ARCH_ARM) && __TARGET_ARCH_ARM-0 >= 7) - #error cmake_ARCH armv7 - #elif defined(__ARM_ARCH_6__) \\ - || defined(__ARM_ARCH_6J__) \\ - || defined(__ARM_ARCH_6T2__) \\ - || defined(__ARM_ARCH_6Z__) \\ - || defined(__ARM_ARCH_6K__) \\ - || defined(__ARM_ARCH_6ZK__) \\ - || defined(__ARM_ARCH_6M__) \\ - || (defined(__TARGET_ARCH_ARM) && __TARGET_ARCH_ARM-0 >= 6) - #error cmake_ARCH armv6 - #elif defined(__ARM_ARCH_5TEJ__) \\ - || (defined(__TARGET_ARCH_ARM) && __TARGET_ARCH_ARM-0 >= 5) - #error cmake_ARCH armv5 - #else - #error cmake_ARCH arm - #endif + #if defined(__ARM_ARCH_7__) \\ + || defined(__ARM_ARCH_7A__) \\ + || defined(__ARM_ARCH_7R__) \\ + || defined(__ARM_ARCH_7M__) \\ + || (defined(__TARGET_ARCH_ARM) && __TARGET_ARCH_ARM-0 >= 7) + #error cmake_ARCH armv7 + #elif defined(__ARM_ARCH_6__) \\ + || defined(__ARM_ARCH_6J__) \\ + || defined(__ARM_ARCH_6T2__) \\ + || defined(__ARM_ARCH_6Z__) \\ + || defined(__ARM_ARCH_6K__) \\ + || defined(__ARM_ARCH_6ZK__) \\ + || defined(__ARM_ARCH_6M__) \\ + || (defined(__TARGET_ARCH_ARM) && __TARGET_ARCH_ARM-0 >= 6) + #error cmake_ARCH armv6 + #elif defined(__ARM_ARCH_5TEJ__) \\ + || (defined(__TARGET_ARCH_ARM) && __TARGET_ARCH_ARM-0 >= 5) + #error cmake_ARCH armv5 + #else + #error cmake_ARCH arm + #endif #elif defined(__i386) || defined(__i386__) || defined(_M_IX86) - #error cmake_ARCH i386 + #error cmake_ARCH i386 #elif defined(__x86_64) || defined(__x86_64__) || defined(__amd64) || defined(_M_X64) - #error cmake_ARCH x86_64 + #error cmake_ARCH x86_64 #elif defined(__ia64) || defined(__ia64__) || defined(_M_IA64) - #error cmake_ARCH ia64 + #error cmake_ARCH ia64 #elif defined(__ppc__) || defined(__ppc) || defined(__powerpc__) \\ - || defined(_ARCH_COM) || defined(_ARCH_PWR) || defined(_ARCH_PPC) \\ - || defined(_M_MPPC) || defined(_M_PPC) - #if defined(__ppc64__) || defined(__powerpc64__) || defined(__64BIT__) - #error cmake_ARCH ppc64 - #else - #error cmake_ARCH ppc - #endif + || defined(_ARCH_COM) || defined(_ARCH_PWR) || defined(_ARCH_PPC) \\ + || defined(_M_MPPC) || defined(_M_PPC) + #if defined(__ppc64__) || defined(__powerpc64__) || defined(__64BIT__) + #error cmake_ARCH ppc64 + #else + #error cmake_ARCH ppc + #endif #endif #error cmake_ARCH unknown @@ -76,94 +76,94 @@ set(archdetect_c_code " # will be treated as invalid architectures since they are no longer supported by Apple function(target_architecture output_var) - if(APPLE AND CMAKE_OSX_ARCHITECTURES) - # On OS X we use CMAKE_OSX_ARCHITECTURES *if* it was set - # First let's normalize the order of the values + if(APPLE AND CMAKE_OSX_ARCHITECTURES) + # On OS X we use CMAKE_OSX_ARCHITECTURES *if* it was set + # First let's normalize the order of the values - # Note that it's not possible to compile PowerPC applications if you are using - # the OS X SDK version 10.6 or later - you'll need 10.4/10.5 for that, so we - # disable it by default - # See this page for more information: - # http://stackoverflow.com/questions/5333490/how-can-we-restore-ppc-ppc64-as-well-as-full-10-4-10-5-sdk-support-to-xcode-4 + # Note that it's not possible to compile PowerPC applications if you are using + # the OS X SDK version 10.6 or later - you'll need 10.4/10.5 for that, so we + # disable it by default + # See this page for more information: + # http://stackoverflow.com/questions/5333490/how-can-we-restore-ppc-ppc64-as-well-as-full-10-4-10-5-sdk-support-to-xcode-4 - # Architecture defaults to i386 or ppc on OS X 10.5 and earlier, depending on the CPU type detected at runtime. - # On OS X 10.6+ the default is x86_64 if the CPU supports it, i386 otherwise. + # Architecture defaults to i386 or ppc on OS X 10.5 and earlier, depending on the CPU type detected at runtime. + # On OS X 10.6+ the default is x86_64 if the CPU supports it, i386 otherwise. - LIST(LENGTH CMAKE_OSX_ARCHITECTURES osx_arch_num) - if(NOT (osx_arch_num EQUAL 1)) - message(FATAL_ERROR "Currently ${CMAKE_PROJECT_NAME} does not support multiple architectures in CMAKE_OSX_ARCHITECTURES") - endif() + LIST(LENGTH CMAKE_OSX_ARCHITECTURES osx_arch_num) + if(NOT (osx_arch_num EQUAL 1)) + message(FATAL_ERROR "Currently ${CMAKE_PROJECT_NAME} does not support multiple architectures in CMAKE_OSX_ARCHITECTURES") + endif() - foreach(osx_arch ${CMAKE_OSX_ARCHITECTURES}) - if("${osx_arch}" STREQUAL "ppc" AND ppc_support) - set(osx_arch_ppc TRUE) - elseif("${osx_arch}" STREQUAL "i386") - set(osx_arch_i386 TRUE) - elseif("${osx_arch}" STREQUAL "x86_64") - set(osx_arch_x86_64 TRUE) - elseif("${osx_arch}" STREQUAL "ppc64" AND ppc_support) - set(osx_arch_ppc64 TRUE) - else() - message(FATAL_ERROR "Invalid OS X arch name: ${osx_arch}") - endif() - endforeach() + foreach(osx_arch ${CMAKE_OSX_ARCHITECTURES}) + if("${osx_arch}" STREQUAL "ppc" AND ppc_support) + set(osx_arch_ppc TRUE) + elseif("${osx_arch}" STREQUAL "i386") + set(osx_arch_i386 TRUE) + elseif("${osx_arch}" STREQUAL "x86_64") + set(osx_arch_x86_64 TRUE) + elseif("${osx_arch}" STREQUAL "ppc64" AND ppc_support) + set(osx_arch_ppc64 TRUE) + else() + message(FATAL_ERROR "Invalid OS X arch name: ${osx_arch}") + endif() + endforeach() - # Now add all the architectures in our normalized order - if(osx_arch_ppc) - list(APPEND ARCH ppc) - endif() + # Now add all the architectures in our normalized order + if(osx_arch_ppc) + list(APPEND ARCH ppc) + endif() - if(osx_arch_i386) - list(APPEND ARCH i386) - endif() + if(osx_arch_i386) + list(APPEND ARCH i386) + endif() - if(osx_arch_x86_64) - list(APPEND ARCH x86_64) - endif() + if(osx_arch_x86_64) + list(APPEND ARCH x86_64) + endif() - if(osx_arch_ppc64) - list(APPEND ARCH ppc64) - endif() + if(osx_arch_ppc64) + list(APPEND ARCH ppc64) + endif() - LIST(LENGTH ARCH osx_arch_num) - if(osx_arch_num LESS 1) - message(FATAL_ERROR "Invalid CMAKE_OSX_ARCHITECTURES: ${CMAKE_OSX_ARCHITECTURES}") - endif() - else() - file(WRITE "${CMAKE_BINARY_DIR}/arch.c" "${archdetect_c_code}") + LIST(LENGTH ARCH osx_arch_num) + if(osx_arch_num LESS 1) + message(FATAL_ERROR "Invalid CMAKE_OSX_ARCHITECTURES: ${CMAKE_OSX_ARCHITECTURES}") + endif() + else() + file(WRITE "${CMAKE_BINARY_DIR}/arch.c" "${archdetect_c_code}") - enable_language(C) + enable_language(C) - # Detect the architecture in a rather creative way... - # This compiles a small C program which is a series of ifdefs that selects a - # particular #error preprocessor directive whose message string contains the - # target architecture. The program will always fail to compile (both because - # file is not a valid C program, and obviously because of the presence of the - # #error preprocessor directives... but by exploiting the preprocessor in this - # way, we can detect the correct target architecture even when cross-compiling, - # since the program itself never needs to be run (only the compiler/preprocessor) - try_run( - run_result_unused - compile_result_unused - "${CMAKE_BINARY_DIR}" - "${CMAKE_BINARY_DIR}/arch.c" - COMPILE_OUTPUT_VARIABLE ARCH - CMAKE_FLAGS CMAKE_OSX_ARCHITECTURES=${CMAKE_OSX_ARCHITECTURES} - ) + # Detect the architecture in a rather creative way... + # This compiles a small C program which is a series of ifdefs that selects a + # particular #error preprocessor directive whose message string contains the + # target architecture. The program will always fail to compile (both because + # file is not a valid C program, and obviously because of the presence of the + # #error preprocessor directives... but by exploiting the preprocessor in this + # way, we can detect the correct target architecture even when cross-compiling, + # since the program itself never needs to be run (only the compiler/preprocessor) + try_run( + run_result_unused + compile_result_unused + "${CMAKE_BINARY_DIR}" + "${CMAKE_BINARY_DIR}/arch.c" + COMPILE_OUTPUT_VARIABLE ARCH + CMAKE_FLAGS CMAKE_OSX_ARCHITECTURES=${CMAKE_OSX_ARCHITECTURES} + ) - # Parse the architecture name from the compiler output - string(REGEX MATCH "cmake_ARCH ([a-zA-Z0-9_]+)" ARCH "${ARCH}") + # Parse the architecture name from the compiler output + string(REGEX MATCH "cmake_ARCH ([a-zA-Z0-9_]+)" ARCH "${ARCH}") - # Get rid of the value marker leaving just the architecture name - string(REPLACE "cmake_ARCH " "" ARCH "${ARCH}") + # Get rid of the value marker leaving just the architecture name + string(REPLACE "cmake_ARCH " "" ARCH "${ARCH}") - # If we are compiling with an unknown architecture this variable should - # already be set to "unknown" but in the case that it's empty (i.e. due - # to a typo in the code), then set it to unknown - if (NOT ARCH) - set(ARCH unknown) - endif() - endif() + # If we are compiling with an unknown architecture this variable should + # already be set to "unknown" but in the case that it's empty (i.e. due + # to a typo in the code), then set it to unknown + if (NOT ARCH) + set(ARCH unknown) + endif() + endif() - set(${output_var} "${ARCH}" PARENT_SCOPE) + set(${output_var} "${ARCH}" PARENT_SCOPE) endfunction() diff --git a/cmake/Translation.cmake b/cmake/Translation.cmake index d391bb2995..9a9e66ee26 100644 --- a/cmake/Translation.cmake +++ b/cmake/Translation.cmake @@ -33,70 +33,70 @@ # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. MACRO(GETTEXT_CREATE_TRANSLATIONS_PCSX2 _potFile _firstPoFileArg) - # make it a real variable, so we can modify it here - SET(_firstPoFile "${_firstPoFileArg}") + # make it a real variable, so we can modify it here + SET(_firstPoFile "${_firstPoFileArg}") - SET(_gmoFiles) - GET_FILENAME_COMPONENT(_potBasename ${_potFile} NAME_WE) - GET_FILENAME_COMPONENT(_absPotFile ${_potFile} ABSOLUTE) + SET(_gmoFiles) + GET_FILENAME_COMPONENT(_potBasename ${_potFile} NAME_WE) + GET_FILENAME_COMPONENT(_absPotFile ${_potFile} ABSOLUTE) - SET(_addToAll) - IF(${_firstPoFile} STREQUAL "ALL") - SET(_addToAll "ALL") - SET(_firstPoFile) - ENDIF(${_firstPoFile} STREQUAL "ALL") + SET(_addToAll) + IF(${_firstPoFile} STREQUAL "ALL") + SET(_addToAll "ALL") + SET(_firstPoFile) + ENDIF(${_firstPoFile} STREQUAL "ALL") - FOREACH (_currentPoFile ${_firstPoFile} ${ARGN}) - GET_FILENAME_COMPONENT(_absFile ${_currentPoFile} ABSOLUTE) - GET_FILENAME_COMPONENT(_abs_PATH ${_absFile} PATH) - GET_FILENAME_COMPONENT(_gmoBase ${_absFile} NAME_WE) - GET_FILENAME_COMPONENT(_lang ${_abs_PATH} NAME_WE) - SET(_gmoFile ${CMAKE_BINARY_DIR}/${_lang}__${_gmoBase}.gmo) - IF (APPLE) - # CMake doesn't support generator expressions as the OUTPUT of a custom command - # Instead, use ${_gmoFile} to detect changes, and output to the bundle as a side effect - # In addition, we have have to preprocess the po files to remove mnemonics: - # On Windows, menu items have "mnemonics", the items with a letter underlined that you can use with alt to select menu items. MacOS doesn't do this. - # Some languages don't use easily-typable characters, so it's common to add a dedicated character for the mnemonic (e.g. in Japanese on Windows, the File menu would be "ファイル(&F)"). - # On MacOS, these extra letters in parentheses are useless and should be avoided. - SET(_mnemonicless "${CMAKE_BINARY_DIR}/${_lang}__${_gmoBase}.nomnemonic.po") - SET(_extraCommands - COMMAND sed -e "\"s/[(]&[A-Za-z][)]//g\"" "${_absFile}" > "${_mnemonicless}" - COMMAND ${CMAKE_COMMAND} -E make_directory "$/../Resources/${_lang}/" - COMMAND ${GETTEXT_MSGFMT_EXECUTABLE} -o "$/../Resources/${_lang}/${_potBasename}.mo" ${_mnemonicless}) - ELSE (APPLE) - SET(_extraCommands) - ENDIF (APPLE) + FOREACH (_currentPoFile ${_firstPoFile} ${ARGN}) + GET_FILENAME_COMPONENT(_absFile ${_currentPoFile} ABSOLUTE) + GET_FILENAME_COMPONENT(_abs_PATH ${_absFile} PATH) + GET_FILENAME_COMPONENT(_gmoBase ${_absFile} NAME_WE) + GET_FILENAME_COMPONENT(_lang ${_abs_PATH} NAME_WE) + SET(_gmoFile ${CMAKE_BINARY_DIR}/${_lang}__${_gmoBase}.gmo) + IF (APPLE) + # CMake doesn't support generator expressions as the OUTPUT of a custom command + # Instead, use ${_gmoFile} to detect changes, and output to the bundle as a side effect + # In addition, we have have to preprocess the po files to remove mnemonics: + # On Windows, menu items have "mnemonics", the items with a letter underlined that you can use with alt to select menu items. MacOS doesn't do this. + # Some languages don't use easily-typable characters, so it's common to add a dedicated character for the mnemonic (e.g. in Japanese on Windows, the File menu would be "ファイル(&F)"). + # On MacOS, these extra letters in parentheses are useless and should be avoided. + SET(_mnemonicless "${CMAKE_BINARY_DIR}/${_lang}__${_gmoBase}.nomnemonic.po") + SET(_extraCommands + COMMAND sed -e "\"s/[(]&[A-Za-z][)]//g\"" "${_absFile}" > "${_mnemonicless}" + COMMAND ${CMAKE_COMMAND} -E make_directory "$/../Resources/${_lang}/" + COMMAND ${GETTEXT_MSGFMT_EXECUTABLE} -o "$/../Resources/${_lang}/${_potBasename}.mo" ${_mnemonicless}) + ELSE (APPLE) + SET(_extraCommands) + ENDIF (APPLE) - IF (_currentPoFile MATCHES "\\.git") - continue() - ENDIF (_currentPoFile MATCHES "\\.git") + IF (_currentPoFile MATCHES "\\.git") + continue() + ENDIF (_currentPoFile MATCHES "\\.git") - IF (CMAKE_BUILD_PO) - ADD_CUSTOM_COMMAND( OUTPUT ${_gmoFile} - COMMAND ${GETTEXT_MSGMERGE_EXECUTABLE} --quiet --update --backup=none -s ${_absFile} ${_absPotFile} - COMMAND ${GETTEXT_MSGFMT_EXECUTABLE} -o ${_gmoFile} ${_absFile} - ${_extraCommands} - DEPENDS ${_absPotFile} ${_absFile} ) - ELSE (CMAKE_BUILD_PO) - ADD_CUSTOM_COMMAND( OUTPUT ${_gmoFile} - COMMAND ${GETTEXT_MSGFMT_EXECUTABLE} -o ${_gmoFile} ${_absFile} - ${_extraCommands} - DEPENDS ${_absPotFile} ${_absFile} ) - ENDIF (CMAKE_BUILD_PO) + IF (CMAKE_BUILD_PO) + ADD_CUSTOM_COMMAND( OUTPUT ${_gmoFile} + COMMAND ${GETTEXT_MSGMERGE_EXECUTABLE} --quiet --update --backup=none -s ${_absFile} ${_absPotFile} + COMMAND ${GETTEXT_MSGFMT_EXECUTABLE} -o ${_gmoFile} ${_absFile} + ${_extraCommands} + DEPENDS ${_absPotFile} ${_absFile} ) + ELSE (CMAKE_BUILD_PO) + ADD_CUSTOM_COMMAND( OUTPUT ${_gmoFile} + COMMAND ${GETTEXT_MSGFMT_EXECUTABLE} -o ${_gmoFile} ${_absFile} + ${_extraCommands} + DEPENDS ${_absPotFile} ${_absFile} ) + ENDIF (CMAKE_BUILD_PO) - IF (PACKAGE_MODE) - INSTALL(FILES ${_gmoFile} DESTINATION ${CMAKE_INSTALL_LOCALEDIR}/${_lang}/LC_MESSAGES RENAME ${_potBasename}.mo) - ELSE (PACKAGE_MODE) - INSTALL(FILES ${_gmoFile} DESTINATION ${CMAKE_SOURCE_DIR}/bin/Langs/${_lang} RENAME ${_potBasename}.mo) - ENDIF (PACKAGE_MODE) + IF (PACKAGE_MODE) + INSTALL(FILES ${_gmoFile} DESTINATION ${CMAKE_INSTALL_LOCALEDIR}/${_lang}/LC_MESSAGES RENAME ${_potBasename}.mo) + ELSE (PACKAGE_MODE) + INSTALL(FILES ${_gmoFile} DESTINATION ${CMAKE_SOURCE_DIR}/bin/Langs/${_lang} RENAME ${_potBasename}.mo) + ENDIF (PACKAGE_MODE) - SET(_gmoFiles ${_gmoFiles} ${_gmoFile}) + SET(_gmoFiles ${_gmoFiles} ${_gmoFile}) - ENDFOREACH (_currentPoFile ) + ENDFOREACH (_currentPoFile ) - IF(NOT LINUX_PACKAGE) - ADD_CUSTOM_TARGET(translations_${_potBasename} ${_addToAll} DEPENDS ${_gmoFiles}) - ENDIF(NOT LINUX_PACKAGE) + IF(NOT LINUX_PACKAGE) + ADD_CUSTOM_TARGET(translations_${_potBasename} ${_addToAll} DEPENDS ${_gmoFiles}) + ENDIF(NOT LINUX_PACKAGE) ENDMACRO(GETTEXT_CREATE_TRANSLATIONS_PCSX2 ) diff --git a/cmake/darwin-compiler-i386-generic.cmake b/cmake/darwin-compiler-i386-generic.cmake index e61a1a54cd..6b33fdf8d2 100644 --- a/cmake/darwin-compiler-i386-generic.cmake +++ b/cmake/darwin-compiler-i386-generic.cmake @@ -4,8 +4,8 @@ set(CMAKE_SYSTEM_PROCESSOR i686) # Leave it generic since it could be clang, gnu, etc. if("$ENV{CC}" STREQUAL "" OR "$ENV{CXX}" STREQUAL "") - set(CMAKE_C_COMPILER cc -m32) - set(CMAKE_CXX_COMPILER c++ -m32) + set(CMAKE_C_COMPILER cc -m32) + set(CMAKE_CXX_COMPILER c++ -m32) endif() # If given a CMAKE_FIND_ROOT_PATH then diff --git a/cmake/linux-compiler-i386-multilib.cmake b/cmake/linux-compiler-i386-multilib.cmake index c97de0f8b4..181e5c3f10 100644 --- a/cmake/linux-compiler-i386-multilib.cmake +++ b/cmake/linux-compiler-i386-multilib.cmake @@ -5,44 +5,44 @@ set(CMAKE_SYSTEM_PROCESSOR i686) # It could be i?86-*linux-gnu, x86_64-*linux-gnu, x86_64-*linux-gnux32, etc. # Leave it generic to only support amd64 or x32 to i386 with any compiler. if ("$ENV{CC}" STREQUAL "") - set(CMAKE_C_COMPILER cc -m32) + set(CMAKE_C_COMPILER cc -m32) elseif(NOT "$ENV{CC}" MATCHES "-m32") - set(CMAKE_C_COMPILER $ENV{CC} -m32) + set(CMAKE_C_COMPILER $ENV{CC} -m32) endif() if ("$ENV{CXX}" STREQUAL "") - set(CMAKE_CXX_COMPILER c++ -m32) + set(CMAKE_CXX_COMPILER c++ -m32) elseif(NOT "$ENV{CXX}" MATCHES "-m32") - set(CMAKE_CXX_COMPILER $ENV{CXX} -m32) + set(CMAKE_CXX_COMPILER $ENV{CXX} -m32) endif() # cmake 2.8.5 correctly sets CMAKE_LIBRARY_ARCHITECTURE for Debian multiarch. # Be really strict about what gets used. if(EXISTS /usr/lib/i386-linux-gnu) - set(CMAKE_SYSTEM_IGNORE_PATH - /lib /lib64 /lib32 - /usr/lib /usr/lib64 /usr/lib32 - /usr/local/lib /usr/local/lib64 /usr/local/lib32) - list(APPEND CMAKE_LIBRARY_PATH /usr/local/lib/i386-linux-gnu) - list(APPEND CMAKE_LIBRARY_PATH /usr/lib/i386-linux-gnu) - list(APPEND CMAKE_LIBRARY_PATH /lib/i386-linux-gnu) + set(CMAKE_SYSTEM_IGNORE_PATH + /lib /lib64 /lib32 + /usr/lib /usr/lib64 /usr/lib32 + /usr/local/lib /usr/local/lib64 /usr/local/lib32) + list(APPEND CMAKE_LIBRARY_PATH /usr/local/lib/i386-linux-gnu) + list(APPEND CMAKE_LIBRARY_PATH /usr/lib/i386-linux-gnu) + list(APPEND CMAKE_LIBRARY_PATH /lib/i386-linux-gnu) elseif(EXISTS /usr/lib32) - set(CMAKE_SYSTEM_IGNORE_PATH - /lib /lib64 - /usr/lib /usr/lib64 - /usr/local/lib /usr/local/lib64) - set(CMAKE_LIBRARY_ARCHITECTURE "../lib32") - list(APPEND CMAKE_LIBRARY_PATH /usr/local/lib32) - list(APPEND CMAKE_LIBRARY_PATH /usr/lib32) - list(APPEND CMAKE_LIBRARY_PATH /lib32) + set(CMAKE_SYSTEM_IGNORE_PATH + /lib /lib64 + /usr/lib /usr/lib64 + /usr/local/lib /usr/local/lib64) + set(CMAKE_LIBRARY_ARCHITECTURE "../lib32") + list(APPEND CMAKE_LIBRARY_PATH /usr/local/lib32) + list(APPEND CMAKE_LIBRARY_PATH /usr/lib32) + list(APPEND CMAKE_LIBRARY_PATH /lib32) else() - set(CMAKE_SYSTEM_IGNORE_PATH - /lib64 - /usr/lib64 - /usr/local/lib64) - set(CMAKE_LIBRARY_ARCHITECTURE ".") - list(APPEND CMAKE_LIBRARY_PATH /usr/local/lib) - list(APPEND CMAKE_LIBRARY_PATH /usr/lib) - list(APPEND CMAKE_LIBRARY_PATH /lib) + set(CMAKE_SYSTEM_IGNORE_PATH + /lib64 + /usr/lib64 + /usr/local/lib64) + set(CMAKE_LIBRARY_ARCHITECTURE ".") + list(APPEND CMAKE_LIBRARY_PATH /usr/local/lib) + list(APPEND CMAKE_LIBRARY_PATH /usr/lib) + list(APPEND CMAKE_LIBRARY_PATH /lib) endif() list(REMOVE_DUPLICATES CMAKE_LIBRARY_PATH) diff --git a/cmake/macros/BuildTargetScript.cmake b/cmake/macros/BuildTargetScript.cmake index 72434498f1..4338376943 100644 --- a/cmake/macros/BuildTargetScript.cmake +++ b/cmake/macros/BuildTargetScript.cmake @@ -25,22 +25,22 @@ include(${CMAKE_CURRENT_LIST_DIR}/GenerateGXML.cmake) # Set flags to actual invocation flags. if(GXML_COMPRESS_ALL) - set(GXML_COMPRESS_ALL COMPRESS_ALL) + set(GXML_COMPRESS_ALL COMPRESS_ALL) endif() if(GXML_NO_COMPRESS_ALL) - set(GXML_NO_COMPRESS_ALL NO_COMPRESS_ALL) + set(GXML_NO_COMPRESS_ALL NO_COMPRESS_ALL) endif() if(GXML_STRIPBLANKS_ALL) - set(GXML_STRIPBLANKS_ALL STRIPBLANKS_ALL) + set(GXML_STRIPBLANKS_ALL STRIPBLANKS_ALL) endif() if(GXML_NO_STRIPBLANKS_ALL) - set(GXML_NO_STRIPBLANKS_ALL NO_STRIPBLANKS_ALL) + set(GXML_NO_STRIPBLANKS_ALL NO_STRIPBLANKS_ALL) endif() if(GXML_TOPIXDATA_ALL) - set(GXML_TOPIXDATA_ALL TOPIXDATA_ALL) + set(GXML_TOPIXDATA_ALL TOPIXDATA_ALL) endif() if(GXML_NO_TOPIXDATA_ALL) - set(GXML_NO_TOPIXDATA_ALL NO_TOPIXDATA_ALL) + set(GXML_NO_TOPIXDATA_ALL NO_TOPIXDATA_ALL) endif() # Replace " " with ";" to import the list over the command line. Otherwise diff --git a/cmake/macros/CompileGResources.cmake b/cmake/macros/CompileGResources.cmake index 48963eb6eb..e111a53a6c 100644 --- a/cmake/macros/CompileGResources.cmake +++ b/cmake/macros/CompileGResources.cmake @@ -15,214 +15,216 @@ set(GCR_CMAKE_MACRO_DIR ${CMAKE_CURRENT_LIST_DIR}) # generates the XML file. glib-compile-resources will then throw a # warning/error. function(COMPILE_GRESOURCES output xml_out) - # Available options: - # COMPRESS_ALL, NO_COMPRESS_ALL Overrides the COMPRESS flag in all - # registered resources. - # STRIPBLANKS_ALL, NO_STRIPBLANKS_ALL Overrides the STRIPBLANKS flag in all - # registered resources. - # TOPIXDATA_ALL, NO_TOPIXDATA_ALL Overrides the TOPIXDATA flag in all - # registered resources. - set(CG_OPTIONS COMPRESS_ALL NO_COMPRESS_ALL - STRIPBLANKS_ALL NO_STRIPBLANKS_ALL - TOPIXDATA_ALL NO_TOPIXDATA_ALL) + # Available options: + # COMPRESS_ALL, NO_COMPRESS_ALL Overrides the COMPRESS flag in all + # registered resources. + # STRIPBLANKS_ALL, NO_STRIPBLANKS_ALL Overrides the STRIPBLANKS flag in all + # registered resources. + # TOPIXDATA_ALL, NO_TOPIXDATA_ALL Overrides the TOPIXDATA flag in all + # registered resources. + set(CG_OPTIONS COMPRESS_ALL NO_COMPRESS_ALL + STRIPBLANKS_ALL NO_STRIPBLANKS_ALL + TOPIXDATA_ALL NO_TOPIXDATA_ALL) - # Available one value options: - # TYPE Type of resource to create. Valid options are: - # EMBED_C: A C-file that can be compiled with your project. - # EMBED_H: A header that can be included into your project. - # BUNDLE: Generates a resource bundle file that can be loaded - # at runtime. - # AUTO: Determine from target file ending. Need to specify - # target argument. - # PREFIX Overrides the resource prefix that is prepended to each - # relative file name in registered resources. - # C_PREFIX Specifies the prefix used for the C identifiers in the code generated - # when EMBED_C or EMBED_H are specified for TYPE. - # SOURCE_DIR Overrides the resources base directory to search for resources. - # Normally this is set to the source directory with that CMake - # was invoked (CMAKE_CURRENT_SOURCE_DIR). - # TARGET Overrides the name of the output file/-s. Normally the output - # names from the glib-compile-resources tool are taken. - set(CG_ONEVALUEARGS TYPE PREFIX C_PREFIX SOURCE_DIR TARGET) + # Available one value options: + # TYPE Type of resource to create. Valid options are: + # EMBED_C: A C-file that can be compiled with your project. + # EMBED_H: A header that can be included into your project. + # BUNDLE: Generates a resource bundle file that can be loaded + # at runtime. + # AUTO: Determine from target file ending. Need to specify + # target argument. + # PREFIX Overrides the resource prefix that is prepended to each + # relative file name in registered resources. + # C_PREFIX Specifies the prefix used for the C identifiers in the code generated + # when EMBED_C or EMBED_H are specified for TYPE. + # SOURCE_DIR Overrides the resources base directory to search for resources. + # Normally this is set to the source directory with that CMake + # was invoked (CMAKE_CURRENT_SOURCE_DIR). + # TARGET Overrides the name of the output file/-s. Normally the output + # names from the glib-compile-resources tool are taken. + set(CG_ONEVALUEARGS TYPE PREFIX C_PREFIX SOURCE_DIR TARGET) - # Available multi-value options: - # RESOURCES The list of resource files. Whether absolute or relative path is - # equal, absolute paths are stripped down to relative ones. If the - # absolute path is not inside the given base directory SOURCE_DIR - # or CMAKE_CURRENT_SOURCE_DIR (if SOURCE_DIR is not overriden), - # this function aborts. - # OPTIONS Extra command line options passed to glib-compile-resources. - set(CG_MULTIVALUEARGS RESOURCES OPTIONS) + # Available multi-value options: + # RESOURCES The list of resource files. Whether absolute or relative path is + # equal, absolute paths are stripped down to relative ones. If the + # absolute path is not inside the given base directory SOURCE_DIR + # or CMAKE_CURRENT_SOURCE_DIR (if SOURCE_DIR is not overriden), + # this function aborts. + # OPTIONS Extra command line options passed to glib-compile-resources. + set(CG_MULTIVALUEARGS RESOURCES OPTIONS) - # Parse the arguments. - cmake_parse_arguments(CG_ARG - "${CG_OPTIONS}" - "${CG_ONEVALUEARGS}" - "${CG_MULTIVALUEARGS}" - "${ARGN}") + # Parse the arguments. + cmake_parse_arguments(CG_ARG + "${CG_OPTIONS}" + "${CG_ONEVALUEARGS}" + "${CG_MULTIVALUEARGS}" + "${ARGN}") - # Variable to store the double-quote (") string. Since escaping - # double-quotes in strings is not possible we need a helper variable that - # does this job for us. - set(Q \") + # Variable to store the double-quote (") string. Since escaping + # double-quotes in strings is not possible we need a helper variable that + # does this job for us. + set(Q \") - # Check invocation validity with the _UNPARSED_ARGUMENTS variable. - # If other not recognized parameters were passed, throw error. - if (CG_ARG_UNPARSED_ARGUMENTS) - set(CG_WARNMSG "Invocation of COMPILE_GRESOURCES with unrecognized") - set(CG_WARNMSG "${CG_WARNMSG} parameters. Parameters are:") - set(CG_WARNMSG "${CG_WARNMSG} ${CG_ARG_UNPARSED_ARGUMENTS}.") - message(WARNING ${CG_WARNMSG}) - endif() + # Check invocation validity with the _UNPARSED_ARGUMENTS variable. + # If other not recognized parameters were passed, throw error. + if (CG_ARG_UNPARSED_ARGUMENTS) + set(CG_WARNMSG "Invocation of COMPILE_GRESOURCES with unrecognized") + set(CG_WARNMSG "${CG_WARNMSG} parameters. Parameters are:") + set(CG_WARNMSG "${CG_WARNMSG} ${CG_ARG_UNPARSED_ARGUMENTS}.") + message(WARNING ${CG_WARNMSG}) + endif() - # Check invocation validity depending on generation mode (EMBED_C, EMBED_H - # or BUNDLE). - if ("${CG_ARG_TYPE}" STREQUAL "EMBED_C") - # EMBED_C mode, output compilable C-file. - list(APPEND CG_GENERATE_COMMAND_LINE --generate-source) - if (NOT "${CG_ARG_C_PREFIX}" STREQUAL "") - list(APPEND CG_GENERATE_COMMAND_LINE --c-name "${CG_ARG_C_PREFIX}") - endif() - set(CG_TARGET_FILE_ENDING "cpp") - elseif ("${CG_ARG_TYPE}" STREQUAL "EMBED_H") - # EMBED_H mode, output includable header file. - list(APPEND CG_GENERATE_COMMAND_LINE --generate-header) - if (NOT "${CG_ARG_C_PREFIX}" STREQUAL "") - list(APPEND CG_GENERATE_COMMAND_LINE --c-name "${CG_ARG_C_PREFIX}") - endif() - set(CG_TARGET_FILE_ENDING "h") - elseif ("${CG_ARG_TYPE}" STREQUAL "BUNDLE") - # BUNDLE mode, output resource bundle. Don't do anything since - # glib-compile-resources outputs a bundle when not specifying - # something else. - set(CG_TARGET_FILE_ENDING "gresource") - if (NOT "${CG_ARG_C_PREFIX}" STREQUAL "") - message(WARNING "Superfluously provided C_PREFIX=${CG_ARG_C_PREFIX} for BUNDLE.") - endif() - else() - # Everything else is AUTO mode, determine from target file ending. - if (CG_ARG_TARGET) - list(APPEND CG_GENERATE_COMMAND_LINE --generate) - else() - set(CG_ERRMSG "AUTO mode given, but no target specified. Can't") - set(CG_ERRMSG "${CG_ERRMSG} determine output type. In function") - set(CG_ERRMSG "${CG_ERRMSG} COMPILE_GRESOURCES.") - message(FATAL_ERROR ${CG_ERRMSG}) - endif() - endif() + # Check invocation validity depending on generation mode (EMBED_C, EMBED_H + # or BUNDLE). + if ("${CG_ARG_TYPE}" STREQUAL "EMBED_C") + # EMBED_C mode, output compilable C-file. + list(APPEND CG_GENERATE_COMMAND_LINE --generate-source) + if (NOT "${CG_ARG_C_PREFIX}" STREQUAL "") + list(APPEND CG_GENERATE_COMMAND_LINE --c-name "${CG_ARG_C_PREFIX}") + endif() + set(CG_TARGET_FILE_ENDING "cpp") + elseif ("${CG_ARG_TYPE}" STREQUAL "EMBED_H") + # EMBED_H mode, output includable header file. + list(APPEND CG_GENERATE_COMMAND_LINE --generate-header) + if (NOT "${CG_ARG_C_PREFIX}" STREQUAL "") + list(APPEND CG_GENERATE_COMMAND_LINE --c-name "${CG_ARG_C_PREFIX}") + endif() + set(CG_TARGET_FILE_ENDING "h") + elseif ("${CG_ARG_TYPE}" STREQUAL "BUNDLE") + # BUNDLE mode, output resource bundle. Don't do anything since + # glib-compile-resources outputs a bundle when not specifying + # something else. + set(CG_TARGET_FILE_ENDING "gresource") + if (NOT "${CG_ARG_C_PREFIX}" STREQUAL "") + message(WARNING "Superfluously provided C_PREFIX=${CG_ARG_C_PREFIX} for BUNDLE.") + endif() + else() + # Everything else is AUTO mode, determine from target file ending. + if (CG_ARG_TARGET) + list(APPEND CG_GENERATE_COMMAND_LINE --generate) + else() + set(CG_ERRMSG "AUTO mode given, but no target specified. Can't") + set(CG_ERRMSG "${CG_ERRMSG} determine output type. In function") + set(CG_ERRMSG "${CG_ERRMSG} COMPILE_GRESOURCES.") + message(FATAL_ERROR ${CG_ERRMSG}) + endif() + endif() - # Check flag validity. - if (CG_ARG_COMPRESS_ALL AND CG_ARG_NO_COMPRESS_ALL) - set(CG_ERRMSG "COMPRESS_ALL and NO_COMPRESS_ALL simultaneously set. In") - set(CG_ERRMSG "${CG_ERRMSG} function COMPILE_GRESOURCES.") - message(FATAL_ERROR ${CG_ERRMSG}) - endif() - if (CG_ARG_STRIPBLANKS_ALL AND CG_ARG_NO_STRIPBLANKS_ALL) - set(CG_ERRMSG "STRIPBLANKS_ALL and NO_STRIPBLANKS_ALL simultaneously") - set(CG_ERRMSG "${CG_ERRMSG} set. In function COMPILE_GRESOURCES.") - message(FATAL_ERROR ${CG_ERRMSG}) - endif() - if (CG_ARG_TOPIXDATA_ALL AND CG_ARG_NO_TOPIXDATA_ALL) - set(CG_ERRMSG "TOPIXDATA_ALL and NO_TOPIXDATA_ALL simultaneously set.") - set(CG_ERRMSG "${CG_ERRMSG} In function COMPILE_GRESOURCES.") - message(FATAL_ERROR ${CG_ERRMSG}) - endif() + # Check flag validity. + if (CG_ARG_COMPRESS_ALL AND CG_ARG_NO_COMPRESS_ALL) + set(CG_ERRMSG "COMPRESS_ALL and NO_COMPRESS_ALL simultaneously set. In") + set(CG_ERRMSG "${CG_ERRMSG} function COMPILE_GRESOURCES.") + message(FATAL_ERROR ${CG_ERRMSG}) + endif() + if (CG_ARG_STRIPBLANKS_ALL AND CG_ARG_NO_STRIPBLANKS_ALL) + set(CG_ERRMSG "STRIPBLANKS_ALL and NO_STRIPBLANKS_ALL simultaneously") + set(CG_ERRMSG "${CG_ERRMSG} set. In function COMPILE_GRESOURCES.") + message(FATAL_ERROR ${CG_ERRMSG}) + endif() + if (CG_ARG_TOPIXDATA_ALL AND CG_ARG_NO_TOPIXDATA_ALL) + set(CG_ERRMSG "TOPIXDATA_ALL and NO_TOPIXDATA_ALL simultaneously set.") + set(CG_ERRMSG "${CG_ERRMSG} In function COMPILE_GRESOURCES.") + message(FATAL_ERROR ${CG_ERRMSG}) + endif() - # Check if there are any resources. - if (NOT CG_ARG_RESOURCES) - set(CG_ERRMSG "No resource files to process. In function") - set(CG_ERRMSG "${CG_ERRMSG} COMPILE_GRESOURCES.") - message(FATAL_ERROR ${CG_ERRMSG}) - endif() + # Check if there are any resources. + if (NOT CG_ARG_RESOURCES) + set(CG_ERRMSG "No resource files to process. In function") + set(CG_ERRMSG "${CG_ERRMSG} COMPILE_GRESOURCES.") + message(FATAL_ERROR ${CG_ERRMSG}) + endif() - # Extract all dependencies for targets from resource list. - foreach(res ${CG_ARG_RESOURCES}) - if (NOT(("${res}" STREQUAL "COMPRESS") OR - ("${res}" STREQUAL "STRIPBLANKS") OR - ("${res}" STREQUAL "TOPIXDATA"))) + # Extract all dependencies for targets from resource list. + foreach(res ${CG_ARG_RESOURCES}) + if (NOT(("${res}" STREQUAL "COMPRESS") OR + ("${res}" STREQUAL "STRIPBLANKS") OR + ("${res}" STREQUAL "TOPIXDATA"))) - list(APPEND CG_RESOURCES_DEPENDENCIES "${res}") - endif() - endforeach() + list(APPEND CG_RESOURCES_DEPENDENCIES "${res}") + endif() + endforeach() - # Construct .gresource.xml path. - set(CG_XML_FILE_PATH "${CMAKE_CURRENT_BINARY_DIR}/.gresource.xml") + # Construct .gresource.xml path. + set(CG_XML_FILE_PATH "${CMAKE_CURRENT_BINARY_DIR}/.gresource.xml") - # Generate gresources XML target. - list(APPEND CG_CMAKE_SCRIPT_ARGS "-D") - list(APPEND CG_CMAKE_SCRIPT_ARGS "GXML_OUTPUT=${CG_XML_FILE_PATH}") - if(CG_ARG_COMPRESS_ALL) - list(APPEND CG_CMAKE_SCRIPT_ARGS "-D") - list(APPEND CG_CMAKE_SCRIPT_ARGS "GXML_COMPRESS_ALL=True") - endif() - if(CG_ARG_NO_COMPRESS_ALL) - list(APPEND CG_CMAKE_SCRIPT_ARGS "-D") - list(APPEND CG_CMAKE_SCRIPT_ARGS "GXML_NO_COMPRESS_ALL=True") - endif() - if(CG_ARG_STRPIBLANKS_ALL) - list(APPEND CG_CMAKE_SCRIPT_ARGS "-D") - list(APPEND CG_CMAKE_SCRIPT_ARGS "GXML_STRIPBLANKS_ALL=True") - endif() - if(CG_ARG_NO_STRIPBLANKS_ALL) - list(APPEND CG_CMAKE_SCRIPT_ARGS "-D") - list(APPEND CG_CMAKE_SCRIPT_ARGS "GXML_NO_STRIPBLANKS_ALL=True") - endif() - if(CG_ARG_TOPIXDATA_ALL) - list(APPEND CG_CMAKE_SCRIPT_ARGS "-D") - list(APPEND CG_CMAKE_SCRIPT_ARGS "GXML_TOPIXDATA_ALL=True") - endif() - if(CG_ARG_NO_TOPIXDATA_ALL) - list(APPEND CG_CMAKE_SCRIPT_ARGS "-D") - list(APPEND CG_CMAKE_SCRIPT_ARGS "GXML_NO_TOPIXDATA_ALL=True") - endif() - list(APPEND CG_CMAKE_SCRIPT_ARGS "-D") - list(APPEND CG_CMAKE_SCRIPT_ARGS "GXML_PREFIX=${Q}${CG_ARG_PREFIX}${Q}") - list(APPEND CG_CMAKE_SCRIPT_ARGS "-D") - list(APPEND CG_CMAKE_SCRIPT_ARGS - "GXML_RESOURCES=${Q}${CG_ARG_RESOURCES}${Q}") - list(APPEND CG_CMAKE_SCRIPT_ARGS "-P") - list(APPEND CG_CMAKE_SCRIPT_ARGS - "${GCR_CMAKE_MACRO_DIR}/BuildTargetScript.cmake") + # Generate gresources XML target. + list(APPEND CG_CMAKE_SCRIPT_ARGS "-D") + list(APPEND CG_CMAKE_SCRIPT_ARGS "GXML_OUTPUT=${CG_XML_FILE_PATH}") + if(CG_ARG_COMPRESS_ALL) + list(APPEND CG_CMAKE_SCRIPT_ARGS "-D") + list(APPEND CG_CMAKE_SCRIPT_ARGS "GXML_COMPRESS_ALL=True") + endif() + if(CG_ARG_NO_COMPRESS_ALL) + list(APPEND CG_CMAKE_SCRIPT_ARGS "-D") + list(APPEND CG_CMAKE_SCRIPT_ARGS "GXML_NO_COMPRESS_ALL=True") + endif() + if(CG_ARG_STRPIBLANKS_ALL) + list(APPEND CG_CMAKE_SCRIPT_ARGS "-D") + list(APPEND CG_CMAKE_SCRIPT_ARGS "GXML_STRIPBLANKS_ALL=True") + endif() + if(CG_ARG_NO_STRIPBLANKS_ALL) + list(APPEND CG_CMAKE_SCRIPT_ARGS "-D") + list(APPEND CG_CMAKE_SCRIPT_ARGS "GXML_NO_STRIPBLANKS_ALL=True") + endif() + if(CG_ARG_TOPIXDATA_ALL) + list(APPEND CG_CMAKE_SCRIPT_ARGS "-D") + list(APPEND CG_CMAKE_SCRIPT_ARGS "GXML_TOPIXDATA_ALL=True") + endif() + if(CG_ARG_NO_TOPIXDATA_ALL) + list(APPEND CG_CMAKE_SCRIPT_ARGS "-D") + list(APPEND CG_CMAKE_SCRIPT_ARGS "GXML_NO_TOPIXDATA_ALL=True") + endif() + list(APPEND CG_CMAKE_SCRIPT_ARGS "-D") + list(APPEND CG_CMAKE_SCRIPT_ARGS "GXML_PREFIX=${Q}${CG_ARG_PREFIX}${Q}") + list(APPEND CG_CMAKE_SCRIPT_ARGS "-D") + list(APPEND CG_CMAKE_SCRIPT_ARGS + "GXML_RESOURCES=${Q}${CG_ARG_RESOURCES}${Q}") + list(APPEND CG_CMAKE_SCRIPT_ARGS "-P") + list(APPEND CG_CMAKE_SCRIPT_ARGS + "${GCR_CMAKE_MACRO_DIR}/BuildTargetScript.cmake") - get_filename_component(CG_XML_FILE_PATH_ONLY_NAME - "${CG_XML_FILE_PATH}" NAME) - set(CG_XML_CUSTOM_COMMAND_COMMENT - "Creating gresources XML file (${CG_XML_FILE_PATH_ONLY_NAME})") - add_custom_command(OUTPUT ${CG_XML_FILE_PATH} - COMMAND ${CMAKE_COMMAND} - ARGS ${CG_CMAKE_SCRIPT_ARGS} - DEPENDS ${CG_RESOURCES_DEPENDENCIES} - WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} - COMMENT ${CG_XML_CUSTOM_COMMAND_COMMENT}) + get_filename_component(CG_XML_FILE_PATH_ONLY_NAME + "${CG_XML_FILE_PATH}" NAME) + set(CG_XML_CUSTOM_COMMAND_COMMENT + "Creating gresources XML file (${CG_XML_FILE_PATH_ONLY_NAME})") + add_custom_command( + OUTPUT ${CG_XML_FILE_PATH} + COMMAND ${CMAKE_COMMAND} + ARGS ${CG_CMAKE_SCRIPT_ARGS} + DEPENDS ${CG_RESOURCES_DEPENDENCIES} + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + COMMENT ${CG_XML_CUSTOM_COMMAND_COMMENT}) - # Create target manually if not set (to make sure glib-compile-resources - # doesn't change behaviour with it's naming standards). - if (NOT CG_ARG_TARGET) - set(CG_ARG_TARGET "${CMAKE_CURRENT_BINARY_DIR}/resources") - set(CG_ARG_TARGET "${CG_ARG_TARGET}.${CG_TARGET_FILE_ENDING}") - endif() + # Create target manually if not set (to make sure glib-compile-resources + # doesn't change behaviour with it's naming standards). + if (NOT CG_ARG_TARGET) + set(CG_ARG_TARGET "${CMAKE_CURRENT_BINARY_DIR}/resources") + set(CG_ARG_TARGET "${CG_ARG_TARGET}.${CG_TARGET_FILE_ENDING}") + endif() - # Create source directory automatically if not set. - if (NOT CG_ARG_SOURCE_DIR) - set(CG_ARG_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}") - endif() + # Create source directory automatically if not set. + if (NOT CG_ARG_SOURCE_DIR) + set(CG_ARG_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}") + endif() - # Add compilation target for resources. - add_custom_command(OUTPUT ${CG_ARG_TARGET} - COMMAND ${GLIB_COMPILE_RESOURCES_EXECUTABLE} - ARGS - ${OPTIONS} - --target ${CG_ARG_TARGET} - --sourcedir ${CG_ARG_SOURCE_DIR} - ${CG_GENERATE_COMMAND_LINE} - ${CG_XML_FILE_PATH} - VERBATIM - MAIN_DEPENDENCY ${CG_XML_FILE_PATH} - DEPENDS ${CG_RESOURCES_DEPENDENCIES} - WORKING_DIRECTORY ${CMAKE_CURRENT_BUILD_DIR}) + # Add compilation target for resources. + add_custom_command( + OUTPUT ${CG_ARG_TARGET} + COMMAND ${GLIB_COMPILE_RESOURCES_EXECUTABLE} + ARGS + ${OPTIONS} + --target ${CG_ARG_TARGET} + --sourcedir ${CG_ARG_SOURCE_DIR} + ${CG_GENERATE_COMMAND_LINE} + ${CG_XML_FILE_PATH} + VERBATIM + MAIN_DEPENDENCY ${CG_XML_FILE_PATH} + DEPENDS ${CG_RESOURCES_DEPENDENCIES} + WORKING_DIRECTORY ${CMAKE_CURRENT_BUILD_DIR}) - # Set output and XML_OUT to parent scope. - set(${xml_out} ${CG_XML_FILE_PATH} PARENT_SCOPE) - set(${output} ${CG_ARG_TARGET} PARENT_SCOPE) + # Set output and XML_OUT to parent scope. + set(${xml_out} ${CG_XML_FILE_PATH} PARENT_SCOPE) + set(${output} ${CG_ARG_TARGET} PARENT_SCOPE) endfunction() diff --git a/cmake/macros/GenerateGXML.cmake b/cmake/macros/GenerateGXML.cmake index b3f1a305c8..2601fb07f6 100644 --- a/cmake/macros/GenerateGXML.cmake +++ b/cmake/macros/GenerateGXML.cmake @@ -6,119 +6,119 @@ include(CMakeParseArguments) # COMPILE_GRESOURCES() to create a custom command, so that this function is # invoked at build-time in script mode from CMake. function(GENERATE_GXML xml_path) - # Available options: - # COMPRESS_ALL, NO_COMPRESS_ALL Overrides the COMPRESS flag in all - # registered resources. - # STRIPBLANKS_ALL, NO_STRIPBLANKS_ALL Overrides the STRIPBLANKS flag in all - # registered resources. - # TOPIXDATA_ALL, NO_TOPIXDATA_ALL Overrides the TOPIXDATA flag in all - # registered resources. - set(GXML_OPTIONS COMPRESS_ALL NO_COMPRESS_ALL - STRIPBLANKS_ALL NO_STRIPBLANKS_ALL - TOPIXDATA_ALL NO_TOPIXDATA_ALL) + # Available options: + # COMPRESS_ALL, NO_COMPRESS_ALL Overrides the COMPRESS flag in all + # registered resources. + # STRIPBLANKS_ALL, NO_STRIPBLANKS_ALL Overrides the STRIPBLANKS flag in all + # registered resources. + # TOPIXDATA_ALL, NO_TOPIXDATA_ALL Overrides the TOPIXDATA flag in all + # registered resources. + set(GXML_OPTIONS COMPRESS_ALL NO_COMPRESS_ALL + STRIPBLANKS_ALL NO_STRIPBLANKS_ALL + TOPIXDATA_ALL NO_TOPIXDATA_ALL) - # Available one value options: - # PREFIX Overrides the resource prefix that is prepended to each - # relative file name in registered resources. - set(GXML_ONEVALUEARGS PREFIX) + # Available one value options: + # PREFIX Overrides the resource prefix that is prepended to each + # relative file name in registered resources. + set(GXML_ONEVALUEARGS PREFIX) - # Available multi-value options: - # RESOURCES The list of resource files. Whether absolute or relative path is - # equal, absolute paths are stripped down to relative ones. If the - # absolute path is not inside the given base directory SOURCE_DIR - # or CMAKE_CURRENT_SOURCE_DIR (if SOURCE_DIR is not overriden), - # this function aborts. - set(GXML_MULTIVALUEARGS RESOURCES) + # Available multi-value options: + # RESOURCES The list of resource files. Whether absolute or relative path is + # equal, absolute paths are stripped down to relative ones. If the + # absolute path is not inside the given base directory SOURCE_DIR + # or CMAKE_CURRENT_SOURCE_DIR (if SOURCE_DIR is not overriden), + # this function aborts. + set(GXML_MULTIVALUEARGS RESOURCES) - # Parse the arguments. - cmake_parse_arguments(GXML_ARG - "${GXML_OPTIONS}" - "${GXML_ONEVALUEARGS}" - "${GXML_MULTIVALUEARGS}" - "${ARGN}") + # Parse the arguments. + cmake_parse_arguments(GXML_ARG + "${GXML_OPTIONS}" + "${GXML_ONEVALUEARGS}" + "${GXML_MULTIVALUEARGS}" + "${ARGN}") - # Variable to store the double-quote (") string. Since escaping - # double-quotes in strings is not possible we need a helper variable that - # does this job for us. - set(Q \") + # Variable to store the double-quote (") string. Since escaping + # double-quotes in strings is not possible we need a helper variable that + # does this job for us. + set(Q \") - # Process resources and generate XML file. - # Begin with the XML header and header nodes. - set(GXML_XML_FILE "") - set(GXML_XML_FILE "${GXML_XML_FILE}") + set(GXML_XML_FILE "${GXML_XML_FILE}") + set(GXML_XML_FILE "${GXML_XML_FILE}${Q}>") - # Process each resource. - foreach(res ${GXML_ARG_RESOURCES}) - if ("${res}" STREQUAL "COMPRESS") - set(GXML_COMPRESSION_FLAG ON) - elseif ("${res}" STREQUAL "STRIPBLANKS") - set(GXML_STRIPBLANKS_FLAG ON) - elseif ("${res}" STREQUAL "TOPIXDATA") - set(GXML_TOPIXDATA_FLAG ON) - else() - # The file name. - set(GXML_RESOURCE_PATH "${res}") + # Process each resource. + foreach(res ${GXML_ARG_RESOURCES}) + if ("${res}" STREQUAL "COMPRESS") + set(GXML_COMPRESSION_FLAG ON) + elseif ("${res}" STREQUAL "STRIPBLANKS") + set(GXML_STRIPBLANKS_FLAG ON) + elseif ("${res}" STREQUAL "TOPIXDATA") + set(GXML_TOPIXDATA_FLAG ON) + else() + # The file name. + set(GXML_RESOURCE_PATH "${res}") - # Append to real resource file dependency list. - list(APPEND GXML_RESOURCES_DEPENDENCIES ${GXML_RESOURCE_PATH}) + # Append to real resource file dependency list. + list(APPEND GXML_RESOURCES_DEPENDENCIES ${GXML_RESOURCE_PATH}) - # Assemble node. - set(GXML_RES_LINE " node. + set(GXML_RES_LINE "${GXML_RESOURCE_PATH}") + set(GXML_RES_LINE "${GXML_RES_LINE}>${GXML_RESOURCE_PATH}") - # Append to file string. - set(GXML_XML_FILE "${GXML_XML_FILE}${GXML_RES_LINE}") + # Append to file string. + set(GXML_XML_FILE "${GXML_XML_FILE}${GXML_RES_LINE}") - # Unset variables. - unset(GXML_COMPRESSION_FLAG) - unset(GXML_STRIPBLANKS_FLAG) - unset(GXML_TOPIXDATA_FLAG) - endif() + # Unset variables. + unset(GXML_COMPRESSION_FLAG) + unset(GXML_STRIPBLANKS_FLAG) + unset(GXML_TOPIXDATA_FLAG) + endif() - endforeach() + endforeach() - # Append closing nodes. - set(GXML_XML_FILE "${GXML_XML_FILE}") + # Append closing nodes. + set(GXML_XML_FILE "${GXML_XML_FILE}") - # Use "file" function to generate XML controlling file. - get_filename_component(xml_path_only_name "${xml_path}" NAME) - file(WRITE ${xml_path} ${GXML_XML_FILE}) + # Use "file" function to generate XML controlling file. + get_filename_component(xml_path_only_name "${xml_path}" NAME) + file(WRITE ${xml_path} ${GXML_XML_FILE}) endfunction() diff --git a/common/src/Utilities/CMakeLists.txt b/common/src/Utilities/CMakeLists.txt index 034afe6b2f..c32a257089 100644 --- a/common/src/Utilities/CMakeLists.txt +++ b/common/src/Utilities/CMakeLists.txt @@ -1,14 +1,14 @@ # 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") + 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) set(Output Utilities) set(CommonFlags - ) + ) set(UtilitiesFinalFlags ${CommonFlags}) @@ -109,7 +109,7 @@ set(UtilitiesFinalSources ) set(UtilitiesFinalLibs - ${LIBC_LIBRARIES} # Gold (new linux linker) does not get automatically dependency of dependency + ${LIBC_LIBRARIES} # Gold (new linux linker) does not get automatically dependency of dependency ${wxWidgets_LIBRARIES} yaml-cpp chdr-static ) diff --git a/common/src/x86emitter/CMakeLists.txt b/common/src/x86emitter/CMakeLists.txt index 6bbc355e5c..e1f4a90635 100644 --- a/common/src/x86emitter/CMakeLists.txt +++ b/common/src/x86emitter/CMakeLists.txt @@ -1,15 +1,15 @@ # 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") + 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) set(Output x86emitter) set(CommonFlags - ) + ) set(x86emitterFinalFlags ${CommonFlags}) diff --git a/locales/CMakeLists.txt b/locales/CMakeLists.txt index cea874f929..e2adfa1137 100644 --- a/locales/CMakeLists.txt +++ b/locales/CMakeLists.txt @@ -1,18 +1,18 @@ # 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") + 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) if (GETTEXT_FOUND) - include(Translation) + include(Translation) - file (GLOB_RECURSE PO_ICO_FILES ${CMAKE_SOURCE_DIR}}/locales pcsx2_Iconized.po) - file (GLOB_RECURSE PO_MAIN_FILES ${CMAKE_SOURCE_DIR}/locales pcsx2_Main.po) + file (GLOB_RECURSE PO_ICO_FILES ${CMAKE_SOURCE_DIR}}/locales pcsx2_Iconized.po) + file (GLOB_RECURSE PO_MAIN_FILES ${CMAKE_SOURCE_DIR}/locales pcsx2_Main.po) - # Macro to compile po file and install them - GETTEXT_CREATE_TRANSLATIONS_PCSX2(${CMAKE_SOURCE_DIR}/locales/templates/pcsx2_Iconized.pot ALL ${PO_ICO_FILES}) - GETTEXT_CREATE_TRANSLATIONS_PCSX2(${CMAKE_SOURCE_DIR}/locales/templates/pcsx2_Main.pot ALL ${PO_MAIN_FILES}) + # Macro to compile po file and install them + GETTEXT_CREATE_TRANSLATIONS_PCSX2(${CMAKE_SOURCE_DIR}/locales/templates/pcsx2_Iconized.pot ALL ${PO_ICO_FILES}) + GETTEXT_CREATE_TRANSLATIONS_PCSX2(${CMAKE_SOURCE_DIR}/locales/templates/pcsx2_Main.pot ALL ${PO_MAIN_FILES}) endif (GETTEXT_FOUND) diff --git a/pcsx2/CMakeLists.txt b/pcsx2/CMakeLists.txt index 3250b073d5..1bc8564c27 100644 --- a/pcsx2/CMakeLists.txt +++ b/pcsx2/CMakeLists.txt @@ -2,27 +2,27 @@ include(macros/GlibCompileResourcesSupport) if (openSUSE) - # openSUSE don't install wx in a standard library system - # path. Let's bypass the dynamic linker and hardcode the path. - set(CMAKE_INSTALL_RPATH_USE_LINK_PATH ON) + # openSUSE don't install wx in a standard library system + # path. Let's bypass the dynamic linker and hardcode the path. + set(CMAKE_INSTALL_RPATH_USE_LINK_PATH ON) endif() # 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") + 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() include_directories ("${CMAKE_SOURCE_DIR}/3rdparty/xbyak/") set(CommonFlags - -fno-strict-aliasing - -Wstrict-aliasing # Allow to track strict aliasing issue. - -Wno-parentheses - -Wno-missing-braces - -Wno-unknown-pragmas - -DWX_PRECOMP + -fno-strict-aliasing + -Wstrict-aliasing # Allow to track strict aliasing issue. + -Wno-parentheses + -Wno-missing-braces + -Wno-unknown-pragmas + -DWX_PRECOMP ) if(GCC_VERSION VERSION_EQUAL "8.0" OR GCC_VERSION VERSION_GREATER "8.0") @@ -31,29 +31,29 @@ if(GCC_VERSION VERSION_EQUAL "8.0" OR GCC_VERSION VERSION_GREATER "8.0") endif() if ("${PGO}" STREQUAL "generate") - set(pcsx2FinalFlags -fprofile-generate) + set(pcsx2FinalFlags -fprofile-generate) elseif("${PGO}" STREQUAL "use") - set(pcsx2FinalFlags -fprofile-use) + set(pcsx2FinalFlags -fprofile-use) else() - set(pcsx2FinalFlags "") + set(pcsx2FinalFlags "") endif() set(pcsx2FinalFlags ${pcsx2FinalFlags} ${CommonFlags}) if(PORTAUDIO_FOUND) - set(pcsx2FinalFlags ${pcsx2FinalFlags} -DSPU2X_PORTAUDIO) + set(pcsx2FinalFlags ${pcsx2FinalFlags} -DSPU2X_PORTAUDIO) endif() if(PULSEAUDIO_FOUND) - set(pcsx2FinalFlags ${pcsx2FinalFlags} -DSPU2X_PULSEAUDIO) + set(pcsx2FinalFlags ${pcsx2FinalFlags} -DSPU2X_PULSEAUDIO) endif() if(XDG_STD) - set(pcsx2FinalFlags ${pcsx2FinalFlags} -DXDG_STD) + set(pcsx2FinalFlags ${pcsx2FinalFlags} -DXDG_STD) endif() if(SDL_FOUND OR SDL2_FOUND) - set(pcsx2FinalFlags ${pcsx2FinalFlags} -DSDL_BUILD) + set(pcsx2FinalFlags ${pcsx2FinalFlags} -DSDL_BUILD) endif() @@ -208,7 +208,7 @@ set(pcsx2CDVDSources CDVD/IsoFS/IsoFile.cpp CDVD/IsoFS/IsoFSCDVD.cpp CDVD/IsoFS/IsoFS.cpp - ) + ) # CDVD headers set(pcsx2CDVDHeaders @@ -260,10 +260,10 @@ set(pcsx2SPU2Sources SPU2/Linux/ConfigSoundTouch.cpp SPU2/Linux/Dialogs.cpp SPU2/wx/wxConfig.cpp - ) + ) if(PORTAUDIO_FOUND) - set(pcsx2SPU2Sources ${pcsx2SPU2Sources} SPU2/SndOut_Portaudio.cpp) + set(pcsx2SPU2Sources ${pcsx2SPU2Sources} SPU2/SndOut_Portaudio.cpp) endif() # SPU2 headers @@ -288,22 +288,22 @@ set(pcsx2SPU2Headers # DEV9 UI sources compile_gresources( pcsx2DEV9UISources - pcsx2DEV9UIXML - TYPE EMBED_C - RESOURCES "DEV9/Linux/dev9.ui" - PREFIX "/net/pcsx2/dev9" - COMPRESS_ALL - STRIPBLANKS_ALL + pcsx2DEV9UIXML + TYPE EMBED_C + RESOURCES "DEV9/Linux/dev9.ui" + PREFIX "/net/pcsx2/dev9" + COMPRESS_ALL + STRIPBLANKS_ALL ) # DEV9 UI headers compile_gresources( pcsx2DEV9UIHeaders - pcsx2DEV9UIXML - TYPE EMBED_H - RESOURCES "DEV9/Linux/dev9.ui" - PREFIX "/net/pcsx2/dev9" - COMPRESS_ALL - STRIPBLANKS_ALL + pcsx2DEV9UIXML + TYPE EMBED_H + RESOURCES "DEV9/Linux/dev9.ui" + PREFIX "/net/pcsx2/dev9" + COMPRESS_ALL + STRIPBLANKS_ALL ) # DEV9 sources @@ -473,12 +473,12 @@ set(pcsx2USBHeaders USB/usb-hid/evdev/evdev.cpp USB/usb-eyetoy/cam-linux.h USB/qemu-usb/input-keymap-linux-to-qcode.h - ) + ) include_directories ("../3rdparty/jpgd/") if(PULSEAUDIO_FOUND) - set(pcsx2USBSources ${pcsx2USBSources} USB/usb-mic/audiodev-pulse.cpp) - set(pcsx2USBHeaders ${pcsx2USBHeaders} USB/usb-mic/audiodev-pulse.h) + set(pcsx2USBSources ${pcsx2USBSources} USB/usb-mic/audiodev-pulse.cpp) + set(pcsx2USBHeaders ${pcsx2USBHeaders} USB/usb-mic/audiodev-pulse.h) endif() @@ -491,86 +491,86 @@ include_directories ("${CMAKE_BINARY_DIR}/pcsx2/PAD/Linux/") file(MAKE_DIRECTORY ${PADImgHeader}) foreach(result_file IN ITEMS - analog circle cross dp_bottom dp_left dp_right dp_up dualshock2 - joystick_cursor l1 r1 l2 r2 l3 r3 select square start triangle arrow_up - arrow_bottom arrow_left arrow_right) - add_custom_command( - OUTPUT "${PADImgHeader}/${result_file}.h" - COMMAND perl ${CMAKE_SOURCE_DIR}/linux_various/hex2h.pl "${PADImg}/${result_file}.png" "${PADImgHeader}/${result_file}" ) + analog circle cross dp_bottom dp_left dp_right dp_up dualshock2 + joystick_cursor l1 r1 l2 r2 l3 r3 select square start triangle arrow_up + arrow_bottom arrow_left arrow_right) + add_custom_command( + OUTPUT "${PADImgHeader}/${result_file}.h" + COMMAND perl ${CMAKE_SOURCE_DIR}/linux_various/hex2h.pl "${PADImg}/${result_file}.png" "${PADImgHeader}/${result_file}" ) endforeach() add_custom_command( - OUTPUT ${CMAKE_BINARY_DIR}/pcsx2/PAD/Linux/resources_pad.h - COMMAND glib-compile-resources --sourcedir "${CMAKE_SOURCE_DIR}/pcsx2/PAD/Linux/res" --generate-header - --c-name PAD_res "${CMAKE_SOURCE_DIR}/pcsx2/PAD/Linux/res/PAD-res.xml" --target=${CMAKE_BINARY_DIR}/pcsx2/PAD/Linux/resources_pad.h - DEPENDS ${CMAKE_SOURCE_DIR}/pcsx2/PAD/Linux/res/PAD-res.xml ${CMAKE_SOURCE_DIR}/pcsx2/PAD/Linux/res/game_controller_db.txt) + OUTPUT ${CMAKE_BINARY_DIR}/pcsx2/PAD/Linux/resources_pad.h + COMMAND glib-compile-resources --sourcedir "${CMAKE_SOURCE_DIR}/pcsx2/PAD/Linux/res" --generate-header + --c-name PAD_res "${CMAKE_SOURCE_DIR}/pcsx2/PAD/Linux/res/PAD-res.xml" --target=${CMAKE_BINARY_DIR}/pcsx2/PAD/Linux/resources_pad.h + DEPENDS ${CMAKE_SOURCE_DIR}/pcsx2/PAD/Linux/res/PAD-res.xml ${CMAKE_SOURCE_DIR}/pcsx2/PAD/Linux/res/game_controller_db.txt) add_custom_command( - OUTPUT ${CMAKE_BINARY_DIR}/pcsx2/PAD/Linux/resources_pad.cpp - COMMAND glib-compile-resources --sourcedir "${CMAKE_SOURCE_DIR}/pcsx2/PAD/Linux/res" --generate-source - --c-name PAD_res "${CMAKE_SOURCE_DIR}/pcsx2/PAD/Linux/res/PAD-res.xml" --target=${CMAKE_BINARY_DIR}/pcsx2/PAD/Linux/resources_pad.cpp - DEPENDS ${CMAKE_SOURCE_DIR}/pcsx2/PAD/Linux/res/PAD-res.xml ${CMAKE_SOURCE_DIR}/pcsx2/PAD/Linux/res/game_controller_db.txt) + OUTPUT ${CMAKE_BINARY_DIR}/pcsx2/PAD/Linux/resources_pad.cpp + COMMAND glib-compile-resources --sourcedir "${CMAKE_SOURCE_DIR}/pcsx2/PAD/Linux/res" --generate-source + --c-name PAD_res "${CMAKE_SOURCE_DIR}/pcsx2/PAD/Linux/res/PAD-res.xml" --target=${CMAKE_BINARY_DIR}/pcsx2/PAD/Linux/resources_pad.cpp + DEPENDS ${CMAKE_SOURCE_DIR}/pcsx2/PAD/Linux/res/PAD-res.xml ${CMAKE_SOURCE_DIR}/pcsx2/PAD/Linux/res/game_controller_db.txt) # PAD/Linux sources set(pcsx2PADSources - PAD/Linux/Device.cpp - PAD/Linux/InputManager.cpp - PAD/Linux/SDL/joystick.cpp - PAD/Linux/keyboard.cpp - PAD/Linux/KeyStatus.cpp - PAD/Linux/PAD.cpp - PAD/Linux/state_management.cpp - PAD/Linux/wx_dialog/dialog.cpp - PAD/Linux/wx_dialog/opPanel.cpp - PAD/Linux/wx_dialog/GamepadConfiguration.cpp - PAD/Linux/wx_dialog/JoystickConfiguration.cpp - PAD/Linux/Config.cpp - PAD/Linux/linux.cpp - ${CMAKE_BINARY_DIR}/pcsx2/PAD/Linux/resources_pad.cpp - ) + PAD/Linux/Device.cpp + PAD/Linux/InputManager.cpp + PAD/Linux/SDL/joystick.cpp + PAD/Linux/keyboard.cpp + PAD/Linux/KeyStatus.cpp + PAD/Linux/PAD.cpp + PAD/Linux/state_management.cpp + PAD/Linux/wx_dialog/dialog.cpp + PAD/Linux/wx_dialog/opPanel.cpp + PAD/Linux/wx_dialog/GamepadConfiguration.cpp + PAD/Linux/wx_dialog/JoystickConfiguration.cpp + PAD/Linux/Config.cpp + PAD/Linux/linux.cpp + ${CMAKE_BINARY_DIR}/pcsx2/PAD/Linux/resources_pad.cpp + ) # PAD/Linux headers set(pcsx2PADHeaders - PAD/Linux/bitwise.h - PAD/Linux/Config.h - PAD/Linux/Device.h - PAD/Linux/Global.h - PAD/Linux/InputManager.h - PAD/Linux/SDL/joystick.h - PAD/Linux/keyboard.h - PAD/Linux/KeyStatus.h - PAD/Linux/PAD.h - PAD/Linux/state_management.h - PAD/Linux/wx_dialog/opPanel.h - PAD/Linux/wx_dialog/GamepadConfiguration.h - PAD/Linux/wx_dialog/JoystickConfiguration.h - ${CMAKE_BINARY_DIR}/pcsx2/PAD/Linux/resources_pad.h - # images - ${PADImgHeader}/analog.h - ${PADImgHeader}/circle.h - ${PADImgHeader}/cross.h - ${PADImgHeader}/dp_bottom.h - ${PADImgHeader}/dp_left.h - ${PADImgHeader}/dp_right.h - ${PADImgHeader}/dp_up.h - ${PADImgHeader}/dualshock2.h - ${PADImgHeader}/joystick_cursor.h - ${PADImgHeader}/l1.h - ${PADImgHeader}/r1.h - ${PADImgHeader}/l2.h - ${PADImgHeader}/r2.h - ${PADImgHeader}/l3.h - ${PADImgHeader}/r3.h - ${PADImgHeader}/select.h - ${PADImgHeader}/square.h - ${PADImgHeader}/start.h - ${PADImgHeader}/triangle.h - ${PADImgHeader}/arrow_up.h - ${PADImgHeader}/arrow_bottom.h - ${PADImgHeader}/arrow_left.h - ${PADImgHeader}/arrow_right.h - ) + PAD/Linux/bitwise.h + PAD/Linux/Config.h + PAD/Linux/Device.h + PAD/Linux/Global.h + PAD/Linux/InputManager.h + PAD/Linux/SDL/joystick.h + PAD/Linux/keyboard.h + PAD/Linux/KeyStatus.h + PAD/Linux/PAD.h + PAD/Linux/state_management.h + PAD/Linux/wx_dialog/opPanel.h + PAD/Linux/wx_dialog/GamepadConfiguration.h + PAD/Linux/wx_dialog/JoystickConfiguration.h + ${CMAKE_BINARY_DIR}/pcsx2/PAD/Linux/resources_pad.h + # images + ${PADImgHeader}/analog.h + ${PADImgHeader}/circle.h + ${PADImgHeader}/cross.h + ${PADImgHeader}/dp_bottom.h + ${PADImgHeader}/dp_left.h + ${PADImgHeader}/dp_right.h + ${PADImgHeader}/dp_up.h + ${PADImgHeader}/dualshock2.h + ${PADImgHeader}/joystick_cursor.h + ${PADImgHeader}/l1.h + ${PADImgHeader}/r1.h + ${PADImgHeader}/l2.h + ${PADImgHeader}/r2.h + ${PADImgHeader}/l3.h + ${PADImgHeader}/r3.h + ${PADImgHeader}/select.h + ${PADImgHeader}/square.h + ${PADImgHeader}/start.h + ${PADImgHeader}/triangle.h + ${PADImgHeader}/arrow_up.h + ${PADImgHeader}/arrow_bottom.h + ${PADImgHeader}/arrow_left.h + ${PADImgHeader}/arrow_right.h + ) # GS sources set(pcsx2GSSources @@ -883,22 +883,22 @@ set(pcsx2GuiHeaders set(res_bin "${CMAKE_BINARY_DIR}/pcsx2/gui/Resources") set(res_src "${CMAKE_SOURCE_DIR}/pcsx2/gui/Resources") set(pcsx2GuiResources - ${res_bin}/AppIcon16.h - ${res_bin}/AppIcon32.h - ${res_bin}/AppIcon64.h - ${res_bin}/BackgroundLogo.h - ${res_bin}/ButtonIcon_Camera.h - ${res_bin}/ConfigIcon_Cpu.h - ${res_bin}/ConfigIcon_Gamefixes.h - ${res_bin}/ConfigIcon_MemoryCard.h - ${res_bin}/ConfigIcon_Paths.h - ${res_bin}/ConfigIcon_Speedhacks.h - ${res_bin}/ConfigIcon_Video.h - ${res_bin}/Logo.h - ${res_bin}/NoIcon.h - ${res_bin}/Breakpoint_Active.h - ${res_bin}/Breakpoint_Inactive.h - ) + ${res_bin}/AppIcon16.h + ${res_bin}/AppIcon32.h + ${res_bin}/AppIcon64.h + ${res_bin}/BackgroundLogo.h + ${res_bin}/ButtonIcon_Camera.h + ${res_bin}/ConfigIcon_Cpu.h + ${res_bin}/ConfigIcon_Gamefixes.h + ${res_bin}/ConfigIcon_MemoryCard.h + ${res_bin}/ConfigIcon_Paths.h + ${res_bin}/ConfigIcon_Speedhacks.h + ${res_bin}/ConfigIcon_Video.h + ${res_bin}/Logo.h + ${res_bin}/NoIcon.h + ${res_bin}/Breakpoint_Active.h + ${res_bin}/Breakpoint_Inactive.h + ) # IPU sources set(pcsx2IPUSources @@ -927,7 +927,7 @@ set(pcsx2LinuxSources Linux/LnxConsolePipe.cpp Linux/LnxKeyCodes.cpp Linux/LnxFlatFileReader.cpp - ) + ) set(pcsx2OSXSources CDVD/Linux/DriveUtility.cpp @@ -1060,12 +1060,12 @@ set(pcsx2UtilitiesHeaders # Zip tools utilies sources set(pcsx2ZipToolsSources - ZipTools/thread_gzip.cpp - ZipTools/thread_lzma.cpp) + ZipTools/thread_gzip.cpp + ZipTools/thread_lzma.cpp) # Zip tools utilies headers set(pcsx2ZipToolsHeaders - ZipTools/ThreadedZipTools.h) + ZipTools/ThreadedZipTools.h) # Windows sources @@ -1200,7 +1200,7 @@ if(Linux) ${pcsx2USBSources} ${pcsx2USBHeaders} ) - + set(Platform_Libs ${LIBUDEV_LIBRARIES} ${X11_LIBRARIES} @@ -1237,64 +1237,64 @@ set(pcsx2FinalSources ) set(pcsx2FinalLibs - Utilities - x86emitter - fmt::fmt - ${wxWidgets_LIBRARIES} - ${GTK2_LIBRARIES} - ${ZLIB_LIBRARIES} - ${AIO_LIBRARIES} - ${GCOV_LIBRARIES} - ${ALSA_LIBRARIES} - ${SOUNDTOUCH_LIBRARIES} - ${SDL2_LIBRARIES} - ${PCAP_LIBRARY} - ${LIBSAMPLERATE_LIBRARIES} - ${LIBXML2_LIBRARIES} - ${LIBC_LIBRARIES} - ${PNG_LIBRARIES} - ${FREETYPE_LIBRARIES} - ${LIBLZMA_LIBRARIES} - ${OPENGL_LIBRARIES} - ${EGL_LIBRARIES} - ${Platform_Libs} + Utilities + x86emitter + fmt::fmt + ${wxWidgets_LIBRARIES} + ${GTK2_LIBRARIES} + ${ZLIB_LIBRARIES} + ${AIO_LIBRARIES} + ${GCOV_LIBRARIES} + ${ALSA_LIBRARIES} + ${SOUNDTOUCH_LIBRARIES} + ${SDL2_LIBRARIES} + ${PCAP_LIBRARY} + ${LIBSAMPLERATE_LIBRARIES} + ${LIBXML2_LIBRARIES} + ${LIBC_LIBRARIES} + ${PNG_LIBRARIES} + ${FREETYPE_LIBRARIES} + ${LIBLZMA_LIBRARIES} + ${OPENGL_LIBRARIES} + ${EGL_LIBRARIES} + ${Platform_Libs} ) if(PORTAUDIO_FOUND) - set(pcsx2FinalLibs ${pcsx2FinalLibs} ${PORTAUDIO_LIBRARIES}) + set(pcsx2FinalLibs ${pcsx2FinalLibs} ${PORTAUDIO_LIBRARIES}) endif() if(PULSEAUDIO_FOUND) - set(pcsx2FinalLibs ${pcsx2FinalLibs} ${PULSEAUDIO_LIBRARIES}) + set(pcsx2FinalLibs ${pcsx2FinalLibs} ${PULSEAUDIO_LIBRARIES}) endif() # additonal include directories include_directories( - gui - x86 - ${CMAKE_BINARY_DIR}/pcsx2/gui + gui + x86 + ${CMAKE_BINARY_DIR}/pcsx2/gui ) ### Generate the resources files file(MAKE_DIRECTORY ${res_bin}) foreach(res_file IN ITEMS - AppIcon16 AppIcon32 AppIcon64 BackgroundLogo Logo NoIcon ButtonIcon_Camera - ConfigIcon_Cpu ConfigIcon_Gamefixes ConfigIcon_MemoryCard - ConfigIcon_Paths ConfigIcon_Speedhacks ConfigIcon_Video Breakpoint_Active Breakpoint_Inactive) - add_custom_command(OUTPUT "${res_bin}/${res_file}.h" COMMAND perl ${CMAKE_SOURCE_DIR}/linux_various/hex2h.pl "${res_src}/${res_file}.png" "${res_bin}/${res_file}" ) + AppIcon16 AppIcon32 AppIcon64 BackgroundLogo Logo NoIcon ButtonIcon_Camera + ConfigIcon_Cpu ConfigIcon_Gamefixes ConfigIcon_MemoryCard + ConfigIcon_Paths ConfigIcon_Speedhacks ConfigIcon_Video Breakpoint_Active Breakpoint_Inactive) + add_custom_command(OUTPUT "${res_bin}/${res_file}.h" COMMAND perl ${CMAKE_SOURCE_DIR}/linux_various/hex2h.pl "${res_src}/${res_file}.png" "${res_bin}/${res_file}" ) endforeach() ### Generate Recording resource files ### Drop them into the folder alongside the png files foreach(res_file IN ITEMS - circlePressed controllerFull controllerHalf controllerThreeQuarters crossPressed downPressed l1Pressed l2Pressed l3Pressed leftPressed - r1Pressed r2Pressed r3Pressed rightPressed selectPressed squarePressed startPressed trianglePressed upPressed) - add_custom_command(OUTPUT "${res_rec_vp_src}/${res_file}.h" COMMAND perl ${CMAKE_SOURCE_DIR}/linux_various/hex2h.pl "${res_rec_vp_src}/${res_file}.png" "${res_rec_vp_src}/${res_file}" ) + circlePressed controllerFull controllerHalf controllerThreeQuarters crossPressed downPressed l1Pressed l2Pressed l3Pressed leftPressed + r1Pressed r2Pressed r3Pressed rightPressed selectPressed squarePressed startPressed trianglePressed upPressed) + add_custom_command(OUTPUT "${res_rec_vp_src}/${res_file}.h" COMMAND perl ${CMAKE_SOURCE_DIR}/linux_various/hex2h.pl "${res_rec_vp_src}/${res_file}.png" "${res_rec_vp_src}/${res_file}" ) endforeach() if(USE_VTUNE) - set(pcsx2FinalLibs ${pcsx2FinalLibs} ${VTUNE_LIBRARIES}) + set(pcsx2FinalLibs ${pcsx2FinalLibs} ${VTUNE_LIBRARIES}) endif() add_pcsx2_executable(${Output} "${pcsx2FinalSources}" "${pcsx2FinalLibs}" "${pcsx2FinalFlags}") @@ -1338,9 +1338,9 @@ if (APPLE) endif() if(NOT DISABLE_SETCAP) - if(PACKAGE_MODE) - install(CODE "execute_process(COMMAND /bin/bash -c \"echo 'Enabling networking capability on Linux...';set -x; [ -f '${CMAKE_INSTALL_FULL_BINDIR}/${Output}' ] && sudo setcap 'CAP_NET_RAW+eip CAP_NET_ADMIN+eip' '${CMAKE_INSTALL_FULL_BINDIR}/${Output}'; set +x\")") - else() - install(CODE "execute_process(COMMAND /bin/bash -c \"echo 'Enabling networking capability on Linux...';set -x; [ -f '${CMAKE_SOURCE_DIR}/bin/${Output}' ] && sudo setcap 'CAP_NET_RAW+eip CAP_NET_ADMIN+eip' '${CMAKE_SOURCE_DIR}/bin/${Output}'; set +x\")") - endif() + if(PACKAGE_MODE) + install(CODE "execute_process(COMMAND /bin/bash -c \"echo 'Enabling networking capability on Linux...';set -x; [ -f '${CMAKE_INSTALL_FULL_BINDIR}/${Output}' ] && sudo setcap 'CAP_NET_RAW+eip CAP_NET_ADMIN+eip' '${CMAKE_INSTALL_FULL_BINDIR}/${Output}'; set +x\")") + else() + install(CODE "execute_process(COMMAND /bin/bash -c \"echo 'Enabling networking capability on Linux...';set -x; [ -f '${CMAKE_SOURCE_DIR}/bin/${Output}' ] && sudo setcap 'CAP_NET_RAW+eip CAP_NET_ADMIN+eip' '${CMAKE_SOURCE_DIR}/bin/${Output}'; set +x\")") + endif() endif() diff --git a/tests/ctest/CMakeLists.txt b/tests/ctest/CMakeLists.txt index 6d0e19b1ca..db2eda67f0 100644 --- a/tests/ctest/CMakeLists.txt +++ b/tests/ctest/CMakeLists.txt @@ -3,10 +3,10 @@ add_custom_target(unittests) add_custom_command(TARGET unittests POST_BUILD COMMAND ${CMAKE_CTEST_COMMAND}) macro(add_pcsx2_test target) - add_executable(${target} EXCLUDE_FROM_ALL ${ARGN}) - target_link_libraries(${target} PRIVATE x86emitter gtest_main Utilities) - add_dependencies(unittests ${target}) - add_test(NAME ${target} COMMAND ${target}) + add_executable(${target} EXCLUDE_FROM_ALL ${ARGN}) + target_link_libraries(${target} PRIVATE x86emitter gtest_main Utilities) + add_dependencies(unittests ${target}) + add_test(NAME ${target} COMMAND ${target}) endmacro() add_subdirectory(x86emitter)