mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-11 02:02:22 +00:00
Test scaffolds
This commit is contained in:
+27
-18
@@ -73,6 +73,8 @@ option(BUILD_IFCMAX "Build IfcMax, a 3ds Max plug-in, Windows-only." OFF)
|
||||
option(BUILD_QTVIEWER "Build IfcOpenShell Qt GUI Viewer" OFF) # QtViewer requires Qt6
|
||||
option(BUILD_IFCMODEL_UI "Build minimal Qt IFC model UI prototype" OFF)
|
||||
option(BUILD_BONSAIVIEWER "Build Bonsai Viewer" OFF) # Requires Qt6 + OpenGL 4.5
|
||||
option(BUILD_IFCOPENSHELL_PARSE_TESTS "Build C++ unit tests for IfcParse (fetches Catch2 v3)" OFF)
|
||||
option(BUILD_IFCOPENSHELL_GEOMETRY_TESTS "Build C++ unit tests for IfcGeom (fetches Catch2 v3)" OFF)
|
||||
option(BUILD_BONSAIVIEWER_TESTS "Build unit tests for Bonsai Viewer core (fetches Catch2 v3)" OFF)
|
||||
option(BUILD_BONSAIVIEWER_WGPU "Build the experimental wgpu backend (fetches wgpu-native binary release)" OFF)
|
||||
# IfcViewer (the GL static lib) now links against IfcViewerWgpu because
|
||||
@@ -130,6 +132,23 @@ project(IfcOpenShell VERSION ${RELEASE_VERSION})
|
||||
# Make sure CMake modules in this project are found first
|
||||
list(PREPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR})
|
||||
|
||||
# Catch2 is fetched only when an explicit C++ test family is enabled, so the
|
||||
# default build remains offline-capable.
|
||||
if(BUILD_IFCOPENSHELL_PARSE_TESTS OR BUILD_IFCOPENSHELL_GEOMETRY_TESTS OR BUILD_BONSAIVIEWER_TESTS)
|
||||
include(FetchContent)
|
||||
FetchContent_Declare(
|
||||
Catch2
|
||||
GIT_REPOSITORY https://github.com/catchorg/Catch2.git
|
||||
GIT_TAG v3.5.4
|
||||
GIT_SHALLOW TRUE
|
||||
)
|
||||
FetchContent_MakeAvailable(Catch2)
|
||||
list(APPEND CMAKE_MODULE_PATH ${catch2_SOURCE_DIR}/extras)
|
||||
include(CTest)
|
||||
include(Catch)
|
||||
enable_testing()
|
||||
endif()
|
||||
|
||||
if(MINIMAL_BUILD)
|
||||
message(STATUS "Setting options for minimal build")
|
||||
set(BUILD_GEOMSERVER OFF)
|
||||
@@ -538,6 +557,9 @@ add_subdirectory(../src/plugin plugin)
|
||||
|
||||
add_subdirectory(../src/ifcparse ifcparse)
|
||||
set(IFCOPENSHELL_LIBRARIES IfcParse)
|
||||
if(BUILD_IFCOPENSHELL_PARSE_TESTS)
|
||||
add_subdirectory(../src/ifcparse/tests ifcparse/tests)
|
||||
endif()
|
||||
|
||||
if(BUILD_EXAMPLES OR BUILD_BONSAIVIEWER)
|
||||
add_subdirectory(../src/helpers helpers)
|
||||
@@ -567,6 +589,11 @@ if(BUILD_IFCGEOM)
|
||||
endif()
|
||||
|
||||
add_subdirectory(../src/ifcgeom ifcgeom)
|
||||
if(BUILD_IFCOPENSHELL_GEOMETRY_TESTS)
|
||||
add_subdirectory(../src/ifcgeom/tests ifcgeom/tests)
|
||||
endif()
|
||||
elseif(BUILD_IFCOPENSHELL_GEOMETRY_TESTS)
|
||||
message(FATAL_ERROR "BUILD_IFCOPENSHELL_GEOMETRY_TESTS requires BUILD_IFCGEOM=ON.")
|
||||
endif(BUILD_IFCGEOM)
|
||||
|
||||
if(BUILD_CONVERT OR BUILD_IFCPYTHON OR BUILD_BONSAIVIEWER)
|
||||
@@ -693,24 +720,6 @@ if(BUILD_IFCGEOM)
|
||||
|
||||
install(TARGETS ${IFCGEOM_SCHEMA_LIBRARIES} ${kernel_libraries} IfcGeom)
|
||||
endif(BUILD_IFCGEOM)
|
||||
# Catch2 fetch hoisted out of BUILD_BONSAIVIEWER so the standalone wgpu
|
||||
# build can also enable BUILD_BONSAIVIEWER_TESTS. Test option is OFF by
|
||||
# default so the default build remains offline-capable.
|
||||
if(BUILD_BONSAIVIEWER_TESTS)
|
||||
include(FetchContent)
|
||||
FetchContent_Declare(
|
||||
Catch2
|
||||
GIT_REPOSITORY https://github.com/catchorg/Catch2.git
|
||||
GIT_TAG v3.5.4
|
||||
GIT_SHALLOW TRUE
|
||||
)
|
||||
FetchContent_MakeAvailable(Catch2)
|
||||
list(APPEND CMAKE_MODULE_PATH ${catch2_SOURCE_DIR}/extras)
|
||||
include(CTest)
|
||||
include(Catch)
|
||||
enable_testing()
|
||||
endif()
|
||||
|
||||
if(BUILD_BONSAIVIEWER)
|
||||
# IfcViewer is the unified scene + render lib since the wgpu/ifcviewer
|
||||
# merge — wgpu-native is fetched inside its CMakeLists.txt.
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
# This file was generated with the assistance of an AI coding tool.
|
||||
|
||||
add_executable(test_ifcopenshell_geometry
|
||||
test_ifcopenshell_geometry.cpp
|
||||
)
|
||||
target_link_libraries(test_ifcopenshell_geometry PRIVATE Catch2::Catch2WithMain)
|
||||
catch_discover_tests(test_ifcopenshell_geometry
|
||||
DL_PATHS
|
||||
$<TARGET_FILE_DIR:Catch2::Catch2>
|
||||
$<TARGET_FILE_DIR:Catch2::Catch2WithMain>
|
||||
)
|
||||
@@ -0,0 +1,7 @@
|
||||
// This file was generated with the assistance of an AI coding tool.
|
||||
|
||||
#include <catch2/catch_test_macros.hpp>
|
||||
|
||||
TEST_CASE("IfcGeom C++ test scaffold is registered", "[ifcgeom]") {
|
||||
REQUIRE(true);
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
# This file was generated with the assistance of an AI coding tool.
|
||||
|
||||
add_executable(test_ifcopenshell_parse
|
||||
test_ifcopenshell_parse.cpp
|
||||
)
|
||||
target_link_libraries(test_ifcopenshell_parse PRIVATE Catch2::Catch2WithMain)
|
||||
catch_discover_tests(test_ifcopenshell_parse
|
||||
DL_PATHS
|
||||
$<TARGET_FILE_DIR:Catch2::Catch2>
|
||||
$<TARGET_FILE_DIR:Catch2::Catch2WithMain>
|
||||
)
|
||||
@@ -0,0 +1,7 @@
|
||||
// This file was generated with the assistance of an AI coding tool.
|
||||
|
||||
#include <catch2/catch_test_macros.hpp>
|
||||
|
||||
TEST_CASE("IfcParse C++ test scaffold is registered", "[ifcparse]") {
|
||||
REQUIRE(true);
|
||||
}
|
||||
Reference in New Issue
Block a user