-
Notifications
You must be signed in to change notification settings - Fork 54
/
CMakeLists.txt
85 lines (71 loc) · 2.23 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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
# Copyright (c) 2018-2023 Serguei Kalentchouk et al. All rights reserved.
# Use of this source code is governed by an MIT license that can be found in the LICENSE file.
# Define project
cmake_minimum_required(VERSION 3.3)
project(maya-math-nodes VERSION 1.6.0)
# Set project version macro
add_definitions(-DPROJECT_VERSION="${PROJECT_VERSION}")
# Set default Maya version
if(NOT DEFINED MAYA_VERSION)
set(MAYA_VERSION 2023)
endif()
# Set node name prefix macro
if(NOT DEFINED NODE_NAME_PREFIX)
set(NODE_NAME_PREFIX "math_")
endif()
add_definitions(-DNODE_NAME_PREFIX="${NODE_NAME_PREFIX}")
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
find_package(Maya REQUIRED)
# Set compile flags
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
if(WIN32)
add_compile_options(/wd4068 /EHsc)
endif()
# Create target
add_library(mayaMathNodes SHARED
src/Absolute.h
src/Add.h
src/Array.h
src/Condition.h
src/Clamp.h
src/Debug.h
src/Distance.h
src/Divide.h
src/Convert.h
src/Interpolate.h
src/Inverse.h
src/MinMax.h
src/Multiply.h
src/Negate.h
src/Plugin.cpp
src/Power.h
src/Round.h
src/Trig.h
src/Twist.h
src/Subtract.h
src/Utils.h
src/VectorOps.h)
include_directories(${MAYA_INCLUDE_DIR})
link_directories(${MAYA_LIBRARY_DIR})
target_link_libraries(mayaMathNodes ${MAYA_LIBRARIES})
set_target_properties(mayaMathNodes PROPERTIES
COMPILE_DEFINITIONS "${MAYA_COMPILE_DEFINITIONS}"
PREFIX ""
SUFFIX ${MAYA_PLUGIN_EXT})
if(WIN32)
set_target_properties(mayaMathNodes PROPERTIES LINK_FLAGS "/export:initializePlugin /export:uninitializePlugin")
endif()
# Set installation directory
if(NOT DEFINED INSTALL_DIR)
set(INSTALL_DIR ${CMAKE_SOURCE_DIR}/dist)
endif()
configure_file(MayaMathNodes.mod.in MayaMathNodes.mod)
install(TARGETS mayaMathNodes
LIBRARY DESTINATION ${INSTALL_DIR}/MayaMathNodes/plug-ins/${MAYA_VERSION}
RUNTIME DESTINATION ${INSTALL_DIR}/MayaMathNodes/plug-ins/${MAYA_VERSION})
install(DIRECTORY python/maya_math_nodes
DESTINATION ${INSTALL_DIR}/MayaMathNodes/scripts
PATTERN "*.pyc" EXCLUDE
PATTERN ".*" EXCLUDE)
install(FILES ${CMAKE_BINARY_DIR}/MayaMathNodes.mod DESTINATION ${INSTALL_DIR})