chore: update ifcmax cmakelists

This commit is contained in:
Josef Wienerroither
2025-12-08 14:43:46 +01:00
parent b4135194ca
commit a9af9341b9
3 changed files with 111 additions and 19 deletions
+88 -19
View File
@@ -18,9 +18,20 @@
################################################################################
# check for 3ds Max SDK
foreach(max_year RANGE 2014 2030)
set(max_sdk "$ENV{ADSK_3DSMAX_SDK_${max_year}}")
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})
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})
@@ -29,22 +40,41 @@ foreach(max_year RANGE 2014 2030)
endif()
endforeach()
message(STATUS)
if(HAS_MAX)
# build libraray for each found 3ds Max SDK
# 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
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 IfcMax.h IfcMax.cpp)
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
target_link_libraries(IfcMax_${max_year} ${IFCOPENSHELL_LIBRARIES}
@@ -63,8 +93,6 @@ if(HAS_MAX)
maxnet.lib
Maxscrpt.lib
maxutil.lib
MenuMan.lib
menus.lib
mesh.lib
MNMath.lib
Paramblk2.lib
@@ -73,14 +101,55 @@ if(HAS_MAX)
RenderUtil.lib
tessint.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")
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()
Binary file not shown.
+23
View File
@@ -0,0 +1,23 @@
//{{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated include file.
// Used by IfcMax.rc
//
#define IDS_LIBDESCRIPTION 101
#define IDS_LIBDESCRIPTION_FREE 102
#define IDS_SHORT_DESCRIPTION 103
#define IDS_LONG_DESCRIPTION 104
#define IDS_AUTHOR_NAME 105
#define IDS_COPYRIGHT_MESSAGE 106
#define IDS_IMPORT_CANCEL_CAPTION 107
#define IDS_IMPORT_CANCEL_MESSAGE 108
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 102
#define _APS_NEXT_COMMAND_VALUE 40001
#define _APS_NEXT_CONTROL_VALUE 1000
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif