Skip to content

Commit

Permalink
Updated version config to mirror that of milk
Browse files Browse the repository at this point in the history
Created ImageStreamIO_config.h.in that defines project name & version
params.
Version gets set in CMakeLists.txt and config header gets dynamically
generated.
Updated ImageStruct.h to include ImageStreamIO_config.h.
Added ImageStreamIO_config.h to .gitignore.
  • Loading branch information
stefi07 authored and DasVinch committed Aug 29, 2024
1 parent 33de558 commit 31ce189
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 7 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@ ImCreate_test
ImCreate_cube
ImageStreamIOWrap.egg-info
setup.cfg
ImageStreamIO_config.h
17 changes: 11 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,17 @@ option(gtest_build_tests "Build Unit Tests" OFF)

project(${LIBNAME} LANGUAGES C)

# Read version from ImageStruct.h
file(READ "ImageStruct.h" header)
string(REGEX MATCH "#define IMAGESTRUCT_VERSION \"[0-9\.]+\"" versiondef "${header}")
string(REGEX MATCH "[0-9]+" IMAGESTRUCT_VERSION "${versiondef}")
set(PROJECT_VERSION ${IMAGESTRUCT_VERSION})
message(" VERSION: ${PROJECT_VERSION}")
# Version number
set ( VERSION_MAJOR 2 )
set ( VERSION_MINOR 00 )
set ( VERSION_PATCH 00 )
set ( VERSION_OPTION "" )
set ( PROJECT_VERSION "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}" )
configure_file (
"${PROJECT_SOURCE_DIR}/${PROJECT_NAME}_config.h.in"
"${PROJECT_SOURCE_DIR}//${PROJECT_NAME}_config.h"
)
message(" VERSION = ${PROJECT_VERSION}")

add_compile_options(-Ofast)

Expand Down
6 changes: 6 additions & 0 deletions ImageStreamIO_config.h.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#define PROJECT_NAME "@PROJECT_NAME@"
#define VERSION_MAJOR @VERSION_MAJOR@
#define VERSION_MINOR @VERSION_MINOR@
#define VERSION_PATCH @VERSION_PATCH@
#define VERSION_OPTION "@VERSION_OPTION@"
#define IMAGESTRUCT_VERSION "@VERSION_MAJOR@.@VERSION_MINOR@"
3 changes: 2 additions & 1 deletion ImageStruct.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
#ifndef _IMAGESTRUCT_H
#define _IMAGESTRUCT_H

#define IMAGESTRUCT_VERSION "2.00"
#include "ImageStreamIO_config.h"
// #define IMAGESTRUCT_VERSION "2.00"

#define STRINGMAXLEN_IMAGE_NAME 80
#define STRINGMAXLEN_FILE_NAME 200
Expand Down

0 comments on commit 31ce189

Please sign in to comment.