Skip to content

Commit

Permalink
Optional dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
darbyjohnston committed Sep 12, 2024
1 parent 70cb208 commit d99b1f7
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 5 deletions.
22 changes: 20 additions & 2 deletions cmake/SuperBuild/BuildOpenImageIO.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,28 @@ set(OpenImageIO_GIT_TAG "a534a392cd5aa027741f7359d3a7f4799d6b9fcc")
set(OpenImageIO_GIT_REPOSITORY "https://github.com/darbyjohnston/OpenImageIO")
set(OpenImageIO_GIT_TAG "ffmpeg_add_metadata")

set(OpenImageIO_DEPS TIFF PNG libjpeg-turbo OpenEXR OpenColorIO Freetype)
set(OpenImageIO_DEPS)
if(toucan_PNG)
list(APPEND OpenImageIO_DEPS PNG)
endif()
if(toucan_TIFF)
list(APPEND OpenImageIO_DEPS TIFF)
endif()
if(toucan_JPEG)
list(APPEND OpenImageIO_DEPS libjpeg-turbo)
endif()
if(toucan_OpenEXR)
list(APPEND OpenImageIO_DEPS OpenEXR)
endif()
if(toucan_Freetype)
list(APPEND OpenImageIO_DEPS Freetype)
endif()
if(toucan_FFMPEG)
list(APPEND OpenImageIO_DEPS FFmpeg)
endif()
if(toucan_OpenColorIO)
list(APPEND OpenImageIO_DEPS OpenColorIO)
endif()

set(OpenImageIO_ARGS
${toucan_EXTERNAL_PROJECT_ARGS}
Expand All @@ -21,7 +39,7 @@ set(OpenImageIO_ARGS
-DOIIO_INSTALL_FONTS=ON
-DUSE_FREETYPE=ON
-DUSE_PNG=ON
-DUSE_FFMPEG=${toucan_FFMPEG}
-DUSE_FFMPEG=ON
-DUSE_OPENCOLORIO=ON
-DUSE_BZIP2=OFF
-DUSE_DCMTK=OFF
Expand Down
6 changes: 5 additions & 1 deletion lib/toucan/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,11 @@ else()
endif()

add_library(toucan ${HEADERS} ${HEADERS_PRIVATE} ${SOURCE})
target_link_libraries(toucan PUBLIC OTIO::opentimelineio OTIO::opentime OpenImageIO::OpenImageIO MINIZIP::minizip)
set(LIBS PUBLIC OTIO::opentimelineio OTIO::opentime OpenImageIO::OpenImageIO)
if(TARGET MINIZIP::minizip)
list(APPEND LIBS MINIZIP::minizip)
endif()
target_link_libraries(toucan ${LIBS})
set_target_properties(toucan PROPERTIES FOLDER lib)
set_target_properties(toucan PROPERTIES PUBLIC_HEADER "${HEADERS}")

Expand Down
8 changes: 6 additions & 2 deletions plugins/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@ foreach(PLUGIN ColorSpace Draw Filter Generator Transform Transition)
toucan${PLUGIN} MODULE
${PLUGIN}Plugin.h Plugin.h Util.h
${PLUGIN}Plugin.cpp Plugin.cpp Util.cpp)
target_link_libraries(toucan${PLUGIN} PUBLIC OpenImageIO::OpenImageIO MINIZIP::minizip)
set(LIBS OpenImageIO::OpenImageIO)
if(TARGET MINIZIP::minizip)
list(APPEND LIBS MINIZIP::minizip)
endif()
target_link_libraries(toucan${PLUGIN} PUBLIC ${LIBS})
set_target_properties(
toucan${PLUGIN} PROPERTIES
FOLDER plugin
Expand All @@ -13,4 +17,4 @@ foreach(PLUGIN ColorSpace Draw Filter Generator Transform Transition)
ARCHIVE DESTINATION lib
LIBRARY DESTINATION bin
RUNTIME DESTINATION bin)
endforeach()
endforeach()

0 comments on commit d99b1f7

Please sign in to comment.