aboutsummaryrefslogtreecommitdiff
path: root/cmake
diff options
context:
space:
mode:
authorSimon Tatham <anakin@pobox.com>2021-03-31 18:44:44 +0100
committerSimon Tatham <anakin@pobox.com>2021-03-31 18:44:44 +0100
commit76aa9619c07bc1a62fafa99e14dbd187ea9aa565 (patch)
tree00888a70055ea801ac6df3643110e1c53f5f5987 /cmake
parentb05a975feeef0abfa5dd38837217b8717e0e7539 (diff)
downloadpuzzles-76aa9619c07bc1a62fafa99e14dbd187ea9aa565.zip
puzzles-76aa9619c07bc1a62fafa99e14dbd187ea9aa565.tar.gz
puzzles-76aa9619c07bc1a62fafa99e14dbd187ea9aa565.tar.bz2
puzzles-76aa9619c07bc1a62fafa99e14dbd187ea9aa565.tar.xz
Provide pre-built icons in the source tarball.
This reinstates the feature of the previous build system, that the C icon files for the GTK puzzles were included in the source tarball, so that users building from that instead of from the raw git repo would not need to run the fiddly piece of build that regenerates them. Running that fiddly piece of build is much easier in the CMake world (because it's integrated with the main makefile), but it has a build dependency on ImageMagick which is easily avoided. The makefile will still build the icons if it _can_. But in the case where it can't, it will use pre-built icon source files if they're available, and only fall back to no-icon.c if it can't even do that. (So a user checking out from git and building without ImageMagick present will still be able to build _something_ playable.)
Diffstat (limited to 'cmake')
-rw-r--r--cmake/platforms/unix.cmake12
1 files changed, 12 insertions, 0 deletions
diff --git a/cmake/platforms/unix.cmake b/cmake/platforms/unix.cmake
index 1bed675..b858be8 100644
--- a/cmake/platforms/unix.cmake
+++ b/cmake/platforms/unix.cmake
@@ -51,9 +51,21 @@ endif()
function(get_platform_puzzle_extra_source_files OUTVAR NAME)
if(build_icons AND EXISTS ${CMAKE_SOURCE_DIR}/icons/${NAME}.sav)
+ # If we have the equipment to rebuild the puzzles' icon images
+ # from scratch, do so. Then changes in the puzzle display code
+ # will cause the icon to auto-update.
build_icon(${NAME})
set(c_icon_file ${CMAKE_BINARY_DIR}/icons/${NAME}-icon.c)
+ elseif(EXISTS ${CMAKE_SOURCE_DIR}/icons/${NAME}-icon.c)
+ # Failing that, use a pre-built icon file in the 'icons'
+ # subdirectory, if there is one. (They don't exist in git, but the
+ # distribution tarball will have pre-built them and put them in
+ # there, so that users building from that can still have icons
+ # even if they don't have the wherewithal to rebuild them.)
+ set(c_icon_file ${CMAKE_SOURCE_DIR}/icons/${NAME}-icon.c)
else()
+ # Failing even that, include no-icon.c to satisfy the link-time
+ # dependencies. The puzzles will build without nice icons.
set(c_icon_file ${CMAKE_SOURCE_DIR}/no-icon.c)
endif()