cmake: move check fo 3ds max sdk to external file

This commit is contained in:
Dirk Olbrich
2023-09-04 14:37:59 +02:00
committed by Thomas Krijnen
parent 5582bb2d4c
commit addacd9ce5
2 changed files with 44 additions and 40 deletions
+24 -37
View File
@@ -883,13 +883,13 @@ if(BUILD_IFCGEOM)
file(GLOB IFCGEOM_CPP_FILES ../src/ifcgeom/*.cpp)
set(IFCGEOM_FILES ${IFCGEOM_CPP_FILES} ${IFCGEOM_H_FILES})
foreach(schema ${SCHEMA_VERSIONS})
add_library(IfcGeom_ifc${schema} STATIC ${IFCGEOM_FILES})
set_target_properties(IfcGeom_ifc${schema} PROPERTIES COMPILE_FLAGS "-DIFC_GEOM_EXPORTS -DIfcSchema=Ifc${schema}")
if (NOT WASM_BUILD)
target_link_libraries(IfcGeom_ifc${schema} IfcParse ${OPENCASCADE_LIBRARIES})
endif()
endforeach()
foreach(schema ${SCHEMA_VERSIONS})
add_library(IfcGeom_ifc${schema} STATIC ${IFCGEOM_FILES})
set_target_properties(IfcGeom_ifc${schema} PROPERTIES COMPILE_FLAGS "-DIFC_GEOM_EXPORTS -DIfcSchema=Ifc${schema}")
if (NOT WASM_BUILD)
target_link_libraries(IfcGeom_ifc${schema} IfcParse ${OPENCASCADE_LIBRARIES})
endif()
endforeach()
# IfcGeom (schema agnostic)
file(GLOB SCHEMA_AGNOSTIC_H_FILES ../src/ifcgeom_schema_agnostic/*.h)
@@ -903,11 +903,11 @@ endforeach()
find_package(Threads)
endif()
if (WASM_BUILD)
target_link_libraries(IfcGeom ${IFCGEOM_SCHEMA_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT})
else()
target_link_libraries(IfcGeom IfcParse ${IFCGEOM_SCHEMA_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT})
endif()
if (WASM_BUILD)
target_link_libraries(IfcGeom ${IFCGEOM_SCHEMA_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT})
else()
target_link_libraries(IfcGeom IfcParse ${IFCGEOM_SCHEMA_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT})
endif()
endif(BUILD_IFCGEOM)
@@ -920,16 +920,16 @@ if(BUILD_CONVERT OR BUILD_IFCPYTHON)
file(GLOB SERIALIZERS_S_CPP_FILES ../src/serializers/schema_dependent/*.cpp)
set(SERIALIZERS_S_FILES ${SERIALIZERS_S_H_FILES} ${SERIALIZERS_S_CPP_FILES})
foreach(schema ${SCHEMA_VERSIONS})
add_library(Serializers_ifc${schema} STATIC ${SERIALIZERS_S_FILES})
set_target_properties(Serializers_ifc${schema} PROPERTIES COMPILE_FLAGS "-DIFC_GEOM_EXPORTS -DIfcSchema=Ifc${schema}")
if (WASM_BUILD)
target_link_libraries(Serializers_ifc${schema} ${HDF5_LIBRARIES})
else()
target_link_libraries(Serializers_ifc${schema} IfcGeom ${OPENCASCADE_LIBRARIES} ${HDF5_LIBRARIES})
endif()
endforeach()
foreach(schema ${SCHEMA_VERSIONS})
add_library(Serializers_ifc${schema} STATIC ${SERIALIZERS_S_FILES})
set_target_properties(Serializers_ifc${schema} PROPERTIES COMPILE_FLAGS "-DIFC_GEOM_EXPORTS -DIfcSchema=Ifc${schema}")
if (WASM_BUILD)
target_link_libraries(Serializers_ifc${schema} ${HDF5_LIBRARIES})
else()
target_link_libraries(Serializers_ifc${schema} IfcGeom ${OPENCASCADE_LIBRARIES} ${HDF5_LIBRARIES})
endif()
endforeach()
add_library(Serializers ${SERIALIZERS_FILES})
set_target_properties(Serializers PROPERTIES COMPILE_FLAGS "-DIFC_GEOM_EXPORTS" VERSION "${PROJECT_VERSION}" SOVERSION "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}")
@@ -1027,21 +1027,8 @@ if(BUILD_EXAMPLES)
add_subdirectory(../src/examples examples)
endif()
if(NOT MINIMAL_BUILD AND BUILD_IFCMAX)
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 found at ${max_sdk}")
set(HAS_MAX TRUE)
endif()
endforeach()
if(HAS_MAX)
add_subdirectory(../src/ifcmax ifcmax)
else()
message(STATUS "Autodesk 3ds Max SDK not found, is required to build IFCMax.")
endif()
if(BUILD_IFCMAX)
add_subdirectory(../src/ifcmax ifcmax)
endif()
if(NOT MINIMAL_BUILD)
+20 -3
View File
@@ -16,9 +16,24 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>. #
# #
################################################################################
# check for 3ds Max SDK
foreach(max_year RANGE 2014 2030)
set(max_sdk "$ENV{ADSK_3DSMAX_SDK_${max_year}}")
if (NOT "${max_sdk}" STREQUAL "")
if(NOT "${max_sdk}" STREQUAL "")
message(STATUS "Autodesk 3ds Max SDK ${max_year} found at ${max_sdk}")
list(APPEND FOUND_MAX_YEARS ${max_year})
list(APPEND FOUND_MAX_SDKS ${max_sdk})
set(HAS_MAX TRUE)
endif()
endforeach()
if(HAS_MAX)
# 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}")
include_directories(${INCLUDE_DIRECTORIES} ${OCC_INCLUDE_DIR} ${OPENCOLLADA_INCLUDE_DIRS} ${ICU_INCLUDE_DIR}
${Boost_INCLUDE_DIRS} ${max_sdk}/include
@@ -65,6 +80,8 @@ foreach(max_year RANGE 2014 2030)
set_target_properties(IfcMax_${max_year} PROPERTIES SUFFIX ".dli")
install(TARGETS IfcMax_${max_year} RUNTIME DESTINATION ${BINDIR})
endforeach()
else()
message(STATUS "Autodesk 3ds Max SDK not found, is required to build IFCMax.")
endif()
endif()
endforeach()