diff options
| -rw-r--r-- | externals/CMakeLists.txt | 83 | ||||
| -rw-r--r-- | src/core/CMakeLists.txt | 7 | ||||
| -rw-r--r-- | src/input_common/CMakeLists.txt | 2 | ||||
| -rw-r--r-- | src/web_service/CMakeLists.txt | 7 |
4 files changed, 71 insertions, 28 deletions
diff --git a/externals/CMakeLists.txt b/externals/CMakeLists.txt index 61ad3487a..d4421f697 100644 --- a/externals/CMakeLists.txt +++ b/externals/CMakeLists.txt | |||
| @@ -3,13 +3,27 @@ | |||
| 3 | set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR}/CMakeModules) | 3 | set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR}/CMakeModules) |
| 4 | include(DownloadExternals) | 4 | include(DownloadExternals) |
| 5 | 5 | ||
| 6 | # pkgconfig -- it is used to find shared libraries without cmake modules on linux systems | ||
| 7 | find_package(PkgConfig) | ||
| 8 | if (NOT PkgConfig_FOUND) | ||
| 9 | function(pkg_check_modules) | ||
| 10 | # STUB | ||
| 11 | endfunction() | ||
| 12 | endif() | ||
| 13 | |||
| 6 | # Catch | 14 | # Catch |
| 7 | add_library(catch-single-include INTERFACE) | 15 | add_library(catch-single-include INTERFACE) |
| 8 | target_include_directories(catch-single-include INTERFACE catch/single_include) | 16 | target_include_directories(catch-single-include INTERFACE catch/single_include) |
| 9 | 17 | ||
| 10 | # libfmt | 18 | # libfmt |
| 11 | add_subdirectory(fmt) | 19 | pkg_check_modules(FMT IMPORTED_TARGET GLOBAL fmt>=6.1.0) |
| 12 | add_library(fmt::fmt ALIAS fmt) | 20 | if (FMT_FOUND) |
| 21 | add_library(fmt::fmt ALIAS PkgConfig::FMT) | ||
| 22 | else() | ||
| 23 | message(STATUS "fmt 6.1.0 or newer not found, falling back to externals") | ||
| 24 | add_subdirectory(fmt) | ||
| 25 | add_library(fmt::fmt ALIAS fmt) | ||
| 26 | endif() | ||
| 13 | 27 | ||
| 14 | # Dynarmic | 28 | # Dynarmic |
| 15 | if (ARCHITECTURE_x86_64) | 29 | if (ARCHITECTURE_x86_64) |
| @@ -30,9 +44,15 @@ add_subdirectory(glad) | |||
| 30 | add_subdirectory(inih) | 44 | add_subdirectory(inih) |
| 31 | 45 | ||
| 32 | # lz4 | 46 | # lz4 |
| 33 | set(LZ4_BUNDLED_MODE ON) | 47 | pkg_check_modules(LIBLZ4 IMPORTED_TARGET GLOBAL liblz4>=1.8.0) |
| 34 | add_subdirectory(lz4/contrib/cmake_unofficial EXCLUDE_FROM_ALL) | 48 | if (LIBLZ4_FOUND) |
| 35 | target_include_directories(lz4_static INTERFACE ./lz4/lib) | 49 | add_library(lz4_static ALIAS PkgConfig::LIBLZ4) |
| 50 | else() | ||
| 51 | message(STATUS "liblz4 1.8.0 or newer not found, falling back to externals") | ||
| 52 | set(LZ4_BUNDLED_MODE ON) | ||
| 53 | add_subdirectory(lz4/contrib/cmake_unofficial EXCLUDE_FROM_ALL) | ||
| 54 | target_include_directories(lz4_static INTERFACE ./lz4/lib) | ||
| 55 | endif() | ||
| 36 | 56 | ||
| 37 | # mbedtls | 57 | # mbedtls |
| 38 | add_subdirectory(mbedtls EXCLUDE_FROM_ALL) | 58 | add_subdirectory(mbedtls EXCLUDE_FROM_ALL) |
| @@ -47,15 +67,27 @@ add_library(unicorn-headers INTERFACE) | |||
| 47 | target_include_directories(unicorn-headers INTERFACE ./unicorn/include) | 67 | target_include_directories(unicorn-headers INTERFACE ./unicorn/include) |
| 48 | 68 | ||
| 49 | # Zstandard | 69 | # Zstandard |
| 50 | add_subdirectory(zstd/build/cmake EXCLUDE_FROM_ALL) | 70 | pkg_check_modules(LIBZSTD IMPORTED_TARGET GLOBAL libzstd>=1.3.8) |
| 51 | target_include_directories(libzstd_static INTERFACE ./zstd/lib) | 71 | if (LIBZSTD_FOUND) |
| 72 | add_library(libzstd_static ALIAS PkgConfig::LIBZSTD) | ||
| 73 | else() | ||
| 74 | message(STATUS "libzstd 1.3.8 or newer not found, falling back to externals") | ||
| 75 | add_subdirectory(zstd/build/cmake EXCLUDE_FROM_ALL) | ||
| 76 | target_include_directories(libzstd_static INTERFACE ./zstd/lib) | ||
| 77 | endif() | ||
| 52 | 78 | ||
| 53 | # SoundTouch | 79 | # SoundTouch |
| 54 | add_subdirectory(soundtouch) | 80 | add_subdirectory(soundtouch) |
| 55 | 81 | ||
| 56 | # Opus | 82 | # Opus |
| 57 | add_subdirectory(opus) | 83 | pkg_check_modules(OPUS IMPORTED_TARGET GLOBAL opus>=1.3.1) |
| 58 | target_include_directories(opus INTERFACE ./opus/include) | 84 | if (OPUS_FOUND) |
| 85 | add_library(opus ALIAS PkgConfig::OPUS) | ||
| 86 | else() | ||
| 87 | message(STATUS "opus 1.3.1 or newer not found, falling back to externals") | ||
| 88 | add_subdirectory(opus) | ||
| 89 | target_include_directories(opus INTERFACE ./opus/include) | ||
| 90 | endif() | ||
| 59 | 91 | ||
| 60 | # Cubeb | 92 | # Cubeb |
| 61 | if(ENABLE_CUBEB) | 93 | if(ENABLE_CUBEB) |
| @@ -75,18 +107,35 @@ if (ENABLE_VULKAN) | |||
| 75 | endif() | 107 | endif() |
| 76 | 108 | ||
| 77 | # zlib | 109 | # zlib |
| 78 | add_subdirectory(zlib EXCLUDE_FROM_ALL) | 110 | find_package(ZLIB 1.2.11) |
| 79 | set(ZLIB_LIBRARIES z) | 111 | if (NOT ZLIB_FOUND) |
| 112 | message(STATUS "zlib 1.2.11 or newer not found, falling back to externals") | ||
| 113 | add_subdirectory(zlib EXCLUDE_FROM_ALL) | ||
| 114 | set(ZLIB_LIBRARIES z) | ||
| 115 | endif() | ||
| 80 | 116 | ||
| 81 | # libzip | 117 | # libzip |
| 82 | add_subdirectory(libzip EXCLUDE_FROM_ALL) | 118 | pkg_check_modules(LIBZIP IMPORTED_TARGET GLOBAL libzip>=1.5.3) |
| 119 | if (LIBZIP_FOUND) | ||
| 120 | add_library(zip ALIAS PkgConfig::LIBZIP) | ||
| 121 | else() | ||
| 122 | message(STATUS "libzip 1.5.3 or newer not found, falling back to externals") | ||
| 123 | add_subdirectory(libzip EXCLUDE_FROM_ALL) | ||
| 124 | endif() | ||
| 83 | 125 | ||
| 84 | if (ENABLE_WEB_SERVICE) | 126 | if (ENABLE_WEB_SERVICE) |
| 85 | # LibreSSL | 127 | # LibreSSL |
| 86 | set(LIBRESSL_SKIP_INSTALL ON CACHE BOOL "") | 128 | find_package(OpenSSL COMPONENTS Crypto SSL) |
| 87 | add_subdirectory(libressl EXCLUDE_FROM_ALL) | 129 | if (NOT OpenSSL_FOUND) |
| 88 | target_include_directories(ssl INTERFACE ./libressl/include) | 130 | message(STATUS "OpenSSL not found, falling back to externals") |
| 89 | target_compile_definitions(ssl PRIVATE -DHAVE_INET_NTOP) | 131 | set(LIBRESSL_SKIP_INSTALL ON CACHE BOOL "") |
| 132 | add_subdirectory(libressl EXCLUDE_FROM_ALL) | ||
| 133 | target_include_directories(ssl INTERFACE ./libressl/include) | ||
| 134 | target_compile_definitions(ssl PRIVATE -DHAVE_INET_NTOP) | ||
| 135 | get_directory_property(OPENSSL_LIBRARIES | ||
| 136 | DIRECTORY libressl | ||
| 137 | DEFINITION OPENSSL_LIBS) | ||
| 138 | endif() | ||
| 90 | 139 | ||
| 91 | # lurlparser | 140 | # lurlparser |
| 92 | add_subdirectory(lurlparser EXCLUDE_FROM_ALL) | 141 | add_subdirectory(lurlparser EXCLUDE_FROM_ALL) |
| @@ -94,6 +143,8 @@ if (ENABLE_WEB_SERVICE) | |||
| 94 | # httplib | 143 | # httplib |
| 95 | add_library(httplib INTERFACE) | 144 | add_library(httplib INTERFACE) |
| 96 | target_include_directories(httplib INTERFACE ./httplib) | 145 | target_include_directories(httplib INTERFACE ./httplib) |
| 146 | target_compile_definitions(httplib INTERFACE -DCPPHTTPLIB_OPENSSL_SUPPORT) | ||
| 147 | target_link_libraries(httplib INTERFACE ${OPENSSL_LIBRARIES}) | ||
| 97 | 148 | ||
| 98 | # JSON | 149 | # JSON |
| 99 | add_library(json-headers INTERFACE) | 150 | add_library(json-headers INTERFACE) |
diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt index 66497a386..c15d9f52f 100644 --- a/src/core/CMakeLists.txt +++ b/src/core/CMakeLists.txt | |||
| @@ -591,11 +591,8 @@ target_link_libraries(core PUBLIC common PRIVATE audio_core video_core) | |||
| 591 | target_link_libraries(core PUBLIC Boost::boost PRIVATE fmt json-headers mbedtls opus unicorn) | 591 | target_link_libraries(core PUBLIC Boost::boost PRIVATE fmt json-headers mbedtls opus unicorn) |
| 592 | 592 | ||
| 593 | if (YUZU_ENABLE_BOXCAT) | 593 | if (YUZU_ENABLE_BOXCAT) |
| 594 | get_directory_property(OPENSSL_LIBS | 594 | target_compile_definitions(core PRIVATE -DYUZU_ENABLE_BOXCAT) |
| 595 | DIRECTORY ${PROJECT_SOURCE_DIR}/externals/libressl | 595 | target_link_libraries(core PRIVATE httplib json-headers zip) |
| 596 | DEFINITION OPENSSL_LIBS) | ||
| 597 | target_compile_definitions(core PRIVATE -DCPPHTTPLIB_OPENSSL_SUPPORT -DYUZU_ENABLE_BOXCAT) | ||
| 598 | target_link_libraries(core PRIVATE httplib json-headers ${OPENSSL_LIBS} zip) | ||
| 599 | endif() | 596 | endif() |
| 600 | 597 | ||
| 601 | if (ENABLE_WEB_SERVICE) | 598 | if (ENABLE_WEB_SERVICE) |
diff --git a/src/input_common/CMakeLists.txt b/src/input_common/CMakeLists.txt index 2520ba321..a9c2392b1 100644 --- a/src/input_common/CMakeLists.txt +++ b/src/input_common/CMakeLists.txt | |||
| @@ -27,4 +27,4 @@ if(SDL2_FOUND) | |||
| 27 | endif() | 27 | endif() |
| 28 | 28 | ||
| 29 | create_target_directory_groups(input_common) | 29 | create_target_directory_groups(input_common) |
| 30 | target_link_libraries(input_common PUBLIC core PRIVATE common ${Boost_LIBRARIES}) | 30 | target_link_libraries(input_common PUBLIC core PRIVATE common Boost::boost) |
diff --git a/src/web_service/CMakeLists.txt b/src/web_service/CMakeLists.txt index 01f2d129d..0c9bb0d55 100644 --- a/src/web_service/CMakeLists.txt +++ b/src/web_service/CMakeLists.txt | |||
| @@ -8,9 +8,4 @@ add_library(web_service STATIC | |||
| 8 | ) | 8 | ) |
| 9 | 9 | ||
| 10 | create_target_directory_groups(web_service) | 10 | create_target_directory_groups(web_service) |
| 11 | 11 | target_link_libraries(web_service PRIVATE common json-headers httplib lurlparser) | |
| 12 | get_directory_property(OPENSSL_LIBS | ||
| 13 | DIRECTORY ${PROJECT_SOURCE_DIR}/externals/libressl | ||
| 14 | DEFINITION OPENSSL_LIBS) | ||
| 15 | target_compile_definitions(web_service PRIVATE -DCPPHTTPLIB_OPENSSL_SUPPORT) | ||
| 16 | target_link_libraries(web_service PRIVATE common json-headers ${OPENSSL_LIBS} httplib lurlparser) | ||