mirror of
https://github.com/ran-j/PS2Recomp.git
synced 2026-09-26 16:59:35 -04:00
Added ARM64 (Apple Silicon) support using sse2neon (#50)
* feat: implemented arm64 support for builds * feat: explicitly add compiler flags when needed
This commit is contained in:
@@ -6,6 +6,43 @@ 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")
|
||||
|
||||
@@ -6,8 +6,14 @@
|
||||
#include <unordered_map>
|
||||
#include <string>
|
||||
#include <functional>
|
||||
#include <immintrin.h> // For SSE/AVX instructions
|
||||
#include <smmintrin.h>
|
||||
#if defined(_MSC_VER)
|
||||
#include <intrin.h>
|
||||
#elif defined(USE_SSE2NEON)
|
||||
#include "sse2neon.h"
|
||||
#else
|
||||
#include <immintrin.h> // For SSE/AVX instructions
|
||||
#include <smmintrin.h> // For SSE4.1 instructions
|
||||
#endif
|
||||
#include <atomic>
|
||||
#include <filesystem>
|
||||
#include <iostream>
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
#include <cstdint>
|
||||
#if defined(_MSC_VER)
|
||||
#include <intrin.h>
|
||||
#elif defined(USE_SSE2NEON)
|
||||
#include "sse2neon.h"
|
||||
#else
|
||||
#include <immintrin.h> // For SSE/AVX intrinsics
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user