Merge pull request #83 from cblichmann:cmake-deps-1

PiperOrigin-RevId: 355585389
Change-Id: Ie8d22fed3e2876b31b61972c5afb7238e71ae34e
This commit is contained in:
Copybara-Service 2021-02-04 02:47:13 -08:00
commit 492cd11273
25 changed files with 14 additions and 1143 deletions

3
.gitignore vendored
View File

@ -11,7 +11,8 @@ build/
*.py[co]
__py_cache__/
# IDE files
.cache/
.clangd/
.idea/
.vscode/
.idea
compile_commands.json

View File

@ -45,7 +45,8 @@ if(SAPI_HARDENED_SOURCE)
endif()
# Sapi CMake modules, order matters
list(APPEND CMAKE_MODULE_PATH "${SAPI_SOURCE_DIR}/cmake")
list(APPEND CMAKE_MODULE_PATH "${SAPI_SOURCE_DIR}/cmake"
"${SAPI_SOURCE_DIR}/cmake/modules")
include(SapiOptions)
include(SapiDeps)
include(SapiUtil)

View File

@ -1,34 +0,0 @@
# Copyright 2019 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
#
# http://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.
# On Debian, install libcap-dev to use this module.
find_path(libcap_INCLUDE_DIR sys/capability.h)
# Look for static library only.
find_library(libcap_LIBRARY cap)
mark_as_advanced(libcap_INCLUDE_DIR libcap_LIBRARY)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(libcap
REQUIRED_VARS libcap_LIBRARY libcap_INCLUDE_DIR
)
if(libcap_FOUND AND NOT TARGET libcap::libcap)
add_library(libcap::libcap UNKNOWN IMPORTED)
set_target_properties(libcap::libcap PROPERTIES
IMPORTED_LINK_INTERFACE_LANGUAGES "C"
IMPORTED_LOCATION "${libcap_LIBRARY}"
INTERFACE_INCLUDE_DIRECTORIES "${libcap_INCLUDE_DIR}"
)
endif()

View File

@ -1,34 +0,0 @@
# Copyright 2019 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
#
# http://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.
# On Debian, install libffi-dev to use this module.
find_path(libffi_INCLUDE_DIR ffitarget.h)
# Look for static library only.
find_library(libffi_LIBRARY ffi)
mark_as_advanced(libffi_INCLUDE_DIR libffi_LIBRARY)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(libffi
REQUIRED_VARS libffi_LIBRARY libffi_INCLUDE_DIR
)
if(libffi_FOUND AND NOT TARGET libffi::libffi)
add_library(libffi::libffi UNKNOWN IMPORTED)
set_target_properties(libffi::libffi PROPERTIES
IMPORTED_LINK_INTERFACE_LANGUAGES "C"
IMPORTED_LOCATION "${libffi_LIBRARY}"
INTERFACE_INCLUDE_DIRECTORIES "${libffi_INCLUDE_DIR}"
)
endif()

View File

@ -38,56 +38,56 @@ endif()
if(SAPI_ENABLE_TESTS)
if(SAPI_DOWNLOAD_GOOGLETEST)
include(cmake/googletest/Download.cmake)
include(cmake/googletest.cmake)
endif()
check_target(gtest)
check_target(gtest_main)
check_target(gmock)
if(SAPI_DOWNLOAD_BENCHMARK)
include(cmake/benchmark/Download.cmake)
include(cmake/benchmark.cmake)
endif()
check_target(benchmark)
endif()
if(SAPI_DOWNLOAD_ABSL)
include(cmake/abseil/Download.cmake)
include(cmake/abseil-cpp.cmake)
endif()
check_target(absl::core_headers)
if(SAPI_DOWNLOAD_LIBCAP)
include(cmake/libcap/Download.cmake)
include(cmake/libcap.cmake)
check_target(libcap::libcap)
else()
find_package(Libcap REQUIRED)
endif()
if(SAPI_DOWNLOAD_LIBFFI)
include(cmake/libffi/Download.cmake)
include(cmake/libffi.cmake)
check_target(libffi::libffi)
else()
find_package(Libffi REQUIRED)
endif()
if(SAPI_DOWNLOAD_LIBUNWIND)
include(cmake/libunwind/Download.cmake)
include(cmake/libunwind.cmake)
endif()
check_target(unwind_ptrace_wrapped)
if(SAPI_DOWNLOAD_GFLAGS)
include(cmake/gflags/Download.cmake)
include(cmake/gflags.cmake)
endif()
check_target(gflags)
if(SAPI_DOWNLOAD_GLOG)
include(cmake/glog/Download.cmake)
include(cmake/glog.cmake)
endif()
check_target(glog::glog)
add_dependencies(glog gflags::gflags)
if(SAPI_DOWNLOAD_PROTOBUF)
include(cmake/protobuf/Download.cmake)
include(cmake/protobuf.cmake)
check_target(protobuf::libprotobuf)
check_target(protobuf::protoc)
else()
@ -96,7 +96,7 @@ endif()
if(SAPI_ENABLE_EXAMPLES)
if(SAPI_DOWNLOAD_ZLIB)
include(cmake/zlib/Download.cmake)
include(cmake/zlib.cmake)
check_target(ZLIB::ZLIB)
else()
find_package(ZLIB REQUIRED)

View File

@ -1,28 +0,0 @@
# Copyright 2019 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
#
# http://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.12)
project(absl-download NONE)
include(ExternalProject)
ExternalProject_Add(absl
GIT_REPOSITORY https://github.com/abseil/abseil-cpp
GIT_TAG 4fd9a1ec5077daac14eeee05df931d658ec0b7b8 # 2020-11-19
SOURCE_DIR "${CMAKE_BINARY_DIR}/absl-src"
BINARY_DIR "${CMAKE_BINARY_DIR}/absl-build"
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
INSTALL_COMMAND ""
TEST_COMMAND ""
)

View File

@ -1,53 +0,0 @@
# Copyright 2019 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
#
# http://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.
# Downloads and unpacks Abseil at configure time
set(workdir "${CMAKE_BINARY_DIR}/absl-download")
configure_file("${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt.in"
"${workdir}/CMakeLists.txt")
execute_process(COMMAND ${CMAKE_COMMAND} -G "${CMAKE_GENERATOR}" .
RESULT_VARIABLE error
WORKING_DIRECTORY "${workdir}")
if(error)
message(FATAL_ERROR "CMake step for ${PROJECT_NAME} failed: ${error}")
endif()
execute_process(COMMAND ${CMAKE_COMMAND} --build .
RESULT_VARIABLE error
WORKING_DIRECTORY "${workdir}")
if(error)
message(FATAL_ERROR "Build step for ${PROJECT_NAME} failed: ${error}")
endif()
set(_sapi_saved_CMAKE_CXX_STANDARD ${CMAKE_CXX_STANDARD})
set(_sapi_saved_BUILD_TESTING ${BUILD_TESTING})
set(CMAKE_CXX_STANDARD ${SAPI_CXX_STANDARD})
set(ABSL_USE_GOOGLETEST_HEAD OFF CACHE BOOL "" FORCE)
set(ABSL_RUN_TESTS OFF CACHE BOOL "" FORCE)
set(BUILD_TESTING OFF) # Avoid errors when re-configuring SAPI
set(ABSL_CXX_STANDARD ${SAPI_CXX_STANDARD} CACHE STRING "" FORCE)
set(ABSL_ENABLE_INSTALL ON CACHE BOOL "" FORCE)
add_subdirectory("${CMAKE_BINARY_DIR}/absl-src"
"${CMAKE_BINARY_DIR}/absl-build" EXCLUDE_FROM_ALL)
if(_sapi_saved_BUILD_TESTING)
set(BUILD_TESTING "${_sapi_saved_BUILD_TESTING}")
endif()
if(_sapi_saved_CMAKE_CXX_STANDARD)
set(CMAKE_CXX_STANDARD "${_sapi_saved_CMAKE_CXX_STANDARD}")
endif()

View File

@ -1,28 +0,0 @@
# Copyright 2019 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
#
# http://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.12)
project(benchmark-download NONE)
include(ExternalProject)
ExternalProject_Add(benchmark
GIT_REPOSITORY https://github.com/google/benchmark.git
GIT_TAG 56898e9a92fba537671d5462df9c5ef2ea6a823a # 2020-04-23
SOURCE_DIR "${CMAKE_BINARY_DIR}/benchmark-src"
BINARY_DIR "${CMAKE_BINARY_DIR}/benchmark-build"
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
INSTALL_COMMAND ""
TEST_COMMAND ""
)

View File

@ -1,40 +0,0 @@
# Copyright 2019 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
#
# http://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.
# Downloads and unpacks Benchmark at configure time
set(workdir "${CMAKE_BINARY_DIR}/benchmark-download")
configure_file("${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt.in"
"${workdir}/CMakeLists.txt")
execute_process(COMMAND ${CMAKE_COMMAND} -G "${CMAKE_GENERATOR}" .
RESULT_VARIABLE error
WORKING_DIRECTORY "${workdir}")
if(error)
message(FATAL_ERROR "CMake step for ${PROJECT_NAME} failed: ${error}")
endif()
execute_process(COMMAND ${CMAKE_COMMAND} --build .
RESULT_VARIABLE error
WORKING_DIRECTORY "${workdir}")
if(error)
message(FATAL_ERROR "Build step for ${PROJECT_NAME} failed: ${error}")
endif()
set(BENCHMARK_ENABLE_TESTING OFF)
set(BENCHMARK_ENABLE_EXCEPTIONS OFF)
set(BENCHMARK_ENABLE_GTEST_TESTS OFF)
add_subdirectory("${CMAKE_BINARY_DIR}/benchmark-src"
"${CMAKE_BINARY_DIR}/benchmark-build" EXCLUDE_FROM_ALL)

View File

@ -1,28 +0,0 @@
# Copyright 2019 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
#
# http://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.12)
project(gflags-download NONE)
include(ExternalProject)
ExternalProject_Add(gflags
GIT_REPOSITORY https://github.com/gflags/gflags.git
GIT_TAG addd749114fab4f24b7ea1e0f2f837584389e52c # 2020-03-18
SOURCE_DIR "${CMAKE_BINARY_DIR}/gflags-src"
BINARY_DIR "${CMAKE_BINARY_DIR}/gflags-build"
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
INSTALL_COMMAND ""
TEST_COMMAND ""
)

View File

@ -1,42 +0,0 @@
# Copyright 2019 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
#
# http://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.
# Downloads and unpacks gflags at configure time
set(workdir "${CMAKE_BINARY_DIR}/gflags-download")
configure_file("${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt.in"
"${workdir}/CMakeLists.txt")
execute_process(COMMAND ${CMAKE_COMMAND} -G "${CMAKE_GENERATOR}" .
RESULT_VARIABLE error
WORKING_DIRECTORY "${workdir}")
if(error)
message(FATAL_ERROR "CMake step for ${PROJECT_NAME} failed: ${error}")
endif()
execute_process(COMMAND ${CMAKE_COMMAND} --build .
RESULT_VARIABLE error
WORKING_DIRECTORY "${workdir}")
if(error)
message(FATAL_ERROR "Build step for ${PROJECT_NAME} failed: ${error}")
endif()
set(GFLAGS_IS_SUBPROJECT TRUE)
set(GFLAGS_BUILD_SHARED_LIBS ${SAPI_ENABLE_SHARED_LIBS})
set(GFLAGS_INSTALL_SHARED_LIBS ${SAPI_ENABLE_SHARED_LIBS})
set(GFLAGS_INSTALL_HEADERS OFF) # TODO: Temporary off
set(GFLAGS_BUILD_TESTING FALSE)
add_subdirectory("${CMAKE_BINARY_DIR}/gflags-src"
"${CMAKE_BINARY_DIR}/gflags-build" EXCLUDE_FROM_ALL)

View File

@ -1,28 +0,0 @@
# Copyright 2019 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
#
# http://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.12)
project(glog-download NONE)
include(ExternalProject)
ExternalProject_Add(glog
GIT_REPOSITORY https://github.com/google/glog.git
GIT_TAG 3ba8976592274bc1f907c402ce22558011d6fc5e # 2020-02-16
SOURCE_DIR "${CMAKE_BINARY_DIR}/glog-src"
BINARY_DIR "${CMAKE_BINARY_DIR}/glog-build"
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
INSTALL_COMMAND ""
TEST_COMMAND ""
)

View File

@ -1,68 +0,0 @@
# Copyright 2019 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
#
# http://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.
# Downloads and unpacks glog at configure time
# Allows use target_link_libraries() with targets in other directories.
if(POLICY CMP0079)
cmake_policy(SET CMP0079 NEW)
endif()
set(workdir "${CMAKE_BINARY_DIR}/glog-download")
configure_file("${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt.in"
"${workdir}/CMakeLists.txt")
execute_process(COMMAND "${CMAKE_COMMAND}" -G "${CMAKE_GENERATOR}" .
RESULT_VARIABLE error
WORKING_DIRECTORY "${workdir}")
if(error)
message(FATAL_ERROR "CMake step for ${PROJECT_NAME} failed: ${error}")
endif()
execute_process(COMMAND "${CMAKE_COMMAND}" --build .
RESULT_VARIABLE error
WORKING_DIRECTORY "${workdir}")
if(error)
message(FATAL_ERROR "Build step for ${PROJECT_NAME} failed: ${error}")
endif()
# Force gflags from subdirectory
set(WITH_GFLAGS OFF CACHE BOOL "" FORCE)
set(HAVE_LIB_GFLAGS 1 CACHE STRING "" FORCE)
set(WITH_UNWIND OFF CACHE BOOL "" FORCE)
set(UNWIND_LIBRARY FALSE)
set(HAVE_PWD_H FALSE)
set(WITH_PKGCONFIG ON CACHE BOOL "" FORCE)
set(_glog_BUILD_TESTING ${BUILD_TESTING})
set(BUILD_TESTING FALSE)
set(BUILD_SHARED_LIBS ${SAPI_ENABLE_SHARED_LIBS})
add_subdirectory("${CMAKE_BINARY_DIR}/glog-src"
"${CMAKE_BINARY_DIR}/glog-build" EXCLUDE_FROM_ALL)
set(BUILD_TESTING ${_glog_BUILD_TESTING})
set(_glog_BUILD_TESTING)
target_include_directories(glog PUBLIC
$<BUILD_INTERFACE:${CMAKE_BINARY_DIR}/gflags-build/include>
$<BUILD_INTERFACE:${CMAKE_BINARY_DIR}/glog-build>
)
add_library(gflags_nothreads STATIC IMPORTED)
set_target_properties(gflags_nothreads PROPERTIES
IMPORTED_LOCATION "${CMAKE_BINARY_DIR}/gflags-build/libgflags_nothreads.a")
target_link_libraries(glog PRIVATE
-Wl,--whole-archive
gflags_nothreads
-Wl,--no-whole-archive
)

View File

@ -1,28 +0,0 @@
# Copyright 2019 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
#
# http://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.12)
project(googletest-download NONE)
include(ExternalProject)
ExternalProject_Add(googletest
GIT_REPOSITORY https://github.com/google/googletest.git
GIT_TAG dcc92d0ab6c4ce022162a23566d44f673251eee4 # 2020-04-16
SOURCE_DIR "${CMAKE_BINARY_DIR}/googletest-src"
BINARY_DIR "${CMAKE_BINARY_DIR}/googletest-build"
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
INSTALL_COMMAND ""
TEST_COMMAND ""
)

View File

@ -1,38 +0,0 @@
# Copyright 2019 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
#
# http://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.
# Downloads and unpacks Googletest at configure time
set(workdir "${CMAKE_BINARY_DIR}/googletest-download")
configure_file("${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt.in"
"${workdir}/CMakeLists.txt")
execute_process(COMMAND ${CMAKE_COMMAND} -G "${CMAKE_GENERATOR}" .
RESULT_VARIABLE error
WORKING_DIRECTORY "${workdir}")
if(error)
message(FATAL_ERROR "CMake step for ${PROJECT_NAME} failed: ${error}")
endif()
execute_process(COMMAND ${CMAKE_COMMAND} --build .
RESULT_VARIABLE error
WORKING_DIRECTORY "${workdir}")
if(error)
message(FATAL_ERROR "Build step for ${PROJECT_NAME} failed: ${error}")
endif()
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
add_subdirectory("${CMAKE_BINARY_DIR}/googletest-src"
"${CMAKE_BINARY_DIR}/googletest-build" EXCLUDE_FROM_ALL)

View File

@ -1,27 +0,0 @@
# Copyright 2019 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
#
# http://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.12)
project(libcap-download NONE)
include(ExternalProject)
ExternalProject_Add(libcap
URL https://www.kernel.org/pub/linux/libs/security/linux-privs/libcap2/libcap-2.27.tar.gz
URL_HASH SHA256=260b549c154b07c3cdc16b9ccc93c04633c39f4fb6a4a3b8d1fa5b8a9c3f5fe8 # 2019-04-16
SOURCE_DIR "${CMAKE_BINARY_DIR}/libcap-src"
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
INSTALL_COMMAND ""
TEST_COMMAND ""
)

View File

@ -1,103 +0,0 @@
# Copyright 2019 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
#
# http://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.
# Downloads and unpacks libunwind at configure time
set(workdir "${CMAKE_BINARY_DIR}/libcap-download")
configure_file("${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt.in"
"${workdir}/CMakeLists.txt")
execute_process(COMMAND ${CMAKE_COMMAND} -G "${CMAKE_GENERATOR}" .
RESULT_VARIABLE error
WORKING_DIRECTORY "${workdir}")
if(error)
message(FATAL_ERROR "CMake step for ${PROJECT_NAME} failed: ${error}")
endif()
execute_process(COMMAND ${CMAKE_COMMAND} --build .
RESULT_VARIABLE error
WORKING_DIRECTORY "${workdir}")
if(error)
message(FATAL_ERROR "Build step for ${PROJECT_NAME} failed: ${error}")
endif()
set(_cap_src "${CMAKE_BINARY_DIR}/libcap-src")
set(libcap_INCLUDE_DIR ${_cap_src}/libcap/include)
add_custom_command(OUTPUT ${_cap_src}/libcap/cap_names.list.h
VERBATIM
# Use the same logic as libcap/Makefile
COMMAND sed -ne [=[/^#define[ \\t]CAP[_A-Z]\+[ \\t]\+[0-9]\+/{s/^#define \([^ \\t]*\)[ \\t]*\([^ \\t]*\)/\{\"\1\",\2\},/p;}]=]
${_cap_src}/libcap/include/uapi/linux/capability.h |
tr [:upper:] [:lower:] > ${_cap_src}/libcap/cap_names.list.h
)
if (CMAKE_CROSSCOMPILING AND BUILD_C_COMPILER)
add_custom_command(OUTPUT ${_cap_src}/libcap/libcap_makenames
VERBATIM
# Use the same logic as libcap/Makefile
COMMAND ${BUILD_C_COMPILER} ${BUILD_C_FLAGS} ${_cap_src}/libcap/_makenames.c -o ${_cap_src}/libcap/libcap_makenames
DEPENDS ${_cap_src}/libcap/cap_names.list.h ${_cap_src}/libcap/_makenames.c
)
add_custom_command(OUTPUT ${_cap_src}/libcap/cap_names.h
COMMAND ${_cap_src}/libcap/libcap_makenames > ${_cap_src}/libcap/cap_names.h
DEPENDS ${_cap_src}/libcap/libcap_makenames
)
else()
add_executable(libcap_makenames
${_cap_src}/libcap/cap_names.list.h
${_cap_src}/libcap/_makenames.c
)
target_include_directories(libcap_makenames PUBLIC
${_cap_src}/libcap
${_cap_src}/libcap/include
${_cap_src}/libcap/include/uapi
)
add_custom_command(OUTPUT ${_cap_src}/libcap/cap_names.h
COMMAND libcap_makenames > ${_cap_src}/libcap/cap_names.h
)
endif()
add_library(cap STATIC
${_cap_src}/libcap/cap_alloc.c
${_cap_src}/libcap/cap_extint.c
${_cap_src}/libcap/cap_file.c
${_cap_src}/libcap/cap_flag.c
${_cap_src}/libcap/cap_names.h
${_cap_src}/libcap/cap_proc.c
${_cap_src}/libcap/cap_text.c
${_cap_src}/libcap/include/uapi/linux/capability.h
${_cap_src}/libcap/libcap.h
)
add_library(libcap::libcap ALIAS cap)
target_include_directories(cap PUBLIC
${_cap_src}/libcap
${_cap_src}/libcap/include
${_cap_src}/libcap/include/uapi
)
target_compile_options(cap PRIVATE
-Wno-tautological-compare
-Wno-unused-result
)
target_compile_definitions(cap PRIVATE
# Work around sys/xattr.h not declaring this
-DXATTR_NAME_CAPS="\"security.capability\""
)
target_link_libraries(cap PRIVATE
sapi::base
)

View File

@ -1,31 +0,0 @@
# 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
#
# http://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.12)
project(libffi-download NONE)
include(ExternalProject)
ExternalProject_Add(libffi
URL https://github.com/libffi/libffi/releases/download/v3.3-rc2/libffi-3.3-rc2.tar.gz
URL_HASH SHA256=653ffdfc67fbb865f39c7e5df2a071c0beb17206ebfb0a9ecb18a18f63f6b263 # 2019-11-02
SOURCE_DIR "${CMAKE_BINARY_DIR}/libffi-src"
CONFIGURE_COMMAND ./configure
--disable-dependency-tracking
--disable-builddir
${SAPI_THIRD_PARTY_CONFIGUREOPTS}
BUILD_COMMAND ""
INSTALL_COMMAND ""
TEST_COMMAND ""
BUILD_IN_SOURCE TRUE
)

View File

@ -1,97 +0,0 @@
# 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
#
# http://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.
# Downloads and unpacks libunwind at configure time
set(workdir "${CMAKE_BINARY_DIR}/libffi-download")
configure_file("${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt.in"
"${workdir}/CMakeLists.txt")
execute_process(COMMAND ${CMAKE_COMMAND} -G "${CMAKE_GENERATOR}" .
RESULT_VARIABLE error
WORKING_DIRECTORY "${workdir}")
if(error)
message(FATAL_ERROR "CMake step for ${PROJECT_NAME} failed: ${error}")
endif()
execute_process(COMMAND ${CMAKE_COMMAND} --build .
RESULT_VARIABLE error
WORKING_DIRECTORY "${workdir}")
if(error)
message(FATAL_ERROR "Build step for ${PROJECT_NAME} failed: ${error}")
endif()
set(_ffi_src "${CMAKE_BINARY_DIR}/libffi-src")
set(libffi_INCLUDE_DIR ${_ffi_src}/libffi/include)
if(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64")
list(APPEND _ffi_platform_srcs
${_ffi_src}/src/x86/asmnames.h
${_ffi_src}/src/x86/ffi.c
${_ffi_src}/src/x86/ffi64.c
${_ffi_src}/src/x86/ffiw64.c
${_ffi_src}/src/x86/internal.h
${_ffi_src}/src/x86/internal64.h
${_ffi_src}/src/x86/sysv.S
${_ffi_src}/src/x86/unix64.S
${_ffi_src}/src/x86/win64.S
)
elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL "ppc64")
list(APPEND _ffi_platform_srcs
${_ffi_src}/src/powerpc/ffi.c
${_ffi_src}/src/powerpc/ffi_linux64.c
${_ffi_src}/src/powerpc/ffi_sysv.c
${_ffi_src}/src/powerpc/linux64.S
${_ffi_src}/src/powerpc/linux64_closure.S
${_ffi_src}/src/powerpc/ppc_closure.S
${_ffi_src}/src/powerpc/sysv.S
# Textual headers
${_ffi_src}/src/powerpc/ffi_powerpc.h
${_ffi_src}/src/powerpc/asm.h
)
elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL "aarch64")
list(APPEND _ffi_platform_srcs
${_ffi_src}/src/aarch64/ffi.c
${_ffi_src}/src/aarch64/internal.h
${_ffi_src}/src/aarch64/sysv.S
)
endif()
add_library(ffi STATIC
${_ffi_src}/fficonfig.h
${_ffi_src}/include/ffi.h
${_ffi_src}/include/ffi_cfi.h
${_ffi_src}/include/ffi_common.h
${_ffi_src}/include/ffitarget.h
${_ffi_src}/src/closures.c
${_ffi_src}/src/debug.c
${_ffi_src}/src/java_raw_api.c
${_ffi_src}/src/prep_cif.c
${_ffi_src}/src/raw_api.c
${_ffi_src}/src/types.c
${_ffi_platform_srcs}
)
add_library(libffi::libffi ALIAS ffi)
target_include_directories(ffi PUBLIC
${_ffi_src}
${_ffi_src}/include
)
target_compile_options(ffi PRIVATE
-Wno-vla
-Wno-unused-result
)
target_link_libraries(ffi PRIVATE
sapi::base
)

View File

@ -1,34 +0,0 @@
# Copyright 2019 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
#
# http://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.12)
project(libunwind-download NONE)
include(ExternalProject)
ExternalProject_Add(libunwind
URL https://github.com/libunwind/libunwind/releases/download/v1.2.1/libunwind-1.2.1.tar.gz
URL_HASH SHA256=3f3ecb90e28cbe53fba7a4a27ccce7aad188d3210bb1964a923a731a27a75acb
SOURCE_DIR "${CMAKE_BINARY_DIR}/libunwind-src"
CONFIGURE_COMMAND ./configure
--disable-dependency-tracking
--disable-documentation
--disable-minidebuginfo
--disable-shared
--enable-ptrace
${SAPI_THIRD_PARTY_CONFIGUREOPTS}
BUILD_COMMAND ""
INSTALL_COMMAND ""
TEST_COMMAND ""
BUILD_IN_SOURCE TRUE
)

View File

@ -1,212 +0,0 @@
# Copyright 2019 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
#
# http://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.
# Downloads and unpacks libunwind at configure time
set(workdir "${CMAKE_BINARY_DIR}/libunwind-download")
configure_file("${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt.in"
"${workdir}/CMakeLists.txt")
execute_process(COMMAND ${CMAKE_COMMAND} -G "${CMAKE_GENERATOR}" .
RESULT_VARIABLE error
WORKING_DIRECTORY "${workdir}")
if(error)
message(FATAL_ERROR "CMake step for ${PROJECT_NAME} failed: ${error}")
endif()
execute_process(COMMAND ${CMAKE_COMMAND} --build .
RESULT_VARIABLE error
WORKING_DIRECTORY "${workdir}")
if(error)
message(FATAL_ERROR "Build step for ${PROJECT_NAME} failed: ${error}")
endif()
set(_unwind_src "${CMAKE_BINARY_DIR}/libunwind-src")
if(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64")
set(_unwind_cpu "x86_64")
list(APPEND _unwind_platform_srcs
${_unwind_src}/src/x86_64/Gcreate_addr_space.c
${_unwind_src}/src/x86_64/Gglobal.c
${_unwind_src}/src/x86_64/Ginit.c
${_unwind_src}/src/x86_64/Gos-linux.c
${_unwind_src}/src/x86_64/Gregs.c
${_unwind_src}/src/x86_64/Gresume.c
${_unwind_src}/src/x86_64/Gstash_frame.c
${_unwind_src}/src/x86_64/Gstep.c
${_unwind_src}/src/x86_64/is_fpreg.c
${_unwind_src}/src/x86_64/setcontext.S
)
list(APPEND _unwind_ptrace_srcs
${_unwind_src}/src/x86_64/Ginit_remote.c
)
elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL "ppc64")
set(_unwind_cpu "ppc64")
list(APPEND _unwind_platform_srcs
${_unwind_src}/src/ppc/Gis_signal_frame.c
${_unwind_src}/src/ppc64/Gcreate_addr_space.c
${_unwind_src}/src/ppc64/Gglobal.c
${_unwind_src}/src/ppc64/Ginit.c
${_unwind_src}/src/ppc64/Gregs.c
${_unwind_src}/src/ppc64/Gresume.c
${_unwind_src}/src/ppc64/Gstep.c
${_unwind_src}/src/ppc64/get_func_addr.c
${_unwind_src}/src/ppc64/is_fpreg.c
)
list(APPEND _unwind_ptrace_srcs
${_unwind_src}/src/ppc/Ginit_remote.c
)
elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL "aarch64")
set(_unwind_cpu "aarch64")
list(APPEND _unwind_platform_srcs
${_unwind_src}/src/aarch64/Gcreate_addr_space.c
${_unwind_src}/src/aarch64/Gglobal.c
${_unwind_src}/src/aarch64/Ginit.c
${_unwind_src}/src/aarch64/Gis_signal_frame.c
${_unwind_src}/src/aarch64/Gregs.c
${_unwind_src}/src/aarch64/Gresume.c
${_unwind_src}/src/aarch64/Gstash_frame.c
${_unwind_src}/src/aarch64/Gstep.c
${_unwind_src}/src/aarch64/is_fpreg.c
)
list(APPEND _unwind_ptrace_srcs
${_unwind_src}/src/aarch64/Ginit_remote.c
)
elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL "arm")
set(_unwind_cpu "arm")
list(APPEND _unwind_platform_srcs
${_unwind_src}/src/arm/Gcreate_addr_space.c
${_unwind_src}/src/arm/Gex_tables.c
${_unwind_src}/src/arm/Gglobal.c
${_unwind_src}/src/arm/Ginit.c
${_unwind_src}/src/arm/Gis_signal_frame.c
${_unwind_src}/src/arm/Gregs.c
${_unwind_src}/src/arm/Gresume.c
${_unwind_src}/src/arm/Gstash_frame.c
${_unwind_src}/src/arm/Gstep.c
${_unwind_src}/src/arm/is_fpreg.c
)
list(APPEND _unwind_ptrace_srcs
${_unwind_src}/src/arm/Ginit_remote.c
)
endif()
add_library(unwind_ptrace_wrapped STATIC
# internal_headers
${_unwind_src}/include/compiler.h
${_unwind_src}/include/config.h
${_unwind_src}/include/dwarf.h
${_unwind_src}/include/dwarf-eh.h
${_unwind_src}/include/dwarf_i.h
${_unwind_src}/include/libunwind.h
${_unwind_src}/include/libunwind-common.h
${_unwind_src}/include/libunwind-coredump.h
${_unwind_src}/include/libunwind-dynamic.h
${_unwind_src}/include/libunwind-ptrace.h
${_unwind_src}/include/libunwind-x86_64.h
${_unwind_src}/include/libunwind_i.h
${_unwind_src}/include/mempool.h
${_unwind_src}/include/remote.h
${_unwind_src}/include/tdep-x86_64/dwarf-config.h
${_unwind_src}/include/tdep-x86_64/libunwind_i.h
${_unwind_src}/include/tdep/dwarf-config.h
${_unwind_src}/include/tdep/libunwind_i.h
${_unwind_src}/include/unwind.h
${_unwind_src}/src/elf32.h
${_unwind_src}/src/elf64.h
${_unwind_src}/src/elfxx.h
${_unwind_src}/src/os-linux.h
${_unwind_src}/src/x86_64/init.h
${_unwind_src}/src/x86_64/offsets.h
${_unwind_src}/src/x86_64/ucontext_i.h
${_unwind_src}/src/x86_64/unwind_i.h
# included_sources
${_unwind_src}/src/elf64.h
${_unwind_src}/src/elfxx.h
${_unwind_src}/src/elfxx.c
# sources_common
${_unwind_src}/src/dwarf/Gexpr.c
${_unwind_src}/src/dwarf/Gfde.c
${_unwind_src}/src/dwarf/Gfind_proc_info-lsb.c
${_unwind_src}/src/dwarf/Gfind_unwind_table.c
${_unwind_src}/src/dwarf/Gparser.c
${_unwind_src}/src/dwarf/Gpe.c
${_unwind_src}/src/dwarf/Gstep.c
${_unwind_src}/src/dwarf/global.c
${_unwind_src}/src/mi/Gdestroy_addr_space.c
${_unwind_src}/src/mi/Gdyn-extract.c
${_unwind_src}/src/mi/Gfind_dynamic_proc_info.c
${_unwind_src}/src/mi/Gget_accessors.c
${_unwind_src}/src/mi/Gget_proc_name.c
${_unwind_src}/src/mi/Gget_reg.c
${_unwind_src}/src/mi/Gput_dynamic_unwind_info.c
${_unwind_src}/src/mi/flush_cache.c
${_unwind_src}/src/mi/init.c
${_unwind_src}/src/mi/mempool.c
${_unwind_src}/src/os-linux.c
${_unwind_platform_srcs}
# srcs
${_unwind_src}/src/mi/Gdyn-remote.c
${_unwind_src}/src/ptrace/_UPT_access_fpreg.c
${_unwind_src}/src/ptrace/_UPT_access_mem.c
${_unwind_src}/src/ptrace/_UPT_access_reg.c
${_unwind_src}/src/ptrace/_UPT_accessors.c
${_unwind_src}/src/ptrace/_UPT_create.c
${_unwind_src}/src/ptrace/_UPT_destroy.c
${_unwind_src}/src/ptrace/_UPT_elf.c
${_unwind_src}/src/ptrace/_UPT_find_proc_info.c
${_unwind_src}/src/ptrace/_UPT_get_dyn_info_list_addr.c
${_unwind_src}/src/ptrace/_UPT_get_proc_name.c
${_unwind_src}/src/ptrace/_UPT_internal.h
${_unwind_src}/src/ptrace/_UPT_put_unwind_info.c
${_unwind_src}/src/ptrace/_UPT_reg_offset.c
${_unwind_src}/src/ptrace/_UPT_resume.c
# hdrs
${_unwind_src}/include/config.h
${_unwind_src}/include/libunwind.h
# source_ptrace
${_unwind_ptrace_srcs}
)
add_library(unwind::unwind_ptrace_wrapped ALIAS unwind_ptrace_wrapped)
target_include_directories(unwind_ptrace_wrapped PUBLIC
${_unwind_src}/include
${_unwind_src}/include/tdep
${_unwind_src}/include/tdep-${_unwind_cpu}
${_unwind_src}/src
)
target_compile_options(unwind_ptrace_wrapped PRIVATE
-fno-common
-Wno-cpp
)
target_compile_definitions(unwind_ptrace_wrapped
PRIVATE -DHAVE_CONFIG_H
-D_GNU_SOURCE
-DNO_FRAME_POINTER
PUBLIC -D_UPT_accessors=_UPT_accessors_wrapped
-D_UPT_create=_UPT_create_wrapped
-D_UPT_destroy=_UPT_destroy_wrapped
-D_U${_unwind_cpu}_create_addr_space=_U${_unwind_cpu}_create_addr_space_wrapped
-D_U${_unwind_cpu}_destroy_addr_space=_U${_unwind_cpu}_destroy_addr_space_wrapped
-D_U${_unwind_cpu}_get_proc_name=_U${_unwind_cpu}_get_proc_name_wrapped
-D_U${_unwind_cpu}_get_reg=_U${_unwind_cpu}_get_reg_wrapped
-D_U${_unwind_cpu}_init_remote=_U${_unwind_cpu}_init_remote_wrapped
-D_U${_unwind_cpu}_step=_U${_unwind_cpu}_step_wrapped
-Dptrace=ptrace_wrapped
)
target_link_libraries(unwind_ptrace_wrapped PRIVATE
sapi::base
sandbox2::ptrace_hook
)

View File

@ -1,28 +0,0 @@
# Copyright 2019 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
#
# http://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.12)
project(protobuf-download NONE)
include(ExternalProject)
ExternalProject_Add(protobuf
GIT_REPOSITORY https://github.com/protocolbuffers/protobuf.git
GIT_TAG v3.11.4 # 2020-02-14
SOURCE_DIR "${CMAKE_BINARY_DIR}/protobuf-src"
BINARY_DIR "${CMAKE_BINARY_DIR}/protobuf-build"
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
INSTALL_COMMAND ""
TEST_COMMAND ""
)

View File

@ -1,42 +0,0 @@
# Copyright 2019 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
#
# http://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.
# Downloads and unpacks Protobuf at configure time
set(workdir "${CMAKE_BINARY_DIR}/protobuf-download")
configure_file("${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt.in"
"${workdir}/CMakeLists.txt")
execute_process(COMMAND ${CMAKE_COMMAND} -G "${CMAKE_GENERATOR}" .
RESULT_VARIABLE error
WORKING_DIRECTORY "${workdir}")
if(error)
message(FATAL_ERROR "CMake step for ${PROJECT_NAME} failed: ${error}")
endif()
execute_process(COMMAND ${CMAKE_COMMAND} --build .
RESULT_VARIABLE error
WORKING_DIRECTORY "${workdir}")
if(error)
message(FATAL_ERROR "Build step for ${PROJECT_NAME} failed: ${error}")
endif()
set(protobuf_BUILD_TESTS OFF CACHE BOOL "")
set(protobuf_BUILD_SHARED_LIBS OFF CACHE BOOL "")
set(protobuf_WITH_ZLIB OFF CACHE BOOL "")
add_subdirectory("${CMAKE_BINARY_DIR}/protobuf-src/cmake"
"${CMAKE_BINARY_DIR}/protobuf-build" EXCLUDE_FROM_ALL)
get_property(Protobuf_INCLUDE_DIRS TARGET protobuf::libprotobuf
PROPERTY INCLUDE_DIRECTORIES)

View File

@ -1,30 +0,0 @@
# 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
#
# http://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.12)
project(zlib-download NONE)
include(ExternalProject)
ExternalProject_Add(zlib
URL https://mirror.bazel.build/zlib.net/zlib-1.2.11.tar.gz
URL_HASH SHA256=c3e5e9fdd5004dcb542feda5ee4f0ff0744628baf8ed2dd5d66f8ca1197cb1a1 # 2020-04-23
SOURCE_DIR "${CMAKE_BINARY_DIR}/zlib-src"
PATCH_COMMAND patch -p1
< "@SAPI_SOURCE_DIR@/sandboxed_api/bazel/external/zlib.patch"
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
INSTALL_COMMAND ""
TEST_COMMAND ""
BUILD_IN_SOURCE TRUE
)

View File

@ -1,78 +0,0 @@
# 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
#
# http://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.
# Downloads and unpacks Abseil at configure time
set(workdir "${CMAKE_BINARY_DIR}/zlib-download")
configure_file("${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt.in"
"${workdir}/CMakeLists.txt")
execute_process(COMMAND ${CMAKE_COMMAND} -G "${CMAKE_GENERATOR}" .
RESULT_VARIABLE error
WORKING_DIRECTORY "${workdir}")
if(error)
message(FATAL_ERROR "CMake step for ${PROJECT_NAME} failed: ${error}")
endif()
execute_process(COMMAND ${CMAKE_COMMAND} --build .
RESULT_VARIABLE error
WORKING_DIRECTORY "${workdir}")
if(error)
message(FATAL_ERROR "Build step for ${PROJECT_NAME} failed: ${error}")
endif()
set(_zlib_src "${CMAKE_BINARY_DIR}/zlib-src")
set(ZLIB_FOUND TRUE)
set(ZLIB_INCLUDE_DIRS ${_zlib_src})
add_library(z STATIC
${_zlib_src}/adler32.c
${_zlib_src}/compress.c
${_zlib_src}/crc32.c
${_zlib_src}/crc32.h
${_zlib_src}/deflate.c
${_zlib_src}/deflate.h
${_zlib_src}/gzclose.c
${_zlib_src}/gzguts.h
${_zlib_src}/gzlib.c
${_zlib_src}/gzread.c
${_zlib_src}/gzwrite.c
${_zlib_src}/infback.c
${_zlib_src}/inffast.c
${_zlib_src}/inffast.h
${_zlib_src}/inffixed.h
${_zlib_src}/inflate.c
${_zlib_src}/inflate.h
${_zlib_src}/inftrees.c
${_zlib_src}/inftrees.h
${_zlib_src}/trees.c
${_zlib_src}/trees.h
${_zlib_src}/uncompr.c
${_zlib_src}/zconf.h
${_zlib_src}/zlib.h
${_zlib_src}/zutil.c
${_zlib_src}/zutil.h
)
add_library(ZLIB::ZLIB ALIAS z)
target_include_directories(z PUBLIC
${_zlib_src}
)
target_compile_options(z PRIVATE
-w
-Dverbose=-1
)
target_link_libraries(z PRIVATE
sapi::base
)