From 0c414fc8a6760dad0fbe4bed6482f9d052d0bd24 Mon Sep 17 00:00:00 2001 From: "Scott E. Graves" Date: Tue, 9 Jul 2024 13:12:02 -0500 Subject: [PATCH] updated build system --- CMakeLists.txt | 5 +++++ scripts/make_package.cmd | 11 +++++------ scripts/make_package.sh | 6 ++++-- 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e91b4e15..bb37768e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -32,6 +32,11 @@ if(PROJECT_BUILD) ) include(project.cmake) + + if (PROJECT_VERSION) + file(WRITE ${CMAKE_CURRENT_SOURCE_DIR}/dist/version.sh "export PROJECT_VERSION=${PROJECT_VERSION}") + add_definitions(-DPROJECT_VERSION=${PROJECT_VERSION}) + endif() else() message(STATUS "-=[CMake Settings]=-") message(STATUS " C standard: ${CMAKE_C_STANDARD}") diff --git a/scripts/make_package.cmd b/scripts/make_package.cmd index a6955ea9..32478fb7 100644 --- a/scripts/make_package.cmd +++ b/scripts/make_package.cmd @@ -2,12 +2,11 @@ setlocal -set VERSION=%~1 -set DEST=%~2 -set ARG1=%~3 -set ARG2=%~4 -set ARG3=%~5 +set DEST=%~1 +set ARG1=%~2 +set ARG2=%~3 +set ARG3=%~4 pushd "%~dp0%" - call mingw64 -no-start ./make_package.sh "%VERSION%" "%DEST%" "%ARG1%" "%ARG2%" "%ARG3%" 1 0 || exit 1 + call mingw64 -no-start ./make_package.sh "%DEST%" "%ARG1%" "%ARG2%" "%ARG3%" 1 0 || exit 1 popd diff --git a/scripts/make_package.sh b/scripts/make_package.sh index 0c66fa0f..a7a95a99 100644 --- a/scripts/make_package.sh +++ b/scripts/make_package.sh @@ -1,14 +1,16 @@ #!/bin/bash -PROJECT_VERSION=$1 DEST_DIR=$(realpath $2) +TEMP_DIR=$(mktemp -d) CURRENT_DIR=$(dirname "$0") CURRENT_DIR=$(realpath ${CURRENT_DIR}) . "${CURRENT_DIR}/env.sh" "$3" "$4" "$5" "$6" "$7" -TEMP_DIR=$(mktemp -d) +if [ -f "../dist/version.sh" ]; then + source ../dist/version.sh +fi function exit_and_clean() { echo $1