Skip to content

Commit

Permalink
Add support for precompiled headers
Browse files Browse the repository at this point in the history
  • Loading branch information
Jason Gauci committed Sep 13, 2019
1 parent 262600b commit de153f6
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 9 deletions.
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,6 @@
[submodule "external/sanitizers-cmake"]
path = external/sanitizers-cmake
url = git:https://github.com/arsenm/sanitizers-cmake.git
[submodule "external/cotire"]
path = external/cotire
url = https://github.com/sakra/cotire.git
30 changes: 21 additions & 9 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ project (EternalTCP VERSION 6.0.0)
SET(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/external/sanitizers-cmake/cmake" ${CMAKE_MODULE_PATH})
FIND_PACKAGE(Sanitizers)

SET(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/external/cotire/CMake" ${CMAKE_MODULE_PATH})
INCLUDE(cotire)
if(POLICY CMP0058)
cmake_policy(SET CMP0058 NEW) # Needed for cotire
endif()

option(CODE_COVERAGE "Enable code coverage" OFF)

SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DET_VERSION='\"${PROJECT_VERSION}\"'")
Expand Down Expand Up @@ -89,6 +95,12 @@ ELSE()
set(CORE_LIBRARIES util resolv)
ENDIF()

MACRO(DECORATE_TARGET TARGET_NAME)
add_sanitizers(${TARGET_NAME})
set_target_properties(${TARGET_NAME} PROPERTIES COTIRE_CXX_PREFIX_HEADER_INIT "src/base/Headers.hpp")
cotire(${TARGET_NAME})
ENDMACRO()

include_directories(
external/easyloggingpp/src
external/ThreadPool
Expand Down Expand Up @@ -166,7 +178,7 @@ add_dependencies(
et-lib
generated-code
)
add_sanitizers(et-lib)
DECORATE_TARGET(et-lib)

add_library(
TerminalCommon
Expand Down Expand Up @@ -205,7 +217,7 @@ add_dependencies(
TerminalCommon
generated-code
)
add_sanitizers(TerminalCommon)
DECORATE_TARGET(TerminalCommon)

add_executable (
etserver
Expand All @@ -223,7 +235,7 @@ target_link_libraries (
${UTEMPTER_LIBRARIES}
${CORE_LIBRARIES}
)
add_sanitizers(etserver)
DECORATE_TARGET(etserver)

add_executable (
etterminal
Expand All @@ -241,7 +253,7 @@ target_link_libraries (
${UTEMPTER_LIBRARIES}
${CORE_LIBRARIES}
)
add_sanitizers(etterminal)
DECORATE_TARGET(etterminal)

add_executable (
et
Expand All @@ -258,7 +270,7 @@ target_link_libraries (
${UTEMPTER_LIBRARIES}
${CORE_LIBRARIES}
)
add_sanitizers(et)
DECORATE_TARGET(et)

add_library (
HtmCommon
Expand All @@ -276,7 +288,7 @@ add_dependencies(
HtmCommon
generated-code
)
add_sanitizers(HtmCommon)
DECORATE_TARGET(HtmCommon)

add_executable (
htm
Expand All @@ -296,7 +308,7 @@ target_link_libraries (
${UTEMPTER_LIBRARIES}
${CORE_LIBRARIES}
)
add_sanitizers(htm)
DECORATE_TARGET(htm)

add_executable (
htmd
Expand All @@ -316,7 +328,7 @@ target_link_libraries (
${UTEMPTER_LIBRARIES}
${CORE_LIBRARIES}
)
add_sanitizers(htmd)
DECORATE_TARGET(htmd)

enable_testing()

Expand Down Expand Up @@ -348,7 +360,7 @@ add_test(
et-test
et-test
)
add_sanitizers(et-test)
DECORATE_TARGET(et-test)

install(TARGETS etserver etterminal et htm htmd
PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ GROUP_EXECUTE GROUP_READ WORLD_EXECUTE WORLD_READ
Expand Down
1 change: 1 addition & 0 deletions external/cotire
Submodule cotire added at 391bf6

0 comments on commit de153f6

Please sign in to comment.