diff --git a/CMakeModules/DetectArchitecture.cmake b/CMakeModules/DetectArchitecture.cmake index 1adf816cac..e772fa3ace 100644 --- a/CMakeModules/DetectArchitecture.cmake +++ b/CMakeModules/DetectArchitecture.cmake @@ -41,14 +41,15 @@ endif() include(CheckSymbolExists) function(detect_architecture symbol arch) + # The output variable needs to be unset between invocations otherwise + # CMake's crazy scope rules will keep it defined unset(SYMBOL_EXISTS CACHE) + if (NOT DEFINED ARCHITECTURE) set(CMAKE_REQUIRED_QUIET 1) check_symbol_exists("${symbol}" "" SYMBOL_EXISTS) unset(CMAKE_REQUIRED_QUIET) - # The output variable needs to be unique across invocations otherwise - # CMake's crazy scope rules will keep it defined if (SYMBOL_EXISTS) set(ARCHITECTURE "${arch}" PARENT_SCOPE) set(ARCHITECTURE_${arch} 1 PARENT_SCOPE) @@ -70,14 +71,11 @@ function(detect_architecture_symbols) set(arch "${ARGS_ARCH}") - message(STATUS "Architecture: symbols ${ARGS_SYMBOLS} for arch ${arch}") - foreach(symbol ${ARGS_SYMBOLS}) detect_architecture("${symbol}" "${arch}") - message(STATUS "Architecture: symbol ${symbol} ${ARCHITECTURE_${arch}}") if (ARCHITECTURE_${arch}) - message(STATUS "[DetectArchitecture] Found architecture symbol ${symbol} for ${arch}") + message(DEBUG "[DetectArchitecture] Found architecture symbol ${symbol} for ${arch}") set(ARCHITECTURE "${arch}" PARENT_SCOPE) set(ARCHITECTURE_${arch} 1 PARENT_SCOPE) add_definitions(-DARCHITECTURE_${arch}=1) @@ -88,6 +86,11 @@ function(detect_architecture_symbols) endfunction() function(DetectArchitecture) + # arches here are put in a sane default order of importance + # notably, amd64, arm64, and riscv (in order) are BY FAR the most common + # mips is pretty popular in embedded + # ppc64 is pretty popular in supercomputing + # ia64 exists detect_architecture_symbols( ARCH arm64 SYMBOLS @@ -95,13 +98,6 @@ function(DetectArchitecture) "__aarch64__" "_M_ARM64") - detect_architecture_symbols( - ARCH arm - SYMBOLS - "__arm__" - "__TARGET_ARCH_ARM" - "_M_ARM") - detect_architecture_symbols( ARCH x86_64 SYMBOLS @@ -111,6 +107,11 @@ function(DetectArchitecture) "_M_X64" "_M_AMD64") + detect_architecture_symbols( + ARCH riscv + SYMBOLS + "__riscv") + detect_architecture_symbols( ARCH x86 SYMBOLS @@ -118,6 +119,13 @@ function(DetectArchitecture) "__i386__" "_M_IX86") + detect_architecture_symbols( + ARCH arm + SYMBOLS + "__arm__" + "__TARGET_ARCH_ARM" + "_M_ARM") + detect_architecture_symbols( ARCH ia64 SYMBOLS @@ -150,11 +158,6 @@ function(DetectArchitecture) "_M_MPPC" "_M_PPC") - detect_architecture_symbols( - ARCH riscv - SYMBOLS - "__riscv") - detect_architecture_symbols( ARCH wasm SYMBOLS diff --git a/externals/CMakeLists.txt b/externals/CMakeLists.txt index 391c14398d..c071de0b8a 100644 --- a/externals/CMakeLists.txt +++ b/externals/CMakeLists.txt @@ -405,10 +405,11 @@ if (APPLE) if (NOT MOLTENVK_LIBRARY OR YUZU_USE_BUNDLED_MOLTENVK) message(STATUS "Using bundled MoltenVK") + AddJsonPackage(moltenvk) # TODO: is this portable? - set(MVK_STATIC "${MOLTENVK_DIR}/MoltenVK/static/MoltenVK.xcframework/macos-arm64_x86_64/libMoltenVK.a") - set(MVK_DYLIB "${MOLTENVK_DIR}/MoltenVK/dylib/${platform}/libMoltenVK.dylib") + set(MVK_STATIC "${moltenvk_SOURCE_DIR}/MoltenVK/static/MoltenVK.xcframework/macos-arm64_x86_64/libMoltenVK.a") + set(MVK_DYLIB "${moltenvk_SOURCE_DIR}/MoltenVK/dylib/${platform}/libMoltenVK.dylib") # prefer static lib if it exists for smaller executable size if (EXISTS "${MVK_STATIC}") diff --git a/src/dynarmic/CMakeLists.txt b/src/dynarmic/CMakeLists.txt index e39191594f..ce275b87f7 100644 --- a/src/dynarmic/CMakeLists.txt +++ b/src/dynarmic/CMakeLists.txt @@ -142,7 +142,7 @@ else() endif() endif() -find_package(Boost 1.57 CONFIG REQUIRED) +find_package(Boost 1.57 REQUIRED) find_package(fmt 8 CONFIG) # Pull in externals CMakeLists for libs where available