blob: d9364eb24339fffc7ea2bae3f56bdb50f7c6c450 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
diff --git a/CMakeLists.txt b/CMakeLists.txt
@@ -6,10 +6,23 @@
set(NAME_PLUGIN_M64P "mupen64plus-rsp-parallel")
-include_directories(../mupen64plus-core/src/api)
+include_directories(/usr/include/mupen64plus)
add_definitions(-DM64P_PLUGIN_API)
add_definitions(-DPARALLEL_INTEGRATION)
+execute_process (
+ COMMAND sh -c "/lib/ld-linux-x86-64.so.2 --help | grep -c 'x86-64-v3 (supported, searched)'"
+ OUTPUT_VARIABLE level3_support
+)
+
+if (${level3_support} GREATER 0 )
+ message("x86-64-v3 microarchitecture is supported, using newer CPU optimizations")
+ set(MARCH_OPTION "x86-64-v3")
+elseif(${level3_support} EQUAL 0)
+ message("x86-64-v3 microarchitecture is NOT supported, fallbacking to v2")
+ set(MARCH_OPTION "x86-64-v2")
+endif()
+
# check for INTERPROCEDURAL_OPTIMIZATION support
if((${CMAKE_VERSION} VERSION_EQUAL 3.9) OR (${CMAKE_VERSION} VERSION_GREATER 3.9))
cmake_policy(SET CMP0069 NEW)
@@ -76,7 +89,7 @@
target_include_directories(${NAME_PLUGIN_M64P} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
target_include_directories(${NAME_PLUGIN_M64P} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/arch/simd/rsp)
target_include_directories(${NAME_PLUGIN_M64P} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/api)
-target_compile_options(${NAME_PLUGIN_M64P} PRIVATE ${PARALLEL_RSP_CXX_FLAGS} -march=x86-64-v3)
+target_compile_options(${NAME_PLUGIN_M64P} PRIVATE ${PARALLEL_RSP_CXX_FLAGS} -march=${MARCH_OPTION})
option(PARALLEL_RSP_BAKED_LIGHTNING "Use built-in Lightning." ON)
@@ -97,8 +110,8 @@
target_sources(lightning PRIVATE win32/mman/sys/mman.c)
target_include_directories(lightning PRIVATE win32/mman)
endif()
- target_compile_options(lightning PRIVATE -march=x86-64-v3)
- target_link_options(lightning PRIVATE -march=x86-64-v3)
+ target_compile_options(lightning PRIVATE -march=${MARCH_OPTION})
+ target_link_options(lightning PRIVATE -march=${MARCH_OPTION})
endif()
-target_link_options(${NAME_PLUGIN_M64P} PRIVATE -march=x86-64-v3)
+target_link_options(${NAME_PLUGIN_M64P} PRIVATE -march=${MARCH_OPTION})
target_link_libraries(${NAME_PLUGIN_M64P} PUBLIC lightning)
|