Signed-off-by: crueter <crueter@eden-emu.dev>
This commit is contained in:
parent
77f52784cd
commit
df2cc41f67
3 changed files with 25 additions and 21 deletions
|
@ -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
|
||||
|
|
5
externals/CMakeLists.txt
vendored
5
externals/CMakeLists.txt
vendored
|
@ -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}")
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue