mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-23 19:36:21 +00:00
tweak ifcmax cmake file
This commit is contained in:
+92
-18
@@ -18,9 +18,20 @@
|
|||||||
################################################################################
|
################################################################################
|
||||||
|
|
||||||
# check for 3ds Max SDK
|
# check for 3ds Max SDK
|
||||||
foreach(max_year RANGE 2014 2030)
|
set(valid_max_years 2027 2026 2025 2024 2023 2022 2021 2020 2019 2018 2017)
|
||||||
set(max_sdk "$ENV{ADSK_3DSMAX_SDK_${max_year}}")
|
|
||||||
|
|
||||||
|
# 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})
|
||||||
|
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}")
|
message(STATUS "Autodesk 3ds Max SDK ${max_year} found at ${max_sdk}")
|
||||||
list(APPEND FOUND_MAX_YEARS ${max_year})
|
list(APPEND FOUND_MAX_YEARS ${max_year})
|
||||||
@@ -29,35 +40,58 @@ foreach(max_year RANGE 2014 2030)
|
|||||||
endif()
|
endif()
|
||||||
endforeach()
|
endforeach()
|
||||||
|
|
||||||
if(HAS_MAX)
|
message(STATUS)
|
||||||
# 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(
|
if(HAS_MAX)
|
||||||
|
# set depenency include and link directoris outside of MaxSDK loop
|
||||||
|
include_directories(
|
||||||
${INCLUDE_DIRECTORIES}
|
${INCLUDE_DIRECTORIES}
|
||||||
${OPENCOLLADA_INCLUDE_DIRS}
|
${OPENCOLLADA_INCLUDE_DIRS}
|
||||||
${ICU_INCLUDE_DIR}
|
${ICU_INCLUDE_DIR}
|
||||||
${Boost_INCLUDE_DIRS}
|
${Boost_INCLUDE_DIRS}
|
||||||
${max_sdk}/include
|
|
||||||
)
|
)
|
||||||
|
|
||||||
# All recent versions of 3ds Max (2014 and newer) are 64-bit only so assume lib/x64 directory
|
|
||||||
link_directories(
|
link_directories(
|
||||||
${LINK_DIRECTORIES}
|
${LINK_DIRECTORIES}
|
||||||
${IfcOpenShell_BINARY_DIR}
|
${IfcOpenShell_BINARY_DIR}
|
||||||
${OPENCOLLADA_LIBRARY_DIR}
|
${OPENCOLLADA_LIBRARY_DIR}
|
||||||
${ICU_LIBRARY_DIR}
|
${ICU_LIBRARY_DIR}
|
||||||
${Boost_LIBRARY_DIRS}
|
${Boost_LIBRARY_DIRS}
|
||||||
${max_sdk}/lib/x64/Release
|
|
||||||
)
|
)
|
||||||
|
|
||||||
add_library(IfcMax_${max_year} SHARED IfcMax.h IfcMax.cpp)
|
# 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
|
||||||
|
foreach(max_year max_sdk IN ZIP_LISTS FOUND_MAX_YEARS FOUND_MAX_SDKS)
|
||||||
|
|
||||||
|
# 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()
|
||||||
|
|
||||||
|
message(STATUS "Building IFCMax library for Autodesk 3ds Max SDK ${max_year}, Tier: ${BUILD_TIER_NAME}")
|
||||||
|
|
||||||
|
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)
|
||||||
|
|
||||||
# TODO: find the minimal subset of 3dsmax libraries to reference
|
# TODO: find the minimal subset of 3dsmax libraries to reference
|
||||||
target_link_libraries(
|
target_link_libraries(
|
||||||
IfcMax_${max_year}
|
IfcMax_${max_year}
|
||||||
${IFCOPENSHELL_LIBRARIES}
|
${IFCOPENSHELL_LIBRARIES}
|
||||||
bmm.lib
|
bmm.lib
|
||||||
Comctl32.lib
|
Comctl32.lib
|
||||||
core.lib
|
core.lib
|
||||||
@@ -73,8 +107,6 @@ if(HAS_MAX)
|
|||||||
maxnet.lib
|
maxnet.lib
|
||||||
Maxscrpt.lib
|
Maxscrpt.lib
|
||||||
maxutil.lib
|
maxutil.lib
|
||||||
MenuMan.lib
|
|
||||||
menus.lib
|
|
||||||
mesh.lib
|
mesh.lib
|
||||||
MNMath.lib
|
MNMath.lib
|
||||||
Paramblk2.lib
|
Paramblk2.lib
|
||||||
@@ -83,14 +115,56 @@ if(HAS_MAX)
|
|||||||
RenderUtil.lib
|
RenderUtil.lib
|
||||||
tessint.lib
|
tessint.lib
|
||||||
viewfile.lib
|
viewfile.lib
|
||||||
zlibdll.lib
|
${OPENCASCADE_LIBRARIES}
|
||||||
${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()
|
||||||
|
|
||||||
|
# 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")
|
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})
|
install(TARGETS IfcMax_${max_year})
|
||||||
|
|
||||||
endforeach()
|
endforeach()
|
||||||
|
message(STATUS)
|
||||||
else()
|
else()
|
||||||
message(STATUS "Autodesk 3ds Max SDK not found, is required to build IFCMax.")
|
message(STATUS "Autodesk 3ds Max SDK not found, is required to build IFCMax.")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user