1# Copyright 2020 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# http://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.10) 16 17project(openjpeg-sapi C CXX) 18 19set(CMAKE_CXX_STANDARD 17) 20set(CMAKE_CXX_STANDARD_REQUIRED True) 21 22# To override lib option -- else SAPI won't work 23set(BUILD_SHARED_LIBS OFF CACHE BOOL "Build OpenJPEG shared library and link executables against it." FORCE) 24add_subdirectory(openjpeg) 25 26set(SAPI_ROOT "../.." CACHE PATH "Path to the Sandboxed API source tree") 27set(SAPI_BUILD_EXAMPLES OFF CACHE BOOL "") 28set(SAPI_BUILD_TESTING OFF CACHE BOOL "") 29set(EXECUTABLE_OUTPUT_PATH "" CACHE PATH "" FORCE) 30add_subdirectory("${SAPI_ROOT}" 31 "${CMAKE_BINARY_DIR}/sandboxed-api-build" 32 EXCLUDE_FROM_ALL) 33 34add_sapi_library(openjp2_sapi 35 FUNCTIONS opj_stream_destroy 36 opj_stream_create_default_file_stream 37 opj_create_decompress 38 opj_image_destroy 39 opj_setup_decoder 40 opj_destroy_codec 41 opj_read_header 42 opj_decode 43 opj_set_default_decoder_parameters 44 opj_end_decompress 45 46 INPUTS ${CMAKE_CURRENT_SOURCE_DIR}/openjpeg/src/lib/openjp2/openjpeg.h 47 LIBRARY openjp2 48 LIBRARY_NAME Openjp2 49 NAMESPACE "" 50) 51 52target_include_directories(openjp2_sapi INTERFACE 53 "${PROJECT_BINARY_DIR}" 54) 55 56add_subdirectory(examples) 57