git repos / sago_multi_scrambler_puzzle2

commit dc6d8b23

Poul Sander · 2026-05-31 21:05
dc6d8b23bea69bf4ac41cfe015c8601412fa4e4a patch · browse files
parent 2d9bff86eda4975ad92ec1072b994971fd13b7ba

Added install option

Changed files

M CMakeLists.txt before
A extra/sago-multi-scrambler-puzzle2.desktop.in
M src/sago_common.cpp before
diff --git a/CMakeLists.txt b/CMakeLists.txt index 4039d33..3d2e889 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt
@@ -1,5 +1,6 @@
cmake_minimum_required(VERSION 3.10.2..3.31.6)
project (sago_multi_scrambler_puzzle2)
+include(GNUInstallDirs)
find_package(Boost COMPONENTS program_options REQUIRED NO_MODULE)
option(USE_EMBEDDED_PLATFORM_FOLDERS "Use the embedded version of PlatformFolders" ON)
@@ -37,4 +38,15 @@ add_executable(sago_multi_scrambler_puzzle2 ${SOURCES})
TARGET_LINK_LIBRARIES( sago_multi_scrambler_puzzle2 ${Boost_LIBRARIES} )
target_link_libraries( sago_multi_scrambler_puzzle2 ${SDL2_LIBRARIES})
target_link_libraries( sago_multi_scrambler_puzzle2 physfs platform_folders rhash)
-target_link_libraries( sago_multi_scrambler_puzzle2 ${SDL2MIXER_LIBRARIES} ${SDL2IMAGE_LIBRARIES} ${SDL2TTF_LIBRARIES} ${SDL2GFX_LIBRARIES})
\ No newline at end of file
+target_link_libraries( sago_multi_scrambler_puzzle2 ${SDL2MIXER_LIBRARIES} ${SDL2IMAGE_LIBRARIES} ${SDL2TTF_LIBRARIES} ${SDL2GFX_LIBRARIES})
+target_compile_definitions(sago_multi_scrambler_puzzle2 PRIVATE INSTALL_DATA_DIR="${CMAKE_INSTALL_FULL_DATADIR}/sago_multi_scrambler_puzzle2")
+
+configure_file(
+ extra/sago-multi-scrambler-puzzle2.desktop.in
+ ${CMAKE_CURRENT_BINARY_DIR}/sago-multi-scrambler-puzzle2.desktop
+)
+
+install(TARGETS sago_multi_scrambler_puzzle2 DESTINATION ${CMAKE_INSTALL_BINDIR})
+install(DIRECTORY data/ DESTINATION ${CMAKE_INSTALL_DATADIR}/sago_multi_scrambler_puzzle2)
+install(FILES ${CMAKE_CURRENT_BINARY_DIR}/sago-multi-scrambler-puzzle2.desktop DESTINATION ${CMAKE_INSTALL_DATADIR}/applications)
+install(FILES extra/sago-multi-scrambler-puzzle2.svg DESTINATION ${CMAKE_INSTALL_DATADIR}/icons/hicolor/scalable/apps)
\ No newline at end of file
diff --git a/extra/sago-multi-scrambler-puzzle2.desktop.in b/extra/sago-multi-scrambler-puzzle2.desktop.in new file mode 100644 index 0000000..099ca27 --- /dev/null +++ b/extra/sago-multi-scrambler-puzzle2.desktop.in
@@ -0,0 +1,10 @@
+[Desktop Entry]
+Version=1.0
+Type=Application
+Name=Sago Multi Scrambler Puzzle II
+Comment=Image scrambling puzzle game
+Exec=@CMAKE_INSTALL_FULL_BINDIR@/sago_multi_scrambler_puzzle2 %f
+Icon=sago-multi-scrambler-puzzle2
+Terminal=false
+Categories=Game;LogicGame;
+MimeType=image/jpeg;image/png;image/jpg;
diff --git a/src/sago_common.cpp b/src/sago_common.cpp index c7ef8bf..220c5fc 100644 --- a/src/sago_common.cpp +++ b/src/sago_common.cpp
@@ -37,6 +37,9 @@ void InitSagoFS(int argc, const char* argv[]) {
PHYSFS_init(argv[0]);
PHYSFS_mount((std::string(PHYSFS_getBaseDir())+"/data").c_str(), nullptr, 0);
PHYSFS_mount("./data", nullptr, 0);
+#ifdef INSTALL_DATA_DIR
+ PHYSFS_mount(INSTALL_DATA_DIR, nullptr, 1);
+#endif
PHYSFS_mount(getPathToSaveFiles().c_str(), nullptr, 0);
OsCreateSaveFolder();
PHYSFS_setWriteDir(getPathToSaveFiles().c_str());