From: Shuanglei Tao Date: Sat, 30 Mar 2024 02:58:37 +0000 (+0800) Subject: cmake: add static version back X-Git-Url: http://git.prime8.dev/?a=commitdiff_plain;h=62f44f827a4f21c7601b56d109acc2b96a8cd16b;p=ttyd.git cmake: add static version back --- diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 3dd3b2d..d5d2b25 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -12,6 +12,15 @@ jobs: runs-on: ubuntu-22.04 steps: - uses: actions/checkout@v4 + - name: Check version bump + run: | + TAG=$(git describe --tags --match "[0-9]*.[0-9]*.[0-9]*" --abbrev=8) + VERSION=$(grep project CMakeLists.txt| awk '{print $3}') + if [ "$TAG" != "$VERSION" ]; then + echo "=== Version in CMakeLists.txt and git tag does not match!" + echo "=== Git Tag: $TAG, Version: $VERSION" + exit 1 + fi - uses: actions/download-artifact@v4 - run: | mkdir build diff --git a/CMakeLists.txt b/CMakeLists.txt index 0bf19bc..0e2a61f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,15 +2,18 @@ cmake_minimum_required(VERSION 3.12.0) list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake") -include(GetGitVersion) +project(ttyd VERSION 1.7.6 LANGUAGES C) + +set(TTYD_VERSION "${PROJECT_VERSION}") +include(GetGitVersion) get_git_version(GIT_VERSION SEM_VER) get_git_head(GIT_COMMIT) - -project(ttyd VERSION "${SEM_VER}" LANGUAGES C) - -if(NOT "{GIT_COMMIT}" STREQUAL "") - set(PROJECT_VERSION "${PROJECT_VERSION}-${GIT_COMMIT}") +if("${SEM_VER}" VERSION_GREATER "${TTYD_VERSION}") + set(TTYD_VERSION "${SEM_VER}") +endif() +if(NOT "${GIT_COMMIT}" STREQUAL "") + set(TTYD_VERSION "${TTYD_VERSION}-${GIT_COMMIT}") endif() set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_GNU_SOURCE") @@ -81,7 +84,7 @@ add_executable(${PROJECT_NAME} ${SOURCE_FILES}) target_include_directories(${PROJECT_NAME} PUBLIC ${INCLUDE_DIRS}) target_link_libraries(${PROJECT_NAME} ${LINK_LIBS}) target_compile_definitions(${PROJECT_NAME} PUBLIC - TTYD_VERSION="${PROJECT_VERSION}" + TTYD_VERSION="${TTYD_VERSION}" $<$:_WIN32_WINNT=0xa00 WINVER=0xa00> )