Get version from CMakeLists.txt

pull/1343/head
Koen Schmeets 2023-02-27 23:04:44 +01:00
parent 41d5795735
commit 8ce18d7240
5 changed files with 28 additions and 8 deletions

View File

@ -21,8 +21,12 @@ jobs:
if [[ "${GITHUB_REF}" == refs/tags/* ]]; then
version="${GITHUB_REF##*/}"
else
# version="$(git describe --tags).dev${GITHUB_RUN_NUMBER}"
version="3.1.0.dev${GITHUB_RUN_NUMBER}"
mkdir empty-build
cd empty-build
cmake .. -DENABLE_GUI=OFF -DENABLE_CLI=OFF -DENABLE_TESTS=OFF -DENABLE_COVERAGE=OFF -DENABLE_SANITIZERS=OFF -DENABLE_OPENMP=OFF
source version.env
cd ..
version="${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}.dev${GITHUB_RUN_NUMBER}"
fi
sed -i.bak "s/^version = .*/version = \"${version}\"/g" pyproject.toml && rm pyproject.toml.bak
python -m pip install -U setuptools build
@ -108,8 +112,12 @@ jobs:
if [[ "${GITHUB_REF}" == refs/tags/* ]]; then
version="${GITHUB_REF##*/}"
else
# version="$(git describe --tags).dev${GITHUB_RUN_NUMBER}"
version="3.1.0.dev${GITHUB_RUN_NUMBER}"
mkdir empty-build
cd empty-build
cmake .. -DENABLE_GUI=OFF -DENABLE_CLI=OFF -DENABLE_TESTS=OFF -DENABLE_COVERAGE=OFF -DENABLE_SANITIZERS=OFF -DENABLE_OPENMP=OFF
source version.env
cd ..
version="${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}.dev${GITHUB_RUN_NUMBER}"
fi
sed -i.bak "s/^version = .*/version = \"${version}\"/g" pyproject.toml && rm pyproject.toml.bak
- name: Set up QEMU

View File

@ -55,7 +55,12 @@ jobs:
if [[ "${GITHUB_REF}" == refs/tags/* ]]; then
version="${GITHUB_REF##*/}"
else
version="3.1.0-dev.${GITHUB_RUN_NUMBER}"
mkdir empty-build
cd empty-build
cmake .. -DENABLE_GUI=OFF -DENABLE_CLI=OFF -DENABLE_TESTS=OFF -DENABLE_COVERAGE=OFF -DENABLE_SANITIZERS=OFF -DENABLE_OPENMP=OFF
source version.env
cd ..
version="${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}-dev.${GITHUB_RUN_NUMBER}"
is_dev="1"
fi
jq --arg version "${version}" '.version = $version' package.json > package.json.tmp

View File

@ -1,6 +1,6 @@
{
"name": "slvs",
"version": "1.0.0",
"version": "0.0.0",
"description": "<img src=\"res/freedesktop/solvespace-scalable.svg\" width=\"70\" height=\"70\" alt=\"SolveSpace Logo\" align=\"left\">",
"main": "slvs.js",
"types": "slvs.d.ts",

View File

@ -4,8 +4,8 @@ build-backend = "scikit_build_core.build"
[project]
name = "solvespace"
version = "3.1.0"
description="A minimal example package (with pybind11)"
version = "0.0.0"
description="SolveSpace solver wrapped with Cython"
readme = "README.md"
authors = [
{ name = "Koen Schmeets", email = "koen@schmeets.de" },

View File

@ -118,6 +118,13 @@ if(ENABLE_EMSCRIPTEN_LIB)
--closure 1")
endif()
file(WRITE ${CMAKE_BINARY_DIR}/version.env "\
VERSION_MAJOR=${PROJECT_VERSION_MAJOR}\n\
VERSION_MINOR=${PROJECT_VERSION_MINOR}\n\
VERSION_PATCH=0\n\
VERSION_GIT_HASH=${solvespace_GIT_HASH}\n\
")
if(ENABLE_PYTHON_LIB)
add_custom_command(
OUTPUT lib.c