Browse Source

Fix compiler flags usage on windows

- x64/amd64 build is now officially supported
- Enable bigobj for MSVC
TODO: warning as errors are disabled in this version
Alexey Edelev 5 years ago
parent
commit
36ccc7152a
2 changed files with 8 additions and 7 deletions
  1. 7 5
      CMakeLists.txt
  2. 1 2
      README.md

+ 7 - 5
CMakeLists.txt

@@ -47,11 +47,13 @@ if(UNIX)
         set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Werror -Wno-error=deprecated-declarations")
     endif()
 elseif(WIN32)
-    if(CMAKE_CL_64)
-        message(FATAL_ERROR "WIN64 build is unsupported yet")
-    endif()
-    if(${CMAKE_CXX_COMPILER_ID} MATCHES "MSVC")
-        set(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} "/WX /W4 /MD")
+    if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
+#TODO: not all l4 warnings are fixed for MSVC. Enable options bellow
+#once fixed
+#        set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /WX /W4 /MD")
+#        set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /WX /W4 /MD")
+        set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /bigobj")
+        set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /bigobj")
     else()
         message(WARNING "Only MSVC compilers family are supported for build")
     endif()

+ 1 - 2
README.md

@@ -62,14 +62,13 @@ git submodule update --init --recursive
 Open Qt MSVC command line and follow steps:
 
 ```bash
-"C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvarsall.bat" x86
+"C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvarsall.bat" <x86|x64>
 cd <directory with qtprotobuf project>
 mkdir build
 cd build
 cmake ..
 cmake --build . [--config <RELEASE|DEBUG>] -- /m:<N>
 ```
-**Note:** 64-bit build is not supported yet
 
 ## Usage