Skip to content

Commit f53e2b9

Browse files
fix qtFred project and bundle setup for Mac
1 parent 9ee9b34 commit f53e2b9

3 files changed

Lines changed: 67 additions & 0 deletions

File tree

qtfred/CMakeLists.txt

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ qt5_wrap_ui(QTFRED_UI_GENERATED ${files_UI})
1919

2020
source_group("UI\\Generated" FILES ${QTFRED_UI_GENERATED})
2121

22+
SET(FRED_APP_ID "us.indiegames.scp.qtFRED")
23+
2224
add_executable(qtfred ${EXE_GUI_TYPE}
2325
${source_files}
2426
${QTFRED_UI_GENERATED}
@@ -41,6 +43,8 @@ target_compile_definitions(qtfred PRIVATE QT_DEPRECATED_WARNINGS)
4143

4244
target_compile_definitions(qtfred PUBLIC USING_THIRD_PARTY_LIBS FRED)
4345

46+
target_compile_definitions(qtfred PUBLIC FRED_APP_ID="${FRED_APP_ID}")
47+
4448
target_include_directories(qtfred PUBLIC
4549
${CMAKE_CURRENT_SOURCE_DIR}/src
4650
${CMAKE_CURRENT_BINARY_DIR}
@@ -137,6 +141,22 @@ elseif(FSO_BUILD_APPIMAGE)
137141

138142
install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/resources/fred_icon.png" DESTINATION "."
139143
COMPONENT "qtFRED")
144+
elseif(PLATFORM_MAC)
145+
# Handling of mac resources
146+
set(subpath resources/mac)
147+
148+
set_target_properties(qtfred PROPERTIES MACOSX_BUNDLE_INFO_PLIST "${CMAKE_CURRENT_SOURCE_DIR}/${subpath}/Info.plist.in")
149+
set_target_properties(qtfred PROPERTIES MACOSX_BUNDLE_ICON_FILE "fred_icon")
150+
set_target_properties(qtfred PROPERTIES MACOSX_BUNDLE_LONG_VERSION_STRING "${FSO_FULL_VERSION_STRING}")
151+
set_target_properties(qtfred PROPERTIES MACOSX_BUNDLE_SHORT_VERSION_STRING "${FSO_PRODUCT_VERSION_STRING}")
152+
set_target_properties(qtfred PROPERTIES MACOSX_BUNDLE_BUNDLE_NAME "qtFRED")
153+
set_target_properties(qtfred PROPERTIES MACOSX_BUNDLE_GUI_IDENTIFIER "${FRED_APP_ID}")
154+
155+
# Copy everything from the Resources directory
156+
add_custom_command(TARGET qtfred POST_BUILD
157+
COMMAND cp -a "${CMAKE_CURRENT_SOURCE_DIR}/${subpath}/Resources" "$<TARGET_FILE_DIR:qtfred>/../Resources"
158+
COMMENT "Copying resources into bundle..."
159+
)
140160
endif()
141161

142162
if (FSO_INSTALL_DEBUG_FILES)
@@ -146,3 +166,10 @@ if (FSO_INSTALL_DEBUG_FILES)
146166
OPTIONAL)
147167
endif()
148168
endif()
169+
170+
# Ensure that Xcode generates debug symbols on macOS for Debug builds
171+
set_target_properties(qtfred PROPERTIES XCODE_ATTRIBUTE_GCC_GENERATE_DEBUGGING_SYMBOLS[variant=Debug] "YES")
172+
set_target_properties(qtfred PROPERTIES XCODE_ATTRIBUTE_COPY_PHASE_STRIP[variant=Debug] "NO")
173+
set_target_properties(qtfred PROPERTIES XCODE_ATTRIBUTE_STRIP_INSTALLED_PRODUCT[variant=Debug] "NO")
174+
set_target_properties(qtfred PROPERTIES XCODE_ATTRIBUTE_GCC_SYMBOLS_PRIVATE_EXTERN[variant=Debug] "NO")
175+
set_target_properties(qtfred PROPERTIES XCODE_ATTRIBUTE_PRODUCT_BUNDLE_IDENTIFIER "${FRED_APP_ID}")

qtfred/resources/mac/Info.plist.in

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>SDL_FILESYSTEM_BASE_DIR_TYPE</key>
6+
<string>parent</string>
7+
<key>CFBundleDevelopmentRegion</key>
8+
<string>English</string>
9+
<key>CFBundleExecutable</key>
10+
<string>${MACOSX_BUNDLE_EXECUTABLE_NAME}</string>
11+
<key>CFBundleIconFile</key>
12+
<string>${MACOSX_BUNDLE_ICON_FILE}</string>
13+
<key>CFBundleInfoDictionaryVersion</key>
14+
<string>6.0</string>
15+
<key>CFBundleDisplayName</key>
16+
<string>qtFRED</string>
17+
<key>CFBundleName</key>
18+
<string>qtFRED</string>
19+
<key>CFBundleIdentifier</key>
20+
<string>${MACOSX_BUNDLE_GUI_IDENTIFIER}</string>
21+
<key>CFBundlePackageType</key>
22+
<string>APPL</string>
23+
<key>CFBundleSignature</key>
24+
<string>????</string>
25+
<key>CFBundleShortVersionString</key>
26+
<string>${MACOSX_BUNDLE_SHORT_VERSION_STRING}</string>
27+
<key>CFBundleVersion</key>
28+
<string>${MACOSX_BUNDLE_LONG_VERSION_STRING}</string>
29+
<key>LSApplicationCategoryType</key>
30+
<string>public.app-category.developer-tools</string>
31+
<key>LSMinimumSystemVersion</key>
32+
<string>${CMAKE_OSX_DEPLOYMENT_TARGET}</string>
33+
<key>NSMainNibFile</key>
34+
<string>MainMenu</string>
35+
<key>NSPrincipalClass</key>
36+
<string>NSApplication</string>
37+
<key>NSHumanReadableCopyright</key>
38+
<string>Copyright 1999 Volition, Inc. &amp; Copyright 2002-2024 The Source Code Project.</string>
39+
</dict>
40+
</plist>
840 KB
Binary file not shown.

0 commit comments

Comments
 (0)