parquet-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From u..@apache.org
Subject parquet-cpp git commit: PARQUET-977: Improve MSVC build.
Date Fri, 12 May 2017 12:55:42 GMT
Repository: parquet-cpp
Updated Branches:
  refs/heads/master a5e6482e2 -> 305aaccaf


PARQUET-977: Improve MSVC build.

- Fix "msvc" COMPILER_FAMILY detection.
- Fix CMAKE_C*_FLAGS for MSVC.

Author: revaliu <revaliu@microsoft.com>

Closes #320 from rip-nsk/master and squashes the following commits:

6ae8419 [revaliu] PARQUET-977: Add check for supported version of MSVC
c9d860f [revaliu] PARQUET-977: Improve MSVC build.


Project: http://git-wip-us.apache.org/repos/asf/parquet-cpp/repo
Commit: http://git-wip-us.apache.org/repos/asf/parquet-cpp/commit/305aacca
Tree: http://git-wip-us.apache.org/repos/asf/parquet-cpp/tree/305aacca
Diff: http://git-wip-us.apache.org/repos/asf/parquet-cpp/diff/305aacca

Branch: refs/heads/master
Commit: 305aaccaffd0571ddfee194ae958820bbbd2f140
Parents: a5e6482
Author: revaliu <revaliu@microsoft.com>
Authored: Fri May 12 14:55:37 2017 +0200
Committer: Uwe L. Korn <uwe@apache.org>
Committed: Fri May 12 14:55:37 2017 +0200

----------------------------------------------------------------------
 CMakeLists.txt                          | 16 +++++++++++-----
 cmake_modules/CompilerInfo.cmake        | 18 +++++++++++++++---
 cmake_modules/ThirdpartyToolchain.cmake | 12 +++++++++---
 3 files changed, 35 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/parquet-cpp/blob/305aacca/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/CMakeLists.txt b/CMakeLists.txt
index e18cf7b..9c0ffc6 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -363,12 +363,13 @@ endif()
 #   -O3: Enable all compiler optimizations
 #   Debug symbols are stripped for reduced binary size. Add
 #   -DPARQUET_CXXFLAGS="-g" to include them
-set(CXX_FLAGS_DEBUG "-ggdb -O0")
 if (MSVC)
-  set(CXX_FLAGS_DEBUG "${CXX_FLAGS_DEBUG} /bigobj")
+  set(CXX_FLAGS_DEBUG "${CXX_FLAGS_DEBUG} /bigobj") # TODO set /bigobj only for specific
lib
+else()
+  set(CXX_FLAGS_DEBUG "-ggdb -O0")
+  set(CXX_FLAGS_FASTDEBUG "-ggdb -O1")
+  set(CXX_FLAGS_RELEASE "-O3")
 endif()
-set(CXX_FLAGS_FASTDEBUG "-ggdb -O1")
-set(CXX_FLAGS_RELEASE "-O3")
 
 string (TOUPPER ${CMAKE_BUILD_TYPE} CMAKE_BUILD_TYPE)
 
@@ -385,7 +386,12 @@ endif ()
 
 message(STATUS "Build Type: ${CMAKE_BUILD_TYPE}")
 
-SET(CMAKE_CXX_FLAGS "${PARQUET_CXXFLAGS} ${CMAKE_CXX_FLAGS} -std=c++11 -Wall -fno-strict-aliasing")
+set(CMAKE_CXX_FLAGS "${PARQUET_CXXFLAGS} ${CMAKE_CXX_FLAGS}")
+if (MSVC)
+  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -W3")
+else()
+  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -fno-strict-aliasing -Wall")
+endif()
 
 if (PARQUET_USE_SSE)
   SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=native")

http://git-wip-us.apache.org/repos/asf/parquet-cpp/blob/305aacca/cmake_modules/CompilerInfo.cmake
----------------------------------------------------------------------
diff --git a/cmake_modules/CompilerInfo.cmake b/cmake_modules/CompilerInfo.cmake
index bf59ab1..8eba874 100644
--- a/cmake_modules/CompilerInfo.cmake
+++ b/cmake_modules/CompilerInfo.cmake
@@ -15,15 +15,27 @@
 # specific language governing permissions and limitations
 # under the License.
 #
-# Sets COMPILER_FAMILY to 'clang' or 'gcc'
+# Sets COMPILER_FAMILY to 'clang' or 'gcc' or 'msvc'
 # Sets COMPILER_VERSION to the version
-execute_process(COMMAND "${CMAKE_CXX_COMPILER}" -v
+if(NOT MSVC)
+  set(COMPILER_GET_VERSION_SWITCH "-v")
+endif()
+
+execute_process(COMMAND "${CMAKE_CXX_COMPILER}" ${COMPILER_GET_VERSION_SWITCH}
+                OUTPUT_VARIABLE COMPILER_VERSION_FULL
                 ERROR_VARIABLE COMPILER_VERSION_FULL)
-message(INFO " ${COMPILER_VERSION_FULL}")
+message(STATUS "Compiler id: ${CMAKE_CXX_COMPILER_ID}")
 string(TOLOWER "${COMPILER_VERSION_FULL}" COMPILER_VERSION_FULL_LOWER)
 
 if(MSVC)
   set(COMPILER_FAMILY "msvc")
+  if ("${COMPILER_VERSION_FULL}" MATCHES ".*Microsoft \\(R\\) C/C\\+\\+ Optimizing Compiler
Version 19.*x64")
+    string(REGEX REPLACE ".*Optimizing Compiler Version ([0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+).*"
"\\1"
+      COMPILER_VERSION "${COMPILER_VERSION_FULL}")
+  elseif(NOT "${COMPILER_VERSION_FULL}" STREQUAL "")
+    message(FATAL_ERROR "Not supported MSVC compiler:\n${COMPILER_VERSION_FULL}\n"
+      "Supported MSVC versions: Visual Studio 2015 2017 x64")
+  endif()
 
 # clang on Linux and Mac OS X before 10.9
 elseif("${COMPILER_VERSION_FULL}" MATCHES ".*clang version.*")

http://git-wip-us.apache.org/repos/asf/parquet-cpp/blob/305aacca/cmake_modules/ThirdpartyToolchain.cmake
----------------------------------------------------------------------
diff --git a/cmake_modules/ThirdpartyToolchain.cmake b/cmake_modules/ThirdpartyToolchain.cmake
index 74b4632..c8faf8d 100644
--- a/cmake_modules/ThirdpartyToolchain.cmake
+++ b/cmake_modules/ThirdpartyToolchain.cmake
@@ -22,9 +22,15 @@ set(THRIFT_VERSION "0.10.0")
 set(BROTLI_VERSION "v0.6.0")
 
 string(TOUPPER ${CMAKE_BUILD_TYPE} UPPERCASE_BUILD_TYPE)
-# Set -fPIC on all external projects and include the main CXX_FLAGS
-set(EP_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_${UPPERCASE_BUILD_TYPE}} -fPIC")
-set(EP_C_FLAGS "${CMAKE_C_FLAGS} ${CMAKE_C_FLAGS_${UPPERCASE_BUILD_TYPE}} -fPIC")
+
+set(EP_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_${UPPERCASE_BUILD_TYPE}}")
+set(EP_C_FLAGS "${CMAKE_C_FLAGS} ${CMAKE_C_FLAGS_${UPPERCASE_BUILD_TYPE}}")
+
+if (NOT MSVC)
+  # Set -fPIC on all external projects
+  set(EP_CXX_FLAGS "${EP_CXX_FLAGS} -fPIC")
+  set(EP_C_FLAGS "${EP_C_FLAGS} -fPIC")
+endif()
 
 # ----------------------------------------------------------------------
 # Configure toolchain with environment variables, if the exist


Mime
View raw message