From 79d96eba9bce40c1c6750b333563cecdf5d0d22d Mon Sep 17 00:00:00 2001 From: Mathis Rosenhauer <rosenhauer@dkrz.de> Date: Sun, 19 Feb 2023 12:02:12 +0100 Subject: [PATCH] Put version information in libaec.h --- CMakeLists.txt | 6 ++++++ configure.ac | 13 +++++++++++-- include/{libaec.h => libaec.h.in} | 5 +++++ src/CMakeLists.txt | 2 +- src/Makefile.am | 2 +- tests/Makefile.am | 6 +++--- 6 files changed, 27 insertions(+), 7 deletions(-) rename include/{libaec.h => libaec.h.in} (95%) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6f75ead..d05dde0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -38,6 +38,11 @@ configure_file( "cmake/config.h.in" "${CMAKE_CURRENT_BINARY_DIR}/config.h") +# Create libaec.h with current version information +configure_file( + "include/libaec.h.in" + "${CMAKE_CURRENT_BINARY_DIR}/include/libaec.h") + add_subdirectory(src) if(BUILD_TESTING) add_subdirectory(tests) @@ -89,6 +94,7 @@ endif() set(CPACK_SOURCE_IGNORE_FILES /.git /.*build.* + /*.cache .*~ .*\#.*\# \..*\#.*) diff --git a/configure.ac b/configure.ac index bac0fed..e2ba962 100644 --- a/configure.ac +++ b/configure.ac @@ -1,5 +1,14 @@ AC_PREREQ([2.64]) -AC_INIT([libaec], [1.0.6], [rosenhauer@dkrz.de]) + +m4_define([VERSION_MAJOR], [1]) +m4_define([VERSION_MINOR], [0]) +m4_define([VERSION_PATCH], [6]) + +AC_INIT([libaec], [VERSION_MAJOR.VERSION_MINOR.VERSION_PATCH], [rosenhauer@dkrz.de]) + +AC_SUBST(PROJECT_VERSION_MAJOR, [VERSION_MAJOR]) +AC_SUBST(PROJECT_VERSION_MINOR, [VERSION_MINOR]) +AC_SUBST(PROJECT_VERSION_PATCH, [VERSION_PATCH]) AC_CONFIG_MACRO_DIR([m4]) AC_CONFIG_AUX_DIR([config]) @@ -30,5 +39,5 @@ AC_CHECK_DECLS(__builtin_clzll) AM_EXTRA_RECURSIVE_TARGETS([bench benc bdec]) -AC_CONFIG_FILES([Makefile src/Makefile tests/Makefile]) +AC_CONFIG_FILES([Makefile src/Makefile tests/Makefile include/libaec.h]) AC_OUTPUT diff --git a/include/libaec.h b/include/libaec.h.in similarity index 95% rename from include/libaec.h rename to include/libaec.h.in index b159f34..a38bc70 100644 --- a/include/libaec.h +++ b/include/libaec.h.in @@ -38,6 +38,11 @@ #ifndef LIBAEC_H #define LIBAEC_H 1 +#define AEC_VERSION_MAJOR @PROJECT_VERSION_MAJOR@ +#define AEC_VERSION_MINOR @PROJECT_VERSION_MINOR@ +#define AEC_VERSION_PATCH @PROJECT_VERSION_PATCH@ +#define AEC_VERSION_STR "@PROJECT_VERSION_MAJOR@.@PROJECT_VERSION_MINOR@.@PROJECT_VERSION_PATCH@" + #include <stddef.h> #ifdef __cplusplus diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 29d62f2..31a7336 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -24,7 +24,7 @@ set_target_properties(aec_shared VERSION 0.0.12 SOVERSION 0 OUTPUT_NAME aec - PUBLIC_HEADER ../include/libaec.h) + PUBLIC_HEADER ${CMAKE_CURRENT_BINARY_DIR}/../include/libaec.h) # Wrapper for compatibility with szip add_library(sz OBJECT sz_compat.c) diff --git a/src/Makefile.am b/src/Makefile.am index 0ac4914..e263a22 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -9,7 +9,7 @@ libsz_la_SOURCES = sz_compat.c libsz_la_LIBADD = libaec.la libsz_la_LDFLAGS = -version-info 2:1:0 -no-undefined -include_HEADERS = $(top_srcdir)/include/libaec.h $(top_srcdir)/include/szlib.h +include_HEADERS = $(top_builddir)/include/libaec.h $(top_srcdir)/include/szlib.h bin_PROGRAMS = aec noinst_PROGRAMS = utime diff --git a/tests/Makefile.am b/tests/Makefile.am index ef122ea..50b2036 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -10,13 +10,13 @@ check_PROGRAMS = check_code_options check_buffer_sizes check_long_fs \ check_szcomp check_code_options_SOURCES = check_code_options.c check_aec.h \ -$(top_srcdir)/include/libaec.h +$(top_builddir)/include/libaec.h check_buffer_sizes_SOURCES = check_buffer_sizes.c check_aec.h \ -$(top_srcdir)/include/libaec.h +$(top_builddir)/include/libaec.h check_long_fs_SOURCES = check_long_fs.c check_aec.h \ -$(top_srcdir)/include/libaec.h +$(top_builddir)/include/libaec.h check_szcomp_SOURCES = check_szcomp.c $(top_srcdir)/include/szlib.h -- GitLab