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 #Options regarding enabling parts of subsurface
option(BTSUPPORT "enable support for QtBluetooth" ON) option(BTSUPPORT "enable support for QtBluetooth" ON)
option(FTDISUPPORT "enable support for libftdi based serial" OFF) 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 # Options regarding What should we build on subsurface
option(MAKE_TESTS "Make the tests" ON) option(MAKE_TESTS "Make the tests" ON)
@ -169,10 +170,6 @@ if(NOT ANDROID)
pkg_config_library(LIBRAW libraw ) pkg_config_library(LIBRAW libraw )
endif() endif()
if(LIBRAW_FOUND)
add_definitions(-DLIBRAW_SUPPORT)
endif()
include_directories(. include_directories(.
${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_BINARY_DIR} ${CMAKE_BINARY_DIR}
@ -300,6 +297,7 @@ elseif (SUBSURFACE_TARGET_EXECUTABLE MATCHES "DownloaderExecutable")
set(SUBSURFACE_TARGET subsurface-downloader) set(SUBSURFACE_TARGET subsurface-downloader)
endif() endif()
set(BTSUPPORT ON) set(BTSUPPORT ON)
set(LIBRAW_SUPPORT OFF)
add_definitions(-DSUBSURFACE_DOWNLOADER) add_definitions(-DSUBSURFACE_DOWNLOADER)
message(STATUS "building the embedded Subsurface-downloader app") message(STATUS "building the embedded Subsurface-downloader app")
endif() endif()
@ -363,6 +361,14 @@ if(BTSUPPORT)
add_definitions(-DBLE_SUPPORT) add_definitions(-DBLE_SUPPORT)
endif() endif()
if (LIBRAW_SUPPORT)
if(LIBRAW_FOUND)
add_definitions(-DLIBRAW_SUPPORT)
endif()
else()
message(STATUS "building without built-in libraw support")
endif()
if(ANDROID) if(ANDROID)
# when building for Android, the toolchain file requires all cmake modules # when building for Android, the toolchain file requires all cmake modules
# to be inside the CMAKE_FIND_ROOT_PATH - which prevents cmake from finding # 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_DOCS=ON \
-DNO_PRINTING=ON \ -DNO_PRINTING=ON \
-DNO_USERMANUAL=ON \ -DNO_USERMANUAL=ON \
-DLIBRAW_SUPPORT=OFF \
-DSUBSURFACE_TARGET_EXECUTABLE=DesktopExecutable \ -DSUBSURFACE_TARGET_EXECUTABLE=DesktopExecutable \
build build
cd build || aborting "Couldn't cd into $SSRF_PATH/build directory" 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(LIBGIT2 libgit2 REQUIRED)
pkg_config_library(LIBMDB libmdb REQUIRED) pkg_config_library(LIBMDB libmdb REQUIRED)
pkg_config_library(LIBDC libdivecomputer REQUIRED) pkg_config_library(LIBDC libdivecomputer REQUIRED)
pkg_config_library(LIBFTDI libftdi1 QUIET)
pkg_config_library(LIBRAW libraw)
find_package(Qt5 REQUIRED COMPONENTS Core find_package(Qt5 REQUIRED COMPONENTS Core
Concurrent Concurrent