compile fixes and improvements

mac was failing to generate an archive.

Icons now in an app asset so it can be properly modified in the project instead of being a static .icns file.

Info.plist now gets its bundle name from the product bundle identifier field, this means it can be changed through the gui instead of having to manually modify the bundle identifier. All other settings are left blank.

Info.plist will need further updates to take values set in Xcode to make it easier to distribute apps.

OpenAL and SDL have to skip installation in release mode builds for the archive to be created correctly.
This commit is contained in:
marauder2k7 2024-03-21 10:45:31 +00:00
parent 057654dda7
commit d44e475800
16 changed files with 113 additions and 11 deletions

View file

@ -320,7 +320,7 @@ endif (WIN32)
# Prepare OSX Plist
if (APPLE)
set(MACOSX_RESOURCES "${CMAKE_SOURCE_DIR}/Tools/CMake/torque.icns"
set(MACOSX_RESOURCES
"${TORQUE_APP_GAME_DIRECTORY}/data"
"${TORQUE_APP_GAME_DIRECTORY}/core"
"${TORQUE_APP_GAME_DIRECTORY}/tools"
@ -340,6 +340,8 @@ if (APPLE)
set(EXECUTABLE_NAME "${TORQUE_APP_NAME}")
configure_file("${CMAKE_SOURCE_DIR}/Tools/CMake/Info.plist.in" "${TORQUE_APP_ROOT_DIRECTORY}/source/Info.plist" COPYONLY)
file( COPY "${CMAKE_SOURCE_DIR}/Tools/CMake/app_assets/apple/App.xcassets" DESTINATION "${TORQUE_APP_ROOT_DIRECTORY}/source")
endif (APPLE)
addDef(TORQUE_DEBUG Debug)
@ -381,12 +383,21 @@ else()
endif (TORQUE_DYNAMIC_LIBRARY AND NOT TORQUE_TESTING)
if (APPLE)
add_executable(${TORQUE_APP_NAME} MACOSX_BUNDLE ${TORQUE_SOURCE_FILES})
add_executable(${TORQUE_APP_NAME} MACOSX_BUNDLE
${TORQUE_SOURCE_FILES})
target_sources(${TORQUE_APP_NAME} PRIVATE "${TORQUE_APP_ROOT_DIRECTORY}/source/App.xcassets")
set_source_files_properties( "${TORQUE_APP_ROOT_DIRECTORY}/source/App.xcassets" PROPERTIES
MACOSX_PACKAGE_LOCATION Resources)
set_target_properties(${TORQUE_APP_NAME} PROPERTIES
BUNDLE true
MACOSX_BUNDLE true
MACOSX_BUNDLE_INFO_PLIST "${TORQUE_APP_ROOT_DIRECTORY}/source/Info.plist"
XCODE_ATTRIBUTE_PRODUCT_BUNDLE_IDENTIFIER "com.torque3d.${TORQUE_APP_NAME}"
XCODE_ATTRIBUTE_INSTALL_PATH "/Applications"
XCODE_ATTRIBUTE_SKIP_INSTALL "No"
XCODE_ATTRIBUTE_ASSETCATALOG_COMPILER_APPICON_NAME "AppIcon"
XCODE_ATTRIBUTE_LINKER_DISPLAYS_MANGLED_NAMES[variant=Debug] YES
XCODE_ATTRIBUTE_ONLY_ACTIVE_ARCH[variant=Debug] YES
XCODE_ATTRIBUTE_ENABLE_TESTABILITY[variant=Debug] YES
@ -507,7 +518,8 @@ if (UNIX)
if ("${LINK_LIBRARY_TYPE}" STREQUAL "SHARED_LIBRARY")
if (APPLE)
set_target_properties(${GAME_LINK_LIBRARY} PROPERTIES
XCODE_ATTRIBUTE_INSTALL_PATH "@rpath")
XCODE_ATTRIBUTE_INSTALL_PATH "@rpath"
XCODE_ATTRIBUTE_SKIP_INSTALL[variant=Release] YES)
else()
set_target_properties(${GAME_LINK_LIBRARY} PROPERTIES LIBRARY_OUTPUT_DIRECTORY "${TORQUE_APP_GAME_DIRECTORY}")
endif(APPLE)

View file

@ -1,22 +1,36 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<!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>${EXECUTABLE_NAME}</string>
<key>CFBundleIconFile</key>
<string>torque</string>
<key>CFBundleGetInfoString</key>
<string>${MACOSX_BUNDLE_INFO_STRING}</string>
<key>CFBundleIconName</key>
<string>AppIcon</string>
<key>CFBundleIdentifier</key>
<string>com.torque3d.${EXECUTABLE_NAME}</string>
<string>$(PRODUCT_BUNDLE_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>1.0</string>
<key>SDL_FILESYSTEM_BASE_DIR_TYPE</key>
<string>${MACOSX_BUNDLE_BUNDLE_VERSION}</string>
<key>CSResourcesFileMapped</key>
<true/>
<key>NSHumanReadableCopyright</key>
<string>${MACOSX_BUNDLE_COPYRIGHT}</string>
<key>SDL_FILESYSTEM_BASE_DIR_TYPE</key>
<string>$(SDL_FILE_DIR)</string>
</dict>
</plist>
</plist>

View file

@ -0,0 +1,68 @@
{
"images" : [
{
"filename" : "torque_appIcon-16.png",
"idiom" : "mac",
"scale" : "1x",
"size" : "16x16"
},
{
"filename" : "torque_appIcon-32.png",
"idiom" : "mac",
"scale" : "2x",
"size" : "16x16"
},
{
"filename" : "torque_appIcon-32 1.png",
"idiom" : "mac",
"scale" : "1x",
"size" : "32x32"
},
{
"filename" : "torque_appIcon-64.png",
"idiom" : "mac",
"scale" : "2x",
"size" : "32x32"
},
{
"filename" : "torque_appIcon-128.png",
"idiom" : "mac",
"scale" : "1x",
"size" : "128x128"
},
{
"filename" : "torque_appIcon-256.png",
"idiom" : "mac",
"scale" : "2x",
"size" : "128x128"
},
{
"filename" : "torque_appIcon-256 1.png",
"idiom" : "mac",
"scale" : "1x",
"size" : "256x256"
},
{
"filename" : "torque_appIcon-512.png",
"idiom" : "mac",
"scale" : "2x",
"size" : "256x256"
},
{
"filename" : "torque_appIcon-512 1.png",
"idiom" : "mac",
"scale" : "1x",
"size" : "512x512"
},
{
"filename" : "torque_appIcon-1024.png",
"idiom" : "mac",
"scale" : "2x",
"size" : "512x512"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 101 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 45 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 45 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

View file

@ -0,0 +1,6 @@
{
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

View file

@ -41,7 +41,9 @@ foreach(lang ${languages})
endforeach()
set(CMAKE_FRAMEWORK_PATH "/Applications/XCode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks")
set(CMAKE_MODULE_LINKER_FLAGS "-rpath @executable_path/../Frameworks -rpath @loader_path/../Frameworks")
set(CMAKE_SHARED_LINKER_FLAGS "-rpath @executable_path/../Frameworks -rpath @loader_path/../Frameworks")
set(CMAKE_INSTALL_NAME_DIR "@rpath")
set(CMAKE_FIND_FRAMEWORK FIRST)
# minimum for multi arch build is 11.
set(CMAKE_OSX_DEPLOYMENT_TARGET "11" CACHE STRING "" FORCE)