Skip to content

Commit

Permalink
Add defines for OQS version components (#2000)
Browse files Browse the repository at this point in the history
* Add defines for OQS version components

Signed-off-by: Douglas Stebila <[email protected]>

* Set OQS_VERSION_TEXT based on new OQS_VERSION_* macros

Co-authored-by: Spencer Wilson <[email protected]>
Signed-off-by: Douglas Stebila <[email protected]>
Signed-off-by: Douglas Stebila <[email protected]>

* Make OQS_VERSION_PRE_RELEASE optionally defined

Co-authored-by: Spencer Wilson <[email protected]>
Signed-off-by: Douglas Stebila <[email protected]>
Signed-off-by: Douglas Stebila <[email protected]>

* Add documentation about OQS_VERSION macros

Signed-off-by: Douglas Stebila <[email protected]>

* Clarify wording about definition of OQS_VERSION_PRE_RELEASE

Signed-off-by: Douglas Stebila <[email protected]>

---------

Signed-off-by: Douglas Stebila <[email protected]>
Signed-off-by: Douglas Stebila <[email protected]>
Co-authored-by: Spencer Wilson <[email protected]>
  • Loading branch information
dstebila and SWilson4 authored Nov 26, 2024
1 parent d9c214c commit 3224d55
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 2 deletions.
6 changes: 5 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,11 @@ set(CMAKE_C_STANDARD 11)
set(CMAKE_C_STANDARD_REQUIRED ON)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
set(CMAKE_C_VISIBILITY_PRESET hidden)
set(OQS_VERSION_TEXT "0.11.1-dev")
set(OQS_VERSION_MAJOR 0)
set(OQS_VERSION_MINOR 11)
set(OQS_VERSION_PATCH 1)
set(OQS_VERSION_PRE_RELEASE "-dev")
set(OQS_VERSION_TEXT "${OQS_VERSION_MAJOR}.${OQS_VERSION_MINOR}.${OQS_VERSION_PATCH}${OQS_VERSION_PRE_RELEASE}")
set(OQS_COMPILE_BUILD_TARGET "${CMAKE_SYSTEM_PROCESSOR}-${CMAKE_HOST_SYSTEM}")
set(OQS_MINIMAL_GCC_VERSION "7.1.0")
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
Expand Down
15 changes: 15 additions & 0 deletions src/oqsconfig.h.cmake
Original file line number Diff line number Diff line change
@@ -1,6 +1,21 @@
// SPDX-License-Identifier: MIT

/**
* Version of liboqs as a string. Equivalent to {MAJOR}.{MINOR}.{PATCH}{PRE_RELEASE}
*/
#cmakedefine OQS_VERSION_TEXT "@OQS_VERSION_TEXT@"
/**
* Version levels of liboqs as integers.
*/
#define OQS_VERSION_MAJOR @OQS_VERSION_MAJOR@
#define OQS_VERSION_MINOR @OQS_VERSION_MINOR@
#define OQS_VERSION_PATCH @OQS_VERSION_PATCH@
/**
* OQS_VERSION_PRE_RELEASE is defined if this is a pre-release version of liboqs, otherwise it is undefined.
* Examples: "-dev" or "-rc1".
*/
#cmakedefine OQS_VERSION_PRE_RELEASE "@OQS_VERSION_PRE_RELEASE@"

#cmakedefine OQS_COMPILE_BUILD_TARGET "@OQS_COMPILE_BUILD_TARGET@"
#cmakedefine OQS_DIST_BUILD 1
#cmakedefine OQS_DIST_X86_64_BUILD 1
Expand Down
6 changes: 5 additions & 1 deletion tests/system_info.c
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,11 @@ static void print_oqs_configuration(void) {
* USE_SANITIZER: -fsanitize= option present in compile options
* OQS_ENABLE_TEST_CONSTANT_TIME: only shown below
*/
printf("OQS version: %s\n", OQS_VERSION_TEXT);
#if defined(OQS_VERSION_PRE_RELEASE)
printf("OQS version: %s (major: %d, minor: %d, patch: %d, pre-release: %s)\n", OQS_VERSION_TEXT, OQS_VERSION_MAJOR, OQS_VERSION_MINOR, OQS_VERSION_PATCH, OQS_VERSION_PRE_RELEASE);
#else
printf("OQS version: %s (major: %d, minor: %d, patch: %d)\n", OQS_VERSION_TEXT, OQS_VERSION_MAJOR, OQS_VERSION_MINOR, OQS_VERSION_PATCH);
#endif
#if defined(OQS_COMPILE_GIT_COMMIT)
printf("Git commit: %s\n", OQS_COMPILE_GIT_COMMIT);
#endif
Expand Down

0 comments on commit 3224d55

Please sign in to comment.