[Build] Convert build system to raw cmake and remove premake layer

This commit is contained in:
Herman S.
2026-03-04 15:28:01 +09:00
parent f1bfb9416d
commit 71c5702ee8
106 changed files with 1829 additions and 3249 deletions

View File

@@ -0,0 +1,17 @@
add_library(xenia-cpu STATIC)
xe_platform_sources(xenia-cpu ${CMAKE_CURRENT_SOURCE_DIR})
xe_platform_sources(xenia-cpu ${CMAKE_CURRENT_SOURCE_DIR}/backend)
xe_platform_sources(xenia-cpu ${CMAKE_CURRENT_SOURCE_DIR}/compiler)
xe_platform_sources(xenia-cpu ${CMAKE_CURRENT_SOURCE_DIR}/compiler/passes)
xe_platform_sources(xenia-cpu ${CMAKE_CURRENT_SOURCE_DIR}/hir)
xe_platform_sources(xenia-cpu ${CMAKE_CURRENT_SOURCE_DIR}/ppc)
target_include_directories(xenia-cpu PRIVATE
${PROJECT_SOURCE_DIR}/third_party/llvm/include
)
target_link_libraries(xenia-cpu PUBLIC xenia-base mspack)
xe_target_defaults(xenia-cpu)
if(XENIA_BUILD_TESTS)
add_subdirectory(testing)
add_subdirectory(ppc/testing)
endif()

View File

@@ -0,0 +1,18 @@
add_library(xenia-cpu-backend-x64 STATIC)
xe_platform_sources(xenia-cpu-backend-x64 ${CMAKE_CURRENT_SOURCE_DIR})
target_compile_definitions(xenia-cpu-backend-x64 PRIVATE
CAPSTONE_X86_ATT_DISABLE
CAPSTONE_HAS_X86
CAPSTONE_USE_SYS_DYN_MEM
XBYAK_NO_OP_NAMES
XBYAK_ENABLE_OMITTED_OPERAND
)
# Optional VTune support
if(EXISTS "${PROJECT_SOURCE_DIR}/third_party/vtune")
target_compile_definitions(xenia-cpu-backend-x64 PRIVATE ENABLE_VTUNE=1)
endif()
target_include_directories(xenia-cpu-backend-x64 PRIVATE
${PROJECT_SOURCE_DIR}/third_party/capstone/include
)
target_link_libraries(xenia-cpu-backend-x64 PUBLIC capstone fmt xenia-base xenia-cpu)
xe_target_defaults(xenia-cpu-backend-x64)

View File

@@ -1,30 +0,0 @@
project_root = "../../../../.."
include(project_root.."/tools/build")
group("src")
project("xenia-cpu-backend-x64")
uuid("7d8d5dce-4696-4197-952a-09506f725afe")
kind("StaticLib")
language("C++")
links({
"capstone",
"fmt",
"xenia-base",
"xenia-cpu",
})
defines({
"CAPSTONE_X86_ATT_DISABLE",
"CAPSTONE_HAS_X86",
"CAPSTONE_USE_SYS_DYN_MEM",
"XBYAK_NO_OP_NAMES",
"XBYAK_ENABLE_OMITTED_OPERAND",
})
-- Enable VTune, if it's installed.
if os.isdir(project_root.."/third_party/vtune") then
defines { "ENABLE_VTUNE=1" }
end
includedirs({
project_root.."/third_party/capstone/include",
})
local_platform_files()

View File

@@ -0,0 +1,37 @@
if(NOT XENIA_BUILD_TESTS)
return()
endif()
add_executable(xenia-cpu-ppc-tests
${CMAKE_CURRENT_SOURCE_DIR}/ppc_testing_main.cc
)
# Add platform-specific console app main
if(WIN32)
target_sources(xenia-cpu-ppc-tests PRIVATE
${PROJECT_SOURCE_DIR}/src/xenia/base/console_app_main_win.cc)
else()
target_sources(xenia-cpu-ppc-tests PRIVATE
${PROJECT_SOURCE_DIR}/src/xenia/base/console_app_main_posix.cc)
endif()
# Add .s files but exclude from build (they're test data)
file(GLOB _ppc_asm "${CMAKE_CURRENT_SOURCE_DIR}/*.s")
target_sources(xenia-cpu-ppc-tests PRIVATE ${_ppc_asm})
set_source_files_properties(${_ppc_asm} PROPERTIES HEADER_FILE_ONLY TRUE)
target_link_libraries(xenia-cpu-ppc-tests PRIVATE
xenia-apu xenia-apu-nop
xenia-base xenia-core xenia-cpu
xenia-gpu xenia-gpu-null
xenia-hid xenia-hid-nop
xenia-kernel xenia-patcher xenia-ui xenia-vfs
capstone fmt imgui mspack
)
# x64 backend
if(CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64|AMD64")
target_link_libraries(xenia-cpu-ppc-tests PRIVATE xenia-cpu-backend-x64)
endif()
xe_target_defaults(xenia-cpu-ppc-tests)

View File

@@ -1,85 +0,0 @@
project_root = "../../../../.."
include(project_root.."/tools/build")
group("tests")
project("xenia-cpu-ppc-tests")
uuid("2a57d5ac-4024-4c49-9cd3-aa3a603c2ef8")
kind("ConsoleApp")
language("C++")
links({
"xenia-apu",
"xenia-apu-nop",
"xenia-base",
"xenia-core",
"xenia-cpu",
"xenia-gpu",
"xenia-gpu-null",
"xenia-hid",
"xenia-hid-nop",
"xenia-kernel",
"xenia-patcher",
"xenia-ui",
"xenia-vfs",
})
links({
"capstone",
"fmt",
"imgui",
"mspack",
})
files({
"ppc_testing_main.cc",
"../../../base/console_app_main_"..platform_suffix..".cc",
})
files({
"*.s",
})
filter("files:*.s")
flags({
"ExcludeFromBuild",
})
filter("architecture:x86_64")
links({
"xenia-cpu-backend-x64",
})
filter("platforms:Windows")
debugdir(project_root)
debugargs({
"2>&1",
"1>scratch/stdout-testing.txt",
})
filter({})
if ARCH == "ppc64" or ARCH == "powerpc64" then
project("xenia-cpu-ppc-nativetests")
uuid("E381E8EE-65CD-4D5E-9223-D9C03B2CE78C")
kind("ConsoleApp")
language("C++")
links({
"fmt",
"xenia-base",
})
files({
"ppc_testing_native_main.cc",
"../../../base/console_app_main_"..platform_suffix..".cc",
})
files({
"instr_*.s",
"seq_*.s",
})
filter("files:instr_*.s", "files:seq_*.s")
flags({
"ExcludeFromBuild",
})
filter({})
buildoptions({
"-Wa,-mregnames", -- Tell GAS to accept register names.
})
files({
"ppc_testing_native_thunks.s",
})
end

View File

@@ -1,27 +0,0 @@
project_root = "../../.."
include(project_root.."/tools/build")
group("src")
project("xenia-cpu")
uuid("0109c91e-5a04-41ab-9168-0d5187d11298")
kind("StaticLib")
language("C++")
links({
"xenia-base",
"mspack",
})
includedirs({
project_root.."/third_party/llvm/include",
})
local_platform_files()
local_platform_files("backend")
local_platform_files("compiler")
local_platform_files("compiler/passes")
local_platform_files("hir")
local_platform_files("ppc")
if enableTests then
include("testing")
include("ppc/testing")
end

View File

@@ -0,0 +1,7 @@
xe_test_suite(xenia-cpu-tests ${CMAKE_CURRENT_SOURCE_DIR}
LINKS
capstone fmt imgui
xenia-base xenia-core xenia-cpu xenia-gpu
xenia-hid-skylander xenia-kernel xenia-ui xenia-patcher
$<$<STREQUAL:${CMAKE_SYSTEM_PROCESSOR},x86_64>:xenia-cpu-backend-x64>
)

View File

@@ -1,28 +0,0 @@
project_root = "../../../.."
include(project_root.."/tools/build")
test_suite("xenia-cpu-tests", project_root, ".", {
links = {
"capstone",
"fmt",
"imgui",
"xenia-base",
"xenia-core",
"xenia-cpu",
"xenia-gpu",
"xenia-hid-skylander",
-- TODO(benvanik): cut these dependencies?
"xenia-kernel",
"xenia-ui", -- needed by xenia-base
"xenia-patcher",
},
filtered_links = {
{
filter = 'architecture:x86_64',
links = {
"xenia-cpu-backend-x64",
},
}
},
})