mirror of
https://github.com/vcmi/vcmi.git
synced 2024-12-24 22:14:36 +02:00
- added PCH compilation for CMake using cotire module (PCH is OFF per default, can be enabled with ENABLE_PCH=ON)
This commit is contained in:
parent
be3bd35b95
commit
df0a28d9cb
@ -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()
|
||||
|
@ -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()
|
||||
|
@ -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()
|
||||
|
@ -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)
|
||||
|
2
Global.h
2
Global.h
@ -90,7 +90,7 @@ static_assert(sizeof(bool) == 1, "Bool needs to be 1 byte in size.");
|
||||
#include <boost/version.hpp>
|
||||
|
||||
#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
|
||||
|
@ -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})
|
||||
|
||||
|
@ -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})
|
||||
|
@ -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
|
||||
|
@ -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()
|
||||
|
@ -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})
|
||||
|
@ -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()
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user