From f1b80d208d6b40d5c93836d89672b695b97d3ebe Mon Sep 17 00:00:00 2001 From: "Nicolas \"Pixel\" Noble" Date: Sun, 12 Jul 2026 23:50:55 -0700 Subject: [PATCH] Adding xmake support for ps1-packer. --- .github/filter-support/filter.sh | 6 ++-- src/support/xmake.lua | 22 +++++++++++++++ src/supportpsx/xmake.lua | 28 +++++++++++++++++++ tools/ps1-packer/xmake.lua | 47 ++++++++++++++++++++++++++++++++ 4 files changed, 100 insertions(+), 3 deletions(-) create mode 100644 src/support/xmake.lua create mode 100644 src/supportpsx/xmake.lua create mode 100644 tools/ps1-packer/xmake.lua diff --git a/.github/filter-support/filter.sh b/.github/filter-support/filter.sh index b04d81aa1..d19accdf6 100755 --- a/.github/filter-support/filter.sh +++ b/.github/filter-support/filter.sh @@ -20,11 +20,11 @@ git filter-branch -f --tree-filter 'rm -rf .github hardware i18n resources .vsco # Need to delete submodules actively. # Done in two passes for speed. -git filter-branch -f --tree-filter 'find third_party -maxdepth 1 -type d -and -not -name third_party -and -not -path third_party/cueparser* -and -not -path third_party/ELFIO\* -and -not -path third_party/expected\* -and -not -path third_party/fmt\* -and -not -path third_party/googletest\* -and -not -path third_party/iec-60908b\* -and -not -path third_party/magic_enum\* -and -not -path third_party/ucl\* -exec rm -rf {} \; || true' --tag-name-filter cat --prune-empty -git filter-branch -f --tree-filter 'find third_party -maxdepth 1 -type d -and -not -name third_party -and -not -path third_party/cueparser* -and -not -path third_party/ELFIO\* -and -not -path third_party/expected\* -and -not -path third_party/fmt\* -and -not -path third_party/googletest\* -and -not -path third_party/iec-60908b\* -and -not -path third_party/magic_enum\* -and -not -path third_party/ucl\* -exec git rm -f {} \; || true' --tag-name-filter cat --prune-empty +git filter-branch -f --tree-filter 'find third_party -maxdepth 1 -type d -and -not -name third_party -and -not -path third_party/cueparser* -and -not -path third_party/ELFIO\* -and -not -path third_party/expected\* -and -not -path third_party/fmt\* -and -not -path third_party/googletest\* -and -not -path third_party/iec-60908b\* -and -not -path third_party/magic_enum\* -and -not -path third_party/PEGTL\* -and -not -path third_party/ucl\* -exec rm -rf {} \; || true' --tag-name-filter cat --prune-empty +git filter-branch -f --tree-filter 'find third_party -maxdepth 1 -type d -and -not -name third_party -and -not -path third_party/cueparser* -and -not -path third_party/ELFIO\* -and -not -path third_party/expected\* -and -not -path third_party/fmt\* -and -not -path third_party/googletest\* -and -not -path third_party/iec-60908b\* -and -not -path third_party/magic_enum\* -and -not -path third_party/PEGTL\* -and -not -path third_party/ucl\* -exec git rm -f {} \; || true' --tag-name-filter cat --prune-empty # Delete ffmpeg, versionning, Lua, and libuv-related source code -git filter-branch -f --tree-filter 'find src -type f -name \*lua\* -delete || true' --tag-name-filter cat --prune-empty +git filter-branch -f --tree-filter 'find src -type f -name \*lua\* -and -not -name xmake.lua -delete || true' --tag-name-filter cat --prune-empty git filter-branch -f --tree-filter 'find src -type f -name assembler.\* -delete || true' --tag-name-filter cat --prune-empty git filter-branch -f --tree-filter 'find src -type f -name ffmpeg\* -delete || true' --tag-name-filter cat --prune-empty git filter-branch -f --tree-filter 'find src -type f -name uv\* -delete || true' --tag-name-filter cat --prune-empty diff --git a/src/support/xmake.lua b/src/support/xmake.lua new file mode 100644 index 000000000..fdcf50bb6 --- /dev/null +++ b/src/support/xmake.lua @@ -0,0 +1,22 @@ +local support_root = path.join(os.scriptdir(), "..", "..") + +add_rules("mode.debug", "mode.release") + +add_requires("fmt", "zlib") +set_languages("c++26") + +target("pcsx.support") + set_kind("static") + + if is_plat("windows") then + add_cxflags("/bigobj") + end + + add_packages("fmt", "zlib") + add_includedirs( + path.join(support_root, "src"), + path.join(support_root, "third_party"), + path.join(support_root, "third_party", "PEGTL", "include") + ) + + add_files("*.cc") diff --git a/src/supportpsx/xmake.lua b/src/supportpsx/xmake.lua new file mode 100644 index 000000000..bf6767e6b --- /dev/null +++ b/src/supportpsx/xmake.lua @@ -0,0 +1,28 @@ +local support_root = path.join(os.scriptdir(), "..", "..") + +add_rules("mode.debug", "mode.release") + +add_requires("fmt", "zlib") +set_languages("c11", "c++26") + +target("pcsx.supportpsx") + set_kind("static") + + add_packages("fmt", "zlib") + add_defines( + "ACC_CONFIG_AUTO_NO_FUNCTIONS" + ) + add_includedirs( + path.join(support_root, "src"), + path.join(support_root, "third_party"), + path.join(support_root, "third_party", "ELFIO"), + path.join(support_root, "third_party", "ucl"), + path.join(support_root, "third_party", "ucl", "include") + ) + + add_files("*.c", "*.cc") + + add_files( + path.join(support_root, "third_party", "ucl", "src", "alloc.c"), + path.join(support_root, "third_party", "ucl", "src", "n2e_99.c") + ) diff --git a/tools/ps1-packer/xmake.lua b/tools/ps1-packer/xmake.lua new file mode 100644 index 000000000..e3fa04dd7 --- /dev/null +++ b/tools/ps1-packer/xmake.lua @@ -0,0 +1,47 @@ +local support_root = path.join(os.scriptdir(), "..", "..") + +add_rules("mode.debug", "mode.release") + +includes( + path.join(support_root, "src", "support"), + path.join(support_root, "src", "supportpsx") +) + +add_requires("fmt", "zlib") +set_languages("c++26") + +target("ps1-packer") + set_kind("binary") + + add_packages("fmt", "zlib") + add_deps("pcsx.support", "pcsx.supportpsx") + add_includedirs( + path.join(support_root, "src"), + path.join(support_root, "third_party") + ) + + add_files("*.cc") + +rule("ps1-packer.psexe") + set_extensions(".elf") + on_load(function(target) + local extension = target:values("psx.extension") + if extension == nil then + extension = ".psexe" + end + local targetdir = target:targetdir() + local targetname = target:basename() + local outfile = path.join(targetdir, targetname .. extension) + target:add("deps", "ps1-packer", {inherit = false}) + target:add("values", "ps1-packer.psexe.postlink.outfile", outfile) + target:add("values", "psexe", false) + end) + after_link(function(target) + local ps1packer = target:dep("ps1-packer") + local outfile = target:values("ps1-packer.psexe.postlink.outfile") + os.run("%s %s -o %s", ps1packer:targetfile(), target:targetfile(), outfile) + end) + on_clean(function(target) + local outfile = target:values("ps1-packer.psexe.postlink.outfile") + os.tryrm(outfile) + end)