diff options
author | David Neto <dneto@google.com> | 2018-11-19 22:02:07 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-11-19 22:02:07 -0500 |
commit | e390591a28e042872376b9db4de5433b15702c02 (patch) | |
tree | 51fdfcf68fc853d3118cb9a3573b2f1b64190b30 /third_party | |
parent | 6296cc53f4608ee06fff0d57a6b266c541f0ca7a (diff) | |
download | amber-e390591a28e042872376b9db4de5433b15702c02.tar.gz |
Windows build support (#71)
Windows build support
* MSVC: Ensure CRT is statically linked into executables
* Use fopen_s on Windows to avoid security warning
* Use std::strtoull and include its header
* Use #if defined(_MSC_VER)
Diffstat (limited to 'third_party')
-rw-r--r-- | third_party/CMakeLists.txt | 81 |
1 files changed, 80 insertions, 1 deletions
diff --git a/third_party/CMakeLists.txt b/third_party/CMakeLists.txt index 4d9b5f3..1b7e2f5 100644 --- a/third_party/CMakeLists.txt +++ b/third_party/CMakeLists.txt @@ -13,7 +13,7 @@ # limitations under the License. if(WIN32) - option(g`_force_shared_crt + option(g_force_shared_crt "Use shared (DLL) run-time lib even when Google Test is built as static lib." ON) endif() @@ -151,6 +151,82 @@ if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") -Wno-pedantic) endif() +if (MSVC) + set(GTEST_BUILD_FIXES + /W3 + /wd4061 + /wd4365 + /wd4514 + /wd4571 + /wd4623 + /wd4625 + /wd4626 + /wd4668 + /wd4710 + /wd4774 + /wd4820 + /wd5026 + /wd5027 + /wd5039 + /wd5045 + ) + + set(GLSLANG_BUILD_FIXES + /W3 + /wd4242 + /wd4244 + /wd4571 + /wd4623 + /wd4625 + /wd4626 + /wd4702 + /wd4774 + /wd4820 + /wd4946 + /wd4996 + /wd5026 + /wd5027 + /wd5045 + ) + + set(SPIRV_TOOLS_BUILD_FIXES + /W3 + /wd4365 + /wd4389 + /wd4571 + /wd4623 + /wd4625 + /wd4626 + /wd4702 + /wd4706 + /wd4710 + /wd4774 + /wd4820 + /wd4826 + /wd4868 + /wd5026 + /wd5027 + /wd5045 + ) + +set(SHADERC_BUILD_FIXES + /W3 + /wd4365 + /wd4571 + /wd4623 + /wd4625 + /wd4626 + /wd4702 + /wd4774 + /wd4820 + /wd4996 + /wd5026 + /wd5027 + /wd5039 + /wd5045 + ) +endif() + set(CXX_BACK ${CMAKE_CXX_FLAGS}) SET(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} "${GTEST_BUILD_FIXES}") STRING(REGEX REPLACE ";" " " CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") @@ -173,6 +249,9 @@ set(ENABLE_HLSL ON) set(BUILD_TESTING FALSE) set(ENABLE_GLSLANG_BINARIES OFF) set(ENABLE_SPVREMAPPER OFF) +# Tell Glslang to statically link the C Runtime library. +set(LLVM_USE_CRT_DEBUG MTd) +set(LLVM_USE_CRT_RELEASE MT) add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/glslang) set(CMAKE_CXX_FLAGS ${CXX_BACK}) |