2022-01-26 23:15:41 +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.
|
|
|
|
|
2023-05-11 22:50:03 +08:00
|
|
|
cmake_minimum_required(VERSION 3.13..3.26)
|
2022-01-26 23:15:41 +08:00
|
|
|
|
|
|
|
project(sapi_zopfli CXX)
|
2022-04-21 16:14:48 +08:00
|
|
|
include(CTest)
|
2022-01-26 23:15:41 +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")
|
2022-02-07 23:30:51 +08:00
|
|
|
add_subdirectory("${SAPI_ROOT}"
|
|
|
|
"${CMAKE_BINARY_DIR}/sandboxed-api-build"
|
|
|
|
EXCLUDE_FROM_ALL)
|
2022-01-26 23:15:41 +08:00
|
|
|
endif()
|
|
|
|
|
2022-02-07 23:30:51 +08:00
|
|
|
FetchContent_Declare(zopfli
|
2022-01-26 23:15:41 +08:00
|
|
|
GIT_REPOSITORY https://github.com/google/zopfli.git
|
|
|
|
GIT_TAG 831773bc28e318b91a3255fa12c9fcde1606058b
|
|
|
|
)
|
2022-02-07 23:30:51 +08:00
|
|
|
FetchContent_MakeAvailable(zopfli)
|
2022-01-26 23:15:41 +08:00
|
|
|
|
2022-02-07 03:31:19 +08:00
|
|
|
add_subdirectory(wrapper)
|
|
|
|
|
2022-01-26 23:15:41 +08:00
|
|
|
add_sapi_library(
|
|
|
|
sapi_zopfli
|
|
|
|
|
|
|
|
FUNCTIONS
|
|
|
|
ZopfliInitOptions
|
|
|
|
|
|
|
|
ZopfliCompress
|
|
|
|
|
|
|
|
ZopfliDeflate
|
|
|
|
ZopfliZlibCompress
|
|
|
|
ZopfliGzipCompress
|
|
|
|
|
2022-02-07 03:31:19 +08:00
|
|
|
ZopfliCompressFD
|
2022-01-26 23:15:41 +08:00
|
|
|
INPUTS
|
2022-02-09 20:41:01 +08:00
|
|
|
"${zopfli_SOURCE_DIR}/src/zopfli/deflate.h"
|
|
|
|
"${zopfli_SOURCE_DIR}/src/zopfli/gzip_container.h"
|
|
|
|
"${zopfli_SOURCE_DIR}/src/zopfli/zlib_container.h"
|
2022-02-07 03:31:19 +08:00
|
|
|
wrapper/wrapper_zopfli.h
|
2022-01-26 23:15:41 +08:00
|
|
|
|
2022-02-07 03:31:19 +08:00
|
|
|
LIBRARY wrapper_zopfli
|
2022-01-26 23:15:41 +08:00
|
|
|
LIBRARY_NAME Zopfli
|
|
|
|
NAMESPACE ""
|
|
|
|
)
|
|
|
|
add_library(sapi_contrib::zopfli ALIAS sapi_zopfli)
|
|
|
|
target_include_directories(sapi_zopfli INTERFACE
|
|
|
|
"${PROJECT_BINARY_DIR}"
|
2022-02-07 23:30:51 +08:00
|
|
|
"${SAPI_SOURCE_DIR}"
|
2022-01-26 23:15:41 +08:00
|
|
|
)
|
|
|
|
|
2022-04-21 16:17:08 +08:00
|
|
|
if(SAPI_BUILD_EXAMPLES)
|
2022-01-26 23:15:41 +08:00
|
|
|
add_subdirectory(example)
|
|
|
|
endif()
|
|
|
|
|
2022-04-21 16:17:08 +08:00
|
|
|
if(BUILD_TESTING AND SAPI_BUILD_TESTING)
|
2022-01-26 23:15:41 +08:00
|
|
|
add_subdirectory(test)
|
|
|
|
endif()
|