diff --git a/.efrocachemap b/.efrocachemap index 569c0b12..6f51a69f 100644 --- a/.efrocachemap +++ b/.efrocachemap @@ -4061,26 +4061,26 @@ "build/assets/windows/Win32/ucrtbased.dll": "2def5335207d41b21b9823f6805997f1", "build/assets/windows/Win32/vc_redist.x86.exe": "b08a55e2e77623fe657bea24f223a3ae", "build/assets/windows/Win32/vcruntime140d.dll": "865b2af4d1e26a1a8073c89acb06e599", - "build/prefab/full/linux_arm64_gui/debug/ballisticakit": "ae5d54179a3a0fae2de63332844033ad", - "build/prefab/full/linux_arm64_gui/release/ballisticakit": "6ee081b61d4f2fdbd93486ded4f9a64c", - "build/prefab/full/linux_arm64_server/debug/dist/ballisticakit_headless": "e7407d776c2109ff69a3cb5ba7ee96e3", - "build/prefab/full/linux_arm64_server/release/dist/ballisticakit_headless": "31a2f27c9f96e6514546c2c287e2b02a", - "build/prefab/full/linux_x86_64_gui/debug/ballisticakit": "afe92df503843db897e9d352f0f9d15d", - "build/prefab/full/linux_x86_64_gui/release/ballisticakit": "1c195ea2f0436b0857bcf1f53596c9ed", - "build/prefab/full/linux_x86_64_server/debug/dist/ballisticakit_headless": "cebf710fd74b426078849cfb61ddfe05", - "build/prefab/full/linux_x86_64_server/release/dist/ballisticakit_headless": "70444645dab4201857c281df50c7fbab", - "build/prefab/full/mac_arm64_gui/debug/ballisticakit": "4e65b35e7013a39b3c805e6b23f4c5be", - "build/prefab/full/mac_arm64_gui/release/ballisticakit": "a701d452a5a66b30b1a328c7e9da1d2f", - "build/prefab/full/mac_arm64_server/debug/dist/ballisticakit_headless": "90f94c72541a8b559fe5f937f59736cd", - "build/prefab/full/mac_arm64_server/release/dist/ballisticakit_headless": "4f003ada50c0dea27919ffaf12ed9290", - "build/prefab/full/mac_x86_64_gui/debug/ballisticakit": "20b922e9f65985fec9c19bd31b834542", - "build/prefab/full/mac_x86_64_gui/release/ballisticakit": "046391bb7ddf1a3e76c07a0299211572", - "build/prefab/full/mac_x86_64_server/debug/dist/ballisticakit_headless": "2101b917622227aa21533653b21f9192", - "build/prefab/full/mac_x86_64_server/release/dist/ballisticakit_headless": "09bd3c5237d9cc020c805252470a05f5", - "build/prefab/full/windows_x86_gui/debug/BallisticaKit.exe": "1af6ad786269c5b2f2790d51bf651eb3", - "build/prefab/full/windows_x86_gui/release/BallisticaKit.exe": "727fdbc097b2e24e12687ea9cf3c566a", - "build/prefab/full/windows_x86_server/debug/dist/BallisticaKitHeadless.exe": "a5e39a8fbb33b22b5c6791fe7a2c39f5", - "build/prefab/full/windows_x86_server/release/dist/BallisticaKitHeadless.exe": "8ba33e36b368e3f2e31da15399fcad99", + "build/prefab/full/linux_arm64_gui/debug/ballisticakit": "93a99cb9461e8c506c5605f9c63dce2d", + "build/prefab/full/linux_arm64_gui/release/ballisticakit": "54ceb7e159839e7f8c7959a5d71335da", + "build/prefab/full/linux_arm64_server/debug/dist/ballisticakit_headless": "fe821168d2dbd6e10acd3bdf70ab61af", + "build/prefab/full/linux_arm64_server/release/dist/ballisticakit_headless": "cce6d43ddec6691d8f43e3561ff299b6", + "build/prefab/full/linux_x86_64_gui/debug/ballisticakit": "38f68382d5f31c1295f796c3766c9426", + "build/prefab/full/linux_x86_64_gui/release/ballisticakit": "d2d222177bb3a60c46921f556b52ad06", + "build/prefab/full/linux_x86_64_server/debug/dist/ballisticakit_headless": "b1d01b76bcf92ebc144df17c9b5fcc07", + "build/prefab/full/linux_x86_64_server/release/dist/ballisticakit_headless": "8d9848fbfdd81c1b32ce1f431203e2b9", + "build/prefab/full/mac_arm64_gui/debug/ballisticakit": "5e2dd187f69557ef546b9361cecda199", + "build/prefab/full/mac_arm64_gui/release/ballisticakit": "e6c72fb374b823a92786861f01adc733", + "build/prefab/full/mac_arm64_server/debug/dist/ballisticakit_headless": "aca0400a32de3484178c4c93a9b430e5", + "build/prefab/full/mac_arm64_server/release/dist/ballisticakit_headless": "6be79f8695e63d7dadc8ff37756cc440", + "build/prefab/full/mac_x86_64_gui/debug/ballisticakit": "e578d0dc38ffec38e8cb7b9893caaf10", + "build/prefab/full/mac_x86_64_gui/release/ballisticakit": "824bac953cbe94f1f5a5bc714cc139a0", + "build/prefab/full/mac_x86_64_server/debug/dist/ballisticakit_headless": "7909565c7d5a006f2fdd2bced6cca2ba", + "build/prefab/full/mac_x86_64_server/release/dist/ballisticakit_headless": "64dd34b2fedb26c9890c509d1bc81531", + "build/prefab/full/windows_x86_gui/debug/BallisticaKit.exe": "df7d4ca2e5e1112c467635ce90bbb198", + "build/prefab/full/windows_x86_gui/release/BallisticaKit.exe": "3790fd6da37a7f3e2d263121ca52609f", + "build/prefab/full/windows_x86_server/debug/dist/BallisticaKitHeadless.exe": "dd8e29d218b374975e7981a4ef9510f1", + "build/prefab/full/windows_x86_server/release/dist/BallisticaKitHeadless.exe": "bbe238d97fcc1ddb0d4a094ce3affc04", "build/prefab/lib/linux_arm64_gui/debug/libballisticaplus.a": "d9865523059d8cf11b2bef4b9da9a8c9", "build/prefab/lib/linux_arm64_gui/release/libballisticaplus.a": "56d6440f62c271c4ce9ef520400395a3", "build/prefab/lib/linux_arm64_server/debug/libballisticaplus.a": "d9865523059d8cf11b2bef4b9da9a8c9", @@ -4097,14 +4097,14 @@ "build/prefab/lib/mac_x86_64_gui/release/libballisticaplus.a": "c2cf0dc227e41a826c913d12e117c316", "build/prefab/lib/mac_x86_64_server/debug/libballisticaplus.a": "fbdc80e41c5883b4a893d2f0786e377f", "build/prefab/lib/mac_x86_64_server/release/libballisticaplus.a": "c2cf0dc227e41a826c913d12e117c316", - "build/prefab/lib/windows/Debug_Win32/BallisticaKitGenericPlus.lib": "73e6dd8dfba14ad1528d154ec43188c1", - "build/prefab/lib/windows/Debug_Win32/BallisticaKitGenericPlus.pdb": "dfdb92bb0d84c405374e7da63c0eea4d", - "build/prefab/lib/windows/Debug_Win32/BallisticaKitHeadlessPlus.lib": "c20a6bd8ea7212f52c291fb6134a9bad", - "build/prefab/lib/windows/Debug_Win32/BallisticaKitHeadlessPlus.pdb": "0e994a801d91149256f2200f75cf58d6", - "build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.lib": "de98295b7373dcf3c31d3cc5a135578b", - "build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.pdb": "65e5b683dfa92a02909e8182d6b25d6e", - "build/prefab/lib/windows/Release_Win32/BallisticaKitHeadlessPlus.lib": "f1e4e29d76abdb38e92a93f45135d1d8", - "build/prefab/lib/windows/Release_Win32/BallisticaKitHeadlessPlus.pdb": "8089cf4b541d14dc38ae71f3d05bde8e", + "build/prefab/lib/windows/Debug_Win32/BallisticaKitGenericPlus.lib": "1dfca87081151b7e5a06442214253dd5", + "build/prefab/lib/windows/Debug_Win32/BallisticaKitGenericPlus.pdb": "b940b29384c69fd72a36b850d169c026", + "build/prefab/lib/windows/Debug_Win32/BallisticaKitHeadlessPlus.lib": "bb66949717079167eec996e90ef69585", + "build/prefab/lib/windows/Debug_Win32/BallisticaKitHeadlessPlus.pdb": "46fcd10d6fea36f51f61d6a11ea94e16", + "build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.lib": "12ae5b092aef3ea1770586f8f5d34a00", + "build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.pdb": "374d9852e5489ece98043ee62fff9b4b", + "build/prefab/lib/windows/Release_Win32/BallisticaKitHeadlessPlus.lib": "ef51d5e45ebb0d53da0bb1f901f03129", + "build/prefab/lib/windows/Release_Win32/BallisticaKitHeadlessPlus.pdb": "e796ef2416394cd133bb5f52f8e0f6a2", "src/assets/ba_data/python/babase/_mgen/__init__.py": "f885fed7f2ed98ff2ba271f9dbe3391c", "src/assets/ba_data/python/babase/_mgen/enums.py": "b611c090513a21e2fe90e56582724e9d", "src/ballistica/base/mgen/pyembed/binding_base.inc": "72bfed2cce8ff19741989dec28302f3f", diff --git a/CHANGELOG.md b/CHANGELOG.md index cc0a07fb..c37acbcb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,4 @@ -### 1.7.33 (build 21779, api 8, 2024-03-13) +### 1.7.33 (build 21788, api 8, 2024-03-14) - Stress test input-devices are now a bit smarter; they won't press any buttons while UIs are up (this could cause lots of chaos if it happened). - Added a 'Show Demos When Idle' option in advanced settings. If enabled, the @@ -41,9 +41,14 @@ - Added a UI for customizing Series Length in Teams and Points-to-Win in FFA (Thanks EraOSBeta!) - Implemented HEX code support to the advanced color picker (Thanks 3alTemp!) +- Players leaving the game after getting hurt will now grant kills. (Thanks + Temp!) - Sphinx based Python documentation generation is now wired up (Thanks Loup-Garou911XD!) - Renaming & overwriting existing profiles is no longer possible (Thanks Temp!) +- Cleaned up builds when running under WSL. Things like `make mypy` should now + work correctly there, and it should now be possible to build and run either + Linux or Windows builds there. ### 1.7.32 (build 21741, api 8, 2023-12-20) - Fixed a screen message that no one will ever see (Thanks vishal332008?...) diff --git a/Makefile b/Makefile index e43ffd49..70526b24 100644 --- a/Makefile +++ b/Makefile @@ -151,7 +151,7 @@ meta-clean: # few things such as localconfig.json). clean: $(CHECK_CLEAN_SAFETY) - rm -rf build # Handle this part ourself; can confuse git. + rm -rf build # Kill build ourself; may confuse git if contains other repos. git clean -dfx $(ROOT_CLEAN_IGNORES) # Show what clean would delete without actually deleting it. @@ -210,37 +210,42 @@ pcommandbatch_speed_test: prereqs # Prebuilt binaries for various platforms. +# WSL is Linux but running under Windows, so it can target either. By default +# we want these top level targets (prefab-gui-debug, etc.) to yield native +# Windows builds from WSL, but this env var can be set to override that. +BA_WSL_TARGETS_WINDOWS ?= 1 + # Assemble & run a gui debug build for this platform. prefab-gui-debug: prefab-gui-debug-build - $($(shell $(PCOMMAND) prefab_run_var gui-debug)) + $($(shell $(WSLU) $(PCOMMAND) prefab_run_var gui-debug)) # Assemble & run a gui release build for this platform. prefab-gui-release: prefab-gui-release-build - $($(shell $(PCOMMAND) prefab_run_var gui-release)) + $($(shell $(WSLU) $(PCOMMAND) prefab_run_var gui-release)) # Assemble a debug build for this platform. prefab-gui-debug-build: - @$(PCOMMAND) make_prefab gui-debug + $(WSLU) $(PCOMMAND) make_prefab gui-debug # Assemble a release build for this platform. prefab-gui-release-build: - @$(PCOMMAND) make_prefab gui-release + $(WSLU) $(PCOMMAND) make_prefab gui-release # Assemble & run a server debug build for this platform. prefab-server-debug: prefab-server-debug-build - $($(shell $(PCOMMAND) prefab_run_var server-debug)) + $($(shell $(WSLU) $(PCOMMAND) prefab_run_var server-debug)) # Assemble & run a server release build for this platform. prefab-server-release: prefab-server-release-build - $($(shell $(PCOMMAND) prefab_run_var server-release)) + $($(shell $(WSLU) $(PCOMMAND) prefab_run_var server-release)) # Assemble a server debug build for this platform. prefab-server-debug-build: - @$(PCOMMAND) make_prefab server-debug + $(WSLU) $(PCOMMAND) make_prefab server-debug # Assemble a server release build for this platform. prefab-server-release-build: - @$(PCOMMAND) make_prefab server-release + $(WSLU) $(PCOMMAND) make_prefab server-release # Clean all prefab builds. prefab-clean: @@ -261,11 +266,11 @@ RUN_PREFAB_MAC_ARM64_GUI_DEBUG = cd build/prefab/full/mac_arm64_gui/debug \ prefab-mac-x86-64-gui-debug: prefab-mac-x86-64-gui-debug-build @$(PCOMMAND) ensure_prefab_platform mac_x86_64 - @$(RUN_PREFAB_MAC_X86_64_GUI_DEBUG) + $(RUN_PREFAB_MAC_X86_64_GUI_DEBUG) prefab-mac-arm64-gui-debug: prefab-mac-arm64-gui-debug-build @$(PCOMMAND) ensure_prefab_platform mac_arm64 - @$(RUN_PREFAB_MAC_ARM64_GUI_DEBUG) + $(RUN_PREFAB_MAC_ARM64_GUI_DEBUG) prefab-mac-x86-64-gui-debug-build: prereqs assets-cmake \ build/prefab/full/mac_x86_64_gui/debug/ballisticakit @@ -291,11 +296,11 @@ RUN_PREFAB_MAC_ARM64_GUI_RELEASE = cd build/prefab/full/mac_arm64_gui/release \ prefab-mac-x86-64-gui-release: prefab-mac-x86-64-gui-release-build @$(PCOMMAND) ensure_prefab_platform mac_x86_64 - @$(RUN_PREFAB_MAC_X86_64_GUI_RELEASE) + $(RUN_PREFAB_MAC_X86_64_GUI_RELEASE) prefab-mac-arm64-gui-release: prefab-mac-arm64-gui_release-build @$(PCOMMAND) ensure_prefab_platform mac_arm64 - @$(RUN_PREFAB_MAC_ARM64_GUI_RELEASE) + $(RUN_PREFAB_MAC_ARM64_GUI_RELEASE) prefab-mac-x86-64-gui-release-build: prereqs assets-cmake \ build/prefab/full/mac_x86_64_gui/release/ballisticakit @@ -325,7 +330,7 @@ prefab-mac-x86-64-server-debug: prefab-mac-x86-64-server-debug-build prefab-mac-arm64-server-debug: prefab-mac-arm64-server-debug-build @$(PCOMMAND) ensure_prefab_platform mac_arm64 - @$(RUN_PREFAB_MAC_ARM64_SERVER_DEBUG) + $(RUN_PREFAB_MAC_ARM64_SERVER_DEBUG) prefab-mac-x86-64-server-debug-build: prereqs assets-server \ build/prefab/full/mac_x86_64_server/debug/dist/ballisticakit_headless @@ -351,11 +356,11 @@ RUN_PREFAB_MAC_ARM64_SERVER_RELEASE = cd \ prefab-mac-x86-64-server-release: prefab-mac-x86-64-server-release-build @$(PCOMMAND) ensure_prefab_platform mac_x86_64 - @$(RUN_PREFAB_MAC_X86_64_SERVER_RELEASE) + $(RUN_PREFAB_MAC_X86_64_SERVER_RELEASE) prefab-mac-arm64-server-release: prefab-mac-arm64-server-release-build @$(PCOMMAND) ensure_prefab_platform mac_arm64 - @$(RUN_PREFAB_MAC_ARM64_SERVER_RELEASE) + $(RUN_PREFAB_MAC_ARM64_SERVER_RELEASE) prefab-mac-x86-64-server-release-build: prereqs assets-server \ build/prefab/full/mac_x86_64_server/release/dist/ballisticakit_headless @@ -382,12 +387,12 @@ RUN_PREFAB_LINUX_ARM64_GUI_DEBUG = cd \ build/prefab/full/linux_arm64_gui/debug && ./ballisticakit prefab-linux-x86-64-gui-debug: prefab-linux-x86-64-gui-debug-build - @$(PCOMMAND) ensure_prefab_platform linux_x86_64 - @$(RUN_PREFAB_LINUX_X86_64_GUI_DEBUG) + @$(WSLL) $(PCOMMAND) ensure_prefab_platform linux_x86_64 + $(RUN_PREFAB_LINUX_X86_64_GUI_DEBUG) prefab-linux-arm64-gui-debug: prefab-linux-arm64-gui-debug-build - @$(PCOMMAND) ensure_prefab_platform linux_arm64 - @$(RUN_PREFAB_LINUX_ARM64_GUI_DEBUG) + @$(WSLL) $(PCOMMAND) ensure_prefab_platform linux_arm64 + $(RUN_PREFAB_LINUX_ARM64_GUI_DEBUG) prefab-linux-x86-64-gui-debug-build: prereqs assets-cmake \ build/prefab/full/linux_x86_64_gui/debug/ballisticakit @@ -412,12 +417,12 @@ RUN_PREFAB_LINUX_ARM64_GUI_RELEASE = cd \ build/prefab/full/linux_arm64_gui/release && ./ballisticakit prefab-linux-x86-64-gui-release: prefab-linux-x86-64-gui-release-build - @$(PCOMMAND) ensure_prefab_platform linux_x86_64 - @$(RUN_PREFAB_LINUX_X86_64_GUI_RELEASE) + @$(WSLL) $(PCOMMAND) ensure_prefab_platform linux_x86_64 + $(RUN_PREFAB_LINUX_X86_64_GUI_RELEASE) prefab-linux-arm64-gui-release: prefab-linux-arm64-gui-release-build - @$(PCOMMAND) ensure_prefab_platform linux_arm64 - @$(RUN_PREFAB_LINUX_ARM64_GUI_RELEASE) + @$(WSLL) $(PCOMMAND) ensure_prefab_platform linux_arm64 + $(RUN_PREFAB_LINUX_ARM64_GUI_RELEASE) prefab-linux-x86-64-gui-release-build: prereqs assets-cmake \ build/prefab/full/linux_x86_64_gui/release/ballisticakit @@ -442,12 +447,12 @@ RUN_PREFAB_LINUX_ARM64_SERVER_DEBUG = cd \ build/prefab/full/linux_arm64_server/debug && ./ballisticakit_server prefab-linux-x86-64-server-debug: prefab-linux-x86-64-server-debug-build - @$(PCOMMAND) ensure_prefab_platform linux_x86_64 - @$(RUN_PREFAB_LINUX_X86_64_SERVER_DEBUG) + @$(WSLL) $(PCOMMAND) ensure_prefab_platform linux_x86_64 + $(RUN_PREFAB_LINUX_X86_64_SERVER_DEBUG) prefab-linux-arm64-server-debug: prefab-linux-arm64-server-debug-build - @$(PCOMMAND) ensure_prefab_platform linux_arm64 - @$(RUN_PREFAB_LINUX_ARM64_SERVER_DEBUG) + @$(WSLL) $(PCOMMAND) ensure_prefab_platform linux_arm64 + $(RUN_PREFAB_LINUX_ARM64_SERVER_DEBUG) prefab-linux-x86-64-server-debug-build: prereqs assets-server \ build/prefab/full/linux_x86_64_server/debug/dist/ballisticakit_headless @@ -474,12 +479,12 @@ RUN_PREFAB_LINUX_ARM64_SERVER_RELEASE = cd \ build/prefab/full/linux_arm64_server/release && ./ballisticakit_server prefab-linux-x86-64-server-release: prefab-linux-x86-64-server-release-build - @$(PCOMMAND) ensure_prefab_platform linux_x86_64 - @$(RUN_PREFAB_LINUX_X86_64_SERVER_RELEASE) + @$(WSLL) $(PCOMMAND) ensure_prefab_platform linux_x86_64 + $(RUN_PREFAB_LINUX_X86_64_SERVER_RELEASE) prefab-linux-arm64-server-release: prefab-linux-arm64-server-release-build - @$(PCOMMAND) ensure_prefab_platform linux_arm64 - @$(RUN_PREFAB_LINUX_ARM64_SERVER_RELEASE) + @$(WSLL) $(PCOMMAND) ensure_prefab_platform linux_arm64 + $(RUN_PREFAB_LINUX_ARM64_SERVER_RELEASE) prefab-linux-x86-64-server-release-build: prereqs assets-server \ build/prefab/full/linux_x86_64_server/release/dist/ballisticakit_headless @@ -503,8 +508,8 @@ RUN_PREFAB_WINDOWS_X86_GUI_DEBUG = cd build/prefab/full/windows_x86_gui/debug \ && ./BallisticaKit.exe prefab-windows-x86-gui-debug: prefab-windows-x86-gui-debug-build - @$(PCOMMAND) ensure_prefab_platform windows_x86 - @$(RUN_PREFAB_WINDOWS_X86_GUI_DEBUG) + @$(WSLW) $(PCOMMAND) ensure_prefab_platform windows_x86 + $(RUN_PREFAB_WINDOWS_X86_GUI_DEBUG) prefab-windows-x86-gui-debug-build: prereqs assets-windows-$(WINPLAT_X86) \ build/prefab/full/windows_x86_gui/debug/BallisticaKit.exe @@ -526,8 +531,8 @@ RUN_PREFAB_WINDOWS_X86_GUI_RELEASE = cd \ build/prefab/full/windows_x86_gui/release && ./BallisticaKit.exe prefab-windows-x86-gui-release: prefab-windows-x86-gui-release-build - @$(PCOMMAND) ensure_prefab_platform windows_x86 - @$(RUN_PREFAB_WINDOWS_X86_GUI_RELEASE) + @$(WSLW) $(PCOMMAND) ensure_prefab_platform windows_x86 + $(RUN_PREFAB_WINDOWS_X86_GUI_RELEASE) prefab-windows-x86-gui-release-build: prereqs \ assets-windows-$(WINPLAT_X86) \ @@ -551,8 +556,8 @@ RUN_PREFAB_WINDOWS_X86_SERVER_DEBUG = cd \ && dist/python_d.exe ballisticakit_server.py prefab-windows-x86-server-debug: prefab-windows-x86-server-debug-build - @$(PCOMMAND) ensure_prefab_platform windows_x86 - @$(RUN_PREFAB_WINDOWS_X86_SERVER_DEBUG) + @$(WSLW) $(PCOMMAND) ensure_prefab_platform windows_x86 + $(RUN_PREFAB_WINDOWS_X86_SERVER_DEBUG) prefab-windows-x86-server-debug-build: prereqs \ assets-windows-$(WINPLAT_X86) \ @@ -576,8 +581,8 @@ RUN_PREFAB_WINDOWS_X86_SERVER_RELEASE = cd \ && dist/python.exe -O ballisticakit_server.py prefab-windows-x86-server-release: prefab-windows-x86-server-release-build - @$(PCOMMAND) ensure_prefab_platform windows_x86 - @$(RUN_PREFAB_WINDOWS_X86_SERVER_RELEASE) + @$(WSLW) $(PCOMMAND) ensure_prefab_platform windows_x86 + $(RUN_PREFAB_WINDOWS_X86_SERVER_RELEASE) prefab-windows-x86-server-release-build: prereqs \ assets-windows-$(WINPLAT_X86) \ @@ -964,66 +969,66 @@ WINDOWS_CONFIGURATION ?= Debug # Stage assets and other files so a built binary will run. windows-staging: assets-windows resources meta - $(STAGE_BUILD) -win-$(WINPLT) -$(WINCFGLC) build/windows/$(WINCFG)_$(WINPLT) + @$(STAGE_BUILD) -win-$(WINPLT) -$(WINCFGLC) build/windows/$(WINCFG)_$(WINPLT) # Build and run a debug windows build (from WSL). windows-debug: windows-debug-build - @$(PCOMMAND) ensure_prefab_platform windows_x86 + @$(WSLW) $(PCOMMAND) ensure_prefab_platform windows_x86 build/windows/Debug_Win32/BallisticaKitGeneric.exe # Build and run a release windows build (from WSL). windows-release: windows-release-build - @$(PCOMMAND) ensure_prefab_platform windows_x86 + @$(WSLW) $(PCOMMAND) ensure_prefab_platform windows_x86 build/windows/Release_Win32/BallisticaKitGeneric.exe # Build a debug windows build (from WSL). -windows-debug-build: \ +windows-debug-build: prereqs \ build/prefab/lib/windows/Debug_Win32/BallisticaKitGenericPlus.lib \ build/prefab/lib/windows/Debug_Win32/BallisticaKitGenericPlus.pdb - @$(PCOMMAND) ensure_prefab_platform windows_x86 + @$(WSLW) $(PCOMMAND) ensure_prefab_platform windows_x86 @$(PCOMMAND) wsl_build_check_win_drive WINDOWS_CONFIGURATION=Debug WINDOWS_PLATFORM=Win32 $(MAKE) windows-staging WINDOWS_PROJECT=Generic WINDOWS_CONFIGURATION=Debug WINDOWS_PLATFORM=Win32 \ $(MAKE) _windows-wsl-build # Rebuild a debug windows build (from WSL). -windows-debug-rebuild: \ +windows-debug-rebuild: prereqs \ build/prefab/lib/windows/Debug_Win32/BallisticaKitGenericPlus.lib \ build/prefab/lib/windows/Debug_Win32/BallisticaKitGenericPlus.pdb - @$(PCOMMAND) ensure_prefab_platform windows_x86 + @$(WSLW) $(PCOMMAND) ensure_prefab_platform windows_x86 @$(PCOMMAND) wsl_build_check_win_drive WINDOWS_CONFIGURATION=Debug WINDOWS_PLATFORM=Win32 $(MAKE) windows-staging WINDOWS_PROJECT=Generic WINDOWS_CONFIGURATION=Debug WINDOWS_PLATFORM=Win32 \ $(MAKE) _windows-wsl-rebuild # Build a release windows build (from WSL). -windows-release-build: \ +windows-release-build: prereqs \ build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.lib \ build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.pdb - @$(PCOMMAND) ensure_prefab_platform windows_x86 + @$(WSLW) $(PCOMMAND) ensure_prefab_platform windows_x86 @$(PCOMMAND) wsl_build_check_win_drive WINDOWS_CONFIGURATION=Release WINDOWS_PLATFORM=Win32 $(MAKE) windows-staging WINDOWS_PROJECT=Generic WINDOWS_CONFIGURATION=Release WINDOWS_PLATFORM=Win32 \ $(MAKE) _windows-wsl-build # Rebuild a release windows build (from WSL). -windows-release-rebuild: \ +windows-release-rebuild: prereqs \ build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.lib \ build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.pdb - @$(PCOMMAND) ensure_prefab_platform windows_x86 + @$(WSLW) $(PCOMMAND) ensure_prefab_platform windows_x86 @$(PCOMMAND) wsl_build_check_win_drive WINDOWS_CONFIGURATION=Release WINDOWS_PLATFORM=Win32 $(MAKE) windows-staging WINDOWS_PROJECT=Generic WINDOWS_CONFIGURATION=Release WINDOWS_PLATFORM=Win32 \ $(MAKE) _windows-wsl-rebuild # Remove all non-git-managed files in windows subdir. -windows-clean: +windows-clean: prereqs @$(CHECK_CLEAN_SAFETY) git clean -dfx ballisticakit-windows rm -rf build/windows $(LAZYBUILDDIR) # Show what would be cleaned. -windows-clean-list: +windows-clean-list: prereqs @$(CHECK_CLEAN_SAFETY) git clean -dnx ballisticakit-windows echo would also remove build/windows $(LAZYBUILDDIR) @@ -1145,8 +1150,8 @@ cmake-modular-server-clean: # Stage assets for building/running within CLion. clion-staging: assets-cmake resources meta - $(STAGE_BUILD) -cmake -debug build/clion_debug - $(STAGE_BUILD) -cmake -release build/clion_release + @$(STAGE_BUILD) -cmake -debug build/clion_debug + @$(STAGE_BUILD) -cmake -release build/clion_release # Tell make which of these targets don't represent files. .PHONY: cmake cmake-build cmake-clean cmake-server cmake-server-build \ @@ -1245,6 +1250,13 @@ _WMSBE_2 = \\Community\\MSBuild\\Current\\Bin\\MSBuild.exe\" _WMSBE_1B = /mnt/c/Program Files/Microsoft Visual Studio/2022 _WMSBE_2B = /Community/MSBuild/Current/Bin/MSBuild.exe +# Sets WSL build type to the user's choice (defaults to Windows). +WSLU=BA_WSL_TARGETS_WINDOWS=$(BA_WSL_TARGETS_WINDOWS) +# Sets WSL build type to Linux. +WSLL=BA_WSL_TARGETS_WINDOWS=0 +# Sets WSL build type to Windows. +WSLW=BA_WSL_TARGETS_WINDOWS=1 + VISUAL_STUDIO_VERSION = -property:VisualStudioVersion=17 WIN_MSBUILD_EXE = $(_WMSBE_1)$(_WMSBE_2) WIN_MSBUILD_EXE_B = "$(_WMSBE_1B)$(_WMSBE_2B)" diff --git a/src/assets/ba_data/python/baenv.py b/src/assets/ba_data/python/baenv.py index 5870b584..e795bb6e 100644 --- a/src/assets/ba_data/python/baenv.py +++ b/src/assets/ba_data/python/baenv.py @@ -52,7 +52,7 @@ if TYPE_CHECKING: # Build number and version of the ballistica binary we expect to be # using. -TARGET_BALLISTICA_BUILD = 21779 +TARGET_BALLISTICA_BUILD = 21788 TARGET_BALLISTICA_VERSION = '1.7.33' diff --git a/src/assets/ba_data/python/bascenev1lib/actor/playerspaz.py b/src/assets/ba_data/python/bascenev1lib/actor/playerspaz.py index 58069c54..fabfd2ef 100644 --- a/src/assets/ba_data/python/bascenev1lib/actor/playerspaz.py +++ b/src/assets/ba_data/python/bascenev1lib/actor/playerspaz.py @@ -223,10 +223,21 @@ class PlayerSpaz(Spaz): elif isinstance(msg, bs.DieMessage): # Report player deaths to the game. if not self._dead: - # Immediate-mode or left-game deaths don't count as 'kills'. - killed = ( - not msg.immediate and msg.how is not bs.DeathType.LEFT_GAME + # Was this player killed while being held? + was_held = self.held_count > 0 and self.last_player_held_by + # Was this player attacked before death? + was_attacked_recently = ( + self.last_player_attacked_by + and bs.time() - self.last_attacked_time < 4.0 ) + # Leaving the game doesn't count as a kill *unless* + # someone does it intentionally while being attacked. + left_game_cleanly = ( + msg.how is bs.DeathType.LEFT_GAME + and not (was_held or was_attacked_recently) + ) + + killed = not (msg.immediate or left_game_cleanly) activity = self._activity() @@ -236,7 +247,7 @@ class PlayerSpaz(Spaz): else: # If this player was being held at the time of death, # the holder is the killer. - if self.held_count > 0 and self.last_player_held_by: + if was_held: killerplayer = self.last_player_held_by else: # Otherwise, if they were attacked by someone in the @@ -246,10 +257,7 @@ class PlayerSpaz(Spaz): # all bot kills would register as suicides; need to # change this from last_player_attacked_by to # something like last_actor_attacked_by to fix that. - if ( - self.last_player_attacked_by - and bs.time() - self.last_attacked_time < 4.0 - ): + if was_attacked_recently: killerplayer = self.last_player_attacked_by else: # ok, call it a suicide unless we're in co-op diff --git a/src/ballistica/shared/ballistica.cc b/src/ballistica/shared/ballistica.cc index 0b9ab797..2956724a 100644 --- a/src/ballistica/shared/ballistica.cc +++ b/src/ballistica/shared/ballistica.cc @@ -39,7 +39,7 @@ auto main(int argc, char** argv) -> int { namespace ballistica { // These are set automatically via script; don't modify them here. -const int kEngineBuildNumber = 21779; +const int kEngineBuildNumber = 21788; const char* kEngineVersion = "1.7.33"; const int kEngineApiVersion = 8; diff --git a/src/ballistica/shared/foundation/event_loop.cc b/src/ballistica/shared/foundation/event_loop.cc index a2a714c5..d390defa 100644 --- a/src/ballistica/shared/foundation/event_loop.cc +++ b/src/ballistica/shared/foundation/event_loop.cc @@ -328,7 +328,6 @@ void EventLoop::BootstrapThread_() { assert(!bootstrapped_); assert(g_core); thread_id_ = std::this_thread::get_id(); - const char* id_string; switch (identifier_) { case EventLoopID::kLogic: diff --git a/src/tools/pcommandbatch/pcommandbatch.c b/src/tools/pcommandbatch/pcommandbatch.c index 4e1c6991..846a8d0d 100644 --- a/src/tools/pcommandbatch/pcommandbatch.c +++ b/src/tools/pcommandbatch/pcommandbatch.c @@ -165,11 +165,16 @@ int get_running_server_port_(const struct Context_* ctx, cJSON* state_dict = cJSON_Parse(buf); if (!state_dict) { + // An un-parseable state file is not a recoverable error; go down hard. + // State files are written and then moved into place so we should never + // see something like a half-written file. fprintf(stderr, - "Error: pcommandbatch client %s_%d (pid %d): failed to parse state " - "value.\n", - ctx->instance_prefix, ctx->instance_num, ctx->pid); - return -1; + "Fatal Error: pcommandbatch client %s_%d (pid %d):" + " failed to parse state file value of size %zu.\n", + ctx->instance_prefix, ctx->instance_num, ctx->pid, amt); + fflush(stderr); + abort(); + // return -1; } // If results included output, print it. diff --git a/tools/batools/apprun.py b/tools/batools/apprun.py index e3e3640a..0e8afd9c 100755 --- a/tools/batools/apprun.py +++ b/tools/batools/apprun.py @@ -1,6 +1,6 @@ # Released under the MIT License. See LICENSE for details. # -"""Utils for wrangling runs of the app. +"""Utils for wrangling running the app as part of a build. Manages constructing or downloading it as well as running it. """ @@ -105,6 +105,9 @@ def acquire_binary(assets: bool, purpose: str) -> str: if os.environ.get('BA_APP_RUN_ENABLE_BUILDS') == '1': # Going the build-it-ourselves route. + # Don't need any env mods for this path. + env = None + if os.environ.get('BA_APP_RUN_BUILD_HEADLESS') == '1': # User has opted for headless builds. if assets: @@ -141,16 +144,23 @@ def acquire_binary(assets: bool, purpose: str) -> str: binary_build_command = ['make', 'cmake-binary'] binary_path = 'build/cmake/debug/staged/ballisticakit' else: - # Ok; going with prefab headless stuff. + # Ok; going with a downloaded prefab headless build. - # Let the user know how to use their own binaries instead. + # By default, prefab build targets on WSL (Linux running on + # Windows) will give us Windows builds which won't work right + # here. Ask it for Linux builds instead. + env = dict(os.environ, BA_WSL_TARGETS_WINDOWS='0') + + # Let the user know how to use their own built binaries instead + # if they prefer. note = '\n' + textwrap.fill( - 'NOTE: You can set env-var BA_APP_RUN_ENABLE_BUILDS=1' - f' to use locally-built binaries for {purpose}' - ' instead of prefab ones. This will properly reflect any changes' - ' you\'ve made to the C/C++ layer.', + f'NOTE: You can set env-var BA_APP_RUN_ENABLE_BUILDS=1' + f' to use locally-built binaries for {purpose} instead' + f' of prefab ones. This will properly reflect any changes' + f' you\'ve made to the C/C++ layer.', 80, ) + if assets: print( f'{Clr.SMAG}Fetching prefab binary & assets for' @@ -160,6 +170,7 @@ def acquire_binary(assets: bool, purpose: str) -> str: binary_path = ( subprocess.run( ['tools/pcommand', 'prefab_binary_path', 'server-release'], + env=env, check=True, capture_output=True, ) @@ -176,6 +187,7 @@ def acquire_binary(assets: bool, purpose: str) -> str: binary_path = ( subprocess.run( ['tools/pcommand', 'prefab_binary_path', 'server-release'], + env=env, check=True, capture_output=True, ) @@ -184,7 +196,7 @@ def acquire_binary(assets: bool, purpose: str) -> str: ) binary_build_command = ['make', binary_path] - subprocess.run(binary_build_command, check=True) + subprocess.run(binary_build_command, env=env, check=True) if not os.path.exists(binary_path): raise RuntimeError( f"Binary not found at expected path '{binary_path}'." diff --git a/tools/batools/build.py b/tools/batools/build.py index 69a94a63..b7c54495 100644 --- a/tools/batools/build.py +++ b/tools/batools/build.py @@ -76,6 +76,87 @@ class PrefabTarget(Enum): GUI_RELEASE = 'gui-release' SERVER_RELEASE = 'server-release' + @property + def buildtype(self) -> str: + """Return the build type for this target.""" + return self.value.split('-')[0] + + @property + def buildmode(self) -> str: + """Return the build mode for this target.""" + return self.value.split('-')[1] + + +class PrefabPlatform(Enum): + """Distinct os/cpu-arch/etc. combos we support for prefab builds.""" + + MAC_X86_64 = 'mac_x86_64' + MAC_ARM64 = 'mac_arm64' + WINDOWS_X86 = 'windows_x86' + LINUX_X86_64 = 'linux_x86_64' + LINUX_ARM64 = 'linux_arm64' + + @classmethod + def get_current( + cls, wsl_targets_windows: bool | None = None + ) -> PrefabPlatform: + """Get an identifier for the platform running this build. + + Pass a bool `wsl_targets_windows` value to cause WSL to target + either native Windows (True) or Linux (False). If this value is + not passed, the env var BA_WSL_TARGETS_WINDOWS is used, and if that + is not set, the default is False (Linux builds). + + Throws a RuntimeError on unsupported platforms. + """ + import platform + + if wsl_targets_windows is None: + wsl_targets_windows = ( + os.environ.get('BA_WSL_TARGETS_WINDOWS', '0') == '1' + ) + + system = platform.system() + machine = platform.machine() + + if system == 'Darwin': + if machine == 'x86_64': + return cls.MAC_X86_64 + if machine == 'arm64': + return cls.MAC_ARM64 + raise RuntimeError( + f'PrefabPlatform.get_current:' + f' unsupported mac machine type:' + f' {machine}.' + ) + if system == 'Linux': + # If it looks like we're in Windows Subsystem for Linux, we may + # want to operate on Windows versions. + if wsl_targets_windows: + if 'microsoft' in platform.uname().release.lower(): + if machine == 'x86_64': + # Currently always targeting 32 bit for prefab stuff. + return cls.WINDOWS_X86 + # TODO: add support for arm windows + raise RuntimeError( + f'make_prefab: unsupported win machine type: {machine}.' + ) + + if machine == 'x86_64': + return cls.LINUX_X86_64 + if machine == 'aarch64': + return cls.LINUX_ARM64 + raise RuntimeError( + f'PrefabPlatform.get_current:' + f' unsupported linux machine type:' + f' {machine}.' + ) + raise RuntimeError( + f'PrefabPlatform.get_current:' + f' unrecognized platform:' + f' {platform.system()}.' + ) + class LazyBuildCategory(Enum): """Types of sources.""" @@ -296,49 +377,6 @@ def archive_old_builds( ) -def get_current_prefab_platform(wsl_gives_windows: bool = True) -> str: - """Get an identifier for the platform running this build. - - Throws a RuntimeError on unsupported platforms. - """ - import platform - - system = platform.system() - machine = platform.machine() - - if system == 'Darwin': - if machine == 'x86_64': - return 'mac_x86_64' - if machine == 'arm64': - return 'mac_arm64' - raise RuntimeError( - f'make_prefab: unsupported mac machine type:' f' {machine}.' - ) - if system == 'Linux': - # If it looks like we're in Windows Subsystem for Linux, - # we may want to operate on Windows versions. - if wsl_gives_windows: - if 'microsoft' in platform.uname().release.lower(): - if machine == 'x86_64': - # Currently always targeting 32 bit for prefab stuff. - return 'windows_x86' - # TODO: add support for arm windows - raise RuntimeError( - f'make_prefab: unsupported win machine type: {machine}.' - ) - - if machine == 'x86_64': - return 'linux_x86_64' - if machine == 'aarch64': - return 'linux_arm64' - raise RuntimeError( - f'make_prefab: unsupported linux machine type:' f' {machine}.' - ) - raise RuntimeError( - f'make_prefab: unrecognized platform:' f' {platform.system()}.' - ) - - def _vstr(nums: Sequence[int]) -> str: return '.'.join(str(i) for i in nums) diff --git a/tools/batools/pcommands.py b/tools/batools/pcommands.py index eb2be2cb..79add57c 100644 --- a/tools/batools/pcommands.py +++ b/tools/batools/pcommands.py @@ -487,34 +487,6 @@ def efrocache_get() -> None: pcommand.clientprint(output) -def get_modern_make() -> None: - """Print name of a modern make command.""" - import platform - import subprocess - - pcommand.disallow_in_batch() - - # Mac gnu make is outdated (due to newer versions using GPL3 I believe). - # so let's return 'gmake' there which will point to homebrew make which - # should be up to date. - if platform.system() == 'Darwin': - if ( - subprocess.run( - ['which', 'gmake'], check=False, capture_output=True - ).returncode - != 0 - ): - print( - 'WARNING: this requires gmake (mac system make is too old).' - " Install it with 'brew install make'", - file=sys.stderr, - flush=True, - ) - print('gmake') - else: - print('make') - - def warm_start_asset_build() -> None: """Prep asset builds to run faster.""" import os @@ -608,6 +580,24 @@ def checkenv() -> None: batools.build.checkenv() +def prefab_platform() -> None: + """Print the current prefab-platform value.""" + from efro.error import CleanError + + from batools.build import PrefabPlatform + + # Platform determination uses env vars; won't work in batch. + pcommand.disallow_in_batch() + + args = pcommand.get_args() + if len(args) != 0: + raise CleanError('No arguments expected.') + + current = PrefabPlatform.get_current() + + print(current.value, end='') + + def ensure_prefab_platform() -> None: """Ensure we are running on a particular prefab platform. @@ -616,50 +606,90 @@ def ensure_prefab_platform() -> None: the prefab platform may be Windows; not Linux. Also, a 64-bit os may be targeting a 32-bit platform. """ - import batools.build from efro.error import CleanError + from batools.build import PrefabPlatform + + # Platform determination uses env vars; won't work in batch. + pcommand.disallow_in_batch() + args = pcommand.get_args() if len(args) != 1: - raise CleanError('Expected 1 platform name arg.') - needed = args[0] - current = batools.build.get_current_prefab_platform() - if current != needed: + options = ', '.join(t.value for t in PrefabPlatform) raise CleanError( - f'Incorrect platform: we are {current}, this requires {needed}.' + f'Expected 1 PrefabPlatform arg. Options are {options}.' + ) + needed = PrefabPlatform(args[0]) + current = PrefabPlatform.get_current() + if current is not needed: + raise CleanError( + f'Incorrect platform: we are {current.value},' + f' this requires {needed.value}.' ) def prefab_run_var() -> None: """Print the current platform prefab run target var.""" - import batools.build + from batools.build import PrefabPlatform + + # Platform determination uses env vars; won't work in batch. + pcommand.disallow_in_batch() args = pcommand.get_args() if len(args) != 1: raise RuntimeError('Expected 1 arg.') base = args[0].replace('-', '_').upper() - platform = batools.build.get_current_prefab_platform().upper() + platform = PrefabPlatform.get_current().value.upper() pcommand.clientprint(f'RUN_PREFAB_{platform}_{base}', end='') def prefab_binary_path() -> None: - """Print the current platform prefab binary path.""" - import batools.build + """Print the path to the current prefab binary.""" + from typing import assert_never + from efro.error import CleanError + + from batools.build import PrefabPlatform, PrefabTarget + + # Platform determination uses env vars; won't work in batch. pcommand.disallow_in_batch() if len(sys.argv) != 3: - raise RuntimeError('Expected 1 arg.') - buildtype, buildmode = sys.argv[2].split('-') - platform = batools.build.get_current_prefab_platform() - if buildtype == 'gui': - binpath = 'ballisticakit' - elif buildtype == 'server': - binpath = 'dist/ballisticakit_headless' + options = ', '.join(t.value for t in PrefabTarget) + raise CleanError(f'Expected 1 PrefabTarget arg. Options are {options}.') + + target = PrefabTarget(sys.argv[2]) + + buildtype = target.buildtype + buildmode = target.buildmode + + platform = PrefabPlatform.get_current() + + if platform is PrefabPlatform.WINDOWS_X86: + if buildtype == 'gui': + binpath = 'BallisticaKit.exe' + elif buildtype == 'server': + binpath = 'dist/BallisticaKitHeadless.exe' + else: + raise ValueError(f"Invalid buildtype '{buildtype}'.") + elif ( + platform is PrefabPlatform.MAC_ARM64 + or platform is PrefabPlatform.MAC_X86_64 + or platform is PrefabPlatform.LINUX_ARM64 + or platform is PrefabPlatform.LINUX_X86_64 + ): + if buildtype == 'gui': + binpath = 'ballisticakit' + elif buildtype == 'server': + binpath = 'dist/ballisticakit_headless' + else: + raise ValueError(f"Invalid buildtype '{buildtype}'.") else: - raise ValueError(f"Invalid buildtype '{buildtype}'.") + # Make sure we're covering all options. + assert_never(platform) + print( - f'build/prefab/full/{platform}_{buildtype}/{buildmode}/{binpath}', + f'build/prefab/full/{platform.value}_{buildtype}/{buildmode}/{binpath}', end='', ) @@ -667,20 +697,21 @@ def prefab_binary_path() -> None: def make_prefab() -> None: """Run prefab builds for the current platform.""" import subprocess - import batools.build + from batools.build import PrefabPlatform, PrefabTarget + # Platform determination uses env vars; won't work in batch. pcommand.disallow_in_batch() if len(sys.argv) != 3: raise RuntimeError('Expected one argument') - target = batools.build.PrefabTarget(sys.argv[2]) - platform = batools.build.get_current_prefab_platform() + targetstr = PrefabTarget(sys.argv[2]).value + platformstr = PrefabPlatform.get_current().value # We use dashes instead of underscores in target names. - platform = platform.replace('_', '-') + platformstr = platformstr.replace('_', '-') try: subprocess.run( - ['make', f'prefab-{platform}-{target.value}-build'], check=True + ['make', f'prefab-{platformstr}-{targetstr}-build'], check=True ) except (Exception, KeyboardInterrupt) as exc: if str(exc): @@ -697,6 +728,7 @@ def lazybuild() -> None: # This command is not a good candidate for batch since it can be # long running and prints various stuff throughout the process. pcommand.disallow_in_batch() + args = pcommand.get_args() if len(args) < 3: diff --git a/tools/batools/pcommands2.py b/tools/batools/pcommands2.py index 203c9eaa..bfa18a9e 100644 --- a/tools/batools/pcommands2.py +++ b/tools/batools/pcommands2.py @@ -204,7 +204,7 @@ def win_ci_install_prereqs() -> None: # We'll need to pull a handful of things out of efrocache for the # build to succeed. Normally this would happen through our Makefile - # targets but we can't use them under raw window so we need to just + # targets but we can't use them under raw Windows so we need to just # hard-code whatever we need here. lib_dbg_win32 = 'build/prefab/lib/windows/Debug_Win32' needed_targets: set[str] = { @@ -256,11 +256,11 @@ def win_ci_binary_build() -> None: def update_cmake_prefab_lib() -> None: - """Update prefab internal libs for builds.""" + """Update prefab internal libs; run as part of a build.""" import subprocess import os from efro.error import CleanError - import batools.build + from batools.build import PrefabPlatform pcommand.disallow_in_batch() @@ -275,14 +275,18 @@ def update_cmake_prefab_lib() -> None: raise CleanError(f'Invalid buildtype: {buildtype}') if mode not in {'debug', 'release'}: raise CleanError(f'Invalid mode: {mode}') - platform = batools.build.get_current_prefab_platform( - wsl_gives_windows=False - ) - suffix = '_server' if buildtype == 'server' else '_gui' - target = f'build/prefab/lib/{platform}{suffix}/{mode}/libballisticaplus.a' - # Build the target and then copy it to dst if it doesn't exist there yet - # or the existing one is older than our target. + # Our 'cmake' build targets use the Linux side of WSL; not native + # Windows. + platform = PrefabPlatform.get_current(wsl_targets_windows=False) + + suffix = '_server' if buildtype == 'server' else '_gui' + target = ( + f'build/prefab/lib/{platform.value}{suffix}/{mode}/libballisticaplus.a' + ) + + # Build the target and then copy it to dst if it doesn't exist there + # yet or the existing one is older than our target. subprocess.run(['make', target], check=True) libdir = os.path.join(builddir, 'prefablib') @@ -431,7 +435,7 @@ def wsl_build_check_win_drive() -> None: != 0 ): raise CleanError( - 'wslpath not found; you must run this from a WSL environment' + "'wslpath' not found. This does not seem to be a WSL environment." ) if os.environ.get('WSL_BUILD_CHECK_WIN_DRIVE_IGNORE') == '1': @@ -448,9 +452,12 @@ def wsl_build_check_win_drive() -> None: .strip() ) - # If we're sitting under the linux filesystem, our path - # will start with \\wsl$; fail in that case and explain why. - if not path.startswith('\\\\wsl$'): + # If we're sitting under the linux filesystem, our path will start + # with '\\wsl$' or '\\wsl.localhost' or '\\wsl\'; fail in that case + # and explain why. + if not any( + path.startswith(x) for x in ['\\\\wsl$', '\\\\wsl.', '\\\\wsl\\'] + ): return def _wrap(txt: str) -> str: @@ -475,7 +482,7 @@ def wsl_build_check_win_drive() -> None: 'Note that WSL2 filesystem performance' ' is poor when accessing' ' native Windows drives, so if Visual Studio builds are not' - ' needed it may be best to keep things' + ' needed it may be best to keep things here' ' on the Linux filesystem.' ' This behavior may differ under WSL1 (untested).' ), @@ -540,3 +547,31 @@ def wsl_path_to_win() -> None: if escape: out = out.replace('\\', '\\\\') print(out, end='') + + +def get_modern_make() -> None: + """Print name of a modern make command.""" + import platform + import subprocess + + pcommand.disallow_in_batch() + + # Mac gnu make is outdated (due to newer versions using GPL3 I believe). + # so let's return 'gmake' there which will point to homebrew make which + # should be up to date. + if platform.system() == 'Darwin': + if ( + subprocess.run( + ['which', 'gmake'], check=False, capture_output=True + ).returncode + != 0 + ): + print( + 'WARNING: this requires gmake (mac system make is too old).' + " Install it with 'brew install make'", + file=sys.stderr, + flush=True, + ) + print('gmake') + else: + print('make') diff --git a/tools/batools/staging.py b/tools/batools/staging.py index 5a14ea75..20b92523 100755 --- a/tools/batools/staging.py +++ b/tools/batools/staging.py @@ -11,6 +11,7 @@ import subprocess from functools import partial from typing import TYPE_CHECKING +from efro.terminal import Clr from efrotools import PYVER, extract_arg, extract_flag if TYPE_CHECKING: @@ -39,6 +40,7 @@ class AssetStager: def __init__(self, projroot: str) -> None: self.projroot = projroot + self.desc = 'unknown' # We always calc src relative to this script. self.src = f'{self.projroot}/build/assets' self.dst: str | None = None @@ -71,6 +73,12 @@ class AssetStager: """Do the thing.""" self._parse_args(args) + print( + f'{Clr.BLU}Staging for {Clr.MAG}{Clr.BLD}{self.desc}{Clr.RST}' + f'{Clr.BLU} at {Clr.MAG}{Clr.BLD}{self.dst}' + f'{Clr.RST}{Clr.BLU}...{Clr.RST}' + ) + # Ok, now for every top level dir in src, come up with a nice single # command to sync the needed subset of it to dst. @@ -140,22 +148,27 @@ class AssetStager: ) if platform_arg == '-android': + self.desc = 'android' self._parse_android_args(args) elif platform_arg.startswith('-win'): + self.desc = 'windows' self._parse_win_args(platform_arg, args) elif platform_arg == '-cmake': + self.desc = 'cmake' self.dst = args[-1] self.tex_suffix = '.dds' # Link/copy in a binary *if* builddir is provided. self.include_binary_executable = self.builddir is not None self.executable_name = 'ballisticakit' elif platform_arg == '-cmakemodular': + self.desc = 'cmake modular' self.dst = args[-1] self.tex_suffix = '.dds' self.include_python_dylib = True self.include_shell_executable = True self.executable_name = 'ballisticakit' elif platform_arg == '-cmakeserver': + self.desc = 'cmake server' self.dst = os.path.join(args[-1], 'dist') self.serverdst = args[-1] self.include_textures = False @@ -165,6 +178,7 @@ class AssetStager: self.include_binary_executable = self.builddir is not None self.executable_name = 'ballisticakit_headless' elif platform_arg == '-cmakemodularserver': + self.desc = 'cmake modular server' self.dst = os.path.join(args[-1], 'dist') self.serverdst = args[-1] self.include_textures = False @@ -175,6 +189,7 @@ class AssetStager: self.executable_name = 'ballisticakit_headless' elif platform_arg == '-xcode-mac': + self.desc = 'xcode mac' self.src = os.environ['SOURCE_ROOT'] + '/../build/assets' self.dst = ( os.environ['TARGET_BUILD_DIR'] @@ -184,17 +199,8 @@ class AssetStager: self.include_pylib = True self.pylib_src_name = 'pylib-apple' self.tex_suffix = '.dds' - elif platform_arg == '-xcode-mac-old': - self.src = os.environ['SOURCE_ROOT'] + '/build/assets' - self.dst = ( - os.environ['TARGET_BUILD_DIR'] - + '/' - + os.environ['UNLOCALIZED_RESOURCES_FOLDER_PATH'] - ) - self.include_pylib = True - self.pylib_src_name = 'pylib-apple' - self.tex_suffix = '.dds' elif platform_arg == '-xcode-ios': + self.desc = 'xcode ios' self.src = os.environ['SOURCE_ROOT'] + '/build/assets' self.dst = ( os.environ['TARGET_BUILD_DIR'] diff --git a/tools/pcommand b/tools/pcommand index 0a6eef2a..8493c487 100755 --- a/tools/pcommand +++ b/tools/pcommand @@ -96,13 +96,13 @@ from batools.pcommands import ( upper, efrocache_update, efrocache_get, - get_modern_make, warm_start_asset_build, gen_docs_pdoc, gen_docs_sphinx, list_pip_reqs, install_pip_reqs, checkenv, + prefab_platform, ensure_prefab_platform, prefab_run_var, prefab_binary_path, @@ -135,6 +135,7 @@ from batools.pcommands2 import ( tests_warm_start, wsl_path_to_win, wsl_build_check_win_drive, + get_modern_make, ) # pylint: enable=unused-import