sandboxed-api/oss-internship-2020/gdal/CMakeLists.txt

87 lines
2.2 KiB
CMake
Raw Normal View History

2020-09-24 02:35:19 +08:00
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
2020-09-24 02:35:19 +08:00
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
2020-09-23 23:49:44 +08:00
2020-09-24 18:12:30 +08:00
cmake_minimum_required(VERSION 3.10)
2020-09-23 23:39:49 +08:00
project(test CXX C)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED True)
2020-09-24 02:35:19 +08:00
find_package(PNG REQUIRED)
find_package(PkgConfig REQUIRED)
pkg_check_modules(libpcre REQUIRED IMPORTED_TARGET libpcre)
2020-09-24 17:40:30 +08:00
pkg_check_modules(proj REQUIRED IMPORTED_TARGET proj)
2020-09-24 02:35:19 +08:00
2020-09-23 23:39:49 +08:00
set(SAPI_ROOT "${PROJECT_SOURCE_DIR}/../.." CACHE PATH "Path to the Sandboxed API source tree")
# cmake .. -G Ninja -DSAPI_ROOT=$HOME/sapi_root
set(SAPI_BUILD_EXAMPLES OFF CACHE BOOL "")
set(SAPI_BUILD_TESTING OFF CACHE BOOL "")
2020-09-23 23:39:49 +08:00
add_subdirectory("${SAPI_ROOT}"
"${CMAKE_BINARY_DIR}/sandboxed-api-build"
# Omit this to have the full Sandboxed API in IDE
EXCLUDE_FROM_ALL)
add_library(libgdal STATIC IMPORTED)
set_property(TARGET libgdal PROPERTY IMPORTED_LOCATION "${CMAKE_CURRENT_SOURCE_DIR}/lib/libgdal.a")
2020-09-23 23:39:49 +08:00
target_link_libraries(libgdal INTERFACE
crypto
expat
jpeg
2020-09-24 02:35:19 +08:00
PkgConfig::libpcre
2020-09-24 17:40:30 +08:00
PkgConfig::proj
sqlite3
tiff
z
pthread
m
rt
dl
curl
PNG::PNG
)
2020-09-23 23:39:49 +08:00
add_sapi_library(gdal_sapi
FUNCTIONS GDALOpen
GDALAllRegister
GDALGetDatasetDriver
GDALGetDriverShortName
GDALGetDriverLongName
GDALGetGeoTransform
GDALGetRasterBand
GDALGetBlockSize
GDALGetRasterBandXSize
GDALGetRasterBandYSize
GDALRasterIO
2020-09-24 18:12:30 +08:00
INPUTS "/usr/include/gdal/gdal.h"
2020-09-23 23:49:44 +08:00
LIBRARY libgdal
2020-09-24 02:35:19 +08:00
LIBRARY_NAME GDAL
2020-09-23 23:49:44 +08:00
NAMESPACE ""
2020-09-23 23:39:49 +08:00
)
target_include_directories(gdal_sapi INTERFACE
2020-09-23 23:49:44 +08:00
"${PROJECT_BINARY_DIR}"
2020-09-23 23:39:49 +08:00
)
add_executable(raster
2020-09-23 23:49:44 +08:00
raster.cc
2020-09-23 23:39:49 +08:00
)
target_link_libraries(raster
2020-09-23 23:49:44 +08:00
gdal_sapi
sapi::sapi
2020-09-23 23:39:49 +08:00
)