vcpkg/ports/openimageio/portfile.cmake
jreichel-nvidia 5db545950d
[openimageio] Separate feature flags for tools and viewer (#34556) (#34699)
* [openimageio] Separate feature flags for tools and viewer (#34556)

Add feature flag "viewer" which controls building the viewer "iv".
Drop feature flag "tools", build tools (excluding the viewer) unconditionally.

* Re-add "tools" flag.
Make "viewer" flag depend on "tools" flag.

* Ensure that Qt does not get picked up by accident if the "viewer" flag is not
selected.
Make hidden dependency of theia on OpenImageIO::iv explicit.

* Fix syntax error in USE_QT option.

* Use ENABLE_IV instead of USE_QT.
Remove explicit setting of -DUSE_QT=OFF.
2023-10-27 18:54:58 -07:00

107 lines
3.2 KiB
CMake

vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO AcademySoftwareFoundation/OpenImageIO
REF "v${VERSION}"
SHA512 6b87c805907a2f7c98f40e987fb6ebf769f8519f5d8a8b7393bed62a41cee1118bb32d2bc4d23fd464973e237077d08771ff85f72073caa57799d71bd098038f
HEAD_REF master
PATCHES
fix-dependencies.patch
fix-static-ffmpeg.patch
fix-openexr-dll.patch
imath-version-guard.patch
fix-openimageio_include_dir.patch
fix-openexr-target-missing.patch
)
file(REMOVE_RECURSE "${SOURCE_PATH}/ext")
file(REMOVE
"${SOURCE_PATH}/src/cmake/modules/FindFFmpeg.cmake"
"${SOURCE_PATH}/src/cmake/modules/FindLibheif.cmake"
"${SOURCE_PATH}/src/cmake/modules/FindLibRaw.cmake"
"${SOURCE_PATH}/src/cmake/modules/FindLibsquish.cmake"
"${SOURCE_PATH}/src/cmake/modules/FindOpenCV.cmake"
"${SOURCE_PATH}/src/cmake/modules/FindOpenJPEG.cmake"
"${SOURCE_PATH}/src/cmake/modules/FindWebP.cmake"
"${SOURCE_PATH}/src/cmake/modules/Findfmt.cmake"
"${SOURCE_PATH}/src/cmake/modules/FindTBB.cmake"
)
vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
FEATURES
libraw USE_LIBRAW
opencolorio USE_OPENCOLORIO
ffmpeg USE_FFMPEG
freetype USE_FREETYPE
gif USE_GIF
opencv USE_OPENCV
openjpeg USE_OPENJPEG
webp USE_WEBP
libheif USE_LIBHEIF
pybind11 USE_PYTHON
tools OIIO_BUILD_TOOLS
viewer ENABLE_IV
)
vcpkg_cmake_configure(
SOURCE_PATH "${SOURCE_PATH}"
OPTIONS
${FEATURE_OPTIONS}
-DBUILD_TESTING=OFF
-DOIIO_BUILD_TESTS=OFF
-DUSE_DCMTK=OFF
-DUSE_NUKE=OFF
-DUSE_OpenVDB=OFF
-DUSE_PTEX=OFF
-DUSE_TBB=OFF
-DLINKSTATIC=OFF # LINKSTATIC breaks library lookup
-DBUILD_MISSING_FMT=OFF
-DBUILD_MISSING_ROBINMAP=OFF
-DBUILD_MISSING_DEPS=OFF
-DSTOP_ON_WARNING=OFF
-DVERBOSE=ON
-DBUILD_DOCS=OFF
-DINSTALL_DOCS=OFF
-DENABLE_INSTALL_testtex=OFF
"-DFMT_INCLUDES=${CURRENT_INSTALLED_DIR}/include"
"-DREQUIRED_DEPS=fmt;JPEG;PNG;Robinmap"
MAYBE_UNUSED_VARIABLES
ENABLE_INSTALL_testtex
)
vcpkg_cmake_install()
vcpkg_cmake_config_fixup(CONFIG_PATH lib/cmake/OpenImageIO)
if("tools" IN_LIST FEATURES)
vcpkg_copy_tools(
TOOL_NAMES iconvert idiff igrep iinfo maketx oiiotool
AUTO_CLEAN
)
endif()
if("viewer" IN_LIST FEATURES)
vcpkg_copy_tools(
TOOL_NAMES iv
AUTO_CLEAN
)
endif()
# Clean
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/share/doc"
"${CURRENT_PACKAGES_DIR}/debug/include"
"${CURRENT_PACKAGES_DIR}/debug/share")
vcpkg_fixup_pkgconfig()
file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}")
vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE.md")
file(READ "${SOURCE_PATH}/THIRD-PARTY.md" third_party)
string(REGEX REPLACE
"^.*The remainder of this file"
"\n-------------------------------------------------------------------------\n\nThe remainder of this file"
third_party
"${third_party}"
)
file(APPEND "${CURRENT_PACKAGES_DIR}/share/${PORT}/copyright" "${third_party}")