Skip to content

Commit

Permalink
A proposal for version check in clap-helpers
Browse files Browse the repository at this point in the history
As we more tightly couple clap-helpers and clap versions this
header allows us to make an "early" error if the clap versions
are incompatible.
  • Loading branch information
baconpaul committed Jan 17, 2024
1 parent 56872a9 commit 7450efe
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 0 deletions.
2 changes: 2 additions & 0 deletions include/clap/helpers/host.hh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

#include <clap/clap.h>

#include "version-check.hh"

#include "checking-level.hh"
#include "misbehaviour-handler.hh"

Expand Down
2 changes: 2 additions & 0 deletions include/clap/helpers/plugin.hh
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@

#include <clap/all.h>

#include "version-check.hh"

#include "checking-level.hh"
#include "host-proxy.hh"
#include "misbehaviour-handler.hh"
Expand Down
21 changes: 21 additions & 0 deletions include/clap/helpers/version-check.hh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#pragma once

/*
* Check the clap version against the supported versions for this version of CLAP Helpers.
* It defines two clap versions, a min and max version, and static asserts that the CLAP
* we are using is in range.
*
* Workflow wise, if you are about to make clap-helpers incompatible with a version, set
* the prior version to max, commit and push, and then move the min to current and max to 2 0 0
* again.
*/

#include "clap/version.h"

#if CLAP_VERSION_LT(1,2,0)
static_assert(false, "Clap version must be at least 1.2.0")
#endif

#if CLAP_VERSION_GE(2,0,0)
static_assert(false, "Clap version must be at most 1.x")
#endif

0 comments on commit 7450efe

Please sign in to comment.