2018-06-05 16:39:39 +00:00
|
|
|
ninja --version 1>NUL 2>&1
|
|
|
|
if %ERRORLEVEL% NEQ 0 (
|
|
|
|
echo "Ninja not detected in the path"
|
|
|
|
exit /b 1
|
|
|
|
)
|
|
|
|
|
2018-05-26 03:46:42 +00:00
|
|
|
set BUILD_CMAKE_ARGS=%BUILD_CMAKE_ARGS% -G "Ninja" %TESTS_CMAKE_ARGS% -DCMAKE_BUILD_TYPE=%BUILD_TYPE%
|
Windows: Add support for building with clang.
This commit contains the minimum to make clang build/work with blender, asan and ninja build support is forthcoming
Things to note:
1) Builds and runs, and is able to pass all tests (except for the freestyle_stroke_material.blend test which was broken at that time for all platforms by the looks of it)
2) It's slightly faster than msvc when using cycles. (time in seconds, on an i7-3370)
victor_cpu
msvc:3099.51
clang:2796.43
pavillon_barcelona_cpu
msvc:1872.05
clang:1827.72
koro_cpu
msvc:1097.58
clang:1006.51
fishy_cat_cpu
msvc:815.37
clang:722.2
classroom_cpu
msvc:1705.39
clang:1575.43
bmw27_cpu
msvc:552.38
clang:561.53
barbershop_interior_cpu
msvc:2134.93
clang:1922.33
3) clang on windows uses a drop in replacement for the Microsoft cl.exe (takes some of the Microsoft parameters, but not all, and takes some of the clang parameters but not all) and uses ms headers + libraries + linker, so you still need visual studio installed and will use our existing vc14 svn libs.
4) X64 only currently, X86 builds but crashes on startup.
5) Tested with llvm/clang 6.0.0
6) Requires visual studio integration, available at https://github.com/LazyDodo/llvm-vs2017-integration
7) The Microsoft compiler spawns a few copies of cl in parallel to get faster build times, clang doesn't, so the build time is 3-4x slower than with msvc.
8) No openmp support yet. Have not looked at this much, the binary distribution of clang doesn't seem to include it on windows.
9) No ASAN support yet, some of the sanitizers can be made to work, but it was decided to leave support out of this commit.
Reviewers: campbellbarton
Differential Revision: https://developer.blender.org/D3304
2018-05-28 20:34:47 +00:00
|
|
|
|
2020-04-20 18:51:43 +00:00
|
|
|
if "%BUILD_WITH_SCCACHE%"=="1" (
|
|
|
|
set BUILD_CMAKE_ARGS=%BUILD_CMAKE_ARGS% -DWITH_WINDOWS_SCCACHE=On
|
|
|
|
if NOT "%verbose%" == "" (
|
|
|
|
echo Enabling sccache
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
Windows: Add support for building with clang.
This commit contains the minimum to make clang build/work with blender, asan and ninja build support is forthcoming
Things to note:
1) Builds and runs, and is able to pass all tests (except for the freestyle_stroke_material.blend test which was broken at that time for all platforms by the looks of it)
2) It's slightly faster than msvc when using cycles. (time in seconds, on an i7-3370)
victor_cpu
msvc:3099.51
clang:2796.43
pavillon_barcelona_cpu
msvc:1872.05
clang:1827.72
koro_cpu
msvc:1097.58
clang:1006.51
fishy_cat_cpu
msvc:815.37
clang:722.2
classroom_cpu
msvc:1705.39
clang:1575.43
bmw27_cpu
msvc:552.38
clang:561.53
barbershop_interior_cpu
msvc:2134.93
clang:1922.33
3) clang on windows uses a drop in replacement for the Microsoft cl.exe (takes some of the Microsoft parameters, but not all, and takes some of the clang parameters but not all) and uses ms headers + libraries + linker, so you still need visual studio installed and will use our existing vc14 svn libs.
4) X64 only currently, X86 builds but crashes on startup.
5) Tested with llvm/clang 6.0.0
6) Requires visual studio integration, available at https://github.com/LazyDodo/llvm-vs2017-integration
7) The Microsoft compiler spawns a few copies of cl in parallel to get faster build times, clang doesn't, so the build time is 3-4x slower than with msvc.
8) No openmp support yet. Have not looked at this much, the binary distribution of clang doesn't seem to include it on windows.
9) No ASAN support yet, some of the sanitizers can be made to work, but it was decided to leave support out of this commit.
Reviewers: campbellbarton
Differential Revision: https://developer.blender.org/D3304
2018-05-28 20:34:47 +00:00
|
|
|
if "%WITH_CLANG%" == "1" (
|
2018-05-29 01:56:17 +00:00
|
|
|
set LLVM_DIR=
|
|
|
|
for /F "usebackq skip=2 tokens=1-2*" %%A IN (`REG QUERY "HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\LLVM\LLVM" /ve 2^>nul`) DO set LLVM_DIR=%%C
|
|
|
|
if DEFINED LLVM_DIR (
|
|
|
|
if NOT "%verbose%" == "" (
|
|
|
|
echo LLVM Detected at "%LLVM_DIR%"
|
|
|
|
)
|
|
|
|
goto DetectionComplete
|
|
|
|
)
|
|
|
|
|
|
|
|
REM Check 32 bits
|
|
|
|
for /F "usebackq skip=2 tokens=1-2*" %%A IN (`REG QUERY "HKEY_LOCAL_MACHINE\SOFTWARE\LLVM\LLVM" /ve 2^>nul`) DO set LLVM_DIR=%%C
|
|
|
|
if DEFINED LLVM_DIR (
|
|
|
|
if NOT "%verbose%" == "" (
|
|
|
|
echo LLVM Detected at "%LLVM_DIR%"
|
|
|
|
)
|
|
|
|
goto DetectionComplete
|
|
|
|
)
|
|
|
|
echo LLVM not found
|
Windows: Add support for building with clang.
This commit contains the minimum to make clang build/work with blender, asan and ninja build support is forthcoming
Things to note:
1) Builds and runs, and is able to pass all tests (except for the freestyle_stroke_material.blend test which was broken at that time for all platforms by the looks of it)
2) It's slightly faster than msvc when using cycles. (time in seconds, on an i7-3370)
victor_cpu
msvc:3099.51
clang:2796.43
pavillon_barcelona_cpu
msvc:1872.05
clang:1827.72
koro_cpu
msvc:1097.58
clang:1006.51
fishy_cat_cpu
msvc:815.37
clang:722.2
classroom_cpu
msvc:1705.39
clang:1575.43
bmw27_cpu
msvc:552.38
clang:561.53
barbershop_interior_cpu
msvc:2134.93
clang:1922.33
3) clang on windows uses a drop in replacement for the Microsoft cl.exe (takes some of the Microsoft parameters, but not all, and takes some of the clang parameters but not all) and uses ms headers + libraries + linker, so you still need visual studio installed and will use our existing vc14 svn libs.
4) X64 only currently, X86 builds but crashes on startup.
5) Tested with llvm/clang 6.0.0
6) Requires visual studio integration, available at https://github.com/LazyDodo/llvm-vs2017-integration
7) The Microsoft compiler spawns a few copies of cl in parallel to get faster build times, clang doesn't, so the build time is 3-4x slower than with msvc.
8) No openmp support yet. Have not looked at this much, the binary distribution of clang doesn't seem to include it on windows.
9) No ASAN support yet, some of the sanitizers can be made to work, but it was decided to leave support out of this commit.
Reviewers: campbellbarton
Differential Revision: https://developer.blender.org/D3304
2018-05-28 20:34:47 +00:00
|
|
|
exit /b 1
|
2018-05-29 01:56:17 +00:00
|
|
|
|
|
|
|
:DetectionComplete
|
|
|
|
set CC=%LLVM_DIR%\bin\clang-cl
|
|
|
|
set CXX=%LLVM_DIR%\bin\clang-cl
|
2019-10-01 18:36:11 +00:00
|
|
|
if "%BUILD_VS_YEAR%" == "2019" (
|
|
|
|
rem build and tested against 2019 16.2
|
|
|
|
set CFLAGS=-m64 -fmsc-version=1922
|
|
|
|
set CXXFLAGS=-m64 -fmsc-version=1922
|
|
|
|
) else (
|
|
|
|
rem build and tested against 2017 15.7
|
|
|
|
set CFLAGS=-m64 -fmsc-version=1914
|
|
|
|
set CXXFLAGS=-m64 -fmsc-version=1914
|
|
|
|
)
|
2018-05-31 17:50:30 +00:00
|
|
|
if "%WITH_ASAN%"=="1" (
|
|
|
|
set BUILD_CMAKE_ARGS=%BUILD_CMAKE_ARGS% -DWITH_COMPILER_ASAN=On
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
if "%WITH_ASAN%"=="1" (
|
|
|
|
if "%WITH_CLANG%" == "" (
|
|
|
|
echo ASAN is only supported with clang.
|
|
|
|
exit /b 1
|
|
|
|
)
|
Windows: Add support for building with clang.
This commit contains the minimum to make clang build/work with blender, asan and ninja build support is forthcoming
Things to note:
1) Builds and runs, and is able to pass all tests (except for the freestyle_stroke_material.blend test which was broken at that time for all platforms by the looks of it)
2) It's slightly faster than msvc when using cycles. (time in seconds, on an i7-3370)
victor_cpu
msvc:3099.51
clang:2796.43
pavillon_barcelona_cpu
msvc:1872.05
clang:1827.72
koro_cpu
msvc:1097.58
clang:1006.51
fishy_cat_cpu
msvc:815.37
clang:722.2
classroom_cpu
msvc:1705.39
clang:1575.43
bmw27_cpu
msvc:552.38
clang:561.53
barbershop_interior_cpu
msvc:2134.93
clang:1922.33
3) clang on windows uses a drop in replacement for the Microsoft cl.exe (takes some of the Microsoft parameters, but not all, and takes some of the clang parameters but not all) and uses ms headers + libraries + linker, so you still need visual studio installed and will use our existing vc14 svn libs.
4) X64 only currently, X86 builds but crashes on startup.
5) Tested with llvm/clang 6.0.0
6) Requires visual studio integration, available at https://github.com/LazyDodo/llvm-vs2017-integration
7) The Microsoft compiler spawns a few copies of cl in parallel to get faster build times, clang doesn't, so the build time is 3-4x slower than with msvc.
8) No openmp support yet. Have not looked at this much, the binary distribution of clang doesn't seem to include it on windows.
9) No ASAN support yet, some of the sanitizers can be made to work, but it was decided to leave support out of this commit.
Reviewers: campbellbarton
Differential Revision: https://developer.blender.org/D3304
2018-05-28 20:34:47 +00:00
|
|
|
)
|
|
|
|
|
2018-05-26 03:46:42 +00:00
|
|
|
if NOT "%verbose%" == "" (
|
|
|
|
echo BUILD_CMAKE_ARGS=%BUILD_CMAKE_ARGS%
|
|
|
|
)
|
|
|
|
|
|
|
|
if NOT EXIST %BUILD_DIR%\nul (
|
|
|
|
mkdir %BUILD_DIR%
|
|
|
|
)
|
|
|
|
|
|
|
|
if "%MUST_CLEAN%"=="1" (
|
|
|
|
echo Cleaning %BUILD_DIR%
|
|
|
|
cd %BUILD_DIR%
|
|
|
|
%CMAKE% cmake --build . --config Clean
|
|
|
|
)
|
|
|
|
|
2018-08-14 13:57:21 +00:00
|
|
|
if NOT EXIST %BUILD_DIR%\build.ninja set MUST_CONFIGURE=1
|
2018-05-26 03:46:42 +00:00
|
|
|
if "%NOBUILD%"=="1" set MUST_CONFIGURE=1
|
|
|
|
|
|
|
|
if "%MUST_CONFIGURE%"=="1" (
|
|
|
|
cmake ^
|
|
|
|
%BUILD_CMAKE_ARGS% ^
|
|
|
|
-H%BLENDER_DIR% ^
|
|
|
|
-B%BUILD_DIR%
|
|
|
|
|
|
|
|
if %ERRORLEVEL% NEQ 0 (
|
|
|
|
echo "Configuration Failed"
|
|
|
|
exit /b 1
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
2020-02-09 00:14:47 +00:00
|
|
|
echo echo off > %BUILD_DIR%\rebuild.cmd
|
|
|
|
echo if "%%VSCMD_VER%%" == "" ^( >> %BUILD_DIR%\rebuild.cmd
|
|
|
|
echo call "%VCVARS%" %BUILD_ARCH% >> %BUILD_DIR%\rebuild.cmd
|
|
|
|
echo ^) >> %BUILD_DIR%\rebuild.cmd
|
2018-05-26 03:46:42 +00:00
|
|
|
echo echo %%TIME%% ^> buildtime.txt >> %BUILD_DIR%\rebuild.cmd
|
2020-11-30 15:22:50 +00:00
|
|
|
echo ninja install %%* >> %BUILD_DIR%\rebuild.cmd
|
2018-05-26 03:46:42 +00:00
|
|
|
echo echo %%TIME%% ^>^> buildtime.txt >> %BUILD_DIR%\rebuild.cmd
|