shithub: candycrisis

Download patch

ref: e7c1ece8a7b2c7b7a37c3654861cef1da9876e6f
parent: ae730c8d493b92bcc630806267532f063bad35f4
author: Iliyas Jorio <iliyas@jor.io>
date: Fri Jun 23 18:01:15 EDT 2023

CMakeLists.txt: Unix install target (#1)

--- /dev/null
+++ b/.editorconfig
@@ -1,0 +1,6 @@
+root = true
+
+[*.{c,cpp,h,hpp,txt}]
+charset = utf-8
+indent_style = tab
+indent_size = 4
--- a/.github/workflows/release-appimage-aarch64.yml
+++ b/.github/workflows/release-appimage-aarch64.yml
@@ -5,7 +5,7 @@
 env:
   SDL2_VERSION: "2.26.3"
   APPIMAGETOOL_VERSION: "13"
-  GAME_SHORTNAME: "CandyCrisis"
+  GAME_SHORTNAME: "candycrisis"
   GAME_LONGNAME: "Candy Crisis"
 
 jobs:
--- a/.github/workflows/release-appimage-x86_64.yml
+++ b/.github/workflows/release-appimage-x86_64.yml
@@ -5,7 +5,7 @@
 env:
   SDL2_VERSION: "2.26.3"
   APPIMAGETOOL_VERSION: "13"
-  GAME_SHORTNAME: "CandyCrisis"
+  GAME_SHORTNAME: "candycrisis"
   GAME_LONGNAME: "Candy Crisis"
 
 jobs:
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -6,9 +6,14 @@
 	cmake_minimum_required(VERSION 3.16)
 endif()
 
-set(GAME_TARGET "CandyCrisis")
+if(APPLE OR WIN32)
+	set(GAME_TARGET "CandyCrisis")
+else()
+	set(GAME_TARGET "candycrisis")
+endif()
 set(GAME_FRIENDLY_NAME "Candy Crisis")
 set(GAME_BUNDLE_ID "io.jor.candycrisis")
+set(GAME_DATA_DIR "CandyCrisisResources")
 set(GAME_MAC_COPYRIGHT "https://github.com/jorio/CandyCrisis")
 
 # Apply macOS deployment target and architectures to all subprojects
@@ -15,7 +20,6 @@
 set(CMAKE_OSX_DEPLOYMENT_TARGET "10.11" CACHE STRING "Minimum macOS deployment version")
 set(CMAKE_OSX_ARCHITECTURES "arm64;x86_64" CACHE STRING "Target macOS architectures")
 
-set(CMAKE_CXX_STANDARD 20)
 if (${CMAKE_VERSION} VERSION_LESS "3.21")
 	set(CMAKE_C_STANDARD	11)
 else()
@@ -23,7 +27,7 @@
 endif()
 
 project(${GAME_TARGET} LANGUAGES C
-	VERSION 3.0.0)
+	VERSION 3.0.1)
 
 # Create an option to switch between a system sdl library and a vendored sdl library
 option(BUILD_SDL_FROM_SOURCE "Build SDL from source" OFF)
@@ -97,7 +101,7 @@
 # EXECUTABLE TARGET
 #------------------------------------------------------------------------------
 
-file(GLOB_RECURSE GAME_SOURCES CONFIGURE_DEPENDS ${GAME_SOURCE_DIR}/*.cpp ${GAME_SOURCE_DIR}/*.c ${GAME_SOURCE_DIR}/*.h)
+file(GLOB_RECURSE GAME_SOURCES CONFIGURE_DEPENDS ${GAME_SOURCE_DIR}/*.c ${GAME_SOURCE_DIR}/*.h)
 
 if(WIN32)
 	list(APPEND GAME_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/packaging/app.exe.rc)
@@ -206,6 +210,7 @@
 	target_compile_options(${GAME_TARGET} PRIVATE
 		/W4
 		/wd5105 # see https://developercommunity.visualstudio.com/t/1249671
+		/we4013	# treat warning as error: undefined function (assuming extern returning int)
 		/MP		# multiprocessor build
 		/Zi		# output info to PDB
 	)
@@ -246,11 +251,11 @@
 if(APPLE)
 	set(GAME_DATA_TARGET_LOCATION "$<TARGET_FILE_DIR:${GAME_TARGET}>/../Resources")
 else()
-	set(GAME_DATA_TARGET_LOCATION "$<TARGET_FILE_DIR:${GAME_TARGET}>/CandyCrisisResources")
+	set(GAME_DATA_TARGET_LOCATION "$<TARGET_FILE_DIR:${GAME_TARGET}>/${GAME_DATA_DIR}")
 endif()
 
 add_custom_command(TARGET ${GAME_TARGET} POST_BUILD
-	COMMAND ${CMAKE_COMMAND} -E copy_directory "${CMAKE_SOURCE_DIR}/CandyCrisisResources" "${GAME_DATA_TARGET_LOCATION}")
+	COMMAND ${CMAKE_COMMAND} -E copy_directory "${CMAKE_SOURCE_DIR}/${GAME_DATA_DIR}" "${GAME_DATA_TARGET_LOCATION}")
 
 # Copy SDL2 DLL for convenience (WARNING: TARGET_RUNTIME_DLLS requires CMake 3.21, so this copy command was separated from the command above.)
 if(WIN32)
@@ -265,4 +270,11 @@
 # Install Windows-specific libraries (cmake --install): copy Visual Studio redistributable DLLs to install location
 if(WIN32)
 	include(InstallRequiredSystemLibraries)
+elseif(APPLE)
+	# no-op
+else()
+	install(TARGETS ${GAME_TARGET} DESTINATION bin)
+	install(FILES ${CMAKE_SOURCE_DIR}/packaging/${GAME_TARGET}.desktop DESTINATION share/applications/)
+	install(FILES ${CMAKE_SOURCE_DIR}/packaging/${GAME_TARGET}.png DESTINATION share/icons/hicolor/128x128/apps/)
+	install(DIRECTORY ${CMAKE_SOURCE_DIR}/${GAME_DATA_DIR}/ DESTINATION share/${GAME_TARGET}/)
 endif()
binary files a/packaging/candycrisis-desktopicon.png /dev/null differ
--- a/packaging/candycrisis.desktop
+++ b/packaging/candycrisis.desktop
@@ -2,8 +2,9 @@
 Type=Application
 Version=1.0
 Name=Candy Crisis
-Comment=Candy Crisis
-Icon=candycrisis-desktopicon
-Exec=CandyCrisis
+Comment=An exciting combination of pure action and puzzle gaming!
+Comment[fr]=Une combinaison palpitante d’action et de réflexion !
+Icon=candycrisis
+Exec=candycrisis
 Terminal=false
 Categories=Game;
binary files /dev/null b/packaging/candycrisis.png differ
--- a/packaging/prepare_appimage_appdir.sh
+++ b/packaging/prepare_appimage_appdir.sh
@@ -11,14 +11,15 @@
 APP_DIR="build/${APP_NAME}.AppDir"
 
 mkdir -p "${APP_DIR}/usr/bin"
+mkdir -p "${APP_DIR}/usr/share"
 
 # Copy executable and assets
 cp "${EXE_PATH}" "${APP_DIR}/usr/bin"
-cp -r CandyCrisisResources "${APP_DIR}/CandyCrisisResources"
+cp -r CandyCrisisResources "${APP_DIR}/usr/share/candycrisis"
 
 # Copy XDG stuff
 cp "packaging/${APP_NAME_LOWERCASE}.desktop" "${APP_DIR}"
-cp "packaging/${APP_NAME_LOWERCASE}-desktopicon.png" "${APP_DIR}"
+cp "packaging/${APP_NAME_LOWERCASE}.png" "${APP_DIR}"
 
 # Copy AppImage kicker script
 cp "packaging/AppRun" "${APP_DIR}"
binary files a/src/main.c b/src/main.c differ
--- a/src/version.h
+++ b/src/version.h
@@ -1,7 +1,7 @@
 #pragma once
 
-#define PROJECT_VERSION "3.0.0"
+#define PROJECT_VERSION "3.0.1"
 #define PROJECT_VERSION_MAJOR 3
 #define PROJECT_VERSION_MINOR 0
-#define PROJECT_VERSION_PATCH 0
+#define PROJECT_VERSION_PATCH 1