Skip to content

Commit de9d201

Browse files
committed
fix #340, fix #341, upversion to 3.3.2.1
these changes allow to build from tgz / zip source without git support Signed-off-by: Martin <[email protected]>
1 parent da618f0 commit de9d201

File tree

4 files changed

+17
-22
lines changed

4 files changed

+17
-22
lines changed

CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ if (GIT_EXECUTABLE AND EXISTS "${CMAKE_SOURCE_DIR}/.git")
2424
OUTPUT_VARIABLE VERSION
2525
OUTPUT_STRIP_TRAILING_WHITESPACE
2626
)
27-
message( STATUS "VERSION: ${VERSION}" )
2827
endif()
28+
message(STATUS "VERSION: ${VERSION}")
2929

3030
# Use CPack to make tgz/deb/rpm/zip installer packages
3131
include(cmake/CPackInfos.cmake)
@@ -48,7 +48,7 @@ if( ${CMAKE_VERSION} VERSION_LESS "3.12.0" ) # deprecated, but still used in old
4848
add_definitions( -D_GLIBCXX_ASSERTIONS )
4949
add_definitions( -D_USE_MATH_DEFINES )
5050
if ( DEFINED VERSION )
51-
add_definitions( -VERSION="${VERSION}" )
51+
add_definitions( -DVERSION="${VERSION}" )
5252
endif()
5353
else() # 'add_compile_definitions()' was introduced with CMake 3.12
5454
add_compile_definitions( _GLIBCXX_ASSERTIONS )

cmake/CPackInfos.cmake

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,6 @@
33
# A tar.gz file is created for macOS (not tested).
44
# A zip file is created on Windows (not tested).
55

6-
if (GIT_EXECUTABLE AND EXISTS "${CMAKE_SOURCE_DIR}/.git")
7-
execute_process(
8-
COMMAND ${GIT_EXECUTABLE} log -1 --format=%h
9-
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
10-
RESULT_VARIABLE CMD_RESULT
11-
OUTPUT_VARIABLE GIT_COMMIT_HASH
12-
OUTPUT_STRIP_TRAILING_WHITESPACE
13-
)
14-
endif()
15-
message( STATUS "GIT_COMMIT_HASH: ${GIT_COMMIT_HASH}" )
16-
176
# create a changelog of the last 20 changes
187
set(ENV{LANG} "en_US")
198
execute_process(
@@ -137,5 +126,3 @@ set(CMAKE_INSTALL_SYSTEM_RUNTIME_DESTINATION ".")
137126
include(InstallRequiredSystemLibraries)
138127

139128
cpack_add_install_type(Full DISPLAY_NAME "All")
140-
141-
set(VERSION ${CPACK_PACKAGE_VERSION})

openhantek/src/OH_VERSION.h

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,31 @@
11
// SPDX-License-Identifier: GPL-2.0-or-later
22

3-
// define OH_VERSION as the version that is shown on top of the program
3+
// set OH_VERSION to define a release
44
// if defined in this file it will tag the commit automatically
55
// via .git/hooks/post-commit (see below)
66
// the hook will then renamed from OH_VERSION to LAST_OH_VERSION
77
//
8-
// if OH_VERSION is undefined VERSION ($COMMIT_DATE-$COMMIT_HASH) will be shown by OpenHantek
8+
99

1010
// next line shall define either OH_VERSION or LAST_OH_VERSION
1111
//
12-
#define OH_VERSION "3.3.2"
12+
#define OH_VERSION "3.3.2.1"
1313

1414

1515
// do not edit below
1616

17+
// VERSION (git describe --tags --dirty) will be shown by OpenHantek
18+
// if VERSION is not defined then use OH_VERSION
19+
// if this is also not defined fall back to build date
20+
21+
#ifndef VERSION
22+
#ifdef OH_VERSION
23+
#define VERSION OH_VERSION
24+
#else
25+
#define VERSION __DATE__
26+
#endif
27+
#endif
28+
1729
/* content of ".git/hooks/post-commit":
1830
1931
#!/bin/bash

openhantek/src/main.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,12 +59,8 @@
5959

6060
#include "models/modelDEMO.h"
6161

62-
#ifndef VERSION
63-
#error "You need to run the cmake buildsystem!"
64-
#endif
6562
#include "OH_VERSION.h"
6663

67-
6864
using namespace Hantek;
6965

7066
// verboseLevel allows the fine granulated tracing of the program for easy testing and debugging

0 commit comments

Comments
 (0)