CMake: Support multiple CMAKE_OSX_ARCHITECTURES

This commit is contained in:
Stenzek
2023-11-24 19:14:57 +10:00
parent af86e5d058
commit 7cc52bba23
23 changed files with 106 additions and 82 deletions

View File

@ -49,18 +49,18 @@ if(ENABLE_DISCORD_PRESENCE)
disable_compiler_warnings_for_target(discord-rpc)
endif()
if(${CPU_ARCH} STREQUAL "x64")
if(CPU_ARCH_X64)
add_subdirectory(xbyak EXCLUDE_FROM_ALL)
add_subdirectory(zydis EXCLUDE_FROM_ALL)
disable_compiler_warnings_for_target(zydis)
endif()
if(${CPU_ARCH} STREQUAL "aarch32" OR ${CPU_ARCH} STREQUAL "aarch64")
if(CPU_ARCH_ARM32 OR CPU_ARCH_ARM64)
add_subdirectory(vixl EXCLUDE_FROM_ALL)
disable_compiler_warnings_for_target(vixl)
endif()
if(${CPU_ARCH} STREQUAL "riscv64")
if(CPU_ARCH_RISCV64)
add_subdirectory(biscuit EXCLUDE_FROM_ALL)
disable_compiler_warnings_for_target(biscuit)
add_subdirectory(riscv-disas EXCLUDE_FROM_ALL)

View File

@ -33,9 +33,9 @@ target_compile_definitions(soundtouch PRIVATE ${COMPILE_DEFINITIONS})
target_compile_options(soundtouch PRIVATE ${COMPILE_OPTIONS})
target_compile_definitions(soundtouch PUBLIC SOUNDTOUCH_FLOAT_SAMPLES ST_NO_EXCEPTION_HANDLING=1)
if("${CPU_ARCH}" STREQUAL "aarch32" OR "${CPU_ARCH}" STREQUAL "aarch64")
if(CPU_ARCH_ARM32 OR CPU_ARCH_ARM64)
target_compile_definitions(soundtouch PRIVATE SOUNDTOUCH_USE_NEON)
if(CMAKE_SYSTEM_PROCESSOR MATCHES "^(armv7.*)$")
if(CPU_ARCH_ARM32)
target_compile_options(soundtouch PRIVATE -mfpu=neon)
endif()
endif()

View File

@ -27,7 +27,7 @@ target_compile_definitions(vixl PUBLIC
VIXL_CODE_BUFFER_MALLOC
)
if(${CPU_ARCH} STREQUAL "aarch32")
if(CPU_ARCH_ARM32)
target_sources(vixl PRIVATE
include/vixl/aarch32/assembler-aarch32.h
include/vixl/aarch32/constants-aarch32.h
@ -52,7 +52,7 @@ if(${CPU_ARCH} STREQUAL "aarch32")
)
endif()
if(${CPU_ARCH} STREQUAL "aarch64")
if(CPU_ARCH_ARM64)
target_sources(vixl PRIVATE
include/vixl/aarch64/abi-aarch64.h
include/vixl/aarch64/assembler-aarch64.h

View File

@ -5,7 +5,7 @@ set(SRCS
add_library(xxhash ${SRCS})
if(${CPU_ARCH} STREQUAL "x86" OR ${CPU_ARCH} STREQUAL "x64")
if(CPU_ARCH_X86 OR CPU_ARCH_X64)
# Required if building with -mavx or -march=native, but you shouldn't be building with it.
target_compile_definitions(xxhash PRIVATE "XXH_X86DISPATCH_ALLOW_AVX")
target_sources(xxhash PRIVATE

View File

@ -52,9 +52,7 @@
extern "C" {
#endif
#if !(defined(__x86_64__) || defined(__i386__) || defined(_M_IX86) || defined(_M_X64))
# error "Dispatching is currently only supported on x86 and x86_64."
#endif
#if defined(__x86_64__) || defined(__i386__) || defined(_M_IX86) || defined(_M_X64)
/*!
* @def XXH_X86DISPATCH_ALLOW_AVX
@ -764,6 +762,8 @@ XXH3_128bits_update_dispatch(XXH3_state_t* state, const void* input, size_t len)
return XXH_g_dispatch128.update(state, (const xxh_u8*)input, len);
}
#endif // defined(__x86_64__) || defined(__i386__) || defined(_M_IX86) || defined(_M_X64)
#if defined (__cplusplus)
}
#endif

View File

@ -28,7 +28,7 @@ add_library(zstd
lib/decompress/zstd_decompress.c
)
if(NOT MSVC AND CPU_ARCH STREQUAL "x64")
if(NOT MSVC AND CPU_ARCH_X64)
target_sources(zstd PRIVATE lib/decompress/huf_decompress_amd64.S)
endif()

View File

@ -44,7 +44,7 @@ extern "C" {
/* Enums and types */
/* ============================================================================================== */
#if !(defined(ZYAN_AARCH64) && defined(ZYAN_APPLE))
#if !(defined(ZYAN_APPLE))
# pragma pack(push, 1)
#endif
@ -68,7 +68,7 @@ typedef struct ZydisShortString_
ZyanU8 size;
} ZydisShortString;
#if !(defined(ZYAN_AARCH64) && defined(ZYAN_APPLE))
#if !(defined(ZYAN_APPLE))
# pragma pack(pop)
#endif