From 021857c7c081b328efac3817dcdc7b769c0cb6d6 Mon Sep 17 00:00:00 2001 From: Shahram Najm Date: Tue, 25 Jun 2013 10:52:05 +0100 Subject: [PATCH] SHA1 hash and other cleanups --- python/CMakeLists.txt | 2 -- src/CMakeLists.txt | 5 +++++ src/grib_api.h | 7 +++++++ src/grib_api_version.c.in | 3 +++ 4 files changed, 15 insertions(+), 2 deletions(-) create mode 100644 src/grib_api_version.c.in diff --git a/python/CMakeLists.txt b/python/CMakeLists.txt index cc536d721..5256b8d61 100644 --- a/python/CMakeLists.txt +++ b/python/CMakeLists.txt @@ -1,7 +1,5 @@ if( GRIB_API_PYTHON ) - message( WARNING "support for Python with CMake needs testing" ) - ecbuild_find_python( VERSION 2.5 ) find_package( SWIG ) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index e8af938f7..0053f554a 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -307,6 +307,8 @@ list( APPEND grib_api_srcs # grib_bits_any_endian_simple.c # ) +configure_file( grib_api_version.c.in grib_api_version.c @ONLY ) + ecbuild_generate_yy( YYPREFIX grib_yy YACC griby LEX gribl @@ -314,9 +316,12 @@ ecbuild_generate_yy( YYPREFIX grib_yy ecbuild_add_library( TARGET grib_api SOURCES + grib_api_version.c griby.c gribl.c ${grib_api_extra_srcs} ${grib_api_srcs} + GENERATED + grib_api_version.c INCLUDES ${GRIB_API_EXTRA_INCLUDE_DIRS} LIBS diff --git a/src/grib_api.h b/src/grib_api.h index ee4b661b4..7894f9378 100644 --- a/src/grib_api.h +++ b/src/grib_api.h @@ -1215,6 +1215,13 @@ void grib_multi_support_reset_file(grib_context* c, FILE* f); */ long grib_get_api_version(void); +/** +* Get the Git version control SHA1 identifier +* +* @return character string with SHA1 identifier +*/ +const char* grib_get_git_sha1(void); + /** * Prints the API version * diff --git a/src/grib_api_version.c.in b/src/grib_api_version.c.in new file mode 100644 index 000000000..1393a3f70 --- /dev/null +++ b/src/grib_api_version.c.in @@ -0,0 +1,3 @@ +#include "grib_api_internal.h" + +const char * grib_get_git_sha1() { return "@GRIB_API_GIT_SHA1@"; }