From ee9264e4f79956814fd164624643ad1cd6762c1b Mon Sep 17 00:00:00 2001 From: SourLemonJuice Date: Sun, 16 Jun 2024 18:31:59 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E4=BA=86=E7=82=B9=E9=A2=84?= =?UTF-8?q?=E5=A4=84=E7=90=86=E5=99=A8=E5=92=8Cmake=E7=9A=84=E9=9B=86?= =?UTF-8?q?=E6=88=90,CI=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/Build.yml | 10 +++++----- source/main.h | 11 ++++++++--- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/.github/workflows/Build.yml b/.github/workflows/Build.yml index 47c6c4f..0274a33 100644 --- a/.github/workflows/Build.yml +++ b/.github/workflows/Build.yml @@ -7,10 +7,10 @@ on: branches: [ "main" ] workflow_dispatch: inputs: - release_build_arg: - required: true - type: string - default: releaseBuild=0 + Make_releaseBuild_arg: + required: false + type: string + default: releaseBuild="0" jobs: build: @@ -20,7 +20,7 @@ jobs: - name: Build with make env: CI_HOST_INFO: GitHub Build Workflow - run: make --directory="./source/" build_host_description="${CI_HOST_INFO} ID:${GITHUB_RUN_ID} for ${GITHUB_REF}" + run: make --directory="./source/" build_host_description="${CI_HOST_INFO} ID:${GITHUB_RUN_ID} for ${GITHUB_REF}" ${Make_releaseBuild_arg} - name: Upload executable file uses: actions/upload-artifact@v4 with: diff --git a/source/main.h b/source/main.h index fb3a80a..7a6f176 100644 --- a/source/main.h +++ b/source/main.h @@ -7,24 +7,29 @@ For compiler defin flag(gcc -D) Those macros should be defined by compiler */ +// git info when building #ifndef APP_GIT_COMMIT_INFO #define APP_GIT_COMMIT_INFO "[Build ERROR] APP_GIT_COMMIT_INFO not defined" #endif +// build host info #ifndef APP_BUILD_HOST_DESCRIPTION #define APP_BUILD_HOST_DESCRIPTION "[Build ERROR] APP_BUILD_HOST_DESCRIPTION not defined" #endif -/* Self define */ // switch between release build mode... #if APP_BUILD_RELEASE_MODE == 1 #define APP_VERSION_STRING "ver-1.0" -#else // ...and develop build +#elif APP_BUILD_RELEASE_MODE == 0 // ...and develop build // cheating the code analyzer #define APP_BUILD_RELEASE_MODE 0 -#define APP_VERSION_STRING "Under Development" +#define APP_VERSION_STRING "Development" +#else +#error The macro APP_BUILD_RELEASE_MODE is set to non 0/1, go check make flags. #endif +/* Self define */ + /* TODO I'm tired... This size use for some input string preprocessor, like fscanf() or deletePunctuations()