mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-19 03:33:48 +00:00
Merge branch 'v0.8.0' into ifcmax/initial-refresh
# Conflicts: # src/ifcmax/CMakeLists.txt
This commit is contained in:
@@ -1062,10 +1062,15 @@ class LoadProject(bpy.types.Operator, IFCFileSelector, ImportHelper):
|
||||
and not self.is_advanced
|
||||
):
|
||||
filepath = self.get_filepath()
|
||||
metadata_path = Path(str(filepath) + ".metadata.blend")
|
||||
suffix = tool.Blender.get_addon_preferences().metadata_blend_file_suffix
|
||||
if str(filepath).lower().endswith(".ifc"):
|
||||
metadata_path = Path(str(filepath)[:-4] + suffix)
|
||||
else:
|
||||
metadata_path = Path(str(filepath) + suffix)
|
||||
if metadata_path.exists() and metadata_path.is_file():
|
||||
try:
|
||||
bpy.ops.bim.load_blend_metadata_and_ifc(filepath=filepath)
|
||||
self.report({"INFO"}, f"Loaded metadata file: {metadata_path.name}")
|
||||
return {"FINISHED"}
|
||||
except Exception as e:
|
||||
self.report({"WARNING"}, f"Failed to load metadata file, using regular load: {e}")
|
||||
@@ -1763,7 +1768,11 @@ class ExportIFC(bpy.types.Operator, ExportHelper):
|
||||
if tool.Blender.get_addon_preferences().save_metadata_blend_file:
|
||||
try:
|
||||
bpy.ops.bim.save_blend_metadata_file()
|
||||
blendmetadata_path = output_file + ".metadata.blend"
|
||||
suffix = tool.Blender.get_addon_preferences().metadata_blend_file_suffix
|
||||
if output_file.lower().endswith(".ifc"):
|
||||
blendmetadata_path = output_file[:-4] + suffix
|
||||
else:
|
||||
blendmetadata_path = output_file + suffix
|
||||
self.report(
|
||||
{"INFO"},
|
||||
f'IFC Project "{os.path.basename(output_file)}" And Metadata File Saved to: {os.path.basename(blendmetadata_path)}',
|
||||
|
||||
@@ -332,10 +332,14 @@ class BIM_PT_project(Panel):
|
||||
row.operator("bim.select_ifc_file", icon="FILE_FOLDER", text="")
|
||||
|
||||
if tool.Blender.get_addon_preferences().save_metadata_blend_file:
|
||||
suffix = tool.Blender.get_addon_preferences().metadata_blend_file_suffix
|
||||
if props.ifc_file.lower().endswith(".ifc"):
|
||||
metadata_filename = os.path.basename(props.ifc_file)[:-4] + suffix
|
||||
else:
|
||||
metadata_filename = os.path.basename(props.ifc_file) + suffix
|
||||
row = self.layout.row(align=True)
|
||||
col = row.column()
|
||||
col.enabled = False
|
||||
metadata_filename = os.path.basename(props.ifc_file) + ".metadata.blend"
|
||||
col.label(text=f"Saving session data to: {metadata_filename}")
|
||||
|
||||
|
||||
|
||||
@@ -260,10 +260,14 @@ class SaveBlendMetadataFile(bpy.types.Operator):
|
||||
self.report({"WARNING"}, "No IFC file path set.")
|
||||
return {"CANCELLED"}
|
||||
|
||||
blendmetadata_path = ifc_file + ".metadata.blend"
|
||||
suffix = tool.Blender.get_addon_preferences().metadata_blend_file_suffix
|
||||
if ifc_file.lower().endswith(".ifc"):
|
||||
blendmetadata_path = ifc_file[:-4] + suffix
|
||||
else:
|
||||
blendmetadata_path = ifc_file + suffix
|
||||
|
||||
# Save a temporary copy of the current blend file
|
||||
temp_path = bpy.path.abspath("//__temp_blendmetadata.blend")
|
||||
ifc_dir = os.path.dirname(ifc_file)
|
||||
temp_path = os.path.join(ifc_dir, "__temp_blendmetadata.blend")
|
||||
bpy.ops.wm.save_as_mainfile(filepath=temp_path, copy=True)
|
||||
|
||||
cleanup_script = f"""
|
||||
@@ -331,12 +335,14 @@ except Exception:
|
||||
bpy.ops.wm.save_as_mainfile(filepath=r'{blendmetadata_path}')
|
||||
"""
|
||||
import tempfile
|
||||
|
||||
with tempfile.NamedTemporaryFile("w", suffix=".py", delete=False) as script_file:
|
||||
script_file.write(cleanup_script)
|
||||
script_path = script_file.name
|
||||
|
||||
blender_exe = bpy.app.binary_path
|
||||
import subprocess
|
||||
|
||||
result = subprocess.run(
|
||||
[blender_exe, temp_path, "--background", "--python", script_path], capture_output=True, text=True
|
||||
)
|
||||
@@ -374,7 +380,11 @@ class LoadBlendMetadataAndIFC(bpy.types.Operator):
|
||||
self.report({"WARNING"}, "No IFC file path set.")
|
||||
return {"CANCELLED"}
|
||||
|
||||
metadata_path = ifc_file + ".metadata.blend"
|
||||
suffix = tool.Blender.get_addon_preferences().metadata_blend_file_suffix
|
||||
if ifc_file.lower().endswith(".ifc"):
|
||||
metadata_path = ifc_file[:-4] + suffix
|
||||
else:
|
||||
metadata_path = ifc_file + suffix
|
||||
# Open the metadata blend file
|
||||
bpy.ops.wm.open_mainfile(filepath=metadata_path)
|
||||
# After loading metadata, clear blend warning (no geometry loaded yet)
|
||||
|
||||
@@ -715,13 +715,18 @@ class BIM_ADDON_preferences(bpy.types.AddonPreferences):
|
||||
)
|
||||
|
||||
save_metadata_blend_file: BoolProperty(
|
||||
name="Save non ifc data to .metadata.blend File",
|
||||
description="Save session data (window layout, settings) to a .metadata.blend file alongside the IFC file. This file is automatically loaded when opening the project.",
|
||||
name="Save non ifc data to metadata blend File",
|
||||
description="Save session data (window layout, settings) to a metadata blend file alongside the IFC file. This file is automatically loaded when opening the project.",
|
||||
default=False,
|
||||
)
|
||||
metadata_blend_file_suffix: StringProperty(
|
||||
name="Metadata File Suffix",
|
||||
description="Custom suffix for the metadata blend file. Will be appended to the filename (without .ifc).",
|
||||
default=".ifc.metadata.blend",
|
||||
)
|
||||
user_ui_customization: BoolProperty(
|
||||
name="User UI Customization",
|
||||
description="Enable user interface customization features (hide/show tabs and panels, bookmark panels) and save the session settings as part of the .metadata.blend file",
|
||||
description="Enable user interface customization features (hide/show tabs and panels, bookmark panels) and save the session settings as part of the metadata blend file",
|
||||
default=False,
|
||||
)
|
||||
|
||||
@@ -958,6 +963,9 @@ class BIM_ADDON_preferences(bpy.types.AddonPreferences):
|
||||
row.operator("bim.open_uri", text="", icon="HELP").uri = "https://community.osarch.org/discussion/comment/27030"
|
||||
layout.prop(self, "save_metadata_blend_file")
|
||||
if self.save_metadata_blend_file:
|
||||
row = layout.row()
|
||||
row.separator()
|
||||
row.prop(self, "metadata_blend_file_suffix")
|
||||
row = layout.row()
|
||||
row.separator()
|
||||
row.prop(self, "user_ui_customization")
|
||||
@@ -1633,6 +1641,8 @@ class BIM_PT_tab_representations(Panel):
|
||||
def poll(cls, context):
|
||||
if not should_show_panel(cls.bl_idname, cls.bim_tab_name, context):
|
||||
return False
|
||||
if tool.Blender.is_tab(context, cls.bim_tab_name) and tool.Ifc.get():
|
||||
return True
|
||||
return tool.Blender.is_tab(context, "BOOKMARK")
|
||||
|
||||
def draw(self, context):
|
||||
@@ -1675,6 +1685,8 @@ class BIM_PT_tab_parametric_geometry(Panel):
|
||||
def poll(cls, context):
|
||||
if not should_show_panel(cls.bl_idname, cls.bim_tab_name, context):
|
||||
return False
|
||||
if tool.Blender.is_tab(context, cls.bim_tab_name) and tool.Ifc.get():
|
||||
return True
|
||||
return tool.Blender.is_tab(context, "BOOKMARK")
|
||||
|
||||
def draw(self, context):
|
||||
@@ -1694,6 +1706,8 @@ class BIM_PT_tab_object_materials(Panel):
|
||||
def poll(cls, context):
|
||||
if not should_show_panel(cls.bl_idname, cls.bim_tab_name, context):
|
||||
return False
|
||||
if tool.Blender.is_tab(context, cls.bim_tab_name) and tool.Ifc.get():
|
||||
return True
|
||||
return tool.Blender.is_tab(context, "BOOKMARK")
|
||||
|
||||
def draw(self, context):
|
||||
|
||||
@@ -488,28 +488,28 @@ def sync_references(
|
||||
|
||||
for element in potential_reference_elements:
|
||||
# Skip spatial elements - their IFC placement is the source of truth
|
||||
if element.is_a("IfcSpatialElement"):
|
||||
if element.is_a("IfcSpatialElement"):
|
||||
continue
|
||||
|
||||
|
||||
# Skip grids - their IFC placement is the source of truth
|
||||
if element.is_a("IfcGrid") or element.is_a("IfcGridAxis"):
|
||||
continue
|
||||
|
||||
|
||||
if (obj := ifc.get_object(element)) and ifc.is_moved(obj):
|
||||
drawing_tool.sync_object_placement(obj)
|
||||
|
||||
for element in drawing_tool.get_group_elements(group):
|
||||
if not drawing_tool.is_auto_annotation(element):
|
||||
continue
|
||||
|
||||
|
||||
# Skip spatial elements - should never sync their placement
|
||||
if element.is_a("IfcSpatialElement"):
|
||||
continue
|
||||
|
||||
|
||||
# Skip grids
|
||||
if element.is_a("IfcGrid") or element.is_a("IfcGridAxis"):
|
||||
continue
|
||||
|
||||
continue
|
||||
|
||||
if (obj := ifc.get_object(element)) and ifc.is_moved(obj):
|
||||
drawing_tool.sync_object_placement(obj)
|
||||
if not (reference_element := drawing_tool.get_assigned_product(element)):
|
||||
|
||||
@@ -387,6 +387,12 @@ class Blender(bonsai.core.tool.Blender):
|
||||
@classmethod
|
||||
def copy_node_graph(cls, material_to: bpy.types.Material, material_from: bpy.types.Material) -> None:
|
||||
temp_override = cls.get_shader_editor_context()
|
||||
if (
|
||||
not temp_override
|
||||
or any(k not in temp_override for k in ("area", "space", "screen"))
|
||||
or temp_override.get("window") is None
|
||||
):
|
||||
return
|
||||
shader_editor = temp_override["space"]
|
||||
|
||||
# remove all nodes from the current material
|
||||
|
||||
@@ -52,7 +52,7 @@ if(SCHEMA_VERSIONS MATCHES "2x3")
|
||||
add_executable(IfcAdvancedHouse IfcAdvancedHouse.cpp)
|
||||
add_library(IfcHouseInterface INTERFACE)
|
||||
|
||||
if (STANDALONE_PROJECT)
|
||||
if(STANDALONE_PROJECT)
|
||||
target_link_libraries(IfcHouseInterface INTERFACE IfcOpenShell::IfcParse IfcOpenShell::geometry_serializer)
|
||||
else()
|
||||
target_link_libraries(IfcHouseInterface INTERFACE IfcParse geometry_serializer)
|
||||
|
||||
@@ -9,13 +9,18 @@ endif()
|
||||
set(IFCCONVERT_FILES ${IFCCONVERT_CPP_FILES} ${IFCCONVERT_H_FILES})
|
||||
add_executable(IfcConvert ${IFCCONVERT_FILES})
|
||||
|
||||
target_link_libraries(IfcConvert
|
||||
target_link_libraries(
|
||||
IfcConvert
|
||||
PRIVATE
|
||||
IfcGeom IfcParse Serializers
|
||||
${OpenCASCADE_LIBRARIES} ${Boost_LIBRARIES} ${HDF5_LIBRARIES} ${USD_LIBRARIES}
|
||||
${CGAL_LIBRARIES} ${GLTF_LIBRARIES}
|
||||
IfcGeom
|
||||
IfcParse
|
||||
Serializers
|
||||
${OpenCASCADE_LIBRARIES}
|
||||
${Boost_LIBRARIES}
|
||||
${HDF5_LIBRARIES}
|
||||
${USD_LIBRARIES}
|
||||
${CGAL_LIBRARIES}
|
||||
${GLTF_LIBRARIES}
|
||||
)
|
||||
|
||||
install(TARGETS IfcConvert
|
||||
EXPORT ${IFCOPENSHELL_EXPORT_TARGETS}
|
||||
)
|
||||
install(TARGETS IfcConvert EXPORT ${IFCOPENSHELL_EXPORT_TARGETS})
|
||||
|
||||
@@ -14,12 +14,13 @@ file(GLOB SCHEMA_AGNOSTIC_CPP_FILES *.cpp)
|
||||
set(SCHEMA_AGNOSTIC_FILES ${SCHEMA_AGNOSTIC_H_FILES} ${SCHEMA_AGNOSTIC_CPP_FILES})
|
||||
|
||||
add_library(IfcGeom ${SCHEMA_AGNOSTIC_FILES})
|
||||
set_target_properties(IfcGeom
|
||||
set_target_properties(
|
||||
IfcGeom
|
||||
PROPERTIES
|
||||
COMPILE_FLAGS -DIFC_GEOM_EXPORTS
|
||||
VERSION "${PROJECT_VERSION}"
|
||||
SOVERSION "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}"
|
||||
PUBLIC_HEADER "${SCHEMA_AGNOSTIC_H_FILES}"
|
||||
COMPILE_FLAGS -DIFC_GEOM_EXPORTS
|
||||
VERSION "${PROJECT_VERSION}"
|
||||
SOVERSION "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}"
|
||||
PUBLIC_HEADER "${SCHEMA_AGNOSTIC_H_FILES}"
|
||||
)
|
||||
|
||||
if(UNIX)
|
||||
@@ -28,16 +29,20 @@ endif()
|
||||
|
||||
find_package(Eigen3 REQUIRED)
|
||||
|
||||
target_link_libraries(IfcGeom
|
||||
${kernel_libraries} ${mapping_libraries}
|
||||
${CMAKE_THREAD_LIBS_INIT} "Eigen3::Eigen"
|
||||
target_link_libraries(
|
||||
IfcGeom
|
||||
${kernel_libraries}
|
||||
${mapping_libraries}
|
||||
${CMAKE_THREAD_LIBS_INIT}
|
||||
"Eigen3::Eigen"
|
||||
${CGAL_LIBRARIES}
|
||||
)
|
||||
if(NOT WASM_BUILD)
|
||||
target_link_libraries(IfcGeom IfcParse)
|
||||
endif()
|
||||
|
||||
install(TARGETS IfcGeom
|
||||
install(
|
||||
TARGETS IfcGeom
|
||||
EXPORT ${IFCOPENSHELL_EXPORT_TARGETS}
|
||||
PUBLIC_HEADER DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/ifcgeom"
|
||||
)
|
||||
|
||||
@@ -3,15 +3,16 @@ add_subdirectory(schema)
|
||||
add_library(geometry_serializer STATIC Serialization.cpp)
|
||||
file(GLOB IFCGEOM_SERIALIZATION_H_FILE *.h)
|
||||
|
||||
set_target_properties(geometry_serializer PROPERTIES
|
||||
COMPILE_FLAGS "-DIFC_GEOMSERIALIZATION_EXPORTS"
|
||||
PUBLIC_HEADER "${IFCGEOM_SERIALIZATION_H_FILE}"
|
||||
set_target_properties(
|
||||
geometry_serializer
|
||||
PROPERTIES COMPILE_FLAGS "-DIFC_GEOMSERIALIZATION_EXPORTS" PUBLIC_HEADER "${IFCGEOM_SERIALIZATION_H_FILE}"
|
||||
)
|
||||
target_link_libraries(geometry_serializer ${geometry_serializer_libraries} IfcParse)
|
||||
set(IFCOPENSHELL_LIBRARIES ${IFCOPENSHELL_LIBRARIES} "geometry_serializer" ${geometry_serializer_libraries})
|
||||
set(IFCOPENSHELL_LIBRARIES ${IFCOPENSHELL_LIBRARIES} PARENT_SCOPE)
|
||||
|
||||
install(TARGETS geometry_serializer ${geometry_serializer_libraries}
|
||||
install(
|
||||
TARGETS geometry_serializer ${geometry_serializer_libraries}
|
||||
EXPORT ${IFCOPENSHELL_EXPORT_TARGETS}
|
||||
PUBLIC_HEADER DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/ifcgeom/Serialization"
|
||||
)
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
foreach(schema ${SCHEMA_VERSIONS})
|
||||
add_library(geometry_serializer_ifc${schema} STATIC Serialization.cpp)
|
||||
target_link_libraries(geometry_serializer_ifc${schema} ${OpenCASCADE_LIBRARIES})
|
||||
set_target_properties(geometry_serializer_ifc${schema} PROPERTIES COMPILE_FLAGS "-DIFC_GEOMSERIALIZATION_EXPORTS -DIfcSchema=Ifc${schema}")
|
||||
set_target_properties(
|
||||
geometry_serializer_ifc${schema}
|
||||
PROPERTIES COMPILE_FLAGS "-DIFC_GEOMSERIALIZATION_EXPORTS -DIfcSchema=Ifc${schema}"
|
||||
)
|
||||
list(APPEND geometry_serializer_libraries geometry_serializer_ifc${schema})
|
||||
endforeach()
|
||||
set(geometry_serializer_libraries ${geometry_serializer_libraries} PARENT_SCOPE)
|
||||
set(geometry_serializer_libraries ${geometry_serializer_libraries} PARENT_SCOPE)
|
||||
|
||||
@@ -9,13 +9,14 @@ foreach(kernel ${GEOMETRY_KERNELS})
|
||||
set(KERNEL_TARGET "geometry_kernel_${kernel}")
|
||||
|
||||
add_library(${KERNEL_TARGET} OBJECT ${IFCGEOM_FILES})
|
||||
set_target_properties(${KERNEL_TARGET} PROPERTIES
|
||||
COMPILE_FLAGS "-DIFC_GEOM_EXPORTS"
|
||||
PUBLIC_HEADER "${IFCGEOM_H_FILES}"
|
||||
set_target_properties(
|
||||
${KERNEL_TARGET}
|
||||
PROPERTIES COMPILE_FLAGS "-DIFC_GEOM_EXPORTS" PUBLIC_HEADER "${IFCGEOM_H_FILES}"
|
||||
)
|
||||
list(APPEND kernel_libraries ${KERNEL_TARGET})
|
||||
target_link_libraries(${KERNEL_TARGET} ${${KERNEL_UPPER}_LIBRARIES} Eigen3::Eigen)
|
||||
install(TARGETS ${KERNEL_TARGET}
|
||||
install(
|
||||
TARGETS ${KERNEL_TARGET}
|
||||
EXPORT ${IFCOPENSHELL_EXPORT_TARGETS}
|
||||
PUBLIC_HEADER DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/ifcgeom/kernels/${kernel}"
|
||||
)
|
||||
@@ -27,13 +28,14 @@ foreach(kernel ${GEOMETRY_KERNELS})
|
||||
|
||||
set(KERNEL_TARGET_SIMPLE "${KERNEL_TARGET}_simple")
|
||||
add_library(${KERNEL_TARGET_SIMPLE} OBJECT ${IFCGEOM_FILES})
|
||||
set_target_properties(${KERNEL_TARGET_SIMPLE} PROPERTIES COMPILE_FLAGS "-DIFC_GEOM_EXPORTS -DIFOPSH_SIMPLE_KERNEL -DCGAL_HAS_THREADS")
|
||||
set_target_properties(
|
||||
${KERNEL_TARGET_SIMPLE}
|
||||
PROPERTIES COMPILE_FLAGS "-DIFC_GEOM_EXPORTS -DIFOPSH_SIMPLE_KERNEL -DCGAL_HAS_THREADS"
|
||||
)
|
||||
list(APPEND kernel_libraries ${KERNEL_TARGET_SIMPLE})
|
||||
target_link_libraries(${KERNEL_TARGET_SIMPLE} ${${KERNEL_UPPER}_LIBRARIES} Eigen3::Eigen)
|
||||
target_link_libraries(${KERNEL_TARGET_SIMPLE} IFCOPENSHELL_CGAL)
|
||||
install(TARGETS ${KERNEL_TARGET_SIMPLE}
|
||||
EXPORT ${IFCOPENSHELL_EXPORT_TARGETS}
|
||||
)
|
||||
install(TARGETS ${KERNEL_TARGET_SIMPLE} EXPORT ${IFCOPENSHELL_EXPORT_TARGETS})
|
||||
elseif(${kernel} STREQUAL "opencascade")
|
||||
target_link_libraries(${KERNEL_TARGET} ${OpenCASCADE_LIBRARIES})
|
||||
endif()
|
||||
|
||||
@@ -7,13 +7,14 @@ foreach(schema ${SCHEMA_VERSIONS})
|
||||
set(IFCGEOM_FILES ${IFCGEOM_CPP_FILES} ${IFCGEOM_H_FILES} ${IFCGEOM_I_FILES})
|
||||
|
||||
add_library(geometry_mapping_ifc${schema} OBJECT ${IFCGEOM_FILES})
|
||||
set_target_properties(geometry_mapping_ifc${schema} PROPERTIES COMPILE_FLAGS "-DIFC_GEOM_EXPORTS -DIfcSchema=Ifc${schema}")
|
||||
target_link_libraries(geometry_mapping_ifc${schema} IfcParse Eigen3::Eigen)
|
||||
set_target_properties(
|
||||
geometry_mapping_ifc${schema}
|
||||
PROPERTIES COMPILE_FLAGS "-DIFC_GEOM_EXPORTS -DIfcSchema=Ifc${schema}"
|
||||
)
|
||||
target_link_libraries(geometry_mapping_ifc${schema} IfcParse Eigen3::Eigen)
|
||||
|
||||
list(APPEND mapping_libraries geometry_mapping_ifc${schema})
|
||||
install(TARGETS geometry_mapping_ifc${schema}
|
||||
EXPORT ${IFCOPENSHELL_EXPORT_TARGETS}
|
||||
)
|
||||
install(TARGETS geometry_mapping_ifc${schema} EXPORT ${IFCOPENSHELL_EXPORT_TARGETS})
|
||||
endforeach()
|
||||
|
||||
set(mapping_libraries ${mapping_libraries} PARENT_SCOPE)
|
||||
|
||||
@@ -5,6 +5,4 @@ set(SOURCE_FILES ${CPP_FILES})
|
||||
add_executable(IfcGeomServer ${SOURCE_FILES})
|
||||
target_link_libraries(IfcGeomServer IfcGeom ${kernel_libraries} ${OpenCASCADE_LIBRARIES})
|
||||
|
||||
install(TARGETS IfcGeomServer
|
||||
EXPORT ${IFCOPENSHELL_EXPORT_TARGETS}
|
||||
)
|
||||
install(TARGETS IfcGeomServer EXPORT ${IFCOPENSHELL_EXPORT_TARGETS})
|
||||
|
||||
+30
-90
@@ -18,20 +18,9 @@
|
||||
################################################################################
|
||||
|
||||
# check for 3ds Max SDK
|
||||
set(valid_max_years 2027 2026 2025 2024 2023 2022 2021 2020 2019 2018 2017)
|
||||
|
||||
# might be dangerous to use tools 143 for all max versions
|
||||
set(max_toolset_versions_143 "2017" "2018" "2019" "2020" "2021" "2022" "2023" "2024" "2025" "2026" "2027" )
|
||||
# set(max_toolset_versions_143 "2025" "2026" "2027" )
|
||||
# set(max_toolset_versions_142 "2022" "2023" "2024" )
|
||||
# set(max_toolset_versions_141 "2020" "2021" )
|
||||
# set(max_toolset_versions_140 "2017" "2018" "2019" )
|
||||
# set(max_toolset_versions_110 "2015" "2016" )
|
||||
# set(max_toolset_versions_100 "2013" "2014" )
|
||||
# set(max_toolset_versions_90 "2010" "2011" "2012" )
|
||||
|
||||
foreach(max_year ${valid_max_years})
|
||||
foreach(max_year RANGE 2014 2030)
|
||||
set(max_sdk "$ENV{ADSK_3DSMAX_SDK_${max_year}}")
|
||||
|
||||
if(NOT "${max_sdk}" STREQUAL "")
|
||||
message(STATUS "Autodesk 3ds Max SDK ${max_year} found at ${max_sdk}")
|
||||
list(APPEND FOUND_MAX_YEARS ${max_year})
|
||||
@@ -40,44 +29,35 @@ foreach(max_year ${valid_max_years})
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
message(STATUS)
|
||||
|
||||
if(HAS_MAX)
|
||||
# set depenency include and link directoris outside of MaxSDK loop
|
||||
include_directories(${INCLUDE_DIRECTORIES} ${OCC_INCLUDE_DIR} ${OPENCOLLADA_INCLUDE_DIRS} ${ICU_INCLUDE_DIR} ${Boost_INCLUDE_DIRS} )
|
||||
link_directories(${LINK_DIRECTORIES} ${IfcOpenShell_BINARY_DIR} ${OCC_LIBRARY_DIR} ${OPENCOLLADA_LIBRARY_DIR} ${ICU_LIBRARY_DIR} ${Boost_LIBRARY_DIRS} )
|
||||
|
||||
# Specify individual source files
|
||||
set(MAX_SOURCES
|
||||
IfcMax.h
|
||||
IfcMax.cpp
|
||||
IfcMax.rc
|
||||
resource.h
|
||||
# IfcHelper.h
|
||||
# IfcHelper.cpp
|
||||
# MaxUtils.h
|
||||
# MaxUtils.cpp
|
||||
)
|
||||
|
||||
# build library for each found 3ds Max SDK
|
||||
# build libraray for each found 3ds Max SDK
|
||||
foreach(max_year max_sdk IN ZIP_LISTS FOUND_MAX_YEARS FOUND_MAX_SDKS)
|
||||
message(STATUS "Building IFCMax library for Autodesk 3ds Max SDK ${max_year}")
|
||||
|
||||
# skip 3ds Max versions that do not match the vs toolset
|
||||
if( NOT ${max_year} IN_LIST max_toolset_versions_${MSVC_TOOLSET_VERSION} )
|
||||
continue()
|
||||
endif()
|
||||
include_directories(
|
||||
${INCLUDE_DIRECTORIES}
|
||||
${OPENCOLLADA_INCLUDE_DIRS}
|
||||
${ICU_INCLUDE_DIR}
|
||||
${Boost_INCLUDE_DIRS}
|
||||
${max_sdk}/include
|
||||
)
|
||||
|
||||
message(STATUS "Adding build target: IFCMax for 3ds Max SDK ${max_year}, Tier: ${BUILD_TIER_NAME}")
|
||||
# All recent versions of 3ds Max (2014 and newer) are 64-bit only so assume lib/x64 directory
|
||||
link_directories(
|
||||
${LINK_DIRECTORIES}
|
||||
${IfcOpenShell_BINARY_DIR}
|
||||
${OPENCOLLADA_LIBRARY_DIR}
|
||||
${ICU_LIBRARY_DIR}
|
||||
${Boost_LIBRARY_DIRS}
|
||||
${max_sdk}/lib/x64/Release
|
||||
)
|
||||
|
||||
add_library(IfcMax_${max_year} SHARED ${MAX_SOURCES})
|
||||
|
||||
target_include_directories(IfcMax_${max_year} PRIVATE ${max_sdk}/include)
|
||||
|
||||
# All recent versions of 3ds Max (2014 and newer) are 64-bit only so assume lib/x64 directory
|
||||
target_link_directories(IfcMax_${max_year} PRIVATE ${max_sdk}/lib/x64/Release)
|
||||
add_library(IfcMax_${max_year} SHARED IfcMax.h IfcMax.cpp)
|
||||
|
||||
# TODO: find the minimal subset of 3dsmax libraries to reference
|
||||
target_link_libraries(IfcMax_${max_year} ${IFCOPENSHELL_LIBRARIES}
|
||||
target_link_libraries(
|
||||
IfcMax_${max_year}
|
||||
${IFCOPENSHELL_LIBRARIES}
|
||||
bmm.lib
|
||||
Comctl32.lib
|
||||
core.lib
|
||||
@@ -93,6 +73,8 @@ if(HAS_MAX)
|
||||
maxnet.lib
|
||||
Maxscrpt.lib
|
||||
maxutil.lib
|
||||
MenuMan.lib
|
||||
menus.lib
|
||||
mesh.lib
|
||||
MNMath.lib
|
||||
Paramblk2.lib
|
||||
@@ -101,56 +83,14 @@ if(HAS_MAX)
|
||||
RenderUtil.lib
|
||||
tessint.lib
|
||||
viewfile.lib
|
||||
${OPENCASCADE_LIBRARIES}
|
||||
)
|
||||
|
||||
# Note: libraries build by same major vs toolset versions are binary compatible. so v14x builds can be intermixed
|
||||
# Older Max versions using v110 or older require dependencies being build using the according toolset version ( most likely )
|
||||
if( ${max_year} IN_LIST max_toolset_versions_143 )
|
||||
set_target_properties( IfcMax_${max_year} PROPERTIES VS_PLATFORM_TOOLSET v143)
|
||||
elseif( ${max_year} IN_LIST max_toolset_versions_142 )
|
||||
set_target_properties( IfcMax_${max_year} PROPERTIES VS_PLATFORM_TOOLSET v142)
|
||||
elseif( ${max_year} IN_LIST max_toolset_versions_141 )
|
||||
set_target_properties( IfcMax_${max_year} PROPERTIES VS_PLATFORM_TOOLSET v141)
|
||||
elseif( ${max_year} IN_LIST max_toolset_versions_140 )
|
||||
set_target_properties( IfcMax_${max_year} PROPERTIES VS_PLATFORM_TOOLSET v140)
|
||||
elseif( ${max_year} IN_LIST max_toolset_versions_110 )
|
||||
set_target_properties( IfcMax_${max_year} PROPERTIES VS_PLATFORM_TOOLSET v110)
|
||||
elseif( ${max_year} IN_LIST max_toolset_versions_100 )
|
||||
set_target_properties( IfcMax_${max_year} PROPERTIES VS_PLATFORM_TOOLSET v100)
|
||||
elseif( ${max_year} IN_LIST max_toolset_versions_90 )
|
||||
set_target_properties( IfcMax_${max_year} PROPERTIES VS_PLATFORM_TOOLSET v90)
|
||||
endif()
|
||||
zlibdll.lib
|
||||
${OpenCASCADE_LIBRARIES}
|
||||
)
|
||||
|
||||
# prevent minmax macro clashes occuring with ifcOpenShell v0.8
|
||||
target_compile_definitions(IfcMax_${max_year} PRIVATE NOMINMAX)
|
||||
|
||||
# fix 3ds Max 2020 SDK's "/permissive-" flag incompatibility / disables C++ language conformance mode
|
||||
if( ${max_year} EQUAL 2020 )
|
||||
set_source_files_properties( "IfcMax.cpp" PROPERTIES COMPILE_FLAGS "/permissive")
|
||||
endif()
|
||||
|
||||
# C++17 required for 3ds Max SDK 2025 and higher
|
||||
if( ${max_year} GREATER_EQUAL 2025 )
|
||||
set_target_properties(IfcMax_${max_year} PROPERTIES CXX_STANDARD 17)
|
||||
endif()
|
||||
|
||||
set_target_properties(IfcMax_${max_year} PROPERTIES SUFFIX ".dli")
|
||||
|
||||
if(BUILD_TIER_NAME)
|
||||
target_compile_definitions(IfcMax_${max_year} PRIVATE BUILD_${BUILD_TIER_NAME}_TIER)
|
||||
|
||||
string(TOLOWER "${BUILD_TIER_NAME}" BUILD_TIER_lower)
|
||||
if(BUILD_TIER_lower STREQUAL "free")
|
||||
set_target_properties(IfcMax_${max_year} PROPERTIES OUTPUT_NAME "IfcMax_Free_${max_year}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
install(TARGETS IfcMax_${max_year} RUNTIME DESTINATION ${BINDIR})
|
||||
|
||||
install(TARGETS IfcMax_${max_year})
|
||||
endforeach()
|
||||
message(STATUS)
|
||||
else()
|
||||
message(STATUS "Autodesk 3ds Max SDK not found, is required to build IFCMax.")
|
||||
endif()
|
||||
|
||||
|
||||
@@ -738,7 +738,7 @@ class AttributeGetattrTransformer(ast.NodeTransformer):
|
||||
while n := getattr(n, "parent", 0):
|
||||
parents.append(n)
|
||||
|
||||
custom_funcs = "is_entity", "usedin", "express_len", "express_getitem", "typeof"
|
||||
custom_funcs = "is_entity", "usedin", "express_len", "express_getitem", "typeof", "express_getattr"
|
||||
function_defs = [p.name for p in parents if isinstance(p, ast.FunctionDef)]
|
||||
if any(fn in function_defs for fn in custom_funcs):
|
||||
return node
|
||||
@@ -755,7 +755,7 @@ class AttributeGetattrTransformer(ast.NodeTransformer):
|
||||
# Replace the Attribute node with a call to the built-in `getattr` function
|
||||
return ast.copy_location(
|
||||
ast.Call(
|
||||
func=ast.Name(id="getattr", ctx=ast.Load()),
|
||||
func=ast.Name(id="express_getattr", ctx=ast.Load()),
|
||||
args=[
|
||||
new_value,
|
||||
ast.Str(s=node.attr),
|
||||
@@ -772,7 +772,7 @@ class AttributeGetattrTransformer(ast.NodeTransformer):
|
||||
while n := getattr(n, "parent", 0):
|
||||
parents.append(n)
|
||||
|
||||
custom_funcs = "is_entity", "usedin", "express_len", "express_getitem", "typeof"
|
||||
custom_funcs = "is_entity", "usedin", "express_len", "express_getitem", "typeof", "express_getattr"
|
||||
function_defs = [p.name for p in parents if isinstance(p, ast.FunctionDef)]
|
||||
if any(fn in function_defs for fn in custom_funcs):
|
||||
return node
|
||||
@@ -937,6 +937,14 @@ def express_getitem(aggr, idx, default):
|
||||
except IndexError as e: return None
|
||||
|
||||
|
||||
def express_getattr(aggr, name, default):
|
||||
v = getattr(aggr, name, default)
|
||||
if v is None:
|
||||
return default
|
||||
else:
|
||||
return v
|
||||
|
||||
|
||||
EXPRESS_ONE_BASED_INDEXING = 1
|
||||
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ from codegen import indent
|
||||
|
||||
|
||||
def reverse_compile(s):
|
||||
return re.sub(
|
||||
return re.sub(r'\bself\b', 'SELF', re.sub(
|
||||
r"\s*\-\s*EXPRESS_ONE_BASED_INDEXING",
|
||||
"",
|
||||
re.sub(
|
||||
@@ -22,11 +22,11 @@ def reverse_compile(s):
|
||||
.replace("len(", "SIZEOF(")
|
||||
.replace("assert ", "")
|
||||
.replace(" is not False", "")
|
||||
.replace("getattr(", "")
|
||||
.replace("express_getattr(", "")
|
||||
.replace("express_getitem(", ""),
|
||||
)[::-1],
|
||||
)[::-1],
|
||||
)
|
||||
))
|
||||
|
||||
|
||||
@dataclass
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Vendored
+10
@@ -0,0 +1,10 @@
|
||||
ISO-10303-21;
|
||||
HEADER;
|
||||
FILE_DESCRIPTION(('ViewDefinition [CoordinationView]'),'2;1');
|
||||
FILE_NAME('','2025-12-24T14:25:45',(''),(''),'IfcOpenShell 0.8.0','IfcOpenShell 0.8.0','');
|
||||
FILE_SCHEMA(('IFC4X3_ADD2'));
|
||||
ENDSEC;
|
||||
DATA;
|
||||
#1=IFCPROPERTYLISTVALUE('Test',$,(IFCLABEL('test1'),IFCINTEGER(2)),$);
|
||||
ENDSEC;
|
||||
END-ISO-10303-21;
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
ISO-10303-21;
|
||||
HEADER;
|
||||
FILE_DESCRIPTION(('ViewDefinition [CoordinationView]'),'2;1');
|
||||
FILE_NAME('','2025-12-24T14:25:45',(''),(''),'IfcOpenShell 0.8.0','IfcOpenShell 0.8.0','');
|
||||
FILE_SCHEMA(('IFC4X3_ADD2'));
|
||||
ENDSEC;
|
||||
DATA;
|
||||
#1=IFCPROPERTYLISTVALUE('Test',$,(IFCLABEL('test1'),IFCLABEL('test2')),$);
|
||||
ENDSEC;
|
||||
END-ISO-10303-21;
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
ISO-10303-21;
|
||||
HEADER;
|
||||
FILE_DESCRIPTION(('ViewDefinition [CoordinationView]'),'2;1');
|
||||
FILE_NAME('','2025-12-24T14:25:45',(''),(''),'IfcOpenShell 0.8.0','IfcOpenShell 0.8.0','');
|
||||
FILE_SCHEMA(('IFC4X3_ADD2'));
|
||||
ENDSEC;
|
||||
DATA;
|
||||
#1=IFCPROPERTYLISTVALUE('Test',$,$,$);
|
||||
ENDSEC;
|
||||
END-ISO-10303-21;
|
||||
+10
-14
@@ -18,26 +18,21 @@ foreach(file ${IFCPARSE_CPP_FILES_ALL})
|
||||
endforeach()
|
||||
|
||||
foreach(schema ${SCHEMA_VERSIONS})
|
||||
list(APPEND IFCPARSE_H_FILES
|
||||
Ifc${schema}.h
|
||||
Ifc${schema}-definitions.h
|
||||
)
|
||||
list(APPEND IFCPARSE_CPP_FILES
|
||||
Ifc${schema}.cpp
|
||||
Ifc${schema}-schema.cpp
|
||||
)
|
||||
list(APPEND IFCPARSE_H_FILES Ifc${schema}.h Ifc${schema}-definitions.h)
|
||||
list(APPEND IFCPARSE_CPP_FILES Ifc${schema}.cpp Ifc${schema}-schema.cpp)
|
||||
endforeach()
|
||||
|
||||
set(IFCPARSE_FILES ${IFCPARSE_CPP_FILES} ${IFCPARSE_H_FILES})
|
||||
|
||||
add_library(IfcParse ${IFCPARSE_FILES})
|
||||
target_compile_definitions(IfcParse PUBLIC ${SCHEMA_DEFINITIONS})
|
||||
set_target_properties(IfcParse
|
||||
set_target_properties(
|
||||
IfcParse
|
||||
PROPERTIES
|
||||
COMPILE_FLAGS -DIFC_PARSE_EXPORTS
|
||||
VERSION "${PROJECT_VERSION}"
|
||||
SOVERSION "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}"
|
||||
PUBLIC_HEADER "${IFCPARSE_H_FILES}"
|
||||
COMPILE_FLAGS -DIFC_PARSE_EXPORTS
|
||||
VERSION "${PROJECT_VERSION}"
|
||||
SOVERSION "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}"
|
||||
PUBLIC_HEADER "${IFCPARSE_H_FILES}"
|
||||
)
|
||||
|
||||
if(IFCXML_SUPPORT)
|
||||
@@ -56,7 +51,8 @@ endif()
|
||||
|
||||
target_link_libraries(IfcParse ${ROCKSDB_LIBRARIES})
|
||||
|
||||
install(TARGETS IfcParse
|
||||
install(
|
||||
TARGETS IfcParse
|
||||
EXPORT ${IFCOPENSHELL_EXPORT_TARGETS}
|
||||
PUBLIC_HEADER DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/ifcparse"
|
||||
INCLUDES DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}"
|
||||
|
||||
+70
-83
@@ -24,27 +24,27 @@ if(POLICY CMP0177) # 3.31
|
||||
cmake_policy(SET CMP0177 OLD)
|
||||
endif()
|
||||
|
||||
FIND_PACKAGE(SWIG)
|
||||
IF(NOT SWIG_FOUND)
|
||||
MESSAGE(
|
||||
find_package(SWIG)
|
||||
if(NOT SWIG_FOUND)
|
||||
message(
|
||||
FATAL_ERROR
|
||||
"BUILD_IFCPYTHON enabled, but unable to find SWIG. Disable BUILD_IFCPYTHON or fix SWIG paths to proceed. "
|
||||
"Likely SWIG_EXECUTABLE is missing (current value - '${SWIG_EXECUTABLE}')."
|
||||
)
|
||||
ENDIF()
|
||||
endif()
|
||||
include(GNUInstallDirs)
|
||||
INCLUDE(${SWIG_USE_FILE})
|
||||
include(${SWIG_USE_FILE})
|
||||
|
||||
IF(NOT "${PYTHON_INCLUDE_DIR}" STREQUAL "")
|
||||
if(NOT "${PYTHON_INCLUDE_DIR}" STREQUAL "")
|
||||
# Hint for FindPython where to find Python_INCLUDE_DIRS.
|
||||
set(Python_INCLUDE_DIR "${PYTHON_INCLUDE_DIR}")
|
||||
MESSAGE(STATUS "Looking for Python header files in: ${Python_INCLUDE_DIR}")
|
||||
ENDIF()
|
||||
IF(NOT "${PYTHON_LIBRARY}" STREQUAL "")
|
||||
message(STATUS "Looking for Python header files in: ${Python_INCLUDE_DIR}")
|
||||
endif()
|
||||
if(NOT "${PYTHON_LIBRARY}" STREQUAL "")
|
||||
# Hint for FindPython where to find Python_LIBRARIES.
|
||||
set(Python_LIBRARY "${PYTHON_LIBRARY}")
|
||||
MESSAGE(STATUS "Looking for Python library file in: ${Python_LIBRARY}")
|
||||
ENDIF()
|
||||
message(STATUS "Looking for Python library file in: ${Python_LIBRARY}")
|
||||
endif()
|
||||
|
||||
# Development.Module = headers on Unix, headers+libraries on Windows.
|
||||
# Required variables:
|
||||
@@ -53,31 +53,29 @@ ENDIF()
|
||||
# Unfortunately all paths must be always provided explicitly, not by prefixing PATH.
|
||||
# Otherwise FindPython will break on newer Python versions (list of supported versions is hardcoded).
|
||||
find_package(Python COMPONENTS Development.Module)
|
||||
IF(NOT Python_Development.Module_FOUND)
|
||||
MESSAGE(FATAL_ERROR "BUILD_IFCPYTHON enabled, but unable to find Python lib or header. Disable BUILD_IFCPYTHON or fix Python paths to proceed.")
|
||||
ENDIF()
|
||||
if(NOT Python_Development.Module_FOUND)
|
||||
message(
|
||||
FATAL_ERROR
|
||||
"BUILD_IFCPYTHON enabled, but unable to find Python lib or header. Disable BUILD_IFCPYTHON or fix Python paths to proceed."
|
||||
)
|
||||
endif()
|
||||
|
||||
# Ensure version is saved here, from wasm libraries,
|
||||
# not from Python interpreter that might be unrelated to pyodide Python version.
|
||||
set(_python_libs_version "${Python_VERSION_MAJOR}${Python_VERSION_MINOR}")
|
||||
INCLUDE_DIRECTORIES(BEFORE ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
include_directories(BEFORE ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
|
||||
SET(CMAKE_SWIG_FLAGS ${SWIG_DEFINES})
|
||||
set(CMAKE_SWIG_FLAGS ${SWIG_DEFINES})
|
||||
|
||||
if (WITH_CGAL)
|
||||
if(WITH_CGAL)
|
||||
set(LIBSVGFILL svgfill)
|
||||
endif()
|
||||
|
||||
SET_SOURCE_FILES_PROPERTIES(IfcPython.i PROPERTIES CPLUSPLUS ON)
|
||||
set_source_files_properties(IfcPython.i PROPERTIES CPLUSPLUS ON)
|
||||
# Rebuild on changes in other .i files.
|
||||
SET_PROPERTY(
|
||||
SOURCE IfcPython.i
|
||||
PROPERTY DEPENDS
|
||||
IfcGeomWrapper.i
|
||||
IfcParseWrapper.i
|
||||
utils/type_conversion.i
|
||||
utils/typemaps_in.i
|
||||
utils/typemaps_out.i
|
||||
set_property(
|
||||
SOURCE IfcPython.i
|
||||
PROPERTY DEPENDS IfcGeomWrapper.i IfcParseWrapper.i utils/type_conversion.i utils/typemaps_in.i utils/typemaps_out.i
|
||||
)
|
||||
|
||||
# On Windows there is '_d' prefix for debug builds - e.g. `_d.cp311-win_amd64.pyd`.
|
||||
@@ -92,20 +90,18 @@ endif()
|
||||
# But debug mode is still might be needed - e.g. Blender's Python is using it, if you're running debug build.
|
||||
if(NOT USE_DEBUG_PYTHON)
|
||||
set(Python_DEBUG_POSTFIX "")
|
||||
add_compile_definitions(SWIG_PYTHON_INTERPRETER_NO_DEBUG)
|
||||
add_compile_definitions(SWIG_PYTHON_INTERPRETER_NO_DEBUG)
|
||||
if(Python_LIBRARY_DEBUG)
|
||||
# If debug libraries were found, then override them with release ones.
|
||||
get_target_property(IMPORTED_IMPLIB Python::Module IMPORTED_IMPLIB_RELEASE)
|
||||
get_target_property(IMPORTED_LOCATION Python::Module IMPORTED_LOCATION_RELEASE)
|
||||
set_target_properties(
|
||||
Python::Module
|
||||
PROPERTIES
|
||||
IMPORTED_IMPLIB_DEBUG "${IMPORTED_IMPLIB}"
|
||||
IMPORTED_LOCATION_DEBUG "${IMPORTED_LOCATION}"
|
||||
PROPERTIES IMPORTED_IMPLIB_DEBUG "${IMPORTED_IMPLIB}" IMPORTED_LOCATION_DEBUG "${IMPORTED_LOCATION}"
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
if (CMAKE_VERSION VERSION_GREATER_EQUAL "4.2")
|
||||
if(CMAKE_VERSION VERSION_GREATER_EQUAL "4.2")
|
||||
# `DEBUG_POSTFIX` argument was added in 4.2.
|
||||
swig_add_library(ifcopenshell_wrapper LANGUAGE python SOURCES IfcPython.i DEBUG_POSTFIX "${Python_DEBUG_POSTFIX}")
|
||||
else()
|
||||
@@ -113,15 +109,12 @@ else()
|
||||
# swig py wrapper will try to import `_ifcopenshell_wrapper_d` module and would fail.
|
||||
set(SWIG_MODULE_ifcopenshell_wrapper_EXTRA_FLAGS "-interface" "_ifcopenshell_wrapper")
|
||||
swig_add_library(ifcopenshell_wrapper LANGUAGE python SOURCES IfcPython.i)
|
||||
set_target_properties(
|
||||
ifcopenshell_wrapper PROPERTIES
|
||||
DEBUG_POSTFIX "${Python_DEBUG_POSTFIX}"
|
||||
)
|
||||
set_target_properties(ifcopenshell_wrapper PROPERTIES DEBUG_POSTFIX "${Python_DEBUG_POSTFIX}")
|
||||
endif()
|
||||
|
||||
target_link_libraries(ifcopenshell_wrapper PRIVATE Python::Module)
|
||||
SET_PROPERTY(TARGET ifcopenshell_wrapper PROPERTY SWIG_DEPENDS ${IFCOPENSHELL_LIBRARIES})
|
||||
if (WASM_BUILD)
|
||||
set_property(TARGET ifcopenshell_wrapper PROPERTY SWIG_DEPENDS ${IFCOPENSHELL_LIBRARIES})
|
||||
if(WASM_BUILD)
|
||||
# SIDE_MODULE=1 - add to .so all symbols from linked archives (default used by pyodide).
|
||||
# Since currently libIfcGeom.a seems to be linked twice it results in duplicated symbols and compilation errors.
|
||||
# Possibly in the future we can clean up linked libs and try `=1`.
|
||||
@@ -130,11 +123,7 @@ if (WASM_BUILD)
|
||||
if(CMAKE_GENERATOR MATCHES "Makefile" AND CMAKE_VERSION VERSION_LESS "4.2")
|
||||
# Accomodate bug in cmake makefile generator (fixed in 4.2+).
|
||||
# https://gitlab.kitware.com/cmake/cmake/-/issues/27326
|
||||
string(
|
||||
REPLACE "SIDE_MODULE=1" "SIDE_MODULE=2"
|
||||
CMAKE_MODULE_LINKER_FLAGS
|
||||
"${CMAKE_MODULE_LINKER_FLAGS}"
|
||||
)
|
||||
string(REPLACE "SIDE_MODULE=1" "SIDE_MODULE=2" CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS}")
|
||||
endif()
|
||||
target_link_options(
|
||||
ifcopenshell_wrapper
|
||||
@@ -142,13 +131,16 @@ if (WASM_BUILD)
|
||||
)
|
||||
endif()
|
||||
if("$ENV{LDFLAGS}" MATCHES ".undefined.suppress")
|
||||
# On osx there is some state in the python dylib. With `-Wl,undefined,suppress` we can ignore the missing symbols at compile time.
|
||||
target_link_libraries(ifcopenshell_wrapper PRIVATE ${IFCOPENSHELL_LIBRARIES} ${OpenCASCADE_LIBRARIES} ${Boost_LIBRARIES} ${LIBSVGFILL})
|
||||
# On osx there is some state in the python dylib. With `-Wl,undefined,suppress` we can ignore the missing symbols at compile time.
|
||||
target_link_libraries(
|
||||
ifcopenshell_wrapper
|
||||
PRIVATE ${IFCOPENSHELL_LIBRARIES} ${OpenCASCADE_LIBRARIES} ${Boost_LIBRARIES} ${LIBSVGFILL}
|
||||
)
|
||||
else()
|
||||
target_link_libraries(ifcopenshell_wrapper PRIVATE ${IFCOPENSHELL_LIBRARIES} ${LIBSVGFILL})
|
||||
target_link_libraries(ifcopenshell_wrapper PRIVATE ${IFCOPENSHELL_LIBRARIES} ${LIBSVGFILL})
|
||||
endif()
|
||||
target_link_libraries(ifcopenshell_wrapper PRIVATE ${CGAL_LIBRARIES})
|
||||
if ((NOT WIN32) AND BUILD_SHARED_LIBS)
|
||||
if((NOT WIN32) AND BUILD_SHARED_LIBS)
|
||||
SET_INSTALL_RPATHS(ifcopenshell_wrapper "${IFCDIRS};${OCC_LIBRARY_DIR}")
|
||||
endif()
|
||||
|
||||
@@ -156,10 +148,10 @@ endif()
|
||||
# directory in which the wrapper can be installed.
|
||||
if(NOT ${PYTHON_EXECUTABLE} STREQUAL "")
|
||||
set(Python_EXECUTABLE "${PYTHON_EXECUTABLE}")
|
||||
MESSAGE(STATUS "Looking for Python interpreter in: ${PYTHON_EXECUTABLE}")
|
||||
message(STATUS "Looking for Python interpreter in: ${PYTHON_EXECUTABLE}")
|
||||
endif()
|
||||
FIND_PACKAGE(Python COMPONENTS Interpreter)
|
||||
IF(Python_Interpreter_FOUND OR PYTHON_MODULE_INSTALL_DIR)
|
||||
find_package(Python COMPONENTS Interpreter)
|
||||
if(Python_Interpreter_FOUND OR PYTHON_MODULE_INSTALL_DIR)
|
||||
# Python_SOABI example value is 'cp311-win_amd64'.
|
||||
if(WASM_BUILD)
|
||||
# For WASM we usually don't provide interpreter,
|
||||
@@ -172,48 +164,43 @@ IF(Python_Interpreter_FOUND OR PYTHON_MODULE_INSTALL_DIR)
|
||||
else()
|
||||
set(PYTHON_EXTENSION_SUFFIX ".${Python_SOABI}.so")
|
||||
endif()
|
||||
set_target_properties(
|
||||
ifcopenshell_wrapper PROPERTIES
|
||||
SUFFIX ${PYTHON_EXTENSION_SUFFIX}
|
||||
)
|
||||
if (PYTHON_MODULE_INSTALL_DIR)
|
||||
set(python_package_dir "${PYTHON_MODULE_INSTALL_DIR}")
|
||||
set_target_properties(ifcopenshell_wrapper PROPERTIES SUFFIX ${PYTHON_EXTENSION_SUFFIX})
|
||||
if(PYTHON_MODULE_INSTALL_DIR)
|
||||
set(python_package_dir "${PYTHON_MODULE_INSTALL_DIR}")
|
||||
else()
|
||||
IF (USERSPACE_PYTHON_PREFIX)
|
||||
EXECUTE_PROCESS(
|
||||
if(USERSPACE_PYTHON_PREFIX)
|
||||
execute_process(
|
||||
COMMAND ${PYTHON_EXECUTABLE} -c "import sys; import site; sys.stdout.write(site.USER_SITE)"
|
||||
OUTPUT_VARIABLE python_package_dir
|
||||
)
|
||||
ELSE ()
|
||||
else()
|
||||
set(python_package_dir "${Python_SITEARCH}")
|
||||
ENDIF()
|
||||
if (BUILD_PACKAGE)
|
||||
endif()
|
||||
if(BUILD_PACKAGE)
|
||||
set(python_package_dir ${CMAKE_INSTALL_LIBDIR}/python${PYTHON_VERSION_MAJOR}/dist-packages/)
|
||||
endif()
|
||||
endif()
|
||||
IF("${python_package_dir}" STREQUAL "")
|
||||
MESSAGE(WARNING "Unable to locate Python site-package directory, unable to install the Python wrapper")
|
||||
ELSE()
|
||||
if("${python_package_dir}" STREQUAL "")
|
||||
message(WARNING "Unable to locate Python site-package directory, unable to install the Python wrapper")
|
||||
else()
|
||||
message(STATUS "Python wrapper will be installed to '${python_package_dir}'.")
|
||||
FILE(GLOB_RECURSE sourcefiles
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/../ifcopenshell-python/ifcopenshell/*"
|
||||
)
|
||||
FOREACH(file ${sourcefiles})
|
||||
FILE(RELATIVE_PATH relative "${CMAKE_CURRENT_SOURCE_DIR}/../ifcopenshell-python/ifcopenshell/" "${file}")
|
||||
GET_FILENAME_COMPONENT(dir "${relative}" DIRECTORY)
|
||||
file(GLOB_RECURSE sourcefiles "${CMAKE_CURRENT_SOURCE_DIR}/../ifcopenshell-python/ifcopenshell/*")
|
||||
foreach(file ${sourcefiles})
|
||||
file(RELATIVE_PATH relative "${CMAKE_CURRENT_SOURCE_DIR}/../ifcopenshell-python/ifcopenshell/" "${file}")
|
||||
get_filename_component(dir "${relative}" DIRECTORY)
|
||||
if(NOT IS_DIRECTORY "${file}")
|
||||
INSTALL(FILES "${file}"
|
||||
DESTINATION "${python_package_dir}/ifcopenshell/${dir}")
|
||||
install(FILES "${file}" DESTINATION "${python_package_dir}/ifcopenshell/${dir}")
|
||||
endif()
|
||||
ENDFOREACH()
|
||||
INSTALL(FILES "${CMAKE_BINARY_DIR}/ifcwrap/ifcopenshell_wrapper.py"
|
||||
DESTINATION "${python_package_dir}/ifcopenshell")
|
||||
INSTALL(TARGETS ifcopenshell_wrapper
|
||||
DESTINATION "${python_package_dir}/ifcopenshell")
|
||||
if (MSVC)
|
||||
INSTALL(FILES $<TARGET_PDB_FILE:ifcopenshell_wrapper> DESTINATION bin OPTIONAL)
|
||||
endif()
|
||||
ENDIF()
|
||||
ELSE()
|
||||
MESSAGE(WARNING "No Python interpreter found, unable to install the Python wrapper")
|
||||
ENDIF()
|
||||
endforeach()
|
||||
install(
|
||||
FILES "${CMAKE_BINARY_DIR}/ifcwrap/ifcopenshell_wrapper.py"
|
||||
DESTINATION "${python_package_dir}/ifcopenshell"
|
||||
)
|
||||
install(TARGETS ifcopenshell_wrapper DESTINATION "${python_package_dir}/ifcopenshell")
|
||||
if(MSVC)
|
||||
install(FILES $<TARGET_PDB_FILE:ifcopenshell_wrapper> DESTINATION bin OPTIONAL)
|
||||
endif()
|
||||
endif()
|
||||
else()
|
||||
message(WARNING "No Python interpreter found, unable to install the Python wrapper")
|
||||
endif()
|
||||
|
||||
+19
-18
@@ -21,7 +21,15 @@ message("Running CMakeLists.txt in /src/qtviewer")
|
||||
|
||||
# Specify the Qt version and components to use
|
||||
set(QT_VERSION 6 CACHE STRING "Qt version")
|
||||
set(QT_COMPONENTS Core Gui OpenGL OpenGLWidgets Widgets CACHE STRING "Qt components")
|
||||
set(QT_COMPONENTS
|
||||
Core
|
||||
Gui
|
||||
OpenGL
|
||||
OpenGLWidgets
|
||||
Widgets
|
||||
CACHE STRING
|
||||
"Qt components"
|
||||
)
|
||||
|
||||
find_package(Qt${QT_VERSION} COMPONENTS ${QT_COMPONENTS} REQUIRED PATHS ${QT_DIR})
|
||||
|
||||
@@ -45,10 +53,7 @@ set(targetName "QtViewer")
|
||||
# Scan for .qrc files and add to build process
|
||||
set(CMAKE_AUTORCC ON)
|
||||
|
||||
set(RESOURCE_FILES
|
||||
resources/qt_resources.qrc
|
||||
resources/qt_res.rc
|
||||
)
|
||||
set(RESOURCE_FILES resources/qt_resources.qrc resources/qt_res.rc)
|
||||
|
||||
# The MACOSX_BUNDLE_ICON_FILE variable is added to the Info.plist
|
||||
# generated by CMake. This variable contains the .icns file name,
|
||||
@@ -57,10 +62,10 @@ set(MACOSX_BUNDLE_ICON_FILE ifcosLogo.icns)
|
||||
|
||||
# The following tells CMake where to find and install the file itself.
|
||||
set(app_icon_macos "resources/ifcosLogo.icns")
|
||||
set_source_files_properties(${app_icon_macos} PROPERTIES
|
||||
MACOSX_PACKAGE_LOCATION "Resources")
|
||||
set_source_files_properties(${app_icon_macos} PROPERTIES MACOSX_PACKAGE_LOCATION "Resources")
|
||||
|
||||
add_executable(${targetName}
|
||||
add_executable(
|
||||
${targetName}
|
||||
MessageLogger.h
|
||||
IfcViewerWidget.h
|
||||
IfcViewerWidget.cpp
|
||||
@@ -73,14 +78,13 @@ add_executable(${targetName}
|
||||
${app_icon_macos}
|
||||
)
|
||||
|
||||
set_target_properties(${targetName} PROPERTIES
|
||||
AUTOMOC On
|
||||
WIN32_EXECUTABLE ON
|
||||
MACOSX_BUNDLE ON
|
||||
RESOURCE "${RESOURCE_FILES}"
|
||||
set_target_properties(
|
||||
${targetName}
|
||||
PROPERTIES AUTOMOC On WIN32_EXECUTABLE ON MACOSX_BUNDLE ON RESOURCE "${RESOURCE_FILES}"
|
||||
)
|
||||
|
||||
target_link_libraries(${targetName}
|
||||
target_link_libraries(
|
||||
${targetName}
|
||||
${IFCOPENSHELL_LIBRARIES}
|
||||
${OpenCASCADE_LIBRARIES}
|
||||
${OPENSCENEGRAPH_LIBRARIES}
|
||||
@@ -91,10 +95,7 @@ target_link_libraries(${targetName}
|
||||
Qt${QT_VERSION}::Widgets
|
||||
)
|
||||
|
||||
target_include_directories(${targetName} PUBLIC
|
||||
${QT_DIR}/include
|
||||
${OPENSCENEGRAPH_INCLUDE_DIRS}
|
||||
)
|
||||
target_include_directories(${targetName} PUBLIC ${QT_DIR}/include ${OPENSCENEGRAPH_INCLUDE_DIRS})
|
||||
|
||||
get_target_property(targetIncludeDirs ${targetName} INCLUDE_DIRECTORIES)
|
||||
message(STATUS "target_include_directories: ${targetIncludeDirs}")
|
||||
|
||||
@@ -5,10 +5,12 @@ file(GLOB SERIALIZERS_CPP_FILES *.cpp)
|
||||
set(SERIALIZERS_FILES ${SERIALIZERS_H_FILES} ${SERIALIZERS_CPP_FILES})
|
||||
|
||||
add_library(Serializers ${SERIALIZERS_FILES})
|
||||
set_target_properties(Serializers PROPERTIES
|
||||
COMPILE_FLAGS "-DSERIALIZERS_EXPORTS"
|
||||
VERSION "${PROJECT_VERSION}"
|
||||
SOVERSION "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}"
|
||||
set_target_properties(
|
||||
Serializers
|
||||
PROPERTIES
|
||||
COMPILE_FLAGS "-DSERIALIZERS_EXPORTS"
|
||||
VERSION "${PROJECT_VERSION}"
|
||||
SOVERSION "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}"
|
||||
)
|
||||
set(SERIALIZER_SCHEMA_LIBRARIES Serializers ${SERIALIZER_SCHEMA_LIBRARIES} PARENT_SCOPE)
|
||||
|
||||
@@ -21,18 +23,21 @@ if(WITH_PROJ)
|
||||
target_link_libraries(Serializers PRIVATE PROJ::proj)
|
||||
endif()
|
||||
|
||||
target_link_libraries(Serializers
|
||||
target_link_libraries(
|
||||
Serializers
|
||||
PRIVATE
|
||||
${SERIALIZER_SCHEMA_LIBRARIES} ${OPENCOLLADA_LIBRARIES} ${USD_LIBRARIES} ${GLTF_LIBRARIES}
|
||||
IfcGeom ${OpenCASCADE_LIBRARIES} ${kernel_libraries} IfcParse
|
||||
${SERIALIZER_SCHEMA_LIBRARIES}
|
||||
${OPENCOLLADA_LIBRARIES}
|
||||
${USD_LIBRARIES}
|
||||
${GLTF_LIBRARIES}
|
||||
IfcGeom
|
||||
${OpenCASCADE_LIBRARIES}
|
||||
${kernel_libraries}
|
||||
IfcParse
|
||||
)
|
||||
|
||||
install(TARGETS Serializers)
|
||||
|
||||
# Can't use `PUBLIC_HEADER` since we need two folders.
|
||||
install(FILES ${SERIALIZERS_H_FILES}
|
||||
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/serializers/"
|
||||
)
|
||||
install(FILES ${SERIALIZERS_S_H_FILES}
|
||||
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/serializers/schema_dependent"
|
||||
)
|
||||
install(FILES ${SERIALIZERS_H_FILES} DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/serializers/")
|
||||
install(FILES ${SERIALIZERS_S_H_FILES} DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/serializers/schema_dependent")
|
||||
|
||||
@@ -5,12 +5,14 @@ set(SERIALIZERS_S_FILES ${SERIALIZERS_S_H_FILES} ${SERIALIZERS_S_CPP_FILES})
|
||||
foreach(schema ${SCHEMA_VERSIONS})
|
||||
add_library(Serializers_ifc${schema} OBJECT ${SERIALIZERS_S_FILES})
|
||||
set(SERIALIZER_SCHEMA_LIBRARIES ${SERIALIZER_SCHEMA_LIBRARIES} Serializers_ifc${schema})
|
||||
set_target_properties(Serializers_ifc${schema} PROPERTIES COMPILE_FLAGS "-DIFC_GEOM_EXPORTS -DIfcSchema=Ifc${schema}")
|
||||
set_target_properties(
|
||||
Serializers_ifc${schema}
|
||||
PROPERTIES COMPILE_FLAGS "-DIFC_GEOM_EXPORTS -DIfcSchema=Ifc${schema}"
|
||||
)
|
||||
target_link_libraries(Serializers_ifc${schema} ${HDF5_LIBRARIES} ${GLTF_LIBRARIES})
|
||||
if(NOT WASM_BUILD)
|
||||
target_link_libraries(Serializers_ifc${schema} IfcGeom ${OpenCASCADE_LIBRARIES})
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
|
||||
set(SERIALIZER_SCHEMA_LIBRARIES ${SERIALIZER_SCHEMA_LIBRARIES} PARENT_SCOPE)
|
||||
|
||||
Vendored
+1
@@ -0,0 +1 @@
|
||||
disable_formatting: true
|
||||
+18
-23
@@ -1,20 +1,19 @@
|
||||
set(CMAKE_CXX_STANDARD 17)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
|
||||
project (svgfill)
|
||||
project(svgfill)
|
||||
|
||||
if (POLICY CMP0144) # 3.27
|
||||
if(POLICY CMP0144) # 3.27
|
||||
cmake_policy(SET CMP0144 NEW) # find_package() uses upper-case <PACKAGENAME>_ROOT variables.
|
||||
endif()
|
||||
if(POLICY CMP0167) # 3.30 find_package(Boost) to use BoostConfig instead of FindBoost.
|
||||
cmake_policy(SET CMP0167 OLD)
|
||||
endif()
|
||||
|
||||
|
||||
if(WIN32 AND NOT DEFINED ENV{CONDA_BUILD})
|
||||
set(Boost_USE_STATIC_LIBS ON)
|
||||
set(Boost_USE_MULTITHREADED ON)
|
||||
if (USE_STATIC_MSVC_RUNTIME)
|
||||
set(Boost_USE_STATIC_LIBS ON)
|
||||
set(Boost_USE_MULTITHREADED ON)
|
||||
if(USE_STATIC_MSVC_RUNTIME)
|
||||
set(Boost_USE_STATIC_RUNTIME ON)
|
||||
endif()
|
||||
else()
|
||||
@@ -28,8 +27,8 @@ else()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if (MSVC)
|
||||
add_definitions(-bigobj)
|
||||
if(MSVC)
|
||||
add_definitions(-bigobj)
|
||||
endif()
|
||||
|
||||
find_package(Boost)
|
||||
@@ -37,35 +36,31 @@ message(STATUS "Boost include files found in ${Boost_INCLUDE_DIRS}")
|
||||
find_package(LibXml2 REQUIRED)
|
||||
find_package(CGAL REQUIRED)
|
||||
|
||||
|
||||
include_directories(${Boost_INCLUDE_DIRS}
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/svgpp/include
|
||||
)
|
||||
include_directories(${Boost_INCLUDE_DIRS} ${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/svgpp/include)
|
||||
|
||||
file(GLOB LIB_H_FILES src/*.h)
|
||||
file(GLOB LIB_CPP_FILES src/svgfill.cpp src/arrange_polygons.cpp)
|
||||
set(LIB_SRC_FILES ${LIB_H_FILES} ${LIB_CPP_FILES})
|
||||
add_library(svgfill ${LIB_SRC_FILES})
|
||||
target_link_libraries(svgfill ${Boost_LIBRARIES} ${BCRYPT_LIBRARIES} LibXml2::LibXml2 IFCOPENSHELL_CGAL)
|
||||
set_target_properties(svgfill PROPERTIES
|
||||
PUBLIC_HEADER "${LIB_H_FILES}"
|
||||
)
|
||||
set_target_properties(svgfill PROPERTIES PUBLIC_HEADER "${LIB_H_FILES}")
|
||||
|
||||
add_executable(svgfill_exe src/main.cpp)
|
||||
target_link_libraries(svgfill_exe svgfill)
|
||||
set_property(TARGET svgfill_exe PROPERTY OUTPUT_NAME svgfill)
|
||||
if(WIN32)
|
||||
# both the library and the executable now result in a file with basename svgfill,
|
||||
# on linux the the library is prefixed with lib as libsvgfill.a. Windows does not
|
||||
# have this mechanism, so on windows the linker would be created an import library
|
||||
# for the executable, also named svgfill.lib. This naming conflict results in:
|
||||
# LINK : fatal error LNK1149: output filename matches input filename
|
||||
# This flag tells the linker not to generate an import library and therefore no
|
||||
# conflict occurs.
|
||||
# both the library and the executable now result in a file with basename svgfill,
|
||||
# on linux the the library is prefixed with lib as libsvgfill.a. Windows does not
|
||||
# have this mechanism, so on windows the linker would be created an import library
|
||||
# for the executable, also named svgfill.lib. This naming conflict results in:
|
||||
# LINK : fatal error LNK1149: output filename matches input filename
|
||||
# This flag tells the linker not to generate an import library and therefore no
|
||||
# conflict occurs.
|
||||
target_link_options(svgfill_exe PRIVATE "/NOIMPLIB")
|
||||
endif()
|
||||
|
||||
install(TARGETS svgfill_exe svgfill
|
||||
install(
|
||||
TARGETS svgfill_exe svgfill
|
||||
EXPORT ${IFCOPENSHELL_EXPORT_TARGETS}
|
||||
PUBLIC_HEADER DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/svgfill"
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user