Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide a numeric version number to compare against. #1054

Merged
merged 1 commit into from
Nov 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions cmake/version.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,13 @@
#define MANIFOLD_VERSION_MAJOR @MANIFOLD_VERSION_MAJOR@
#define MANIFOLD_VERSION_MINOR @MANIFOLD_VERSION_MINOR@
#define MANIFOLD_VERSION_PATCH @MANIFOLD_VERSION_PATCH@

// Comparable version numbers to check version in code or preprocessing.
// Check if your minimum requirements are met with e.g.
// MANIFOLD_VERSION > MANIFOLD_VERSION_NUMBER(2, 5, 1)
#define MANIFOLD_VERSION_NUMBER(v_major, v_minor, v_patch) \
(((v_major) * 1000000) + ((v_minor) * 1000) + (v_patch))

#define MANIFOLD_VERSION MANIFOLD_VERSION_NUMBER(MANIFOLD_VERSION_MAJOR, \
MANIFOLD_VERSION_MINOR, \
MANIFOLD_VERSION_PATCH)
6 changes: 5 additions & 1 deletion scripts/test-cmake.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ EOT
cat <<EOT > test.cpp
#include <manifold/manifold.h>
#include <manifold/version.h>

#if MANIFOLD_VERSION < MANIFOLD_VERSION_NUMBER(2, 5, 1)
# error "Unexpected: minimum version number not available"
#endif

int main() { manifold::Manifold foo; return 0; }
EOT

Expand All @@ -21,4 +26,3 @@ cd build
cmake ..
make
./testing

5 changes: 5 additions & 0 deletions scripts/test-pkgconfig.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ EOT
cat <<EOT > testing.cpp
#include <manifold/manifold.h>
#include <manifold/version.h>

#if MANIFOLD_VERSION < MANIFOLD_VERSION_NUMBER(2, 5, 1)
# error "Unexpected: minimum version number not available"
#endif

int main() { manifold::Manifold foo; return 0; }
EOT

Expand Down
Loading