From 422bfa2b6f9932ed20abca0f9d22272790169e09 Mon Sep 17 00:00:00 2001 From: Joshua Saxby Date: Sun, 28 Aug 2016 14:57:36 +0100 Subject: [PATCH] Use version set in CMake file for build_logo and func_test Also use this as a macro in PNG render backend rather than build string in C --- CMakeLists.txt | 10 ++++++++-- build_logo.sh | 7 ++++--- func_test.sh | 5 +++-- saxbospiral.png | Bin 615 -> 641 bytes saxbospiral/render_backends/png_backend.c | 9 ++------- 5 files changed, 17 insertions(+), 14 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 065e877..8feeecf 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,12 +5,18 @@ enable_language(C CXX) project(saxbospiral VERSION 0.9.0 LANGUAGES C) set(CMAKE_C_STANDARD 99) set(CMAKE_C_STANDARD_REQUIRED ON) +set( + SAXBOSPIRAL_VERSION_STRING + "v${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}" +) +set(SAXBOSPIRAL_ESCAPED_VERSION_STRING "\"${SAXBOSPIRAL_VERSION_STRING}\"") # end basic metadata # pass in version of library as preprocessor definitions add_definitions(-DSAXBOSPIRAL_VERSION_MAJOR=${PROJECT_VERSION_MAJOR}) add_definitions(-DSAXBOSPIRAL_VERSION_MINOR=${PROJECT_VERSION_MINOR}) add_definitions(-DSAXBOSPIRAL_VERSION_PATCH=${PROJECT_VERSION_PATCH}) +add_definitions(-DSAXBOSPIRAL_VERSION_STRING=${SAXBOSPIRAL_ESCAPED_VERSION_STRING}) include(CheckCCompilerFlag) @@ -93,11 +99,11 @@ if(COMMAND_INTERPRETER) add_test( NAME func_test COMMAND ${COMMAND_INTERPRETER} # each script needs to know the path to each executable it runs - "func_test.sh" sxp_prepare sxp_generate sxp_render + "func_test.sh" sxp_prepare sxp_generate sxp_render "saxbospiral ${SAXBOSPIRAL_VERSION_STRING}" ) add_custom_target( build_logo ${COMMAND_INTERPRETER} - "build_logo.sh" sxp_prepare sxp_generate sxp_render "saxbospiral.png" + "build_logo.sh" sxp_prepare sxp_generate sxp_render "saxbospiral.png" "saxbospiral ${SAXBOSPIRAL_VERSION_STRING}" ) else() # warn about skipping of functional test script diff --git a/build_logo.sh b/build_logo.sh index dc5e829..1da7bbe 100755 --- a/build_logo.sh +++ b/build_logo.sh @@ -2,11 +2,12 @@ # # Script for updating the project logo # The paths of the prepare, generate and render commands are -# passed as the first 3 arguments. The last argument is the -# file to write the PNG output to. +# passed as the first 3 arguments. The 4th argument is the +# file to write the PNG output to and the 5th is the message +# to use for the logo data (of format "saxbospiral vX.Y.Z") # echo "Generating logo"; -echo -n "saxbospiral `git describe --abbrev=0`" > temp.hex && \ +echo -n "$5" > temp.hex && \ ./"$1" temp.hex temp.sxp && \ ./"$2" temp.sxp && \ ./"$3" temp.sxp "$4" && \ diff --git a/func_test.sh b/func_test.sh index 2f2af8d..f663cca 100755 --- a/func_test.sh +++ b/func_test.sh @@ -3,8 +3,9 @@ # Functional test script. # Generates a new logo and compares with the current one. # The paths of the prepare, generate and render commands are -# passed as the first 3 arguments. +# passed as the first 3 arguments. The 4th argument is the +# message to use for the file (see build_logo.sh) # -./build_logo.sh "$1" "$2" "$3" "test_saxbospiral.png" && \ +./build_logo.sh "$1" "$2" "$3" "test_saxbospiral.png" "$4" && \ diff "saxbospiral.png" "test_saxbospiral.png" && \ rm "test_saxbospiral.png"; diff --git a/saxbospiral.png b/saxbospiral.png index 7c371c3c1c05155a932f0accabfd0281abe0c157..7a74ae54d2637a38f8fcc64590b42fe50aa61e75 100644 GIT binary patch delta 334 zcmV-U0kQt)1c3!1iBL{Q4GJ0x0000DNk~Le0000z0000%0RR910806h{;?rH0e=At zNkl4gzW)0rM*edpwE`2v@8k-ltc5tr#{Z3*#dP4MXR^ zGY*_I86zh? zhvc<%RT5ikYzo_rARe7y**1V9U8Zxl54wzdHnAYg8%Y-DN$_-01(Dw`7$cP0736`H gRXnhV|KBEsKS#)t=M}F=wEzGB07*qoM6N<$f|0O?A^-pY delta 308 zcmV-40n7e@1?L1IiBL{Q4GJ0x0000DNk~Le0000n0000#0RR910AcMN!LcDf0e=AT zNklMQI;kfHg@E#$rHfR$N^c6%Kxq#aq8@PQH(JleE4Oy6V zzN$;}Ak>$>jwl4Ko;KF0+C2Tfn1#&#(M-vF-