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

Add defines for OQS version components #2000

Merged
merged 5 commits into from
Nov 26, 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
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)
baentsch marked this conversation as resolved.
Show resolved Hide resolved
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);
dstebila marked this conversation as resolved.
Show resolved Hide resolved
#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
Loading