diff options
author | Liam <byteslice@airmail.cc> | 2022-12-10 18:50:00 +0100 |
---|---|---|
committer | Liam <byteslice@airmail.cc> | 2022-12-10 21:04:25 +0100 |
commit | 1085bbb0a391f7a011be73a748b62d9790aa4f79 (patch) | |
tree | ec1011b6eea7202a29e79d518b94bae34af1a53f /CMakeLists.txt | |
parent | Merge pull request #9412 from Saalvage/fix/trace-log-compilation (diff) | |
download | yuzu-1085bbb0a391f7a011be73a748b62d9790aa4f79.tar yuzu-1085bbb0a391f7a011be73a748b62d9790aa4f79.tar.gz yuzu-1085bbb0a391f7a011be73a748b62d9790aa4f79.tar.bz2 yuzu-1085bbb0a391f7a011be73a748b62d9790aa4f79.tar.lz yuzu-1085bbb0a391f7a011be73a748b62d9790aa4f79.tar.xz yuzu-1085bbb0a391f7a011be73a748b62d9790aa4f79.tar.zst yuzu-1085bbb0a391f7a011be73a748b62d9790aa4f79.zip |
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r-- | CMakeLists.txt | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index cd59e7485..16f31b3a6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -51,6 +51,8 @@ option(YUZU_USE_BUNDLED_VCPKG "Use vcpkg for yuzu dependencies" "${MSVC}") option(YUZU_CHECK_SUBMODULES "Check if submodules are present" ON) +CMAKE_DEPENDENT_OPTION(YUZU_USE_FASTER_LD "Check if a faster linker is available" ON "NOT WIN32" OFF) + if (YUZU_USE_BUNDLED_VCPKG) if (YUZU_TESTS) list(APPEND VCPKG_MANIFEST_FEATURES "yuzu-tests") @@ -579,6 +581,21 @@ if (MSVC AND CMAKE_GENERATOR STREQUAL "Ninja") ) endif() +if (YUZU_USE_FASTER_LD AND CMAKE_CXX_COMPILER_ID STREQUAL "GNU") + # We will assume that if the compiler is GCC, it will attempt to use ld.bfd by default. + # Try to pick a faster linker. + find_program(LLD lld) + find_program(MOLD mold) + + if (MOLD AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL "12.1") + message(NOTICE "Selecting mold as linker") + add_link_options("-fuse-ld=mold") + elseif (LLD) + message(NOTICE "Selecting lld as linker") + add_link_options("-fuse-ld=lld") + endif() +endif() + enable_testing() add_subdirectory(externals) add_subdirectory(src) |