[Build] Convert to cmake

This commit is contained in:
Herman S.
2026-04-15 13:56:23 +09:00
parent 1e27f0b83b
commit a12fdee02f
128 changed files with 2514 additions and 5626 deletions
+3 -15
View File
@@ -40,13 +40,6 @@ jobs:
with:
fetch-depth: 0
- name: Cache premake5
id: cache-premake5
uses: actions/cache@main
with:
path: tools/build/bin/premake5
key: ${{ runner.os }}-premake5-${{ hashFiles('third_party/premake-core/**') }}
- name: Cache Qt6
id: cache-qt-linux
uses: actions/cache@v3
@@ -86,7 +79,7 @@ jobs:
sudo apt-add-repository "deb http://apt.llvm.org/${UBUNTU_BASE}/ llvm-toolchain-${UBUNTU_BASE}-21 main"
sudo apt-get -y update
sudo apt-get -y install mesa-vulkan-drivers valgrind libc++-dev libc++abi-dev libsdl2-dev libvulkan-dev libx11-xcb-dev clang-21 ninja-build spirv-tools libxkbcommon-x11-0 libxcb-icccm4 libxcb-image0 libxcb-keysyms1 libxcb-randr0 libxcb-render-util0 libxcb-xinerama0 libxcb-cursor0 libxcb-shape0 libfontconfig1-dev libxtst-dev
sudo apt-get -y install mesa-vulkan-drivers valgrind libc++-dev libc++abi-dev libgtk-3-dev libsdl2-dev libvulkan-dev libx11-xcb-dev clang-21 lld-21 ninja-build cmake spirv-tools libxkbcommon-x11-0 libxcb-icccm4 libxcb-image0 libxcb-keysyms1 libxcb-randr0 libxcb-render-util0 libxcb-xinerama0 libxcb-cursor0 libxcb-shape0 libfontconfig1-dev libxtst-dev
# Install Vulkan SDK
if [ '${{ steps.cache-vulkan-sdk-linux.outputs.cache-hit }}' != 'true' ]; then
@@ -131,12 +124,7 @@ jobs:
# Update submodules if not cached
if [ '${{ steps.cache-submodules.outputs.cache-hit }}' != 'true' ]; then
git submodule update --init --depth=1 -j$(getconf _NPROCESSORS_ONLN) $(grep -oP '(?<=path = )(?!third_party\/(DirectXShaderCompiler|premake-(androidndk|export-compile-commands))).+' .gitmodules)
fi
if [ '${{ steps.cache-premake5.outputs.cache-hit }}' != 'true' ]; then
./xenia-build.py premake
cp third_party/premake-core/bin/release/premake5 tools/build/bin
git submodule update --init --depth=1 -j$(getconf _NPROCESSORS_ONLN) $(grep -oP '(?<=path = )(?!third_party\/DirectXShaderCompiler).+' .gitmodules)
fi
# Fetch data repos (game-patches, optimized-settings)
@@ -310,7 +298,7 @@ jobs:
$cacheHit = '${{ steps.cache-submodules.outputs.cache-hit }}'
if ($cacheHit -ne 'true') {
git submodule update --init --depth=1 -j $env:NUMBER_OF_PROCESSORS (Select-String -CaseSensitive '(?<=path = )(?!third_party\/(premake-(androidndk|cmake|export-compile-commands))).+' .gitmodules).Matches.Value
git submodule update --init --depth=1 -j $env:NUMBER_OF_PROCESSORS (Select-String -CaseSensitive '(?<=path = ).+' .gitmodules).Matches.Value
}
# Fetch data repos (game-patches, optimized-settings)
+6
View File
@@ -94,7 +94,13 @@ node_modules/.bin/
# coverage/etc
/scratch/
# CMake build trees
/build/
/build-vs/
# CMake user-specific overrides + compile commands export
CMakeUserPresets.json
/compile_commands.json
# ==============================================================================
# Local-only paths
-12
View File
@@ -7,16 +7,10 @@
[submodule "third_party/catch"]
path = third_party/catch
url = https://github.com/catchorg/Catch2.git
[submodule "third_party/premake-core"]
path = third_party/premake-core
url = https://github.com/premake/premake-core.git
[submodule "third_party/snappy"]
path = third_party/snappy
url = https://github.com/google/snappy.git
ignore = dirty
[submodule "third_party/premake-export-compile-commands"]
path = third_party/premake-export-compile-commands
url = https://github.com/xenia-project/premake-export-compile-commands.git
[submodule "third_party/discord-rpc"]
path = third_party/discord-rpc
url = https://github.com/discordapp/discord-rpc.git
@@ -50,9 +44,6 @@
[submodule "third_party/DirectXShaderCompiler"]
path = third_party/DirectXShaderCompiler
url = https://github.com/microsoft/DirectXShaderCompiler.git
[submodule "third_party/premake-cmake"]
path = third_party/premake-cmake
url = https://github.com/JoelLinn/premake-cmake.git
[submodule "third_party/date"]
path = third_party/date
url = https://github.com/HowardHinnant/date.git
@@ -63,9 +54,6 @@
path = third_party/FFmpeg
url = https://github.com/has207/FFmpeg.git
branch = xmaframes
[submodule "third_party/premake-androidndk"]
path = third_party/premake-androidndk
url = https://github.com/Triang3l/premake-androidndk.git
[submodule "third_party/FidelityFX-CAS"]
path = third_party/FidelityFX-CAS
url = https://github.com/GPUOpen-Effects/FidelityFX-CAS.git
+326
View File
@@ -0,0 +1,326 @@
cmake_minimum_required(VERSION 3.20)
project(xenia LANGUAGES C CXX)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_C_STANDARD 17)
set(CMAKE_C_STANDARD_REQUIRED ON)
option(XENIA_BUILD_TESTS "Build test suites" OFF)
option(XENIA_BUILD_MISC "Build misc subprojects (trace viewers, shader compiler, vfs-dump, demos)" OFF)
option(XENIA_ENABLE_LTO "Enable link-time optimization in Release (slow link)" ON)
get_property(_is_multi_config GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
if(_is_multi_config)
set(CMAKE_CONFIGURATION_TYPES "Checked;Debug;Release;Valgrind" CACHE STRING "" FORCE)
endif()
# Checked and Valgrind inherit Debug's flags as a starting point; the
# platform blocks below layer sanitizers and config-specific tweaks on top.
foreach(_cfg CHECKED VALGRIND)
set(CMAKE_C_FLAGS_${_cfg} "${CMAKE_C_FLAGS_DEBUG}" CACHE STRING "" FORCE)
set(CMAKE_CXX_FLAGS_${_cfg} "${CMAKE_CXX_FLAGS_DEBUG}" CACHE STRING "" FORCE)
set(CMAKE_EXE_LINKER_FLAGS_${_cfg} "${CMAKE_EXE_LINKER_FLAGS_DEBUG}" CACHE STRING "" FORCE)
set(CMAKE_SHARED_LINKER_FLAGS_${_cfg} "${CMAKE_SHARED_LINKER_FLAGS_DEBUG}" CACHE STRING "" FORCE)
set(CMAKE_STATIC_LINKER_FLAGS_${_cfg} "${CMAKE_STATIC_LINKER_FLAGS_DEBUG}" CACHE STRING "" FORCE)
endforeach()
if(WIN32)
set(XE_PLATFORM_NAME "Windows")
else()
set(XE_PLATFORM_NAME "Linux")
endif()
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin/${XE_PLATFORM_NAME}")
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin/${XE_PLATFORM_NAME}")
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/obj/${XE_PLATFORM_NAME}")
file(MAKE_DIRECTORY "${PROJECT_SOURCE_DIR}/scratch")
find_package(Python3 REQUIRED COMPONENTS Interpreter)
# Debug/Checked/Valgrind are compiled against the release CRT (/MD) so we
# can link the Vulkan SDK's release-only SPIRV-Tools libs. Force any
# imported library (Qt6::*, etc.) to resolve to its Release variant in
# those configs too — otherwise Qt6*d.dll drags in /MDd and the process
# ends up mixing two CRTs, corrupting std::string/QString allocations.
# NOCONFIG is the fallback for imported targets that ship without a
# configuration suffix (FindOpenGL on Linux creates OpenGL::OpenGL this
# way — without NOCONFIG in the map we fail to resolve it in Debug et al).
set(CMAKE_MAP_IMPORTED_CONFIG_DEBUG "Release;NOCONFIG" CACHE STRING "" FORCE)
set(CMAKE_MAP_IMPORTED_CONFIG_CHECKED "Release;NOCONFIG" CACHE STRING "" FORCE)
set(CMAKE_MAP_IMPORTED_CONFIG_VALGRIND "Release;NOCONFIG" CACHE STRING "" FORCE)
include(cmake/XeniaHelpers.cmake)
include_directories(
${PROJECT_SOURCE_DIR}
${PROJECT_SOURCE_DIR}/src
${PROJECT_SOURCE_DIR}/third_party
# Build directory — for `#include "version.h"` (generated by xenia-build.py
# into CMAKE_BINARY_DIR, which varies per configure: build/, build-vs/, ...).
${CMAKE_BINARY_DIR}
)
add_compile_definitions(
VULKAN_HPP_NO_TO_STRING
IMGUI_DISABLE_OBSOLETE_FUNCTIONS
IMGUI_DISABLE_DEFAULT_FONT
IMGUI_USE_STB_SPRINTF
USE_CPP17 # Tabulate
_LIB
)
# ==============================================================================
# Qt6 (optional, gated on the QT_DIR env var)
# ==============================================================================
set(XE_QT_DIR "$ENV{QT_DIR}")
if(XE_QT_DIR)
list(PREPEND CMAKE_PREFIX_PATH "${XE_QT_DIR}")
set(QT_NO_PRIVATE_MODULE_WARNING ON)
find_package(Qt6 COMPONENTS Core Gui GuiPrivate Widgets QUIET)
if(Qt6_FOUND)
message(STATUS "Qt6: using QT_DIR=${XE_QT_DIR} (version ${Qt6_VERSION})")
set(CMAKE_AUTOMOC ON)
# CMAKE_INCLUDE_CURRENT_DIR is intentionally off. Setting it globally
# would add each target's source dir to its include path, and
# src/xenia/base contains files named assert.h / string.h / memory.h /
# mutex.h that collide with C/C++ standard headers. Targets that need
# their source dir on the path (xenia-ui, so AUTOMOC-generated moc
# files can find Q_OBJECT headers) add it via target_include_directories.
if(NOT WIN32)
add_link_options("-Wl,-rpath,${XE_QT_DIR}/lib")
endif()
set(XE_HAS_QT TRUE)
# Qt6 pulls in third-party find-modules (FindOpenGL, FindXKB, …) that
# create UNKNOWN IMPORTED targets with only a bare IMPORTED_LOCATION (no
# config suffix). Ninja Multi-Config can't map NOCONFIG locations for
# custom configs even with CMAKE_MAP_IMPORTED_CONFIG_*. Re-tag every
# such target as Release so the existing MAP resolves them correctly.
get_property(_imported_targets DIRECTORY PROPERTY IMPORTED_TARGETS)
foreach(_tgt IN LISTS _imported_targets)
get_target_property(_loc ${_tgt} IMPORTED_LOCATION)
if(_loc AND NOT _loc MATCHES "-NOTFOUND$")
get_target_property(_confs ${_tgt} IMPORTED_CONFIGURATIONS)
if(NOT _confs OR _confs MATCHES "-NOTFOUND$")
set_target_properties(${_tgt} PROPERTIES
IMPORTED_CONFIGURATIONS "Release"
IMPORTED_LOCATION_RELEASE "${_loc}"
)
endif()
endif()
endforeach()
else()
message(WARNING "QT_DIR=${XE_QT_DIR} is set but find_package(Qt6) failed; building without Qt")
endif()
endif()
# ==============================================================================
# Platform-specific global settings
# ==============================================================================
if(MSVC)
# CRT runtime selection via CMP0091. Debug and Release use the release
# CRT (/MD); Checked uses the debug CRT (/MDd) because it pairs /RTCsu
# with ASan.
set(CMAKE_MSVC_RUNTIME_LIBRARY
"MultiThreaded$<$<CONFIG:Checked>:Debug>DLL"
CACHE STRING "" FORCE)
add_compile_options(
/utf-8 # non-Latin-codepage-safe source parsing
/Zc:__cplusplus # correct __cplusplus macro value (Qt6 needs this)
/Zc:preprocessor # conformant preprocessor
/wd4201 # nameless struct/unions are ok
/arch:AVX
/MP
)
add_compile_definitions(
_CRT_NONSTDC_NO_DEPRECATE
_CRT_SECURE_NO_WARNINGS
WIN32
_WIN64=1
_AMD64=1
UNICODE
_UNICODE
)
add_link_options(
/ignore:4006 # duplicate symbols in static libs
/ignore:4221 # empty obj files
)
link_libraries(
ntdll wsock32 ws2_32 xinput comctl32 shcore shlwapi dxguid bcrypt
)
# Checked: /RTCsu + ASan + debug symbols. /RTC1 from CMake's default
# Debug flags conflicts with /RTCsu, so strip it first.
string(REPLACE "/RTC1" "" CMAKE_C_FLAGS_CHECKED "${CMAKE_C_FLAGS_CHECKED}")
string(REPLACE "/RTC1" "" CMAKE_CXX_FLAGS_CHECKED "${CMAKE_CXX_FLAGS_CHECKED}")
string(APPEND CMAKE_C_FLAGS_CHECKED " /RTCsu /fsanitize=address /Zi")
string(APPEND CMAKE_CXX_FLAGS_CHECKED " /RTCsu /fsanitize=address /Zi")
string(APPEND CMAKE_EXE_LINKER_FLAGS_CHECKED " /INCREMENTAL:NO")
add_compile_definitions(
$<$<CONFIG:Checked>:DEBUG>
$<$<CONFIG:Checked>:NDEBUG>
# STB_SPRINTF is incompatible with ASan runtime hooks.
$<$<CONFIG:Checked>:IMGUI_USE_STB_SPRINTF_DISABLED>
)
# Debug: /RTC1 requires the debug CRT, so strip it — we're on /MD. Pin
# _ITERATOR_DEBUG_LEVEL=0 so our STL object layouts match release-CRT
# prebuilts (Vulkan SDK SPIRV-Tools) and we don't hit LNK2038.
string(REPLACE "/RTC1" "" CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG}")
string(REPLACE "/RTC1" "" CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}")
add_compile_definitions(
$<$<CONFIG:Debug>:DEBUG>
$<$<CONFIG:Debug>:_NO_DEBUG_HEAP=1>
$<$<CONFIG:Debug>:_ITERATOR_DEBUG_LEVEL=0>
)
add_compile_definitions(
$<$<CONFIG:Release>:NDEBUG>
$<$<CONFIG:Release>:_NO_DEBUG_HEAP=1>
)
add_compile_options(
$<$<CONFIG:Release>:/Gw>
$<$<CONFIG:Release>:/GS-> # NoBufferSecurityCheck
)
# /Ob3 is a stronger inline heuristic than CMake's default /Ob2.
string(REPLACE "/Ob2" "/Ob3" CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE}")
string(REPLACE "/Ob2" "/Ob3" CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}")
# LTCG (whole-program optimization). Disabled by -DXENIA_ENABLE_LTO=OFF
# for faster Release link times during iterative work.
if(XENIA_ENABLE_LTO)
add_compile_options($<$<CONFIG:Release>:/GL>)
add_link_options($<$<CONFIG:Release>:/LTCG>)
set(CMAKE_STATIC_LINKER_FLAGS_RELEASE "${CMAKE_STATIC_LINKER_FLAGS_RELEASE} /LTCG")
endif()
# Release has no PDB.
string(REPLACE "/Zi" "" CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE}")
string(REPLACE "/Zi" "" CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}")
string(REPLACE "/DEBUG" "" CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE}")
else()
# GCC/Clang (Linux)
add_compile_options(-mavx)
add_compile_options(
$<$<COMPILE_LANGUAGE:CXX>:-Wno-switch>
$<$<COMPILE_LANGUAGE:CXX>:-Wno-attributes>
)
if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
add_compile_options(
$<$<COMPILE_LANGUAGE:CXX>:-Wno-deprecated-register>
$<$<COMPILE_LANGUAGE:CXX>:-Wno-deprecated-volatile>
$<$<COMPILE_LANGUAGE:CXX>:-Wno-deprecated-enum-enum-conversion>
)
if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 20)
add_compile_options(
$<$<COMPILE_LANGUAGE:CXX>:-Wno-deprecated-literal-operator>
$<$<COMPILE_LANGUAGE:CXX>:-Wno-nontrivial-memcall>
)
endif()
if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 21)
add_compile_options(
$<$<COMPILE_LANGUAGE:CXX>:-Wno-character-conversion>
)
endif()
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
add_compile_options(
$<$<COMPILE_LANGUAGE:CXX>:-Wno-unused-result>
$<$<COMPILE_LANGUAGE:CXX>:-Wno-volatile>
$<$<COMPILE_LANGUAGE:CXX>:-Wno-template-id-cdtor>
$<$<COMPILE_LANGUAGE:CXX>:-Wno-return-type>
$<$<COMPILE_LANGUAGE:CXX>:-Wno-deprecated>
-fpermissive # HACK
)
add_link_options(-fpermissive)
endif()
add_compile_options(
$<$<COMPILE_LANGUAGE:C>:-Wno-implicit-function-declaration>
)
find_package(PkgConfig REQUIRED)
pkg_check_modules(GTK3 REQUIRED gtk+-x11-3.0)
include_directories(${GTK3_INCLUDE_DIRS})
link_directories(${GTK3_LIBRARY_DIRS})
add_compile_options(${GTK3_CFLAGS_OTHER})
link_libraries(stdc++fs dl lz4 m pthread rt)
# Link group so executables resolve circular static-lib deps.
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--start-group")
set(CMAKE_CXX_STANDARD_LIBRARIES "${CMAKE_CXX_STANDARD_LIBRARIES} -Wl,--end-group")
# Checked: UBSan.
string(APPEND CMAKE_C_FLAGS_CHECKED " -fsanitize=undefined")
string(APPEND CMAKE_CXX_FLAGS_CHECKED " -fsanitize=undefined")
string(APPEND CMAKE_EXE_LINKER_FLAGS_CHECKED " -fsanitize=undefined")
add_compile_definitions(
$<$<CONFIG:Checked>:DEBUG>
$<$<CONFIG:Checked>:NDEBUG>
)
add_compile_definitions(
$<$<CONFIG:Debug>:DEBUG>
$<$<CONFIG:Debug>:_NO_DEBUG_HEAP=1>
)
# Release keeps -g so crashes in the field have resolvable frames.
add_compile_definitions(
$<$<CONFIG:Release>:NDEBUG>
$<$<CONFIG:Release>:_NO_DEBUG_HEAP=1>
)
add_compile_options(
$<$<CONFIG:Release>:-O3>
$<$<CONFIG:Release>:-finline-functions>
$<$<CONFIG:Release>:-funroll-loops>
$<$<CONFIG:Release>:-fomit-frame-pointer>
$<$<CONFIG:Release>:-g>
)
# ThinLTO + lld. Gated behind XENIA_ENABLE_LTO so -DXENIA_ENABLE_LTO=OFF
# produces a Release binary with the standard system linker and no LTO,
# which links an order of magnitude faster during iterative work.
if(XENIA_ENABLE_LTO)
add_compile_options($<$<CONFIG:Release>:-flto=thin>)
add_link_options(
$<$<CONFIG:Release>:-flto=thin>
$<$<CONFIG:Release>:-fuse-ld=lld>
)
endif()
# Valgrind: -Og for debuggability without the pathological debug perf
# cost, no sanitizers (they fight valgrind), no inlining so stack
# traces reflect source structure.
string(APPEND CMAKE_C_FLAGS_VALGRIND " -Og -g3 -fno-omit-frame-pointer -fno-inline-functions")
string(APPEND CMAKE_CXX_FLAGS_VALGRIND " -Og -g3 -fno-omit-frame-pointer -fno-inline-functions")
add_compile_definitions(
$<$<CONFIG:Valgrind>:DEBUG>
$<$<CONFIG:Valgrind>:NDEBUG>
$<$<CONFIG:Valgrind>:_NO_DEBUG_HEAP=1>
)
endif()
# ==============================================================================
# Subdirectories
# ==============================================================================
# third_party is added before Qt is made directory-global so its libs
# don't pull Qt into their compile lines.
add_subdirectory(third_party)
# Qt headers reach into src/xenia/kernel, src/xenia/gpu, etc. via
# transitive includes of app/emulator_window.h and ui/*_qt.h — not just
# the targets with Q_OBJECT. Linking Qt at directory scope keeps all
# xenia src libs consistent.
if(XE_HAS_QT)
link_libraries(Qt6::Core Qt6::Gui Qt6::Widgets)
endif()
add_subdirectory(src/xenia)
set_property(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY VS_STARTUP_PROJECT xenia-app)
+60
View File
@@ -0,0 +1,60 @@
{
"version": 3,
"cmakeMinimumRequired": {
"major": 3,
"minor": 20,
"patch": 0
},
"configurePresets": [
{
"name": "default",
"displayName": "Ninja Multi-Config",
"generator": "Ninja Multi-Config",
"binaryDir": "${sourceDir}/build"
},
{
"name": "vs",
"displayName": "Visual Studio 2022",
"generator": "Visual Studio 17 2022",
"architecture": "x64",
"binaryDir": "${sourceDir}/build"
}
],
"buildPresets": [
{
"name": "debug",
"configurePreset": "default",
"configuration": "Debug"
},
{
"name": "release",
"configurePreset": "default",
"configuration": "Release"
},
{
"name": "checked",
"configurePreset": "default",
"configuration": "Checked"
},
{
"name": "valgrind",
"configurePreset": "default",
"configuration": "Valgrind"
},
{
"name": "vs-debug",
"configurePreset": "vs",
"configuration": "Debug"
},
{
"name": "vs-release",
"configurePreset": "vs",
"configuration": "Release"
},
{
"name": "vs-checked",
"configurePreset": "vs",
"configuration": "Checked"
}
]
}
+242
View File
@@ -0,0 +1,242 @@
# Helper functions for the xenia build.
include(CMakeParseArguments)
set(XE_PLATFORM_SUFFIXES
_win _linux _posix _gnulinux _x11 _gtk _android _mac
)
# xe_platform_sources(target base_path [RECURSIVE])
#
# Globs source files from base_path and adds them to target. Excludes
# *_main.cc / *_test.cc / *_demo.cc, and any file with a platform suffix
# that doesn't match the current platform. RECURSIVE descends into
# subdirectories.
function(xe_platform_sources target base_path)
set(options RECURSIVE)
cmake_parse_arguments(ARG "${options}" "" "" ${ARGN})
if(ARG_RECURSIVE)
set(glob_mode GLOB_RECURSE)
else()
set(glob_mode GLOB)
endif()
file(${glob_mode} _all_sources
"${base_path}/*.h"
"${base_path}/*.cc"
"${base_path}/*.cpp"
"${base_path}/*.c"
"${base_path}/*.inc"
)
set(_excluded)
foreach(src ${_all_sources})
get_filename_component(_name_we ${src} NAME_WE)
if(_name_we MATCHES "_main$" OR _name_we MATCHES "_test$" OR _name_we MATCHES "_demo$")
list(APPEND _excluded ${src})
continue()
endif()
foreach(suffix ${XE_PLATFORM_SUFFIXES})
if(_name_we MATCHES "${suffix}$")
list(APPEND _excluded ${src})
break()
endif()
endforeach()
endforeach()
set(_sources ${_all_sources})
if(_excluded)
list(REMOVE_ITEM _sources ${_excluded})
endif()
if(WIN32)
file(${glob_mode} _plat_sources
"${base_path}/*_win.h"
"${base_path}/*_win.cc"
)
elseif(CMAKE_SYSTEM_NAME STREQUAL "Linux")
file(${glob_mode} _plat_sources
"${base_path}/*_posix.h"
"${base_path}/*_posix.cc"
"${base_path}/*_linux.h"
"${base_path}/*_linux.cc"
"${base_path}/*_gnulinux.h"
"${base_path}/*_gnulinux.cc"
"${base_path}/*_x11.h"
"${base_path}/*_x11.cc"
"${base_path}/*_gtk.h"
"${base_path}/*_gtk.cc"
)
endif()
list(APPEND _sources ${_plat_sources})
target_sources(${target} PRIVATE ${_sources})
endfunction()
# xe_target_defaults(target)
#
# Applies xenia-wide compile defaults to a target: project-root include
# directories and warnings-as-errors. GCC is excluded from -Werror because
# it's too noisy to keep clean across the codebase.
function(xe_target_defaults target)
target_include_directories(${target} PRIVATE
${PROJECT_SOURCE_DIR}
${PROJECT_SOURCE_DIR}/src
${PROJECT_SOURCE_DIR}/third_party
)
if(MSVC)
target_compile_options(${target} PRIVATE /WX)
elseif(NOT CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
target_compile_options(${target} PRIVATE -Werror)
endif()
endfunction()
# xe_shader_rules_spirv(target shader_dir)
#
# Wires up SPIR-V shader compilation (glslang + spirv-opt + spirv-dis,
# via tools/build/compile_shader_spirv.py) as a prerequisite of target.
# Sources are *.xesl / *.glsl with a stage suffix (vs/hs/ds/gs/ps/cs);
# outputs land in <shader_dir>/bytecode/vulkan_spirv/<id>.h. A stamp
# file drives incremental rebuilds when any source or the compile
# script changes.
function(xe_shader_rules_spirv target shader_dir)
get_filename_component(shader_dir "${shader_dir}" ABSOLUTE)
file(GLOB _sources
"${shader_dir}/*.xesl" "${shader_dir}/*.glsl"
"${shader_dir}/*.xesli" "${shader_dir}/*.glsli")
set(_stamp "${CMAKE_CURRENT_BINARY_DIR}/${target}_spirv.stamp")
set(_script "${PROJECT_SOURCE_DIR}/tools/build/compile_shader_spirv.py")
set(_valid_stages vs hs ds gs ps cs)
set(_commands)
set(_bytecode_dir "${shader_dir}/bytecode/vulkan_spirv")
list(APPEND _commands COMMAND ${CMAKE_COMMAND} -E make_directory "${_bytecode_dir}")
foreach(src ${_sources})
get_filename_component(_name ${src} NAME)
string(REGEX REPLACE "\\.[^.]+$" "" _basename "${_name}")
string(REPLACE "." "_" _id "${_basename}")
string(LENGTH "${_id}" _len)
if(_len LESS 3)
continue()
endif()
math(EXPR _s "${_len} - 2")
string(SUBSTRING "${_id}" ${_s} 2 _stage)
if(NOT _stage IN_LIST _valid_stages)
continue()
endif()
list(APPEND _commands COMMAND ${Python3_EXECUTABLE} "${_script}" "${src}" "${_bytecode_dir}/${_id}.h")
endforeach()
add_custom_command(
OUTPUT "${_stamp}"
${_commands}
COMMAND ${CMAKE_COMMAND} -E touch "${_stamp}"
DEPENDS ${_sources} "${_script}"
COMMENT "Compiling SPIR-V shaders for ${target}..."
VERBATIM
)
add_custom_target(${target}-spirv-shaders DEPENDS "${_stamp}")
add_dependencies(${target} ${target}-spirv-shaders)
# Attach sources to the target for IDE visibility without letting VS
# try to compile them as C++.
set_source_files_properties(${_sources} PROPERTIES HEADER_FILE_ONLY TRUE)
target_sources(${target} PRIVATE ${_sources})
endfunction()
# xe_shader_rules_dxbc(target shader_dir)
#
# DXBC counterpart to xe_shader_rules_spirv: invokes FXC via
# tools/build/compile_shader_dxbc.py on each stage-suffixed *.xesl /
# *.hlsl under shader_dir, emitting <shader_dir>/bytecode/d3d12_5_1/<id>.h.
function(xe_shader_rules_dxbc target shader_dir)
get_filename_component(shader_dir "${shader_dir}" ABSOLUTE)
file(GLOB _sources
"${shader_dir}/*.xesl" "${shader_dir}/*.hlsl"
"${shader_dir}/*.xesli" "${shader_dir}/*.hlsli")
set(_stamp "${CMAKE_CURRENT_BINARY_DIR}/${target}_dxbc.stamp")
set(_script "${PROJECT_SOURCE_DIR}/tools/build/compile_shader_dxbc.py")
set(_valid_stages vs hs ds gs ps cs)
set(_commands)
set(_bytecode_dir "${shader_dir}/bytecode/d3d12_5_1")
list(APPEND _commands COMMAND ${CMAKE_COMMAND} -E make_directory "${_bytecode_dir}")
foreach(src ${_sources})
get_filename_component(_name ${src} NAME)
string(REGEX REPLACE "\\.[^.]+$" "" _basename "${_name}")
string(REPLACE "." "_" _id "${_basename}")
string(LENGTH "${_id}" _len)
if(_len LESS 3)
continue()
endif()
math(EXPR _s "${_len} - 2")
string(SUBSTRING "${_id}" ${_s} 2 _stage)
if(NOT _stage IN_LIST _valid_stages)
continue()
endif()
list(APPEND _commands COMMAND ${Python3_EXECUTABLE} "${_script}" "${src}" "${_bytecode_dir}/${_id}.h")
endforeach()
add_custom_command(
OUTPUT "${_stamp}"
${_commands}
COMMAND ${CMAKE_COMMAND} -E touch "${_stamp}"
DEPENDS ${_sources} "${_script}"
COMMENT "Compiling DXBC shaders for ${target}..."
VERBATIM
)
add_custom_target(${target}-dxbc-shaders DEPENDS "${_stamp}")
add_dependencies(${target} ${target}-dxbc-shaders)
set_source_files_properties(${_sources} PROPERTIES HEADER_FILE_ONLY TRUE)
target_sources(${target} PRIVATE ${_sources})
endfunction()
# xe_force_c(files...) — compile the given sources as C.
function(xe_force_c)
set_source_files_properties(${ARGN} PROPERTIES LANGUAGE C)
endfunction()
# xe_force_cxx(files...) — compile the given sources as C++.
function(xe_force_cxx)
set_source_files_properties(${ARGN} PROPERTIES LANGUAGE CXX)
endfunction()
# xe_test_suite(name base_path LINKS lib1 lib2 ...)
#
# Creates a Catch2 test executable from *_test.cc files in base_path.
# Returns early (no target) if no test sources are found.
function(xe_test_suite name base_path)
cmake_parse_arguments(ARG "" "" "LINKS" ${ARGN})
file(GLOB _test_sources "${base_path}/*_test.cc")
if(NOT _test_sources)
return()
endif()
add_executable(${name}
${_test_sources}
${PROJECT_SOURCE_DIR}/tools/build/src/test_suite_main.cc
)
if(WIN32)
target_sources(${name} PRIVATE
${PROJECT_SOURCE_DIR}/src/xenia/base/console_app_main_win.cc)
else()
target_sources(${name} PRIVATE
${PROJECT_SOURCE_DIR}/src/xenia/base/console_app_main_posix.cc)
endif()
target_compile_definitions(${name} PRIVATE
"XE_TEST_SUITE_NAME=\"${name}\""
)
target_include_directories(${name} PRIVATE
${PROJECT_SOURCE_DIR}/tools/build
${PROJECT_SOURCE_DIR}/tools/build/src
${PROJECT_SOURCE_DIR}/tools/build/third_party/catch/include
)
if(ARG_LINKS)
target_link_libraries(${name} PRIVATE ${ARG_LINKS})
endif()
xe_target_defaults(${name})
if(MSVC)
# Edit-and-Continue rewrites __LINE__ and breaks Catch2 test discovery.
target_compile_options(${name} PRIVATE /Zi)
endif()
endfunction()
-558
View File
File diff suppressed because it is too large Load Diff
+46
View File
@@ -0,0 +1,46 @@
# xenia-core: the loose .h/.cc files directly under src/xenia/ (emulator,
# kernel_state, etc.) that aren't part of any specific submodule.
add_library(xenia-core STATIC)
file(GLOB _core_sources
"${CMAKE_CURRENT_SOURCE_DIR}/*.h"
"${CMAKE_CURRENT_SOURCE_DIR}/*.cc"
)
target_sources(xenia-core PRIVATE ${_core_sources})
target_link_libraries(xenia-core PUBLIC fmt xenia-base)
xe_target_defaults(xenia-core)
add_subdirectory(base)
add_subdirectory(cpu)
add_subdirectory(cpu/backend/x64)
add_subdirectory(apu)
add_subdirectory(apu/nop)
add_subdirectory(apu/sdl)
add_subdirectory(gpu)
add_subdirectory(gpu/null)
add_subdirectory(gpu/vulkan)
add_subdirectory(helper/sdl)
add_subdirectory(hid)
add_subdirectory(hid/nop)
add_subdirectory(hid/sdl)
add_subdirectory(hid/skylander)
add_subdirectory(kernel)
add_subdirectory(patcher)
add_subdirectory(ui)
add_subdirectory(ui/vulkan)
add_subdirectory(vfs)
add_subdirectory(debug/ui)
add_subdirectory(app/discord)
add_subdirectory(app)
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
add_subdirectory(apu/alsa)
endif()
if(WIN32)
add_subdirectory(apu/xaudio2)
add_subdirectory(debug/gdb)
add_subdirectory(gpu/d3d12)
add_subdirectory(hid/winkey)
add_subdirectory(hid/xinput)
add_subdirectory(ui/d3d12)
endif()
+172
View File
@@ -0,0 +1,172 @@
if(WIN32)
add_executable(xenia-app WIN32)
else()
add_executable(xenia-app)
endif()
set_target_properties(xenia-app PROPERTIES OUTPUT_NAME "xenia_edge")
target_sources(xenia-app PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/xenia_main.cc
)
xe_platform_sources(xenia-app ${CMAKE_CURRENT_SOURCE_DIR})
# Qt owns the windowed main entry point; one implementation is shared
# across platforms.
target_sources(xenia-app PRIVATE
${PROJECT_SOURCE_DIR}/src/xenia/ui/windowed_app_main_qt.cc
)
if(WIN32)
target_sources(xenia-app PRIVATE
${PROJECT_SOURCE_DIR}/src/xenia/base/main_init_win.cc
${CMAKE_CURRENT_SOURCE_DIR}/main_resources.rc
${PROJECT_SOURCE_DIR}/src/xenia/base/app_win32.manifest
)
# main_init runs the AVX feature check — it must itself not use AVX.
set_source_files_properties(
${PROJECT_SOURCE_DIR}/src/xenia/base/main_init_win.cc
PROPERTIES COMPILE_OPTIONS "/arch:SSE2"
)
# WIN32 executable defaults to /SUBSYSTEM:WINDOWS; override to CONSOLE
# in Debug so stdout/stderr reach an attached terminal. /ENTRY points
# at the Qt-style main() rather than WinMain.
target_link_options(xenia-app PRIVATE
$<$<CONFIG:Debug>:/SUBSYSTEM:CONSOLE>
/ENTRY:mainCRTStartup
)
else()
target_sources(xenia-app PRIVATE
${PROJECT_SOURCE_DIR}/src/xenia/base/main_init_posix.cc
)
if(NOT MSVC)
set_source_files_properties(
${PROJECT_SOURCE_DIR}/src/xenia/base/main_init_posix.cc
PROPERTIES COMPILE_OPTIONS "-msse2;-mno-avx"
)
endif()
endif()
target_compile_definitions(xenia-app PRIVATE
XBYAK_NO_OP_NAMES
XBYAK_ENABLE_OMITTED_OPERAND
)
target_link_libraries(xenia-app PRIVATE
xenia-apu
xenia-apu-nop
xenia-base
xenia-core
xenia-cpu
xenia-gpu
xenia-gpu-null
xenia-gpu-vulkan
xenia-hid
xenia-hid-nop
xenia-kernel
xenia-patcher
xenia-ui
xenia-ui-vulkan
xenia-vfs
aes_128
capstone
fmt
dxbc
discord-rpc
glslang-spirv
imgui
libavcodec
libavutil
mspack
snappy
xxhash
xenia-app-discord
xenia-apu-sdl
xenia-debug-ui
xenia-helper-sdl
xenia-hid-sdl
)
if(CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64|AMD64")
target_link_libraries(xenia-app PRIVATE xenia-cpu-backend-x64)
endif()
if(WIN32)
target_link_libraries(xenia-app PRIVATE
xenia-apu-xaudio2
xenia-debug-gdb
xenia-gpu-d3d12
xenia-hid-winkey
xenia-hid-xinput
xenia-ui-d3d12
)
elseif(CMAKE_SYSTEM_NAME STREQUAL "Linux")
target_link_libraries(xenia-app PRIVATE
xenia-apu-alsa
X11
xcb
X11-xcb
SDL2
)
endif()
xe_target_defaults(xenia-app)
# ==============================================================================
# Post-build: Qt deployment and runtime asset copy
# ==============================================================================
set(_edge_assets_font_src "${PROJECT_SOURCE_DIR}/assets/font")
set(_edge_optimized_src "${PROJECT_SOURCE_DIR}/.data_repos/optimized-settings/settings")
set(_edge_game_patches_src "${PROJECT_SOURCE_DIR}/.data_repos/game-patches/patches")
# windeployqt always deploys --release DLLs. All our configs link
# release Qt (root CMakeLists maps Debug/Checked/Valgrind imported
# configs to Release), so deploying Qt6Cored.dll would pull in the
# debug CRT and corrupt Qt/STL objects at runtime.
if(WIN32)
set(XE_QT_DIR "$ENV{QT_DIR}")
if(XE_QT_DIR AND EXISTS "${XE_QT_DIR}/bin/windeployqt.exe")
add_custom_command(TARGET xenia-app POST_BUILD
COMMAND "${XE_QT_DIR}/bin/windeployqt.exe"
--release
--no-translations
--no-system-d3d-compiler
--no-opengl-sw
--no-compiler-runtime
"$<TARGET_FILE:xenia-app>"
VERBATIM
)
endif()
endif()
# Stage runtime assets (fonts, game patches, optimized settings) next to
# the executable. Same layout on Windows and Linux.
add_custom_command(TARGET xenia-app POST_BUILD
COMMAND ${CMAKE_COMMAND} -E make_directory "$<TARGET_FILE_DIR:xenia-app>/optimized_settings"
COMMAND ${CMAKE_COMMAND} -E make_directory "$<TARGET_FILE_DIR:xenia-app>/game_patches"
COMMAND ${CMAKE_COMMAND} -E make_directory "$<TARGET_FILE_DIR:xenia-app>/assets/font"
VERBATIM
)
if(EXISTS "${_edge_optimized_src}")
add_custom_command(TARGET xenia-app POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_directory
"${_edge_optimized_src}" "$<TARGET_FILE_DIR:xenia-app>/optimized_settings"
VERBATIM
)
endif()
if(EXISTS "${_edge_game_patches_src}")
add_custom_command(TARGET xenia-app POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_directory
"${_edge_game_patches_src}" "$<TARGET_FILE_DIR:xenia-app>/game_patches"
VERBATIM
)
endif()
if(EXISTS "${_edge_assets_font_src}")
add_custom_command(TARGET xenia-app POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_directory
"${_edge_assets_font_src}" "$<TARGET_FILE_DIR:xenia-app>/assets/font"
VERBATIM
)
endif()
+9
View File
@@ -0,0 +1,9 @@
add_library(xenia-app-discord STATIC
${CMAKE_CURRENT_SOURCE_DIR}/discord_presence.cc
${CMAKE_CURRENT_SOURCE_DIR}/discord_presence.h
)
target_include_directories(xenia-app-discord PRIVATE
${PROJECT_SOURCE_DIR}/third_party/discord-rpc/src
)
target_link_libraries(xenia-app-discord PUBLIC discord-rpc)
xe_target_defaults(xenia-app-discord)
-18
View File
@@ -1,18 +0,0 @@
project_root = "../../../.."
include(project_root.."/tools/build")
group("src")
project("xenia-app-discord")
uuid("d14c0885-22d2-40de-ab28-7b234ef2b949")
kind("StaticLib")
language("C++")
links({
"discord-rpc"
})
includedirs({
project_root.."/third_party/discord-rpc/src"
})
files({
"discord_presence.cc",
"discord_presence.h"
})
+2 -2
View File
@@ -125,8 +125,8 @@
#include "xenia/ui/virtual_key.h"
#include "xenia/ui/window_qt.h"
// Autogenerated by `xb premake`.
#include "build/version.h"
// version.h is autogenerated by xenia-build.py into the CMake binary dir.
#include "version.h"
DECLARE_bool(debug);
-211
View File
@@ -1,211 +0,0 @@
project_root = "../../.."
include(project_root.."/tools/build")
group("src")
project("xenia-app")
uuid("d7e98620-d007-4ad8-9dbd-b47c8853a17f")
language("C++")
links({
"xenia-apu",
"xenia-apu-nop",
"xenia-base",
"xenia-core",
"xenia-cpu",
"xenia-gpu",
"xenia-gpu-null",
"xenia-gpu-vulkan",
"xenia-hid",
"xenia-hid-nop",
"xenia-kernel",
"xenia-patcher",
"xenia-ui",
"xenia-ui-vulkan",
"xenia-vfs",
})
links({
"aes_128",
"capstone",
"fmt",
"dxbc",
"discord-rpc",
"glslang-spirv",
"imgui",
"libavcodec",
"libavutil",
"mspack",
"snappy",
"xxhash",
})
defines({
"XBYAK_NO_OP_NAMES",
"XBYAK_ENABLE_OMITTED_OPERAND",
})
apu_transitive_deps()
local_platform_files()
files({
"../base/main_init_"..platform_suffix..".cc",
"../ui/windowed_app_main_qt.cc",
})
resincludedirs({
project_root,
})
filter(SINGLE_LIBRARY_FILTER)
-- Unified library containing all apps as StaticLibs, not just the main
-- emulator windowed app.
kind("SharedLib")
if enableMiscSubprojects then
links({
"xenia-gpu-vulkan-trace-viewer",
"xenia-hid-demo",
"xenia-ui-window-vulkan-demo",
})
end
filter(NOT_SINGLE_LIBRARY_FILTER)
kind("WindowedApp")
filter({NOT_SINGLE_LIBRARY_FILTER, "platforms:Windows", "configurations:Debug"})
kind("ConsoleApp")
-- `targetname` is broken if building from Gradle, works only for toggling the
-- `lib` prefix, as Gradle uses LOCAL_MODULE_FILENAME, not a derivative of
-- LOCAL_MODULE, to specify the targets to build when executing ndk-build.
filter("platforms:not Android-*")
targetname("xenia_edge")
filter("architecture:x86_64")
links({
"xenia-cpu-backend-x64",
})
-- TODO(Triang3l): The emulator itself on Android.
filter("platforms:not Android-*")
files({
"xenia_main.cc",
})
filter("platforms:Windows")
files({
"main_resources.rc",
})
linkoptions({"/ENTRY:mainCRTStartup"})
filter({"architecture:x86_64", "files:../base/main_init_"..platform_suffix..".cc"})
vectorextensions("SSE2") -- Disable AVX for main_init_win.cc so our AVX check doesn't use AVX instructions.
filter("platforms:not Android-*")
links({
"xenia-app-discord",
"xenia-apu-sdl",
-- TODO(Triang3l): CPU debugger on Android.
"xenia-debug-ui",
"xenia-helper-sdl",
"xenia-hid-sdl",
})
filter("platforms:Linux")
links({
"xenia-apu-alsa",
"X11",
"xcb",
"X11-xcb",
"SDL2",
})
filter("platforms:Windows")
links({
"xenia-apu-xaudio2",
"xenia-debug-gdb",
"xenia-gpu-d3d12",
"xenia-hid-winkey",
"xenia-hid-xinput",
"xenia-ui-d3d12",
})
filter("platforms:Windows")
if enableMiscSubprojects then
filter({"platforms:Windows", SINGLE_LIBRARY_FILTER})
links({
"xenia-gpu-d3d12-trace-viewer",
"xenia-ui-window-d3d12-demo",
})
end
filter("platforms:Windows")
-- Only create the .user file if it doesn't already exist.
local user_file = project_root.."/build/xenia-app.vcxproj.user"
if not os.isfile(user_file) then
debugdir(project_root)
end
-- Run windeployqt as post-build event to copy Qt DLLs
filter({"platforms:Windows", "configurations:Debug or Checked"})
local qt_dir = os.getenv("QT_DIR")
if qt_dir then
local windeployqt = path.translate(path.join(qt_dir, "bin", "windeployqt.exe"), "\\")
postbuildcommands {
'if exist "' .. windeployqt .. '" "' .. windeployqt .. '" --debug --no-translations --no-system-d3d-compiler --no-opengl-sw --no-compiler-runtime "$(TargetPath)"'
}
end
filter({"platforms:Windows", "configurations:Release"})
local qt_dir = os.getenv("QT_DIR")
if qt_dir then
local windeployqt = path.translate(path.join(qt_dir, "bin", "windeployqt.exe"), "\\")
postbuildcommands {
'if exist "' .. windeployqt .. '" "' .. windeployqt .. '" --release --no-translations --no-system-d3d-compiler --no-opengl-sw --no-compiler-runtime "$(TargetPath)"'
}
end
-- Copy optimized-settings files (TOML or JSON) next to executable
filter("platforms:Windows")
-- Use absolute path to avoid issues with relative paths
local optimized_settings_src = path.translate(path.getabsolute(path.join(project_root, ".data_repos", "optimized-settings", "settings")), "\\")
postbuildcommands {
'if not exist "$(TargetDir)optimized_settings" mkdir "$(TargetDir)optimized_settings"',
'if exist "' .. optimized_settings_src .. '\\*.json" xcopy /I /Y /Q "' .. optimized_settings_src .. '\\*.json" "$(TargetDir)optimized_settings\\"',
'if exist "' .. optimized_settings_src .. '\\*.toml" xcopy /I /Y /Q "' .. optimized_settings_src .. '\\*.toml" "$(TargetDir)optimized_settings\\"'
}
-- Copy game-patches TOML files next to executable
filter("platforms:Windows")
local game_patches_src = path.translate(path.getabsolute(path.join(project_root, ".data_repos", "game-patches", "patches")), "\\")
postbuildcommands {
'if not exist "$(TargetDir)game_patches" mkdir "$(TargetDir)game_patches"',
'xcopy /I /Y /Q "' .. game_patches_src .. '\\*.toml" "$(TargetDir)game_patches\\"'
}
-- Copy assets/font next to executable
filter("platforms:Windows")
local assets_font_src = path.translate(path.getabsolute(path.join(project_root, "assets", "font")), "\\")
postbuildcommands {
'if not exist "$(TargetDir)assets\\font" mkdir "$(TargetDir)assets\\font"',
'xcopy /I /Y /Q "' .. assets_font_src .. '\\*.*" "$(TargetDir)assets\\font\\"'
}
filter("platforms:Linux")
local optimized_settings_src = path.getabsolute(path.join(project_root, ".data_repos", "optimized-settings", "settings"))
local optimized_settings_dst = path.getabsolute(path.join(project_root, "build", "bin", "Linux")) .. "/%{cfg.buildcfg}/optimized_settings"
postbuildcommands {
'{MKDIR} ' .. optimized_settings_dst,
'{COPY} ' .. optimized_settings_src .. '/*.json ' .. optimized_settings_dst .. ' 2>/dev/null || true',
'{COPY} ' .. optimized_settings_src .. '/*.toml ' .. optimized_settings_dst .. ' 2>/dev/null || true'
}
filter("platforms:Linux")
local game_patches_src = path.getabsolute(path.join(project_root, ".data_repos", "game-patches", "patches"))
local game_patches_dst = path.getabsolute(path.join(project_root, "build", "bin", "Linux")) .. "/%{cfg.buildcfg}/game_patches"
postbuildcommands {
'{MKDIR} ' .. game_patches_dst,
'{COPY} ' .. game_patches_src .. '/*.toml ' .. game_patches_dst
}
-- Copy assets/font next to executable
filter("platforms:Linux")
local assets_font_src = path.getabsolute(path.join(project_root, "assets", "font"))
local assets_font_dst = path.getabsolute(path.join(project_root, "build", "bin", "Linux")) .. "/%{cfg.buildcfg}/assets/font"
postbuildcommands {
'{MKDIR} ' .. assets_font_dst,
'{COPY} ' .. assets_font_src .. '/* ' .. assets_font_dst
}
+13
View File
@@ -0,0 +1,13 @@
add_library(xenia-apu STATIC)
xe_platform_sources(xenia-apu ${CMAKE_CURRENT_SOURCE_DIR})
target_include_directories(xenia-apu PRIVATE
${PROJECT_SOURCE_DIR}/third_party/FFmpeg
${PROJECT_SOURCE_DIR}/third_party/ffmpeg-xenia
)
target_link_libraries(xenia-apu PUBLIC libavcodec libavutil libavformat xenia-base)
# AudioMediaPlayer instantiates SDLAudioDriver directly on Linux, so the
# SDL chain is a transitive dependency of xenia-apu there.
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
target_link_libraries(xenia-apu PUBLIC xenia-helper-sdl SDL2)
endif()
xe_target_defaults(xenia-apu)
+7
View File
@@ -0,0 +1,7 @@
add_library(xenia-apu-alsa STATIC)
xe_platform_sources(xenia-apu-alsa ${CMAKE_CURRENT_SOURCE_DIR})
target_link_libraries(xenia-apu-alsa PUBLIC xenia-apu xenia-base)
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
target_link_libraries(xenia-apu-alsa PRIVATE asound pthread)
endif()
xe_target_defaults(xenia-apu-alsa)
-18
View File
@@ -1,18 +0,0 @@
group("src")
project("xenia-apu-alsa")
uuid("8c2e1340-f847-4f9a-8b2e-5d8c1b7a8f9e")
kind("StaticLib")
language("C++")
links({
"xenia-apu",
"xenia-base",
})
defines({
})
local_platform_files()
filter("platforms:Linux")
links({
"asound",
"pthread",
})
+4
View File
@@ -0,0 +1,4 @@
add_library(xenia-apu-nop STATIC)
xe_platform_sources(xenia-apu-nop ${CMAKE_CURRENT_SOURCE_DIR})
target_link_libraries(xenia-apu-nop PUBLIC xenia-base xenia-apu)
xe_target_defaults(xenia-apu-nop)
-13
View File
@@ -1,13 +0,0 @@
project_root = "../../../.."
include(project_root.."/tools/build")
group("src")
project("xenia-apu-nop")
uuid("f37dbf3a-d200-4cc0-83f0-f801b1bdd862")
kind("StaticLib")
language("C++")
links({
"xenia-base",
"xenia-apu",
})
local_platform_files()
-26
View File
@@ -1,26 +0,0 @@
project_root = "../../.."
include(project_root.."/tools/build")
group("src")
project("xenia-apu")
uuid("f4df01f0-50e4-4c67-8f54-61660696cc79")
kind("StaticLib")
language("C++")
links({
"libavcodec",
"libavutil",
"libavformat",
"xenia-base",
})
includedirs({
project_root.."/third_party/FFmpeg",
project_root.."/third_party/ffmpeg-xenia",
})
filter("platforms:Linux")
links({
"xenia-helper-sdl",
"SDL2",
})
sdl2_include()
filter({})
local_platform_files()
+4
View File
@@ -0,0 +1,4 @@
add_library(xenia-apu-sdl STATIC)
xe_platform_sources(xenia-apu-sdl ${CMAKE_CURRENT_SOURCE_DIR})
target_link_libraries(xenia-apu-sdl PUBLIC xenia-apu xenia-base xenia-helper-sdl SDL2)
xe_target_defaults(xenia-apu-sdl)

Some files were not shown because too many files have changed in this diff Show More