diff --git a/AI/BattleAI/CMakeLists.txt b/AI/BattleAI/CMakeLists.txt index 978587320..589bf5694 100644 --- a/AI/BattleAI/CMakeLists.txt +++ b/AI/BattleAI/CMakeLists.txt @@ -11,6 +11,10 @@ set(battleAI_SRCS add_library(BattleAI SHARED ${battleAI_SRCS}) target_link_libraries(BattleAI vcmi) +if(COMMAND cotire) + cotire(BattleAI) +endif() + if (NOT APPLE) # Already inside vcmiclient bundle install(TARGETS BattleAI DESTINATION ${AI_LIB_DIR}) endif() diff --git a/AI/StupidAI/CMakeLists.txt b/AI/StupidAI/CMakeLists.txt index 9320fceb9..b7d74d663 100644 --- a/AI/StupidAI/CMakeLists.txt +++ b/AI/StupidAI/CMakeLists.txt @@ -11,6 +11,10 @@ set(stupidAI_SRCS add_library(StupidAI SHARED ${stupidAI_SRCS}) target_link_libraries(StupidAI vcmi) +if(COMMAND cotire) + cotire(StupidAI) +endif() + if (NOT APPLE) # Already inside vcmiclient bundle install(TARGETS StupidAI DESTINATION ${AI_LIB_DIR}) endif() diff --git a/AI/VCAI/CMakeLists.txt b/AI/VCAI/CMakeLists.txt index 4a99a285c..89f8fa3d3 100644 --- a/AI/VCAI/CMakeLists.txt +++ b/AI/VCAI/CMakeLists.txt @@ -18,6 +18,10 @@ set(VCAI_HEADERS add_library(VCAI SHARED ${VCAI_SRCS} ${VCAI_HEADERS}) target_link_libraries(VCAI FuzzyLite_lib vcmi) +if(COMMAND cotire) + cotire(VCAI) +endif() + if (NOT APPLE) # Already inside vcmiclient bundle install(TARGETS VCAI DESTINATION ${AI_LIB_DIR}) endif() diff --git a/CMakeLists.txt b/CMakeLists.txt index 629e87a70..4a592cd26 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -21,6 +21,7 @@ option(ENABLE_ERM "Enable compilation of ERM scripting module" OFF) option(ENABLE_EDITOR "Enable compilation of map editor" OFF) option(ENABLE_LAUNCHER "Enable compilation of launcher" ON) option(ENABLE_TEST "Enable compilation of unit tests" OFF) +option(ENABLE_PCH "Enable precompiled headers" OFF) ############################################ # Building section # @@ -59,6 +60,10 @@ find_package(SDL_mixer REQUIRED) find_package(SDL_ttf REQUIRED) find_package(ZLIB REQUIRED) +if(ENABLE_PCH) + include(cotire) +endif() + if (ENABLE_EDITOR OR ENABLE_LAUNCHER) # Widgets finds its own dependencies (QtGui and QtCore). find_package(Qt5Widgets REQUIRED) diff --git a/Global.h b/Global.h index a8e6d8ac2..07dceab7e 100644 --- a/Global.h +++ b/Global.h @@ -90,7 +90,7 @@ static_assert(sizeof(bool) == 1, "Bool needs to be 1 byte in size."); #include #define BOOST_FILESYSTEM_VERSION 3 -#if ( BOOST_VERSION>105000 ) +#if ( BOOST_VERSION>105000 && !defined(BOOST_THREAD_VERSION)) #define BOOST_THREAD_VERSION 3 #endif #define BOOST_THREAD_DONT_PROVIDE_THREAD_DESTRUCTOR_CALLS_TERMINATE_IF_JOINABLE 1 diff --git a/client/CMakeLists.txt b/client/CMakeLists.txt index 206938fb7..53581633d 100644 --- a/client/CMakeLists.txt +++ b/client/CMakeLists.txt @@ -108,5 +108,11 @@ endif() target_link_libraries(vcmiclient vcmi ${Boost_LIBRARIES} ${SDL_LIBRARY} ${SDLIMAGE_LIBRARY} ${SDLMIXER_LIBRARY} ${SDLTTF_LIBRARY} ${ZLIB_LIBRARIES} ${FFMPEG_LIBRARIES} ${RT_LIB} ${DL_LIB}) +set_property(DIRECTORY PROPERTY COTIRE_PREFIX_HEADER_IGNORE_PATH "${FFMPEG_INCLUDE_DIRS}" "${CMAKE_SOURCE_DIR}" "${CMAKE_BINARY_DIR}") + +if(COMMAND cotire) + cotire(vcmiclient) +endif() + install(TARGETS vcmiclient DESTINATION ${BIN_DIR}) diff --git a/editor/CMakeLists.txt b/editor/CMakeLists.txt index 38e3236be..5ce1e0cf1 100644 --- a/editor/CMakeLists.txt +++ b/editor/CMakeLists.txt @@ -38,6 +38,7 @@ add_executable(vcmieditor ${maped_SRCS} ${maped_FORMS_OUT}) # The Qt5Widgets_LIBRARIES variable also includes QtGui and QtCore target_link_libraries(vcmieditor vcmi ${Qt5Widgets_LIBRARIES}) +cotire(vcmieditor) if (NOT APPLE) # Already inside bundle install(TARGETS vcmieditor DESTINATION ${BIN_DIR}) diff --git a/launcher/CMakeLists.txt b/launcher/CMakeLists.txt index 1325bbcf5..6464f9f58 100644 --- a/launcher/CMakeLists.txt +++ b/launcher/CMakeLists.txt @@ -53,6 +53,10 @@ add_executable(vcmilauncher ${launcher_SRCS} ${launcher_UI_HEADERS}) # The Qt5Widgets_LIBRARIES variable also includes QtGui and QtCore target_link_libraries(vcmilauncher vcmi ${Qt5Widgets_LIBRARIES} ${Qt5Network_LIBRARIES}) +if(COMMAND cotire) + cotire(vcmilauncher) +endif() + if (NOT APPLE) # Already inside bundle install(TARGETS vcmilauncher DESTINATION ${BIN_DIR}) # copy whole directory but .svn control files diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt index d7843719f..c9e313184 100644 --- a/lib/CMakeLists.txt +++ b/lib/CMakeLists.txt @@ -106,6 +106,10 @@ add_library(vcmi SHARED ${lib_SRCS} ${lib_HEADERS}) set_target_properties(vcmi PROPERTIES XCODE_ATTRIBUTE_LD_DYLIB_INSTALL_NAME "@executable_path/libvcmi.dylib") target_link_libraries(vcmi minizip ${Boost_LIBRARIES} ${SDL_LIBRARY} ${ZLIB_LIBRARIES} ${RT_LIB} ${DL_LIB}) +if(COMMAND cotire) + cotire(vcmi) +endif() + if (NOT APPLE) # Already inside vcmiclient bundle install(TARGETS vcmi DESTINATION ${LIB_DIR}) endif() diff --git a/scripting/erm/CMakeLists.txt b/scripting/erm/CMakeLists.txt index d661a5135..8c214b63b 100644 --- a/scripting/erm/CMakeLists.txt +++ b/scripting/erm/CMakeLists.txt @@ -11,5 +11,6 @@ set(lib_SRCS add_library(vcmiERM SHARED ${lib_SRCS}) target_link_libraries(vcmiERM ${Boost_LIBRARIES}) +cotire(vcmiERM) install(TARGETS vcmiERM DESTINATION ${SCRIPTING_LIB_DIR}) diff --git a/server/CMakeLists.txt b/server/CMakeLists.txt index 109b14981..5aa4e1707 100644 --- a/server/CMakeLists.txt +++ b/server/CMakeLists.txt @@ -19,6 +19,10 @@ endif() target_link_libraries(vcmiserver vcmi ${Boost_LIBRARIES} ${RT_LIB} ${DL_LIB}) +if(COMMAND cotire) + cotire(vcmiserver) +endif() + if (NOT APPLE) # Already inside vcmiclient bundle install(TARGETS vcmiserver DESTINATION ${BIN_DIR}) endif() diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index a88ccad4e..e81a26f0f 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -14,6 +14,12 @@ add_executable(vcmitest ${test_SRCS}) target_link_libraries(vcmitest vcmi ${Boost_LIBRARIES} ${RT_LIB} ${DL_LIB}) add_test(vcmitest vcmitest) +set_property(DIRECTORY PROPERTY COTIRE_PREFIX_HEADER_IGNORE_PATH "${Boost_INCLUDE_DIRS}/boost/test" "${CMAKE_SOURCE_DIR}" "${CMAKE_BINARY_DIR}") + +if(COMMAND cotire) + cotire(vcmitest) +endif() + # Files to copy to the build directory add_custom_target(vcmitestFiles ALL) set(vcmitest_FILES