Commit ed6d65fa authored by Bardur Arantsson's avatar Bardur Arantsson

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.)
parent 70dc0c10
......@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment