-
Notifications
You must be signed in to change notification settings - Fork 478
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
change from using ninja and custom cmake target
run_test
to using c…
…make & ctest. Upon reading issue #1494 This PR aims to remove the need for ninja, and make tests platform agnostic. The new build process will work as follows: ``` cmake -B build cmake --build build --parallel ctest --test-dir build/tests --output-on-failure ``` Unfortunately, cmake does not have the nice pytest --ignore feature. So to ensure test_kat_all doesn't run by default, the `OQS_ENABLE_LONG_TESTS` variableis introduced. If you would like to run the long tests (currently only `test_kat_all`) you would do the following: ``` cmake -B build -DOQS_ENABLE_LONG_TESTS=on cmake --build build --parallel ctest --test-dir build/tests --output-on-failure ```
- Loading branch information
1 parent
ac164b4
commit c45b9df
Showing
7 changed files
with
129 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,22 @@ | ||
# As per https://gitlab.kitware.com/cmake/community/-/wikis/FAQ#can-i-do-make-uninstall-with-cmake | ||
|
||
if(NOT EXISTS "@CMAKE_BINARY_DIR@/install_manifest.txt") | ||
message(FATAL_ERROR "Cannot find install manifest: @CMAKE_BINARY_DIR@/install_manifest.txt") | ||
if(NOT EXISTS "${CMAKE_BINARY_DIR}/install_manifest.txt") | ||
message(FATAL_ERROR "Cannot find install manifest: ${CMAKE_BINARY_DIR}/install_manifest.txt") | ||
endif() | ||
|
||
file(READ "@CMAKE_BINARY_DIR@/install_manifest.txt" files) | ||
file(READ "${CMAKE_BINARY_DIR}/install_manifest.txt" files) | ||
string(REGEX REPLACE "\n" ";" files "${files}") | ||
foreach(file ${files}) | ||
message(STATUS "Uninstalling $ENV{DESTDIR}${file}") | ||
if(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}") | ||
exec_program( | ||
"@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${file}\"" | ||
execute_process( | ||
COMMAND "${CMAKE_COMMAND}" -E remove "$ENV{DESTDIR}${file}" | ||
OUTPUT_VARIABLE rm_out | ||
RETURN_VALUE rm_retval | ||
RESULT_VARIABLE rm_retval | ||
) | ||
if(NOT "${rm_retval}" STREQUAL 0) | ||
message(FATAL_ERROR "Problem when removing $ENV{DESTDIR}${file}") | ||
endif() | ||
else(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}") | ||
else() | ||
message(STATUS "File $ENV{DESTDIR}${file} does not exist.") | ||
endif() | ||
endforeach() | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -84,11 +84,11 @@ In order to optimize support effort, | |
|
||
On Ubuntu: | ||
|
||
sudo apt install astyle cmake gcc ninja-build libssl-dev python3-pytest python3-pytest-xdist unzip xsltproc doxygen graphviz python3-yaml valgrind | ||
sudo apt install astyle cmake gcc libssl-dev python3-pytest python3-pytest-xdist unzip xsltproc doxygen graphviz python3-yaml valgrind | ||
|
||
On macOS, using a package manager of your choice (we've picked Homebrew): | ||
|
||
brew install cmake ninja [email protected] wget doxygen graphviz astyle valgrind | ||
brew install cmake [email protected] wget doxygen graphviz astyle valgrind | ||
pip3 install pytest pytest-xdist pyyaml | ||
|
||
Note that, if you want liboqs to use OpenSSL for various symmetric crypto algorithms (AES, SHA-2, etc.) then you must have OpenSSL installed (version 3.x recommended; EOL version 1.1.1 also still possible). | ||
|
@@ -100,9 +100,8 @@ In order to optimize support effort, | |
|
||
and build: | ||
|
||
mkdir build && cd build | ||
cmake -GNinja .. | ||
ninja | ||
cmake -B build | ||
cmake --build build --parallel | ||
|
||
Various `cmake` build options to customize the resultant artifacts are available and are [documented in CONFIGURE.md](CONFIGURE.md#options-for-configuring-liboqs-builds). All supported options are also listed in the `.CMake/alg-support.cmake` file, and can be viewed by running `cmake -LAH ..` in the `build` directory. | ||
|
||
|
@@ -125,24 +124,24 @@ The following instructions assume we are in `build`. | |
|
||
The complete test suite can be run using | ||
|
||
ninja run_tests | ||
ctest --test-dir build/tests --parallel $(nproc) | ||
|
||
4. To generate HTML documentation of the API, run: | ||
|
||
ninja gen_docs | ||
cmake --build build --target gen_docs | ||
|
||
Then open `docs/html/index.html` in your web browser. | ||
|
||
4. `ninja install` can be run to install the built library and `include` files to a location of choice, which can be specified by passing the `-DCMAKE_INSTALL_PREFIX=<dir>` option to `cmake` at configure time. Alternatively, `ninja package` can be run to create an install package. | ||
4. `cmake --install build` can be run to install the built library and `include` files to a location of choice, which can be specified by passing the `-DCMAKE_INSTALL_PREFIX=<dir>` option to `cmake` at configure time. Alternatively, `cmake --build build --target package` can be run to create an install package. | ||
|
||
5. `ninja uninstall` can be run to remove all installation files. | ||
5. `cmake --build build --target uninstall` can be run to remove all installation files. | ||
|
||
|
||
### Windows | ||
|
||
Binaries can be generated using Visual Studio 2019 with the [CMake Tools](https://marketplace.visualstudio.com/items?itemName=ms-vscode.cmake-tools) extension installed. The same options as explained above for Linux/macOS can be used and build artifacts are generated in the specified `build` folders. | ||
|
||
If you want to create Visual Studio build files, e.g., if not using `ninja`, be sure to _not_ pass the parameter `-GNinja` to the `cmake` command as exemplified above. You can then build all components using `msbuild`, e.g. as follows: `msbuild ALL_BUILD.vcxproj` and install all artifacts e.g. using this command `msbuild INSTALL.vcxproj`. | ||
You can then build all components using `msbuild`, e.g. as follows: `msbuild ALL_BUILD.vcxproj` and install all artifacts e.g. using this command `msbuild INSTALL.vcxproj`. | ||
|
||
|
||
### Cross compilation | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters