Skip to content

Commit

Permalink
Merge branch 'hotfix/0.9.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
jahnf committed Feb 26, 2021
2 parents d04b1eb + 539e5d4 commit 483d4a3
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 19 deletions.
16 changes: 8 additions & 8 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ target_compile_definitions(projecteur PRIVATE
set_target_properties(projecteur PROPERTIES
VERSION_MAJOR 0
VERSION_MINOR 9
VERSION_PATCH 0
VERSION_PATCH 1
VERSION_TYPE release
)
add_version_info(projecteur "${CMAKE_CURRENT_SOURCE_DIR}")
Expand Down Expand Up @@ -140,13 +140,6 @@ set(CMAKE_INSTALL_DEFAULT_DIRECTORY_PERMISSIONS
WORLD_READ WORLD_EXECUTE
)

## -- prevent additional lintian warnings 'non-standard-dir-perm' for the cmake install prefix
set(DIR_TO_INSTALL "${CMAKE_INSTALL_PREFIX}")
while(NOT "${DIR_TO_INSTALL}" STREQUAL "/" AND NOT "${DIR_TO_INSTALL}" STREQUAL "")
install(DIRECTORY DESTINATION "${DIR_TO_INSTALL}")
get_filename_component(DIR_TO_INSTALL "${DIR_TO_INSTALL}" PATH)
endwhile()

install(TARGETS projecteur DESTINATION bin)
set(PROJECTEUR_INSTALL_PATH "${CMAKE_INSTALL_PREFIX}/bin/projecteur") #used in desktop file template

Expand Down Expand Up @@ -287,6 +280,13 @@ if(PACKAGE_TARGETS)
# Need to check if this would clash with packages from the debian/ubuntu repos.
#configure_file("${TMPLDIR}/copyright.in" "pkg/copyright" @ONLY)
#install(FILES "${OUTDIR}/pkg/copyright" DESTINATION /usr/share/doc/projecteur/)

## -- prevent additional lintian warnings 'non-standard-dir-perm' for the cmake install prefix
set(DIR_TO_INSTALL "${CMAKE_INSTALL_PREFIX}")
while(NOT "${DIR_TO_INSTALL}" STREQUAL "/" AND NOT "${DIR_TO_INSTALL}" STREQUAL "")
install(DIRECTORY DESTINATION "${DIR_TO_INSTALL}")
get_filename_component(DIR_TO_INSTALL "${DIR_TO_INSTALL}" PATH)
endwhile()
endif()
endif()

Expand Down
24 changes: 20 additions & 4 deletions cmake/modules/GitVersion.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ set(VERSION_RC_START_TAG_PREFIX "rc-") # If available tags with the given prefix
set(RC_BRANCH_PREFIX release) # e.g. release/0.2
set(HOTFIX_BRANCH_PREFIX hotfix) # e.g. hotfix/2.0.3

set(MAIN_BRANCH master)

set(_GitVersion_DIRECTORY "${CMAKE_CURRENT_LIST_DIR}")

# Get the version information for a directory, sets the following variables
Expand Down Expand Up @@ -60,6 +62,7 @@ function(get_version_info prefix directory)
set(${prefix}_VERSION_DISTANCE 0)
set(${prefix}_VERSION_DISTANCE 0 PARENT_SCOPE)
set(${prefix}_VERSION_STRING 0.0.0-unknown)
set(${prefix}_VERSION_STRING_FULL 0.0.0-unknown)
set(${prefix}_VERSION_ISDIRTY 0 PARENT_SCOPE)
set(${prefix}_VERSION_DATE_MONTH_YEAR "" PARENT_SCOPE)

Expand Down Expand Up @@ -163,7 +166,7 @@ function(get_version_info prefix directory)
string(SUBSTRING ${GIT_BRANCH} 0 ${PREFIX_LEN} COMPARE_PREFIX)
string(COMPARE EQUAL ${HOTFIX_BRANCH_PREFIX} ${COMPARE_PREFIX} ON_HOTFIX_BRANCH)
# Check for master branch
string(COMPARE EQUAL "master" ${GIT_BRANCH} ON_MASTER)
string(COMPARE EQUAL "${MAIN_BRANCH}" "${GIT_BRANCH}" ON_MASTER)

if(ON_RELEASE_BRANCH)
set(${prefix}_VERSION_FLAG ${VERSION_RC_FLAG})
Expand Down Expand Up @@ -305,19 +308,24 @@ function(get_version_info prefix directory)

# Build version string...
set(VERSION_STRING "${${prefix}_VERSION_MAJOR}.${${prefix}_VERSION_MINOR}")
set(VERSION_STRING_FULL "${VERSION_STRING}.${${prefix}_VERSION_PATCH}")
if(NOT ${${prefix}_VERSION_PATCH} EQUAL 0)
set(VERSION_STRING "${VERSION_STRING}.${${prefix}_VERSION_PATCH}")
endif()
if(NOT ON_MASTER OR NOT ${${prefix}_VERSION_DISTANCE} EQUAL 0)
set(VERSION_STRING "${VERSION_STRING}-${${prefix}_VERSION_FLAG}")
endif()
set(VERSION_STRING_FULL "${VERSION_STRING_FULL}-${${prefix}_VERSION_FLAG}")
endif()
if(NOT ${${prefix}_VERSION_FLAG} STREQUAL "")
set(VERSION_STRING "${VERSION_STRING}.")
set(VERSION_STRING_FULL "${VERSION_STRING_FULL}.")
endif()
if(NOT ON_MASTER OR (NOT ON_MASTER AND NOT ${${prefix}_VERSION_DISTANCE} EQUAL 0))
set(VERSION_STRING "${VERSION_STRING}${${prefix}_VERSION_DISTANCE}")
set(VERSION_STRING_FULL "${VERSION_STRING_FULL}${${prefix}_VERSION_DISTANCE}")
endif()
set(${prefix}_VERSION_STRING "${VERSION_STRING}" PARENT_SCOPE)
set(${prefix}_VERSION_STRING_FULL "${VERSION_STRING_FULL}" PARENT_SCOPE)
endfunction()

# Add version information to a target, header and source file are configured from templates.
Expand All @@ -344,6 +352,7 @@ function(add_version_info_custom_prefix target prefix directory)
set(VERSION_SHORTHASH unknown)
set(VERSION_FULLHASH unknown)
set(VERSION_STRING "0.0-unknown.0")
set(VERSION_STRING_FULL "0.0.0-unknown.0")
set(VERSION_ISDIRTY 0)
set(VERSION_BRANCH unknown)
set(output_dir "${CMAKE_CURRENT_BINARY_DIR}/version/${targetid}")
Expand Down Expand Up @@ -388,7 +397,7 @@ function(add_version_info_custom_prefix target prefix directory)
if("${${prefix}_VERSION_BRANCH}" MATCHES ".*[ \t]+[->]+[\t ]+(.*)([,]?.*)")
set(${prefix}_VERSION_BRANCH "${CMAKE_MATCH_1}")
elseif("${${prefix}_VERSION_BRANCH}" MATCHES ".*,[ \t](.*)")
if("${CMAKE_MATCH_1}" STREQUAL "master")
if("${CMAKE_MATCH_1}" STREQUAL "${MAIN_BRANCH}")
set(ON_MASTER ON)
endif()
endif()
Expand All @@ -402,7 +411,7 @@ function(add_version_info_custom_prefix target prefix directory)
string(COMPARE EQUAL ${HOTFIX_BRANCH_PREFIX} ${COMPARE_PREFIX} ON_HOTFIX_BRANCH)
# Check for master branch
if(NOT ON_MASTER)
string(COMPARE EQUAL "master" ${${prefix}_VERSION_BRANCH} ON_MASTER)
string(COMPARE EQUAL "${MAIN_BRANCH}" "${${prefix}_VERSION_BRANCH}" ON_MASTER)
endif()
if(ON_MASTER)
set(${prefix}_VERSION_FLAG "")
Expand All @@ -415,19 +424,24 @@ function(add_version_info_custom_prefix target prefix directory)
endif()
# Build version string...
set(VERSION_STRING "${${prefix}_VERSION_MAJOR}.${${prefix}_VERSION_MINOR}")
set(VERSION_STRING_FULL "${VERSION_STRING}.${${prefix}_VERSION_PATCH}")
if(NOT ${${prefix}_VERSION_PATCH} EQUAL 0)
set(VERSION_STRING "${VERSION_STRING}.${${prefix}_VERSION_PATCH}")
endif()
if(NOT ON_MASTER OR NOT ${${prefix}_VERSION_DISTANCE} EQUAL 0)
set(VERSION_STRING "${VERSION_STRING}-${${prefix}_VERSION_FLAG}")
set(VERSION_STRING_FULL "${VERSION_STRING_FULL}-${${prefix}_VERSION_FLAG}")
endif()
if(NOT ${${prefix}_VERSION_FLAG} STREQUAL "")
set(VERSION_STRING "${VERSION_STRING}.")
set(VERSION_STRING_FULL "${VERSION_STRING_FULL}.")
endif()
if(NOT ON_MASTER OR (NOT ON_MASTER AND NOT ${${prefix}_VERSION_DISTANCE} EQUAL 0))
set(VERSION_STRING "${VERSION_STRING}${${prefix}_VERSION_DISTANCE}")
set(VERSION_STRING_FULL "${VERSION_STRING_FULL}${${prefix}_VERSION_DISTANCE}")
endif()
set(${prefix}_VERSION_STRING "${VERSION_STRING}")
set(${prefix}_VERSION_STRING_FULL "${VERSION_STRING_FULL}")
endif()
endif()
endif()
Expand All @@ -446,6 +460,7 @@ function(add_version_info_custom_prefix target prefix directory)
set(VERSION_SHORTHASH ${${prefix}_VERSION_SHORTHASH})
set(VERSION_FULLHASH ${${prefix}_VERSION_FULLHASH})
set(VERSION_STRING ${${prefix}_VERSION_STRING})
set(VERSION_STRING_FULL ${${prefix}_VERSION_STRING_FULL})
set(VERSION_ISDIRTY ${${prefix}_VERSION_ISDIRTY})
set(VERSION_BRANCH ${${prefix}_VERSION_BRANCH})
set(VERSION_DATE_MONTH_YEAR ${${prefix}_VERSION_DATE_MONTH_YEAR})
Expand All @@ -464,6 +479,7 @@ function(add_version_info_custom_prefix target prefix directory)
VERSION_SHORTHASH "${VERSION_SHORTHASH}"
VERSION_FULLHASH "${VERSION_FULLHASH}"
VERSION_STRING "${VERSION_STRING}"
VERSION_STRING_FULL "${VERSION_STRING_FULL}"
VERSION_ISDIRTY "${VERSION_ISDIRTY}"
VERSION_BRANCH "${VERSION_BRANCH}"
VERSION_DATE_MONTH_YEAR "${VERSION_DATE_MONTH_YEAR}"
Expand Down
14 changes: 9 additions & 5 deletions cmake/modules/LinuxPackaging.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ function(add_dist_package_target)
message(FATAL_ERROR "Argument 'TARGET' needs to be a valid target.")
endif()

get_target_property(PKG_VERSION_STRING_FULL ${PKG_TARGET} VERSION_STRING)
get_target_property(PKG_VERSION_STRING_FULL ${PKG_TARGET} VERSION_STRING_FULL)
get_target_property(PKG_VERSION_STRING ${PKG_TARGET} VERSION_STRING)
get_target_property(PKG_VERSION_MAJOR ${PKG_TARGET} VERSION_MAJOR)
get_target_property(PKG_VERSION_MINOR ${PKG_TARGET} VERSION_MINOR)
get_target_property(PKG_VERSION_PATCH ${PKG_TARGET} VERSION_PATCH)
Expand All @@ -70,9 +71,12 @@ function(add_dist_package_target)
if("${PKG_VERSION_PATCH}" STREQUAL "")
set(PKG_VERSION_PATCH 0)
endif()
set(PKG_VERSION_STRING "${PKG_VERSION_MAJOR}.${PKG_VERSION_MINOR}.${PKG_VERSION_PATCH}")
set(PKG_VERSION_IDENTIFIERS "${PKG_VERSION_FLAG}.${PKG_VERSION_DISTANCE}")

set(PKG_VERSION_STRING_BASE "${PKG_VERSION_MAJOR}.${PKG_VERSION_MINOR}.${PKG_VERSION_PATCH}")
if("${PKG_VERSION_FLAG}" STREQUAL "")
set(PKG_VERSION_IDENTIFIERS "1")
else()
set(PKG_VERSION_IDENTIFIERS "0${PKG_VERSION_FLAG}.${PKG_VERSION_DISTANCE}")
endif()
# Set defaults if not set
if("${PKG_CONTACT}" STREQUAL "")
set(PKG_CONTACT "Generic Maintainer <[email protected]>")
Expand Down Expand Up @@ -272,7 +276,7 @@ endfunction()

# Default cpack packaging (DEB, RPM, TGZ)
function(_cpack_default_packaging)
set(PKG_CPACK_PKG_FILENAME "${PKG_NAME}-${PKG_VERSION_STRING_FULL}_${PKG_DIST}-${CMAKE_SYSTEM_PROCESSOR}")
set(PKG_CPACK_PKG_FILENAME "${PKG_NAME}-${PKG_VERSION_STRING}_${PKG_DIST}-${CMAKE_SYSTEM_PROCESSOR}")
set(PKG_CPACK_PKG_FILE_PREFIX "dist-pkg")
set(PKG_CONFIG_TEMPLATE "${_LinuxPackaging_DIRECTORY}/LinuxPkgCPackConfig.cmake.in")
set(PKG_CONFIG_FILE "${CMAKE_CURRENT_BINARY_DIR}/CPackConfig-${PKG_TYPE}.cmake")
Expand Down
4 changes: 3 additions & 1 deletion cmake/modules/LinuxPkgCPackConfig.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ set(CPACK_OUTPUT_FILE_PREFIX "@PKG_CPACK_PKG_FILE_PREFIX@")
set(CPACK_DEBIAN_PACKAGE_NAME "${CPACK_PACKAGE_NAME}")
set(CPACK_RPM_PACKAGE_NAME "${CPACK_PACKAGE_NAME}")
set(CPACK_RPM_COMPRESSION_TYPE gzip)
set(CPACK_RPM_PACKAGE_VERSION "@PKG_VERSION_STRING@")
set(CPACK_DEBIAN_PACKAGE_VERSION "@PKG_VERSION_STRING_BASE@")
set(CPACK_DEBIAN_PACKAGE_RELEASE "@PKG_VERSION_IDENTIFIERS@")
set(CPACK_RPM_PACKAGE_VERSION "@PKG_VERSION_STRING_BASE@")
set(CPACK_RPM_PACKAGE_RELEASE "@PKG_VERSION_IDENTIFIERS@")
set(CPACK_RPM_PACKAGE_LICENSE "@PKG_LICENSE@")
set(CPACK_RPM_PACKAGE_DESCRIPTION "@PKG_DESCRIPTION_FULL@")
Expand Down
2 changes: 1 addition & 1 deletion cmake/modules/PKGBUILD.in
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ build() {
cd $srcdir
mkdir -p builddir
cd builddir
cmake $srcdir/@PKG_NAME@-@PKG_VERSION_STRING_FULL@
cmake $srcdir/@PKG_NAME@-@PKG_VERSION_STRING@
make -j2
}

Expand Down

0 comments on commit 483d4a3

Please sign in to comment.