First Commit
This commit is contained in:
49
externals/cryptopp-cmake/test/unit/CMakeLists.txt
vendored
Normal file
49
externals/cryptopp-cmake/test/unit/CMakeLists.txt
vendored
Normal file
@ -0,0 +1,49 @@
|
||||
# ===-----------------------------------------------------------------------===#
|
||||
# Distributed under the 3-Clause BSD License. See accompanying file LICENSE or
|
||||
# copy at https://opensource.org/licenses/BSD-3-Clause).
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
# ===-----------------------------------------------------------------------===#
|
||||
|
||||
file(GLOB tests "${CMAKE_CURRENT_SOURCE_DIR}/*")
|
||||
list(REMOVE_ITEM tests "${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt")
|
||||
|
||||
foreach(test ${tests})
|
||||
cmake_path(GET test FILENAME test_name)
|
||||
message(STATUS "Adding unit test: ${test_name}")
|
||||
# Configure
|
||||
add_test(
|
||||
NAME cryptopp-${test_name}-configure
|
||||
COMMAND
|
||||
${CMAKE_COMMAND}
|
||||
# Always use ninja, never the visual studio generator (bugged)
|
||||
-G${CMAKE_GENERATOR}
|
||||
# Pass the locations for common cmake files
|
||||
-D "TEST_CMAKE_FILES_DIR=${TEST_CMAKE_FILES_DIR}"
|
||||
# Pass the locations for common test source files
|
||||
-D "TEST_EXAMPLE_SOURCES_DIR=${TEST_EXAMPLE_SOURCES_DIR}"
|
||||
# Use ccache
|
||||
-D "USE_CCACHE=TRUE"
|
||||
# Override cmake compiler flags for ccache/MSVC
|
||||
-D
|
||||
"CMAKE_USER_MAKE_RULES_OVERRIDE=${TEST_CMAKE_FILES_DIR}/ResetInitialCompilerOptions.cmake"
|
||||
# Setup cmake source/build dirs
|
||||
-S "${test}" -B "${CMAKE_BINARY_DIR}/test-dirs/${test_name}"
|
||||
# Use local source code for cryptopp-cmake
|
||||
-D "CPM_cryptopp-cmake_SOURCE=${cryptopp-cmake_SOURCE_DIR}"
|
||||
# Enable verbose makefiles so we can see the full compile command line
|
||||
-D CMAKE_VERBOSE_MAKEFILE=ON
|
||||
# Set the build-type to what we are building
|
||||
-D CMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE})
|
||||
set_tests_properties(cryptopp-${test_name}-configure PROPERTIES
|
||||
FIXTURES_SETUP ${test_name}-config
|
||||
LABELS "cryptopp;cryptopp-unit-tests;cryptopp-${test_name}")
|
||||
# Build
|
||||
add_test(NAME cryptopp-${test_name}-build
|
||||
COMMAND ${CMAKE_COMMAND} --build
|
||||
"${CMAKE_BINARY_DIR}/test-dirs/${test_name}"
|
||||
--config ${CMAKE_BUILD_TYPE})
|
||||
# Run build test case after the configure test case
|
||||
set_tests_properties(cryptopp-${test_name}-build PROPERTIES
|
||||
FIXTURES_REQUIRED ${test_name}-config
|
||||
LABELS "cryptopp;cryptopp-unit-tests;cryptopp-${test_name}")
|
||||
endforeach()
|
||||
35
externals/cryptopp-cmake/test/unit/disable-asm/CMakeLists.txt
vendored
Normal file
35
externals/cryptopp-cmake/test/unit/disable-asm/CMakeLists.txt
vendored
Normal file
@ -0,0 +1,35 @@
|
||||
# ===-----------------------------------------------------------------------===#
|
||||
# Distributed under the 3-Clause BSD License. See accompanying file LICENSE or
|
||||
# copy at https://opensource.org/licenses/BSD-3-Clause).
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
# ===-----------------------------------------------------------------------===#
|
||||
|
||||
include(${CPM_cryptopp-cmake_SOURCE}/cmake/cmake_minimum_required.cmake)
|
||||
cmake_minimum_required(VERSION ${CRYPTOPP_MINIMUM_CMAKE_VERSION})
|
||||
|
||||
# Test project for the standard way of using cryptopp-cmake
|
||||
project(CryptoppCmakeDisableFeatureTest)
|
||||
|
||||
# ---- Add dependencies via CPM ----
|
||||
# see https://github.com/TheLartians/CPM.cmake for more info
|
||||
include(${TEST_CMAKE_FILES_DIR}/CPM.cmake)
|
||||
|
||||
# ---- Speedup build using ccache (needs CPM) ----
|
||||
include(${TEST_CMAKE_FILES_DIR}/FasterBuild.cmake)
|
||||
|
||||
cpmaddpackage(
|
||||
NAME
|
||||
cryptopp-cmake
|
||||
GITHUB_REPOSITORY
|
||||
abdes/cryptopp-cmake
|
||||
VERSION
|
||||
${cryptopp_GIT_BRANCH}
|
||||
OPTIONS
|
||||
"CRYPTOPP_BUILD_TESTING OFF"
|
||||
"DISABLE_ASM ON"
|
||||
)
|
||||
|
||||
# compile and link a test program using crypto++
|
||||
add_executable(rng-test ${TEST_EXAMPLE_SOURCES_DIR}/main.cpp)
|
||||
target_link_libraries(rng-test cryptopp::cryptopp)
|
||||
target_compile_features(rng-test PRIVATE cxx_constexpr)
|
||||
34
externals/cryptopp-cmake/test/unit/include-prefix/CMakeLists.txt
vendored
Normal file
34
externals/cryptopp-cmake/test/unit/include-prefix/CMakeLists.txt
vendored
Normal file
@ -0,0 +1,34 @@
|
||||
# ===-----------------------------------------------------------------------===#
|
||||
# Distributed under the 3-Clause BSD License. See accompanying file LICENSE or
|
||||
# copy at https://opensource.org/licenses/BSD-3-Clause).
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
# ===-----------------------------------------------------------------------===#
|
||||
|
||||
include(${CPM_cryptopp-cmake_SOURCE}/cmake/cmake_minimum_required.cmake)
|
||||
cmake_minimum_required(VERSION ${CRYPTOPP_MINIMUM_CMAKE_VERSION})
|
||||
|
||||
# Test project for the standard way of using cryptopp-cmake
|
||||
project(CryptoppCmakeIncludePrefixTest)
|
||||
|
||||
# ---- Add dependencies via CPM ----
|
||||
# see https://github.com/TheLartians/CPM.cmake for more info
|
||||
include(${TEST_CMAKE_FILES_DIR}/CPM.cmake)
|
||||
|
||||
# ---- Speedup build using ccache (needs CPM) ----
|
||||
include(${TEST_CMAKE_FILES_DIR}/FasterBuild.cmake)
|
||||
|
||||
cpmaddpackage(
|
||||
NAME
|
||||
cryptopp-cmake
|
||||
GITHUB_REPOSITORY
|
||||
abdes/cryptopp-cmake
|
||||
VERSION
|
||||
${cryptopp_GIT_BRANCH}
|
||||
OPTIONS
|
||||
"CRYPTOPP_BUILD_TESTING OFF"
|
||||
"CRYPTOPP_INCLUDE_PREFIX crypto++")
|
||||
|
||||
# compile and link a test program using crypto++
|
||||
add_executable(rng-test main.cpp)
|
||||
target_link_libraries(rng-test cryptopp::cryptopp)
|
||||
target_compile_features(rng-test PRIVATE cxx_constexpr)
|
||||
17
externals/cryptopp-cmake/test/unit/include-prefix/main.cpp
vendored
Normal file
17
externals/cryptopp-cmake/test/unit/include-prefix/main.cpp
vendored
Normal file
@ -0,0 +1,17 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
// Distributed under the 3-Clause BSD License. See accompanying file LICENSE or
|
||||
// copy at https://opensource.org/licenses/BSD-3-Clause).
|
||||
// SPDX-License-Identifier: BSD-3-Clause
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include <array>
|
||||
#include <cstdint>
|
||||
|
||||
#include <crypto++/osrng.h> // for random number generation
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
constexpr size_t c_buffer_size = 16;
|
||||
std::array<uint8_t, c_buffer_size> output;
|
||||
CryptoPP::AutoSeededRandomPool rng;
|
||||
rng.GenerateBlock(output.data(), c_buffer_size);
|
||||
}
|
||||
34
externals/cryptopp-cmake/test/unit/no-install/CMakeLists.txt
vendored
Normal file
34
externals/cryptopp-cmake/test/unit/no-install/CMakeLists.txt
vendored
Normal file
@ -0,0 +1,34 @@
|
||||
# ===-----------------------------------------------------------------------===#
|
||||
# Distributed under the 3-Clause BSD License. See accompanying file LICENSE or
|
||||
# copy at https://opensource.org/licenses/BSD-3-Clause).
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
# ===-----------------------------------------------------------------------===#
|
||||
|
||||
include(${CPM_cryptopp-cmake_SOURCE}/cmake/cmake_minimum_required.cmake)
|
||||
cmake_minimum_required(VERSION ${CRYPTOPP_MINIMUM_CMAKE_VERSION})
|
||||
|
||||
# Test project for the standard way of using cryptopp-cmake
|
||||
project(CryptoppCmakeNoInstallTest)
|
||||
|
||||
# ---- Add dependencies via CPM ----
|
||||
# see https://github.com/TheLartians/CPM.cmake for more info
|
||||
include(${TEST_CMAKE_FILES_DIR}/CPM.cmake)
|
||||
|
||||
# ---- Speedup build using ccache (needs CPM) ----
|
||||
include(${TEST_CMAKE_FILES_DIR}/FasterBuild.cmake)
|
||||
|
||||
cpmaddpackage(
|
||||
NAME
|
||||
cryptopp-cmake
|
||||
GIT_REPOSITORY
|
||||
abdes/cryptopp-cmake
|
||||
GIT_TAG
|
||||
${cryptopp_GIT_BRANCH}
|
||||
OPTIONS
|
||||
"CRYPTOPP_BUILD_TESTING OFF"
|
||||
"CRYPTOPP_INSTALL OFF")
|
||||
|
||||
# compile and link a test program using crypto++
|
||||
add_executable(rng-test ${TEST_EXAMPLE_SOURCES_DIR}/main.cpp)
|
||||
target_link_libraries(rng-test cryptopp::cryptopp)
|
||||
target_compile_features(rng-test PRIVATE cxx_constexpr)
|
||||
33
externals/cryptopp-cmake/test/unit/standard-cpm/CMakeLists.txt
vendored
Normal file
33
externals/cryptopp-cmake/test/unit/standard-cpm/CMakeLists.txt
vendored
Normal file
@ -0,0 +1,33 @@
|
||||
# ===-----------------------------------------------------------------------===#
|
||||
# Distributed under the 3-Clause BSD License. See accompanying file LICENSE or
|
||||
# copy at https://opensource.org/licenses/BSD-3-Clause).
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
# ===-----------------------------------------------------------------------===#
|
||||
|
||||
include(${CPM_cryptopp-cmake_SOURCE}/cmake/cmake_minimum_required.cmake)
|
||||
cmake_minimum_required(VERSION ${CRYPTOPP_MINIMUM_CMAKE_VERSION})
|
||||
|
||||
# Test project for the standard way of using cryptopp-cmake
|
||||
project(CryptoppCmakeStandardTest)
|
||||
|
||||
# ---- Add dependencies via CPM ----
|
||||
# see https://github.com/TheLartians/CPM.cmake for more info
|
||||
include(${TEST_CMAKE_FILES_DIR}/CPM.cmake)
|
||||
|
||||
# ---- Speedup build using ccache (needs CPM) ----
|
||||
include(${TEST_CMAKE_FILES_DIR}/FasterBuild.cmake)
|
||||
|
||||
cpmaddpackage(
|
||||
NAME
|
||||
cryptopp-cmake
|
||||
GIT_REPOSITORY
|
||||
abdes/cryptopp-cmake
|
||||
GIT_TAG
|
||||
${cryptopp_GIT_BRANCH}
|
||||
OPTIONS
|
||||
"CRYPTOPP_BUILD_TESTING OFF")
|
||||
|
||||
# compile and link a test program using crypto++
|
||||
add_executable(rng-test ${TEST_EXAMPLE_SOURCES_DIR}/main.cpp)
|
||||
target_link_libraries(rng-test cryptopp::cryptopp)
|
||||
target_compile_features(rng-test PRIVATE cxx_constexpr)
|
||||
Reference in New Issue
Block a user