-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathxmake.lua
More file actions
99 lines (86 loc) · 4.8 KB
/
Copy pathxmake.lua
File metadata and controls
99 lines (86 loc) · 4.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
-- Somatic Camera SF (formerly Improved Camera SF) - xmake build configuration
-- Built on Linux against libxse's CommonLibSF (Starfield runtime 1.16.244.0).
-- Nothing below is toolchain-specific; the toolchain is chosen at configure time.
--
-- DEFAULT - real MSVC (cl.exe/link.exe) run under Wine via msvc-wine wrappers.
-- The game and CommonLibSF are MSVC-built, so this matches the C++ ABI the mod
-- hooks into exactly, rather than relying on clang-cl's MSVC-ABI emulation:
-- xmake f -p windows -a x64 -m releasedbg --toolchain=msvc --sdk=/mnt/sata/msvc \
-- --builddir=build-msvc -y
-- xmake build
-- xmake's msvc toolchain detects the msvc-wine layout (VC/Tools/MSVC + Windows
-- Kits) natively; the wrappers in <sdk>/bin/x64 (cl.exe -> bash script) set
-- INCLUDE/LIB/WINEPATH and invoke the real compiler through Wine.
--
-- ALTERNATIVE - clang-cl + lld-link against an xwin-provided SDK. Roughly 6-7x
-- faster (no Wine, no per-file .exe startup), so it is the better choice for
-- quick iteration; verify with the MSVC build before shipping:
-- xmake f -p windows -a x64 -m releasedbg --toolchain=clang-cl --sdk=$HOME/.vsxwin \
-- --builddir=build -y
-- xmake build
-- Each toolchain keeps its own build dir so their objects never mix. --builddir is
-- sticky: xmake persists it in .xmake/, and a later "xmake f" without the flag
-- reuses whatever was configured last - always pass it when switching toolchains.
-- Project-local module overrides: find_rc.lua makes xmake locate an rc compiler on
-- Linux (upstream find_rc is Windows-only), which the clang-cl path needs. Must
-- come before any target resolution.
add_moduledirs("modules")
-- CommonLibSF (+ nested commonlib-shared) built from source as a static-lib subproject.
-- The original repo shipped no build files and expected prebuilt *.lib. spdlog (v1.16.0,
-- std_format+wchar) is pulled by commonlib-shared via xrepo and propagates transitively.
includes("extern/commonlibsf")
set_project("SomaticCameraSF")
set_version("2.0.0")
set_license("MPL-2.0")
set_languages("c++23")
set_warnings("allextra")
set_encodings("utf-8")
add_rules("mode.debug", "mode.release", "mode.releasedbg")
-- Third-party libraries used by the overlay/hooking/config layers, pulled from xrepo:
-- glm - math used by the pseudo-camera transforms (header-only)
-- imgui - core Dear ImGui (no graphics backend; the mod drives it itself)
-- minhook - inline hooking of the game's camera update functions
-- mini - metayeti mINI, provides <mini/ini.h> for the .ini config
add_requires("glm", "imgui", "minhook", "mini")
-- Target name is load-bearing: the plugin locates its own INI via
-- GetModuleHandleA("SomaticCameraSF.dll") (PseudoFPConfig.cpp,
-- EventsStarfield.cpp, OsfUiIntegration.cpp). Renaming the output DLL makes
-- that handle null, so GetModuleFileNameA falls back to the game EXE path and
-- every setting silently reverts to its built-in default.
target("SomaticCameraSF")
set_kind("shared")
-- WIN32_LEAN_AND_MEAN / NOMINMAX / GLM_* are also set in PCH.h; keep the core ones
-- here so every TU (incl. the PCH itself) agrees.
add_defines("UNICODE", "_UNICODE", "NOMINMAX", "WIN32_LEAN_AND_MEAN")
add_deps("commonlibsf")
add_packages("glm", "imgui", "minhook", "mini")
-- source files. spdlog_compat.cpp was a hand-rolled shim that redefines
-- REX::Impl::Log/Fail for a manually built commonlib-shared.lib; the real
-- commonlib-shared (built here from source) already provides those symbols, so
-- compiling it would cause duplicate-symbol link errors.
add_files("source/**.cpp")
add_files("PCH/PCH.cpp")
remove_files("source/spdlog_compat.cpp")
add_headerfiles("include/**.h", "PCH/PCH.h")
-- "." lets PCH.cpp resolve "PCH/PCH.h"; "include" resolves the plugin headers.
-- "extern/osfui" resolves <OSFUI_API.h>, the header-only OSF UI SDK that
-- OsfUiIntegration.cpp includes but upstream doesn't ship (see the README
-- there). Header-only: nothing links against OSFUI.dll, and the bridge is
-- resolved at runtime, so OSF UI remains an optional dependency.
add_includedirs(".", "include", "PCH", "extern/osfui")
-- precompiled header
set_pcxxheader("PCH/PCH.h")
-- SFSEPlugin_Version / SFSEPlugin_Load come from CommonLibSF's SFSE_PLUGIN_* macros
-- (already __declspec(dllexport)); pin them into the export table explicitly too.
add_ldflags(
"/EXPORT:SFSEPlugin_Version",
"/EXPORT:SFSEPlugin_Load",
{ force = true }
)
-- Win32 libraries: D3D11/DXGI for the overlay, the rest are the usual SFSE set
-- (some also arrive transitively from commonlib-shared).
add_syslinks(
"user32", "kernel32", "shell32", "version", "ws2_32", "advapi32",
"bcrypt", "ole32", "oleaut32", "dxgi", "d3d11", "d3dcompiler", "dbghelp", "psapi"
)
target_end()