added cmake-modular-server builds

This commit is contained in:
Eric 2023-07-25 12:05:20 -07:00
parent 6fce0eb734
commit 7ed0abb708
No known key found for this signature in database
GPG Key ID: 89C93F0F8D6D5A98
8 changed files with 139 additions and 78 deletions

56
.efrocachemap generated
View File

@ -4068,26 +4068,26 @@
"build/assets/windows/Win32/ucrtbased.dll": "https://files.ballistica.net/cache/ba1/2d/ef/5335207d41b21b9823f6805997f1", "build/assets/windows/Win32/ucrtbased.dll": "https://files.ballistica.net/cache/ba1/2d/ef/5335207d41b21b9823f6805997f1",
"build/assets/windows/Win32/vc_redist.x86.exe": "https://files.ballistica.net/cache/ba1/b0/8a/55e2e77623fe657bea24f223a3ae", "build/assets/windows/Win32/vc_redist.x86.exe": "https://files.ballistica.net/cache/ba1/b0/8a/55e2e77623fe657bea24f223a3ae",
"build/assets/windows/Win32/vcruntime140d.dll": "https://files.ballistica.net/cache/ba1/86/5b/2af4d1e26a1a8073c89acb06e599", "build/assets/windows/Win32/vcruntime140d.dll": "https://files.ballistica.net/cache/ba1/86/5b/2af4d1e26a1a8073c89acb06e599",
"build/prefab/full/linux_arm64_gui/debug/ballisticakit": "https://files.ballistica.net/cache/ba1/52/15/ab02c6459f5439f526e93d2b7f54", "build/prefab/full/linux_arm64_gui/debug/ballisticakit": "https://files.ballistica.net/cache/ba1/6b/a1/5f560a97ab8641091343c6ee688b",
"build/prefab/full/linux_arm64_gui/release/ballisticakit": "https://files.ballistica.net/cache/ba1/97/f4/5069754f3c14bc147cbf5a720a7a", "build/prefab/full/linux_arm64_gui/release/ballisticakit": "https://files.ballistica.net/cache/ba1/50/dd/86cbb96aca3a339318b00574b2db",
"build/prefab/full/linux_arm64_server/debug/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/d6/59/b2b8c3fd93cee8c42e8f0ad52b4e", "build/prefab/full/linux_arm64_server/debug/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/6b/b4/65070558df0a917c9a1aac8bb280",
"build/prefab/full/linux_arm64_server/release/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/92/fd/cdfb069952a518a5bf2e7cf3392b", "build/prefab/full/linux_arm64_server/release/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/93/04/19410cb96b5c12fc2cd20dd9c099",
"build/prefab/full/linux_x86_64_gui/debug/ballisticakit": "https://files.ballistica.net/cache/ba1/35/74/92cc2e753dcec2a1b5686e356354", "build/prefab/full/linux_x86_64_gui/debug/ballisticakit": "https://files.ballistica.net/cache/ba1/36/69/25b4f3e931ff0add15a975383491",
"build/prefab/full/linux_x86_64_gui/release/ballisticakit": "https://files.ballistica.net/cache/ba1/7d/87/ab64cdae54b714a12ccba26edd04", "build/prefab/full/linux_x86_64_gui/release/ballisticakit": "https://files.ballistica.net/cache/ba1/16/68/6011835e4db7927b26761847950b",
"build/prefab/full/linux_x86_64_server/debug/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/60/00/041955bb284b8ed8adfeda2dd58f", "build/prefab/full/linux_x86_64_server/debug/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/11/bf/aa9df1fd5ae51e9b076a324d8e7a",
"build/prefab/full/linux_x86_64_server/release/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/03/55/4003a3204340b5982ee2ccc9e4a1", "build/prefab/full/linux_x86_64_server/release/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/8a/76/54da9b7ff4d79164d3f4dea2782b",
"build/prefab/full/mac_arm64_gui/debug/ballisticakit": "https://files.ballistica.net/cache/ba1/fe/74/c853281985a80ff7697064aecc0e", "build/prefab/full/mac_arm64_gui/debug/ballisticakit": "https://files.ballistica.net/cache/ba1/4a/08/bf75de3244efe6fc342139a6da32",
"build/prefab/full/mac_arm64_gui/release/ballisticakit": "https://files.ballistica.net/cache/ba1/32/24/52c5ebf4d681eceba318b9da7b9c", "build/prefab/full/mac_arm64_gui/release/ballisticakit": "https://files.ballistica.net/cache/ba1/33/c7/d3534c1d605b5bcc4a541457cde9",
"build/prefab/full/mac_arm64_server/debug/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/0a/cc/4742fe6cf5e8fd5164896e65b967", "build/prefab/full/mac_arm64_server/debug/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/0e/58/c7da77e4c0d031073e4db047e4f3",
"build/prefab/full/mac_arm64_server/release/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/52/0a/fa2d0611dc0c009679fdb46bed31", "build/prefab/full/mac_arm64_server/release/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/f5/be/f80777972954ebe6fd91b52a6533",
"build/prefab/full/mac_x86_64_gui/debug/ballisticakit": "https://files.ballistica.net/cache/ba1/2f/b6/f4e880dbd1d5d8fc65431f9faaf4", "build/prefab/full/mac_x86_64_gui/debug/ballisticakit": "https://files.ballistica.net/cache/ba1/e4/20/0f1e3a2e343e48dbe3c3ae8c6ab7",
"build/prefab/full/mac_x86_64_gui/release/ballisticakit": "https://files.ballistica.net/cache/ba1/25/72/e88b3f07c7dc1e33abeb20504ecc", "build/prefab/full/mac_x86_64_gui/release/ballisticakit": "https://files.ballistica.net/cache/ba1/23/46/72f453ea380bd5f04957886c2b57",
"build/prefab/full/mac_x86_64_server/debug/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/86/ec/36d71d58ab16db28a370f1756464", "build/prefab/full/mac_x86_64_server/debug/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/f8/e3/b7bf2bdd4fe4879e8f95bc56073c",
"build/prefab/full/mac_x86_64_server/release/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/92/5f/d3aedaebca5fd7b6bf1733ece902", "build/prefab/full/mac_x86_64_server/release/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/b5/e6/451f3cc73b5b79d21b19c2416d61",
"build/prefab/full/windows_x86_gui/debug/BallisticaKit.exe": "https://files.ballistica.net/cache/ba1/f6/4b/34f50badf8c0145555b3fb793921", "build/prefab/full/windows_x86_gui/debug/BallisticaKit.exe": "https://files.ballistica.net/cache/ba1/b2/0e/778420dfd1a6f81ed457a94f8f1d",
"build/prefab/full/windows_x86_gui/release/BallisticaKit.exe": "https://files.ballistica.net/cache/ba1/c3/7a/27057ee8be4d3ce1be25e364ebcb", "build/prefab/full/windows_x86_gui/release/BallisticaKit.exe": "https://files.ballistica.net/cache/ba1/00/76/0f4dd3bbf7a98f00221307535b4f",
"build/prefab/full/windows_x86_server/debug/dist/BallisticaKitHeadless.exe": "https://files.ballistica.net/cache/ba1/d5/8f/8b90bda67603753391a2c72cd539", "build/prefab/full/windows_x86_server/debug/dist/BallisticaKitHeadless.exe": "https://files.ballistica.net/cache/ba1/4d/fe/1d4e9c927e74f900766cb3d3c55f",
"build/prefab/full/windows_x86_server/release/dist/BallisticaKitHeadless.exe": "https://files.ballistica.net/cache/ba1/db/1a/2516790f8fe7c5a794e5e552a0f3", "build/prefab/full/windows_x86_server/release/dist/BallisticaKitHeadless.exe": "https://files.ballistica.net/cache/ba1/82/99/e0a873f37e95674f2151ea99bf3d",
"build/prefab/lib/linux_arm64_gui/debug/libballisticaplus.a": "https://files.ballistica.net/cache/ba1/b3/a2/5da0c4dc65f469e4a476e0395eb5", "build/prefab/lib/linux_arm64_gui/debug/libballisticaplus.a": "https://files.ballistica.net/cache/ba1/b3/a2/5da0c4dc65f469e4a476e0395eb5",
"build/prefab/lib/linux_arm64_gui/release/libballisticaplus.a": "https://files.ballistica.net/cache/ba1/a9/9a/adb83188f9c7d7b51dafd0f8b8a8", "build/prefab/lib/linux_arm64_gui/release/libballisticaplus.a": "https://files.ballistica.net/cache/ba1/a9/9a/adb83188f9c7d7b51dafd0f8b8a8",
"build/prefab/lib/linux_arm64_server/debug/libballisticaplus.a": "https://files.ballistica.net/cache/ba1/b3/a2/5da0c4dc65f469e4a476e0395eb5", "build/prefab/lib/linux_arm64_server/debug/libballisticaplus.a": "https://files.ballistica.net/cache/ba1/b3/a2/5da0c4dc65f469e4a476e0395eb5",
@ -4104,14 +4104,14 @@
"build/prefab/lib/mac_x86_64_gui/release/libballisticaplus.a": "https://files.ballistica.net/cache/ba1/59/fe/a3e369f2db87a305641e74ae70ab", "build/prefab/lib/mac_x86_64_gui/release/libballisticaplus.a": "https://files.ballistica.net/cache/ba1/59/fe/a3e369f2db87a305641e74ae70ab",
"build/prefab/lib/mac_x86_64_server/debug/libballisticaplus.a": "https://files.ballistica.net/cache/ba1/be/df/60063a6845e8654958f1a3e37867", "build/prefab/lib/mac_x86_64_server/debug/libballisticaplus.a": "https://files.ballistica.net/cache/ba1/be/df/60063a6845e8654958f1a3e37867",
"build/prefab/lib/mac_x86_64_server/release/libballisticaplus.a": "https://files.ballistica.net/cache/ba1/59/fe/a3e369f2db87a305641e74ae70ab", "build/prefab/lib/mac_x86_64_server/release/libballisticaplus.a": "https://files.ballistica.net/cache/ba1/59/fe/a3e369f2db87a305641e74ae70ab",
"build/prefab/lib/windows/Debug_Win32/BallisticaKitGenericPlus.lib": "https://files.ballistica.net/cache/ba1/d1/50/ee04ab770e6128a557e49c82615d", "build/prefab/lib/windows/Debug_Win32/BallisticaKitGenericPlus.lib": "https://files.ballistica.net/cache/ba1/91/2f/362a643d543963de549d830fe604",
"build/prefab/lib/windows/Debug_Win32/BallisticaKitGenericPlus.pdb": "https://files.ballistica.net/cache/ba1/37/af/364afe42b7d12c55bff5cff70e92", "build/prefab/lib/windows/Debug_Win32/BallisticaKitGenericPlus.pdb": "https://files.ballistica.net/cache/ba1/2e/d4/67d6c0f9b372eb5cd92c9def6fc8",
"build/prefab/lib/windows/Debug_Win32/BallisticaKitHeadlessPlus.lib": "https://files.ballistica.net/cache/ba1/20/45/857c24d456719039f97dc0926ff0", "build/prefab/lib/windows/Debug_Win32/BallisticaKitHeadlessPlus.lib": "https://files.ballistica.net/cache/ba1/68/8b/d6049425f1069d256abdaf90004c",
"build/prefab/lib/windows/Debug_Win32/BallisticaKitHeadlessPlus.pdb": "https://files.ballistica.net/cache/ba1/07/69/58c0df6421c215ed6a4087c9ff08", "build/prefab/lib/windows/Debug_Win32/BallisticaKitHeadlessPlus.pdb": "https://files.ballistica.net/cache/ba1/3e/82/f70e75696765ac05875cb5dd778c",
"build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.lib": "https://files.ballistica.net/cache/ba1/e0/03/38c940328f966108e8309c301f5c", "build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.lib": "https://files.ballistica.net/cache/ba1/38/ee/56658557aa2ecabd0d30eb01b68e",
"build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.pdb": "https://files.ballistica.net/cache/ba1/e5/59/28ef0b5b254fa22891d8e2020447", "build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.pdb": "https://files.ballistica.net/cache/ba1/6b/4c/568766d02bbca174752488850737",
"build/prefab/lib/windows/Release_Win32/BallisticaKitHeadlessPlus.lib": "https://files.ballistica.net/cache/ba1/3e/31/5640d04cea61f78e430415c6ab1e", "build/prefab/lib/windows/Release_Win32/BallisticaKitHeadlessPlus.lib": "https://files.ballistica.net/cache/ba1/3e/5b/1aa2252706188de69075eb7b3656",
"build/prefab/lib/windows/Release_Win32/BallisticaKitHeadlessPlus.pdb": "https://files.ballistica.net/cache/ba1/13/80/e30666a9b6abeb6fdafe78d3b7d8", "build/prefab/lib/windows/Release_Win32/BallisticaKitHeadlessPlus.pdb": "https://files.ballistica.net/cache/ba1/ab/a7/21bc5acc8a823bd7c7ec940e97bc",
"src/assets/ba_data/python/babase/_mgen/__init__.py": "https://files.ballistica.net/cache/ba1/f8/85/fed7f2ed98ff2ba271f9dbe3391c", "src/assets/ba_data/python/babase/_mgen/__init__.py": "https://files.ballistica.net/cache/ba1/f8/85/fed7f2ed98ff2ba271f9dbe3391c",
"src/assets/ba_data/python/babase/_mgen/enums.py": "https://files.ballistica.net/cache/ba1/f8/cd/3af311ac63147882590123b78318", "src/assets/ba_data/python/babase/_mgen/enums.py": "https://files.ballistica.net/cache/ba1/f8/cd/3af311ac63147882590123b78318",
"src/ballistica/base/mgen/pyembed/binding_base.inc": "https://files.ballistica.net/cache/ba1/ee/dd/ad968b176000e31c65be6206a2bc", "src/ballistica/base/mgen/pyembed/binding_base.inc": "https://files.ballistica.net/cache/ba1/ee/dd/ad968b176000e31c65be6206a2bc",

View File

@ -527,6 +527,7 @@
<w>cmakelist</w> <w>cmakelist</w>
<w>cmakelists</w> <w>cmakelists</w>
<w>cmakemodular</w> <w>cmakemodular</w>
<w>cmakemodularserver</w>
<w>cmakeserver</w> <w>cmakeserver</w>
<w>cmath</w> <w>cmath</w>
<w>cmathmodule</w> <w>cmathmodule</w>

View File

@ -5,26 +5,27 @@
by a standard Python interpreter. This new build style is referred to as by a standard Python interpreter. This new build style is referred to as
'modular'. The traditional form of the app, where we bootstrap Python 'modular'. The traditional form of the app, where we bootstrap Python
ourselves inside a standalone binary, is called 'monolithic'. To build and run ourselves inside a standalone binary, is called 'monolithic'. To build and run
Ballistica in modular form, you can do `make cmake-modular`. This should make Ballistica in modular form, you can do `make cmake-modular` or `make
it easier to use certain things like Python debuggers with Ballistica. While I cmake-modular-server`. This should make it easier to use certain things like
expect most builds of the game to remain monolithic, this may become the Python debuggers with Ballistica. While I expect most builds of the game to
default for certain situations such as server builds or possibly Linux builds remain monolithic, this may become the default for certain situations such as
if it seems beneficial. We'll see. Modular mode should work on Linux and Mac server builds or possibly Linux builds if it seems beneficial. We'll see.
currently; other platforms remain monolithic-only for now. Modular mode should work on Linux and Mac currently; other platforms remain
monolithic-only for now.
- Changed builds such as `cmake` and `cmake-server` to be more like the new - Changed builds such as `cmake` and `cmake-server` to be more like the new
`cmake-monolithic` setup; there is now a `staged` dir that built binaries are `cmake-monolithic-*` builds; there is now a `staged` dir that built binaries
symlinked into instead of just dumping a `ba_data` into the cmake build dir. are symlinked into instead of just dumping a `ba_data` into the cmake build
This keeps things a bit cleaner with fewer build-related files interspersed dir. This keeps things a bit cleaner with fewer build-related files
with the stuff that Ballistica expects to be there at runtime. This also interspersed with the stuff that Ballistica expects to be there at runtime.
allows an elegant `-dist` flag to be used with the staging command to copy This also allows an elegant `-dist` flag to be used with the staging command
files instead of symlinking them. to copy files instead of symlinking them.
- Changed path wrangling a bit in baenv.py. All ballistica Python paths - Changed path wrangling a bit in baenv.py. All ballistica Python paths
(including python-site-packages) are now placed before any other existing (including python-site-packages) are now placed *before* any other existing
Python paths. This should provide a more consistent environment and means Python paths. This should provide a more consistent environment and means
Ballistica will always use its own version of things like yaml or certifi or Ballistica will always use its own version of things like yaml or certifi or
typing_extensions instead of one the user has installed via pip. Holler if you typing_extensions instead of ones the user has installed via pip. Holler if
run into any problems because of this and we can make an option to use the old you run into any problems because of this and we can make an option to use the
behavior where Ballistica's app and site paths get placed at the end. old behavior where Ballistica's app and site paths get placed at the end.
- It is now possible to manually run the app loop even on monolithic builds; - It is now possible to manually run the app loop even on monolithic builds;
just do `PYTHONPATH=ba_data/python ./ballisticacore -c "import baenv; just do `PYTHONPATH=ba_data/python ./ballisticacore -c "import baenv;
baenv.configure(); import babase; babase.app.run()"`. This is basically the baenv.configure(); import babase; babase.app.run()"`. This is basically the
@ -43,7 +44,8 @@
than simply asset files so this is a more accurate name. than simply asset files so this is a more accurate name.
- Added `babase.fatal_error()`. Mod code should generally never use this, but it - Added `babase.fatal_error()`. Mod code should generally never use this, but it
can be useful for core engine code to directly and clearly point out problems can be useful for core engine code to directly and clearly point out problems
that cannot be recovered from. that cannot be recovered from (Exceptions in such cases can tend to be
'handled' which leads to a broken or crashing app).
### 1.7.23 (build 21178, api 8, 2023-07-19) ### 1.7.23 (build 21178, api 8, 2023-07-19)

View File

@ -1088,14 +1088,39 @@ cmake-modular-binary: meta
cmake-modular-clean: cmake-modular-clean:
rm -rf build/cmake/modular-$(CM_BT_LC) rm -rf build/cmake/modular-$(CM_BT_LC)
cmake-modular-server: cmake-modular-server-build
@cd build/cmake/modular-server-$(CM_BT_LC)/staged && ./ballisticakit_server
cmake-modular-server-build: assets-server meta cmake-modular-server-binary
@$(STAGE_BUILD) -cmakemodularserver -$(CM_BT_LC) \
-builddir build/cmake/modular-server-$(CM_BT_LC) \
build/cmake/modular-server-$(CM_BT_LC)/staged
@tools/pcommand echo BLD \
Server build complete: BLU build/cmake/modular-server-$(CM_BT_LC)/staged
cmake-modular-server-binary: meta
@tools/pcommand cmake_prep_dir build/cmake/modular-server-$(CM_BT_LC)
@cd build/cmake/modular-server-$(CM_BT_LC) && test -f Makefile \
|| cmake -DCMAKE_BUILD_TYPE=$(CMAKE_BUILD_TYPE) -DHEADLESS=true \
$(shell pwd)/ballisticakit-cmake
@tools/pcommand update_cmake_prefab_lib server $(CM_BT_LC) \
build/cmake/modular-server-$(CM_BT_LC)
@cd build/cmake/modular-server-$(CM_BT_LC) && $(MAKE) \
-j$(CPUS) ballisticakitso
cmake-modular-server-clean:
rm -rf build/cmake/modular-server-$(CM_BT_LC)
# Stage assets for building/running within CLion. # Stage assets for building/running within CLion.
clion-staging: assets-cmake resources meta clion-staging: assets-cmake resources meta
$(STAGE_BUILD) -cmake -debug build/clion_debug $(STAGE_BUILD) -cmake -debug build/clion_debug
$(STAGE_BUILD) -cmake -release build/clion_release $(STAGE_BUILD) -cmake -release build/clion_release
# Tell make which of these targets don't represent files. # Tell make which of these targets don't represent files.
.PHONY: cmake cmake-build cmake-clean cmake-server cmake-server-build \ .PHONY: cmake cmake-build cmake-clean cmake-server cmake-server-build \
cmake-server-clean cmake-server-clean cmake-modular-build cmake-modular cmake-modular-binary \
cmake-modular-clean cmake-modular-server cmake-modular-server-build \
cmake-modular-server-binary cmake-modular-server-clean clion-staging
################################################################################ ################################################################################

View File

@ -329,6 +329,7 @@
<w>cloudtoba</w> <w>cloudtoba</w>
<w>cmakelist</w> <w>cmakelist</w>
<w>cmakemodular</w> <w>cmakemodular</w>
<w>cmakemodularserver</w>
<w>cmath</w> <w>cmath</w>
<w>cmds</w> <w>cmds</w>
<w>cmdspath</w> <w>cmdspath</w>

View File

@ -693,9 +693,10 @@ def cmake_prep_dir(dirname: str, verbose: bool = False) -> None:
current_value: str current_value: str
# Start with an entry we can explicitly increment if we want to blow # Start with an entry we can explicitly increment if we want to blow
# away all cmake builds everywhere (for if we change something in # away all cmake builds everywhere (to keep things clean if we
# the CMakeList that cmake doesn't properly handle itself, etc.). # rename or move something in the build dir or if we change
entries: list[Entry] = [Entry('explicit cmake rebuild', '1')] # something cmake doesn't properly handle without a fresh start).
entries: list[Entry] = [Entry('explicit cmake rebuild', '2')]
# Start fresh if cmake version changes. # Start fresh if cmake version changes.
cmake_ver_output = subprocess.run( cmake_ver_output = subprocess.run(

View File

@ -894,6 +894,14 @@ class SpinoffContext:
'', '',
label=src_path, label=src_path,
) )
text = replace_exact(
text,
'\t@tools/pcommand update_cmake_prefab_lib server'
' $(CM_BT_LC) \\\n'
' build/cmake/modular-server-$(CM_BT_LC)\n',
'',
label=src_path,
)
return self.default_filter_text(text) return self.default_filter_text(text)

View File

@ -47,7 +47,7 @@ class AssetStager:
self.win_platform: str | None = None self.win_platform: str | None = None
self.win_type: str | None = None self.win_type: str | None = None
self.include_python_dylib = False self.include_python_dylib = False
self.include_shell_launcher = False self.include_shell_executable = False
self.include_audio = True self.include_audio = True
self.include_meshes = True self.include_meshes = True
self.include_collision_meshes = True self.include_collision_meshes = True
@ -57,8 +57,8 @@ class AssetStager:
self.include_fonts = True self.include_fonts = True
self.include_json = True self.include_json = True
self.include_pylib = False self.include_pylib = False
self.include_monolithic_binary = False self.include_binary_executable = False
self.monolithic_binary_name: str | None = None self.executable_name: str | None = None
self.pylib_src_name: str | None = None self.pylib_src_name: str | None = None
self.include_payload_file = False self.include_payload_file = False
self.tex_suffix: str | None = None self.tex_suffix: str | None = None
@ -105,6 +105,9 @@ class AssetStager:
def _parse_args(self, args: list[str]) -> None: def _parse_args(self, args: list[str]) -> None:
"""Parse args and apply to ourself.""" """Parse args and apply to ourself."""
# pylint: disable=too-many-branches
# pylint: disable=too-many-statements
if len(args) < 1: if len(args) < 1:
raise RuntimeError('Expected at least one argument.') raise RuntimeError('Expected at least one argument.')
platform_arg = args[0] platform_arg = args[0]
@ -144,13 +147,14 @@ class AssetStager:
self.dst = args[-1] self.dst = args[-1]
self.tex_suffix = '.dds' self.tex_suffix = '.dds'
# Link/copy in a binary *if* builddir is provided. # Link/copy in a binary *if* builddir is provided.
self.include_monolithic_binary = self.builddir is not None self.include_binary_executable = self.builddir is not None
self.monolithic_binary_name = 'ballisticakit' self.executable_name = 'ballisticakit'
elif platform_arg == '-cmakemodular': elif platform_arg == '-cmakemodular':
self.dst = args[-1] self.dst = args[-1]
self.tex_suffix = '.dds' self.tex_suffix = '.dds'
self.include_python_dylib = True self.include_python_dylib = True
self.include_shell_launcher = True self.include_shell_executable = True
self.executable_name = 'ballisticakit'
elif platform_arg == '-cmakeserver': elif platform_arg == '-cmakeserver':
self.dst = os.path.join(args[-1], 'dist') self.dst = os.path.join(args[-1], 'dist')
self.serverdst = args[-1] self.serverdst = args[-1]
@ -158,8 +162,17 @@ class AssetStager:
self.include_audio = False self.include_audio = False
self.include_meshes = False self.include_meshes = False
# Link/copy in a binary *if* builddir is provided. # Link/copy in a binary *if* builddir is provided.
self.include_monolithic_binary = self.builddir is not None self.include_binary_executable = self.builddir is not None
self.monolithic_binary_name = 'ballisticakit_headless' self.executable_name = 'ballisticakit_headless'
elif platform_arg == '-cmakemodularserver':
self.dst = os.path.join(args[-1], 'dist')
self.serverdst = args[-1]
self.include_textures = False
self.include_audio = False
self.include_meshes = False
self.include_python_dylib = True
self.include_shell_executable = True
self.executable_name = 'ballisticakit_headless'
elif platform_arg == '-xcode-mac': elif platform_arg == '-xcode-mac':
self.src = os.environ['SOURCE_ROOT'] + '/build/assets' self.src = os.environ['SOURCE_ROOT'] + '/build/assets'
@ -398,6 +411,7 @@ class AssetStager:
subprocess.run(cmd, check=True) subprocess.run(cmd, check=True)
def _sync_ba_data(self) -> None: def _sync_ba_data(self) -> None:
# pylint: disable=too-many-branches
assert self.dst is not None assert self.dst is not None
os.makedirs(f'{self.dst}/ba_data', exist_ok=True) os.makedirs(f'{self.dst}/ba_data', exist_ok=True)
cmd: list[str] = [ cmd: list[str] = [
@ -417,14 +431,17 @@ class AssetStager:
cmd.append('--delete-excluded') cmd.append('--delete-excluded')
else: else:
# Shouldn't be trying to do sparse stuff. # Shouldn't be trying to do sparse stuff.
assert ( if self.serverdst is not None:
self.include_textures assert self.include_json and self.include_collision_meshes
and self.include_audio else:
and self.include_fonts assert (
and self.include_json self.include_textures
and self.include_meshes and self.include_audio
and self.include_collision_meshes and self.include_fonts
) and self.include_json
and self.include_meshes
and self.include_collision_meshes
)
# Keep rsync from trying to prune this as an 'empty' dir. # Keep rsync from trying to prune this as an 'empty' dir.
cmd += ['--exclude', '/python-dylib'] cmd += ['--exclude', '/python-dylib']
@ -468,17 +485,20 @@ class AssetStager:
] ]
subprocess.run(cmd, check=True) subprocess.run(cmd, check=True)
if self.include_monolithic_binary: if self.include_binary_executable:
self._sync_monolithic_binary() self._sync_binary_executable()
if self.include_python_dylib: if self.include_python_dylib:
self._sync_python_dylib() self._sync_python_dylib()
if self.include_shell_launcher: if self.include_shell_executable:
self._sync_shell_launcher() self._sync_shell_executable()
def _sync_shell_launcher(self) -> None: def _sync_shell_executable(self) -> None:
path = f'{self.dst}/ballisticakit' if self.executable_name is None:
raise RuntimeError('Executable name must be set for this staging.')
path = f'{self.dst}/{self.executable_name}'
# For now this is so simple we just do an ad-hoc write each time; # For now this is so simple we just do an ad-hoc write each time;
# not worth setting up files and syncs. # not worth setting up files and syncs.
@ -503,10 +523,10 @@ class AssetStager:
f'{optstuff}' f'{optstuff}'
'\n' '\n'
'# Run the app, forwarding along all arguments.\n' '# Run the app, forwarding along all arguments.\n'
'# Basically this does:\n' '# Basically this will do:\n'
'# import baenv; baenv.configure();' '# import baenv; baenv.configure();'
' import babase; babase.app.run().\n' ' import babase; babase.app.run().\n'
'python3.11 ba_data/python/baenv.py $@\n' 'exec python3.11 ba_data/python/baenv.py $@\n'
) )
subprocess.run(['chmod', '+x', path], check=True) subprocess.run(['chmod', '+x', path], check=True)
@ -524,13 +544,13 @@ class AssetStager:
relpath = os.path.relpath(srcpath, os.path.dirname(dstpath)) relpath = os.path.relpath(srcpath, os.path.dirname(dstpath))
subprocess.run(['ln', '-sf', relpath, dstpath], check=True) subprocess.run(['ln', '-sf', relpath, dstpath], check=True)
def _sync_monolithic_binary(self) -> None: def _sync_binary_executable(self) -> None:
if self.builddir is None: if self.builddir is None:
raise RuntimeError("This staging type requires '-builddir' arg.") raise RuntimeError("This staging type requires '-builddir' arg.")
if self.monolithic_binary_name is None: if self.executable_name is None:
raise RuntimeError('monolithic-binary-name is not set.') raise RuntimeError('monolithic-binary-name is not set.')
mbname = self.monolithic_binary_name mbname = self.executable_name
self._copy_or_symlink_file( self._copy_or_symlink_file(
f'{self.builddir}/{mbname}', f'{self.dst}/{mbname}' f'{self.builddir}/{mbname}', f'{self.dst}/{mbname}'
) )
@ -544,8 +564,11 @@ class AssetStager:
dylib_staging_dir = f'{self.dst}/ba_data/python-dylib' dylib_staging_dir = f'{self.dst}/ba_data/python-dylib'
if self.executable_name is None:
raise RuntimeError('executable_name is not set.')
# Name of our single shared library containing all our stuff. # Name of our single shared library containing all our stuff.
soname = 'ballisticakit.so' soname = f'{self.executable_name}.so'
# All featuresets in the project with binary modules. # All featuresets in the project with binary modules.
bmodfeaturesets = { bmodfeaturesets = {