Commit e007afe 1 parent 68e7783 commit e007afe Copy full SHA for e007afe
File tree 3 files changed +23
-1
lines changed
3 files changed +23
-1
lines changed Original file line number Diff line number Diff line change 1
1
cmake_minimum_required (VERSION 3.1)
2
2
project (RTLSDR-Airband CXX)
3
3
4
- execute_process (COMMAND git describe --tags --abbrev --dirty --always
4
+ execute_process (COMMAND ${PROJECT_SOURCE_DIR} /scripts/find_version
5
5
OUTPUT_VARIABLE RTL_AIRBAND_VERSION
6
6
OUTPUT_STRIP_TRAILING_WHITESPACE
7
7
ERROR_VARIABLE RTL_AIRBAND_VERSION_ERROR
Original file line number Diff line number Diff line change @@ -45,6 +45,7 @@ WORKDIR /rtl_airband_build
45
45
# WARNING: not copying in the whole repo, this may need to be updated if build files are added outside of src/
46
46
COPY ./.git/ .git/
47
47
COPY ./src/ src/
48
+ COPY ./scripts/ scripts/
48
49
COPY ./CMakeLists.txt .
49
50
50
51
# configure and build
Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+
3
+ PROJECT_ROOT_PATH=" $( cd $( dirname " $0 " ) /../ ; pwd) "
4
+ PROJECT_GIT_DIR_PATH=" ${PROJECT_ROOT_PATH} /.git"
5
+ PROJECT_DIR_NAME=" $( basename ${PROJECT_ROOT_PATH} ) "
6
+
7
+ # if there is a .git directory at the project root then rely on git for the version string
8
+ if [ -d " ${PROJECT_GIT_DIR_PATH} " ] ; then
9
+ git describe --tags --abbrev --dirty --always
10
+ exit 0
11
+ fi
12
+
13
+ # if the proejct root directory matches the naming convetion of an extracted archive then
14
+ # get the version number out of that
15
+ if [[ " ${PROJECT_DIR_NAME} " =~ ^RTLSDR-Airband-[0-9]* \. [0-9]* \. [0-9]* $ ]]; then
16
+ echo ${PROJECT_DIR_NAME} | cut -d ' -' -f 3
17
+ exit 0
18
+ fi
19
+
20
+ # print an error string to stderr (any output to stdout is considered success)
21
+ >&2 echo " did not find a git root directory at ${PROJECT_GIT_DIR_PATH} and failed to extract a version from ${PROJECT_DIR_NAME} "
You can’t perform that action at this time.
0 commit comments