REM This batch file does an out-of-source CMake build in ../build_windows
REM This is for users who like to configure & build Blender with a single command.
+setlocal ENABLEEXTENSIONS
set BLENDER_DIR=%~dp0
set BUILD_DIR=%BLENDER_DIR%..\build_windows
set BUILD_TYPE=Release
set BUILD_CMAKE_ARGS=
+REM Detect MSVC Installation
+if DEFINED VisualStudioVersion goto msvc_detect_finally
+set VALUE_NAME=ProductDir
+REM Check 64 bits
+set KEY_NAME="HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\12.0\Setup\VC"
+for /F "usebackq skip=2 tokens=1-2*" %%A IN (`REG QUERY %KEY_NAME% /v %VALUE_NAME% 2^>nul`) DO set MSVC_VC_DIR=%%C
+if DEFINED MSVC_VC_DIR goto msvc_detect_finally
+REM Check 32 bits
+set KEY_NAME="HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\12.0\Setup\VC"
+for /F "usebackq skip=2 tokens=1-2*" %%A IN (`REG QUERY %KEY_NAME% /v %VALUE_NAME% 2^>nul`) DO set MSVC_VC_DIR=%%C
+if DEFINED MSVC_VC_DIR goto msvc_detect_finally
+:msvc_detect_finally
+if DEFINED MSVC_VC_DIR call "%MSVC_VC_DIR%\vcvarsall.bat"
+
+
REM Sanity Checks
where /Q msbuild
if %ERRORLEVEL% NEQ 0 (
if NOT "%1" == "" (
REM Help Message
- if "%1" == "--help" (
+ if "%1" == "help" (
echo.
echo Convenience targets
echo - debug
echo - bpy
echo.
echo Utilities ^(not associated with building^)
+ echo - clean
echo - update
goto EOF
)
git pull --rebase
git submodule foreach git pull --rebase origin master
goto EOF
+ ) else if "%1" == "clean" (
+ msbuild ^
+ %BUILD_DIR%\Blender.sln ^
+ /target:clean ^
+ /property:Configuration=%BUILD_TYPE% ^
+ /verbosity:minimal
+ if %ERRORLEVEL% NEQ 0 (
+ echo Cleaned "%BUILD_DIR%"
+ )
+ goto EOF
) else (
echo Command "%1" unknown, aborting!
goto EOF
mkdir %BUILD_DIR%
)
-cmake ^
- %BUILD_CMAKE_ARGS% ^
- -H%BLENDER_DIR% ^
- -B%BUILD_DIR% ^
- %BUILD_CMAKE_ARGS%
+REM Only configure on first run
+if NOT EXIST %BUILD_DIR%\Blender.sln (
+ cmake ^
+ %BUILD_CMAKE_ARGS% ^
+ -H%BLENDER_DIR% ^
+ -B%BUILD_DIR% ^
+ %BUILD_CMAKE_ARGS%
-if %ERRORLEVEL% NEQ 0 (
- echo "Configuration Failed"
- goto EOF
+ if %ERRORLEVEL% NEQ 0 (
+ echo "Configuration Failed"
+ goto EOF
+ )
)
msbuild ^
/verbosity:minimal
echo.
-echo Your build is complete at: "%BUILD_DIR%\bin\%BUILD_TYPE%"
+echo At any point you can optionally modify your build configuration by editing:
+echo "%BUILD_DIR%\CMakeCache.txt", then run "make" again to build with the changes applied.
+echo.
+echo Blender successfully built, run from: "%BUILD_DIR%\bin\%BUILD_TYPE%"
echo.
:EOF