From 7a442801cd0eb30656cf1eab16f5aed6f7b60e54 Mon Sep 17 00:00:00 2001 From: Stuart Mentzer Date: Sun, 26 Jan 2020 14:28:56 -0500 Subject: [PATCH] FBX plugin updates / PREFIX-NOTFOUND work-around --- CMakeModules/FindFBX.cmake | 56 ++++++++++++++++++++++++++++--- CMakeModules/ModuleInstall.cmake | 3 ++ src/osgPlugins/fbx/CMakeLists.txt | 9 ++++- 3 files changed, 62 insertions(+), 6 deletions(-) diff --git a/CMakeModules/FindFBX.cmake b/CMakeModules/FindFBX.cmake index 7e0ffb6d6..6ffee2ceb 100644 --- a/CMakeModules/FindFBX.cmake +++ b/CMakeModules/FindFBX.cmake @@ -25,17 +25,22 @@ ELSEIF(MSVC10) SET(FBX_LIBDIR "vs2010") ELSEIF(MSVC11) SET(FBX_LIBDIR "vs2012") -ELSEIF(MSVC12 OR MSVC_VERSION==1800) +ELSEIF(MSVC_VERSION EQUAL 1800) SET(FBX_LIBDIR "vs2013") -ELSEIF(MSVC14 OR MSVC_VERSION>1900) +ELSEIF(MSVC_VERSION EQUAL 1900) SET(FBX_LIBDIR "vs2015") +ELSEIF(MSVC_VERSION GREATER_EQUAL 1910 AND MSVC_VERSION LESS 1920) + SET(FBX_LIBDIR "vs2017") +ELSEIF(MSVC_VERSION GREATER_EQUAL 1920 AND MSVC_VERSION LESS 1930) +# SET(FBX_LIBDIR "vs2019") # FBX doesn't have this yet as of version 2020.0.1 + SET(FBX_LIBDIR "vs2017") # Binary compatible with vs2019 ENDIF() IF(APPLE) # do nothing ELSEIF(CMAKE_CL_64) SET(FBX_LIBDIR ${FBX_LIBDIR}/x64) -ELSEIF(CMAKE_COMPILER_IS_GNUCXX AND CMAKE_SIZEOF_VOID_P EQUAL 8) +ELSEIF(CMAKE_SIZEOF_VOID_P EQUAL 8) SET(FBX_LIBDIR ${FBX_LIBDIR}/x64) ELSE() SET(FBX_LIBDIR ${FBX_LIBDIR}/x86) @@ -53,6 +58,10 @@ ELSE() SET(FBX_LIBNAME "libfbxsdk") ELSE() SET(FBX_LIBNAME "libfbxsdk-md") + IF(WIN32) + SET(FBX_XML2_LIBNAME "libxml2-md") + SET(FBX_ZLIB_LIBNAME "zlib-md") + ENDIF() ENDIF() ENDIF() @@ -60,19 +69,41 @@ SET(FBX_LIBNAME_DEBUG ${FBX_LIBNAME}d) SET( FBX_SEARCH_PATHS $ENV{FBX_DIR} + "$ENV{ProgramW6432}/Autodesk/FBX/FBX SDK/2020.0.1" + "$ENV{PROGRAMFILES}/Autodesk/FBX/FBX SDK/2020.0.1" + "/Applications/Autodesk/FBX SDK/2020.0.1" + "$ENV{ProgramW6432}/Autodesk/FBX/FBX SDK/2020.0" + "$ENV{PROGRAMFILES}/Autodesk/FBX/FBX SDK/2020.0" + "/Applications/Autodesk/FBX SDK/2020.0" + "$ENV{ProgramW6432}/Autodesk/FBX/FBX SDK/2019.5" + "$ENV{PROGRAMFILES}/Autodesk/FBX/FBX SDK/2019.5" + "/Applications/Autodesk/FBX SDK/2019.5" + "$ENV{ProgramW6432}/Autodesk/FBX/FBX SDK/2019.2" + "$ENV{PROGRAMFILES}/Autodesk/FBX/FBX SDK/2019.2" + "/Applications/Autodesk/FBX SDK/2019.2" "$ENV{ProgramW6432}/Autodesk/FBX/FBX SDK/2019.0" "$ENV{PROGRAMFILES}/Autodesk/FBX/FBX SDK/2019.0" - "/Applications/Autodesk/FBX\ SDK/2019.0" + "/Applications/Autodesk/FBX SDK/2019.0" "$ENV{ProgramW6432}/Autodesk/FBX/FBX SDK/2018.1.1" "$ENV{PROGRAMFILES}/Autodesk/FBX/FBX SDK/2018.1.1" - "/Applications/Autodesk/FBX\ SDK/2018.0" + "/Applications/Autodesk/FBX SDK/2018.1.1" + "$ENV{ProgramW6432}/Autodesk/FBX/FBX SDK/2018.0" + "$ENV{PROGRAMFILES}/Autodesk/FBX/FBX SDK/2018.0" + "/Applications/Autodesk/FBX SDK/2018.0" "$ENV{ProgramW6432}/Autodesk/FBX/FBX SDK/2017.1" "$ENV{PROGRAMFILES}/Autodesk/FBX/FBX SDK/2017.1" "/Applications/Autodesk/FBX SDK/2017.1" + "$ENV{ProgramW6432}/Autodesk/FBX/FBX SDK/2017.0" + "$ENV{PROGRAMFILES}/Autodesk/FBX/FBX SDK/2017.0" + "/Applications/Autodesk/FBX SDK/2017.0" "$ENV{ProgramW6432}/Autodesk/FBX/FBX SDK/2016.1.2" "$ENV{PROGRAMFILES}/Autodesk/FBX/FBX SDK/2016.1.2" + "/Applications/Autodesk/FBX/FBX SDK/2016.1.2" + /Applications/Autodesk/FBXSDK201612 "$ENV{ProgramW6432}/Autodesk/FBX/FBX SDK/2016.1.1" "$ENV{PROGRAMFILES}/Autodesk/FBX/FBX SDK/2016.1.1" + "/Applications/Autodesk/FBX/FBX SDK/2016.1.1" + /Applications/Autodesk/FBXSDK201611 "$ENV{ProgramW6432}/Autodesk/FBX/FBX SDK/2015.1" "$ENV{PROGRAMFILES}/Autodesk/FBX/FBX SDK/2015.1" "/Applications/Autodesk/FBX/FBX SDK/2015.1" @@ -101,6 +132,21 @@ FIND_LIBRARY( FBX_LIBRARY_DEBUG ${FBX_LIBNAME_DEBUG} PATHS ${FBX_SEARCH_PATHS} PATH_SUFFIXES "lib/${FBX_LIBDIR}") +IF(WIN32) + FIND_LIBRARY( FBX_XML2_LIBRARY ${FBX_XML2_LIBNAME} + PATHS ${FBX_SEARCH_PATHS} + PATH_SUFFIXES "lib/${FBX_LIBDIR}/release" "lib/${FBX_LIBDIR}") + FIND_LIBRARY( FBX_ZLIB_LIBRARY ${FBX_ZLIB_LIBNAME} + PATHS ${FBX_SEARCH_PATHS} + PATH_SUFFIXES "lib/${FBX_LIBDIR}/release" "lib/${FBX_LIBDIR}") + FIND_LIBRARY( FBX_XML2_LIBRARY_DEBUG ${FBX_XML2_LIBNAME} + PATHS ${FBX_SEARCH_PATHS} + PATH_SUFFIXES "lib/${FBX_LIBDIR}/debug") + FIND_LIBRARY( FBX_ZLIB_LIBRARY_DEBUG ${FBX_ZLIB_LIBNAME} + PATHS ${FBX_SEARCH_PATHS} + PATH_SUFFIXES "lib/${FBX_LIBDIR}/debug") +ENDIF() + IF(FBX_LIBRARY AND FBX_LIBRARY_DEBUG AND FBX_INCLUDE_DIR) SET(FBX_FOUND "YES") ELSE() diff --git a/CMakeModules/ModuleInstall.cmake b/CMakeModules/ModuleInstall.cmake index be80fd1db..21108afda 100644 --- a/CMakeModules/ModuleInstall.cmake +++ b/CMakeModules/ModuleInstall.cmake @@ -34,6 +34,9 @@ INSTALL( IF(MSVC AND DYNAMIC_OPENSCENEGRAPH) GET_TARGET_PROPERTY(PREFIX ${LIB_NAME} PREFIX) + IF("${PREFIX}" STREQUAL PREFIX-NOTFOUND) # Fix for PREFIX-NOTFOUND left in file names + SET(PREFIX "") + ENDIF() INSTALL(FILES ${OUTPUT_BINDIR}/${PREFIX}${LIB_NAME}${CMAKE_RELWITHDEBINFO_POSTFIX}.pdb DESTINATION ${INSTALL_BINDIR} COMPONENT libopenscenegraph CONFIGURATIONS RelWithDebInfo) INSTALL(FILES ${OUTPUT_BINDIR}/${PREFIX}${LIB_NAME}${CMAKE_DEBUG_POSTFIX}.pdb DESTINATION ${INSTALL_BINDIR} COMPONENT libopenscenegraph CONFIGURATIONS Debug) ENDIF(MSVC AND DYNAMIC_OPENSCENEGRAPH) diff --git a/src/osgPlugins/fbx/CMakeLists.txt b/src/osgPlugins/fbx/CMakeLists.txt index b43f41a80..066baae92 100644 --- a/src/osgPlugins/fbx/CMakeLists.txt +++ b/src/osgPlugins/fbx/CMakeLists.txt @@ -37,6 +37,9 @@ IF(WIN32) OPTION(FBX_SHARED OFF) IF(FBX_SHARED) ADD_DEFINITIONS(-DFBXSDK_SHARED) + ELSE() + SET(TARGET_EXTERNAL_LIBRARIES ${FBX_XML2_LIBRARY}) + SET(TARGET_EXTERNAL_LIBRARIES ${FBX_ZLIB_LIBNAME}) ENDIF(FBX_SHARED) SET(TARGET_EXTERNAL_LIBRARIES wininet) @@ -49,7 +52,11 @@ IF(APPLE) ENDIF(APPLE) SET(TARGET_LIBRARIES_VARS FBX_LIBRARY) -SET(TARGET_ADDED_LIBRARIES osgAnimation) +IF (CMAKE_BUILD_TYPE MATCHES "debug" OR CMAKE_BUILD_TYPE MATCHES "DEBUG") + SET(TARGET_ADDED_LIBRARIES osgAnimation ${FBX_XML2_LIBRARY_DEBUG}) +ELSE() + SET(TARGET_ADDED_LIBRARIES osgAnimation ${FBX_XML2_LIBRARY}) +ENDIF() #### end var setup ### SETUP_PLUGIN(fbx)