Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRay Molenkamp <github@lazydodo.com>2020-04-20 21:51:43 +0300
committerRay Molenkamp <github@lazydodo.com>2020-04-20 21:51:43 +0300
commit55a2682348df94d0ff2f57d786b7a557312d0345 (patch)
treec79466cc4bd00ce1469c96205723ac25d86d7968 /build_files/cmake/platform/platform_win32.cmake
parent9618bd9202a7f4a024895da443d8e053debe6b4a (diff)
Windows: Add sccache support.
sccache [1] is one of the few ccache like solutions that will work on windows. sccache support can be enabled with the `WITH_WINDOWS_SCCACHE` cmake option however it will only will work with ninja as the build system, msbuild is not supported currently. Advanced option, developes are expected to obtain and configure sccache on their own. ``` Full build no cache 1428.90s (100.00%) Full build cached 434.34s ( 30.40%) ``` [1] https://github.com/mozilla/sccache Reviewed By: nicholas_rishel, Brecht Differential Revision: https://developer.blender.org/D7466
Diffstat (limited to 'build_files/cmake/platform/platform_win32.cmake')
-rw-r--r--build_files/cmake/platform/platform_win32.cmake24
1 files changed, 19 insertions, 5 deletions
diff --git a/build_files/cmake/platform/platform_win32.cmake b/build_files/cmake/platform/platform_win32.cmake
index 1ecde8635c8..f882ff6238b 100644
--- a/build_files/cmake/platform/platform_win32.cmake
+++ b/build_files/cmake/platform/platform_win32.cmake
@@ -134,7 +134,7 @@ add_definitions(-D_ALLOW_KEYWORD_MACROS)
# We want to support Windows 7 level ABI
add_definitions(-D_WIN32_WINNT=0x601)
include(build_files/cmake/platform/platform_win32_bundle_crt.cmake)
-remove_cc_flag("/MDd" "/MD")
+remove_cc_flag("/MDd" "/MD" "/Zi")
if(MSVC_CLANG) # Clangs version of cl doesn't support all flags
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CXX_WARN_FLAGS} /nologo /J /Gd /EHsc -Wno-unused-command-line-argument -Wno-microsoft-enum-forward-reference ")
@@ -151,16 +151,30 @@ if(MSVC_VERSION GREATER 1911 AND NOT MSVC_CLANG)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /Zc:twoPhase-")
endif()
+if(WITH_WINDOWS_SCCACHE AND CMAKE_VS_MSBUILD_COMMAND)
+ message(WARNING "Disabling sccache, sccache is not supported with msbuild")
+ set(WITH_WINDOWS_SCCACHE Off)
+endif()
-set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /MDd /ZI")
-set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /MDd /ZI")
+if(WITH_WINDOWS_SCCACHE)
+ set(CMAKE_C_COMPILER_LAUNCHER sccache)
+ set(CMAKE_CXX_COMPILER_LAUNCHER sccache)
+ set(SYMBOL_FORMAT /Z7)
+else()
+ unset(CMAKE_C_COMPILER_LAUNCHER)
+ unset(CMAKE_CXX_COMPILER_LAUNCHER)
+ set(SYMBOL_FORMAT /ZI)
+endif()
+
+set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /MDd ${SYMBOL_FORMAT}")
+set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /MDd ${SYMBOL_FORMAT}")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /MD")
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} /MD")
set(CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS_MINSIZEREL} /MD")
set(CMAKE_C_FLAGS_MINSIZEREL "${CMAKE_C_FLAGS_MINSIZEREL} /MD")
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} /MD")
set(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO} /MD")
-
+unset(SYMBOL_FORMAT)
# JMC is available on msvc 15.8 (1915) and up
if(MSVC_VERSION GREATER 1914 AND NOT MSVC_CLANG)
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /JMC")
@@ -209,7 +223,7 @@ endif()
# Mark libdir as system headers with a lower warn level, to resolve some warnings
# that we have very little control over
-if(MSVC_VERSION GREATER_EQUAL 1914 AND NOT MSVC_CLANG)
+if(MSVC_VERSION GREATER_EQUAL 1914 AND NOT MSVC_CLANG AND NOT WITH_WINDOWS_SCCACHE)
add_compile_options(/experimental:external /external:templates- /external:I "${LIBDIR}" /external:W0)
endif()