Repository: parquet-cpp Updated Branches: refs/heads/master 13843d3d4 -> 4d735876d
PARQUET-447: Add release and fastdebug build types Note that release builds have many compiler warnings. We also should address the other supressed compiler warnings in a separate patch (see PARQUET-519). Author: Wes McKinney <[email protected]> Closes #45 from wesm/PARQUET-447 and squashes the following commits: 6ef295d [Wes McKinney] Explicit -O0 in DEBUG build type, remove redundant -O0 from coverage build flags 50b02a1 [Wes McKinney] Add release and fastdebug build types Project: http://git-wip-us.apache.org/repos/asf/parquet-cpp/repo Commit: http://git-wip-us.apache.org/repos/asf/parquet-cpp/commit/4d735876 Tree: http://git-wip-us.apache.org/repos/asf/parquet-cpp/tree/4d735876 Diff: http://git-wip-us.apache.org/repos/asf/parquet-cpp/diff/4d735876 Branch: refs/heads/master Commit: 4d735876d6abf89aef1348f2d420ef26ce0ea7b1 Parents: 13843d3 Author: Wes McKinney <[email protected]> Authored: Wed Feb 10 22:22:10 2016 -0800 Committer: Julien Le Dem <[email protected]> Committed: Wed Feb 10 22:22:10 2016 -0800 ---------------------------------------------------------------------- CMakeLists.txt | 39 ++++++++++++++++++++++++++++++++++++--- 1 file changed, 36 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/parquet-cpp/blob/4d735876/CMakeLists.txt ---------------------------------------------------------------------- diff --git a/CMakeLists.txt b/CMakeLists.txt index d9d9a3f..452b315 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -23,7 +23,6 @@ if (NOT "$ENV{PARQUET_GCC_ROOT}" STREQUAL "") set(CMAKE_C_COMPILER ${GCC_ROOT}/bin/gcc) set(GCOV_PATH ${GCC_ROOT}/bin/gcov) set(CMAKE_CXX_COMPILER ${GCC_ROOT}/bin/g++) - set(CMAKE_CXX_COMPILER ${GCC_ROOT}/bin/g++) endif() if ("$ENV{PARQUET_USE_CCACHE}") @@ -196,14 +195,48 @@ set(LIBRARY_OUTPUT_DIRECTORY "${BUILD_OUTPUT_ROOT_DIRECTORY}") # where to put generated binaries set(EXECUTABLE_OUTPUT_PATH "${BUILD_OUTPUT_ROOT_DIRECTORY}") +############################################################# +# Compiler flags and release types + +# compiler flags for different build types (run 'cmake -DCMAKE_BUILD_TYPE=<type> .') +# For all builds: +# For CMAKE_BUILD_TYPE=Debug +# -ggdb: Enable gdb debugging +# For CMAKE_BUILD_TYPE=FastDebug +# Same as DEBUG, except with -O1 +# For CMAKE_BUILD_TYPE=Release +# -O3: Enable all compiler optimizations +# -g: Enable symbols for profiler tools (TODO: remove for shipping) +set(CXX_FLAGS_DEBUG "-ggdb -O0") +set(CXX_FLAGS_FASTDEBUG "-ggdb -O1") +set(CXX_FLAGS_RELEASE "-O3 -g") + +string (TOUPPER ${CMAKE_BUILD_TYPE} CMAKE_BUILD_TYPE) + +if ("${CMAKE_BUILD_TYPE}" STREQUAL "DEBUG") + set(CMAKE_CXX_FLAGS ${CXX_FLAGS_DEBUG}) +elseif ("${CMAKE_BUILD_TYPE}" STREQUAL "FASTDEBUG") + set(CMAKE_CXX_FLAGS ${CXX_FLAGS_FASTDEBUG}) +elseif ("${CMAKE_BUILD_TYPE}" STREQUAL "RELEASE") + set(CMAKE_CXX_FLAGS ${CXX_FLAGS_RELEASE}) +else() + message(FATAL_ERROR "Unknown build type: ${CMAKE_BUILD_TYPE}") +endif () + +message(STATUS "Build Type: ${CMAKE_BUILD_TYPE}") + +# Build with C++11 and SSE3 by default +# TODO(wesm): These compiler warning suppressions should be removed one by one SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -msse3 -Wall -Wno-unused-value -Wno-unused-variable -Wno-sign-compare -Wno-unknown-pragmas") -SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -ggdb") + if (APPLE) # Use libc++ to avoid linker errors on some platforms set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++") endif() +############################################################ +# Includes include_directories( ${CMAKE_CURRENT_SOURCE_DIR}/src @@ -241,7 +274,7 @@ if ("${PARQUET_GENERATE_COVERAGE}") message(SEND_ERROR "Cannot currently generate coverage with clang") endif() message(STATUS "Configuring build for gcov") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O0 --coverage") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --coverage") # For coverage to work properly, we need to use static linkage. Otherwise, # __gcov_flush() doesn't properly flush coverage from every module. # See http://stackoverflow.com/questions/28164543/using-gcov-flush-within-a-library-doesnt-force-the-other-modules-to-yield-gc
