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>2019-10-01 21:36:11 +0300
committerRay Molenkamp <github@lazydodo.com>2019-10-01 21:36:11 +0300
commit34bd23dbb71b2f8bfc696acf5107650bd750364d (patch)
tree038dc3019c13624eb83918f6f0abd1242137fa5f
parentc06350d8a79fa1bfeda0772d683cb91218ea3cb7 (diff)
MSVC: Support Building clang+ninja+VS2019
1) Clang was given the wrong VS version to emulate when used in combination with VS2019 causing build issues. 2) The erroneous supplied parameter `-std::c++11`caused CMake to fail running its compiler detection scripts.
-rw-r--r--CMakeLists.txt10
-rw-r--r--build_files/windows/configure_ninja.cmd12
2 files changed, 16 insertions, 6 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 258e79b7d4a..cddb93dd7ab 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1610,15 +1610,19 @@ if(WITH_PYTHON)
endif()
endif()
-if(
+if(MSVC)
+ # MSVC needs to be tested first, since clang on windows will
+ # match the compiler test below but clang-cl does not accept -std=c++11
+ # since it is on by default and cannot be turned off.
+ #
+ # Nothing special is needed, C++11 features are available by default.
+elseif(
CMAKE_COMPILER_IS_GNUCC OR
CMAKE_C_COMPILER_ID MATCHES "Clang" OR
CMAKE_C_COMPILER_ID MATCHES "Intel"
)
# TODO(sergey): Do we want c++11 or gnu-c++11 here?
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
-elseif(MSVC)
- # Nothing special is needed, C++11 features are available by default.
else()
message(FATAL_ERROR "Unknown compiler ${CMAKE_C_COMPILER_ID}, can't enable C++11 build")
endif()
diff --git a/build_files/windows/configure_ninja.cmd b/build_files/windows/configure_ninja.cmd
index 995d8d56fa8..8f766e855a6 100644
--- a/build_files/windows/configure_ninja.cmd
+++ b/build_files/windows/configure_ninja.cmd
@@ -30,9 +30,15 @@ set LLVM_DIR=
:DetectionComplete
set CC=%LLVM_DIR%\bin\clang-cl
set CXX=%LLVM_DIR%\bin\clang-cl
- rem build and tested against 2017 15.7
- set CFLAGS=-m64 -fmsc-version=1914
- set CXXFLAGS=-m64 -fmsc-version=1914
+ 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
+ )
if "%WITH_ASAN%"=="1" (
set BUILD_CMAKE_ARGS=%BUILD_CMAKE_ARGS% -DWITH_COMPILER_ASAN=On
)