Skip to content

Commit

Permalink
fix #340, fix #341, upversion to 3.3.2.1
Browse files Browse the repository at this point in the history
these changes allow to build from tgz / zip source without git support

Signed-off-by: Martin <[email protected]>
  • Loading branch information
Ho-Ro committed Jan 8, 2023
1 parent da618f0 commit de9d201
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 22 deletions.
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ if (GIT_EXECUTABLE AND EXISTS "${CMAKE_SOURCE_DIR}/.git")
OUTPUT_VARIABLE VERSION
OUTPUT_STRIP_TRAILING_WHITESPACE
)
message( STATUS "VERSION: ${VERSION}" )
endif()
message(STATUS "VERSION: ${VERSION}")

# Use CPack to make tgz/deb/rpm/zip installer packages
include(cmake/CPackInfos.cmake)
Expand All @@ -48,7 +48,7 @@ if( ${CMAKE_VERSION} VERSION_LESS "3.12.0" ) # deprecated, but still used in old
add_definitions( -D_GLIBCXX_ASSERTIONS )
add_definitions( -D_USE_MATH_DEFINES )
if ( DEFINED VERSION )
add_definitions( -VERSION="${VERSION}" )
add_definitions( -DVERSION="${VERSION}" )
endif()
else() # 'add_compile_definitions()' was introduced with CMake 3.12
add_compile_definitions( _GLIBCXX_ASSERTIONS )
Expand Down
13 changes: 0 additions & 13 deletions cmake/CPackInfos.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,6 @@
# A tar.gz file is created for macOS (not tested).
# A zip file is created on Windows (not tested).

if (GIT_EXECUTABLE AND EXISTS "${CMAKE_SOURCE_DIR}/.git")
execute_process(
COMMAND ${GIT_EXECUTABLE} log -1 --format=%h
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
RESULT_VARIABLE CMD_RESULT
OUTPUT_VARIABLE GIT_COMMIT_HASH
OUTPUT_STRIP_TRAILING_WHITESPACE
)
endif()
message( STATUS "GIT_COMMIT_HASH: ${GIT_COMMIT_HASH}" )

# create a changelog of the last 20 changes
set(ENV{LANG} "en_US")
execute_process(
Expand Down Expand Up @@ -137,5 +126,3 @@ set(CMAKE_INSTALL_SYSTEM_RUNTIME_DESTINATION ".")
include(InstallRequiredSystemLibraries)

cpack_add_install_type(Full DISPLAY_NAME "All")

set(VERSION ${CPACK_PACKAGE_VERSION})
18 changes: 15 additions & 3 deletions openhantek/src/OH_VERSION.h
Original file line number Diff line number Diff line change
@@ -1,19 +1,31 @@
// SPDX-License-Identifier: GPL-2.0-or-later

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


// next line shall define either OH_VERSION or LAST_OH_VERSION
//
#define OH_VERSION "3.3.2"
#define OH_VERSION "3.3.2.1"


// do not edit below

// VERSION (git describe --tags --dirty) will be shown by OpenHantek
// if VERSION is not defined then use OH_VERSION
// if this is also not defined fall back to build date

#ifndef VERSION
#ifdef OH_VERSION
#define VERSION OH_VERSION
#else
#define VERSION __DATE__
#endif
#endif

/* content of ".git/hooks/post-commit":
#!/bin/bash
Expand Down
4 changes: 0 additions & 4 deletions openhantek/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,8 @@

#include "models/modelDEMO.h"

#ifndef VERSION
#error "You need to run the cmake buildsystem!"
#endif
#include "OH_VERSION.h"


using namespace Hantek;

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

0 comments on commit de9d201

Please sign in to comment.