Files
PS2Recomp/CMakeLists.txt
T
Enrique Martinez 1d1b79d5f0 Added ARM64 (Apple Silicon) support using sse2neon (#50)
* feat: implemented arm64 support for builds

* feat: explicitly add compiler flags when needed
2026-02-06 20:12:36 -03:00

52 lines
1.6 KiB
CMake

cmake_minimum_required(VERSION 3.21)
project("PS2 Retro X")
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
option(PS2X_RUNTIME OFF)
# ARM64 support using sse2neon
if(CMAKE_SYSTEM_PROCESSOR MATCHES "arm64|aarch64|ARM64")
message(STATUS "ARM64 detected, fetching sse2neon")
include(FetchContent)
FetchContent_Declare(
sse2neon
GIT_REPOSITORY https://github.com/DLTcollab/sse2neon.git
GIT_TAG v1.9.1
GIT_SHALLOW TRUE
)
FetchContent_MakeAvailable(sse2neon)
include_directories(${sse2neon_SOURCE_DIR})
add_compile_definitions(USE_SSE2NEON)
if(APPLE)
# macOS ARM64 already uses optimal defaults
message(STATUS "macOS ARM64 - using default compiler flags")
elseif(MSVC)
# Windows ARM64 - MSVC already uses optimal defaults
message(STATUS "Windows ARM64 (MSVC) - using default compiler flags")
else()
# Linux ARM64 - add NEON flags
message(STATUS "Non-Apple ARM64 - adding NEON compiler flags")
add_compile_options(-march=armv8-a+fp+simd)
# Try to enable crypto and CRC extensions if supported
include(CheckCXXCompilerFlag)
check_cxx_compiler_flag("-march=armv8-a+fp+simd+crypto+crc" COMPILER_SUPPORTS_CRYPTO_CRC)
if(COMPILER_SUPPORTS_CRYPTO_CRC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=armv8-a+fp+simd+crypto+crc")
message(STATUS "Crypto and CRC extensions enabled")
endif()
endif()
endif()
add_subdirectory("ps2xRecomp")
add_subdirectory("ps2xRuntime")
add_subdirectory("ps2xAnalyzer")
add_subdirectory("ps2xTest")