-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathCMakeLists.txt
88 lines (68 loc) · 2.63 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
86
87
cmake_minimum_required(VERSION 3.4.1)
project(wrap_cuda_deformer)
# in case a gcc version is too new for cuda
# cmake -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ .
set(MAYA_VERSION 2017)
set(CUSTOM_DEFINITIONS "REQUIRE_IOSTREAM;_BOOL")
set(MAYA_INSTALL_BASE_SUFFIX "")
set(MAYA_INC_SUFFIX "include")
set(MAYA_LIB_SUFFIX "lib")
set(MAYA_INSTALL_BASE_SUFFIX "")
if(WIN32)
set(MAYA_INSTALL_BASE_DEFAULT "C:/Program Files/Autodesk")
elseif(APPLE)
set(MAYA_INSTALL_BASE_DEFAULT /Applications/Autodesk)
else()
set(MAYA_INSTALL_BASE_DEFAULT /usr/autodesk)
if(MAYA_VERSION LESS 2016)
SET(MAYA_INSTALL_BASE_SUFFIX -x64)
endif()
endif()
set(MAYA_INSTALL_BASE_PATH ${MAYA_INSTALL_BASE_DEFAULT})
set(MAYA_LOCATION
${MAYA_INSTALL_BASE_PATH}/maya${MAYA_VERSION}${MAYA_INSTALL_BASE_SUFFIX})
find_package(OpenGL REQUIRED)
find_package(CUDA REQUIRED)
set(SOURCE_FILES
"utils/point_to_triangle.cc"
"maya/wrap_cuda_deformer.cc"
"maya/wrap_cuda_main.cc"
)
set(LIBRARIES ${LIBRARIES}
"Foundation"
"OpenMaya"
"OpenMayaAnim"
"OpenMayaUI"
"OpenMayaRender"
${OPENGL_LIBRARIES})
set(CUDA_NVCC_FLAGS "-arch=sm_50 -Xcompiler -fPIC")
set(_MAYA_LOCATION
${MAYA_INSTALL_BASE_PATH}/maya${MAYA_VERSION}${MAYA_INSTALL_BASE_SUFFIX})
set(_PROJECT ${PROJECT_NAME})
include_directories(${_MAYA_LOCATION}/${MAYA_INC_SUFFIX}
"${CMAKE_CURRENT_BINARY_DIR}/maya"
"${CMAKE_CURRENT_BINARY_DIR}/utils"
"${CMAKE_CURRENT_BINARY_DIR}/cuda"
${OPENGL_INCLUDE_DIRS}
${GLUT_INCLUDE_DIRS})
link_directories(${_MAYA_LOCATION}/${MAYA_LIB_SUFFIX})
cuda_add_library(cuda_ops STATIC "cuda/cuda_ops.cu")
CUDA_ADD_CUBLAS_TO_TARGET(cuda_ops)
add_library(${_PROJECT} SHARED ${SOURCE_FILES})
set_target_properties(${_PROJECT} PROPERTIES COMPILE_FLAGS
"${CMAKE_CXX_FLAGS} -std=c++11")
target_link_libraries(${_PROJECT} cuda_ops ${LIBRARIES} ${CUDA_LIBRARIES})
set_target_properties(${_PROJECT} PROPERTIES
COMPILE_DEFINITIONS "${CUSTOM_DEFINITIONS}")
set_target_properties(${_PROJECT} PROPERTIES OUTPUT_NAME ${PROJECT_NAME})
set_target_properties(${_PROJECT} PROPERTIES CLEAN_DIRECT_OUTPUT 1)
if(WIN32)
set_target_properties(${_PROJECT} PROPERTIES SUFFIX ".mll" )
set_target_properties(${_PROJECT} PROPERTIES LINK_FLAGS
"/export:initializePlugin /export:uninitializePlugin" )
elseif(APPLE)
set_target_properties(${_PROJECT} PROPERTIES PREFIX "" )
set_target_properties(${_PROJECT} PROPERTIES SUFFIX ".bundle" )
else()
set_target_properties(${_PROJECT} PROPERTIES PREFIX "" )
endif()