-
-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #88 from stephengtuggy/short_sha_0.8.x
Short SHA, other version-related changes -- Assets, 0.8.x
- Loading branch information
Showing
3 changed files
with
58 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,7 @@ | |
#==================================== | ||
# Copyright (C) 2020-2021 Evert Vorster, Stephen G. Tuggy, | ||
# and other vsUTCS contributors. | ||
# Copyright (C) 2022 Stephen G. Tuggy | ||
# | ||
# This file is part of Vega Strike: Upon the Coldest Sea ("vsUTCS"). | ||
# | ||
|
@@ -26,9 +27,10 @@ CMAKE_MINIMUM_REQUIRED(VERSION 3.5 FATAL_ERROR) | |
SET(vsUTCS_VERSION_MAJOR "0") | ||
SET(vsUTCS_VERSION_MINOR "8") | ||
SET(vsUTCS_VERSION_PATCH "0") | ||
|
||
# Auto-populate with the git hash of the build | ||
IF (DEFINED ENV{GITHUB_SHA} AND NOT "$ENV{GITHUB_SHA}" STREQUAL "") | ||
SET (vsUTCS_VERSION_TWEAK "$ENV{GITHUB_SHA}") | ||
IF (DEFINED ENV{SHORT_SHA} AND NOT "$ENV{SHORT_SHA}" STREQUAL "") | ||
SET (vsUTCS_VERSION_TWEAK "$ENV{SHORT_SHA}") | ||
ELSE () | ||
EXECUTE_PROCESS( | ||
COMMAND git rev-parse --short HEAD | ||
|
@@ -38,11 +40,39 @@ ELSE () | |
) | ||
ENDIF () | ||
|
||
SET(vsUTCS_VERSION_LONG_STR "${vsUTCS_VERSION_MAJOR}.${vsUTCS_VERSION_MINOR}.${vsUTCS_VERSION_PATCH}-${vsUTCS_VERSION_TWEAK}") | ||
SET(vsUTCS_VERSION_SHORT_STR "${vsUTCS_VERSION_MAJOR}.${vsUTCS_VERSION_MINOR}.${vsUTCS_VERSION_PATCH}") | ||
SET(vsUTCS_PKG_VERSION_STR "${vsUTCS_VERSION_MAJOR}.${vsUTCS_VERSION_MINOR}.${vsUTCS_VERSION_PATCH}") | ||
|
||
IF (DEFINED ENV{TAG_NAME} AND NOT "$ENV{TAG_NAME}" STREQUAL "") | ||
STRING(REGEX REPLACE "^v([0-9]+)\\..*" "\\1" TAG_VERSION_MAJOR "$ENV{TAG_NAME}") | ||
STRING(REGEX REPLACE "^v[0-9]+\\.([0-9]+).*" "\\1" TAG_VERSION_MINOR "$ENV{TAG_NAME}") | ||
STRING(REGEX REPLACE "^v[0-9]+\\.[0-9]+\\.([0-9]+).*" "\\1" TAG_VERSION_PATCH "$ENV{TAG_NAME}") | ||
STRING(REGEX REPLACE "^v[0-9]+\\.[0-9]+\\.[0-9]+(.*)" "\\1" TAG_VERSION_TWEAK "$ENV{TAG_NAME}") | ||
|
||
SET(TAG_VERSION_SHORT_STR "${TAG_VERSION_MAJOR}.${TAG_VERSION_MINOR}.${TAG_VERSION_PATCH}") | ||
|
||
IF (NOT "${vsUTCS_VERSION_SHORT_STR}" VERSION_EQUAL "${TAG_VERSION_SHORT_STR}") | ||
MESSAGE(FATAL_ERROR "!! Project version spelled out in CMake file does not match project version from TAG_NAME environment variable") | ||
ENDIF () | ||
IF (NOT "${TAG_VERSION_TWEAK}" STREQUAL "") | ||
SET(vsUTCS_VERSION_LONG_STR "${vsUTCS_VERSION_MAJOR}.${vsUTCS_VERSION_MINOR}.${vsUTCS_VERSION_PATCH}${TAG_VERSION_TWEAK}-${vsUTCS_VERSION_TWEAK}") | ||
SET(vsUTCS_PKG_VERSION_STR "${vsUTCS_VERSION_MAJOR}.${vsUTCS_VERSION_MINOR}.${vsUTCS_VERSION_PATCH}${TAG_VERSION_TWEAK}") | ||
ENDIF () | ||
ENDIF () | ||
|
||
# VERSION Policy | ||
IF (POLICY CMP0048) | ||
CMAKE_POLICY (SET CMP0048 NEW) | ||
ENDIF (POLICY CMP0048) | ||
|
||
PROJECT(vsUTCS | ||
VERSION | ||
"${vsUTCS_VERSION_MAJOR}.${vsUTCS_VERSION_MINOR}.${vsUTCS_VERSION_PATCH}" #.${vsUTCS_VERSION_TWEAK} # CMake only allows numeric version components, unfortunately. | ||
) | ||
|
||
MESSAGE("== vsUTCS Version: ${vsUTCS_VERSION_LONG_STR}") | ||
|
||
# Let cmake find our in-tree modules | ||
SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${vsUTCS_SOURCE_DIR}) | ||
|
||
|
@@ -169,13 +199,7 @@ SET(CPACK_PACKAGE_VERSION_PATCH "${vsUTCS_VERSION_PATCH}") | |
SET(CPACK_PACKAGE_INSTALL_DIRECTORY "vsUTCS-${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}") | ||
SET(CPACK_CONTACT "[email protected]") | ||
|
||
# Source package filename | ||
IF (DEFINED ENV{TAG_NAME}) | ||
SET(vsUTCS_PACKAGE_VERSION_STR "$ENV{TAG_NAME}") | ||
ELSE (DEFINED ENV{TAG_NAME}) | ||
SET(vsUTCS_PACKAGE_VERSION_STR "${vsUTCS_VERSION_MAJOR}.${vsUTCS_VERSION_MINOR}.${vsUTCS_VERSION_PATCH}-0.${vsUTCS_VERSION_TWEAK}") | ||
ENDIF (DEFINED ENV{TAG_NAME}) | ||
SET(CPACK_SOURCE_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}_${vsUTCS_PACKAGE_VERSION_STR}-Source") | ||
SET(CPACK_SOURCE_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}_v${vsUTCS_PKG_VERSION_STR}-Source") | ||
SET(CPACK_SOURCE_GENERATOR "TXZ") | ||
|
||
IF (WIN32 AND NOT UNIX) | ||
|
@@ -211,10 +235,11 @@ ELSEIF (CMAKE_SYSTEM_NAME STREQUAL Linux) | |
# See https://cmake.org/cmake/help/v3.3/module/CPackDeb.html | ||
SET(CPACK_DEBIAN_PACKAGE_NAME "vsUTCS") | ||
SET(CPACK_DEBIAN_PACKAGE_MAINTAINER "[email protected]") | ||
SET(CPACK_DEBIAN_PACKAGE_VERSION "${vsUTCS_PKG_VERSION_STR}") | ||
SET(CPACK_DEBIAN_COMPRESSION_TYPE "bzip2") | ||
SET(CPACK_DEBIAN_PACKAGE_DEPENDS "vega-strike") | ||
|
||
SET(CPACK_PACKAGE_FILE_NAME "${CPACK_DEBIAN_PACKAGE_NAME}_${vsUTCS_PACKAGE_VERSION_STR}") | ||
SET(CPACK_PACKAGE_FILE_NAME "${CPACK_DEBIAN_PACKAGE_NAME}_v${vsUTCS_PKG_VERSION_STR}") | ||
|
||
SET(CPACK_DEBIAN_PACKAGE_SECTION "Amusements/Games") | ||
SET(CPACK_DEBIAN_PACKAGE_HOMEPAGE "https://www.vega-strike.org") | ||
|
@@ -228,6 +253,7 @@ ELSEIF (CMAKE_SYSTEM_NAME STREQUAL Linux) | |
SET(CPACK_RPM_PACKAGE_LICENSE "GPLv3") # See ../LICENSE | ||
SET(CPACK_RPM_PACKAGE_URL "https://www.vega-strike.org") | ||
SET(CPACK_RPM_PACKAGE_NAME "vsUTCS") | ||
SET(CPACK_RPM_PACKAGE_VERSION "${vsUTCS_PKG_VERSION_STR}") | ||
SET(CPACK_RPM_PACKAGE_REQUIRES "Vega-Strike") | ||
|
||
# Figure out the filename | ||
|
@@ -237,7 +263,7 @@ ELSEIF (CMAKE_SYSTEM_NAME STREQUAL Linux) | |
SET(vsUTCS_LINUX_VERSION_STR "${LINUX_VERSION_ID}") | ||
ENDIF (LINUX_CODENAME) | ||
|
||
SET(CPACK_PACKAGE_FILE_NAME "${CPACK_RPM_PACKAGE_NAME}_${vsUTCS_PACKAGE_VERSION_STR}-${LINUX_ID}-${vsUTCS_LINUX_VERSION_STR}") | ||
SET(CPACK_PACKAGE_FILE_NAME "${CPACK_RPM_PACKAGE_NAME}_v${vsUTCS_PKG_VERSION_STR}-${LINUX_ID}-${vsUTCS_LINUX_VERSION_STR}") | ||
SET(CPACK_GENERATOR "RPM") | ||
ENDIF () | ||
ELSE (WIN32 AND NOT UNIX) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters