build(cmake): isolate test-only dependencies
This commit is contained in:
+1
-2
@@ -22,6 +22,7 @@ if(NOT CMAKE_SIZEOF_VOID_P EQUAL 8)
|
|||||||
message(FATAL_ERROR "FESA requires a 64-bit target.")
|
message(FATAL_ERROR "FESA requires a 64-bit target.")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
include(CTest)
|
||||||
include(cmake/FesaDependencies.cmake)
|
include(cmake/FesaDependencies.cmake)
|
||||||
|
|
||||||
add_library(fesa_core STATIC
|
add_library(fesa_core STATIC
|
||||||
@@ -44,8 +45,6 @@ target_link_libraries(fesa PRIVATE fesa_core)
|
|||||||
target_compile_features(fesa PRIVATE cxx_std_20)
|
target_compile_features(fesa PRIVATE cxx_std_20)
|
||||||
target_compile_options(fesa PRIVATE /W4 /permissive- /EHsc)
|
target_compile_options(fesa PRIVATE /W4 /permissive- /EHsc)
|
||||||
|
|
||||||
include(CTest)
|
|
||||||
|
|
||||||
if(BUILD_TESTING)
|
if(BUILD_TESTING)
|
||||||
add_subdirectory(tests)
|
add_subdirectory(tests)
|
||||||
endif()
|
endif()
|
||||||
|
|||||||
@@ -12,7 +12,10 @@ set(MKL_THREADING tbb_thread)
|
|||||||
find_package(MKL CONFIG REQUIRED)
|
find_package(MKL CONFIG REQUIRED)
|
||||||
find_package(TBB CONFIG REQUIRED COMPONENTS tbb)
|
find_package(TBB CONFIG REQUIRED COMPONENTS tbb)
|
||||||
find_package(HDF5 CONFIG REQUIRED COMPONENTS C shared)
|
find_package(HDF5 CONFIG REQUIRED COMPONENTS C shared)
|
||||||
find_package(GTest CONFIG REQUIRED)
|
|
||||||
|
if(BUILD_TESTING)
|
||||||
|
find_package(GTest CONFIG REQUIRED)
|
||||||
|
endif()
|
||||||
|
|
||||||
function(fesa_require_imported_target target_name)
|
function(fesa_require_imported_target target_name)
|
||||||
if(NOT TARGET "${target_name}")
|
if(NOT TARGET "${target_name}")
|
||||||
@@ -36,9 +39,12 @@ endfunction()
|
|||||||
fesa_require_imported_target(MKL::MKL)
|
fesa_require_imported_target(MKL::MKL)
|
||||||
fesa_require_imported_target(TBB::tbb)
|
fesa_require_imported_target(TBB::tbb)
|
||||||
fesa_require_imported_target(hdf5::hdf5-shared)
|
fesa_require_imported_target(hdf5::hdf5-shared)
|
||||||
fesa_require_imported_target(GTest::gtest_main)
|
|
||||||
fesa_require_imported_target(GTest::gtest)
|
if(BUILD_TESTING)
|
||||||
fesa_require_imported_target(GTest::gmock)
|
fesa_require_imported_target(GTest::gtest_main)
|
||||||
|
fesa_require_imported_target(GTest::gtest)
|
||||||
|
fesa_require_imported_target(GTest::gmock)
|
||||||
|
endif()
|
||||||
|
|
||||||
add_library(HDF5::HDF5 INTERFACE IMPORTED GLOBAL)
|
add_library(HDF5::HDF5 INTERFACE IMPORTED GLOBAL)
|
||||||
set_property(
|
set_property(
|
||||||
|
|||||||
@@ -37,11 +37,29 @@ set_property(
|
|||||||
${FESA_DEPENDENCY_RUNTIME_MODIFICATIONS}
|
${FESA_DEPENDENCY_RUNTIME_MODIFICATIONS}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
add_test(
|
||||||
|
NAME ProductionConfigureWithoutGTest
|
||||||
|
COMMAND
|
||||||
|
"${CMAKE_COMMAND}"
|
||||||
|
--fresh
|
||||||
|
-S "${CMAKE_SOURCE_DIR}"
|
||||||
|
-B "${CMAKE_BINARY_DIR}/testing/production-no-gtest"
|
||||||
|
-G "${CMAKE_GENERATOR}"
|
||||||
|
-A "${CMAKE_GENERATOR_PLATFORM}"
|
||||||
|
-T "${CMAKE_VS_PLATFORM_TOOLSET}"
|
||||||
|
-DBUILD_TESTING=OFF
|
||||||
|
-DCMAKE_DISABLE_FIND_PACKAGE_GTest=TRUE
|
||||||
|
"-DMKL_DIR=${MKL_DIR}"
|
||||||
|
"-DTBB_DIR=${TBB_DIR}"
|
||||||
|
"-DHDF5_DIR=${HDF5_DIR}"
|
||||||
|
)
|
||||||
|
|
||||||
add_executable(fesa_core_value_tests
|
add_executable(fesa_core_value_tests
|
||||||
unit/core/diagnostic_test.cpp
|
unit/core/diagnostic_test.cpp
|
||||||
unit/core/entity_id_test.cpp
|
unit/core/entity_id_test.cpp
|
||||||
unit/core/status_test.cpp
|
unit/core/status_test.cpp
|
||||||
unit/core/vec3_test.cpp
|
unit/core/vec3_test.cpp
|
||||||
|
unit/core/version_test.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
target_compile_features(fesa_core_value_tests PRIVATE cxx_std_20)
|
target_compile_features(fesa_core_value_tests PRIVATE cxx_std_20)
|
||||||
|
|||||||
@@ -0,0 +1,11 @@
|
|||||||
|
#include <gtest/gtest.h>
|
||||||
|
|
||||||
|
#include <fesa/core/version.hpp>
|
||||||
|
|
||||||
|
namespace {
|
||||||
|
|
||||||
|
TEST(Version, ReportsPhaseOneSemanticVersion) {
|
||||||
|
EXPECT_EQ(fesa::version(), "0.1.0");
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace
|
||||||
@@ -11,6 +11,8 @@
|
|||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
|
static_assert(sizeof(MKL_INT) == 4, "FESA requires the oneMKL LP64 interface.");
|
||||||
|
|
||||||
TEST(DependencySmoke, CallsOneMklVectorOperation) {
|
TEST(DependencySmoke, CallsOneMklVectorOperation) {
|
||||||
constexpr std::array<double, 3> x{1.0, 2.0, 3.0};
|
constexpr std::array<double, 3> x{1.0, 2.0, 3.0};
|
||||||
std::array<double, 3> y{4.0, 5.0, 6.0};
|
std::array<double, 3> y{4.0, 5.0, 6.0};
|
||||||
|
|||||||
Reference in New Issue
Block a user