Skip to content

Commit

Permalink
Make the data extraction an optional step in cmake
Browse files Browse the repository at this point in the history
If you set the cmake var EXTRACT_DATA to off (default on), it no longer causes
the data extractor to be run as part of the default build. This means CD_PATH
would no longer need to point to a valid file, for example.

The extraction step can still be run with the 'extract-data' target - make sure
this is run before trying to run the game or any tests!
  • Loading branch information
JonnyH committed Aug 31, 2018
1 parent 7471c86 commit 4793a82
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
3 changes: 2 additions & 1 deletion CMakeLists.txt
Expand Up @@ -19,11 +19,12 @@ string(TOLOWER "${CMAKE_BUILD_TYPE}" lower_build_type)

option(LTO "Build using link-time-optimisations" OFF)
option(ENABLE_TESTS "Build some unit tests" ON)
option(EXTRACT_DATA "Run the data extractor as part of the default target" ON)

set(CD_PATH ${CMAKE_SOURCE_DIR}/data/cd.iso CACHE STRING "Path to cd.iso (used
by test and extractor")

if (NOT EXISTS ${CD_PATH})
if (${EXTRACT_DATA} AND NOT EXISTS ${CD_PATH})
message(FATAL_ERROR "CD_PATH \"${CD_PATH}\" points at non-existant file")
endif()

Expand Down
4 changes: 4 additions & 0 deletions tools/extractors/CMakeLists.txt
Expand Up @@ -899,4 +899,8 @@ add_extractor(EXTRACTOR_TARGET_LIST "battle_map_sectors"
"data/maps/57ufo7_01"
"data/maps/58ufo8_01")

if ($EXTRACT_DATA)
add_custom_target(extract-data ALL DEPENDS ${EXTRACTOR_TARGET_LIST})
else()
add_custom_target(extract-data DEPENDS ${EXTRACTOR_TARGET_LIST})
endif()

0 comments on commit 4793a82

Please sign in to comment.