2022-02-10 05:13:09 +08:00
|
|
|
# Copyright 2022 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
|
|
|
|
#
|
|
|
|
# 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.
|
|
|
|
|
|
|
|
cmake_minimum_required(VERSION 3.13..3.22)
|
2022-04-21 16:14:48 +08:00
|
|
|
|
2022-02-10 05:13:09 +08:00
|
|
|
project(woff2-sapi CXX C)
|
2022-04-21 16:14:48 +08:00
|
|
|
include(CTest)
|
2022-02-10 05:13:09 +08:00
|
|
|
|
|
|
|
set(CMAKE_CXX_STANDARD 17)
|
|
|
|
set(CMAKE_CXX_STANDARD_REQUIRED True)
|
|
|
|
|
|
|
|
if(NOT TARGET sapi::sapi)
|
|
|
|
set(SAPI_ROOT "../.." CACHE PATH "Path to the Sandboxed API source tree")
|
|
|
|
add_subdirectory("${SAPI_ROOT}"
|
|
|
|
"${CMAKE_BINARY_DIR}/sandboxed-api-build"
|
|
|
|
# Omit this to have the full Sandboxed API in IDE
|
|
|
|
EXCLUDE_FROM_ALL)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
find_package(PkgConfig REQUIRED)
|
|
|
|
pkg_check_modules(WOFF2_ENC REQUIRED IMPORTED_TARGET GLOBAL libwoff2enc)
|
|
|
|
pkg_check_modules(WOFF2_DEC REQUIRED IMPORTED_TARGET GLOBAL libwoff2dec)
|
|
|
|
pkg_check_modules(WOFF2_COMMON REQUIRED IMPORTED_TARGET GLOBAL libwoff2common)
|
|
|
|
|
|
|
|
add_library(woff2_sapi_wrapper woff2_wrapper.cc woff2_wrapper.h)
|
|
|
|
target_link_libraries(woff2_sapi_wrapper
|
|
|
|
PRIVATE
|
|
|
|
PkgConfig::WOFF2_ENC
|
|
|
|
PkgConfig::WOFF2_DEC
|
|
|
|
PkgConfig::WOFF2_COMMON
|
|
|
|
)
|
|
|
|
|
|
|
|
add_sapi_library(woff2_sapi
|
|
|
|
FUNCTIONS
|
|
|
|
WOFF2_ConvertWOFF2ToTTF
|
|
|
|
WOFF2_ConvertTTFToWOFF2
|
|
|
|
WOFF2_Free
|
|
|
|
INPUTS
|
|
|
|
"woff2_wrapper.h"
|
|
|
|
LIBRARY
|
|
|
|
woff2_sapi_wrapper
|
|
|
|
LIBRARY_NAME
|
|
|
|
WOFF2
|
|
|
|
NAMESPACE
|
|
|
|
sapi_woff2
|
|
|
|
)
|
2022-04-01 15:10:43 +08:00
|
|
|
add_library(sapi_contrib::woff2 ALIAS woff2_sapi)
|
2022-02-10 05:13:09 +08:00
|
|
|
target_include_directories(woff2_sapi INTERFACE
|
|
|
|
"${PROJECT_BINARY_DIR}"
|
|
|
|
"${SAPI_SOURCE_DIR}"
|
|
|
|
)
|
|
|
|
|
2022-04-21 16:17:08 +08:00
|
|
|
if(BUILD_TESTING AND SAPI_BUILD_TESTING)
|
2022-02-10 05:13:09 +08:00
|
|
|
enable_testing()
|
|
|
|
add_executable(woff2_sapi_test
|
|
|
|
woff2_sapi_test.cc
|
|
|
|
)
|
|
|
|
target_link_libraries(woff2_sapi_test PRIVATE
|
2022-10-20 21:48:06 +08:00
|
|
|
absl::flags
|
|
|
|
absl::flags_parse
|
2022-04-29 17:13:32 +08:00
|
|
|
sapi_contrib::woff2
|
2022-10-20 21:48:06 +08:00
|
|
|
sapi::test_main
|
2022-02-10 05:13:09 +08:00
|
|
|
)
|
|
|
|
gtest_discover_tests(woff2_sapi_test PROPERTIES
|
|
|
|
ENVIRONMENT "TEST_DATA_DIR=${PROJECT_SOURCE_DIR}/testdata")
|
|
|
|
endif()
|