@@ -27,7 +27,22 @@ endif()
27
27
28
28
if (NOT DEFINED FBXSDK_PACKAGE_PATH )
29
29
# TODO: store the FbxSdk directly in this project
30
- set (FBXSDK_PACKAGE_PATH "${CMAKE_SOURCE_DIR} /../FbxSharpBuild/FbxSdk_${PACKAGE_VERSION} .unitypackage" )
30
+ set (FBXSDK_PACKAGE_PATH "${CMAKE_SOURCE_DIR} /../FbxSharpBuild" )
31
+
32
+ # find the most recent package at the path
33
+ file (GLOB FBXSDK_PACKAGES "${FBXSDK_PACKAGE_PATH} /FbxSdk_*.*.*.unitypackage" )
34
+ set (NEWEST_PACKAGE "" )
35
+ foreach (fbxsdk_package ${FBXSDK_PACKAGES} )
36
+ if (fbxsdk_package IS_NEWER_THAN NEWEST_PACKAGE )
37
+ set (NEWEST_PACKAGE ${fbxsdk_package} )
38
+ endif ()
39
+ endforeach (fbxsdk_package )
40
+
41
+ if ("${NEWEST_PACKAGE} " STREQUAL "" )
42
+ message (FATAL_ERROR "Failed to find FbxSdk Unity Package at: ${FBXSDK_PACKAGE_PATH} " )
43
+ else ()
44
+ set (FBXSDK_PACKAGE_PATH ${NEWEST_PACKAGE} )
45
+ endif ()
31
46
endif ()
32
47
33
48
# promote warnings to errors
@@ -52,10 +67,12 @@ set(Python_ADDITIONAL_VERSIONS 2.7)
52
67
###########################################################################
53
68
# Import FbxSharp package
54
69
70
+ # remove FbxSdk folder
71
+ file (REMOVE_RECURSE "${CMAKE_SOURCE_DIR} /Assets/FbxExporters/FbxSdk" )
72
+
55
73
set (FBXSDK_PACKAGE_TARGET import_fbxsdk )
56
74
add_custom_target (
57
75
${FBXSDK_PACKAGE_TARGET}
58
- COMMAND rmdir /s "${CMAKE_SOURCE_DIR} /Assets/FbxSdk"
59
76
COMMAND "${UNITY_EDITOR_PATH} " -projectPath "${CMAKE_SOURCE_DIR} " -importPackage ${FBXSDK_PACKAGE_PATH} -quit
60
77
)
61
78
@@ -82,7 +99,7 @@ add_custom_target(${MAYA_INTEGRATION_TARGET} DEPENDS ${MAYA_INTEGRATION_ZIP_NAME
82
99
# Add target for creating a package
83
100
add_custom_command (
84
101
OUTPUT ${PACKAGE_PATH}
85
- COMMAND "${UNITY_EDITOR_PATH} " -batchmode -projectPath ${CMAKE_SOURCE_DIR} -exportPackage Assets/FbxExporters Assets/FbxSdk ${PACKAGE_PATH} -quit
102
+ COMMAND "${UNITY_EDITOR_PATH} " -batchmode -projectPath ${CMAKE_SOURCE_DIR} -exportPackage Assets/FbxExporters ${PACKAGE_PATH} -quit
86
103
COMMENT "Creating Unity Package ${PACKAGE_PATH} "
87
104
DEPENDS ${MAYA_INTEGRATION_TARGET}
88
105
)
0 commit comments