From 0ed01470b08a1d64294a21ac3f1aa0908aa5d897 Mon Sep 17 00:00:00 2001 From: kervala Date: Tue, 15 Nov 2016 10:55:41 +0100 Subject: [PATCH] Changed: 3dsmax 2013 and up are always using Unicode --- code/CMakeModules/Find3dsMaxSDK.cmake | 25 ++++++++++++++++--- .../tools/3d/ligo/plugin_max/CMakeLists.txt | 4 ++- .../nel_3dsmax_shared/CMakeLists.txt | 2 +- .../3d/plugin_max/nel_export/CMakeLists.txt | 2 ++ .../3d/plugin_max/nel_mesh_lib/CMakeLists.txt | 2 ++ .../nel_patch_converter/CMakeLists.txt | 2 ++ .../plugin_max/nel_patch_edit/CMakeLists.txt | 2 ++ .../plugin_max/nel_patch_lib/CMakeLists.txt | 2 ++ .../plugin_max/nel_patch_paint/CMakeLists.txt | 2 ++ .../nel_vertex_tree_paint/CMakeLists.txt | 2 ++ 10 files changed, 40 insertions(+), 5 deletions(-) diff --git a/code/CMakeModules/Find3dsMaxSDK.cmake b/code/CMakeModules/Find3dsMaxSDK.cmake index 9cd4bd67b..cf49a90d3 100644 --- a/code/CMakeModules/Find3dsMaxSDK.cmake +++ b/code/CMakeModules/Find3dsMaxSDK.cmake @@ -18,6 +18,7 @@ FIND_PATH(MAXSDK_DIR PATHS "$ENV{ADSK_3DSMAX_SDK_2012}/maxsdk" "$ENV{3DSMAX_2011_SDK_PATH}/maxsdk" + "$ENV{PROGRAMFILES}/Autodesk/3ds Max 2017 SDK/maxsdk" "$ENV{PROGRAMFILES}/Autodesk/3ds Max 2010 SDK/maxsdk" "$ENV{PROGRAMFILES}/Autodesk/3ds Max 2009 SDK/maxsdk" "$ENV{PROGRAMFILES}/Autodesk/3ds Max 2008 SDK/maxsdk" @@ -36,12 +37,12 @@ FIND_PATH(MAXSDK_CS_INCLUDE_DIR bipexp.h ) IF(TARGET_X64) - SET(MAXSDK_LIBRARY_DIRS ${MAXSDK_DIR}/x64/lib) + SET(MAXSDK_LIBRARY_DIRS ${MAXSDK_DIR}/x64/lib ${MAXSDK_DIR}/lib/x64/Release) ELSE() SET(MAXSDK_LIBRARY_DIRS ${MAXSDK_DIR}/lib) ENDIF() -MACRO(FIND_3DS_LIBRARY MYLIBRARY MYLIBRARYNAME) +MACRO(FIND_3DS_LIBRARY MYLIBRARY MYLIBRARYNAME) FIND_LIBRARY(${MYLIBRARY} NAMES ${MYLIBRARYNAME} HINTS @@ -73,8 +74,26 @@ if(MAXSDK_FOUND) ${MAXSDK_MAXUTIL_LIBRARY} ${MAXSDK_MAXSCRIPT_LIBRARY} ${MAXSDK_PARAMBLK2_LIBRARY} - ${MAXSDK_BMM_LIBRARY} ) + ${MAXSDK_BMM_LIBRARY}) + # parse maxversion.h to determine SDK version + IF(EXISTS "${MAXSDK_DIR}/include/maxversion.h") + FILE(STRINGS "${MAXSDK_DIR}/include/maxversion.h" LINES REGEX "#define MAX_PRODUCT_YEAR_NUMBER ([0-9]+)") + + STRING(REGEX REPLACE ".+MAX_PRODUCT_YEAR_NUMBER ([0-9]+)" "\\1" MAXSDK_VERSION "${LINES}") + UNSET(LINES) + ELSE() + SET(MAXSDK_VERSION "Unknown") + ENDIF() + + MESSAGE(STATUS "Found 3dsmax version ${MAXSDK_VERSION} in ${MAXSDK_DIR}") + + # 3ds Max 2013 and later are always Unicode + IF(MAXSDK_VERSION VERSION_GREATER 2012) + SET(MAXSDK_DEFINITIONS -DUNICODE -D_UNICODE) + ELSE() + SET(MAXSDK_DEFINITIONS) + ENDIF() ELSE() set(MAXSDK_LIBRARIES) ENDIF() diff --git a/code/nel/tools/3d/ligo/plugin_max/CMakeLists.txt b/code/nel/tools/3d/ligo/plugin_max/CMakeLists.txt index 761537791..6427c6b17 100644 --- a/code/nel/tools/3d/ligo/plugin_max/CMakeLists.txt +++ b/code/nel/tools/3d/ligo/plugin_max/CMakeLists.txt @@ -19,7 +19,9 @@ SET_TARGET_PROPERTIES(ligoscape_utility PROPERTIES SUFFIX ".dlx") NL_DEFAULT_PROPS(ligoscape_utility "MAX Plugin: Ligoscape Utility") NL_ADD_RUNTIME_FLAGS(ligoscape_utility) NL_ADD_LIB_SUFFIX(ligoscape_utility) - + +ADD_DEFINITIONS(${MAXSDK_DEFINITIONS}) + INSTALL(TARGETS ligoscape_utility RUNTIME DESTINATION maxplugin/plugins LIBRARY DESTINATION ${NL_LIB_PREFIX} ARCHIVE DESTINATION ${NL_LIB_PREFIX} COMPONENT libraries) INSTALL(FILES ligoscript.txt DESTINATION maxplugin/docs) INSTALL(DIRECTORY scripts/ diff --git a/code/nel/tools/3d/plugin_max/nel_3dsmax_shared/CMakeLists.txt b/code/nel/tools/3d/plugin_max/nel_3dsmax_shared/CMakeLists.txt index a93decee5..9a14d59a6 100644 --- a/code/nel/tools/3d/plugin_max/nel_3dsmax_shared/CMakeLists.txt +++ b/code/nel/tools/3d/plugin_max/nel_3dsmax_shared/CMakeLists.txt @@ -16,7 +16,7 @@ NL_ADD_RUNTIME_FLAGS(nel_3dsmax_shared) NL_ADD_LIB_SUFFIX(nel_3dsmax_shared) #SET_TARGET_PROPERTIES(nel_export PROPERTIES SUFFIX ".dlx") -ADD_DEFINITIONS(-DNEL_3DSMAX_SHARED_EXPORTS) +ADD_DEFINITIONS(-DNEL_3DSMAX_SHARED_EXPORTS ${MAXSDK_DEFINITIONS}) IF(WITH_PCH) ADD_NATIVE_PRECOMPILED_HEADER(nel_3dsmax_shared ${CMAKE_CURRENT_SOURCE_DIR}/StdAfx.h ${CMAKE_CURRENT_SOURCE_DIR}/StdAfx.cpp) diff --git a/code/nel/tools/3d/plugin_max/nel_export/CMakeLists.txt b/code/nel/tools/3d/plugin_max/nel_export/CMakeLists.txt index 4fb8b4455..2787a7645 100644 --- a/code/nel/tools/3d/plugin_max/nel_export/CMakeLists.txt +++ b/code/nel/tools/3d/plugin_max/nel_export/CMakeLists.txt @@ -25,6 +25,8 @@ NL_ADD_RUNTIME_FLAGS(nel_export) NL_ADD_LIB_SUFFIX(nel_export) SET_TARGET_PROPERTIES(nel_export PROPERTIES SUFFIX ".dlu") +ADD_DEFINITIONS(${MAXSDK_DEFINITIONS}) + IF(WITH_PCH) ADD_NATIVE_PRECOMPILED_HEADER(nel_export ${CMAKE_CURRENT_SOURCE_DIR}/std_afx.h ${CMAKE_CURRENT_SOURCE_DIR}/std_afx.cpp) ENDIF() diff --git a/code/nel/tools/3d/plugin_max/nel_mesh_lib/CMakeLists.txt b/code/nel/tools/3d/plugin_max/nel_mesh_lib/CMakeLists.txt index 3c96760a8..e8222ad54 100644 --- a/code/nel/tools/3d/plugin_max/nel_mesh_lib/CMakeLists.txt +++ b/code/nel/tools/3d/plugin_max/nel_mesh_lib/CMakeLists.txt @@ -8,6 +8,8 @@ NL_DEFAULT_PROPS(nel_mesh_lib "MAX Plugin: NeL Mesh Library") NL_ADD_RUNTIME_FLAGS(nel_mesh_lib) NL_ADD_LIB_SUFFIX(nel_mesh_lib) +ADD_DEFINITIONS(${MAXSDK_DEFINITIONS}) + IF(WITH_PCH) ADD_NATIVE_PRECOMPILED_HEADER(nel_mesh_lib ${CMAKE_CURRENT_SOURCE_DIR}/StdAfx.h ${CMAKE_CURRENT_SOURCE_DIR}/StdAfx.cpp) ENDIF() diff --git a/code/nel/tools/3d/plugin_max/nel_patch_converter/CMakeLists.txt b/code/nel/tools/3d/plugin_max/nel_patch_converter/CMakeLists.txt index c173232b3..178e70f5d 100644 --- a/code/nel/tools/3d/plugin_max/nel_patch_converter/CMakeLists.txt +++ b/code/nel/tools/3d/plugin_max/nel_patch_converter/CMakeLists.txt @@ -18,4 +18,6 @@ NL_DEFAULT_PROPS(nel_patch_converter "MAX Plugin: NeL Patch Converter") NL_ADD_RUNTIME_FLAGS(nel_patch_converter) NL_ADD_LIB_SUFFIX(nel_patch_converter) +ADD_DEFINITIONS(${MAXSDK_DEFINITIONS}) + INSTALL(TARGETS nel_patch_converter RUNTIME DESTINATION maxplugin/plugins LIBRARY DESTINATION ${NL_LIB_PREFIX} ARCHIVE DESTINATION ${NL_LIB_PREFIX} COMPONENT libraries) diff --git a/code/nel/tools/3d/plugin_max/nel_patch_edit/CMakeLists.txt b/code/nel/tools/3d/plugin_max/nel_patch_edit/CMakeLists.txt index 20a3635e4..bc2f81f33 100644 --- a/code/nel/tools/3d/plugin_max/nel_patch_edit/CMakeLists.txt +++ b/code/nel/tools/3d/plugin_max/nel_patch_edit/CMakeLists.txt @@ -18,6 +18,8 @@ NL_DEFAULT_PROPS(nel_patch_edit "MAX Plugin: NeL Patch Editor") NL_ADD_RUNTIME_FLAGS(nel_patch_edit) NL_ADD_LIB_SUFFIX(nel_patch_edit) +ADD_DEFINITIONS(${MAXSDK_DEFINITIONS}) + IF(WITH_PCH) ADD_NATIVE_PRECOMPILED_HEADER(nel_patch_edit ${CMAKE_CURRENT_SOURCE_DIR}/stdafx.h ${CMAKE_CURRENT_SOURCE_DIR}/stdafx.cpp) ENDIF() diff --git a/code/nel/tools/3d/plugin_max/nel_patch_lib/CMakeLists.txt b/code/nel/tools/3d/plugin_max/nel_patch_lib/CMakeLists.txt index 63f0a5bcc..127b7fba2 100644 --- a/code/nel/tools/3d/plugin_max/nel_patch_lib/CMakeLists.txt +++ b/code/nel/tools/3d/plugin_max/nel_patch_lib/CMakeLists.txt @@ -8,4 +8,6 @@ NL_DEFAULT_PROPS(nel_patch_lib "MAX Plugin: NeL Patch Library") NL_ADD_RUNTIME_FLAGS(nel_patch_lib) NL_ADD_LIB_SUFFIX(nel_patch_lib) +ADD_DEFINITIONS(${MAXSDK_DEFINITIONS}) + INSTALL(TARGETS nel_patch_lib RUNTIME DESTINATION maxplugin/plugins LIBRARY DESTINATION ${NL_LIB_PREFIX} ARCHIVE DESTINATION ${NL_LIB_PREFIX} COMPONENT libraries) diff --git a/code/nel/tools/3d/plugin_max/nel_patch_paint/CMakeLists.txt b/code/nel/tools/3d/plugin_max/nel_patch_paint/CMakeLists.txt index de6310d18..388e8b8ef 100644 --- a/code/nel/tools/3d/plugin_max/nel_patch_paint/CMakeLists.txt +++ b/code/nel/tools/3d/plugin_max/nel_patch_paint/CMakeLists.txt @@ -22,5 +22,7 @@ NL_DEFAULT_PROPS(nel_patch_paint "MAX Plugin: NeL Patch Painter") NL_ADD_RUNTIME_FLAGS(nel_patch_paint) NL_ADD_LIB_SUFFIX(nel_patch_paint) +ADD_DEFINITIONS(${MAXSDK_DEFINITIONS}) + INSTALL(TARGETS nel_patch_paint RUNTIME DESTINATION maxplugin/plugins LIBRARY DESTINATION ${NL_LIB_PREFIX} ARCHIVE DESTINATION ${NL_LIB_PREFIX} COMPONENT libraries) INSTALL(FILES keys.cfg DESTINATION maxplugin/plugins ) \ No newline at end of file diff --git a/code/nel/tools/3d/plugin_max/nel_vertex_tree_paint/CMakeLists.txt b/code/nel/tools/3d/plugin_max/nel_vertex_tree_paint/CMakeLists.txt index 9c4f6deb2..dc5b6a284 100644 --- a/code/nel/tools/3d/plugin_max/nel_vertex_tree_paint/CMakeLists.txt +++ b/code/nel/tools/3d/plugin_max/nel_vertex_tree_paint/CMakeLists.txt @@ -19,4 +19,6 @@ NL_DEFAULT_PROPS(nel_vertex_tree_paint "MAX Plugin: NeL Vertex Tree Painter") NL_ADD_RUNTIME_FLAGS(nel_vertex_tree_paint) NL_ADD_LIB_SUFFIX(nel_vertex_tree_paint) +ADD_DEFINITIONS(${MAXSDK_DEFINITIONS}) + INSTALL(TARGETS nel_vertex_tree_paint RUNTIME DESTINATION maxplugin/plugins LIBRARY DESTINATION ${NL_LIB_PREFIX} ARCHIVE DESTINATION ${NL_LIB_PREFIX} COMPONENT libraries)