aboutsummaryrefslogtreecommitdiff
path: root/cmake/setup.cmake
diff options
context:
space:
mode:
authorSimon Tatham <anakin@pobox.com>2021-05-23 10:01:06 +0100
committerSimon Tatham <anakin@pobox.com>2021-05-25 10:45:40 +0100
commitd5b53853aad6c3bbfe255c063c045e7986de33ad (patch)
tree3bbc687c667fb1b3ceb196d3312e1690c603b92d /cmake/setup.cmake
parentb54702168b5c0759604302f198d85bc28af40feb (diff)
downloadpuzzles-d5b53853aad6c3bbfe255c063c045e7986de33ad.zip
puzzles-d5b53853aad6c3bbfe255c063c045e7986de33ad.tar.gz
puzzles-d5b53853aad6c3bbfe255c063c045e7986de33ad.tar.bz2
puzzles-d5b53853aad6c3bbfe255c063c045e7986de33ad.tar.xz
Permit building GUI helper tools.
These look like puzzles, in that they link against a frontend and provide the usual 'struct game', but they don't count as a puzzle for purposes of shipping, or even having to have descriptions and icons. There's one of these buried in the code already under an ifdef, which I'll re-enable in the next commit.
Diffstat (limited to 'cmake/setup.cmake')
-rw-r--r--cmake/setup.cmake20
1 files changed, 20 insertions, 0 deletions
diff --git a/cmake/setup.cmake b/cmake/setup.cmake
index 0ccf345..26eb74d 100644
--- a/cmake/setup.cmake
+++ b/cmake/setup.cmake
@@ -4,6 +4,7 @@ to build as if official (separated by ';')")
set(build_individual_puzzles TRUE)
set(build_cli_programs TRUE)
+set(build_gui_programs TRUE)
set(build_icons FALSE)
set(need_c_icons FALSE)
@@ -90,6 +91,7 @@ function(puzzle NAME)
set_property(TARGET ${EXENAME} PROPERTY objective ${OPT_OBJECTIVE})
set_property(TARGET ${EXENAME} PROPERTY official ${official})
set_platform_puzzle_target_properties(${NAME} ${EXENAME})
+ set_platform_gui_target_properties(${EXENAME})
endif()
endfunction()
@@ -109,6 +111,24 @@ function(cliprogram NAME)
endif()
endfunction()
+# Similar to cliprogram, but builds a GUI helper tool, linked against
+# the normal puzzle frontend.
+function(guiprogram NAME)
+ cmake_parse_arguments(OPT
+ "" "COMPILE_DEFINITIONS" "" ${ARGN})
+
+ if(build_gui_programs)
+ get_platform_puzzle_extra_source_files(extra_files nullgame)
+ add_executable(${NAME} ${OPT_UNPARSED_ARGUMENTS} ${extra_files})
+ target_link_libraries(${NAME}
+ common ${platform_gui_libs} ${platform_libs})
+ if(OPT_COMPILE_DEFINITIONS)
+ target_compile_definitions(${NAME} PRIVATE ${OPT_COMPILE_DEFINITIONS})
+ endif()
+ set_platform_gui_target_properties(${NAME})
+ endif()
+endfunction()
+
# A small wrapper around cliprogram, taking advantage of the common
# formula that puzzle 'foo' often comes with 'foosolver'.
function(solver NAME)