macOS: add support for OpenMP, making smoke/fluid/cloth simulations faster.
[blender.git] / build_files / build_environment / cmake / harvest.cmake
1 # ***** BEGIN GPL LICENSE BLOCK *****
2 #
3 # This program is free software; you can redistribute it and/or
4 # modify it under the terms of the GNU General Public License
5 # as published by the Free Software Foundation; either version 2
6 # of the License, or (at your option) any later version.
7 #
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11 # GNU General Public License for more details.
12 #
13 # You should have received a copy of the GNU General Public License
14 # along with this program; if not, write to the Free Software Foundation,
15 # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
16 #
17 # ***** END GPL LICENSE BLOCK *****
18
19 ########################################################################
20 # Copy all generated files to the proper strucure as blender prefers
21 ########################################################################
22
23 if(NOT DEFINED HARVEST_TARGET)
24         set(HARVEST_TARGET ${CMAKE_CURRENT_SOURCE_DIR}/Harvest)
25 endif()
26 message("HARVEST_TARGET = ${HARVEST_TARGET}")
27
28 if(WIN32)
29 if(BUILD_MODE STREQUAL Release)
30         add_custom_target(Harvest_Release_Results
31                 COMMAND # jpeg rename libfile + copy include
32                                 ${CMAKE_COMMAND} -E copy ${LIBDIR}/jpg/lib/jpeg-static.lib ${HARVEST_TARGET}/jpeg/lib/libjpeg.lib &&
33                                 ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/jpg/include/ ${HARVEST_TARGET}/jpeg/include/ &&
34                                 # OpenImageIO
35                                 ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/OpenImageIO/include ${HARVEST_TARGET}/OpenImageIO/include &&
36                                 ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/OpenImageIO/lib ${HARVEST_TARGET}/OpenImageIO/lib &&
37                                 ${CMAKE_COMMAND} -E copy ${LIBDIR}/OpenImageIO/bin/idiff.exe ${HARVEST_TARGET}/OpenImageIO/bin/idiff.exe &&
38                                 # png
39                                 ${CMAKE_COMMAND} -E copy ${LIBDIR}/png/lib/libpng16_static.lib ${HARVEST_TARGET}/png/lib/libpng.lib &&
40                                 ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/png/include/ ${HARVEST_TARGET}/png/include/ &&
41                                 # freeglut-> opengl
42                                 ${CMAKE_COMMAND} -E copy ${LIBDIR}/freeglut/lib/freeglut_static.lib ${HARVEST_TARGET}/opengl/lib/freeglut_static.lib &&
43                                 ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/freeglut/include/ ${HARVEST_TARGET}/opengl/include/ &&
44                                 # glew-> opengl
45                                 ${CMAKE_COMMAND} -E copy ${LIBDIR}/glew/lib/libglew32.lib ${HARVEST_TARGET}/opengl/lib/glew.lib &&
46                                 ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/glew/include/ ${HARVEST_TARGET}/opengl/include/ &&
47                                 # sndfile
48                                 ${CMAKE_COMMAND} -E copy ${LIBDIR}/sndfile/lib/libsndfile.dll.a ${HARVEST_TARGET}/sndfile/lib/libsndfile-1.lib &&
49                                 ${CMAKE_COMMAND} -E copy ${LIBDIR}/sndfile/bin/libsndfile-1.dll ${HARVEST_TARGET}/sndfile/lib/libsndfile-1.dll &&
50                                 ${CMAKE_COMMAND} -E copy ${LIBDIR}/sndfile/include/sndfile.h ${HARVEST_TARGET}/sndfile/include/sndfile.h &&
51                                 # tiff
52                                 ${CMAKE_COMMAND} -E copy ${LIBDIR}/tiff/lib/tiff.lib ${HARVEST_TARGET}/tiff/lib/libtiff.lib &&
53                                 ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/tiff/include/ ${HARVEST_TARGET}/tiff/include/ &&
54                                 # BlendThumb
55                                 ${CMAKE_COMMAND} -E copy ${LIBDIR}/BlendThumb64/bin/blendthumb.dll ${HARVEST_TARGET}/ThumbHandler/lib/BlendThumb64.dll &&
56                                 ${CMAKE_COMMAND} -E copy ${LIBDIR}/BlendThumb32/bin/blendthumb.dll ${HARVEST_TARGET}/ThumbHandler/lib/BlendThumb.dll &&
57                                 # hidapi
58                                 ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/hidapi/ ${HARVEST_TARGET}/hidapi/ &&
59                                 # webp, straight up copy
60                                 ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/webp ${HARVEST_TARGET}/webp &&
61                 DEPENDS
62         )
63 endif()
64
65 if(BUILD_MODE STREQUAL Debug)
66         add_custom_target(Harvest_Debug_Results
67                                 # OpenImageIO
68                 COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/openimageio/lib/OpenImageIO.lib ${HARVEST_TARGET}/openimageio/lib/OpenImageIO_d.lib &&
69                                 ${CMAKE_COMMAND} -E copy ${LIBDIR}/openimageio/lib/OpenImageIO_Util.lib ${HARVEST_TARGET}/openimageio/lib/OpenImageIO_Util_d.lib &&
70                                 # python
71                                 ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/python/ ${HARVEST_TARGET}/python/ &&
72                                 # hdf5
73                                 ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/hdf5/lib ${HARVEST_TARGET}/hdf5/lib &&
74                                 # numpy
75                                 ${CMAKE_COMMAND} -E copy ${LIBDIR}/python${PYTHON_SHORT_VERSION_NO_DOTS}_numpy_${NUMPY_SHORT_VERSION}d.tar.gz ${HARVEST_TARGET}/Release/python${PYTHON_SHORT_VERSION_NO_DOTS}_numpy_${NUMPY_SHORT_VERSION}d.tar.gz &&
76                                 # python
77                                 ${CMAKE_COMMAND} -E copy ${LIBDIR}/python${PYTHON_SHORT_VERSION_NO_DOTS}_d.tar.gz ${HARVEST_TARGET}/Release/python${PYTHON_SHORT_VERSION_NO_DOTS}_d.tar.gz
78                 DEPENDS Package_Python
79         )
80 endif()
81
82 else(WIN32)
83
84 function(harvest from to)
85         set(pattern "")
86         foreach(f ${ARGN})
87                 set(pattern ${f})
88         endforeach()
89
90         if(pattern STREQUAL "")
91                 get_filename_component(dirpath ${to} DIRECTORY)
92                 get_filename_component(filename ${to} NAME)
93                 install(
94                         FILES ${LIBDIR}/${from}
95                         DESTINATION ${HARVEST_TARGET}/${dirpath}
96                         RENAME ${filename})
97         else()
98                 install(
99                         DIRECTORY ${LIBDIR}/${from}/
100                         DESTINATION ${HARVEST_TARGET}/${to}
101                         USE_SOURCE_PERMISSIONS
102                         FILES_MATCHING PATTERN ${pattern}
103                         PATTERN "pkgconfig" EXCLUDE
104                         PATTERN "cmake" EXCLUDE
105                         PATTERN "__pycache__" EXCLUDE
106                         PATTERN "tests" EXCLUDE)
107         endif()
108 endfunction()
109
110 harvest(alembic/include alembic/include "*.h")
111 harvest(alembic/lib/libAlembic.a alembic/lib/libAlembic.a)
112 harvest(alembic/bin alembic/bin "*")
113 harvest(boost/include boost/include "*")
114 harvest(boost/lib boost/lib "*.a")
115 harvest(ffmpeg/include ffmpeg/include "*.h")
116 harvest(ffmpeg/lib ffmpeg/lib "*.a")
117 harvest(fftw3/include fftw3/include "*.h")
118 harvest(fftw3/lib fftw3/lib "*.a")
119 harvest(flac/lib sndfile/lib "libFLAC.a")
120 harvest(freetype/include freetype/include "*.h")
121 harvest(freetype/lib/libfreetype2ST.a freetype/lib/libfreetype.a)
122 harvest(glew/include glew/include "*.h")
123 harvest(glew/lib glew/lib "*.a")
124 harvest(ilmbase openexr "*")
125 harvest(ilmbase/include openexr/include "*.h")
126 harvest(jemalloc/include jemalloc/include "*.h")
127 harvest(jemalloc/lib jemalloc/lib "*.a")
128 harvest(jpg/include jpeg/include "*.h")
129 harvest(jpg/lib jpeg/lib "libjpeg.a")
130 harvest(lame/lib ffmpeg/lib "*.a")
131 harvest(clang/bin llvm/bin "clang-format")
132 harvest(llvm/bin llvm/bin "llvm-config")
133 harvest(llvm/lib llvm/lib "libLLVM*.a")
134 if(APPLE)
135         harvest(openmp/lib openmp/lib "*")
136         harvest(openmp/include openmp/include "*.h")
137 endif()
138 harvest(ogg/lib ffmpeg/lib "*.a")
139 harvest(openal/include openal/include "*.h")
140 if(UNIX AND NOT APPLE)
141         harvest(openal/lib openal/lib "*.a")
142
143         harvest(blosc/include blosc/include "*.h")
144         harvest(blosc/lib blosc/lib "*.a")
145
146         harvest(zlib/include zlib/include "*.h")
147         harvest(zlib/lib zlib/lib "*.a")
148
149         harvest(xml2/include xml2/include "*.h")
150         harvest(xml2/lib xml2/lib "*.a")
151 else()
152         harvest(blosc/lib openvdb/lib "*.a")
153         harvest(xml2/lib opencollada/lib "*.a")
154 endif()
155 harvest(opencollada/include/opencollada opencollada/include "*.h")
156 harvest(opencollada/lib/opencollada opencollada/lib "*.a")
157 harvest(opencolorio/include opencolorio/include "*.h")
158 harvest(opencolorio/lib opencolorio/lib "*.a")
159 harvest(opencolorio/lib/static opencolorio/lib "*.a")
160 harvest(openexr/include openexr/include "*.h")
161 harvest(openexr/lib openexr/lib "*.a")
162 harvest(openimageio/bin openimageio/bin "idiff")
163 harvest(openimageio/bin openimageio/bin "maketx")
164 harvest(openimageio/bin openimageio/bin "oiiotool")
165 harvest(openimageio/include openimageio/include "*")
166 harvest(openimageio/lib openimageio/lib "*.a")
167 harvest(openjpeg/include/openjpeg-2.3 openjpeg/include "*.h")
168 harvest(openjpeg/lib openjpeg/lib "*.a")
169 harvest(opensubdiv/include opensubdiv/include "*.h")
170 harvest(opensubdiv/lib opensubdiv/lib "*.a")
171 harvest(openvdb/include/openvdb openvdb/include/openvdb "*.h")
172 harvest(openvdb/lib openvdb/lib "*.a")
173 harvest(osl/bin osl/bin "oslc")
174 harvest(osl/include osl/include "*.h")
175 harvest(osl/lib osl/lib "*.a")
176 harvest(osl/shaders osl/shaders "*.h")
177 harvest(png/include png/include "*.h")
178 harvest(png/lib png/lib "*.a")
179 harvest(python/bin python/bin "python${PYTHON_SHORT_VERSION}m")
180 harvest(python/include python/include "*h")
181 harvest(python/lib python/lib "*")
182 harvest(sdl/include/SDL2 sdl/include "*.h")
183 harvest(sdl/lib sdl/lib "libSDL2.a")
184 harvest(sndfile/include sndfile/include "*.h")
185 harvest(sndfile/lib sndfile/lib "*.a")
186 harvest(spnav/include spnav/include "*.h")
187 harvest(spnav/lib spnav/lib "*.a")
188 harvest(tbb/include tbb/include "*.h")
189 harvest(tbb/lib/libtbb_static.a tbb/lib/libtbb.a)
190 harvest(theora/lib ffmpeg/lib "*.a")
191 harvest(tiff/include tiff/include "*.h")
192 harvest(tiff/lib tiff/lib "*.a")
193 harvest(vorbis/lib ffmpeg/lib "*.a")
194 harvest(vpx/lib ffmpeg/lib "*.a")
195 harvest(webp/lib ffmpeg/lib "*.a")
196 harvest(x264/lib ffmpeg/lib "*.a")
197 harvest(xvidcore/lib ffmpeg/lib "*.a")
198 harvest(embree/include embree/include "*.h")
199 harvest(embree/lib embree/lib "*.a")
200
201 endif()