-
Notifications
You must be signed in to change notification settings - Fork 61
Open
Description
Currently version of Colvars is set by the colvars_version.h:
Lines 1 to 3 in ec89df1
| #ifndef COLVARS_VERSION | |
| #define COLVARS_VERSION "2025-05-12" | |
| #endif |
It is a bit difficult to compare different Colvars version strings and compile external C++ code conditionally based on different versions of Colvars. I am a bit worried that by introducing #788, any 3rd C++ code (for example, those code in https://www.ks.uiuc.edu/Training/Tutorials/#namd:~:text=Customizing%20CVs%20in%20NAMD%3A) relying on the Colvars internal APIs won't work, so it would be better to provide a way to conditionally compile C++ code based on the Colvars version.
I propose the following solution:
#ifndef COLVARS_VERSION
#include <cstdint>
#define COLVARS_VERSION_YEAR 2025
#define COLVARS_VERSION_MONTH 05
#define COLVARS_VERSION_DATE 12
#define COLVARS_VERSION_STR_HELPER(x) #x
#define COLVARS_VERSION_STR(x) COLVARS_VERSION_STR_HELPER(x)
#define COLVARS_VERSION \
COLVARS_VERSION_STR(COLVARS_VERSION_YEAR) "-"\
COLVARS_VERSION_STR(COLVARS_VERSION_MONTH) "-"\
COLVARS_VERSION_STR(COLVARS_VERSION_DATE)
#define COLVARS_VERSION_UINT64(a,b,c) \
((UINT64_C(a) << 16) + (UINT64_C(b) << 8) + UINT64_C(c))
#define COLVARS_VERSION_UINT64_CURRENT \
COLVARS_VERSION_UINT64(COLVARS_VERSION_YEAR, \
COLVARS_VERSION_MONTH, \
COLVARS_VERSION_DATE)
#endifBut it looks like that will break other shell scripts.
Metadata
Metadata
Assignees
Labels
No labels