1# Copyright 2022 Google LLC 2# 3# Licensed under the Apache License, Version 2.0 (the "License"); 4# you may not use this file except in compliance with the License. 5# You may obtain a copy of the License at 6# 7# https://www.apache.org/licenses/LICENSE-2.0 8# 9# Unless required by applicable law or agreed to in writing, software 10# distributed under the License is distributed on an "AS IS" BASIS, 11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12# See the License for the specific language governing permissions and 13# limitations under the License. 14 15cmake_minimum_required(VERSION 3.13..3.26) 16 17project(sapi_libraw CXX) 18include(CTest) 19include(GoogleTest) 20 21set(CMAKE_CXX_STANDARD 17) 22set(CMAKE_CXX_STANDARD_REQUIRED True) 23 24if (NOT TARGET sapi::sapi) 25 set(SAPI_ROOT "../.." CACHE PATH "Path to the Sandboxed API source tree") 26 add_subdirectory("${SAPI_ROOT}" 27 "${CMAKE_BINARY_DIR}/sandboxed-api-build" 28 EXCLUDE_FROM_ALL) 29endif() 30 31FetchContent_Declare(libraw 32 GIT_REPOSITORY https://github.com/LibRaw/LibRaw.git 33 GIT_TAG a077aac05190530f22af4254a1e31745876d007f # 2022-06-03 34) 35FetchContent_MakeAvailable(libraw) 36 37set(LIBRAW_PATH "${libraw_SOURCE_DIR}" CACHE STRING "" FORCE) 38set(BUILD_SHARED_LIBS OFF CACHE BOOL "" FORCE) 39FetchContent_Declare(libraw_cmake 40 GIT_REPOSITORY https://github.com/LibRaw/LibRaw-cmake.git 41 GIT_TAG b82a1b0101b1e7264eb3113f1e6c1ba2372ebb7f # 2021-11-18 42) 43FetchContent_MakeAvailable(libraw_cmake) 44 45configure_file(raw.gen.h.in raw.gen.h) 46 47add_sapi_library(sapi_libraw 48 FUNCTIONS libraw_init 49 libraw_open_file 50 libraw_unpack 51 libraw_close 52 53 libraw_subtract_black 54 55 libraw_cameraList 56 libraw_cameraCount 57 58 libraw_COLOR 59 libraw_get_raw_height 60 libraw_get_raw_width 61 62 INPUTS "${CMAKE_BINARY_DIR}/raw.gen.h" 63 64 LIBRARY raw 65 LIBRARY_NAME LibRaw 66 NAMESPACE "" 67) 68add_library(sapi_contrib::libraw ALIAS sapi_libraw) 69target_include_directories(sapi_libraw INTERFACE 70 "${PROJECT_BINARY_DIR}" 71) 72 73if(SAPI_BUILD_EXAMPLES) 74 add_subdirectory(example) 75endif() 76 77if(BUILD_TESTING AND SAPI_BUILD_TESTING) 78 add_subdirectory(test) 79endif() 80