2015-11-09 17:42:46 +02:00
|
|
|
################################################################################
|
|
|
|
|
# #
|
|
|
|
|
# This file is part of IfcOpenShell. #
|
|
|
|
|
# #
|
|
|
|
|
# IfcOpenShell is free software: you can redistribute it and/or modify #
|
|
|
|
|
# it under the terms of the Lesser GNU General Public License as published by #
|
|
|
|
|
# the Free Software Foundation, either version 3.0 of the License, or #
|
|
|
|
|
# (at your option) any later version. #
|
|
|
|
|
# #
|
|
|
|
|
# IfcOpenShell is distributed in the hope that it will be useful, #
|
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of #
|
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
|
|
|
|
|
# Lesser GNU General Public License for more details. #
|
|
|
|
|
# #
|
|
|
|
|
# You should have received a copy of the Lesser GNU General Public License #
|
|
|
|
|
# along with this program. If not, see <http://www.gnu.org/licenses/>. #
|
|
|
|
|
# #
|
|
|
|
|
################################################################################
|
|
|
|
|
|
2025-12-12 12:19:40 +05:00
|
|
|
# Thils file can also be build standalone, outside of the IfcOpenShell build tree,
|
|
|
|
|
# to demonstrate the usage IfcOpenShell as a cmake package.
|
|
|
|
|
if(NOT BUILD_EXAMPLES)
|
|
|
|
|
set(STANDALONE_PROJECT ON)
|
|
|
|
|
endif()
|
|
|
|
|
|
|
|
|
|
if(STANDALONE_PROJECT)
|
|
|
|
|
cmake_minimum_required(VERSION 3.21)
|
|
|
|
|
project(IfcOpenShellExamples)
|
|
|
|
|
|
2025-12-12 15:37:34 +05:00
|
|
|
set(CMAKE_CXX_STANDARD 17)
|
2025-12-12 12:19:40 +05:00
|
|
|
find_package(IfcOpenShell CONFIG REQUIRED)
|
2025-12-12 18:32:47 +05:00
|
|
|
set(SCHEMA_VERSIONS ${IFCOPENSHELL_SCHEMA_VERSIONS})
|
|
|
|
|
set(WITH_OPENCASCADE ${IFCOPENSHELL_WITH_OPENCASCADE})
|
2025-12-12 18:58:04 +05:00
|
|
|
else()
|
|
|
|
|
include_directories("${CMAKE_SOURCE_DIR}/../src")
|
2025-12-12 12:19:40 +05:00
|
|
|
endif()
|
2012-11-04 16:26:33 +00:00
|
|
|
|
2026-01-23 20:41:40 +01:00
|
|
|
macro(build_example exe_name)
|
|
|
|
|
set (additional_targets ${ARGN})
|
|
|
|
|
add_executable(${exe_name} ${exe_name}.cpp)
|
2025-12-12 22:44:40 +01:00
|
|
|
|
|
|
|
|
if(STANDALONE_PROJECT)
|
2026-01-23 20:41:40 +01:00
|
|
|
target_link_libraries(${exe_name} IfcOpenShell::IfcParse $<$<BOOL:${additional_targets}>:IfcOpenShell::${additional_targets}>)
|
2025-12-12 22:44:40 +01:00
|
|
|
else()
|
2026-01-23 20:41:40 +01:00
|
|
|
target_include_directories(${exe_name} PRIVATE "${CMAKE_SOURCE_DIR}/../src")
|
|
|
|
|
target_link_libraries(${exe_name} IfcParse ${additional_targets})
|
|
|
|
|
set_target_properties(${exe_name} PROPERTIES FOLDER Examples)
|
2025-12-12 22:44:40 +01:00
|
|
|
endif()
|
2026-01-23 20:41:40 +01:00
|
|
|
install(TARGETS ${exe_name})
|
|
|
|
|
endmacro()
|
2025-12-12 22:44:40 +01:00
|
|
|
|
2026-01-23 20:41:40 +01:00
|
|
|
if("4" IN_LIST SCHEMA_VERSIONS)
|
|
|
|
|
build_example(arbitrary_open_profile_def)
|
|
|
|
|
build_example(triangulated_faceset)
|
2025-12-12 22:44:40 +01:00
|
|
|
endif()
|
|
|
|
|
|
2026-01-23 20:41:40 +01:00
|
|
|
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)
|
2025-12-12 12:19:40 +05:00
|
|
|
|
2025-12-15 15:25:22 +05:00
|
|
|
if(WITH_OPENCASCADE)
|
2026-01-23 20:41:40 +01:00
|
|
|
build_example(IfcOpenHouse geometry_serializer)
|
|
|
|
|
build_example(IfcAdvancedHouse geometry_serializer)
|
2025-11-15 20:31:13 +01:00
|
|
|
endif()
|
2025-12-12 12:19:40 +05:00
|
|
|
endif()
|
2023-03-22 11:17:14 +01:00
|
|
|
|
2026-01-23 20:41:40 +01:00
|
|
|
if("4x3_add2" IN_LIST SCHEMA_VERSIONS)
|
|
|
|
|
build_example(IfcAlignment)
|
|
|
|
|
build_example(IfcSimplifiedAlignment)
|
2024-06-10 15:42:11 +05:00
|
|
|
endif()
|