Skip to content

Commit

Permalink
允许在构建时控制其目标为 调试 或者 发布
Browse files Browse the repository at this point in the history
  • Loading branch information
SourLemonJuice committed Jun 16, 2024
1 parent 0cb2736 commit 3442a18
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 7 deletions.
7 changes: 6 additions & 1 deletion .github/workflows/Build.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
name: Build CI

on:
workflow_dispatch:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
workflow_dispatch:
inputs:
release_build_arg:
required: true
type: string
default: releaseBuild=0

jobs:
build:
Expand Down
6 changes: 5 additions & 1 deletion source/GNUmakefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,17 @@ build_host_description = Not explicit declared
# And I'll use cli to overwrite them with github ci, uglier then ugly.
# It took me 6 commits to figure this out.

# 1 == enabled
releaseBuild = 0

ALL: i18nglish.out

i18nglish.out: $(source_files)
/usr/bin/clang $(source_files) \
--output $(executable_name) \
-DAPP_GIT_COMMIT_INFO="\"$(git_commit_info)\"" \
-DAPP_BUILD_HOST_DESCRIPTION="\"$(build_host_description)\""
-DAPP_BUILD_HOST_DESCRIPTION="\"$(build_host_description)\"" \
-DAPP_BUILD_RELEASE_MODE="$(releaseBuild)"

clean:
rm -i ./$(executable_name)
11 changes: 6 additions & 5 deletions source/main.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,13 @@
#endif

/* Self define */
#define APP_VERSION_RELEASE_BUILD false
// release version
#if APP_VERSION_RELEASE_BUILD
// switch between release build mode...
#if APP_BUILD_RELEASE_MODE == 1
#define APP_VERSION_STRING "ver-1.0"
#else
#define APP_VERSION_STRING "Development"
#else // ...and develop build
// cheating the code analyzer
#define APP_BUILD_RELEASE_MODE 0
#define APP_VERSION_STRING "Under Development"
#endif

/*
Expand Down

0 comments on commit 3442a18

Please sign in to comment.