Skip to content

Commit 8ce18d7

Browse files
committed
Get version from CMakeLists.txt
1 parent 41d5795 commit 8ce18d7

File tree

5 files changed

+28
-8
lines changed

5 files changed

+28
-8
lines changed

.github/workflows/python.yml

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,12 @@ jobs:
2121
if [[ "${GITHUB_REF}" == refs/tags/* ]]; then
2222
version="${GITHUB_REF##*/}"
2323
else
24-
# version="$(git describe --tags).dev${GITHUB_RUN_NUMBER}"
25-
version="3.1.0.dev${GITHUB_RUN_NUMBER}"
24+
mkdir empty-build
25+
cd empty-build
26+
cmake .. -DENABLE_GUI=OFF -DENABLE_CLI=OFF -DENABLE_TESTS=OFF -DENABLE_COVERAGE=OFF -DENABLE_SANITIZERS=OFF -DENABLE_OPENMP=OFF
27+
source version.env
28+
cd ..
29+
version="${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}.dev${GITHUB_RUN_NUMBER}"
2630
fi
2731
sed -i.bak "s/^version = .*/version = \"${version}\"/g" pyproject.toml && rm pyproject.toml.bak
2832
python -m pip install -U setuptools build
@@ -108,8 +112,12 @@ jobs:
108112
if [[ "${GITHUB_REF}" == refs/tags/* ]]; then
109113
version="${GITHUB_REF##*/}"
110114
else
111-
# version="$(git describe --tags).dev${GITHUB_RUN_NUMBER}"
112-
version="3.1.0.dev${GITHUB_RUN_NUMBER}"
115+
mkdir empty-build
116+
cd empty-build
117+
cmake .. -DENABLE_GUI=OFF -DENABLE_CLI=OFF -DENABLE_TESTS=OFF -DENABLE_COVERAGE=OFF -DENABLE_SANITIZERS=OFF -DENABLE_OPENMP=OFF
118+
source version.env
119+
cd ..
120+
version="${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}.dev${GITHUB_RUN_NUMBER}"
113121
fi
114122
sed -i.bak "s/^version = .*/version = \"${version}\"/g" pyproject.toml && rm pyproject.toml.bak
115123
- name: Set up QEMU

.github/workflows/wasmlib.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,12 @@ jobs:
5555
if [[ "${GITHUB_REF}" == refs/tags/* ]]; then
5656
version="${GITHUB_REF##*/}"
5757
else
58-
version="3.1.0-dev.${GITHUB_RUN_NUMBER}"
58+
mkdir empty-build
59+
cd empty-build
60+
cmake .. -DENABLE_GUI=OFF -DENABLE_CLI=OFF -DENABLE_TESTS=OFF -DENABLE_COVERAGE=OFF -DENABLE_SANITIZERS=OFF -DENABLE_OPENMP=OFF
61+
source version.env
62+
cd ..
63+
version="${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}-dev.${GITHUB_RUN_NUMBER}"
5964
is_dev="1"
6065
fi
6166
jq --arg version "${version}" '.version = $version' package.json > package.json.tmp

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "slvs",
3-
"version": "1.0.0",
3+
"version": "0.0.0",
44
"description": "<img src=\"res/freedesktop/solvespace-scalable.svg\" width=\"70\" height=\"70\" alt=\"SolveSpace Logo\" align=\"left\">",
55
"main": "slvs.js",
66
"types": "slvs.d.ts",

pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ build-backend = "scikit_build_core.build"
44

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

src/CMakeLists.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,13 @@ if(ENABLE_EMSCRIPTEN_LIB)
118118
--closure 1")
119119
endif()
120120

121+
file(WRITE ${CMAKE_BINARY_DIR}/version.env "\
122+
VERSION_MAJOR=${PROJECT_VERSION_MAJOR}\n\
123+
VERSION_MINOR=${PROJECT_VERSION_MINOR}\n\
124+
VERSION_PATCH=0\n\
125+
VERSION_GIT_HASH=${solvespace_GIT_HASH}\n\
126+
")
127+
121128
if(ENABLE_PYTHON_LIB)
122129
add_custom_command(
123130
OUTPUT lib.c

0 commit comments

Comments
 (0)