Skip to content

Customizing liboqs

xvzcf edited this page Mar 17, 2020 · 20 revisions

Various options can be passed to cmake during the build file generation process that can be used to customize the way liboqs is built, and what its functionality is. This page lists and explains each of these options.

List of Options


CMAKE_BUILD_TYPE

It can take the following values:

  • Debug: This will turn off all optimizations and compile the code with debug information included. For this value, when the compiler is Clang, the USE_SANITIZER flag can also be passed in to enable a Clang Sanitizer build. This value only has effect when the compiler is GCC or Clang.
  • Generic: This enables code to built with the O3 optimization level, and other flags are set that reduce the binary size. This does not enable CPU extensions such as AVX2, SSE, etc., so as to preserve the resulting binary's portability, since such feature detection is not done during runtime. This value only has effect when the compiler is GCC or Clang.
  • Optimized: This, along with all the flags enabled by the Generic value, adds the -march=native flag to enable the use of CPU features. The resulting binary will not be portable. This value only has effect when the compiler is GCC or Clang.
  • Dependency: This is for third-party software that use liboqs as a dependency. When specified, only liboqs is built, and targets such as run_tests, gen_docs are not made available to the build system. This can prevent name collisions, for example, when add_subdirectory() is used to incorporate liboqs into the build process.

OQS_BUILD_TYPE

This is identical to CMAKE_BUILD_TYPE. It is a separate option so that third-party software can use add_subdirectory() to incorporate liboqs into the build process, and can set the CMAKE_BUILD_TYPE for their projects as desired.