d33c03eaa8d115a06ccf56dadd1194eb1fa6dbb6
[blender.git] / build_files / build_environment / cmake / opencolorio.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 set(OPENCOLORIO_EXTRA_ARGS
20         -DBoost_COMPILER:STRING=${BOOST_COMPILER_STRING}
21         -DBoost_USE_MULTITHREADED=ON
22         -DBoost_USE_STATIC_LIBS=ON
23         -DBoost_USE_STATIC_RUNTIME=ON
24         -DBOOST_ROOT=${LIBDIR}/boost
25         -DBOOST_INCLUDEDIR=${LIBDIR}/boost/include/boost_1_60/boost
26         -DBoost_NO_SYSTEM_PATHS=ON
27         -DBoost_DEBUG=ON
28         -DBoost_MAJOR_VERSION=1
29         -DBoost_MINOR_VERSION=60
30         -DOCIO_BUILD_APPS=OFF
31         -DOCIO_BUILD_PYGLUE=OFF
32         -DOCIO_BUILD_NUKE=OFF
33 )
34
35 if(WIN32)
36         set(OPENCOLORIO_EXTRA_ARGS
37                 ${OPENCOLORIO_EXTRA_ARGS}
38                 -DOCIO_USE_BOOST_PTR=ON
39                 -DOCIO_BUILD_STATIC=OFF
40                 -DOCIO_BUILD_SHARED=ON
41         )
42 else()
43         set(OPENCOLORIO_EXTRA_ARGS
44                 ${OPENCOLORIO_EXTRA_ARGS}
45                 -DOCIO_USE_BOOST_PTR=OFF
46                 -DOCIO_BUILD_STATIC=ON
47                 -DOCIO_BUILD_SHARED=OFF
48         )
49 endif()
50
51 ExternalProject_Add(external_opencolorio
52         URL ${OPENCOLORIO_URI}
53         DOWNLOAD_DIR ${DOWNLOAD_DIR}
54         URL_HASH MD5=${OPENCOLORIO_HASH}
55         PREFIX ${BUILD_DIR}/opencolorio
56         PATCH_COMMAND ${PATCH_CMD} -p 0 -N -d ${BUILD_DIR}/opencolorio/src/external_opencolorio < ${PATCH_DIR}/opencolorio.diff
57         CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBDIR}/opencolorio ${DEFAULT_CMAKE_FLAGS} ${OPENCOLORIO_EXTRA_ARGS}
58         INSTALL_DIR ${LIBDIR}/opencolorio
59 )
60
61 if(NOT WIN32)
62         add_custom_command(
63                 OUTPUT ${LIBDIR}/opencolorio/lib/libtinyxml.a
64                 COMMAND cp ${BUILD_DIR}/opencolorio/src/external_opencolorio-build/ext/dist/lib/libtinyxml.a ${LIBDIR}/opencolorio/lib/libtinyxml.a
65                 COMMAND cp ${BUILD_DIR}/opencolorio/src/external_opencolorio-build/ext/dist/lib/libyaml-cpp.a ${LIBDIR}/opencolorio/lib/libyaml-cpp.a
66         )
67         add_custom_target(external_opencolorio_extra ALL DEPENDS external_opencolorio ${LIBDIR}/opencolorio/lib/libtinyxml.a)
68 endif()
69
70 add_dependencies(
71         external_opencolorio
72         external_boost
73 )