Output documented build options (#1155)

* explaining all config options in system_info output
This commit is contained in:
Michael Baentsch 2021-12-13 15:33:19 +01:00 committed by GitHub
parent abf1080ddd
commit ae6c7b4798
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 61 additions and 4 deletions

View File

@ -12,6 +12,11 @@
#cmakedefine ARCH_X86_64 1
#cmakedefine ARCH_ARM64v8 1
#cmakedefine ARCH_ARM32v7 1
#cmakedefine BUILD_SHARED_LIBS 1
#cmakedefine OQS_BUILD_ONLY_LIB 1
#cmakedefine OQS_OPT_TARGET "@OQS_OPT_TARGET@"
#cmakedefine USE_SANITIZER "@USE_SANITIZER@"
#cmakedefine CMAKE_BUILD_TYPE "@CMAKE_BUILD_TYPE@"
#cmakedefine OQS_USE_OPENSSL 1
#cmakedefine OQS_USE_AES_OPENSSL 1

View File

@ -28,14 +28,18 @@ static void print_compiler_info(void) {
// based on macros in https://sourceforge.net/p/predef/wiki/Architectures/
static void print_platform_info(void) {
#if defined(OQS_COMPILE_BUILD_TARGET)
printf("Target platform: %s\n", OQS_COMPILE_BUILD_TARGET);
printf("Target platform: %s", OQS_COMPILE_BUILD_TARGET);
#elif defined(_WIN64)
printf("Target platform: Windows (64-bit)\n");
printf("Target platform: Windows (64-bit)");
#elif defined(_WIN32)
printf("Target platform: Windows (32-bit)\n");
printf("Target platform: Windows (32-bit)");
#else
printf("Target platform: Unknown\n");
printf("Target platform: Unknown");
#endif
#if defined(OQS_SPEED_USE_ARM_PMU)
printf(" - ARM PMU options enabled");
#endif
printf("\n");
}
#if defined(OQS_USE_OPENSSL)
@ -170,6 +174,23 @@ static void print_cpu_extensions(void) {
}
static void print_oqs_configuration(void) {
/* Display all options as per https://github.com/open-quantum-safe/liboqs/wiki/Customizing-liboqs:
* BUILD_SHARED_LIBS: Performance relevance small/improbable
* CMAKE_BUILD_TYPE: If Debug, -g compiler option will be shown;
* -O3 for Release build
* CMAKE_INSTALL_PREFIX: Not performance relevant
* OQS_ENABLE_KEM|SIG: alg absence/presence detected on run; can be output
* by not passing an alg name to the test programs
* OQS_BUILD_ONLY_LIB: Not performance relevant
* OQS_DIST_BUILD: Set if output "CPU exts active" present;
* otherwise, "CPU exts compile-time:" output
* OQS_USE_OPENSSL: Explicitly output
* OQS_OPT_TARGET: Visible by looking at compile options (-march or -mcpu):
* 'auto' -> "-march|cpu=native"
* OQS_SPEED_USE_ARM_PMU: Output with Target platform
* 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_COMPILE_GIT_COMMIT)
printf("Git commit: %s\n", OQS_COMPILE_GIT_COMMIT);
@ -200,6 +221,37 @@ static void print_oqs_configuration(void) {
#else
printf("SHA-3: C\n");
#endif
printf("OQS build flags: ");
#ifdef BUILD_SHARED_LIBS
printf("BUILD_SHARED_LIBS ");
#endif
#ifdef OQS_ENABLE_TEST_CONSTANT_TIME
printf("OQS_ENABLE_TEST_CONSTANT_TIME ");
#endif
#ifdef OQS_SPEED_USE_ARM_PMU
printf("OQS_SPEED_USE_ARM_PMU ");
#endif
#ifdef OQS_DIST_BUILD
printf("OQS_DIST_BUILD ");
#endif
#ifdef OQS_BUILD_ONLY_LIB
printf("OQS_BUILD_ONLY_LIB "); // pretty much impossible to appear but added for completeness
#endif
#ifdef USE_SANITIZER
printf("USE_SANITIZER=%s ", USE_SANITIZER);
#endif
#ifdef OQS_OPT_TARGET
printf("OQS_OPT_TARGET=%s ", OQS_OPT_TARGET);
#endif
#ifdef CMAKE_BUILD_TYPE
printf("CMAKE_BUILD_TYPE=%s ", CMAKE_BUILD_TYPE);
#else
#ifdef OQS_DEBUG_BUILD
guard against impossible configuration (no CMAKE_BUILD_TYPE but DEBUG_BUILD)
#endif
printf("CMAKE_BUILD_TYPE=Release ");
#endif
printf("\n");
}
static void print_system_info(void) {