diff --git a/.efrocachemap b/.efrocachemap index a074cf7e..6dc29bf5 100644 --- a/.efrocachemap +++ b/.efrocachemap @@ -3949,8 +3949,8 @@ "build/prefab/full/mac_x86_64_gui/release/ballisticacore": "https://files.ballistica.net/cache/ba1/d2/9f/8ec15bb92912109fec9f11c63541", "build/prefab/full/mac_x86_64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/d9/8d/d65fcf33eb6d33cf5201bd832c11", "build/prefab/full/mac_x86_64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/99/3c/8be98acc89f793f458aa61e050c2", - "build/prefab/full/windows_x86_gui/debug/BallisticaCore.exe": "https://files.ballistica.net/cache/ba1/45/20/cc832b67acf9b2df59dd5f3fa5c4", - "build/prefab/full/windows_x86_gui/release/BallisticaCore.exe": "https://files.ballistica.net/cache/ba1/33/c8/7679fdc76a7271eccf4a13a891b1", + "build/prefab/full/windows_x86_gui/debug/BallisticaCore.exe": "https://files.ballistica.net/cache/ba1/3f/9f/2f4750d796e57a19de0ffd9a6b02", + "build/prefab/full/windows_x86_gui/release/BallisticaCore.exe": "https://files.ballistica.net/cache/ba1/02/01/97181feb54a1788002020de362a2", "build/prefab/full/windows_x86_server/debug/dist/BallisticaCoreHeadless.exe": "https://files.ballistica.net/cache/ba1/e3/03/85e4eae1bb8231864e1e46554913", "build/prefab/full/windows_x86_server/release/dist/BallisticaCoreHeadless.exe": "https://files.ballistica.net/cache/ba1/60/79/2e0070b506a3d9e9370d735c79b4", "build/prefab/lib/linux_arm64_gui/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/f0/d3/e88910c0724d5d5828598a55b3ac", diff --git a/.idea/dictionaries/ericf.xml b/.idea/dictionaries/ericf.xml index f325f390..e050c0db 100644 --- a/.idea/dictionaries/ericf.xml +++ b/.idea/dictionaries/ericf.xml @@ -2463,11 +2463,13 @@ winserver winsound winstate + wintdir wintype wmsbe woooo workdir workflows + woutdir wpath wprjp wref diff --git a/CHANGELOG.md b/CHANGELOG.md index 73e24174..a8b54f71 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,7 @@ ### 1.6.4 (20371) - Some cleanups in the Favorites tab of the gather window. - Reorganized prefab target names; some targets such as `prefab-debug` are now `prefab-gui-debug` (more consistent with the existing `prefab-server-debug` targets). +- Windows builds now go to build/windows instead of ballisticacore_windows/build. ### 1.6.3 (20366) - Telnet access works again for gui builds without requiring a password (access must still be granted via the gui). diff --git a/Makefile b/Makefile index 23400f98..339bdc46 100644 --- a/Makefile +++ b/Makefile @@ -182,11 +182,11 @@ prefab-mac-arm64-gui-debug: prefab-mac-arm64-gui-debug-build @${RUN_PREFAB_MAC_ARM64_GUI_DEBUG} prefab-mac-x86-64-gui-debug-build: prereqs assets-cmake \ - build/prefab/full/mac_x86_64_gui/debug/ballisticacore + build/prefab/full/mac_x86_64_gui/debug/ballisticacore @${STAGE_ASSETS} -cmake build/prefab/full/mac_x86_64_gui/debug prefab-mac-arm64-gui-debug-build: prereqs assets-cmake \ - build/prefab/full/mac_arm64_gui/debug/ballisticacore + build/prefab/full/mac_arm64_gui/debug/ballisticacore @${STAGE_ASSETS} -cmake build/prefab/full/mac_arm64_gui/debug build/prefab/full/mac_%_gui/debug/ballisticacore: .efrocachemap @@ -204,19 +204,19 @@ RUN_PREFAB_MAC_ARM64_GUI_RELEASE = cd build/prefab/full/mac_arm64_gui/release \ && ./ballisticacore prefab-mac-x86-64-gui-release: prefab-mac-x86-64-gui-release-build - @tools/pcommand ensure_build_platform mac_x86_64 + @tools/pcommand ensure_prefab_platform mac_x86_64 @${RUN_PREFAB_MAC_X86_64_GUI_RELEASE} prefab-mac-arm64-gui-release: prefab-mac-arm64-gui_release-build - @tools/pcommand ensure_build_platform mac_arm64 + @tools/pcommand ensure_prefab_platform mac_arm64 @${RUN_PREFAB_MAC_ARM64_GUI_RELEASE} prefab-mac-x86-64-gui-release-build: prereqs assets-cmake \ - build/prefab/full/mac_x86_64_gui/release/ballisticacore + build/prefab/full/mac_x86_64_gui/release/ballisticacore @${STAGE_ASSETS} -cmake build/prefab/full/mac_x86_64_gui/release prefab-mac-arm64-gui-release-build: prereqs assets-cmake \ - build/prefab/full/mac_arm64_gui/release/ballisticacore + build/prefab/full/mac_arm64_gui/release/ballisticacore @${STAGE_ASSETS} -cmake build/prefab/full/mac_arm64_gui/release build/prefab/full/mac_%_gui/release/ballisticacore: .efrocachemap @@ -234,11 +234,11 @@ RUN_PREFAB_MAC_ARM64_SERVER_DEBUG = cd \ build/prefab/full/mac_arm64_server/debug && ./ballisticacore_server prefab-mac-x86-64-server-debug: prefab-mac-x86-64-server-debug-build - @tools/pcommand ensure_build_platform mac_x86_64 + @tools/pcommand ensure_prefab_platform mac_x86_64 @${RUN_PREFAB_MAC_X86_64_SERVER_DEBUG} prefab-mac-arm64-server-debug: prefab-mac-arm64-server-debug-build - @tools/pcommand ensure_build_platform mac_arm64 + @tools/pcommand ensure_prefab_platform mac_arm64 @${RUN_PREFAB_MAC_ARM64_SERVER_DEBUG} prefab-mac-x86-64-server-debug-build: prereqs assets-cmake \ @@ -261,14 +261,14 @@ RUN_PREFAB_MAC_X86_64_SERVER_RELEASE = cd \ build/prefab/full/mac_x86_64_server/release && ./ballisticacore_server RUN_PREFAB_MAC_ARM64_SERVER_RELEASE = cd \ - build/prefab/full/mac_arm64_server/release && ./ballisticacore_server + build/prefab/full/mac_arm64_server/release && ./ballisticacore_server prefab-mac-x86-64-server-release: prefab-mac-x86-64-server-release-build - @tools/pcommand ensure_build_platform mac_x86_64 + @tools/pcommand ensure_prefab_platform mac_x86_64 @${RUN_PREFAB_MAC_X86_64_SERVER_RELEASE} prefab-mac-arm64-server-release: prefab-mac-arm64-server-release-build - @tools/pcommand ensure_build_platform mac_arm64 + @tools/pcommand ensure_prefab_platform mac_arm64 @${RUN_PREFAB_MAC_ARM64_SERVER_RELEASE} prefab-mac-x86-64-server-release-build: prereqs assets-cmake \ @@ -296,19 +296,19 @@ RUN_PREFAB_LINUX_ARM64_GUI_DEBUG = cd \ build/prefab/full/linux_arm64_gui/debug && ./ballisticacore prefab-linux-x86-64-gui-debug: prefab-linux-x86-64-gui-debug-build - @tools/pcommand ensure_build_platform linux_x86_64 + @tools/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 - @tools/pcommand ensure_build_platform linux_arm64 + @tools/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/ballisticacore + build/prefab/full/linux_x86_64_gui/debug/ballisticacore @${STAGE_ASSETS} -cmake build/prefab/full/linux_x86_64_gui/debug prefab-linux-arm64-gui-debug-build: prereqs assets-cmake \ - build/prefab/full/linux_arm64_gui/debug/ballisticacore + build/prefab/full/linux_arm64_gui/debug/ballisticacore @${STAGE_ASSETS} -cmake build/prefab/full/linux_arm64_gui/debug build/prefab/full/linux_%_gui/debug/ballisticacore: .efrocachemap @@ -326,19 +326,19 @@ RUN_PREFAB_LINUX_ARM64_GUI_RELEASE = cd \ build/prefab/full/linux_arm64_gui/release && ./ballisticacore prefab-linux-x86-64-gui-release: prefab-linux-x86-64-gui-release-build - @tools/pcommand ensure_build_platform linux_x86_64 + @tools/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 - @tools/pcommand ensure_build_platform linux_arm64 + @tools/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/ballisticacore + build/prefab/full/linux_x86_64_gui/release/ballisticacore @${STAGE_ASSETS} -cmake build/prefab/full/linux_x86_64_gui/release prefab-linux-arm64-gui-release-build: prereqs assets-cmake \ - build/prefab/full/linux_arm64_gui/release/ballisticacore + build/prefab/full/linux_arm64_gui/release/ballisticacore @${STAGE_ASSETS} -cmake build/prefab/full/linux_arm64_gui/release build/prefab/full/linux_%_gui/release/ballisticacore: .efrocachemap @@ -350,17 +350,17 @@ build/prefab/lib/linux_%_gui/release/libballisticacore_internal.a: .efrocachemap # Linux server debug: RUN_PREFAB_LINUX_X86_64_SERVER_DEBUG = cd \ - build/prefab/full/linux_x86_64_server/debug && ./ballisticacore_server + build/prefab/full/linux_x86_64_server/debug && ./ballisticacore_server RUN_PREFAB_LINUX_ARM64_SERVER_DEBUG = cd \ - build/prefab/full/linux_arm64_server/debug && ./ballisticacore_server + build/prefab/full/linux_arm64_server/debug && ./ballisticacore_server prefab-linux-x86-64-server-debug: prefab-linux-x86-64-server-debug-build - @tools/pcommand ensure_build_platform linux_x86_64 + @tools/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 - @tools/pcommand ensure_build_platform linux_arm64 + @tools/pcommand ensure_prefab_platform linux_arm64 @${RUN_PREFAB_LINUX_ARM64_SERVER_DEBUG} prefab-linux-x86-64-server-debug-build: prereqs assets-cmake \ @@ -382,26 +382,26 @@ build/prefab/lib/linux_%_server/debug/libballisticacore_internal.a: .efrocachema # Linux server release: RUN_PREFAB_LINUX_X86_64_SERVER_RELEASE = cd \ - build/prefab/full/linux_x86_64_server/release && ./ballisticacore_server + build/prefab/full/linux_x86_64_server/release && ./ballisticacore_server RUN_PREFAB_LINUX_ARM64_SERVER_RELEASE = cd \ - build/prefab/full/linux_arm64_server/release && ./ballisticacore_server + build/prefab/full/linux_arm64_server/release && ./ballisticacore_server prefab-linux-x86-64-server-release: prefab-linux-x86-64-server-release-build - @tools/pcommand ensure_build_platform linux_x86_64 + @tools/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 - @tools/pcommand ensure_build_platform linux_arm64 + @tools/pcommand ensure_prefab_platform linux_arm64 @${RUN_PREFAB_LINUX_ARM64_SERVER_RELEASE} prefab-linux-x86-64-server-release-build: prereqs assets-cmake \ - build/prefab/full/linux_x86_64_server/release/dist/ballisticacore_headless + build/prefab/full/linux_x86_64_server/release/dist/ballisticacore_headless @${STAGE_ASSETS} -cmakeserver -release \ build/prefab/full/linux_x86_64_server/release prefab-linux-arm64-server-release-build: prereqs assets-cmake \ - build/prefab/full/linux_arm64_server/release/dist/ballisticacore_headless + build/prefab/full/linux_arm64_server/release/dist/ballisticacore_headless @${STAGE_ASSETS} -cmakeserver -release \ build/prefab/full/linux_arm64_server/release @@ -417,7 +417,7 @@ RUN_PREFAB_WINDOWS_X86_GUI_DEBUG = cd build/prefab/full/windows_x86_gui/debug \ && ./BallisticaCore.exe prefab-windows-x86-gui-debug: prefab-windows-x86-gui-debug-build - @tools/pcommand ensure_build_platform windows_x86 + @tools/pcommand ensure_prefab_platform windows_x86 @{RUN_PREFAB_WINDOWS_X86_GUI_DEBUG} prefab-windows-x86-gui-debug-build: prereqs assets-windows-${WINPLAT_X86} \ @@ -440,7 +440,7 @@ RUN_PREFAB_WINDOWS_X86_GUI_RELEASE = cd \ build/prefab/full/windows_x86_gui/release && ./BallisticaCore.exe prefab-windows-x86-gui-release: prefab-windows-x86-gui-release-build - @tools/pcommand ensure_build_platform windows_x86 + @tools/pcommand ensure_prefab_platform windows_x86 @{RUN_PREFAB_WINDOWS_X86_GUI_RELEASE} prefab-windows-x86-gui-release-build: prereqs \ @@ -455,18 +455,18 @@ build/prefab/full/windows_x86_gui/release/BallisticaCore.exe: .efrocachemap # Windows prefab server debug: RUN_PREFAB_WINDOWS_X86_SERVER_DEBUG = cd \ - build/prefab/full/windows_x86_server/debug \ - && dist/python_d.exe ballisticacore_server.py + build/prefab/full/windows_x86_server/debug \ + && dist/python_d.exe ballisticacore_server.py prefab-windows-x86-server-debug: prefab-windows-x86-server-debug-build - @tools/pcommand ensure_build_platform windows_x86 + @tools/pcommand ensure_prefab_platform windows_x86 @{RUN_PREFAB_WINDOWS_X86_SERVER_DEBUG} prefab-windows-x86-server-debug-build: prereqs \ assets-windows-${WINPLAT_X86} \ build/prefab/full/windows_x86_server/debug/dist/BallisticaCoreHeadless.exe @${STAGE_ASSETS} -winserver-${WINPLAT_X86}-Debug \ - build/prefab/full/windows_x86_server/debug + build/prefab/full/windows_x86_server/debug build/prefab/full/windows_x86_server/debug/dist/BallisticaCoreHeadless.exe: .efrocachemap @tools/pcommand efrocache_get $@ @@ -474,11 +474,11 @@ build/prefab/full/windows_x86_server/debug/dist/BallisticaCoreHeadless.exe: .efr # Windows prefab server release: RUN_PREFAB_WINDOWS_X86_SERVER_RELEASE = cd \ - build/prefab/full/windows_x86_server/release \ - && dist/python.exe -O ballisticacore_server.py + build/prefab/full/windows_x86_server/release \ + && dist/python.exe -O ballisticacore_server.py prefab-windows-x86-server-release: prefab-windows-x86-server-release-build - @tools/pcommand ensure_build_platform windows_x86 + @tools/pcommand ensure_prefab_platform windows_x86 @{RUN_PREFAB_WINDOWS_X86_SERVER_RELEASE} prefab-windows-x86-server-release-build: prereqs \ @@ -736,34 +736,24 @@ WINDOWS_PLATFORM ?= Win32 # Can be Debug or Release WINDOWS_CONFIGURATION ?= Debug -# Base dir for all windows asset staging, intermediate files, and builds. -# Note: this value only applies to MSBuild compiles when launched through -# this Makefile. If you build/debug directly from within Visual Studio, -# its own project paths will be used instead. Those are set to line up -# with the default here, but if you change one then you may need to -# change the other. (or just always build via Makefile and things should -# always line up). -WINDOWS_BUILD_DIR ?= /mnt/c/ballisticacore_builds - -foof: - echo ${WINTDIR} - # Stage assets and other files so a built binary will run. windows-staging: assets-windows resources code ${STAGE_ASSETS} -win-${WINPLT}-${WINCFG} \ - ${WINDOWS_BUILD_DIR}/$(WINCFG)_$(WINPLT) + build/windows/$(WINCFG)_$(WINPLT) -windows-wsl-debug-build: windows-staging \ +windows-debug-build: windows-staging \ build/prefab/lib/windows/Debug_Win32/BallisticaCoreGenericInternal.lib \ build/prefab/lib/windows/Debug_Win32/BallisticaCoreGenericInternal.pdb \ ballisticacore-windows/Generic/BallisticaCore.ico + @tools/pcommand ensure_prefab_platform windows_x86 WINDOWS_PROJECT=Generic WINDOWS_CONFIGURATION=Debug WINDOWS_PLATFORM=Win32 \ ${MAKE} _windows-wsl-build -windows-wsl-debug-rebuild: windows-staging \ +windows-debug-rebuild: windows-staging \ build/prefab/lib/windows/Debug_Win32/BallisticaCoreGenericInternal.lib \ build/prefab/lib/windows/Debug_Win32/BallisticaCoreGenericInternal.pdb \ ballisticacore-windows/Generic/BallisticaCore.ico + @tools/pcommand ensure_prefab_platform windows_x86 WINDOWS_PROJECT=Generic WINDOWS_CONFIGURATION=Debug WINDOWS_PLATFORM=Win32 \ ${MAKE} _windows-wsl-rebuild @@ -774,13 +764,13 @@ ballisticacore-windows/Generic/BallisticaCore.ico: .efrocachemap windows-clean: @${CHECK_CLEAN_SAFETY} git clean -dfx ballisticacore-windows - rm -rf ${WINDOWS_BUILD_DIR} ${LAZYBUILDDIR} + rm -rf build/windows ${LAZYBUILDDIR} # Show what would be cleaned. windows-clean-list: @${CHECK_CLEAN_SAFETY} git clean -dnx ballisticacore-windows - echo would also remove ${WINDOWS_BUILD_DIR} ${LAZYBUILDDIR} + echo would also remove build/windows ${LAZYBUILDDIR} ################################################################################ @@ -913,11 +903,6 @@ WINPRJ = $(WINDOWS_PROJECT) WINPLT = $(WINDOWS_PLATFORM) WINCFG = $(WINDOWS_CONFIGURATION) -_WINT1 = $(WINDOWS_BUILD_DIR)/obj/BallisticaCore$(WINPRJ)/$(WINCFG)_$(WINPLT)/ -WINTDIR = $(shell tools/pcommand wsl_path_to_win --escape --create $(_WINT1)) -_WOUT1 = $(WINDOWS_BUILD_DIR)/$(WINCFG)_$(WINPLT)/ -WOUTDIR = $(shell tools/pcommand wsl_path_to_win --escape --create $(_WOUT1)) - # When using CLion, our cmake dir is root. Expose .clang-format there too. ballisticacore-cmake/.clang-format: .clang-format @cd ballisticacore-cmake && ln -sf ../.clang-format . @@ -949,30 +934,27 @@ _cmake-simple-ci-server-build: && mv compile_commands.json .cache/irony @tools/pcommand echo BLU Created Irony build db at $@ -_WINDOWS_WSL_PROP_INJECT = -property:IntDir=$(WINTDIR) \ - -property:OutDir=$(WOUTDIR) - _windows-wsl-build: - ${WIN_MSBUILD_EXE_B} \ - ${shell tools/pcommand wsl_path_to_win --escape \ - ballisticacore-windows/${WINPRJ}/BallisticaCore${WINPRJ}.vcxproj} \ + @tools/pcommand wsl_build_check_win_drive + $(WIN_MSBUILD_EXE_B) \ + $(shell tools/pcommand wsl_path_to_win --escape \ + ballisticacore-windows/$(WINPRJ)/BallisticaCore${WINPRJ}.vcxproj) \ -target:Build \ - -property:Configuration=${WINCFG} \ - -property:Platform=${WINPLT} \ - ${_WINDOWS_WSL_PROP_INJECT} \ - ${VISUAL_STUDIO_VERSION} - @tools/pcommand echo BLU BLD Built ${WOUTDIR}BallisticaCore${WINPRJ}.exe. + -property:Configuration=$(WINCFG) \ + -property:Platform=$(WINPLT) \ + $(VISUAL_STUDIO_VERSION) + @tools/pcommand echo BLU BLD Built build/windows/BallisticaCore$(WINPRJ).exe. _windows-wsl-rebuild: - ${WIN_MSBUILD_EXE_B} \ - ${shell tools/pcommand wsl_path_to_win --escape \ - ballisticacore-windows/${WINPRJ}/BallisticaCore${WINPRJ}.vcxproj} \ + @tools/pcommand wsl_build_check_win_drive + $(WIN_MSBUILD_EXE_B) \ + $(shell tools/pcommand wsl_path_to_win --escape \ + ballisticacore-windows/$(WINPRJ)/BallisticaCore${WINPRJ}.vcxproj) \ -target:Rebuild \ - -property:Configuration=${WINCFG} \ - -property:Platform=${WINPLT} \ - ${_WINDOWS_WSL_PROP_INJECT} \ - ${VISUAL_STUDIO_VERSION} - @tools/pcommand echo BLU BLD Built ${WOUTDIR}BallisticaCore${WINPRJ}.exe. + -property:Configuration=$(WINCFG) \ + -property:Platform=$(WINPLT) \ + $(VISUAL_STUDIO_VERSION) + @tools/pcommand echo BLU BLD Built build/windows/BallisticaCore$(WINPRJ).exe. # Tell make which of these targets don't represent files. .PHONY: _cmake-simple-ci-server-build _windows-wsl-build _windows-wsl-rebuild diff --git a/ballisticacore-cmake/.idea/dictionaries/ericf.xml b/ballisticacore-cmake/.idea/dictionaries/ericf.xml index c2759a89..7db0fc8c 100644 --- a/ballisticacore-cmake/.idea/dictionaries/ericf.xml +++ b/ballisticacore-cmake/.idea/dictionaries/ericf.xml @@ -1096,9 +1096,11 @@ windowshade winmm winsock + wintdir wofocj wonkiness worldspace + woutdir wprjp wsroot wunused diff --git a/tools/batools/build.py b/tools/batools/build.py index 435c9946..a16e3567 100644 --- a/tools/batools/build.py +++ b/tools/batools/build.py @@ -460,7 +460,7 @@ def gen_fulltest_buildfile_linux() -> None: outfile.write('\n'.join(lines)) -def get_current_build_platform(wsl_gives_windows: bool = True) -> str: +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. @@ -482,9 +482,10 @@ def get_current_build_platform(wsl_gives_windows: bool = True) -> str: # we may want to operate on Windows versions. if wsl_gives_windows: if 'microsoft' in platform.uname().release.lower(): - # TODO: add support for arm windows 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:' f' {machine}.') diff --git a/tools/batools/pcommand.py b/tools/batools/pcommand.py index 1a3c48a3..72148b4e 100644 --- a/tools/batools/pcommand.py +++ b/tools/batools/pcommand.py @@ -474,6 +474,50 @@ def checkenv() -> None: batools.build.checkenv() +def wsl_build_check_win_drive() -> None: + """Make sure we're building on a windows drive.""" + import os + import subprocess + import textwrap + from efro.error import CleanError + + if subprocess.run(['which', 'wslpath'], check=False, + capture_output=True).returncode != 0: + raise CleanError('wslpath not found; you must run' + ' this from a WSL environment') + + if os.environ.get('WSL_BUILD_CHECK_WIN_DRIVE_IGNORE') == '1': + return + + # Get a windows path to the current dir. + path = subprocess.run( + ['wslpath', '-w', '-a', os.getcwd()], capture_output=True, + check=True).stdout.decode().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$'): + return + + def _wrap(txt: str) -> str: + return textwrap.fill(txt, 76) + + raise CleanError('\n\n'.join([ + _wrap('ERROR: This project appears to live on the Linux filesystem.'), + _wrap('Visual Studio builds will error here for reasons related' + ' to Linux filesystem case-sensitivity, and thus are' + ' disallowed.' + ' Clone the repo to a location that maps to a native' + ' Windows drive such as \'/mnt/c/ballistica\' and try again.'), + _wrap('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 on the Linux filesystem.' + ' This behavior may differ under WSL1 (untested).'), + _wrap('Set env-var WSL_BUILD_CHECK_WIN_DRIVE_IGNORE=1 to skip' + ' this check.') + ])) + + def wsl_path_to_win() -> None: """Forward escape slashes in a provided win path arg.""" import subprocess @@ -525,14 +569,15 @@ def wsl_path_to_win() -> None: print(out, end='') -def ensure_build_platform() -> None: +def ensure_prefab_platform() -> None: """Ensure we are building on a particular platform.""" import batools.build from efro.error import CleanError + if len(sys.argv) != 3: raise CleanError('Expected 1 platform name arg.') needed = sys.argv[2] - current = batools.build.get_current_build_platform() + current = batools.build.get_current_prefab_platform() if current != needed: raise CleanError( f'Incorrect platform: we are {current}, this requires {needed}.') @@ -544,7 +589,7 @@ def prefab_run_var() -> None: if len(sys.argv) != 3: raise RuntimeError('Expected 1 arg.') base = sys.argv[2].replace('-', '_').upper() - platform = batools.build.get_current_build_platform().upper() + platform = batools.build.get_current_prefab_platform().upper() print(f'RUN_PREFAB_{platform}_{base}', end='') @@ -555,7 +600,7 @@ def make_prefab() -> None: if len(sys.argv) != 3: raise RuntimeError('Expected one argument') target = batools.build.PrefabTarget(sys.argv[2]) - platform = batools.build.get_current_build_platform() + platform = batools.build.get_current_prefab_platform() # We use dashes instead of underscores in target names. platform = platform.replace('_', '-') @@ -714,7 +759,7 @@ 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_build_platform( + 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}/' diff --git a/tools/pcommand b/tools/pcommand index b1e9e47d..abf6fceb 100755 --- a/tools/pcommand +++ b/tools/pcommand @@ -34,11 +34,11 @@ from batools.pcommand import ( python_build_android_debug, python_android_patch, python_gather, python_winprune, capitalize, upper, efrocache_update, efrocache_get, get_modern_make, warm_start_asset_build, update_docs_md, list_pip_reqs, - install_pip_reqs, checkenv, ensure_build_platform, prefab_run_var, + install_pip_reqs, checkenv, ensure_prefab_platform, prefab_run_var, make_prefab, update_makebob, lazybuild, android_archive_unstripped_libs, efro_gradle, stage_assets, update_assets_makefile, update_project, update_cmake_prefab_lib, cmake_prep_dir, gen_binding_code, - gen_flat_data_code, wsl_path_to_win) + gen_flat_data_code, wsl_path_to_win, wsl_build_check_win_drive) # pylint: enable=unused-import if TYPE_CHECKING: