-
Notifications
You must be signed in to change notification settings - Fork 46
/
CMakeLists.txt
67 lines (53 loc) · 2.85 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
cmake_minimum_required (VERSION 3.8)
SET(CMAKE_INSTALL_PREFIX "${CMAKE_SOURCE_DIR}" CACHE PATH "Install path prefix")
MESSAGE(STATUS "CMAKE_INSTALL_PREFIX is: " ${CMAKE_INSTALL_PREFIX})
project (UnityFbxExporterEditorPackage NONE)
###########################################################################
# Zip integrations folder
set(MAYA_INTEGRATION_COPY_TARGET CopyMayaIntegration)
set(MAYA_INTEGRATION_ZIP_TARGET ZipMayaIntegration)
set(MAYA_INTEGRATION_ZIP_NAME "UnityFbxForMaya.7z")
set(MAX_INTEGRATION_ZIP_TARGET ZipMaxIntegration)
set(MAX_INTEGRATION_ZIP_NAME "UnityFbxForMax.7z")
configure_file("${CMAKE_SOURCE_DIR}/Integrations/Autodesk/maya/scripts/unitySetupUI.mel.in"
"${CMAKE_BINARY_DIR}/Integrations/Autodesk/maya/scripts/unitySetupUI.mel"
@ONLY
)
file(GLOB_RECURSE MAYA_INTEGRATION_FILES RELATIVE "${CMAKE_SOURCE_DIR}" "${CMAKE_SOURCE_DIR}/Integrations/Autodesk/maya/*")
list(FILTER MAYA_INTEGRATION_FILES EXCLUDE REGEX ".*/unitySetupUI.mel.in$")
add_custom_command(OUTPUT ${MAYA_INTEGRATION_FILES}
COMMAND ${CMAKE_COMMAND} -E copy_directory
"${CMAKE_SOURCE_DIR}/Integrations/Autodesk/maya"
"${CMAKE_BINARY_DIR}/Integrations/Autodesk/maya"
COMMAND ${CMAKE_COMMAND} -E remove
"${CMAKE_BINARY_DIR}/Integrations/Autodesk/maya/scripts/unitySetupUI.mel.in"
COMMENT "Copying Maya Integration folder"
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
)
add_custom_target(${MAYA_INTEGRATION_COPY_TARGET} ALL DEPENDS ${MAYA_INTEGRATION_FILES})
add_custom_command(OUTPUT ${MAYA_INTEGRATION_ZIP_NAME}
COMMAND ${CMAKE_COMMAND} -E tar "cfv" ${CMAKE_BINARY_DIR}/${MAYA_INTEGRATION_ZIP_NAME} --format=7zip
"${CMAKE_BINARY_DIR}/Integrations/Autodesk/maya"
MAIN_DEPENDENCY "${CMAKE_SOURCE_DIR}/Integrations/Autodesk/maya"
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
COMMENT "Zipping Maya Integration folder"
)
add_custom_target(${MAYA_INTEGRATION_ZIP_TARGET} ALL DEPENDS ${MAYA_INTEGRATION_ZIP_NAME})
add_dependencies(${MAYA_INTEGRATION_ZIP_TARGET} ${MAYA_INTEGRATION_COPY_TARGET})
add_custom_command(OUTPUT ${MAX_INTEGRATION_ZIP_NAME}
COMMAND ${CMAKE_COMMAND} -E tar "cfv" ${CMAKE_BINARY_DIR}/${MAX_INTEGRATION_ZIP_NAME} --format=7zip
"${CMAKE_SOURCE_DIR}/Integrations/Autodesk/max"
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
COMMENT "Zipping 3DsMax Integration folder"
)
add_custom_target(${MAX_INTEGRATION_ZIP_TARGET} ALL DEPENDS ${MAX_INTEGRATION_ZIP_NAME})
############################################################################
# Install project into build folder
install(
FILES "${CMAKE_BINARY_DIR}/${MAYA_INTEGRATION_ZIP_NAME}" "${CMAKE_BINARY_DIR}/${MAX_INTEGRATION_ZIP_NAME}"
DESTINATION "${CMAKE_INSTALL_PREFIX}/com.unity.formats.fbx/Editor/Integrations~"
)
install(
FILES "${CMAKE_SOURCE_DIR}/CHANGELOG.md" "${CMAKE_SOURCE_DIR}/LICENSE.md"
DESTINATION "${CMAKE_INSTALL_PREFIX}/com.unity.formats.fbx"
)