[ARM64] Initial commit for arm64 backend
Based entirely off existing xbyak x86 implementation and available tests. Still needs a lot of optimization and testing on non-Windows platforms. So far passes all tests and boots at least some games on Windows.
This commit is contained in:
@@ -6,6 +6,27 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
set(CMAKE_C_STANDARD 17)
|
||||
set(CMAKE_C_STANDARD_REQUIRED ON)
|
||||
|
||||
# Detect target architecture.
|
||||
# - VS generator: CMAKE_GENERATOR_PLATFORM (from -A flag) takes priority.
|
||||
# - Ninja/Makefiles: CMAKE_SYSTEM_PROCESSOR (set via -DCMAKE_SYSTEM_NAME
|
||||
# + -DCMAKE_SYSTEM_PROCESSOR for cross-compile, or auto-detected natively).
|
||||
if(CMAKE_GENERATOR_PLATFORM)
|
||||
if(CMAKE_GENERATOR_PLATFORM STREQUAL "ARM64")
|
||||
set(XE_TARGET_AARCH64 TRUE)
|
||||
set(XE_TARGET_X86_64 FALSE)
|
||||
else()
|
||||
set(XE_TARGET_AARCH64 FALSE)
|
||||
set(XE_TARGET_X86_64 TRUE)
|
||||
endif()
|
||||
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "aarch64|ARM64")
|
||||
set(XE_TARGET_AARCH64 TRUE)
|
||||
set(XE_TARGET_X86_64 FALSE)
|
||||
else()
|
||||
set(XE_TARGET_AARCH64 FALSE)
|
||||
set(XE_TARGET_X86_64 TRUE)
|
||||
endif()
|
||||
message(STATUS "Target architecture: XE_TARGET_AARCH64=${XE_TARGET_AARCH64} XE_TARGET_X86_64=${XE_TARGET_X86_64} (CMAKE_SYSTEM_PROCESSOR=${CMAKE_SYSTEM_PROCESSOR})")
|
||||
|
||||
# Options
|
||||
option(XENIA_BUILD_TESTS "Build test suites" OFF)
|
||||
option(XENIA_BUILD_MISC "Build misc subprojects (trace viewers, shader compiler, vfs-dump, demos)" OFF)
|
||||
@@ -35,10 +56,12 @@ else()
|
||||
set(XE_PLATFORM_NAME "Linux")
|
||||
endif()
|
||||
|
||||
# Output directories — use CMAKE_BINARY_DIR so each build tree (build/, build-arm64/,
|
||||
# build/vs-arm64/, etc.) gets its own output paths.
|
||||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin/${XE_PLATFORM_NAME}")
|
||||
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin/${XE_PLATFORM_NAME}")
|
||||
# Output directories — strip any vs-* nesting from CMAKE_BINARY_DIR so that
|
||||
# VS and Ninja builds for the same architecture share an output directory,
|
||||
# while different architectures (build/ vs build-arm64/) stay separate.
|
||||
string(REGEX REPLACE "/vs-[^/]+$" "" XE_OUTPUT_ROOT "${CMAKE_BINARY_DIR}")
|
||||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${XE_OUTPUT_ROOT}/bin/${XE_PLATFORM_NAME}")
|
||||
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${XE_OUTPUT_ROOT}/bin/${XE_PLATFORM_NAME}")
|
||||
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/obj/${XE_PLATFORM_NAME}")
|
||||
|
||||
# Create scratch/ if needed
|
||||
@@ -78,9 +101,11 @@ if(MSVC)
|
||||
add_compile_options(
|
||||
/utf-8 # Build correctly on systems with non-Latin codepages
|
||||
/wd4201 # Nameless struct/unions are ok
|
||||
/arch:AVX # AVX vector extensions
|
||||
/MP # Multi-processor compilation
|
||||
)
|
||||
if(XE_TARGET_X86_64)
|
||||
add_compile_options(/arch:AVX)
|
||||
endif()
|
||||
add_compile_definitions(
|
||||
_CRT_NONSTDC_NO_DEPRECATE
|
||||
_CRT_SECURE_NO_WARNINGS
|
||||
@@ -139,7 +164,9 @@ if(MSVC)
|
||||
|
||||
else()
|
||||
# GCC/Clang (Linux)
|
||||
add_compile_options(-mavx)
|
||||
if(XE_TARGET_X86_64)
|
||||
add_compile_options(-mavx)
|
||||
endif()
|
||||
|
||||
# Disable specific warnings for C++
|
||||
add_compile_options(
|
||||
|
||||
Reference in New Issue
Block a user