diff options
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r-- | CMakeLists.txt | 43 |
1 files changed, 12 insertions, 31 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 10a3de9e2..91ec50bef 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -56,6 +56,8 @@ option(YUZU_USE_BUNDLED_VCPKG "Use vcpkg for yuzu dependencies" "${MSVC}") option(YUZU_CHECK_SUBMODULES "Check if submodules are present" ON) +option(YUZU_ENABLE_LTO "Enable link-time optimization" OFF) + CMAKE_DEPENDENT_OPTION(YUZU_USE_FASTER_LD "Check if a faster linker is available" ON "NOT WIN32" OFF) if (YUZU_USE_BUNDLED_VCPKG) @@ -65,6 +67,9 @@ if (YUZU_USE_BUNDLED_VCPKG) if (YUZU_CRASH_DUMPS) list(APPEND VCPKG_MANIFEST_FEATURES "dbghelp") endif() + if (ENABLE_WEB_SERVICE) + list(APPEND VCPKG_MANIFEST_FEATURES "web-service") + endif() include(${CMAKE_SOURCE_DIR}/externals/vcpkg/scripts/buildsystems/vcpkg.cmake) elseif(NOT "$ENV{VCPKG_TOOLCHAIN_FILE}" STREQUAL "") @@ -205,10 +210,11 @@ 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(Boost 1.73.0 REQUIRED context) 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) @@ -241,26 +247,13 @@ 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) find_package(Catch2 3.0.1 REQUIRED) endif() -find_package(Boost 1.73.0 COMPONENTS context) -if (Boost_FOUND) - set(Boost_LIBRARIES Boost::boost) - # Conditionally add Boost::context only if the found Boost package provides it - # The old version is missing Boost::context, so we want to avoid adding in that case - # The new version requires adding Boost::context to prevent linking issues - if (TARGET Boost::context) - list(APPEND Boost_LIBRARIES Boost::context) - endif() -else() - message(FATAL_ERROR "Boost 1.73.0 or newer not found") -endif() - # boost:asio has functions that require AcceptEx et al if (MINGW) find_library(MSWSOCK_LIBRARY mswsock REQUIRED) @@ -457,14 +450,6 @@ if (ENABLE_SDL2) endif() endif() -# Reexport some targets that are named differently when using the upstream CmakeConfig -# In order to ALIAS targets to a new name, they first need to be IMPORTED_GLOBAL -# Dynarmic checks for target `boost` and so we want to make sure it can find it through our system instead of using their external -if (TARGET Boost::boost) - set_target_properties(Boost::boost PROPERTIES IMPORTED_GLOBAL TRUE) - add_library(boost ALIAS Boost::boost) -endif() - # List of all FFmpeg components required set(FFmpeg_COMPONENTS avcodec @@ -492,8 +477,8 @@ if (APPLE) find_library(COCOA_LIBRARY Cocoa) set(PLATFORM_LIBRARIES ${COCOA_LIBRARY} ${IOKIT_LIBRARY} ${COREVIDEO_LIBRARY}) elseif (WIN32) - # WSAPoll and SHGetKnownFolderPath (AppData/Roaming) didn't exist before WinNT 6.x (Vista) - add_definitions(-D_WIN32_WINNT=0x0600 -DWINVER=0x0600) + # Target Windows 10 + add_definitions(-D_WIN32_WINNT=0x0A00 -DWINVER=0x0A00) set(PLATFORM_LIBRARIES winmm ws2_32 iphlpapi) if (MINGW) # PSAPI is the Process Status API @@ -580,11 +565,7 @@ function(create_target_directory_groups target_name) endfunction() # Prevent boost from linking against libs when building -add_definitions(-DBOOST_ERROR_CODE_HEADER_ONLY - -DBOOST_SYSTEM_NO_LIB - -DBOOST_DATE_TIME_NO_LIB - -DBOOST_REGEX_NO_LIB -) +target_link_libraries(Boost::headers INTERFACE Boost::disable_autolinking) # Adjustments for MSVC + Ninja if (MSVC AND CMAKE_GENERATOR STREQUAL "Ninja") add_compile_options( |