summary refs log tree commit diff
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2022-01-22 00:04:20 -0500
committerJune McEnroe <june@causal.agency>2022-01-22 00:04:20 -0500
commit63c6b7519d2b062ec3df0da99ca27b0ff846df84 (patch)
treee1e6299af5bb7fcbd329e22b33f3e335d44e673e
parentOnly use cells for moveColumn (diff)
downloadwep-63c6b7519d2b062ec3df0da99ca27b0ff846df84.tar.gz
wep-63c6b7519d2b062ec3df0da99ca27b0ff846df84.zip
Build macOS .app bundles
-rw-r--r--CMakeLists.txt28
-rw-r--r--MacOSXBundleInfo.plist.in36
2 files changed, 60 insertions, 4 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index ce4e2f0..d56d244 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.10)
+cmake_minimum_required(VERSION 3.13)
 
 project(WEP C)
 
@@ -11,8 +11,28 @@ if(NOT MSVC)
 	add_compile_options(-Wall -Wextra -pedantic)
 endif()
 
-add_executable(sol sol.c)
-add_executable(freecell freecell.c)
+add_executable(sol MACOSX_BUNDLE sol.c)
+add_executable(freecell MACOSX_BUNDLE freecell.c)
+
+set_target_properties(
+	sol freecell PROPERTIES
+	MACOSX_BUNDLE_INFO_PLIST
+	${CMAKE_CURRENT_SOURCE_DIR}/MacOSXBundleInfo.plist.in
+)
+if(CMAKE_MACOSX_BUNDLE OR CMAKE_SYSTEM_NAME STREQUAL Darwin)
+	set_target_properties(sol PROPERTIES OUTPUT_NAME Solitaire)
+	set_target_properties(freecell PROPERTIES OUTPUT_NAME FreeCell)
+endif()
+
+if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/CARDS.DLL)
+	target_sources(sol PRIVATE CARDS.DLL)
+	target_sources(freecell PRIVATE CARDS.DLL)
+	set_target_properties(sol freecell PROPERTIES RESOURCE CARDS.DLL)
+endif()
+if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/FREECELL.EXE)
+	target_sources(freecell PRIVATE FREECELL.EXE)
+	set_target_properties(freecell PROPERTIES RESOURCE "CARDS.DLL;FREECELL.EXE")
+endif()
 
 # Workaround possible bugs in SDL2Config.cmake
 if(MINGW)
@@ -31,4 +51,4 @@ if(WIN32)
 	set_target_properties(freecell PROPERTIES OUTPUT_NAME wepfreecell)
 endif()
 
-install(TARGETS sol freecell)
+install(TARGETS sol freecell BUNDLE DESTINATION /Applications)
diff --git a/MacOSXBundleInfo.plist.in b/MacOSXBundleInfo.plist.in
new file mode 100644
index 0000000..b144709
--- /dev/null
+++ b/MacOSXBundleInfo.plist.in
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+	<key>CFBundleDevelopmentRegion</key>
+	<string>English</string>
+	<key>CFBundleExecutable</key>
+	<string>${MACOSX_BUNDLE_EXECUTABLE_NAME}</string>
+	<key>CFBundleGetInfoString</key>
+	<string>${MACOSX_BUNDLE_INFO_STRING}</string>
+	<key>CFBundleIconFile</key>
+	<string>${MACOSX_BUNDLE_ICON_FILE}</string>
+	<key>CFBundleIdentifier</key>
+	<string>${MACOSX_BUNDLE_GUI_IDENTIFIER}</string>
+	<key>CFBundleInfoDictionaryVersion</key>
+	<string>6.0</string>
+	<key>CFBundleLongVersionString</key>
+	<string>${MACOSX_BUNDLE_LONG_VERSION_STRING}</string>
+	<key>CFBundleName</key>
+	<string>${MACOSX_BUNDLE_BUNDLE_NAME}</string>
+	<key>CFBundlePackageType</key>
+	<string>APPL</string>
+	<key>CFBundleShortVersionString</key>
+	<string>${MACOSX_BUNDLE_SHORT_VERSION_STRING}</string>
+	<key>CFBundleSignature</key>
+	<string>????</string>
+	<key>CFBundleVersion</key>
+	<string>${MACOSX_BUNDLE_BUNDLE_VERSION}</string>
+	<key>CSResourcesFileMapped</key>
+	<true/>
+	<key>NSHumanReadableCopyright</key>
+	<string>${MACOSX_BUNDLE_COPYRIGHT}</string>
+	<key>NSHighResolutionCapable</key>
+	<string>True</string>
+</dict>
+</plist>