Commit 2841f3c3 authored by Adrian Johnson's avatar Adrian Johnson Committed by Albert Astals Cid

Cmake support for openjpeg2

With some tweaks from Albert
parent 117af9c6
......@@ -30,7 +30,7 @@ option(BUILD_CPP_TESTS "Whether compile the CPP test programs." ON)
option(ENABLE_SPLASH "Build the Splash graphics backend." ON)
option(ENABLE_UTILS "Compile poppler command line utils." ON)
option(ENABLE_CPP "Compile poppler cpp wrapper." ON)
option(ENABLE_LIBOPENJPEG "Use libopenjpeg for JPX streams." ON)
set(ENABLE_LIBOPENJPEG "auto" CACHE STRING "Use libopenjpeg for JPX streams. Possible values: auto, openjpeg1, openjpeg2. 'auto' prefers openjpeg1 over openjpeg2 if both are available. Unset to not use openjpeg.")
set(ENABLE_CMS "auto" CACHE STRING "Use color management system. Possible values: auto, lcms1, lcms2. 'auto' prefers lcms2 over lcms1 if both are available. Unset to disable color management system.")
option(ENABLE_LIBCURL "Build libcurl based HTTP support." OFF)
option(ENABLE_ZLIB "Build with zlib (not totally safe)." OFF)
......@@ -151,11 +151,26 @@ if(ENABLE_ZLIB)
endif(ZLIB_FOUND)
set(ENABLE_ZLIB ${ZLIB_FOUND})
endif(ENABLE_ZLIB)
if(ENABLE_LIBOPENJPEG)
set(USE_OPENJPEG1 FALSE)
set(USE_OPENJPEG2 FALSE)
if(ENABLE_LIBOPENJPEG STREQUAL "auto")
find_package(LIBOPENJPEG)
set(ENABLE_LIBOPENJPEG ${LIBOPENJPEG_FOUND})
set(HAVE_OPENJPEG_H ON)
endif(ENABLE_LIBOPENJPEG)
set(USE_OPENJPEG1 ${LIBOPENJPEG_FOUND})
set(WITH_OPENJPEG ${LIBOPENJPEG_FOUND})
if(NOT LIBOPENJPEG_FOUND)
find_package(LIBOPENJPEG2)
set(USE_OPENJPEG2 ${LIBOPENJPEG2_FOUND})
set(WITH_OPENJPEG ${LIBOPENJPEG2_FOUND})
endif()
elseif(ENABLE_LIBOPENJPEG STREQUAL "openjpeg1")
find_package(LIBOPENJPEG)
set(USE_OPENJPEG1 ${LIBOPENJPEG_FOUND})
set(WITH_OPENJPEG ${LIBOPENJPEG_FOUND})
elseif(ENABLE_LIBOPENJPEG STREQUAL "openjpeg2")
find_package(LIBOPENJPEG2)
set(USE_OPENJPEG2 ${LIBOPENJPEG2_FOUND})
set(WITH_OPENJPEG ${LIBOPENJPEG2_FOUND})
endif()
if(ENABLE_CMS STREQUAL "auto")
find_package(LCMS2)
set(USE_CMS ${LCMS2_FOUND})
......@@ -225,6 +240,9 @@ endif(TIFF_FOUND)
if(LIBOPENJPEG_FOUND)
include_directories(${LIBOPENJPEG_INCLUDE_DIR})
endif(LIBOPENJPEG_FOUND)
if(LIBOPENJPEG2_FOUND)
include_directories(${LIBOPENJPEG2_INCLUDE_DIRS})
endif()
if(LCMS_FOUND)
include_directories(${LCMS_INCLUDE_DIR})
endif(LCMS_FOUND)
......@@ -409,11 +427,19 @@ if(LIBOPENJPEG_FOUND)
poppler/JPEG2000Stream.cc
)
set(poppler_LIBS ${poppler_LIBS} ${LIBOPENJPEG_LIBRARIES})
else (LIBOPENJPEG_FOUND)
add_definitions(-DUSE_OPENJPEG1)
elseif (LIBOPENJPEG2_FOUND)
set(poppler_SRCS ${poppler_SRCS}
poppler/JPEG2000Stream.cc
)
add_definitions(-DUSE_OPENJPEG2)
MESSAGE(${LIBOPENJPEG2_LIBRARIES})
set(poppler_LIBS ${poppler_LIBS} ${LIBOPENJPEG2_LIBRARIES})
else ()
set(poppler_SRCS ${poppler_SRCS}
poppler/JPXStream.cc
)
endif(LIBOPENJPEG_FOUND)
endif()
if(USE_CMS)
if(LCMS_FOUND)
set(poppler_LIBS ${poppler_LIBS} ${LCMS_LIBRARIES})
......@@ -574,11 +600,15 @@ if(ENABLE_XPDF_HEADERS)
install(FILES
poppler/JPEG2000Stream.h
DESTINATION include/poppler)
else(LIBOPENJPEG_FOUND)
elseif(LIBOPENJPEG2_FOUND)
install(FILES
poppler/JPEG2000Stream.h
DESTINATION include/poppler)
else()
install(FILES
poppler/JPXStream.h
DESTINATION include/poppler)
endif(LIBOPENJPEG_FOUND)
endif()
if(ENABLE_SPLASH)
install(FILES
poppler/SplashOutputDev.h
......@@ -678,7 +708,13 @@ show_end_message_yesno("use libpng" ENABLE_LIBPNG)
show_end_message_yesno("use libtiff" ENABLE_LIBTIFF)
show_end_message_yesno("use zlib" ENABLE_ZLIB)
show_end_message_yesno("use curl" ENABLE_LIBCURL)
show_end_message_yesno("use libopenjpeg" LIBOPENJPEG_FOUND)
show_end_message_yesno("use libopenjpeg" WITH_OPENJPEG)
if(USE_OPENJPEG1)
message(" with openjpeg1")
endif()
if(USE_OPENJPEG2)
message(" with openjpeg2")
endif()
show_end_message_yesno("use cms" USE_CMS)
if(LCMS_FOUND)
message(" with lcms1")
......
# - Try to find the libopenjpeg2 library
# Once done this will define
#
# LIBOPENJPEG2_FOUND - system has libopenjpeg
# LIBOPENJPEG2_INCLUDE_DIRS - the libopenjpeg include directories
# LIBOPENJPEG2_LIBRARIES - Link these to use libopenjpeg
# Copyright (c) 2008, Albert Astals Cid, <aacid@kde.org>
#
# Redistribution and use is allowed according to the terms of the BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
if (LIBOPENJPEG2_LIBRARIES AND LIBOPENJPEG2_INCLUDE_DIR)
# in cache already
set(LIBOPENJPEG2_FOUND TRUE)
else ()
set(LIBOPENJPEG2_FOUND FALSE)
set(LIBOPENJPEG2_INCLUDE_DIRS)
set(LIBOPENJPEG2_LIBRARIES)
find_package(PkgConfig REQUIRED)
pkg_check_modules(LIBOPENJPEG2 libopenjp2)
if (LIBOPENJPEG2_FOUND)
add_definitions(-DUSE_OPENJPEG2)
endif ()
endif ()
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment