diff --git a/.efrocachemap b/.efrocachemap index ffc0ab54..8453c7ce 100644 --- a/.efrocachemap +++ b/.efrocachemap @@ -3933,8 +3933,6 @@ "assets/build/windows/Win32/vc_redist.x86.exe": "https://files.ballistica.net/cache/ba1/1c/e1/4a1a2eddda2f4aebd5f8b64ab08e", "assets/build/windows/Win32/vcruntime140d.dll": "https://files.ballistica.net/cache/ba1/50/8d/bc2600ac9491f1b14d659709451f", "ballisticacore-windows/Generic/BallisticaCore.ico": "https://files.ballistica.net/cache/ba1/89/c0/e32c7d2a35dc9aef57cc73b0911a", - "ballisticacore-windows/build/Debug_Win32/BallisticaCoreGenericInternal.lib": "https://files.ballistica.net/cache/ba1/bb/ef/cbbb2871d6951c4178c51b9168ee", - "ballisticacore-windows/build/Debug_Win32/BallisticaCoreGenericInternal.pdb": "https://files.ballistica.net/cache/ba1/d4/4e/8f19b93f504faf01ab6110076482", "build/prefab/full/linux_arm64_gui/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/e8/15/872df30172235c867eda63d89589", "build/prefab/full/linux_arm64_gui/release/ballisticacore": "https://files.ballistica.net/cache/ba1/74/1d/fc9e33e565475daaac80da5252f0", "build/prefab/full/linux_arm64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/78/4f/3c6279192f18688bd84bb6a4411b", @@ -3970,5 +3968,7 @@ "build/prefab/lib/mac_x86_64_gui/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/fc/09/e9e374f8ff007abd68731bd3ddb9", "build/prefab/lib/mac_x86_64_gui/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/21/3f/116ca7d820d2e9722ac2505471f4", "build/prefab/lib/mac_x86_64_server/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/86/9f/c6610a0006b255768a74d73ce77b", - "build/prefab/lib/mac_x86_64_server/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/a1/6e/c4b8e6499dd2404c010eb25fc55e" + "build/prefab/lib/mac_x86_64_server/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/a1/6e/c4b8e6499dd2404c010eb25fc55e", + "build/prefab/lib/windows/Debug_Win32/BallisticaCoreGenericInternal.lib": "https://files.ballistica.net/cache/ba1/f2/05/7ce635c1c407a4182b75b316c36e", + "build/prefab/lib/windows/Debug_Win32/BallisticaCoreGenericInternal.pdb": "https://files.ballistica.net/cache/ba1/06/63/ee6a0047fdcc7eac67ad99622ecc" } \ No newline at end of file diff --git a/Makefile b/Makefile index 631444f3..b54ae17c 100644 --- a/Makefile +++ b/Makefile @@ -486,29 +486,29 @@ build/prefab/full/windows_x86_server/release/dist/BallisticaCoreHeadless.exe: .e # Windows visual-studio-compiled debug -ballisticacore-windows/build/Debug_%/BallisticaCoreGenericInternal.lib: .efrocachemap +build/prefab/lib/windows/Debug_%/BallisticaCoreGenericInternal.lib: .efrocachemap @tools/pcommand efrocache_get $@ -ballisticacore-windows/build/Debug_%/BallisticaCoreGenericInternal.pdb: .efrocachemap +build/prefab/lib/windows/Debug_%/BallisticaCoreGenericInternal.pdb: .efrocachemap @tools/pcommand efrocache_get $@ ballisticacore-windows/Generic/BallisticaCore.ico: .efrocachemap @tools/pcommand efrocache_get $@ -ballisticacore-windows/build/Debug_%/BallisticaCoreGenericInternal.exe: \ - ballisticacore-windows/build/Debug_%/BallisticaCoreGenericInternal.lib \ - ballisticacore-windows/build/Debug_%/BallisticaCoreGenericInternal.pdb \ - ballisticacore-windows/Generic/BallisticaCore.ico \ - prereqs code resources +windows-wsl-debug-build: \ + prereqs code resources \ + build/prefab/lib/windows/Debug_Win32/BallisticaCoreGenericInternal.lib \ + build/prefab/lib/windows/Debug_Win32/BallisticaCoreGenericInternal.pdb \ + ballisticacore-windows/Generic/BallisticaCore.ico WINDOWS_PROJECT=Generic WINDOWS_CONFIGURATION=Debug WINDOWS_PLATFORM=$* \ - ${MAKE} _windows-wsl-build + ${MAKE} _windows-wsl-build # These are 'intermediate' files and will get deleted implicitly by make # if we don't do this. # See: https://www.gnu.org/software/make/manual/make.html#Special-Targets -.PRECIOUS: \ - ballisticacore-windows/build/Debug_%/BallisticaCoreGenericInternal.lib \ - ballisticacore-windows/build/Debug_%/BallisticaCoreGenericInternal.pdb +# .PRECIOUS: \ +# ballisticacore-windows/build/Debug_%/BallisticaCoreGenericInternal.lib \ +# ballisticacore-windows/build/Debug_%/BallisticaCoreGenericInternal.pdb # Tell make which of these targets don't represent files. .PHONY: prefab-debug prefab-release prefab-debug-build prefab-release-build \ @@ -755,6 +755,30 @@ 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 defaults here, but if you change one then you may need to +# change the other. (or just always build via Makefile and things will +# always line up). +WINDOWS_BUILD_DIR ?= build/windows + +foof: + echo PTH $(shell tools/pcommand wsl_path_to_win --escape --create $(WOUTDIR)) + +# Remove all non-git-managed files in windows subdir. +windows-clean: + @${CHECK_CLEAN_SAFETY} + git clean -dfx ballisticacore-windows + rm -rf ${WINDOWS_BUILD_DIR} ${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} + ################################################################################ # # @@ -884,6 +908,8 @@ WIN_MSBUILD_EXE_B = "${_WMSBE_1B}${_WMSBE_2B}" WINPRJ = $(WINDOWS_PROJECT) WINPLT = $(WINDOWS_PLATFORM) WINCFG = $(WINDOWS_CONFIGURATION) +WOUTDIR = $(WINDOWS_BUILD_DIR)/$(WINCFG)_$(WINPLT)/ +WINTDIR = $(WINDOWS_BUILD_DIR)/obj/BallisticaCore$(WINPRJ)/$(WINCFG)_$(WINPLT)/ # When using CLion, our cmake dir is root. Expose .clang-format there too. ballisticacore-cmake/.clang-format: .clang-format @@ -918,17 +944,29 @@ _cmake-simple-ci-server-build: _windows-wsl-build: ${WIN_MSBUILD_EXE_B} \ - ${shell tools/pcommand wsl_to_escaped_win_path \ - ballisticacore-windows/${WINPRJ}/BallisticaCore${WINPRJ}.vcxproj} \ - -target:Build -property:Configuration=${WINCFG} \ - -property:Platform=${WINPLT} ${VISUAL_STUDIO_VERSION} + ${shell tools/pcommand wsl_path_to_win --escape \ + ballisticacore-windows/${WINPRJ}/BallisticaCore${WINPRJ}.vcxproj} \ + -target:Build \ + -property:Configuration=${WINCFG} \ + -property:Platform=${WINPLT} \ + -property:IntDir=$(shell tools/pcommand wsl_path_to_win \ + --escape --create $(WINTDIR)) \ + -property:OutDir=$(shell tools/pcommand wsl_path_to_win \ + --escape --create $(WOUTDIR)) \ + ${VISUAL_STUDIO_VERSION} _windows-wsl-rebuild: ${WIN_MSBUILD_EXE_B} \ - ${shell tools/pcommand wsl_to_escaped_win_path \ - ballisticacore-windows/${WINPRJ}/BallisticaCore${WINPRJ}.vcxproj} \ - -target:Rebuild -property:Configuration=${WINCFG} \ - -property:Platform=${WINPLT} ${VISUAL_STUDIO_VERSION} + ${shell tools/pcommand wsl_path_to_win --escape \ + ballisticacore-windows/${WINPRJ}/BallisticaCore${WINPRJ}.vcxproj} \ + -target:Rebuild \ + -property:Configuration=${WINCFG} \ + -property:Platform=${WINPLT} \ + -property:IntDir=$(shell tools/pcommand wsl_path_to_win \ + --escape --create $(WINTDIR)) \ + -property:OutDir=$(shell tools/pcommand wsl_path_to_win \ + --escape --create $(WOUTDIR)) \ + ${VISUAL_STUDIO_VERSION} # 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-windows/Generic/BallisticaCoreGeneric.vcxproj b/ballisticacore-windows/Generic/BallisticaCoreGeneric.vcxproj index 6011ac83..ab91419a 100644 --- a/ballisticacore-windows/Generic/BallisticaCoreGeneric.vcxproj +++ b/ballisticacore-windows/Generic/BallisticaCoreGeneric.vcxproj @@ -727,7 +727,7 @@ - + diff --git a/ballisticacore-windows/Headless/BallisticaCoreHeadless.vcxproj b/ballisticacore-windows/Headless/BallisticaCoreHeadless.vcxproj index fa22160c..cd4bac56 100644 --- a/ballisticacore-windows/Headless/BallisticaCoreHeadless.vcxproj +++ b/ballisticacore-windows/Headless/BallisticaCoreHeadless.vcxproj @@ -72,22 +72,22 @@ true $(ProjectDir)..\build\$(Configuration)_$(Platform)\ - $(ProjectDir)..\build\obj\$(MSBuildProjectName)\$(Platform)_$(Configuration)\ + $(ProjectDir)..\build\obj\$(MSBuildProjectName)\$(Configuration)_$(Platform)\ true $(ProjectDir)..\build\$(Configuration)_$(Platform)\ - $(ProjectDir)..\build\obj\$(MSBuildProjectName)\$(Platform)_$(Configuration)\ + $(ProjectDir)..\build\obj\$(MSBuildProjectName)\$(Configuration)_$(Platform)\ false $(ProjectDir)..\build\$(Configuration)_$(Platform)\ - $(ProjectDir)..\build\obj\$(MSBuildProjectName)\$(Platform)_$(Configuration)\ + $(ProjectDir)..\build\obj\$(MSBuildProjectName)\$(Configuration)_$(Platform)\ false $(ProjectDir)..\build\$(Configuration)_$(Platform)\ - $(ProjectDir)..\build\obj\$(MSBuildProjectName)\$(Platform)_$(Configuration)\ + $(ProjectDir)..\build\obj\$(MSBuildProjectName)\$(Configuration)_$(Platform)\ @@ -181,7 +181,7 @@ - + diff --git a/tools/batools/pcommand.py b/tools/batools/pcommand.py index 9282cbae..a1d874ac 100644 --- a/tools/batools/pcommand.py +++ b/tools/batools/pcommand.py @@ -474,23 +474,56 @@ def checkenv() -> None: batools.build.checkenv() -def wsl_to_escaped_win_path() -> None: +def wsl_path_to_win() -> None: """Forward escape slashes in a provided win path arg.""" import subprocess + import logging + import os from efro.error import CleanError - if len(sys.argv) != 3: - raise CleanError('Expected 1 path arg.') try: - out = subprocess.run(['wslpath', '-w', '-a', sys.argv[2]], - capture_output=True, - check=True) + print('HELLO FROM WSL_PATH_TO_WIN', file=sys.stderr) + create = False + escape = False + if len(sys.argv) < 3: + raise CleanError('Expected at least 1 path arg.') + wsl_path: Optional[str] = None + for arg in sys.argv[2:]: + if arg == '--create': + create = True + elif arg == '--escape': + escape = True + else: + if wsl_path is not None: + raise CleanError('More than one path provided.') + wsl_path = arg + if wsl_path is None: + raise CleanError('No path provided.') + + # wslpath fails on nonexistent paths; make it clear when that happens. + if create: + os.makedirs(wsl_path, exist_ok=True) + if not os.path.exists(wsl_path): + raise CleanError(f'Path \'{wsl_path}\' does not exist.') + + results = subprocess.run(['wslpath', '-w', '-a', wsl_path], + capture_output=True, + check=True) except Exception: # This gets used in a makefile so our returncode is ignored; - # try to convey failure in other ways. + # let's try to make our failure known in other ways. + logging.exception('wsl_to_escaped_win_path failed.') print('wsl_to_escaped_win_path_error_occurred', end='') return - print(out.stdout.decode().strip().replace('\\', '\\\\'), end='') + out = results.stdout.decode().strip() + + # If our input ended with a slash, match in the output. + if wsl_path.endswith('/') and not out.endswith('\\'): + out += '\\' + + if escape: + out = out.replace('\\', '\\\\') + print(out, end='') def ensure_build_platform() -> None: diff --git a/tools/pcommand b/tools/pcommand index 5e145b8b..b1e9e47d 100755 --- a/tools/pcommand +++ b/tools/pcommand @@ -38,7 +38,7 @@ from batools.pcommand import ( 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_to_escaped_win_path) + gen_flat_data_code, wsl_path_to_win) # pylint: enable=unused-import if TYPE_CHECKING: