2
1
Fork 0
mirror of https://github.com/yuzu-emu/yuzu.git synced 2024-07-04 23:31:19 +01:00

Merge pull request #9416 from liamwhite/penicillin

cmake: enable faster linkers if available
This commit is contained in:
Mai 2022-12-10 20:43:03 +00:00 committed by GitHub
commit 821da3ed54
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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) 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_USE_BUNDLED_VCPKG)
if (YUZU_TESTS) if (YUZU_TESTS)
list(APPEND VCPKG_MANIFEST_FEATURES "yuzu-tests") list(APPEND VCPKG_MANIFEST_FEATURES "yuzu-tests")
@ -579,6 +581,21 @@ if (MSVC AND CMAKE_GENERATOR STREQUAL "Ninja")
) )
endif() 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() enable_testing()
add_subdirectory(externals) add_subdirectory(externals)
add_subdirectory(src) add_subdirectory(src)