Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Link libdeflate for OpenEXR 3.2+ (cmake) #1274

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
31 changes: 31 additions & 0 deletions toonz/sources/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -464,6 +464,21 @@ elseif(BUILD_ENV_APPLE)
find_library(GPHOTO2_PORT_LIB gphoto2_port)
message("**************** gphoto2_port lib:" ${GPHOTO2_PORT_LIB})
endif()

# If compiling with OpenEXR
find_package(OpenEXR)
if((OpenEXR_VERSION VERSION_EQUAL 3.2) OR (OpenEXR_VERSION GREATER 3.2))
# OpenEXR requires libdeflate starting with 3.2.0
# https://openexr.com/en/latest/news.html#august-30-2023-openexr-v3-2-0-released
if(DEFLATE-NOTFOUND)
pkg_check_modules(DEFLATE REQUIRED deflate)
endif()
if (TARGET deflate::deflate)
set(DEFLATE_LIB deflate::deflate)
else()
set(DEFLATE_LIB ${Deflate_LIBRARY})
endif()
endif()
elseif(BUILD_ENV_UNIXLIKE)
if(BUILD_TARGET_WIN)
find_library(GL_LIB opengl32)
Expand Down Expand Up @@ -540,6 +555,22 @@ elseif(BUILD_ENV_UNIXLIKE)
find_library(GPHOTO2_PORT_LIB gphoto2_port)
message("**************** gphoto2_port lib:" ${GPHOTO2_PORT_LIB})
endif()

# If compiling with OpenEXR
find_package(OpenEXR)
if((OpenEXR_VERSION VERSION_EQUAL 3.2) OR (OpenEXR_VERSION GREATER 3.2))
# OpenEXR requires libdeflate starting with 3.2.0
# https://openexr.com/en/latest/news.html#august-30-2023-openexr-v3-2-0-released
if(DEFLATE-NOTFOUND)
pkg_check_modules(DEFLATE REQUIRED deflate)
endif()
if (TARGET deflate::deflate)
set(DEFLATE_LIB deflate::deflate)
else()
# use custom Find module if there is one?
set(DEFLATE_LIB ${Deflate_LIBRARY})
endif()
endif()
endif()


Expand Down
8 changes: 8 additions & 0 deletions toonz/sources/toonz/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -524,6 +524,10 @@ elseif(BUILD_ENV_APPLE)
set(EXTRA_LIBS ${EXTRA_LIBS} ${GPHOTO2_LIB} ${GPHOTO2_PORT_LIB})
endif()

if(DEFLATE)
set(EXTRA_LIBS ${EXTRA_LIBS} ${DEFLATE_LIB})
endif()

add_dependencies(Tahoma2D tnzcore tnzbase toonzlib colorfx tnzext image sound toonzqt tnztools tnzstdfx tfarm)

target_link_libraries(Tahoma2D
Expand All @@ -549,6 +553,10 @@ elseif(BUILD_ENV_UNIXLIKE)
set(EXTRA_LIBS ${EXTRA_LIBS} Qt5::WinMain -lstrmiids -mwindows)
endif()

if(DEFLATE)
set(EXTRA_LIBS ${EXTRA_LIBS} ${DEFLATE_LIB})
endif()

target_link_libraries(
Tahoma2D Qt5::Core Qt5::Gui Qt5::Network Qt5::OpenGL Qt5::Svg Qt5::Xml
Qt5::Script Qt5::Widgets Qt5::PrintSupport Qt5::Multimedia Qt5::SerialPort Qt5::UiTools
Expand Down