forked from appleseedhq/appleseed
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmac-clang.txt
244 lines (205 loc) · 8.53 KB
/
mac-clang.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
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
#
# This source file is part of appleseed.
# Visit https://appleseedhq.net/ for additional information and resources.
#
# This software is released under the MIT license.
#
# Copyright (c) 2010-2013 Francois Beaune, Jupiter Jazz Limited
# Copyright (c) 2014-2018 Francois Beaune, The appleseedhq Organization
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
#
#--------------------------------------------------------------------------------------------------
# clang on macOS.
#--------------------------------------------------------------------------------------------------
set (platform "mac-clang")
#--------------------------------------------------------------------------------------------------
# Preprocessor definitions.
#--------------------------------------------------------------------------------------------------
#--------------------------------------------------------------------------------------------------
# Compilation/linking flags.
#--------------------------------------------------------------------------------------------------
# Flags common to all configurations.
set (c_compiler_flags_common
-Wno-switch # don't complain about unhandled enumeration values in switch
-Wno-deprecated-register # don't complain about "register" (OpenEXR issue)
-fno-math-errno # ignore errno when calling math functions
)
set (cxx_compiler_flags_common
${cxx_compiler_flags_common}
-stdlib=libc++
)
if (USE_SSE)
set (c_compiler_flags_common
${c_compiler_flags_common}
-msse2 # enable SSE instruction sets up to SSE 2
)
endif ()
if (USE_F16C)
set (c_compiler_flags_common
${c_compiler_flags_common}
-mf16c # enable F16C instructions
)
endif ()
if (USE_SSE42)
set (c_compiler_flags_common
${c_compiler_flags_common}
-msse4.2 # enable SSE instruction sets up to SSE 4.2
)
endif ()
if (USE_AVX)
set (c_compiler_flags_common
${c_compiler_flags_common}
-mavx # enable AVX instruction set
)
endif ()
if (USE_AVX2)
set (c_compiler_flags_common
${c_compiler_flags_common}
-mavx2 # enable AVX2 instruction set
-mfma # enable FMA instruction
-ffp-contract=off # for now only explicit fmadd
)
endif ()
set (exe_linker_flags_common
-bind_at_load
)
if (WARNINGS_AS_ERRORS)
if (CMAKE_BUILD_TYPE STREQUAL "Debug" OR
CMAKE_BUILD_TYPE STREQUAL "Release")
set (c_compiler_flags_common
${c_compiler_flags_common}
-Werror # treat Warnings As Errors
)
set (exe_linker_flags_common
-Werror # treat Warnings As Errors
)
set (shared_lib_linker_flags_common
-Werror # treat Warnings As Errors
)
endif ()
endif ()
# Release configuration.
set (c_compiler_flags_release
-O3 # optimization level
)
#--------------------------------------------------------------------------------------------------
# Libraries.
#--------------------------------------------------------------------------------------------------
macro (link_against_platform target)
set_target_properties (${target} PROPERTIES
LINK_FLAGS "-framework Cocoa -lcurl"
)
endmacro ()
macro (link_against_embree target)
target_link_libraries (${target} ${EMBREE_LIBRARIES})
endmacro ()
macro (link_against_lz4 target)
target_link_libraries (${target} ${LZ4_LIBRARY})
endmacro ()
macro (link_against_ocio target)
target_link_libraries (${target} ${OPENCOLORIO_LIBRARIES})
endmacro ()
macro (link_against_oiio target)
target_link_libraries (${target} ${OPENIMAGEIO_LIBRARIES})
endmacro ()
macro (link_against_openexr target)
target_link_libraries (${target}
${IMATH_LIBRARIES}
${OPENEXR_LIBRARIES}
)
endmacro ()
macro (link_against_osl target)
target_link_libraries (${target} ${OSL_EXEC_LIBRARY} ${OSL_COMP_LIBRARY} ${OSL_QUERY_LIBRARY})
endmacro ()
macro (link_against_xercesc target)
target_link_libraries (${target} ${XERCES_LIBRARIES})
endmacro ()
macro (link_against_zlib target)
target_link_libraries (${target} ${ZLIB_LIBRARIES})
endmacro ()
#--------------------------------------------------------------------------------------------------
# Copy a target binary to the sandbox.
#--------------------------------------------------------------------------------------------------
macro (get_sandbox_bin_path path)
set (${path} ${PROJECT_SOURCE_DIR}/sandbox/bin/${CMAKE_BUILD_TYPE})
endmacro ()
macro (get_sandbox_lib_path path)
set (${path} ${PROJECT_SOURCE_DIR}/sandbox/lib/${CMAKE_BUILD_TYPE})
endmacro ()
macro (get_sandbox_py_path path)
get_sandbox_lib_path (${path})
set (${path} ${${path}}/python)
endmacro ()
macro (get_relative_path_from_module_name path name)
string (REPLACE "." "/" ${path} ${name})
endmacro ()
macro (add_copy_target_exe_to_sandbox_command target)
get_target_property (target_path ${target} LOCATION)
get_sandbox_bin_path (bin_path)
add_custom_command (TARGET ${target} POST_BUILD
COMMAND mkdir -p ${bin_path}
COMMAND cp ${target_path} ${bin_path}
)
endmacro ()
macro (add_copy_target_lib_to_sandbox_command target)
get_target_property (target_path ${target} LOCATION)
get_sandbox_lib_path (lib_path)
add_custom_command (TARGET ${target} POST_BUILD
COMMAND mkdir -p ${lib_path}
COMMAND cp ${target_path} ${lib_path}
)
endmacro ()
macro (add_copy_target_to_sandbox_py_module_command target module_name)
get_target_property (target_path ${target} LOCATION)
get_sandbox_py_path (py_path)
get_relative_path_from_module_name (relative_module_path ${module_name})
set (module_path "${py_path}/${relative_module_path}")
add_custom_command (TARGET ${target} POST_BUILD
COMMAND mkdir -p ${module_path}
COMMAND cp ${target_path} ${module_path}
)
endmacro ()
macro (add_copy_py_file_to_sandbox_py_module_command py_src module_name)
get_sandbox_py_path (py_path)
get_relative_path_from_module_name (relative_module_path ${module_name})
set (module_path "${py_path}/${relative_module_path}")
add_custom_command (TARGET appleseed.python.copy_py_files POST_BUILD
COMMAND mkdir -p ${module_path}
COMMAND cp ${py_src} ${module_path}
)
endmacro ()
macro (add_copy_dir_to_sandbox_py_module_command py_dir module_name)
get_sandbox_py_path (py_path)
get_relative_path_from_module_name (relative_module_path ${module_name})
set (module_path "${py_path}/${relative_module_path}")
add_custom_command (TARGET appleseed.python.copy_py_files POST_BUILD
COMMAND mkdir -p ${module_path}
COMMAND cp -r ${py_dir} ${module_path}
)
endmacro ()
macro (add_copy_studio_py_file_to_sandbox_py_module_command py_src module_name)
get_sandbox_py_path (py_path)
get_relative_path_from_module_name (relative_module_path ${module_name})
set (module_path "${py_path}/${relative_module_path}")
add_custom_command (TARGET appleseed.studio.copy_py_files POST_BUILD
COMMAND mkdir -p ${module_path}
COMMAND cp ${py_src} ${module_path}
)
endmacro ()