Build Environment: fix alembic, openvdb, ffmpeg, osl build on Linux.
[blender.git] / build_files / build_environment / cmake / alembic.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 if(ALEMBIC_HDF5)
20         set(ALEMBIC_HDF5_HL)
21         # in debug mode we do not build HDF5_hdf5_hl_LIBRARY which makes cmake really
22         # unhappy, stub it with the debug mode lib. it's not linking it in at this
23         # point in time anyhow
24         if(BUILD_MODE STREQUAL Debug)
25                 set(ALEMBIC_HDF5_HL -DHDF5_hdf5_hl_LIBRARY=${LIBDIR}/hdf5/lib/libhdf5_hl_D.${LIBEXT})
26         endif()
27 endif()
28
29 set(ALEMBIC_EXTRA_ARGS
30         -DBUILDSTATIC=ON
31         -DLINKSTATIC=ON
32         -DALEMBIC_LIB_USES_BOOST=ON
33         -DBoost_COMPILER:STRING=${BOOST_COMPILER_STRING}
34         -DBoost_USE_MULTITHREADED=ON
35         -DUSE_STATIC_BOOST=On
36         -DBoost_USE_STATIC_LIBS=ON
37         -DBoost_USE_STATIC_RUNTIME=ON
38         -DBoost_DEBUG=ON
39         -DBOOST_ROOT=${LIBDIR}/boost
40         -DBoost_NO_SYSTEM_PATHS=ON
41         -DILMBASE_ROOT=${LIBDIR}/ilmbase
42         -DALEMBIC_ILMBASE_INCLUDE_DIRECTORY=${LIBDIR}/ilmbase/include/OpenEXR
43         -DALEMBIC_ILMBASE_HALF_LIB=${LIBDIR}/ilmbase/lib/${LIBPREFIX}Half${ILMBASE_VERSION_POSTFIX}${LIBEXT}
44         -DALEMBIC_ILMBASE_IMATH_LIB=${LIBDIR}/ilmbase/lib/${LIBPREFIX}Imath${ILMBASE_VERSION_POSTFIX}${LIBEXT}
45         -DALEMBIC_ILMBASE_ILMTHREAD_LIB=${LIBDIR}/ilmbase/lib/${LIBPREFIX}IlmThread${ILMBASE_VERSION_POSTFIX}${LIBEXT}
46         -DALEMBIC_ILMBASE_IEX_LIB=${LIBDIR}/ilmbase/lib/${LIBPREFIX}Iex${ILMBASE_VERSION_POSTFIX}${LIBEXT}
47         -DALEMBIC_ILMBASE_IEXMATH_LIB=${LIBDIR}/ilmbase/lib/${LIBPREFIX}IexMath${ILMBASE_VERSION_POSTFIX}${LIBEXT}
48         -DUSE_PYILMBASE=0
49         -DUSE_PYALEMBIC=0
50         -DUSE_ARNOLD=0
51         -DUSE_MAYA=0
52         -DUSE_PRMAN=0
53         -DUSE_HDF5=Off
54         -DUSE_STATIC_HDF5=Off
55         -DHDF5_ROOT=${LIBDIR}/hdf5
56         -DUSE_TESTS=Off
57         -DALEMBIC_NO_OPENGL=1
58         -DUSE_BINARIES=ON
59         -DALEMBIC_ILMBASE_LINK_STATIC=On
60         -DALEMBIC_SHARED_LIBS=OFF
61         -DGLUT_INCLUDE_DIR=""
62         -DZLIB_LIBRARY=${LIBDIR}/zlib/lib/${ZLIB_LIBRARY}
63         -DZLIB_INCLUDE_DIR=${LIBDIR}/zlib/include/
64         ${ALEMBIC_HDF5_HL}
65 )
66
67 ExternalProject_Add(external_alembic
68         URL ${ALEMBIC_URI}
69         DOWNLOAD_DIR ${DOWNLOAD_DIR}
70         URL_HASH MD5=${ALEMBIC_MD5}
71         PREFIX ${BUILD_DIR}/alembic
72         CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBDIR}/alembic -Wno-dev ${DEFAULT_CMAKE_FLAGS} ${ALEMBIC_EXTRA_ARGS}
73         INSTALL_DIR ${LIBDIR}/alembic
74 )
75
76 if(WIN32)
77         if(BUILD_MODE STREQUAL Release)
78                 ExternalProject_Add_Step(external_alembic after_install
79                         COMMAND ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/alembic ${HARVEST_TARGET}/alembic
80                         DEPENDEES install
81                 )
82         endif()
83         if(BUILD_MODE STREQUAL Debug)
84                 ExternalProject_Add_Step(external_alembic after_install
85                         COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/alembic/lib/alembic.lib ${HARVEST_TARGET}/alembic/lib/alembic_d.lib
86                         DEPENDEES install
87                 )
88         endif()
89 endif()
90
91
92
93 add_dependencies(
94         external_alembic
95         external_boost
96         external_zlib
97         external_ilmbase
98         external_openexr
99 )