Repository: mesos Updated Branches: refs/heads/master fe14bace5 -> 5b12abb01
CMake: Added precompiled headers for the libmesos target. This sets several cotire variables in the 'src' directory to enable precompiled headers for the libmesos target. The excluded headers were removed due to namespace issues or breaking incremental builds. As of this commit, precompiled headers are only enabled on Windows. There are unresolved compilation issues on non-Windows builds with precompiled headers. Review: https://reviews.apache.org/r/58014/ Project: http://git-wip-us.apache.org/repos/asf/mesos/repo Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/c32977b9 Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/c32977b9 Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/c32977b9 Branch: refs/heads/master Commit: c32977b9c118386ef07009ba2c7bdef02e7e4474 Parents: b14375c Author: Jeff Coffler <[email protected]> Authored: Wed Mar 29 11:29:55 2017 -0700 Committer: Joseph Wu <[email protected]> Committed: Wed Mar 29 13:38:21 2017 -0700 ---------------------------------------------------------------------- cmake/CompilationConfigure.cmake | 20 ++++++++++++++++++++ src/CMakeLists.txt | 20 ++++++++++++++++++++ 2 files changed, 40 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/mesos/blob/c32977b9/cmake/CompilationConfigure.cmake ---------------------------------------------------------------------- diff --git a/cmake/CompilationConfigure.cmake b/cmake/CompilationConfigure.cmake index 39aea28..1c54669 100644 --- a/cmake/CompilationConfigure.cmake +++ b/cmake/CompilationConfigure.cmake @@ -26,6 +26,26 @@ endif (ENABLE_DEBUG) option(BUILD_SHARED_LIBS "Build shared libraries." OFF) +option(ENABLE_PRECOMPILED_HEADERS + "Enable auto-generated precompiled headers using cotire" ${WIN32}) + +if (NOT WIN32 AND ENABLE_PRECOMPILED_HEADERS) + message( + FATAL_ERROR + "Precompiled headers are only supported on Windows. See MESOS-7322.") +endif (NOT WIN32 AND ENABLE_PRECOMPILED_HEADERS) + +if (ENABLE_PRECOMPILED_HEADERS) + # By default Cotire generates both precompiled headers and a "unity" build. + # A unity build is where all the source files in a target are combined into + # a single source file to reduce the number of files that need to be opened + # and read. We disable "unity" builds for now. + set(COTIRE_ADD_UNITY_BUILD FALSE) + + set(COTIRE_VERBOSE ${VERBOSE}) +endif (ENABLE_PRECOMPILED_HEADERS) + +# Enable optimization? option(ENABLE_OPTIMIZE "Enable optimization" TRUE) if (ENABLE_OPTIMIZE) if (WIN32) http://git-wip-us.apache.org/repos/asf/mesos/blob/c32977b9/src/CMakeLists.txt ---------------------------------------------------------------------- diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index b67b512..08f0ef1 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -537,6 +537,26 @@ set_target_properties( SOVERSION ${MESOS_PACKAGE_SOVERSION} ) +if (ENABLE_PRECOMPILED_HEADERS) + # These exluded headers either cause namespace resolution issues or + # are problematic for incremental builds. + set_property(DIRECTORY + PROPERTY COTIRE_PREFIX_HEADER_IGNORE_PATH + "${CMAKE_SOURCE_DIR}/include/mesos/authentication/http/basic_authenticator_factory.hpp" + "${CMAKE_SOURCE_DIR}/include/mesos/authentication/http/combined_authenticator.hpp" + "${CMAKE_SOURCE_DIR}/src/sched/constants.hpp" + "${CMAKE_SOURCE_DIR}/src/sched/flags.hpp" + "${CMAKE_BINARY_DIR}/src/common/build_config.hpp") + + # For now, we include agent headers, because the Windows build currently + # does not build all of the Mesos master (only enough for testing the agent). + set_property(DIRECTORY + PROPERTY COTIRE_PREFIX_HEADER_INCLUDE_PATH + "${AGENT_INCLUDE_DIRS};${AGENT_3RDPARTY_INCLUDE_DIRS}") + + cotire(${MESOS_LIBS_TARGET}) +endif (ENABLE_PRECOMPILED_HEADERS) + # ADD LIBRARY DEPENDENCIES (tells CMake what to compile/build first). #################################################################### add_dependencies(${MESOS_TARGET} ${MESOS_LIBS_TARGET})
