Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ builtin_jpeg=ON
builtin_lz4=ON
builtin_lzma=ON
builtin_png=ON
builtin_tiff=ON
builtin_vdt=ON
builtin_zlib=ON
builtin_zstd=ON
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ builtin_nlohmannjson=ON
builtin_openssl=ON
builtin_pcre=ON
builtin_tbb=ON
builtin_tiff=ON
builtin_unuran=ON
builtin_vdt=ON
builtin_xrootd=ON
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/root-ci-config/buildconfig/mac14.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ builtin_nlohmannjson=ON
builtin_openssl=ON
builtin_pcre=ON
builtin_tbb=ON
builtin_tiff=ON
builtin_unuran=ON
builtin_vdt=ON
builtin_xrootd=ON
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/root-ci-config/buildconfig/mac15.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ builtin_nlohmannjson=ON
builtin_openssl=ON
builtin_pcre=ON
builtin_tbb=ON
builtin_tiff=ON
builtin_unuran=ON
builtin_vdt=ON
builtin_xrootd=ON
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/root-ci-config/buildconfig/mac26.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ builtin_nlohmannjson=ON
builtin_openssl=ON
builtin_pcre=ON
builtin_tbb=ON
builtin_tiff=ON
builtin_unuran=ON
builtin_vdt=ON
builtin_xrootd=ON
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ builtin_nlohmannjson=ON
builtin_pcre=ON
builtin_png=ON
builtin_tbb=ON
builtin_tiff=ON
builtin_unuran=ON
builtin_xxhash=ON
builtin_zlib=ON
Expand Down
3 changes: 0 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -409,9 +409,6 @@ else()
if(asimage)
message(SEND_ERROR "minimal=ON is not compatible with asimage=ON. Consider setting instead gminimal=ON")
endif()
if(asimage_tiff)
message(SEND_ERROR "minimal=ON is not compatible with asimage_tiff=ON. Consider setting instead gminimal=ON")
endif()
if(x11)
message(SEND_ERROR "minimal=ON is not compatible with x11=ON. Consider setting instead gminimal=ON")
endif()
Expand Down
2 changes: 1 addition & 1 deletion builtins/libjpeg/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ add_dependencies(JPEG::JPEG BUILTIN_LIBJPEG)

# Set the canonical output of find_package according to
# https://cmake.org/cmake/help/latest/manual/cmake-developer.7.html#standard-variable-names
set(JPEG_INCLUDE_DIRS ${${ROOT_LIBJPEG_PREFIX}/include} PARENT_SCOPE)
set(JPEG_INCLUDE_DIRS ${ROOT_LIBJPEG_PREFIX}/include PARENT_SCOPE)
set(JPEG_LIBRARIES ${ROOT_LIBJPEG_LIBRARY} PARENT_SCOPE)
set(JPEG_FOUND TRUE PARENT_SCOPE)
set(JPEG_VERSION ${ROOT_LIBJPEG_VERSION} PARENT_SCOPE)
120 changes: 120 additions & 0 deletions builtins/libtiff/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
# Copyright (C) 1995-2026, Rene Brun and Fons Rademakers.
# All rights reserved.
#
# For the licensing terms see $ROOTSYS/LICENSE.
# For the list of contributors see $ROOTSYS/README/CREDITS.

# **PLEASE UPDATE ALSO THE FOLLOWING LINE WHEN UPDATING THE VERSION**
# 18 Sep 2024, https://github.com/libsdl-org/libtiff/releases/tag/v4.7.0
set(ROOT_LIBTIFF_VERSION 4.7.0)
set(ROOT_LIBTIFF_HASH "67160e3457365ab96c5b3286a0903aa6e78bdc44c4bc737d2e486bcecb6ba976")

set(ROOT_LIBTIFF_PREFIX ${CMAKE_BINARY_DIR}/builtins/LIBTIFF-prefix)
if(MSVC)
if(winrtdebug)
set(LIBTIFF_POSTFIX d)
endif()
if(NOT CMAKE_GENERATOR MATCHES Ninja)
if(winrtdebug)
set(ROOT_LIBTIFF_BUILD_COMMAND_FLAGS "--config Debug")
else()
set(ROOT_LIBTIFF_BUILD_COMMAND_FLAGS "--config $<IF:$<CONFIG:Debug,RelWithDebInfo>,RelWithDebInfo,Release>")
endif()
endif()
set(ROOT_LIBTIFF_LIBRARY ${ROOT_LIBTIFF_PREFIX}/lib/tiff${LIBTIFF_POSTFIX}${CMAKE_STATIC_LIBRARY_SUFFIX})
else()
set(ROOT_LIBTIFF_LIBRARY ${ROOT_LIBTIFF_PREFIX}/lib/${CMAKE_STATIC_LIBRARY_PREFIX}tiff${CMAKE_STATIC_LIBRARY_SUFFIX})
endif()

# If zlib is not builtin, the string will be empty, nothing special to be
# done: we rely on libtiff CMake to find zlib.
# If zlib is builtin, we need to direct the builtin libtiff to it.
if(builtin_zlib)
set(ZLIB_ROOT_OPTION "-DZLIB_ROOT=${ROOT_ZLIB_PREFIX}")
endif()
if(builtin_zstd)
set(ZSTD_ROOT_OPTION "-DZSTD_ROOT=${ROOT_ZSTD_PREFIX}")
endif()
if(builtin_lzma)
set(LZMA_ROOT_OPTION "-DLIBLZMA_ROOT=${ROOT_LZMA_PREFIX}")
endif()
if(builtin_jpeg)
set(JPEG_ROOT_OPTION "-DJPEG_ROOT=${ROOT_LIBJPEG_PREFIX}")
endif()

ExternalProject_Add(
BUILTIN_LIBTIFF
PREFIX ${ROOT_LIBTIFF_PREFIX}
URL ${lcgpackages}/tiff-${ROOT_LIBTIFF_VERSION}.tar.gz
URL_HASH SHA256=${ROOT_LIBTIFF_HASH}
CMAKE_ARGS -G ${CMAKE_GENERATOR}
-DCMAKE_POLICY_VERSION_MINIMUM=3.5
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
-DCMAKE_INSTALL_PREFIX=<INSTALL_DIR>
-DCMAKE_INSTALL_LIBDIR=<INSTALL_DIR>/lib
-DCMAKE_INSTALL_BINDIR=<INSTALL_DIR>/lib
-DCMAKE_POSITION_INDEPENDENT_CODE=ON
-DCMAKE_CXX_VISIBILITY_PRESET=hidden
-DCMAKE_C_VISIBILITY_PRESET=hidden
-DBUILD_SHARED_LIBS=OFF
-Dtiff-contrib=OFF
-Dtiff-docs=OFF
-Dtiff-opengl=OFF # if ON, link below to GL and dependency to builtin
-Dtiff-tests=OFF
-Dtiff-tools=OFF
-Dcxx=OFF # We do not need library tiffxx.a (C++ stream API library)
-Djpeg=ON
-Dlerc=OFF
Comment thread
ferdymercury marked this conversation as resolved.
Comment thread
ferdymercury marked this conversation as resolved.
-Dlibdeflate=OFF # if ON or unset, then you need to target link libs interface below
-Dpixarlog=OFF
-Dwebp=OFF
-DZLIB_LIBRARY=${ZLIB_LIBRARIES}
-DZLIB_INCLUDE_DIR=${ZLIB_INCLUDE_DIRS}
${ZLIB_ROOT_OPTION}
-DZSTD_LIBRARY=${ZSTD_LIBRARIES}
-DZSTD_INCLUDE_DIR=${ZSTD_INCLUDE_DIRS}
${ZSTD_ROOT_OPTION}
-DLIBLZMA_LIBRARY=${LZMA_LIBRARIES}
-DLIBLZMA_INCLUDE_DIR=${LZMA_INCLUDE_DIRS}
${LZMA_ROOT_OPTION}
-DJPEG_LIBRARY=${JPEG_LIBRARIES}
-DJPEG_INCLUDE_DIR=${JPEG_INCLUDE_DIRS}
${JPEG_ROOT_OPTION}
BUILD_COMMAND ${CMAKE_COMMAND} --build . ${ROOT_LIBTIFF_BUILD_COMMAND_FLAGS}
INSTALL_COMMAND ${CMAKE_COMMAND} --build . ${ROOT_LIBTIFF_BUILD_COMMAND_FLAGS} --target install
LOG_CONFIGURE 1 LOG_BUILD 1 LOG_INSTALL 1 LOG_OUTPUT_ON_FAILURE 1
BUILD_BYPRODUCTS ${ROOT_LIBTIFF_LIBRARY}
TIMEOUT 600
)

file(MAKE_DIRECTORY ${ROOT_LIBTIFF_PREFIX}/include)
add_library(TIFF::TIFF IMPORTED STATIC GLOBAL)
set_target_properties(TIFF::TIFF PROPERTIES
IMPORTED_LOCATION ${ROOT_LIBTIFF_LIBRARY}
INTERFACE_INCLUDE_DIRECTORIES ${ROOT_LIBTIFF_PREFIX}/include
)
add_dependencies(TIFF::TIFF BUILTIN_LIBTIFF)

if(builtin_zlib)
add_dependencies(BUILTIN_LIBTIFF BUILTIN_ZLIB)
endif()
target_link_libraries(TIFF::TIFF INTERFACE ZLIB::ZLIB)
if(builtin_zstd)
add_dependencies(BUILTIN_LIBTIFF BUILTIN_ZSTD)
endif()
target_link_libraries(TIFF::TIFF INTERFACE ZSTD::ZSTD)
if(builtin_lzma)
add_dependencies(BUILTIN_LIBTIFF BUILTIN_LZMA)
endif()
target_link_libraries(TIFF::TIFF INTERFACE LibLZMA::LibLZMA)
if(builtin_jpeg)
add_dependencies(BUILTIN_LIBTIFF BUILTIN_LIBJPEG)
endif()
target_link_libraries(TIFF::TIFF INTERFACE JPEG::JPEG)

# Set the canonical output of find_package according to
# https://cmake.org/cmake/help/latest/manual/cmake-developer.7.html#standard-variable-names
set(TIFF_INCLUDE_DIRS ${ROOT_LIBTIFF_PREFIX}/include PARENT_SCOPE)
set(TIFF_LIBRARIES ${ROOT_LIBTIFF_LIBRARY} PARENT_SCOPE)
set(TIFF_FOUND TRUE PARENT_SCOPE)
set(TIFF_VERSION ${ROOT_LIBTIFF_VERSION} PARENT_SCOPE)
4 changes: 2 additions & 2 deletions cmake/modules/RootBuildOptions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ endfunction()

ROOT_BUILD_OPTION(arrow OFF "Enable support for Apache Arrow")
ROOT_BUILD_OPTION(asimage ON "Enable support for image processing via libAfterImage")
ROOT_BUILD_OPTION(asimage_tiff ON "Support TIFF in image processing (requires libtiff)")
ROOT_BUILD_OPTION(asserts OFF "Enable asserts (defaults to ON for CMAKE_BUILD_TYPE=Debug and/or dev=ON)")
ROOT_BUILD_OPTION(builtin_cfitsio OFF "Build CFITSIO internally (requires network)")
ROOT_BUILD_OPTION(builtin_clang ON "Build bundled copy of Clang")
Expand All @@ -104,6 +103,7 @@ ROOT_BUILD_OPTION(builtin_openui5 ON "Use openui5 bundle distributed with ROOT")
ROOT_BUILD_OPTION(builtin_pcre OFF "Build bundled copy of PCRE")
ROOT_BUILD_OPTION(builtin_png OFF "Build bundled copy of libpng")
ROOT_BUILD_OPTION(builtin_tbb OFF "Build TBB internally (requires network)")
ROOT_BUILD_OPTION(builtin_tiff OFF "Build libtiff internally (requires network)")
ROOT_BUILD_OPTION(builtin_unuran OFF "Build bundled copy of unuran [GPL]")
ROOT_BUILD_OPTION(builtin_vdt OFF "Build VDT internally (requires network)")
ROOT_BUILD_OPTION(builtin_xrootd OFF "Build XRootD internally (requires network)")
Expand Down Expand Up @@ -206,7 +206,6 @@ endif()
if(all)
set(arrow_defvalue ON)
set(asimage_defvalue ON)
set(asimage_tiff_defvalue ON)
set(cefweb_defvalue ON)
set(clad_defvalue ON)
set(curl_defvalue ON)
Expand Down Expand Up @@ -276,6 +275,7 @@ if(builtin_all)
set(builtin_pcre_defvalue ON)
set(builtin_png_defvalue ON)
set(builtin_tbb_defvalue ON)
set(builtin_tiff_defvalue ON)
# set(builtin_unuran_defvalue ON) (GPL)
set(builtin_vdt_defvalue ON)
set(builtin_xrootd_defvalue ON)
Expand Down
20 changes: 8 additions & 12 deletions cmake/modules/SearchInstalledSoftware.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -112,11 +112,12 @@ endforeach()
if(asimage)
ROOT_FIND_REQUIRED_DEP(GIF builtin_gif)
ROOT_FIND_REQUIRED_DEP(JPEG builtin_jpeg)
# We cannot PNG here because while searching PNG, CMake will also find ZLIB.
# We cannot PNG/TIFF here because while searching, CMake will also find ZLIB.
# If found, CMake will define the default variables and target:
# see https://cmake.org/cmake/help/latest/module/FindZLIB.html).
# For this reason, the check has to be put below, after ZLIB is searched for.
#ROOT_FIND_REQUIRED_DEP(PNG builtin_png)
#ROOT_FIND_REQUIRED_DEP(TIFF builtin_tiff)
endif()
ROOT_FIND_REQUIRED_DEP(LZ4 builtin_lz4)
ROOT_FIND_REQUIRED_DEP(LibLZMA builtin_lzma)
Expand Down Expand Up @@ -175,6 +176,7 @@ if(asimage)
# This check can be added only now because of the reasons explained above, where all
# other required dependencies are checked.
ROOT_FIND_REQUIRED_DEP(PNG builtin_png)
ROOT_FIND_REQUIRED_DEP(TIFF builtin_tiff)
endif()

#---Check for nlohmann/json.hpp---------------------------------------------------------
Expand Down Expand Up @@ -383,18 +385,12 @@ if(asimage)
endif()
list(APPEND ASEXTRA_LIBRARIES JPEG::JPEG)

if(asimage_tiff)
find_Package(TIFF)
if(TIFF_FOUND)
list(APPEND ASEXTRA_LIBRARIES TIFF::TIFF)
else()
if(fail-on-missing)
message(SEND_ERROR "libtiff required but not found. Please make sure it's installed on the system, or disable TIFF support with '-Dasimage_tiff=OFF', or set '-Dfail-on-missing=OFF' to automatically disable features")
else()
set(asimage_tiff OFF CACHE BOOL "Disabled because libtiff was not found" FORCE)
endif()
endif()
if(builtin_tiff)
add_subdirectory(builtins/libtiff)
get_target_property(TIFF_INCLUDE_DIR TIFF::TIFF INTERFACE_INCLUDE_DIRECTORIES)
get_target_property(TIFF_LIBRARY_LOCATION TIFF::TIFF IMPORTED_LOCATION)
endif()
list(APPEND ASEXTRA_LIBRARIES TIFF::TIFF)
endif()

#---Check for GSL library---------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion roottest/root/graf/simpleImages.C
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ int simpleImages()
TH1D h("myHisto", "The Title;the X;the Y", 64, -4, 4);
h.FillRandom("gaus");
h.Draw();
std::vector<std::string> fileNames{"f.jpeg", "f.png", "f.gif", "f.bmp"}; // TIFF not always there: only ON if asimage_tiff and libtiff installed in system (it's not a builtin like jpeg, png, gif)
std::vector<std::string> fileNames{"f.jpeg", "f.png", "f.gif", "f.bmp", "f.tiff"};
ImagesRAII iraii(fileNames);
for (auto &&fileName : fileNames) {
c.SaveAs(fileName.c_str());
Expand Down
1 change: 1 addition & 0 deletions roottest/root/graf/simpleImages.ref
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ Info in <TCanvas::Print>: jpg file f.jpeg has been created
Info in <TCanvas::Print>: png file f.png has been created
Info in <TCanvas::Print>: gif file f.gif has been created
Info in <TCanvas::Print>: bmp file f.bmp has been created
Info in <TCanvas::Print>: tiff file f.tiff has been created
(int) 0
Loading