2023-08-15 16:20:26 +02:00
|
|
|
# SPDX-FileCopyrightText: 2017-2023 Blender Authors
|
2023-06-14 14:49:59 +02:00
|
|
|
#
|
2022-02-10 23:07:11 +01:00
|
|
|
# SPDX-License-Identifier: GPL-2.0-or-later
|
2017-07-25 16:37:55 +02:00
|
|
|
|
|
|
|
if(BUILD_MODE STREQUAL Release)
|
|
|
|
set(OIIO_TOOLS ON)
|
|
|
|
else()
|
|
|
|
set(OIIO_TOOLS OFF)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(UNIX AND NOT APPLE)
|
|
|
|
# This causes linking to static pthread libraries which gives link errors.
|
|
|
|
# Since we manually specify library paths it should static link other libs.
|
|
|
|
set(OPENIMAGEIO_LINKSTATIC -DLINKSTATIC=OFF)
|
|
|
|
else()
|
|
|
|
set(OPENIMAGEIO_LINKSTATIC -DLINKSTATIC=ON)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(WIN32)
|
2024-03-06 15:45:51 +01:00
|
|
|
if(BLENDER_PLATFORM_ARM)
|
|
|
|
set(OIIO_SIMD_FLAGS -DUSE_SIMD=0)
|
|
|
|
else()
|
|
|
|
set(OIIO_SIMD_FLAGS -DUSE_SIMD=sse2)
|
|
|
|
endif()
|
2017-09-22 21:57:21 +02:00
|
|
|
set(OPENJPEG_POSTFIX _msvc)
|
2022-07-27 04:59:44 +02:00
|
|
|
if(BUILD_MODE STREQUAL Debug)
|
|
|
|
set(TIFF_POSTFIX d)
|
2022-12-05 23:18:54 +01:00
|
|
|
set(PNG_POSTFIX d)
|
2022-07-27 04:59:44 +02:00
|
|
|
else()
|
|
|
|
set(TIFF_POSTFIX)
|
2022-12-05 23:18:54 +01:00
|
|
|
set(PNG_POSTFIX)
|
2022-07-27 04:59:44 +02:00
|
|
|
endif()
|
2022-12-05 23:18:54 +01:00
|
|
|
set(PNG_LIBNAME libpng16_static${PNG_POSTFIX}${LIBEXT})
|
2017-07-25 16:37:55 +02:00
|
|
|
else()
|
|
|
|
set(PNG_LIBNAME libpng${LIBEXT})
|
|
|
|
set(OIIO_SIMD_FLAGS)
|
2022-07-27 04:59:44 +02:00
|
|
|
set(TIFF_POSTFIX)
|
2017-07-25 16:37:55 +02:00
|
|
|
endif()
|
|
|
|
|
2017-11-05 04:50:15 +01:00
|
|
|
if(MSVC)
|
|
|
|
set(OPENJPEG_FLAGS
|
2022-04-19 18:08:51 +02:00
|
|
|
-DOpenJPEG_ROOT=${LIBDIR}/openjpeg_msvc
|
2017-11-05 04:50:15 +01:00
|
|
|
)
|
2017-09-22 21:57:21 +02:00
|
|
|
else()
|
2017-11-05 04:50:15 +01:00
|
|
|
set(OPENJPEG_FLAGS
|
2022-04-19 18:08:51 +02:00
|
|
|
-DOpenJPEG_ROOT=${LIBDIR}/openjpeg
|
2017-09-22 21:57:21 +02:00
|
|
|
)
|
|
|
|
endif()
|
|
|
|
|
2017-07-25 16:37:55 +02:00
|
|
|
set(OPENIMAGEIO_EXTRA_ARGS
|
2022-12-05 23:18:54 +01:00
|
|
|
-DBUILD_SHARED_LIBS=ON
|
2017-07-25 16:37:55 +02:00
|
|
|
${OPENIMAGEIO_LINKSTATIC}
|
2022-04-19 18:08:51 +02:00
|
|
|
${DEFAULT_BOOST_FLAGS}
|
2023-09-22 16:32:26 +02:00
|
|
|
-DREQUIRED_DEPS=WebP$<SEMICOLON>JPEGTurbo$<SEMICOLON>TIFF$<SEMICOLON>OpenEXR$<SEMICOLON>PNG$<SEMICOLON>OpenJPEG$<SEMICOLON>fmt$<SEMICOLON>Robinmap$<SEMICOLON>ZLIB$<SEMICOLON>pugixml$<SEMICOLON>Python
|
2020-05-31 21:15:40 +02:00
|
|
|
-DUSE_LIBSQUISH=OFF
|
|
|
|
-DUSE_QT5=OFF
|
|
|
|
-DUSE_NUKE=OFF
|
|
|
|
-DUSE_OPENVDB=OFF
|
|
|
|
-DUSE_BZIP2=OFF
|
|
|
|
-DUSE_FREETYPE=OFF
|
|
|
|
-DUSE_DCMTK=OFF
|
|
|
|
-DUSE_LIBHEIF=OFF
|
2017-07-25 16:37:55 +02:00
|
|
|
-DUSE_OPENGL=OFF
|
2023-05-10 16:20:16 +02:00
|
|
|
-DUSE_TBB=ON
|
2017-07-25 16:37:55 +02:00
|
|
|
-DUSE_QT=OFF
|
2022-12-05 23:18:54 +01:00
|
|
|
-DUSE_PYTHON=ON
|
2017-07-25 16:37:55 +02:00
|
|
|
-DUSE_GIF=OFF
|
|
|
|
-DUSE_OPENCV=OFF
|
2017-09-21 21:09:52 +02:00
|
|
|
-DUSE_OPENJPEG=ON
|
2017-07-25 16:37:55 +02:00
|
|
|
-DUSE_FFMPEG=OFF
|
|
|
|
-DUSE_PTEX=OFF
|
|
|
|
-DUSE_FREETYPE=OFF
|
|
|
|
-DUSE_LIBRAW=OFF
|
2020-05-31 21:15:40 +02:00
|
|
|
-DUSE_OPENCOLORIO=OFF
|
2022-04-19 18:08:51 +02:00
|
|
|
-DUSE_WEBP=ON
|
2017-07-25 16:37:55 +02:00
|
|
|
-DOIIO_BUILD_TOOLS=${OIIO_TOOLS}
|
|
|
|
-DOIIO_BUILD_TESTS=OFF
|
|
|
|
-DBUILD_TESTING=OFF
|
|
|
|
-DZLIB_LIBRARY=${LIBDIR}/zlib/lib/${ZLIB_LIBRARY}
|
|
|
|
-DZLIB_INCLUDE_DIR=${LIBDIR}/zlib/include
|
|
|
|
-DPNG_LIBRARY=${LIBDIR}/png/lib/${PNG_LIBNAME}
|
|
|
|
-DPNG_PNG_INCLUDE_DIR=${LIBDIR}/png/include
|
2022-07-27 04:59:44 +02:00
|
|
|
-DTIFF_LIBRARY=${LIBDIR}/tiff/lib/${LIBPREFIX}tiff${TIFF_POSTFIX}${LIBEXT}
|
2017-07-25 16:37:55 +02:00
|
|
|
-DTIFF_INCLUDE_DIR=${LIBDIR}/tiff/include
|
2022-04-19 18:08:51 +02:00
|
|
|
-DJPEG_LIBRARY=${LIBDIR}/jpeg/lib/${JPEG_LIBRARY}
|
|
|
|
-DJPEG_INCLUDE_DIR=${LIBDIR}/jpeg/include
|
2017-09-22 21:57:21 +02:00
|
|
|
${OPENJPEG_FLAGS}
|
2022-12-05 23:18:54 +01:00
|
|
|
-DOPENEXR_ILMTHREAD_LIBRARY=${LIBDIR}/openexr/lib/${LIBPREFIX}IlmThread${OPENEXR_VERSION_POSTFIX}${SHAREDLIBEXT}
|
|
|
|
-DOPENEXR_IEX_LIBRARY=${LIBDIR}/openexr/lib/${LIBPREFIX}Iex${OPENEXR_VERSION_POSTFIX}${SHAREDLIBEXT}
|
|
|
|
-DOPENEXR_ILMIMF_LIBRARY=${LIBDIR}/openexr/lib/${LIBPREFIX}IlmImf${OPENEXR_VERSION_POSTFIX}${SHAREDLIBEXT}
|
2017-07-25 16:37:55 +02:00
|
|
|
-DSTOP_ON_WARNING=OFF
|
2020-11-29 22:01:33 +01:00
|
|
|
-DUSE_EXTERNAL_PUGIXML=ON
|
|
|
|
-DPUGIXML_LIBRARY=${LIBDIR}/pugixml/lib/${LIBPREFIX}pugixml${LIBEXT}
|
|
|
|
-DPUGIXML_INCLUDE_DIR=${LIBDIR}/pugixml/include/
|
2022-12-05 23:18:54 +01:00
|
|
|
-Dpugixml_DIR=${LIBDIR}/pugixml/lib/cmake/pugixml
|
2022-04-19 18:08:51 +02:00
|
|
|
-DBUILD_MISSING_ROBINMAP=OFF
|
|
|
|
-DBUILD_MISSING_FMT=OFF
|
|
|
|
-DFMT_INCLUDE_DIR=${LIBDIR}/fmt/include/
|
|
|
|
-DRobinmap_ROOT=${LIBDIR}/robinmap
|
|
|
|
-DWebP_ROOT=${LIBDIR}/webp
|
2017-07-25 16:37:55 +02:00
|
|
|
${OIIO_SIMD_FLAGS}
|
2022-04-19 18:08:51 +02:00
|
|
|
-DOpenEXR_ROOT=${LIBDIR}/openexr
|
|
|
|
-DImath_ROOT=${LIBDIR}/imath
|
2022-12-05 23:18:54 +01:00
|
|
|
-Dpybind11_ROOT=${LIBDIR}/pybind11
|
|
|
|
-DPython_EXECUTABLE=${PYTHON_BINARY}
|
2023-05-10 16:20:16 +02:00
|
|
|
-DTBB_ROOT=${LIBDIR}/tbb
|
2017-07-25 16:37:55 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
ExternalProject_Add(external_openimageio
|
2021-03-16 14:10:30 +01:00
|
|
|
URL file://${PACKAGE_DIR}/${OPENIMAGEIO_FILE}
|
2017-07-25 16:37:55 +02:00
|
|
|
DOWNLOAD_DIR ${DOWNLOAD_DIR}
|
2021-03-16 14:10:30 +01:00
|
|
|
URL_HASH ${OPENIMAGEIO_HASH_TYPE}=${OPENIMAGEIO_HASH}
|
2022-12-05 23:18:54 +01:00
|
|
|
CMAKE_GENERATOR ${PLATFORM_ALT_GENERATOR}
|
2017-07-25 16:37:55 +02:00
|
|
|
PREFIX ${BUILD_DIR}/openimageio
|
2024-02-10 12:35:36 +01:00
|
|
|
|
|
|
|
PATCH_COMMAND
|
|
|
|
${PATCH_CMD} -p 1 -N -d
|
|
|
|
${BUILD_DIR}/openimageio/src/external_openimageio/ <
|
|
|
|
${PATCH_DIR}/openimageio.diff &&
|
|
|
|
${PATCH_CMD} -p 1 -N -d
|
|
|
|
${BUILD_DIR}/openimageio/src/external_openimageio/ <
|
|
|
|
${PATCH_DIR}/oiio_webp.diff &&
|
|
|
|
${PATCH_CMD} -p 1 -N -d
|
|
|
|
${BUILD_DIR}/openimageio/src/external_openimageio/ <
|
|
|
|
${PATCH_DIR}/oiio_4044.diff &&
|
|
|
|
${PATCH_CMD} -p 1 -N -d
|
|
|
|
${BUILD_DIR}/openimageio/src/external_openimageio/ <
|
|
|
|
${PATCH_DIR}/oiio_4062.diff
|
|
|
|
|
|
|
|
CMAKE_ARGS
|
|
|
|
-DCMAKE_INSTALL_PREFIX=${LIBDIR}/openimageio
|
|
|
|
${DEFAULT_CMAKE_FLAGS}
|
|
|
|
${OPENIMAGEIO_EXTRA_ARGS}
|
|
|
|
|
2017-07-25 16:37:55 +02:00
|
|
|
INSTALL_DIR ${LIBDIR}/openimageio
|
|
|
|
)
|
|
|
|
|
2017-11-05 04:50:15 +01:00
|
|
|
add_dependencies(
|
|
|
|
external_openimageio
|
2020-05-31 21:15:40 +02:00
|
|
|
external_png
|
|
|
|
external_zlib
|
2017-11-05 04:50:15 +01:00
|
|
|
external_openexr
|
2022-04-19 18:08:51 +02:00
|
|
|
external_imath
|
2017-11-05 04:50:15 +01:00
|
|
|
external_jpeg
|
|
|
|
external_boost
|
|
|
|
external_tiff
|
2020-11-29 22:01:33 +01:00
|
|
|
external_pugixml
|
2022-04-19 18:08:51 +02:00
|
|
|
external_fmt
|
|
|
|
external_robinmap
|
2017-11-05 04:50:15 +01:00
|
|
|
external_openjpeg${OPENJPEG_POSTFIX}
|
2022-04-19 18:08:51 +02:00
|
|
|
external_webp
|
2022-12-05 23:18:54 +01:00
|
|
|
external_python
|
|
|
|
external_pybind11
|
2023-05-10 16:20:16 +02:00
|
|
|
external_tbb
|
2017-11-05 04:50:15 +01:00
|
|
|
)
|
2020-05-31 21:15:40 +02:00
|
|
|
|
|
|
|
if(WIN32)
|
|
|
|
if(BUILD_MODE STREQUAL Release)
|
|
|
|
ExternalProject_Add_Step(external_openimageio after_install
|
2024-02-10 12:35:36 +01:00
|
|
|
COMMAND ${CMAKE_COMMAND} -E copy_directory
|
|
|
|
${LIBDIR}/OpenImageIO/include
|
|
|
|
${HARVEST_TARGET}/OpenImageIO/include
|
|
|
|
COMMAND ${CMAKE_COMMAND} -E copy_directory
|
|
|
|
${LIBDIR}/OpenImageIO/lib
|
|
|
|
${HARVEST_TARGET}/OpenImageIO/lib
|
|
|
|
COMMAND ${CMAKE_COMMAND} -E copy
|
|
|
|
${LIBDIR}/OpenImageIO/bin/iconvert.exe
|
|
|
|
${HARVEST_TARGET}/OpenImageIO/bin/iconvert.exe
|
|
|
|
COMMAND ${CMAKE_COMMAND} -E copy
|
|
|
|
${LIBDIR}/OpenImageIO/bin/idiff.exe
|
|
|
|
${HARVEST_TARGET}/OpenImageIO/bin/idiff.exe
|
|
|
|
COMMAND ${CMAKE_COMMAND} -E copy
|
|
|
|
${LIBDIR}/OpenImageIO/bin/igrep.exe
|
|
|
|
${HARVEST_TARGET}/OpenImageIO/bin/igrep.exe
|
|
|
|
COMMAND ${CMAKE_COMMAND} -E copy
|
|
|
|
${LIBDIR}/OpenImageIO/bin/iinfo.exe
|
|
|
|
${HARVEST_TARGET}/OpenImageIO/bin/iinfo.exe
|
|
|
|
COMMAND ${CMAKE_COMMAND} -E copy
|
|
|
|
${LIBDIR}/OpenImageIO/bin/maketx.exe
|
|
|
|
${HARVEST_TARGET}/OpenImageIO/bin/maketx.exe
|
|
|
|
COMMAND ${CMAKE_COMMAND} -E copy
|
|
|
|
${LIBDIR}/OpenImageIO/bin/oiiotool.exe
|
|
|
|
${HARVEST_TARGET}/OpenImageIO/bin/oiiotool.exe
|
|
|
|
COMMAND ${CMAKE_COMMAND} -E copy
|
|
|
|
${LIBDIR}/OpenImageIO/bin/OpenImageIO.dll
|
|
|
|
${HARVEST_TARGET}/OpenImageIO/bin/OpenImageIO.dll
|
|
|
|
COMMAND ${CMAKE_COMMAND} -E copy
|
|
|
|
${LIBDIR}/OpenImageIO/bin/OpenImageIO_Util.dll
|
|
|
|
${HARVEST_TARGET}/OpenImageIO/bin/OpenImageIO_Util.dll
|
|
|
|
|
2020-05-31 21:15:40 +02:00
|
|
|
DEPENDEES install
|
|
|
|
)
|
|
|
|
endif()
|
|
|
|
if(BUILD_MODE STREQUAL Debug)
|
|
|
|
ExternalProject_Add_Step(external_openimageio after_install
|
2024-02-10 12:35:36 +01:00
|
|
|
COMMAND ${CMAKE_COMMAND} -E copy
|
|
|
|
${LIBDIR}/openimageio/lib/OpenImageIO_d.lib
|
|
|
|
${HARVEST_TARGET}/openimageio/lib/OpenImageIO_d.lib
|
|
|
|
COMMAND ${CMAKE_COMMAND} -E copy
|
|
|
|
${LIBDIR}/openimageio/lib/OpenImageIO_Util_d.lib
|
|
|
|
${HARVEST_TARGET}/openimageio/lib/OpenImageIO_Util_d.lib
|
|
|
|
COMMAND ${CMAKE_COMMAND} -E copy
|
|
|
|
${LIBDIR}/OpenImageIO/bin/OpenImageIO_d.dll
|
|
|
|
${HARVEST_TARGET}/OpenImageIO/bin/OpenImageIO_d.dll
|
|
|
|
COMMAND ${CMAKE_COMMAND} -E copy
|
|
|
|
${LIBDIR}/OpenImageIO/bin/OpenImageIO_Util_d.dll
|
|
|
|
${HARVEST_TARGET}/OpenImageIO/bin/OpenImageIO_Util_d.dll
|
|
|
|
COMMAND ${CMAKE_COMMAND} -E copy_directory
|
|
|
|
${LIBDIR}/OpenImageIO/lib/python${PYTHON_SHORT_VERSION}/
|
|
|
|
${HARVEST_TARGET}/OpenImageIO/lib/python${PYTHON_SHORT_VERSION}_debug/
|
|
|
|
|
2020-05-31 21:15:40 +02:00
|
|
|
DEPENDEES install
|
|
|
|
)
|
|
|
|
endif()
|
2017-07-25 16:37:55 +02:00
|
|
|
endif()
|