diff --git a/build-msvc.bat b/build-msvc.bat index d733ff0..044ed6e 100755 --- a/build-msvc.bat +++ b/build-msvc.bat @@ -70,10 +70,21 @@ if %clean% == true ( echo ------------------------ echo cleaning up old files echo ------------------------ - rd /s /q "third_party\sgl" rd /s /q "third_party\vcpkg" for /d %%G in (".build*") do rd /s /q "%%~G" rd /s /q "Shipping" + +:: https://stackoverflow.com/questions/5626879/how-to-find-if-a-file-contains-a-given-string-using-windows-command-line + find /c "sgl" .gitmodules >NUL + if %errorlevel% equ 1 goto notfound + rd /s /q "third_party\sgl\install" + for /d %%G in ("third_party\sgl\.build*") do rd /s /q "%%~G" + goto done + :notfound + rd /s /q "third_party\sgl" + goto done + :done + git submodule update --init --recursive ) diff --git a/build.sh b/build.sh index b8c3d2c..2fb7e64 100755 --- a/build.sh +++ b/build.sh @@ -137,7 +137,12 @@ if [ $clean = true ]; then echo "------------------------" echo " cleaning up old files " echo "------------------------" - rm -rf third_party/sgl/ third_party/vcpkg/ .build_release/ .build_debug/ Shipping/ + rm -rf third_party/vcpkg/ .build_release/ .build_debug/ Shipping/ + if grep -wq "sgl" .gitmodules; then + rm -rf third_party/sgl/install/ third_party/sgl/.build_release/ third_party/sgl/.build_debug/ + else + rm -rf third_party/sgl/ + fi git submodule update --init --recursive fi