diff options
author | Bardur Arantsson <bardur@scientician.net> | 2015-06-08 07:19:47 +0200 |
---|---|---|
committer | Bardur Arantsson <bardur@scientician.net> | 2015-06-08 07:19:47 +0200 |
commit | ed6d65fa84a5e40ef89fea96e3c795b35a95e44e (patch) | |
tree | 8c3bd148efe61466ea032b3d4d997403d1f2311b | |
parent | 70dc0c1046a468411147bee40763f0f5a499c847 (diff) |
Use compile-to-library trick to reduce compilation time
Before we would be compiling most of the game engine
code twice because of the test harness.
In my totally non-rigorous benchmark this reduced the compilation time
rather drastically from ~162s to ~96s. (Using a single CPU for
compilation.)
-rw-r--r-- | src/CMakeLists.txt | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 9221e109..dcd1e518 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -124,6 +124,10 @@ SET(SRCS_TESTS ../tests/lua_get_level.cc ) +ADD_LIBRARY(game + ${SRCS_COMMON} +) + # Need a few additional source files for Windows. if(WIN32) SET(SRCS ${SRCS} main-win.c) @@ -142,12 +146,12 @@ if(WIN32) endif(WIN32) # tome executable -ADD_EXECUTABLE(tome ${EXECUTABLE_OPTIONS} ${SRCS_COMMON} ${SRCS_PROGRAM}) -TARGET_LINK_LIBRARIES(tome squelch ${LIBS}) +ADD_EXECUTABLE(tome ${EXECUTABLE_OPTIONS} ${SRCS_PROGRAM}) +TARGET_LINK_LIBRARIES(tome game squelch ${LIBS}) # test harness executable -ADD_EXECUTABLE(harness ${EXECUTABLE_OPTIONS} ${SRCS_COMMON} ${SRCS_TESTS}) -TARGET_LINK_LIBRARIES(harness squelch ${LIBS}) +ADD_EXECUTABLE(harness ${EXECUTABLE_OPTIONS} ${SRCS_TESTS}) +TARGET_LINK_LIBRARIES(harness game squelch ${LIBS}) # Installation INSTALL(TARGETS tome |