Enable retargeting of example schema

This commit is contained in:
Thomas Krijnen
2026-06-12 11:04:18 +02:00
parent 3136c74c2f
commit 4d22a3fdb9
14 changed files with 294 additions and 132 deletions
+36 -15
View File
@@ -36,7 +36,17 @@ else()
endif()
macro(build_example exe_name)
set(_target_schema "")
set(additional_targets ${ARGN})
list(LENGTH additional_targets _argc)
if(_argc GREATER 0)
list(GET additional_targets 0 _first_arg)
if("${_first_arg}" IN_LIST SCHEMA_VERSIONS)
set(_target_schema ${_first_arg})
list(REMOVE_AT additional_targets 0)
endif()
endif()
add_executable(${exe_name} ${exe_name}.cpp)
if(STANDALONE_PROJECT)
@@ -50,27 +60,38 @@ macro(build_example exe_name)
target_link_libraries(${exe_name} IfcParse ${additional_targets})
set_target_properties(${exe_name} PROPERTIES FOLDER Examples)
endif()
if(_target_schema)
set_target_properties(
${exe_name}
PROPERTIES COMPILE_FLAGS "-DIfcSchema=Ifc${_target_schema}"
)
endif()
unset(_target_schema)
unset(_argc)
unset(_first_arg)
install(TARGETS ${exe_name})
endmacro()
if("4" IN_LIST SCHEMA_VERSIONS)
build_example(arbitrary_open_profile_def)
build_example(triangulated_faceset)
if(SCHEMA_VERSIONS)
list(GET SCHEMA_VERSIONS -1 schema)
endif()
if("2x3" IN_LIST SCHEMA_VERSIONS)
build_example(composite_profile_def)
build_example(csg_primitive)
build_example(ellipse_pies)
build_example(faces)
build_example(ifc_curve_rebar)
build_example(profiles)
build_example(IfcParseExamples)
build_example(arbitrary_open_profile_def ${schema})
build_example(triangulated_faceset ${schema})
if(WITH_OPENCASCADE)
build_example(IfcOpenHouse geometry_serializer)
build_example(IfcAdvancedHouse geometry_serializer)
endif()
build_example(composite_profile_def ${schema})
build_example(csg_primitive ${schema})
build_example(ellipse_pies ${schema})
build_example(faces ${schema})
build_example(ifc_curve_rebar ${schema})
build_example(profiles ${schema})
build_example(IfcParseExamples ${schema})
if(WITH_OPENCASCADE)
build_example(IfcOpenHouse ${schema} geometry_serializer)
build_example(IfcAdvancedHouse ${schema} geometry_serializer)
endif()
if("4x3_add2" IN_LIST SCHEMA_VERSIONS)