CMake: Support multiple CMAKE_OSX_ARCHITECTURES
This commit is contained in:
parent
af86e5d058
commit
7cc52bba23
|
@ -368,7 +368,11 @@ jobs:
|
||||||
run: |
|
run: |
|
||||||
mkdir build
|
mkdir build
|
||||||
cd build
|
cd build
|
||||||
../scripts/make-universal-macos-binary.sh ..
|
export MACOSX_DEPLOYMENT_TARGET=11.0
|
||||||
|
cmake -DCMAKE_OSX_ARCHITECTURES="x86_64;arm64" -DCMAKE_BUILD_TYPE=Release -DENABLE_OPENGL=OFF -DCMAKE_PREFIX_PATH="$HOME/deps" -DCMAKE_INTERPROCEDURAL_OPTIMIZATION=ON -G Ninja ..
|
||||||
|
cmake --build . --parallel
|
||||||
|
mv bin/DuckStation.app .
|
||||||
|
codesign -s - --deep -f -v DuckStation.app
|
||||||
zip -r duckstation-mac-release.zip DuckStation.app/
|
zip -r duckstation-mac-release.zip DuckStation.app/
|
||||||
|
|
||||||
- name: Upload macOS .app
|
- name: Upload macOS .app
|
||||||
|
|
|
@ -135,31 +135,44 @@ endif()
|
||||||
|
|
||||||
|
|
||||||
# Detect processor type.
|
# Detect processor type.
|
||||||
if("${CMAKE_OSX_ARCHITECTURES}" STREQUAL "arm64")
|
if(APPLE AND NOT "${CMAKE_OSX_ARCHITECTURES}" STREQUAL "")
|
||||||
# Cross-compile on macos.
|
# Universal binaries.
|
||||||
set(CPU_ARCH "aarch64")
|
if("x86_64" IN_LIST CMAKE_OSX_ARCHITECTURES)
|
||||||
|
set(CPU_ARCH_X64 TRUE)
|
||||||
|
message("Building x86_64 MacOS binaries.")
|
||||||
|
endif()
|
||||||
|
if("arm64" IN_LIST CMAKE_OSX_ARCHITECTURES)
|
||||||
|
set(CPU_ARCH_ARM64 TRUE)
|
||||||
|
message("Building ARM64 MacOS binaries.")
|
||||||
|
endif()
|
||||||
elseif("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "x86_64" OR "${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "amd64" OR
|
elseif("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "x86_64" OR "${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "amd64" OR
|
||||||
"${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "AMD64" OR "${CMAKE_OSX_ARCHITECTURES}" STREQUAL "x86_64")
|
"${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "AMD64" OR "${CMAKE_OSX_ARCHITECTURES}" STREQUAL "x86_64")
|
||||||
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
|
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||||
set(CPU_ARCH "x64")
|
set(CPU_ARCH_X64 TRUE)
|
||||||
|
message("Building x86_64 binaries.")
|
||||||
else()
|
else()
|
||||||
# Cross-compiling 32-bit build. 32-bit hosts are not supported.
|
# Cross-compiling 32-bit build. 32-bit hosts are not supported.
|
||||||
set(CPU_ARCH "x86")
|
set(CPU_ARCH_X86 TRUE)
|
||||||
|
message("Building x86_32 binaries [not supported].")
|
||||||
endif()
|
endif()
|
||||||
elseif("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "x86" OR "${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "i386" OR
|
elseif("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "x86" OR "${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "i386" OR
|
||||||
"${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "i686")
|
"${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "i686")
|
||||||
set(CPU_ARCH "x86")
|
set(CPU_ARCH_X86 TRUE)
|
||||||
|
message("Building x86_32 binaries [not supported].")
|
||||||
elseif("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "aarch64" OR "${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "arm64")
|
elseif("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "aarch64" OR "${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "arm64")
|
||||||
if(CMAKE_SIZEOF_VOID_P EQUAL 8) # Might have an A64 kernel, e.g. Raspbian.
|
if(CMAKE_SIZEOF_VOID_P EQUAL 8) # Might have an A64 kernel, e.g. Raspbian.
|
||||||
set(CPU_ARCH "aarch64")
|
set(CPU_ARCH_ARM64 TRUE)
|
||||||
|
message("Building ARM64 binaries.")
|
||||||
else()
|
else()
|
||||||
set(CPU_ARCH "aarch32")
|
set(CPU_ARCH_ARM32 TRUE)
|
||||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -marm -march=armv7-a")
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -marm -march=armv7-a")
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -marm -march=armv7-a")
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -marm -march=armv7-a")
|
||||||
|
message("Building ARM32 binaries on ARM64.")
|
||||||
endif()
|
endif()
|
||||||
elseif("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "arm" OR "${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "armv7-a" OR
|
elseif("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "arm" OR "${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "armv7-a" OR
|
||||||
"${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "armv7l")
|
"${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "armv7l")
|
||||||
set(CPU_ARCH "aarch32")
|
set(CPU_ARCH_ARM32 TRUE)
|
||||||
|
message("Building ARM32 binaries.")
|
||||||
if(ANDROID)
|
if(ANDROID)
|
||||||
# Force ARM mode, since apparently ANDROID_ARM_MODE isn't working..
|
# Force ARM mode, since apparently ANDROID_ARM_MODE isn't working..
|
||||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -marm")
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -marm")
|
||||||
|
@ -171,6 +184,7 @@ elseif("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "arm" OR "${CMAKE_SYSTEM_PROCESSOR}"
|
||||||
endif()
|
endif()
|
||||||
elseif("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "riscv64")
|
elseif("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "riscv64")
|
||||||
set(CPU_ARCH "riscv64")
|
set(CPU_ARCH "riscv64")
|
||||||
|
message("Building RISC-V 64 binaries.")
|
||||||
|
|
||||||
# Not done for us. Or we should inline atomics?
|
# Not done for us. Or we should inline atomics?
|
||||||
link_libraries("-latomic")
|
link_libraries("-latomic")
|
||||||
|
@ -208,7 +222,7 @@ find_package(Threads REQUIRED)
|
||||||
|
|
||||||
# Enable large file support on Linux 32-bit platforms.
|
# Enable large file support on Linux 32-bit platforms.
|
||||||
# Android is deliberately ommitted here as it didn't support 64-bit ops on files until Android 7/N.
|
# Android is deliberately ommitted here as it didn't support 64-bit ops on files until Android 7/N.
|
||||||
if((LINUX OR FREEBSD) AND (${CPU_ARCH} STREQUAL "x86" OR ${CPU_ARCH} STREQUAL "aarch32"))
|
if((LINUX OR FREEBSD) AND (CPU_ARCH_X86 OR CPU_ARCH_ARM32))
|
||||||
add_definitions("-D_FILE_OFFSET_BITS=64")
|
add_definitions("-D_FILE_OFFSET_BITS=64")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
|
@ -49,18 +49,18 @@ if(ENABLE_DISCORD_PRESENCE)
|
||||||
disable_compiler_warnings_for_target(discord-rpc)
|
disable_compiler_warnings_for_target(discord-rpc)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(${CPU_ARCH} STREQUAL "x64")
|
if(CPU_ARCH_X64)
|
||||||
add_subdirectory(xbyak EXCLUDE_FROM_ALL)
|
add_subdirectory(xbyak EXCLUDE_FROM_ALL)
|
||||||
add_subdirectory(zydis EXCLUDE_FROM_ALL)
|
add_subdirectory(zydis EXCLUDE_FROM_ALL)
|
||||||
disable_compiler_warnings_for_target(zydis)
|
disable_compiler_warnings_for_target(zydis)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(${CPU_ARCH} STREQUAL "aarch32" OR ${CPU_ARCH} STREQUAL "aarch64")
|
if(CPU_ARCH_ARM32 OR CPU_ARCH_ARM64)
|
||||||
add_subdirectory(vixl EXCLUDE_FROM_ALL)
|
add_subdirectory(vixl EXCLUDE_FROM_ALL)
|
||||||
disable_compiler_warnings_for_target(vixl)
|
disable_compiler_warnings_for_target(vixl)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(${CPU_ARCH} STREQUAL "riscv64")
|
if(CPU_ARCH_RISCV64)
|
||||||
add_subdirectory(biscuit EXCLUDE_FROM_ALL)
|
add_subdirectory(biscuit EXCLUDE_FROM_ALL)
|
||||||
disable_compiler_warnings_for_target(biscuit)
|
disable_compiler_warnings_for_target(biscuit)
|
||||||
add_subdirectory(riscv-disas EXCLUDE_FROM_ALL)
|
add_subdirectory(riscv-disas EXCLUDE_FROM_ALL)
|
||||||
|
|
|
@ -33,9 +33,9 @@ target_compile_definitions(soundtouch PRIVATE ${COMPILE_DEFINITIONS})
|
||||||
target_compile_options(soundtouch PRIVATE ${COMPILE_OPTIONS})
|
target_compile_options(soundtouch PRIVATE ${COMPILE_OPTIONS})
|
||||||
target_compile_definitions(soundtouch PUBLIC SOUNDTOUCH_FLOAT_SAMPLES ST_NO_EXCEPTION_HANDLING=1)
|
target_compile_definitions(soundtouch PUBLIC SOUNDTOUCH_FLOAT_SAMPLES ST_NO_EXCEPTION_HANDLING=1)
|
||||||
|
|
||||||
if("${CPU_ARCH}" STREQUAL "aarch32" OR "${CPU_ARCH}" STREQUAL "aarch64")
|
if(CPU_ARCH_ARM32 OR CPU_ARCH_ARM64)
|
||||||
target_compile_definitions(soundtouch PRIVATE SOUNDTOUCH_USE_NEON)
|
target_compile_definitions(soundtouch PRIVATE SOUNDTOUCH_USE_NEON)
|
||||||
if(CMAKE_SYSTEM_PROCESSOR MATCHES "^(armv7.*)$")
|
if(CPU_ARCH_ARM32)
|
||||||
target_compile_options(soundtouch PRIVATE -mfpu=neon)
|
target_compile_options(soundtouch PRIVATE -mfpu=neon)
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
|
@ -27,7 +27,7 @@ target_compile_definitions(vixl PUBLIC
|
||||||
VIXL_CODE_BUFFER_MALLOC
|
VIXL_CODE_BUFFER_MALLOC
|
||||||
)
|
)
|
||||||
|
|
||||||
if(${CPU_ARCH} STREQUAL "aarch32")
|
if(CPU_ARCH_ARM32)
|
||||||
target_sources(vixl PRIVATE
|
target_sources(vixl PRIVATE
|
||||||
include/vixl/aarch32/assembler-aarch32.h
|
include/vixl/aarch32/assembler-aarch32.h
|
||||||
include/vixl/aarch32/constants-aarch32.h
|
include/vixl/aarch32/constants-aarch32.h
|
||||||
|
@ -52,7 +52,7 @@ if(${CPU_ARCH} STREQUAL "aarch32")
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(${CPU_ARCH} STREQUAL "aarch64")
|
if(CPU_ARCH_ARM64)
|
||||||
target_sources(vixl PRIVATE
|
target_sources(vixl PRIVATE
|
||||||
include/vixl/aarch64/abi-aarch64.h
|
include/vixl/aarch64/abi-aarch64.h
|
||||||
include/vixl/aarch64/assembler-aarch64.h
|
include/vixl/aarch64/assembler-aarch64.h
|
||||||
|
|
|
@ -5,7 +5,7 @@ set(SRCS
|
||||||
|
|
||||||
add_library(xxhash ${SRCS})
|
add_library(xxhash ${SRCS})
|
||||||
|
|
||||||
if(${CPU_ARCH} STREQUAL "x86" OR ${CPU_ARCH} STREQUAL "x64")
|
if(CPU_ARCH_X86 OR CPU_ARCH_X64)
|
||||||
# Required if building with -mavx or -march=native, but you shouldn't be building with it.
|
# Required if building with -mavx or -march=native, but you shouldn't be building with it.
|
||||||
target_compile_definitions(xxhash PRIVATE "XXH_X86DISPATCH_ALLOW_AVX")
|
target_compile_definitions(xxhash PRIVATE "XXH_X86DISPATCH_ALLOW_AVX")
|
||||||
target_sources(xxhash PRIVATE
|
target_sources(xxhash PRIVATE
|
||||||
|
|
|
@ -52,9 +52,7 @@
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !(defined(__x86_64__) || defined(__i386__) || defined(_M_IX86) || defined(_M_X64))
|
#if defined(__x86_64__) || defined(__i386__) || defined(_M_IX86) || defined(_M_X64)
|
||||||
# error "Dispatching is currently only supported on x86 and x86_64."
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @def XXH_X86DISPATCH_ALLOW_AVX
|
* @def XXH_X86DISPATCH_ALLOW_AVX
|
||||||
|
@ -764,6 +762,8 @@ XXH3_128bits_update_dispatch(XXH3_state_t* state, const void* input, size_t len)
|
||||||
return XXH_g_dispatch128.update(state, (const xxh_u8*)input, len);
|
return XXH_g_dispatch128.update(state, (const xxh_u8*)input, len);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif // defined(__x86_64__) || defined(__i386__) || defined(_M_IX86) || defined(_M_X64)
|
||||||
|
|
||||||
#if defined (__cplusplus)
|
#if defined (__cplusplus)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -28,7 +28,7 @@ add_library(zstd
|
||||||
lib/decompress/zstd_decompress.c
|
lib/decompress/zstd_decompress.c
|
||||||
)
|
)
|
||||||
|
|
||||||
if(NOT MSVC AND CPU_ARCH STREQUAL "x64")
|
if(NOT MSVC AND CPU_ARCH_X64)
|
||||||
target_sources(zstd PRIVATE lib/decompress/huf_decompress_amd64.S)
|
target_sources(zstd PRIVATE lib/decompress/huf_decompress_amd64.S)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
|
@ -44,7 +44,7 @@ extern "C" {
|
||||||
/* Enums and types */
|
/* Enums and types */
|
||||||
/* ============================================================================================== */
|
/* ============================================================================================== */
|
||||||
|
|
||||||
#if !(defined(ZYAN_AARCH64) && defined(ZYAN_APPLE))
|
#if !(defined(ZYAN_APPLE))
|
||||||
# pragma pack(push, 1)
|
# pragma pack(push, 1)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -68,7 +68,7 @@ typedef struct ZydisShortString_
|
||||||
ZyanU8 size;
|
ZyanU8 size;
|
||||||
} ZydisShortString;
|
} ZydisShortString;
|
||||||
|
|
||||||
#if !(defined(ZYAN_AARCH64) && defined(ZYAN_APPLE))
|
#if !(defined(ZYAN_APPLE))
|
||||||
# pragma pack(pop)
|
# pragma pack(pop)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -1,48 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
|
|
||||||
set -e
|
|
||||||
|
|
||||||
DEPS=$HOME/deps
|
|
||||||
|
|
||||||
if [ "$#" -ne 1 ]; then
|
|
||||||
echo "Syntax: $0 <path to source directory>"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# no realpath...
|
|
||||||
SOURCEDIR="$1"
|
|
||||||
|
|
||||||
echo "Build x64..."
|
|
||||||
mkdir build-x64
|
|
||||||
cd build-x64
|
|
||||||
export MACOSX_DEPLOYMENT_TARGET=11.0
|
|
||||||
cmake -DCMAKE_BUILD_TYPE=Release -DENABLE_OPENGL=OFF -DCMAKE_PREFIX_PATH="$DEPS" -DCMAKE_INTERPROCEDURAL_OPTIMIZATION=ON -G Ninja "../$SOURCEDIR"
|
|
||||||
cmake --build . --parallel
|
|
||||||
cd ..
|
|
||||||
|
|
||||||
echo "Build arm64..."
|
|
||||||
mkdir build-arm64
|
|
||||||
cd build-arm64
|
|
||||||
export MACOSX_DEPLOYMENT_TARGET=11.00
|
|
||||||
cmake -DCMAKE_OSX_ARCHITECTURES=arm64 -DCMAKE_BUILD_TYPE=Release -DENABLE_OPENGL=OFF -DCMAKE_PREFIX_PATH="$DEPS" -DCMAKE_INTERPROCEDURAL_OPTIMIZATION=ON -G Ninja "../$SOURCEDIR"
|
|
||||||
cmake --build . --parallel
|
|
||||||
cd ..
|
|
||||||
|
|
||||||
echo "Combine binary..."
|
|
||||||
unset MACOSX_DEPLOYMENT_TARGET
|
|
||||||
BINPATH=bin/DuckStation.app/Contents/MacOS/DuckStation
|
|
||||||
UPDATERPATH=bin/DuckStation.app/Contents/Resources/Updater.app/Contents/MacOS/Updater
|
|
||||||
lipo -create "build-x64/$BINPATH" "build-arm64/$BINPATH" -o "build-x64/$BINPATH"
|
|
||||||
lipo -create "build-x64/$UPDATERPATH" "build-arm64/$UPDATERPATH" -o "build-x64/$UPDATERPATH"
|
|
||||||
|
|
||||||
# For some reason, the svg image format plugin doesn't get included in combined builds...
|
|
||||||
if [ -f $HOME/deps/plugins/imageformats/libqsvg.dylib ]; then
|
|
||||||
cp -v -n $HOME/deps/plugins/imageformats/libqsvg.dylib build-x64/bin/DuckStation.app/Contents/PlugIns/imageformats
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "Grab app..."
|
|
||||||
mv build-x64/bin/DuckStation.app .
|
|
||||||
rm -fr build-x64 build-arm64
|
|
||||||
|
|
||||||
echo "Sign binary with self-signed cert..."
|
|
||||||
codesign -s - --deep -f -v DuckStation.app
|
|
|
@ -133,16 +133,20 @@ target_include_directories(core PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/..")
|
||||||
target_link_libraries(core PUBLIC Threads::Threads common util zlib)
|
target_link_libraries(core PUBLIC Threads::Threads common util zlib)
|
||||||
target_link_libraries(core PRIVATE stb xxhash imgui rapidjson rcheevos)
|
target_link_libraries(core PRIVATE stb xxhash imgui rapidjson rcheevos)
|
||||||
|
|
||||||
if(${CPU_ARCH} STREQUAL "x64")
|
if(CPU_ARCH_X64)
|
||||||
target_compile_definitions(core PUBLIC "ENABLE_RECOMPILER=1" "ENABLE_NEWREC=1" "ENABLE_MMAP_FASTMEM=1")
|
target_compile_definitions(core PUBLIC "ENABLE_RECOMPILER=1" "ENABLE_NEWREC=1" "ENABLE_MMAP_FASTMEM=1")
|
||||||
target_sources(core PRIVATE ${RECOMPILER_SRCS} ${NEWREC_SOURCES}
|
target_sources(core PRIVATE ${RECOMPILER_SRCS} ${NEWREC_SOURCES}
|
||||||
cpu_recompiler_code_generator_x64.cpp
|
cpu_recompiler_code_generator_x64.cpp
|
||||||
cpu_newrec_compiler_x64.cpp
|
cpu_newrec_compiler_x64.cpp
|
||||||
cpu_newrec_compiler_x64.h
|
cpu_newrec_compiler_x64.h
|
||||||
)
|
)
|
||||||
target_link_libraries(core PRIVATE xbyak zydis)
|
target_link_libraries(core PRIVATE xbyak)
|
||||||
|
if("${CMAKE_BUILD_TYPE}" STREQUAL "Debug")
|
||||||
|
target_link_libraries(core PRIVATE zydis)
|
||||||
|
endif()
|
||||||
message("Building x64 recompiler")
|
message("Building x64 recompiler")
|
||||||
elseif(${CPU_ARCH} STREQUAL "aarch32")
|
endif()
|
||||||
|
if(CPU_ARCH_ARM32)
|
||||||
target_compile_definitions(core PUBLIC "ENABLE_RECOMPILER=1" "ENABLE_NEWREC=1")
|
target_compile_definitions(core PUBLIC "ENABLE_RECOMPILER=1" "ENABLE_NEWREC=1")
|
||||||
target_sources(core PRIVATE ${RECOMPILER_SRCS} ${NEWREC_SOURCES}
|
target_sources(core PRIVATE ${RECOMPILER_SRCS} ${NEWREC_SOURCES}
|
||||||
cpu_recompiler_code_generator_aarch32.cpp
|
cpu_recompiler_code_generator_aarch32.cpp
|
||||||
|
@ -151,7 +155,8 @@ elseif(${CPU_ARCH} STREQUAL "aarch32")
|
||||||
)
|
)
|
||||||
target_link_libraries(core PUBLIC vixl)
|
target_link_libraries(core PUBLIC vixl)
|
||||||
message("Building AArch32 recompiler")
|
message("Building AArch32 recompiler")
|
||||||
elseif(${CPU_ARCH} STREQUAL "aarch64")
|
endif()
|
||||||
|
if(CPU_ARCH_ARM64)
|
||||||
target_compile_definitions(core PUBLIC "ENABLE_RECOMPILER=1" "ENABLE_NEWREC=1" "ENABLE_MMAP_FASTMEM=1")
|
target_compile_definitions(core PUBLIC "ENABLE_RECOMPILER=1" "ENABLE_NEWREC=1" "ENABLE_MMAP_FASTMEM=1")
|
||||||
target_sources(core PRIVATE ${RECOMPILER_SRCS} ${NEWREC_SOURCES}
|
target_sources(core PRIVATE ${RECOMPILER_SRCS} ${NEWREC_SOURCES}
|
||||||
cpu_recompiler_code_generator_aarch64.cpp
|
cpu_recompiler_code_generator_aarch64.cpp
|
||||||
|
@ -160,7 +165,8 @@ elseif(${CPU_ARCH} STREQUAL "aarch64")
|
||||||
)
|
)
|
||||||
target_link_libraries(core PUBLIC vixl)
|
target_link_libraries(core PUBLIC vixl)
|
||||||
message("Building AArch64 recompiler")
|
message("Building AArch64 recompiler")
|
||||||
elseif(${CPU_ARCH} STREQUAL "riscv64")
|
endif()
|
||||||
|
if(CPU_ARCH_RISCV64)
|
||||||
target_compile_definitions(core PUBLIC "ENABLE_NEWREC=1" "ENABLE_MMAP_FASTMEM=1")
|
target_compile_definitions(core PUBLIC "ENABLE_NEWREC=1" "ENABLE_MMAP_FASTMEM=1")
|
||||||
target_sources(core PRIVATE ${NEWREC_SOURCES}
|
target_sources(core PRIVATE ${NEWREC_SOURCES}
|
||||||
cpu_newrec_compiler_riscv64.cpp
|
cpu_newrec_compiler_riscv64.cpp
|
||||||
|
@ -168,8 +174,6 @@ elseif(${CPU_ARCH} STREQUAL "riscv64")
|
||||||
)
|
)
|
||||||
target_link_libraries(core PUBLIC biscuit::biscuit riscv-disas)
|
target_link_libraries(core PUBLIC biscuit::biscuit riscv-disas)
|
||||||
message("Building RISC-V 64-bit recompiler")
|
message("Building RISC-V 64-bit recompiler")
|
||||||
else()
|
|
||||||
message("Not building recompiler")
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(ENABLE_DISCORD_PRESENCE)
|
if(ENABLE_DISCORD_PRESENCE)
|
||||||
|
|
|
@ -14,6 +14,9 @@
|
||||||
#include "settings.h"
|
#include "settings.h"
|
||||||
#include "timing_event.h"
|
#include "timing_event.h"
|
||||||
#include <limits>
|
#include <limits>
|
||||||
|
|
||||||
|
#ifdef CPU_ARCH_ARM32
|
||||||
|
|
||||||
Log_SetChannel(CPU::NewRec);
|
Log_SetChannel(CPU::NewRec);
|
||||||
|
|
||||||
#define PTR(x) vixl::aarch32::MemOperand(RSTATE, (((u8*)(x)) - ((u8*)&g_state)))
|
#define PTR(x) vixl::aarch32::MemOperand(RSTATE, (((u8*)(x)) - ((u8*)&g_state)))
|
||||||
|
@ -2260,3 +2263,5 @@ u32 CPU::NewRec::CompileLoadStoreThunk(void* thunk_code, u32 thunk_space, void*
|
||||||
|
|
||||||
return static_cast<u32>(armAsm->GetCursorOffset());
|
return static_cast<u32>(armAsm->GetCursorOffset());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif // CPU_ARCH_ARM32
|
||||||
|
|
|
@ -2,9 +2,12 @@
|
||||||
// SPDX-License-Identifier: (GPL-3.0 OR CC-BY-NC-ND-4.0)
|
// SPDX-License-Identifier: (GPL-3.0 OR CC-BY-NC-ND-4.0)
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "cpu_newrec_compiler.h"
|
#include "cpu_newrec_compiler.h"
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
|
#ifdef CPU_ARCH_ARM32
|
||||||
|
|
||||||
#include "vixl/aarch32/assembler-aarch32.h"
|
#include "vixl/aarch32/assembler-aarch32.h"
|
||||||
#include "vixl/aarch32/operands-aarch32.h"
|
#include "vixl/aarch32/operands-aarch32.h"
|
||||||
|
|
||||||
|
@ -162,3 +165,5 @@ private:
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace CPU::NewRec
|
} // namespace CPU::NewRec
|
||||||
|
|
||||||
|
#endif // CPU_ARCH_ARM32
|
|
@ -14,6 +14,9 @@
|
||||||
#include "settings.h"
|
#include "settings.h"
|
||||||
#include "timing_event.h"
|
#include "timing_event.h"
|
||||||
#include <limits>
|
#include <limits>
|
||||||
|
|
||||||
|
#ifdef CPU_ARCH_ARM64
|
||||||
|
|
||||||
Log_SetChannel(CPU::NewRec);
|
Log_SetChannel(CPU::NewRec);
|
||||||
|
|
||||||
#define PTR(x) vixl::aarch64::MemOperand(RSTATE, (((u8*)(x)) - ((u8*)&g_state)))
|
#define PTR(x) vixl::aarch64::MemOperand(RSTATE, (((u8*)(x)) - ((u8*)&g_state)))
|
||||||
|
@ -2248,3 +2251,5 @@ u32 CPU::NewRec::CompileLoadStoreThunk(void* thunk_code, u32 thunk_space, void*
|
||||||
|
|
||||||
return static_cast<u32>(armAsm->GetCursorOffset());
|
return static_cast<u32>(armAsm->GetCursorOffset());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif // CPU_ARCH_ARM64
|
||||||
|
|
|
@ -5,6 +5,8 @@
|
||||||
#include "cpu_newrec_compiler.h"
|
#include "cpu_newrec_compiler.h"
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
|
#ifdef CPU_ARCH_ARM64
|
||||||
|
|
||||||
#include "vixl/aarch64/assembler-aarch64.h"
|
#include "vixl/aarch64/assembler-aarch64.h"
|
||||||
|
|
||||||
namespace CPU::NewRec {
|
namespace CPU::NewRec {
|
||||||
|
@ -163,3 +165,5 @@ private:
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace CPU::NewRec
|
} // namespace CPU::NewRec
|
||||||
|
|
||||||
|
#endif // CPU_ARCH_ARM64
|
||||||
|
|
|
@ -13,6 +13,9 @@
|
||||||
#include "settings.h"
|
#include "settings.h"
|
||||||
#include "timing_event.h"
|
#include "timing_event.h"
|
||||||
#include <limits>
|
#include <limits>
|
||||||
|
|
||||||
|
#ifdef CPU_ARCH_RISCV64
|
||||||
|
|
||||||
Log_SetChannel(CPU::NewRec);
|
Log_SetChannel(CPU::NewRec);
|
||||||
|
|
||||||
#ifdef ENABLE_HOST_DISASSEMBLY
|
#ifdef ENABLE_HOST_DISASSEMBLY
|
||||||
|
@ -2480,3 +2483,5 @@ u32 CPU::NewRec::CompileLoadStoreThunk(void* thunk_code, u32 thunk_space, void*
|
||||||
|
|
||||||
return static_cast<u32>(rvAsm->GetCodeBuffer().GetSizeInBytes());
|
return static_cast<u32>(rvAsm->GetCodeBuffer().GetSizeInBytes());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif // CPU_ARCH_RISCV64
|
||||||
|
|
|
@ -5,6 +5,8 @@
|
||||||
#include "cpu_newrec_compiler.h"
|
#include "cpu_newrec_compiler.h"
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
|
#ifdef CPU_ARCH_RISCV64
|
||||||
|
|
||||||
namespace CPU::NewRec {
|
namespace CPU::NewRec {
|
||||||
|
|
||||||
class RISCV64Compiler final : public Compiler
|
class RISCV64Compiler final : public Compiler
|
||||||
|
@ -168,3 +170,5 @@ private:
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace CPU::NewRec
|
} // namespace CPU::NewRec
|
||||||
|
|
||||||
|
#endif // CPU_ARCH_RISCV64
|
||||||
|
|
|
@ -15,6 +15,9 @@
|
||||||
#include "settings.h"
|
#include "settings.h"
|
||||||
#include "timing_event.h"
|
#include "timing_event.h"
|
||||||
#include <limits>
|
#include <limits>
|
||||||
|
|
||||||
|
#ifdef CPU_ARCH_X64
|
||||||
|
|
||||||
Log_SetChannel(CPU::NewRec);
|
Log_SetChannel(CPU::NewRec);
|
||||||
|
|
||||||
#define RMEMBASE cg->rbx
|
#define RMEMBASE cg->rbx
|
||||||
|
@ -2223,3 +2226,5 @@ u32 CPU::NewRec::CompileLoadStoreThunk(void* thunk_code, u32 thunk_space, void*
|
||||||
|
|
||||||
return static_cast<u32>(cg->getSize());
|
return static_cast<u32>(cg->getSize());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif // CPU_ARCH_X64
|
||||||
|
|
|
@ -3,9 +3,10 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
#include "cpu_newrec_compiler.h"
|
#include "cpu_newrec_compiler.h"
|
||||||
#include <initializer_list>
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
|
#ifdef CPU_ARCH_X64
|
||||||
|
|
||||||
namespace CPU::NewRec {
|
namespace CPU::NewRec {
|
||||||
|
|
||||||
class X64Compiler final : public Compiler
|
class X64Compiler final : public Compiler
|
||||||
|
@ -139,3 +140,5 @@ private:
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace CPU::NewRec
|
} // namespace CPU::NewRec
|
||||||
|
|
||||||
|
#endif // CPU_ARCH_X64
|
||||||
|
|
|
@ -12,6 +12,9 @@
|
||||||
#include "cpu_recompiler_thunks.h"
|
#include "cpu_recompiler_thunks.h"
|
||||||
#include "settings.h"
|
#include "settings.h"
|
||||||
#include "timing_event.h"
|
#include "timing_event.h"
|
||||||
|
|
||||||
|
#ifdef CPU_ARCH_ARM32
|
||||||
|
|
||||||
Log_SetChannel(CPU::Recompiler);
|
Log_SetChannel(CPU::Recompiler);
|
||||||
|
|
||||||
#ifdef ENABLE_HOST_DISASSEMBLY
|
#ifdef ENABLE_HOST_DISASSEMBLY
|
||||||
|
@ -2301,3 +2304,5 @@ void CodeGenerator::EmitLoadGlobalAddress(HostReg host_reg, const void* ptr)
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace CPU::Recompiler
|
} // namespace CPU::Recompiler
|
||||||
|
|
||||||
|
#endif // CPU_ARCH_ARM32
|
||||||
|
|
|
@ -11,6 +11,9 @@
|
||||||
#include "cpu_recompiler_thunks.h"
|
#include "cpu_recompiler_thunks.h"
|
||||||
#include "settings.h"
|
#include "settings.h"
|
||||||
#include "timing_event.h"
|
#include "timing_event.h"
|
||||||
|
|
||||||
|
#ifdef CPU_ARCH_ARM64
|
||||||
|
|
||||||
Log_SetChannel(CPU::Recompiler);
|
Log_SetChannel(CPU::Recompiler);
|
||||||
|
|
||||||
#ifdef ENABLE_HOST_DISASSEMBLY
|
#ifdef ENABLE_HOST_DISASSEMBLY
|
||||||
|
@ -2592,3 +2595,5 @@ void CodeGenerator::EmitLoadGlobalAddress(HostReg host_reg, const void* ptr)
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace CPU::Recompiler
|
} // namespace CPU::Recompiler
|
||||||
|
|
||||||
|
#endif // CPU_ARCH_ARM64
|
||||||
|
|
|
@ -13,6 +13,8 @@
|
||||||
#include "common/assert.h"
|
#include "common/assert.h"
|
||||||
#include "common/log.h"
|
#include "common/log.h"
|
||||||
|
|
||||||
|
#ifdef CPU_ARCH_X64
|
||||||
|
|
||||||
Log_SetChannel(Recompiler::CodeGenerator);
|
Log_SetChannel(Recompiler::CodeGenerator);
|
||||||
|
|
||||||
#ifdef ENABLE_HOST_DISASSEMBLY
|
#ifdef ENABLE_HOST_DISASSEMBLY
|
||||||
|
@ -3207,3 +3209,5 @@ void CodeGenerator::EmitLoadGlobalAddress(HostReg host_reg, const void* ptr)
|
||||||
m_emit->mov(GetHostReg64(host_reg), reinterpret_cast<size_t>(ptr));
|
m_emit->mov(GetHostReg64(host_reg), reinterpret_cast<size_t>(ptr));
|
||||||
}
|
}
|
||||||
} // namespace CPU::Recompiler
|
} // namespace CPU::Recompiler
|
||||||
|
|
||||||
|
#endif // CPU_ARCH_X64
|
||||||
|
|
|
@ -34,7 +34,7 @@
|
||||||
<key>CFBundlePackageType</key>
|
<key>CFBundlePackageType</key>
|
||||||
<string>APPL</string>
|
<string>APPL</string>
|
||||||
<key>NSHumanReadableCopyright</key>
|
<key>NSHumanReadableCopyright</key>
|
||||||
<string>Licensed under GPL version 3</string>
|
<string>2019-2023 Connor McLaughlin <stenzek@gmail.com></string>
|
||||||
<key>LSMinimumSystemVersion</key>
|
<key>LSMinimumSystemVersion</key>
|
||||||
<string>${CMAKE_OSX_DEPLOYMENT_TARGET}</string>
|
<string>${CMAKE_OSX_DEPLOYMENT_TARGET}</string>
|
||||||
<key>NSHighResolutionCapable</key>
|
<key>NSHighResolutionCapable</key>
|
||||||
|
|
Loading…
Reference in New Issue