mirror of https://github.com/PCSX2/pcsx2.git
UnitTests: Only build SSE4 on Apple Silicon host
This commit is contained in:
parent
e20984a5f7
commit
f416fd7a9e
|
@ -26,13 +26,23 @@ if(DISABLE_ADVANCE_SIMD)
|
||||||
set(compile_options_avx -march=sandybridge -mtune=sandybridge)
|
set(compile_options_avx -march=sandybridge -mtune=sandybridge)
|
||||||
set(compile_options_sse4 -msse4.1 -mtune=nehalem)
|
set(compile_options_sse4 -msse4.1 -mtune=nehalem)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
# This breaks when running on Apple Silicon, because even though we skip the test itself, the
|
||||||
|
# gtest constructor still generates AVX code, and that's a global object which gets constructed
|
||||||
|
# at binary load time. So, for now, only compile SSE4 if running on ARM64.
|
||||||
|
if (NOT APPLE OR "${CMAKE_HOST_SYSTEM_PROCESSOR}" STREQUAL "x86_64")
|
||||||
|
set(isa_list "sse4" "avx" "avx2")
|
||||||
|
else()
|
||||||
|
set(isa_list "sse4")
|
||||||
|
endif()
|
||||||
|
|
||||||
# ODR violation time!
|
# ODR violation time!
|
||||||
# Everything would be fine if we only defined things in cpp files, but C++ tends to like inline functions (STL anyone?)
|
# Everything would be fine if we only defined things in cpp files, but C++ tends to like inline functions (STL anyone?)
|
||||||
# Each ISA will bring with it its own copies of these inline header functions, and the linker gets to choose whichever one it wants! Not fun if the linker chooses the avx2 version and uses it with everything
|
# Each ISA will bring with it its own copies of these inline header functions, and the linker gets to choose whichever one it wants! Not fun if the linker chooses the avx2 version and uses it with everything
|
||||||
# Thankfully, most linkers don't choose at random. When presented with a bunch of .o files, most linkers seem to choose the first implementation they see, so make sure you order these from oldest to newest
|
# Thankfully, most linkers don't choose at random. When presented with a bunch of .o files, most linkers seem to choose the first implementation they see, so make sure you order these from oldest to newest
|
||||||
# Note: ld64 (macOS's linker) does not act the same way when presented with .a files, unless linked with `-force_load` (cmake WHOLE_ARCHIVE).
|
# Note: ld64 (macOS's linker) does not act the same way when presented with .a files, unless linked with `-force_load` (cmake WHOLE_ARCHIVE).
|
||||||
set(is_first_isa "1")
|
set(is_first_isa "1")
|
||||||
foreach(isa "sse4" "avx" "avx2")
|
foreach(isa IN LISTS isa_list)
|
||||||
add_library(core_test_${isa} STATIC ${multi_isa_sources})
|
add_library(core_test_${isa} STATIC ${multi_isa_sources})
|
||||||
target_link_libraries(core_test_${isa} PRIVATE PCSX2_FLAGS gtest)
|
target_link_libraries(core_test_${isa} PRIVATE PCSX2_FLAGS gtest)
|
||||||
target_compile_definitions(core_test_${isa} PRIVATE MULTI_ISA_UNSHARED_COMPILATION=isa_${isa} MULTI_ISA_IS_FIRST=${is_first_isa} ${pcsx2_defs_${isa}})
|
target_compile_definitions(core_test_${isa} PRIVATE MULTI_ISA_UNSHARED_COMPILATION=isa_${isa} MULTI_ISA_IS_FIRST=${is_first_isa} ${pcsx2_defs_${isa}})
|
||||||
|
|
Loading…
Reference in New Issue