shithub: puzzles

Download patch

ref: d0f97926e80482d9cbb3679165a09ca6e695f83f
parent: 63346a8ceac9ac1061e59af2a99ab1a44c851392
author: Simon Tatham <anakin@pobox.com>
date: Fri May 5 08:51:25 EDT 2023

Isolate icons build from the running user's preferences.

Preferences that adjust the display, such as Pearl graphics style or
Light Up lit-blobs toggling, shouldn't affect the official icons, even
if a ~/.config/sgt-puzzles exists in the account that builds the
puzzles.

--- a/icons/icons.cmake
+++ b/icons/icons.cmake
@@ -97,6 +97,10 @@
 set(icon_srcdir ${CMAKE_SOURCE_DIR}/icons)
 set(icon_bindir ${CMAKE_BINARY_DIR}/icons)
 
+# We'll need to point $SGT_PUZZLES_DIR at an empty directory, to avoid
+# the icons reflecting the building user's display preferences.
+set(empty_config_dir ${CMAKE_BINARY_DIR}/icons/config)
+
 function(build_icon name)
   set(output_icon_files)
 
@@ -118,7 +122,10 @@
     set(redo_arg)
   endif()
   add_custom_command(OUTPUT ${icon_bindir}/${name}-base.png
-    COMMAND ${CMAKE_COMMAND} -E env ASAN_OPTIONS=detect_leaks=0
+    COMMAND ${CMAKE_COMMAND} -E make_directory ${empty_config_dir}
+    COMMAND ${CMAKE_COMMAND} -E env
+      ASAN_OPTIONS=detect_leaks=0
+      SGT_PUZZLES_DIR=${empty_config_dir}
       ${icon_bindir}/${name}-icon-maker
       ${redo_arg}
       --screenshot ${icon_bindir}/${name}-base.png