1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-24 22:14:36 +02:00

Merge pull request #1022 from kambala-decapitator/apple-set-app-version

[Apple] set proper app and build versions
This commit is contained in:
Andrii Danylchenko 2022-10-01 20:48:37 +03:00 committed by GitHub
commit d07586ccf6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 63 additions and 53 deletions

View File

@ -62,6 +62,7 @@ option(ENABLE_LUA "Enable compilation of LUA scripting module" OFF)
option(ENABLE_LAUNCHER "Enable compilation of launcher" ON)
if(APPLE_IOS)
set(BUNDLE_IDENTIFIER_PREFIX "" CACHE STRING "Bundle identifier prefix")
set(APP_DISPLAY_NAME "VCMI" CACHE STRING "App name on the home screen")
else()
option(ENABLE_TEST "Enable compilation of unit tests" ON)
endif()
@ -155,6 +156,7 @@ set(CMAKE_MAP_IMPORTED_CONFIG_MINSIZEREL MinSizeRel Release RelWithDebInfo "")
# Release falls back to RelWithDebInfo, then MinSizeRel
set(CMAKE_MAP_IMPORTED_CONFIG_RELEASE Release RelWithDebInfo MinSizeRel "")
set(CMAKE_XCODE_ATTRIBUTE_APP_DISPLAY_NAME ${APP_DISPLAY_NAME})
set(CMAKE_XCODE_ATTRIBUTE_CLANG_ENABLE_OBJC_ARC YES)
set(CMAKE_XCODE_ATTRIBUTE_DEBUG_INFORMATION_FORMAT[variant=Debug] dwarf)
set(CMAKE_XCODE_ATTRIBUTE_ENABLE_BITCODE NO)
@ -585,8 +587,13 @@ elseif(APPLE_MACOS AND NOT ENABLE_MONOLITHIC_INSTALL)
# Pre-generated DS_Store use absolute path to background image
set(CPACK_DMG_VOLUME_NAME "${CMAKE_PROJECT_NAME}")
include(GetGitRevisionDescription)
get_git_head_revision(GIT_REFSPEC GIT_SHA1)
set(MACOSX_BUNDLE_NAME "${CMAKE_PROJECT_NAME}")
set(MACOSX_BUNDLE_BUNDLE_NAME "${CMAKE_PROJECT_NAME}")
set(MACOSX_BUNDLE_BUNDLE_VERSION ${GIT_SHA1})
set(MACOSX_BUNDLE_SHORT_VERSION_STRING ${APP_SHORT_VERSION})
if(ENABLE_LAUNCHER)
set(MACOSX_BUNDLE_EXECUTABLE_NAME "vcmilauncher")
else()

View File

@ -269,8 +269,10 @@ enable_pch(vcmiclient)
if(APPLE_IOS)
add_custom_command(TARGET vcmiclient POST_BUILD
COMMAND ios/set_build_version.sh "$<TARGET_BUNDLE_CONTENT_DIR:vcmiclient>"
COMMAND ${CMAKE_COMMAND} --install "${CMAKE_BINARY_DIR}" --component "${CMAKE_INSTALL_DEFAULT_COMPONENT_NAME}" --config "$<CONFIG>" --prefix "$<TARGET_BUNDLE_CONTENT_DIR:vcmiclient>"
COMMAND ${CMAKE_SOURCE_DIR}/ios/codesign.sh
COMMAND ios/codesign.sh
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
)
install(TARGETS vcmiclient DESTINATION Payload COMPONENT app) # for ipa generation with cpack
else()

View File

@ -11,7 +11,7 @@
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>VCMI</string>
<string>$(APP_DISPLAY_NAME)</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>

View File

@ -6,6 +6,26 @@
<string>Root</string>
<key>PreferenceSpecifiers</key>
<array>
<dict>
<key>Type</key>
<string>PSTitleValueSpecifier</string>
<key>Title</key>
<string>AppVersion</string>
<key>Key</key>
<string>foo1</string>
<key>DefaultValue</key>
<string></string>
</dict>
<dict>
<key>Type</key>
<string>PSTitleValueSpecifier</string>
<key>Title</key>
<string>BuildVersion</string>
<key>Key</key>
<string>foo2</string>
<key>DefaultValue</key>
<string></string>
</dict>
<dict>
<key>Type</key>
<string>PSRadioGroupSpecifier</string>

View File

@ -1,3 +1,6 @@
"LaunchType" = "App start type";
"Launcher" = "Launcher";
"Game" = "Game";
"AppVersion" = "Application version";
"BuildVersion" = "Build version";

View File

@ -1,3 +1,6 @@
"LaunchType" = "Тип запуска приложения";
"Launcher" = "Конфигурация (лаунчер)";
"Game" = "Игра";
"AppVersion" = "Версия приложения";
"BuildVersion" = "Версия сборки";

10
ios/set_build_version.sh Executable file
View File

@ -0,0 +1,10 @@
#!/usr/bin/env bash
today=$(date '+%Y-%m-%d')
commitShort=$(git rev-parse --short HEAD)
bundleVersion="$today-$commitShort"
/usr/libexec/PlistBuddy "$1/Info.plist" -c "Set :CFBundleVersion $bundleVersion"
/usr/libexec/PlistBuddy "$1/Settings.bundle/Root.plist" -c "Set :PreferenceSpecifiers:0:DefaultValue $MARKETING_VERSION"
/usr/libexec/PlistBuddy "$1/Settings.bundle/Root.plist" -c "Set :PreferenceSpecifiers:1:DefaultValue $bundleVersion"

View File

@ -171,6 +171,7 @@ CSettingsView::CSettingsView(QWidget * parent)
{
ui->setupUi(this);
ui->labelBuildVersion->setText(QString::fromStdString(GameConstants::VCMI_VERSION));
loadSettings();
}

View File

@ -572,6 +572,20 @@
</property>
</widget>
</item>
<item row="13" column="6">
<widget class="QLabel" name="labelBuildVersionDesc">
<property name="text">
<string>Build version</string>
</property>
</widget>
</item>
<item row="13" column="7" colspan="3">
<widget class="QLabel" name="labelBuildVersion">
<property name="text">
<string notr="true"/>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>

View File

@ -397,30 +397,6 @@ TerrainType::TerrainType(const std::string& _name):
transitionRequired(false)
{
}
TerrainType& TerrainType::operator=(const TerrainType & other)
{
battleFields = other.battleFields;
prohibitTransitions = other.prohibitTransitions;
minimapBlocked = other.minimapBlocked;
minimapUnblocked = other.minimapUnblocked;
name = other.name;
musicFilename = other.musicFilename;
tilesFilename = other.tilesFilename;
terrainText = other.terrainText;
typeCode = other.typeCode;
terrainViewPatterns = other.terrainViewPatterns;
rockTerrain = other.rockTerrain;
river = other.river;
id = other.id;
moveCost = other.moveCost;
horseSoundId = other.horseSoundId;
passabilityType = other.passabilityType;
transitionRequired = other.transitionRequired;
return *this;
}
bool TerrainType::operator==(const TerrainType& other)
{
@ -474,16 +450,6 @@ RiverType::RiverType(const std::string & fileName, const std::string & code, Riv
{
}
RiverType& RiverType::operator=(const RiverType& other)
{
fileName = other.fileName;
code = other.code;
deltaName = other.deltaName;
id = other.id;
return *this;
}
RoadType::RoadType(const std::string& fileName, const std::string& code, RoadId id):
fileName(fileName),
code(code),
@ -492,14 +458,4 @@ RoadType::RoadType(const std::string& fileName, const std::string& code, RoadId
{
}
RoadType& RoadType::operator=(const RoadType& other)
{
fileName = other.fileName;
code = other.code;
id = other.id;
movementCost = other.movementCost;
return *this;
}
VCMI_LIB_NAMESPACE_END
VCMI_LIB_NAMESPACE_END

View File

@ -49,8 +49,6 @@ public:
bool transitionRequired;
TerrainType(const std::string & name = "");
TerrainType& operator=(const TerrainType & other);
bool operator==(const TerrainType & other);
bool operator!=(const TerrainType & other);
@ -99,8 +97,6 @@ public:
RiverType(const std::string & fileName = "", const std::string & code = "", RiverId id = River::NO_RIVER);
RiverType& operator=(const RiverType & other);
template <typename Handler> void serialize(Handler& h, const int version)
{
h & fileName;
@ -120,8 +116,6 @@ public:
RoadType(const std::string & fileName = "", const std::string& code = "", RoadId id = Road::NO_ROAD);
RoadType& operator=(const RoadType & other);
template <typename Handler> void serialize(Handler& h, const int version)
{
h & fileName;