This repository has been archived by the owner on Feb 28, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
CMakeLists.txt
216 lines (183 loc) · 6.93 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
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
cmake_minimum_required(VERSION 3.1)
set(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS true)
cmake_policy(SET CMP0003 NEW)
include(CheckCXXCompilerFlag)
project(HoudiniROPCopGif)
# Detect C++11 or C++0x.
CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11)
CHECK_CXX_COMPILER_FLAG("-std=c++0x" COMPILER_SUPPORTS_CXX0X)
if(COMPILER_SUPPORTS_CXX11)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
elseif(COMPILER_SUPPORTS_CXX0X)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
else()
if(NOT WIN32)
message(STATUS "The compiler ${CMAKE_CXX_COMPILER} has no C++11 support. Please use a different C++ compiler.")
endif ()
endif()
# Function to extract Houdini version from a Version file.
function(extract_houdini_version parm_hfs)
set(_version_file ${parm_hfs}/toolkit/include/SYS/SYS_Version.h)
if(EXISTS ${_version_file})
file(READ ${_version_file} _version_file_contents)
string(REGEX MATCH "#define SYS_VERSION_FULL \"([0-9]+\.[0-9]+\.[0-9]+)\"" _version_line ${_version_file_contents})
string(REGEX REPLACE "#define SYS_VERSION_FULL \"([0-9]+\.[0-9]+\.[0-9]+)\"" "\\1" HOUDINI_ROP_COPGIF_VERSION_FULL ${_version_line})
set(HOUDINI_ROP_COPGIF_VERSION_FULL ${HOUDINI_ROP_COPGIF_VERSION_FULL} PARENT_SCOPE)
else()
message(FATAL " ${parm_hfs} does not point to a valid Houdini baseline.")
endif()
endfunction()
if(APPLE)
if(DEFINED ENV{HOUDINI_VERSION})
set(HOUDINI_ROP_COPGIF_VERSION_FULL $ENV{HOUDINI_VERSION})
set(HOUDINI_ROP_COPGIF_HFS /Library/Frameworks/Houdini.Framework/Versions/${HOUDINI_ROP_COPGIF_VERSION_FULL})
set(_version_file /Library/Frameworks/Houdini.Framework/Versions/${HOUDINI_ROP_COPGIF_VERSION_FULL}/Resources/toolkit/include/SYS/SYS_Version.h)
if(NOT EXISTS ${_version_file})
message(FATAL " Houdini ${HOUDINI_ROP_COPGIF_VERSION_FULL} is not installed.")
endif()
elseif(DEFINED ENV{HFS})
set(HOUDINI_ROP_COPGIF_HFS $ENV{HFS})
if(EXISTS ${HOUDINI_ROP_COPGIF_HFS}/Frameworks/Houdini.Framework/Versions/Current/Resources)
extract_houdini_version(${HOUDINI_ROP_COPGIF_HFS}/Frameworks/Houdini.Framework/Versions/Current/Resources)
else()
extract_houdini_version(${HOUDINI_ROP_COPGIF_HFS}/Resources)
endif()
else()
message(FATAL " Please define either HOUDINI_VERSION or HFS variable.")
endif()
string(REGEX MATCH "([0-9]+\.[0-9]+)" HOUDINI_ROP_COPGIF_VERSION ${HOUDINI_ROP_COPGIF_VERSION_FULL})
set(HOUDINI_ROP_COPGIF_VERSION ${HOUDINI_ROP_COPGIF_VERSION})
# Path to where DSOs are installed for this version.
set(HOUDINI_ROP_COPGIF_DSO_PATH $ENV{HOME}/Library/Preferences/houdini/${HOUDINI_ROP_COPGIF_VERSION}/dso)
set(HOUDINI_ROP_COPGIF_INCLUDE_DIRECTORIES
${HOUDINI_ROP_COPGIF_HFS}/Resources/toolkit/include
)
set(HOUDINI_ROP_COPGIF_LINK_DIRECTORIES
${HOUDINI_ROP_COPGIF_HFS}/Libraries
)
# Remove lib prefix on OS X.
set(CMAKE_SHARED_MODULE_PREFIX "")
set(CMAKE_SHARED_LIBRARY_PREFIX "")
# Set dylib prefix for modules on OS X.
set(CMAKE_SHARED_MODULE_SUFFIX ".dylib")
# OS X specific definitions.
add_definitions(
-DVERSION=\"${HOUDINI_ROP_COPGIF_VERSION_FULL}\"
-DENABLE_THREADS
-DUSE_PTHREADS
-DMBSD_INTEL
-DMBSD_COCOA
-DMBSD
-DUSE_PTHREADS
-D_GNU_SOURCE
-DGCC4
-DGCC3
"-arch x86_64"
"-mmacosx-version-min=10.9"
)
# Disable rpath.
set(CMAKE_SKIP_RPATH TRUE)
# Module creation flags.
string(REPLACE "-Wl,-headerpad_max_install_names" "" CMAKE_SHARED_MODULE_CREATE_CXX_FLAGS "${CMAKE_SHARED_MODULE_CREATE_CXX_FLAGS}")
set(CMAKE_SHARED_MODULE_CREATE_CXX_FLAGS "${CMAKE_SHARED_MODULE_CREATE_CXX_FLAGS} -flat_namespace -undefined suppress -arch x86_64 -fobjc-gc")
set(HOUDINI_ROP_COPGIF_LIBS
HoudiniUT
HoudiniGEO
HoudiniPRM
HoudiniOP2
HoudiniOP3
boost_system
tbb
tbbmalloc
)
elseif (WIN32)
if(DEFINED ENV{HOUDINI_VERSION})
set(HOUDINI_ROP_COPGIF_VERSION_FULL $ENV{HOUDINI_VERSION})
set(HOUDINI_ROP_COPGIF_HFS "C:/Program Files/Side Effects Software/Houdini ${HOUDINI_ROP_COPGIF_VERSION_FULL}")
set(_version_file ${HOUDINI_ROP_COPGIF_HFS}/toolkit/include/SYS/SYS_Version.h)
if(NOT EXISTS ${_version_file})
message(FATAL " Houdini ${HOUDINI_ROP_COPGIF_VERSION_FULL} is not installed.")
endif()
elseif(DEFINED ENV{HFS})
set(HOUDINI_ROP_COPGIF_HFS $ENV{HFS})
extract_houdini_version(${HOUDINI_ROP_COPGIF_HFS})
else()
message(FATAL " Please define either HOUDINI_VERSION or HFS variable.")
endif()
string(REGEX MATCH "([0-9]+\.[0-9]+)" HOUDINI_ROP_COPGIF_VERSION ${HOUDINI_ROP_COPGIF_VERSION_FULL})
set(HOUDINI_ROP_COPGIF_VERSION ${HOUDINI_ROP_COPGIF_VERSION})
# Path to where DSOs are installed for this version.
set(HOUDINI_ROP_COPGIF_DSO_PATH ${HOUDINI_ROP_COPGIF_HFS}/bin)
set(HOUDINI_ROP_COPGIF_INCLUDE_DIRECTORIES
${HOUDINI_ROP_COPGIF_HFS}/toolkit/include
)
set(HOUDINI_ROP_COPGIF_LINK_DIRECTORIES
${HOUDINI_ROP_COPGIF_HFS}/custom/houdini/dsolib
)
add_definitions(
-DVERSION=\"${HOUDINI_ROP_COPGIF_VERSION_FULL}\"
-DWIN32
-DI386
-nologo
-TP
-Zc:forScope
-DSWAP_BITFIELDS
-D_WIN32_WINNT=0x0502
-DNOMINMAX
-DSTRICT
-DWIN32_LEAN_AND_MEAN
-D_USE_MATH_DEFINES
-D_CRT_SECURE_NO_DEPRECATE
-D_CRT_NONSTDC_NO_DEPRECATE
-D_SCL_SECURE_NO_WARNINGS
-DBOOST_ALL_NO_LIB
-wd4355
-w14996
#-O2
-DNDEBUG
-MD
-EHsc
-GR
-bigobj
)
set(HOUDINI_ROP_COPGIF_LIBS
${HOUDINI_ROP_COPGIF_LINK_DIRECTORIES}/*.a
${HOUDINI_ROP_COPGIF_LINK_DIRECTORIES}/*.lib
)
else()
else()
message(FATAL_ERROR "Unsupported platform.")
endif()
# Add common definitions.
add_definitions(
-DMAKING_DSO
-DAMD64
-DSIZEOF_VOID_P=8
-DSESI_LITTLE_ENDIAN
-DFBX_ENABLED=1
-DOPENCL_ENABLED=1
-DOPENVDB_ENABLED=1
-D_REENTRANT
-D_FILE_OFFSET_BITS=64
)
# Set include directories.
include_directories(${HOUDINI_ROP_COPGIF_INCLUDE_DIRECTORIES})
include_directories(gif-h-mit)
# Set link directories.
link_directories(${HOUDINI_ROP_COPGIF_LINK_DIRECTORIES})
# Set output directory.
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_DEBUG ${CMAKE_BINARY_DIR})
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE ${CMAKE_BINARY_DIR})
message(STATUS "HOUDINI_VERSION=${HOUDINI_ROP_COPGIF_VERSION_FULL}")
message(STATUS "HFS=${HOUDINI_ROP_COPGIF_HFS}")
set(HOUDINI_ROP_COPGIF_INCLUDE
ROP_CopGif.h
)
set(HOUDINI_ROP_COPGIF_SOURCE
ROP_CopGif.C
)
add_definitions(
-DUT_DSO_TAGINFO=\"3262197cbf1f421b2dbf06a85739dcf12041dbe9c46287fa6d9cbe575a5ae8803e9a58fd12869342e09e3a80a9b631c59f9f501ffd8e85349072cf865fa90bb71be45a0ff924994a326cf515dba11b1e0019ba98488\")
add_library(ROP_CopGif SHARED ${HOUDINI_ROP_COPGIF_INCLUDE} ${HOUDINI_ROP_COPGIF_SOURCE})
target_link_libraries(ROP_CopGif ${HOUDINI_ROP_COPGIF_LIBS})