Make libraw support build optional

Build in by default if libraw is found, but make it optional for builds
were it's not needed, like smtk2ssrf or subsurface-downloader.

Signed-off-by: Salvador Cuñat <salvador.cunat@gmail.com>
This commit is contained in:
Salvador Cuñat 2024-09-24 06:45:58 +02:00 committed by Michael Keller
parent 821f3fc551
commit f81cf77886
3 changed files with 11 additions and 6 deletions

View file

@ -52,6 +52,7 @@ option(NO_USERMANUAL "don't include a viewer for the user manual" OFF)
#Options regarding enabling parts of subsurface
option(BTSUPPORT "enable support for QtBluetooth" ON)
option(FTDISUPPORT "enable support for libftdi based serial" OFF)
option(LIBRAW_SUPPORT "enable support for LibRaw images" ON)
# Options regarding What should we build on subsurface
option(MAKE_TESTS "Make the tests" ON)
@ -169,10 +170,6 @@ if(NOT ANDROID)
pkg_config_library(LIBRAW libraw )
endif()
if(LIBRAW_FOUND)
add_definitions(-DLIBRAW_SUPPORT)
endif()
include_directories(.
${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_BINARY_DIR}
@ -300,6 +297,7 @@ elseif (SUBSURFACE_TARGET_EXECUTABLE MATCHES "DownloaderExecutable")
set(SUBSURFACE_TARGET subsurface-downloader)
endif()
set(BTSUPPORT ON)
set(LIBRAW_SUPPORT OFF)
add_definitions(-DSUBSURFACE_DOWNLOADER)
message(STATUS "building the embedded Subsurface-downloader app")
endif()
@ -363,6 +361,14 @@ if(BTSUPPORT)
add_definitions(-DBLE_SUPPORT)
endif()
if (LIBRAW_SUPPORT)
if(LIBRAW_FOUND)
add_definitions(-DLIBRAW_SUPPORT)
endif()
else()
message(STATUS "building without built-in libraw support")
endif()
if(ANDROID)
# when building for Android, the toolchain file requires all cmake modules
# to be inside the CMAKE_FIND_ROOT_PATH - which prevents cmake from finding

View file

@ -148,6 +148,7 @@ cmake -DBTSUPPORT=OFF \
-DNO_DOCS=ON \
-DNO_PRINTING=ON \
-DNO_USERMANUAL=ON \
-DLIBRAW_SUPPORT=OFF \
-DSUBSURFACE_TARGET_EXECUTABLE=DesktopExecutable \
build
cd build || aborting "Couldn't cd into $SSRF_PATH/build directory"

View file

@ -34,8 +34,6 @@ pkg_config_library(GLIB2 glib-2.0 REQUIRED)
pkg_config_library(LIBGIT2 libgit2 REQUIRED)
pkg_config_library(LIBMDB libmdb REQUIRED)
pkg_config_library(LIBDC libdivecomputer REQUIRED)
pkg_config_library(LIBFTDI libftdi1 QUIET)
pkg_config_library(LIBRAW libraw)
find_package(Qt5 REQUIRED COMPONENTS Core
Concurrent