forked from redpawfx/DisplaceD
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
131 lines (93 loc) · 3.46 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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
##### THIS WILL NEED SOME HELP WITH NON-Linux compiles
## CMake compatibility issues: don't modify this, please!
CMAKE_MINIMUM_REQUIRED( VERSION 2.4.6 )
if(COMMAND cmake_policy)
cmake_policy(SET CMP0003 NEW)
cmake_policy(SET CMP0015 NEW) # to supress relative library directory warnings
endif(COMMAND cmake_policy)
SET(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
IF (UNIX)
EXECUTE_PROCESS(COMMAND sh -c "echo `uname`-`uname -m`" OUTPUT_VARIABLE VARIANT_DIRECTORY OUTPUT_STRIP_TRAILING_WHITESPACE)
SET(BUILD_PLATFORM "${VARIANT_DIRECTORY}")
MESSAGE(STATUS "Build Platform: ${BUILD_PLATFORM}")
ELSEIF(WIN32)
SET( BUILD_PLATFORM "windows_x86_64")
ENDIF()
find_package(Maya)
if (MAYA_FOUND)
IF ( UNIX AND NOT APPLE )
ADD_DEFINITIONS(-DLINUX)
ENDIF()
if( APPLE )
ADD_DEFINITIONS(-DMAC_PLUGIN)
ADD_DEFINITIONS(-DOSMac_)
ADD_DEFINITIONS(-DOSMac_MachO)
ENDIF()
SET(CMAKE_CXX_WARNING_LEVEL 4)
MARK_AS_ADVANCED(CMAKE_BACKWARDS_COMPATIBILITY)
## allow more human readable "if then else" constructs
SET( CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS TRUE )
## Use verbose make file
SET ( CMAKE_VERBOSE_MAKEFILE TRUE )
set (PLUGIN_NAME "DisplaceD")
set (CMAKE_PROJECT_NAME "DisplaceD")
if(APPLE)
set (PLUGIN_SUFFIX ".bundle")
set (CMAKE_SHARED_LIBRARY_SUFFIX ".bundle")
set (SUFFIX ".bundle")
ENDIF()
if(WIN32)
set (PLUGIN_SUFFIX ".mll")
set (CMAKE_SHARED_LIBRARY_SUFFIX ".mll")
set (SUFFIX ".mll")
ENDIF()
if (UNIX)
set (PLUGIN_SUFFIX ".so")
set (CMAKE_SHARED_LIBRARY_SUFFIX ".so")
set (SUFFIX ".so")
ENDIF()
set (STD_INCLUDES "." ".." "/usr/X11R6/include" "/usr/include" "/usr/include/CC")
set (FOOBAR "/usr/lib64")
include_directories (${STD_INCLUDES} ${MAYA_INCLUDE_DIRS})
link_directories ( ${FOOBAR} ${MAYA_LIBRARY_DIR})
add_definitions(-D_BOOL)
add_definitions(-DREQUIRE_IOSTREAM)
if (!WIN32)
add_definitions(-fPIC)
add_definitions(-O3)
add_definitions(-pthread)
endif()
FILE(GLOB displaceDCPP "src/*.cpp")
FILE(GLOB displaceDINCLUDES "src/*.h")
SET(TARGET_H ${displaceDINCLUDES})
SET(TARGET_SRC ${displaceDCPP})
find_package(OpenGL REQUIRED)
if (OPENGL_FOUND)
if(APPLE)
SET(OPENGL_gl_LIBRARY "-framework OpenGL")
SET(OPENGL_glu_LIBRARY "-framework GLUT")
elseif(WIN32)
SET(OPENGL_gl_LIBRARY "openGL32")
SET(OPENGL_glu_LIBRARY "glu32")
else()
SET(OPENGL_gl_LIBRARY "GL")
SET(OPENGL_glu_LIBRARY "GLU")
endif()
endif(OPENGL_FOUND)
SET(MAYA_LIBS OpenMaya Foundation OpenMayaAnim OpenMayaFX OpenMayaUI OpenMayaRender)
ADD_LIBRARY(${PLUGIN_NAME} SHARED ${TARGET_H} ${TARGET_SRC})
set_target_properties(${PLUGIN_NAME} PROPERTIES PREFIX "")
## need these to build for windows or else the plugin won't load
IF(WIN32)
set_target_properties(${PLUGIN_NAME} PROPERTIES LINK_FLAGS "/export:initializePlugin /export:uninitializePlugin")
ENDIF()
TARGET_LINK_LIBRARIES(${PLUGIN_NAME} ${MAYA_LIBS} ${OPENGL_gl_LIBRARY} ${OPENGL_glu_LIBRARY})
SET (DISPLACED_OUTPUT_PATH ${CMAKE_SOURCE_DIR}/outputs/${BUILD_PLATFORM}/maya-${MAYA_VERSION}/plug-ins)
SET (DISPLACED_OUTPUTSCRIPTS_PATH ${CMAKE_SOURCE_DIR}/outputs/${BUILD_PLATFORM}/maya-${MAYA_VERSION}/scripts)
SET (DISPLACED_OUTPUTICONS_PATH ${CMAKE_SOURCE_DIR}/outputs/${BUILD_PLATFORM}/maya-${MAYA_VERSION}/icons)
INSTALL( TARGETS ${PLUGIN_NAME} DESTINATION ${DISPLACED_OUTPUT_PATH})
FILE(GLOB DISPLACED_SCRIPTS "scripts/*.mel")
INSTALL( FILES ${DISPLACED_SCRIPTS} DESTINATION ${DISPLACED_OUTPUTSCRIPTS_PATH})
FILE(GLOB DISPLACED_ICONS "icons/*")
INSTALL( FILES ${DISPLACED_ICONS} DESTINATION ${DISPLACED_OUTPUTICONS_PATH})
ENDIF(MAYA_FOUND)