mirror of
https://git.citron-emu.org/Citron/Citron.git
synced 2025-01-22 08:36:32 +01:00
CMake: Force x86-64-v2 instruction set for better compatibility
Enforce x86-64-v2 instruction set level to prevent compatibility issues on systems that default to higher ISA levels (v3/v4). This fixes crashes reported on certain Linux distributions like CachyOS that force higher instruction set levels by default. The fix: - Sets -march=x86-64-v2 for both C and CXX flags - Adds compile options to ensure system defaults don't override - Explicitly disables v3 and v4 instruction sets - Only applies to x86_64 architectures Credits to Alex&Indie for identifying the ISA level compatibility issue. Fixes: Linux Compilation.
This commit is contained in:
parent
cce4abbb0b
commit
cc897c3f0e
1 changed files with 18 additions and 0 deletions
|
@ -654,3 +654,21 @@ if(ENABLE_QT AND UNIX AND NOT APPLE)
|
||||||
install(FILES "dist/org.citron_emu.citron.metainfo.xml"
|
install(FILES "dist/org.citron_emu.citron.metainfo.xml"
|
||||||
DESTINATION "share/metainfo")
|
DESTINATION "share/metainfo")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
# Set default x86-64-v2 instruction set for better compatibility
|
||||||
|
if (CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64|amd64|AMD64")
|
||||||
|
# Only set flags if not explicitly provided via command line
|
||||||
|
if (NOT CMAKE_C_FLAGS MATCHES "-march=" AND NOT CMAKE_CXX_FLAGS MATCHES "-march=")
|
||||||
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=x86-64-v2")
|
||||||
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -march=x86-64-v2")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Ensure we're not getting overridden by system defaults
|
||||||
|
add_compile_options(-march=x86-64-v2)
|
||||||
|
|
||||||
|
# Force disable higher ISA levels
|
||||||
|
add_compile_definitions(
|
||||||
|
__x86_64_v3__=0
|
||||||
|
__x86_64_v4__=0
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
|
Loading…
Reference in a new issue