From ed6d65fa84a5e40ef89fea96e3c795b35a95e44e Mon Sep 17 00:00:00 2001 From: Bardur Arantsson Date: Mon, 8 Jun 2015 07:19:47 +0200 Subject: 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.) --- src/CMakeLists.txt | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'src/CMakeLists.txt') 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 -- cgit v1.2.3