Skip to content

Commit 0d4819d

Browse files
committed
dllimport/export #6926
1 parent ce91d29 commit 0d4819d

File tree

2 files changed

+23
-20
lines changed

2 files changed

+23
-20
lines changed

cmake/CMakeLists.txt

Lines changed: 21 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,11 @@ if(MSVC AND MSVC_PARALLEL_BUILD)
127127
add_definitions("/MP")
128128
endif()
129129

130+
if (MSVC AND BUILD_SHARED_LIBS)
131+
# @todo how do projects normally deal with this regarding classes derived from std::exception?
132+
add_compile_options(/wd4275)
133+
endif()
134+
130135
if(NO_WARN)
131136
if(MSVC)
132137
add_compile_options("/w")
@@ -1023,12 +1028,14 @@ if(BUILD_CONVERT OR BUILD_IFCPYTHON)
10231028
set(GEOM_SERIALIZER_SCHEMA_LIBRARIES ${GEOM_SERIALIZER_SCHEMA_LIBRARIES} GeometrySerializers_ifc${schema})
10241029

10251030
add_library(geometry_serializer_ifc${schema} STATIC ../src/ifcgeom/Serialization/schema/Serialization.cpp)
1026-
set_target_properties(geometry_serializer_ifc${schema} PROPERTIES COMPILE_FLAGS "-DIFC_GEOM_EXPORTS -DIfcSchema=Ifc${schema}")
1031+
set_target_properties(geometry_serializer_ifc${schema} PROPERTIES COMPILE_FLAGS "-DIFC_GEOMSERIALIZATION_EXPORTS -DIfcSchema=Ifc${schema}")
1032+
target_link_libraries(geometry_serializer_ifc${schema} ${OPENCASCADE_LIBRARIES})
10271033
list(APPEND geometry_serializer_libraries geometry_serializer_ifc${schema})
10281034
endforeach()
10291035

1030-
add_library(geometry_serializer STATIC ../src/ifcgeom/Serialization/Serialization.cpp)
1031-
target_link_libraries(geometry_serializer ${geometry_serializer_libraries})
1036+
add_library(geometry_serializer STATIC ../src/ifcgeom/Serialization/Serialization.h ../src/ifcgeom/Serialization/Serialization.cpp)
1037+
set_target_properties(geometry_serializer PROPERTIES COMPILE_FLAGS "-DIFC_GEOMSERIALIZATION_EXPORTS")
1038+
target_link_libraries(geometry_serializer ${geometry_serializer_libraries} IfcParse)
10321039
set(IFCOPENSHELL_LIBRARIES ${IFCOPENSHELL_LIBRARIES} geometry_serializer ${geometry_serializer_libraries})
10331040
endif()
10341041
endif()
@@ -1113,23 +1120,23 @@ if(BUILD_IFCGEOM)
11131120
file(GLOB IFCGEOM_CPP_FILES ../src/ifcgeom/kernels/${kernel}/*.cpp)
11141121
set(IFCGEOM_FILES ${IFCGEOM_CPP_FILES} ${IFCGEOM_H_FILES})
11151122

1116-
add_library(geometry_kernel_${kernel} ${IFCGEOM_FILES})
1117-
set_property(TARGET geometry_kernel_${kernel} APPEND PROPERTY COMPILE_FLAGS "-DIFC_GEOM_EXPORTS")
1123+
add_library(geometry_kernel_${kernel} ${IFCGEOM_FILES} ../src/ifcgeom/kernels/ifc_geomlibrary_api.h)
1124+
set_property(TARGET geometry_kernel_${kernel} APPEND PROPERTY COMPILE_FLAGS "-DIFC_GEOMLIBRARY_EXPORTS")
11181125
# needed?
11191126
# if(NOT WASM_BUILD)
11201127
# endif()
1121-
target_link_libraries(geometry_kernel_${kernel} ${${KERNEL_UPPER}_LIBRARIES})
1128+
target_link_libraries(geometry_kernel_${kernel} ${${KERNEL_UPPER}_LIBRARIES} IfcGeom IfcParse)
11221129
list(APPEND kernel_libraries geometry_kernel_${kernel})
11231130

11241131
if(${kernel} STREQUAL "cgal")
11251132
set_property(TARGET geometry_kernel_${kernel} APPEND_STRING PROPERTY COMPILE_FLAGS " -DCGAL_HAS_THREADS")
11261133

11271134
add_library(geometry_kernel_${kernel}_simple ${IFCGEOM_FILES})
1128-
set_target_properties(geometry_kernel_${kernel}_simple PROPERTIES COMPILE_FLAGS "-DIFC_GEOM_EXPORTS -DIFOPSH_SIMPLE_KERNEL -DCGAL_HAS_THREADS")
1135+
set_target_properties(geometry_kernel_${kernel}_simple PROPERTIES COMPILE_FLAGS "-DIFC_GEOMLIBRARY_EXPORTS -DIFOPSH_SIMPLE_KERNEL -DCGAL_HAS_THREADS")
11291136
# needed?
11301137
# if(NOT WASM_BUILD)
11311138
# endif()
1132-
target_link_libraries(geometry_kernel_${kernel}_simple ${${KERNEL_UPPER}_LIBRARIES})
1139+
target_link_libraries(geometry_kernel_${kernel}_simple ${${KERNEL_UPPER}_LIBRARIES} IfcGeom IfcParse)
11331140
list(APPEND kernel_libraries geometry_kernel_${kernel}_simple)
11341141
endif()
11351142
endforeach()
@@ -1159,11 +1166,7 @@ if(BUILD_IFCGEOM)
11591166
find_package(Threads)
11601167
endif()
11611168

1162-
if(WASM_BUILD)
1163-
target_link_libraries(IfcGeom ${kernel_libraries} ${mapping_libraries} ${CMAKE_THREAD_LIBS_INIT})
1164-
else()
1165-
target_link_libraries(IfcGeom IfcParse ${kernel_libraries} ${mapping_libraries} ${CMAKE_THREAD_LIBS_INIT})
1166-
endif()
1169+
target_link_libraries(IfcGeom IfcParse ${mapping_libraries} ${CMAKE_THREAD_LIBS_INIT})
11671170

11681171
endif(BUILD_IFCGEOM)
11691172

@@ -1178,7 +1181,7 @@ if(BUILD_CONVERT OR BUILD_IFCPYTHON)
11781181

11791182
foreach(schema ${SCHEMA_VERSIONS})
11801183
add_library(Serializers_ifc${schema} STATIC ${SERIALIZERS_S_FILES})
1181-
set_target_properties(Serializers_ifc${schema} PROPERTIES COMPILE_FLAGS "-DIFC_GEOM_EXPORTS -DIfcSchema=Ifc${schema}")
1184+
set_target_properties(Serializers_ifc${schema} PROPERTIES COMPILE_FLAGS "-DSERIALIZERS_EXPORTS -DIfcSchema=Ifc${schema}")
11821185

11831186
if(WASM_BUILD)
11841187
target_link_libraries(Serializers_ifc${schema} ${HDF5_LIBRARIES})
@@ -1188,7 +1191,7 @@ if(BUILD_CONVERT OR BUILD_IFCPYTHON)
11881191
endforeach()
11891192

11901193
add_library(Serializers ${SERIALIZERS_FILES})
1191-
set_target_properties(Serializers PROPERTIES COMPILE_FLAGS "-DIFC_GEOM_EXPORTS" VERSION "${PROJECT_VERSION}" SOVERSION "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}")
1194+
set_target_properties(Serializers PROPERTIES COMPILE_FLAGS "-DSERIALIZERS_EXPORTS" VERSION "${PROJECT_VERSION}" SOVERSION "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}")
11921195

11931196
if(WITH_PROJ)
11941197
target_compile_definitions(Serializers PRIVATE "WITH_PROJ")
@@ -1199,7 +1202,7 @@ if(BUILD_CONVERT OR BUILD_IFCPYTHON)
11991202
target_link_libraries(Serializers ${PROJ_LIBRARIES})
12001203
endif()
12011204

1202-
target_link_libraries(Serializers ${SERIALIZER_SCHEMA_LIBRARIES} ${OPENCOLLADA_LIBRARIES} ${USD_LIBRARIES})
1205+
target_link_libraries(Serializers ${SERIALIZER_SCHEMA_LIBRARIES} ${OPENCOLLADA_LIBRARIES} ${USD_LIBRARIES} IfcGeom ${OPENCASCADE_LIBRARIES} ${kernel_libraries} IfcParse)
12031206

12041207
endif(BUILD_CONVERT OR BUILD_IFCPYTHON)
12051208

@@ -1246,7 +1249,7 @@ if(BUILD_CONVERT)
12461249
set(IFCCONVERT_FILES ${IFCCONVERT_CPP_FILES} ${IFCCONVERT_H_FILES})
12471250
add_executable(IfcConvert ${IFCCONVERT_FILES})
12481251

1249-
target_link_libraries(IfcConvert ${IFCOPENSHELL_LIBRARIES} ${OPENCASCADE_LIBRARIES} ${Boost_LIBRARIES} ${HDF5_LIBRARIES} ${USD_LIBRARIES})
1252+
target_link_libraries(IfcConvert IfcGeom IfcParse Serializers ${kernel_libraries} ${OPENCASCADE_LIBRARIES} ${Boost_LIBRARIES} ${HDF5_LIBRARIES} ${USD_LIBRARIES})
12501253
if (WITH_RELATIONSHIP_VALIDATION)
12511254
set_property(TARGET IfcConvert APPEND_STRING PROPERTY COMPILE_FLAGS " -DWITH_RELATIONSHIP_VALIDATION")
12521255
endif()
@@ -1280,7 +1283,7 @@ if(BUILD_GEOMSERVER)
12801283
file(GLOB H_FILES ../src/ifcgeomserver/*.h)
12811284
set(SOURCE_FILES ${CPP_FILES} ${H_FILES})
12821285
add_executable(IfcGeomServer ${SOURCE_FILES})
1283-
target_link_libraries(IfcGeomServer ${IFCOPENSHELL_LIBRARIES} ${OPENCASCADE_LIBRARIES} ${Boost_LIBRARIES})
1286+
target_link_libraries(IfcGeomServer IfcGeom IfcParse Serializers ${kernel_libraries} ${OPENCASCADE_LIBRARIES} ${Boost_LIBRARIES})
12841287

12851288
if((NOT WIN32) AND BUILD_SHARED_LIBS)
12861289
SET_INSTALL_RPATHS(IfcGeomServer "${IFCOPENSHELL_LIBRARY_DIR};${OCC_LIBRARY_DIR};${Boost_LIBRARY_DIRS}")

src/ifcwrap/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,9 +88,9 @@ swig_add_library(ifcopenshell_wrapper LANGUAGE python SOURCES IfcPython.i)
8888
SET_PROPERTY(TARGET ${SWIG_MODULE_ifcopenshell_wrapper_REAL_NAME} PROPERTY SWIG_DEPENDS ${IFCOPENSHELL_LIBRARIES})
8989
if("$ENV{LDFLAGS}" MATCHES ".undefined.suppress")
9090
# On osx there is some state in the python dylib. With `-Wl,undefined,suppress` we can ignore the missing symbols at compile time.
91-
SWIG_LINK_LIBRARIES(ifcopenshell_wrapper ${IFCOPENSHELL_LIBRARIES} ${OPENCASCADE_LIBRARIES} ${Boost_LIBRARIES} ${LIBSVGFILL})
91+
SWIG_LINK_LIBRARIES(ifcopenshell_wrapper IfcGeom IfcParse Serializers ${kernel_libraries} geometry_serializer ${OPENCASCADE_LIBRARIES} ${Boost_LIBRARIES} ${LIBSVGFILL})
9292
else()
93-
SWIG_LINK_LIBRARIES(ifcopenshell_wrapper ${IFCOPENSHELL_LIBRARIES} ${PYTHON_LIBRARIES} ${LIBSVGFILL})
93+
SWIG_LINK_LIBRARIES(ifcopenshell_wrapper IfcGeom IfcParse Serializers ${kernel_libraries} geometry_serializer ${PYTHON_LIBRARIES} ${LIBSVGFILL})
9494
endif()
9595
if ((NOT WIN32) AND BUILD_SHARED_LIBS)
9696
SET_INSTALL_RPATHS(${SWIG_MODULE_ifcopenshell_wrapper_REAL_NAME} "${IFCDIRS};${OCC_LIBRARY_DIR}")

0 commit comments

Comments
 (0)