Skip to content

Commit

Permalink
Read project version from build/version file.
Browse files Browse the repository at this point in the history
  • Loading branch information
john-preston committed Dec 6, 2019
1 parent aea5a8f commit cf0ea4a
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 4 deletions.
4 changes: 3 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,12 @@ cmake_policy(SET CMP0091 NEW)
set_property(GLOBAL PROPERTY USE_FOLDERS ON)

include(cmake/variables.cmake)
include(cmake/version.cmake)
desktop_app_parse_version(Telegram/build/version)

project(Telegram
LANGUAGES C CXX
VERSION 1.9.0
VERSION ${desktop_app_version_cmake}
DESCRIPTION "Official Telegram Desktop messenger"
HOMEPAGE_URL "https://desktop.telegram.org"
)
Expand Down
3 changes: 1 addition & 2 deletions Telegram/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1064,14 +1064,13 @@ else()
set(output_name "Telegram")
endif()

set(current_version 1.9.1)
set_target_properties(Telegram PROPERTIES
OUTPUT_NAME ${output_name}
MACOSX_BUNDLE_GUI_IDENTIFIER ${bundle_identifier}
MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/Telegram.plist
XCODE_ATTRIBUTE_CODE_SIGN_ENTITLEMENTS "${CMAKE_CURRENT_SOURCE_DIR}/Telegram/${bundle_entitlements}"
XCODE_ATTRIBUTE_PRODUCT_BUNDLE_IDENTIFIER ${bundle_identifier}
XCODE_ATTRIBUTE_CURRENT_PROJECT_VERSION ${current_version}
XCODE_ATTRIBUTE_CURRENT_PROJECT_VERSION ${desktop_app_version_string}
XCODE_ATTRIBUTE_PRODUCT_NAME ${output_name}
XCODE_ATTRIBUTE_DEBUG_INFORMATION_FORMAT $<$<NOT:$<CONFIG:Debug>>:dwarf-with-dsym>
XCODE_ATTRIBUTE_ASSETCATALOG_COMPILER_APPICON_NAME AppIcon
Expand Down
3 changes: 3 additions & 0 deletions Telegram/build/set_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ def finish(code):
scriptPath = os.path.dirname(os.path.realpath(__file__))

inputVersion = ''
versionOriginal = ''
versionMajor = ''
versionMinor = ''
versionPatch = ''
Expand All @@ -29,6 +30,7 @@ def finish(code):
match = re.match(r'^\s*(\d+)\.(\d+)(\.(\d+)(\.(\d+|beta))?)?\s*$', arg)
if match:
inputVersion = arg
versionOriginal = inputVersion
versionMajor = match.group(1)
versionMinor = match.group(2)
versionPatch = match.group(4) if match.group(4) else '0'
Expand Down Expand Up @@ -117,6 +119,7 @@ def replaceInFile(path, replacements):
[ r'(AppVersionStr\s+)\d[\d\.]*', r'\g<1>' + versionStr ],
[ r'(BetaChannel\s+)\d', r'\g<1>' + ('1' if versionBeta else '0') ],
[ r'(AlphaVersion\s+)\d+', r'\g<1>' + versionFullAlpha ],
[ r'(AppVersionOriginal\s+)\d[\d\.beta]*', r'\g<1>' + versionOriginal ],
])

print('Patching core/version.h...')
Expand Down
1 change: 1 addition & 0 deletions Telegram/build/version
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ AppVersionStrSmall 1.9.1
AppVersionStr 1.9.1
BetaChannel 0
AlphaVersion 1009001008
AppVersionOriginal 1.9.1.8
2 changes: 1 addition & 1 deletion cmake
Submodule cmake updated 1 files
+71 −0 version.cmake

0 comments on commit cf0ea4a

Please sign in to comment.