diff options
author | liamwhite <liamwhite@users.noreply.github.com> | 2023-02-28 22:36:28 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-02-28 22:36:28 +0100 |
commit | 304d6e9870f39afcc033c2843588bee18ef8c931 (patch) | |
tree | 344fce8b5837273e8791a0f28622d075a215d712 | |
parent | Merge pull request #9851 from abouvier/openssl-vcpkg (diff) | |
parent | cmake: support components in find modules (diff) | |
download | yuzu-304d6e9870f39afcc033c2843588bee18ef8c931.tar yuzu-304d6e9870f39afcc033c2843588bee18ef8c931.tar.gz yuzu-304d6e9870f39afcc033c2843588bee18ef8c931.tar.bz2 yuzu-304d6e9870f39afcc033c2843588bee18ef8c931.tar.lz yuzu-304d6e9870f39afcc033c2843588bee18ef8c931.tar.xz yuzu-304d6e9870f39afcc033c2843588bee18ef8c931.tar.zst yuzu-304d6e9870f39afcc033c2843588bee18ef8c931.zip |
-rw-r--r-- | CMakeLists.txt | 6 | ||||
-rw-r--r-- | CMakeModules/FindLLVM.cmake | 18 | ||||
-rw-r--r-- | CMakeModules/Findhttplib.cmake | 12 | ||||
-rw-r--r-- | CMakeModules/Findinih.cmake | 19 |
4 files changed, 43 insertions, 12 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 0f344ffd9..7a7faa1c4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -212,8 +212,8 @@ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/bin) # Enforce the search mode of non-required packages for better and shorter failure messages find_package(enet 1.3 MODULE) find_package(fmt 9 REQUIRED) -find_package(inih MODULE) -find_package(LLVM MODULE) +find_package(inih 52 MODULE COMPONENTS INIReader) +find_package(LLVM MODULE COMPONENTS Demangle) find_package(lz4 REQUIRED) find_package(nlohmann_json 3.8 REQUIRED) find_package(Opus 1.3 MODULE) @@ -246,7 +246,7 @@ endif() if (ENABLE_WEB_SERVICE) find_package(cpp-jwt 1.4 CONFIG) - find_package(httplib 0.12 MODULE) + find_package(httplib 0.12 MODULE COMPONENTS OpenSSL) endif() if (YUZU_TESTS) diff --git a/CMakeModules/FindLLVM.cmake b/CMakeModules/FindLLVM.cmake index 513d9a536..efbd0ca46 100644 --- a/CMakeModules/FindLLVM.cmake +++ b/CMakeModules/FindLLVM.cmake @@ -2,15 +2,25 @@ # # SPDX-License-Identifier: GPL-3.0-or-later -find_package(LLVM QUIET CONFIG) +find_package(LLVM QUIET COMPONENTS CONFIG) +if (LLVM_FOUND) + separate_arguments(LLVM_DEFINITIONS) + if (LLVMDemangle IN_LIST LLVM_AVAILABLE_LIBS) + set(LLVM_Demangle_FOUND TRUE) + endif() +endif() include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(LLVM CONFIG_MODE) +find_package_handle_standard_args(LLVM HANDLE_COMPONENTS CONFIG_MODE) -if (LLVM_FOUND AND NOT TARGET LLVM::Demangle) +if (LLVM_FOUND AND LLVM_Demangle_FOUND AND NOT TARGET LLVM::Demangle) add_library(LLVM::Demangle INTERFACE IMPORTED) - llvm_map_components_to_libnames(LLVM_LIBRARIES demangle) target_compile_definitions(LLVM::Demangle INTERFACE ${LLVM_DEFINITIONS}) target_include_directories(LLVM::Demangle INTERFACE ${LLVM_INCLUDE_DIRS}) + # prefer shared LLVM: https://github.com/llvm/llvm-project/issues/34593 + # but use ugly hack because llvm_config doesn't support interface library + add_library(_dummy_lib SHARED EXCLUDE_FROM_ALL src/yuzu/main.cpp) + llvm_config(_dummy_lib USE_SHARED demangle) + get_target_property(LLVM_LIBRARIES _dummy_lib LINK_LIBRARIES) target_link_libraries(LLVM::Demangle INTERFACE ${LLVM_LIBRARIES}) endif() diff --git a/CMakeModules/Findhttplib.cmake b/CMakeModules/Findhttplib.cmake index 861207eb5..48967add9 100644 --- a/CMakeModules/Findhttplib.cmake +++ b/CMakeModules/Findhttplib.cmake @@ -6,13 +6,23 @@ include(FindPackageHandleStandardArgs) find_package(httplib QUIET CONFIG) if (httplib_CONSIDERED_CONFIGS) - find_package_handle_standard_args(httplib CONFIG_MODE) + find_package_handle_standard_args(httplib HANDLE_COMPONENTS CONFIG_MODE) else() find_package(PkgConfig QUIET) pkg_search_module(HTTPLIB QUIET IMPORTED_TARGET cpp-httplib) + if ("-DCPPHTTPLIB_OPENSSL_SUPPORT" IN_LIST HTTPLIB_CFLAGS_OTHER) + set(httplib_OpenSSL_FOUND TRUE) + endif() + if ("-DCPPHTTPLIB_ZLIB_SUPPORT" IN_LIST HTTPLIB_CFLAGS_OTHER) + set(httplib_ZLIB_FOUND TRUE) + endif() + if ("-DCPPHTTPLIB_BROTLI_SUPPORT" IN_LIST HTTPLIB_CFLAGS_OTHER) + set(httplib_Brotli_FOUND TRUE) + endif() find_package_handle_standard_args(httplib REQUIRED_VARS HTTPLIB_INCLUDEDIR VERSION_VAR HTTPLIB_VERSION + HANDLE_COMPONENTS ) endif() diff --git a/CMakeModules/Findinih.cmake b/CMakeModules/Findinih.cmake index b8d38dcff..791befebd 100644 --- a/CMakeModules/Findinih.cmake +++ b/CMakeModules/Findinih.cmake @@ -3,14 +3,25 @@ # SPDX-License-Identifier: GPL-3.0-or-later find_package(PkgConfig QUIET) -pkg_search_module(INIREADER QUIET IMPORTED_TARGET INIReader) +pkg_search_module(INIH QUIET IMPORTED_TARGET inih) +if (INIReader IN_LIST inih_FIND_COMPONENTS) + pkg_search_module(INIREADER QUIET IMPORTED_TARGET INIReader) + if (INIREADER_FOUND) + set(inih_INIReader_FOUND TRUE) + endif() +endif() include(FindPackageHandleStandardArgs) find_package_handle_standard_args(inih - REQUIRED_VARS INIREADER_LINK_LIBRARIES - VERSION_VAR INIREADER_VERSION + REQUIRED_VARS INIH_LINK_LIBRARIES + VERSION_VAR INIH_VERSION + HANDLE_COMPONENTS ) -if (inih_FOUND AND NOT TARGET inih::INIReader) +if (inih_FOUND AND NOT TARGET inih::inih) + add_library(inih::inih ALIAS PkgConfig::INIH) +endif() + +if (inih_FOUND AND inih_INIReader_FOUND AND NOT TARGET inih::INIReader) add_library(inih::INIReader ALIAS PkgConfig::INIREADER) endif() |