CMake: Support multiple CMAKE_OSX_ARCHITECTURES

This commit is contained in:
Stenzek
2023-11-24 19:14:57 +10:00
parent af86e5d058
commit 7cc52bba23
23 changed files with 106 additions and 82 deletions

View File

@ -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 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_sources(core PRIVATE ${RECOMPILER_SRCS} ${NEWREC_SOURCES}
cpu_recompiler_code_generator_x64.cpp
cpu_newrec_compiler_x64.cpp
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")
elseif(${CPU_ARCH} STREQUAL "aarch32")
endif()
if(CPU_ARCH_ARM32)
target_compile_definitions(core PUBLIC "ENABLE_RECOMPILER=1" "ENABLE_NEWREC=1")
target_sources(core PRIVATE ${RECOMPILER_SRCS} ${NEWREC_SOURCES}
cpu_recompiler_code_generator_aarch32.cpp
@ -151,7 +155,8 @@ elseif(${CPU_ARCH} STREQUAL "aarch32")
)
target_link_libraries(core PUBLIC vixl)
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_sources(core PRIVATE ${RECOMPILER_SRCS} ${NEWREC_SOURCES}
cpu_recompiler_code_generator_aarch64.cpp
@ -160,7 +165,8 @@ elseif(${CPU_ARCH} STREQUAL "aarch64")
)
target_link_libraries(core PUBLIC vixl)
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_sources(core PRIVATE ${NEWREC_SOURCES}
cpu_newrec_compiler_riscv64.cpp
@ -168,8 +174,6 @@ elseif(${CPU_ARCH} STREQUAL "riscv64")
)
target_link_libraries(core PUBLIC biscuit::biscuit riscv-disas)
message("Building RISC-V 64-bit recompiler")
else()
message("Not building recompiler")
endif()
if(ENABLE_DISCORD_PRESENCE)

View File

@ -14,6 +14,9 @@
#include "settings.h"
#include "timing_event.h"
#include <limits>
#ifdef CPU_ARCH_ARM32
Log_SetChannel(CPU::NewRec);
#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());
}
#endif // CPU_ARCH_ARM32

View File

@ -2,9 +2,12 @@
// SPDX-License-Identifier: (GPL-3.0 OR CC-BY-NC-ND-4.0)
#pragma once
#include "cpu_newrec_compiler.h"
#include <memory>
#ifdef CPU_ARCH_ARM32
#include "vixl/aarch32/assembler-aarch32.h"
#include "vixl/aarch32/operands-aarch32.h"
@ -162,3 +165,5 @@ private:
};
} // namespace CPU::NewRec
#endif // CPU_ARCH_ARM32

View File

@ -14,6 +14,9 @@
#include "settings.h"
#include "timing_event.h"
#include <limits>
#ifdef CPU_ARCH_ARM64
Log_SetChannel(CPU::NewRec);
#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());
}
#endif // CPU_ARCH_ARM64

View File

@ -5,6 +5,8 @@
#include "cpu_newrec_compiler.h"
#include <memory>
#ifdef CPU_ARCH_ARM64
#include "vixl/aarch64/assembler-aarch64.h"
namespace CPU::NewRec {
@ -163,3 +165,5 @@ private:
};
} // namespace CPU::NewRec
#endif // CPU_ARCH_ARM64

View File

@ -13,6 +13,9 @@
#include "settings.h"
#include "timing_event.h"
#include <limits>
#ifdef CPU_ARCH_RISCV64
Log_SetChannel(CPU::NewRec);
#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());
}
#endif // CPU_ARCH_RISCV64

View File

@ -5,6 +5,8 @@
#include "cpu_newrec_compiler.h"
#include <memory>
#ifdef CPU_ARCH_RISCV64
namespace CPU::NewRec {
class RISCV64Compiler final : public Compiler
@ -168,3 +170,5 @@ private:
};
} // namespace CPU::NewRec
#endif // CPU_ARCH_RISCV64

View File

@ -15,6 +15,9 @@
#include "settings.h"
#include "timing_event.h"
#include <limits>
#ifdef CPU_ARCH_X64
Log_SetChannel(CPU::NewRec);
#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());
}
#endif // CPU_ARCH_X64

View File

@ -3,9 +3,10 @@
#pragma once
#include "cpu_newrec_compiler.h"
#include <initializer_list>
#include <memory>
#ifdef CPU_ARCH_X64
namespace CPU::NewRec {
class X64Compiler final : public Compiler
@ -139,3 +140,5 @@ private:
};
} // namespace CPU::NewRec
#endif // CPU_ARCH_X64

View File

@ -12,6 +12,9 @@
#include "cpu_recompiler_thunks.h"
#include "settings.h"
#include "timing_event.h"
#ifdef CPU_ARCH_ARM32
Log_SetChannel(CPU::Recompiler);
#ifdef ENABLE_HOST_DISASSEMBLY
@ -2301,3 +2304,5 @@ void CodeGenerator::EmitLoadGlobalAddress(HostReg host_reg, const void* ptr)
}
} // namespace CPU::Recompiler
#endif // CPU_ARCH_ARM32

View File

@ -11,6 +11,9 @@
#include "cpu_recompiler_thunks.h"
#include "settings.h"
#include "timing_event.h"
#ifdef CPU_ARCH_ARM64
Log_SetChannel(CPU::Recompiler);
#ifdef ENABLE_HOST_DISASSEMBLY
@ -2592,3 +2595,5 @@ void CodeGenerator::EmitLoadGlobalAddress(HostReg host_reg, const void* ptr)
}
} // namespace CPU::Recompiler
#endif // CPU_ARCH_ARM64

View File

@ -13,6 +13,8 @@
#include "common/assert.h"
#include "common/log.h"
#ifdef CPU_ARCH_X64
Log_SetChannel(Recompiler::CodeGenerator);
#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));
}
} // namespace CPU::Recompiler
#endif // CPU_ARCH_X64

View File

@ -34,7 +34,7 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>NSHumanReadableCopyright</key>
<string>Licensed under GPL version 3</string>
<string>2019-2023 Connor McLaughlin &lt;stenzek@gmail.com&gt;</string>
<key>LSMinimumSystemVersion</key>
<string>${CMAKE_OSX_DEPLOYMENT_TARGET}</string>
<key>NSHighResolutionCapable</key>