From bcdccd29019b0353f6ba5b21a8fc0a05aabd12dc Mon Sep 17 00:00:00 2001 From: Austin Hale Date: Fri, 24 Jul 2026 11:05:25 -0700 Subject: [PATCH 1/4] fix: dedup native build/clean across multi-TFM builds via inner MSBuild project Delegating the cmake configure/build and the clean's directory removal to BuildStereoKitNative.proj lets MSBuild collapse concurrent identical requests from parallel TFM/project builds into a single execution instead of racing. The clean also switches to 'cmake -E rm -rf', which handles the read-only git objects under _deps that RemoveDir refuses to delete. Design-time builds skip the native build entirely. --- StereoKit/BuildStereoKitNative.proj | 15 +++++++++++++++ StereoKit/BuildStereoKitSDK.targets | 27 ++++++++++++++++----------- 2 files changed, 31 insertions(+), 11 deletions(-) create mode 100644 StereoKit/BuildStereoKitNative.proj diff --git a/StereoKit/BuildStereoKitNative.proj b/StereoKit/BuildStereoKitNative.proj new file mode 100644 index 000000000..844684385 --- /dev/null +++ b/StereoKit/BuildStereoKitNative.proj @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/StereoKit/BuildStereoKitSDK.targets b/StereoKit/BuildStereoKitSDK.targets index aa010510d..c616ae8de 100644 --- a/StereoKit/BuildStereoKitSDK.targets +++ b/StereoKit/BuildStereoKitSDK.targets @@ -67,7 +67,7 @@ - + _Fast @@ -75,14 +75,12 @@ $(SKSDKFolder)\bin\intermediate\$(SKSDKBuildOS)_$(SKSDKBuildModePreset)$(SKSDKPresetFast)\CMakeCache.txt $(SKSDKFolder)\bin\intermediate\$(SKSDKBuildOS)_$(SKSDKBuildModePreset)_$(Configuration)$(SKSDKPresetFast)\CMakeCache.txt - - cd "$(SKSDKFolder)" - $(SKBuildCommand) && cmake --preset $(SKSDKPreset) -DSK_BUILD_TESTS=OFF $(SKConfigureArgs) - $(SKBuildCommand) && cmake --build --preset $(SKSDKPreset) - - + @@ -120,9 +118,16 @@ - - - + + _Fast + + $(SKSDKFolder)\bin\intermediate\$(SKSDKBuildOS)_$(SKSDKBuildModePreset)$(SKSDKPresetFast) + $(SKSDKFolder)\bin\intermediate\$(SKSDKBuildOS)_$(SKSDKBuildModePreset)_$(Configuration)$(SKSDKPresetFast) + + @@ -130,4 +135,4 @@ - \ No newline at end of file + From 8dff3273c50445ddaeabf74249160f744c7e20af Mon Sep 17 00:00:00 2001 From: Austin Hale Date: Fri, 24 Jul 2026 11:06:04 -0700 Subject: [PATCH 2/4] fix: strip openxr_loader to a side file instead of in place Stripping the loader's actual build output on every StereoKitC post-build destroyed debug symbols in the build tree and rewrote the file each build. Strip to a .stripped side file in the binary dir and point the distribute copy at it; distribute output is unchanged, the build tree keeps symbols. --- CMakeLists.txt | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ee3361ae1..843104ca0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -709,11 +709,6 @@ if (NOT MSVC) COMMAND ${CMAKE_OBJCOPY} --add-gnu-debuglink=$/$$${SK_BIN_DEBUG_EXT} $ ) endif() - if (SK_DYNAMIC_OPENXR AND SK_STRIP_DEBUG_SYMBOLS) - add_custom_command(TARGET StereoKitC POST_BUILD - COMMAND ${CMAKE_STRIP} --strip-debug $ - ) - endif() endif() else() set(SK_BIN_DEBUG_EXT ".pdb") @@ -870,9 +865,15 @@ if(SK_DISTRIBUTE) COMMAND ${CMAKE_COMMAND} -E copy_if_different "$/$$${SK_BIN_DEBUG_EXT}" "${CMAKE_CURRENT_SOURCE_DIR}/${SK_DISTRIBUTE_FOLDER}/bin/${SK_BIN_OS}/${SK_ARCH}/$/$$${SK_BIN_DEBUG_EXT}" ) endif() if (SK_DYNAMIC_OPENXR) + set(SK_OPENXR_LOADER_DIST_SRC "$") + if (SK_STRIP_DEBUG_SYMBOLS AND NOT MSVC AND NOT APPLE) + set(SK_OPENXR_LOADER_DIST_SRC "${CMAKE_CURRENT_BINARY_DIR}/$.stripped") + add_custom_command(TARGET StereoKitC POST_BUILD + COMMAND ${CMAKE_STRIP} --strip-debug -o "${SK_OPENXR_LOADER_DIST_SRC}" "$" ) + endif() add_custom_command(TARGET StereoKitC POST_BUILD COMMAND ${CMAKE_COMMAND} -E make_directory "${CMAKE_CURRENT_SOURCE_DIR}/${SK_DISTRIBUTE_FOLDER}/bin/${SK_BIN_OS}/${SK_ARCH}/$/standard" - COMMAND ${CMAKE_COMMAND} -E copy_if_different "$" "${CMAKE_CURRENT_SOURCE_DIR}/${SK_DISTRIBUTE_FOLDER}/bin/${SK_BIN_OS}/${SK_ARCH}/$/standard/$" ) + COMMAND ${CMAKE_COMMAND} -E copy_if_different "${SK_OPENXR_LOADER_DIST_SRC}" "${CMAKE_CURRENT_SOURCE_DIR}/${SK_DISTRIBUTE_FOLDER}/bin/${SK_BIN_OS}/${SK_ARCH}/$/standard/$" ) endif() # Copy sk_app.jar on Android (Java classes for file dialogs, activity results) if (ANDROID AND TARGET sk_app_jar) From e9f9ba79865badcc06af6e6dd26bc1018e9a2b85 Mon Sep 17 00:00:00 2001 From: Austin Hale Date: Fri, 24 Jul 2026 11:06:22 -0700 Subject: [PATCH 3/4] feat: auto-detect sibling sk_renderer checkout, use per-preset binary dir SK_LOCAL_SK_RENDERER now defaults ON when a sibling ../sk_renderer clone exists. The local add_subdirectory also moves its binary dir into CMAKE_BINARY_DIR so each preset (MSVC, NDK) gets its own build tree instead of colliding in a shared ../sk_renderer/build. --- CMakeLists.txt | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 843104ca0..024a2a0f1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -49,7 +49,12 @@ set(SK_BUILD_TESTS ON CACHE BOOL "Build the StereoKitCTest pro set(SK_BUILD_SHARED_LIBS ON CACHE BOOL "Should StereoKit build as a shared, or static library?") set(SK_DYNAMIC_OPENXR OFF CACHE BOOL "Dynamic link with the standard OpenXR Loader. Not what you want on desktop, but on Android you may need to dynamic link with other loaders.") set(SK_WINDOWS_GL OFF CACHE BOOL "Build Windows version using OpenGL as the renderer. This is primarily for debugging GL code while developing on Windows.") -set(SK_LOCAL_SK_RENDERER OFF CACHE BOOL "Build using a local version of sk_renderer, instead of the latest release. This is useful for testing in-progress changes to sk_renderer.") +if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/../sk_renderer/CMakeLists.txt") + set(SK_DEFAULT_LOCAL_SK_RENDERER ON) +else() + set(SK_DEFAULT_LOCAL_SK_RENDERER OFF) +endif() +set(SK_LOCAL_SK_RENDERER ${SK_DEFAULT_LOCAL_SK_RENDERER} CACHE BOOL "Build using a local version of sk_renderer, instead of the latest release. This is useful for testing in-progress changes to sk_renderer.") set(SK_LOCAL_SK_APP OFF CACHE BOOL "Build using a local version of sk_app, instead of the latest release. This is useful for testing in-progress changes to sk_app.") set(SK_PROFILE OFF CACHE BOOL "Build with Tracy profiler enabled.") set(SK_STRIP_DEBUG_SYMBOLS ON CACHE BOOL "Strip debug symbols from the shared library. Disable on Android to keep symbols embedded for native debugging.") @@ -312,7 +317,7 @@ if (NOT SK_LOCAL_SK_RENDERER) else() # For building directly with in-progress sk_renderer changes, point this to your # local sk_renderer clone, and use it instead of CPM. - add_subdirectory(../sk_renderer ../sk_renderer/build) + add_subdirectory(../sk_renderer ${CMAKE_BINARY_DIR}/sk_renderer-local) endif() set_target_properties(sk_renderer PROPERTIES POSITION_INDEPENDENT_CODE ON) # Enable Win32 Vulkan surface support for Windows builds (needed by volk) From 1e48cbc88a1cb521f2f52aaf502ce9601bb42756 Mon Sep 17 00:00:00 2001 From: Austin Hale Date: Fri, 24 Jul 2026 11:06:34 -0700 Subject: [PATCH 4/4] fix: drop FORCE from SKSHADERC_ENABLE_GLSLANG so -D overrides work FORCE stomped the cache on every configure, making it impossible to opt in to glslang from the command line when SK_USE_SVSL is on. Without FORCE the defaults are unchanged, but an explicit -DSKSHADERC_ENABLE_GLSLANG=ON wins. --- CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 024a2a0f1..5335a6809 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -304,9 +304,9 @@ set(SKR_BUILD_EXAMPLES OFF CACHE PATH "Faster build" FORCE) # If we're only using the SVSL shader compiler, we can drop glslang from # skshaderc and save ourselves a lot of binary size and build time! if (SK_USE_SVSL) - set(SKSHADERC_ENABLE_GLSLANG OFF CACHE BOOL "Not needed with SVSL" FORCE) + set(SKSHADERC_ENABLE_GLSLANG OFF CACHE BOOL "Not needed with SVSL") else() - set(SKSHADERC_ENABLE_GLSLANG ON CACHE BOOL "Required for HLSL shaders" FORCE) + set(SKSHADERC_ENABLE_GLSLANG ON CACHE BOOL "Required for HLSL shaders") endif() if (NOT SK_LOCAL_SK_RENDERER) CPMAddPackage(