2020-01-17 21:05:03 +08:00
|
|
|
# Copyright 2019 Google LLC
|
2019-05-06 20:03:29 +08:00
|
|
|
#
|
|
|
|
# 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
|
|
|
|
#
|
2022-01-28 17:38:27 +08:00
|
|
|
# https://www.apache.org/licenses/LICENSE-2.0
|
2019-05-06 20:03:29 +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.
|
|
|
|
|
2021-01-14 01:25:25 +08:00
|
|
|
# sandboxed_api/util:file_base
|
|
|
|
add_library(sapi_util_file_base ${SAPI_LIB_TYPE}
|
|
|
|
path.cc
|
|
|
|
path.h
|
|
|
|
)
|
|
|
|
add_library(sapi::file_base ALIAS sapi_util_file_base)
|
|
|
|
target_link_libraries(sapi_util_file_base PRIVATE
|
|
|
|
absl::strings
|
|
|
|
sapi::base
|
|
|
|
)
|
|
|
|
|
|
|
|
# sandboxed_api/util:file_helpers
|
|
|
|
add_library(sapi_util_file_helpers ${SAPI_LIB_TYPE}
|
|
|
|
file_helpers.cc
|
|
|
|
file_helpers.h
|
|
|
|
)
|
|
|
|
add_library(sapi::file_helpers ALIAS sapi_util_file_helpers)
|
|
|
|
target_link_libraries(sapi_util_file_helpers PRIVATE
|
|
|
|
absl::status
|
|
|
|
absl::strings
|
|
|
|
sapi::base
|
|
|
|
)
|
|
|
|
|
|
|
|
# sandboxed_api/util:fileops
|
|
|
|
add_library(sapi_util_fileops ${SAPI_LIB_TYPE}
|
|
|
|
fileops.cc
|
|
|
|
fileops.h
|
|
|
|
)
|
|
|
|
add_library(sapi::fileops ALIAS sapi_util_fileops)
|
|
|
|
target_link_libraries(sapi_util_fileops PRIVATE
|
|
|
|
absl::strings
|
|
|
|
sapi::strerror
|
|
|
|
sapi::base
|
|
|
|
)
|
|
|
|
|
|
|
|
# sandboxed_api/util:flag
|
|
|
|
file(WRITE ${SAPI_BINARY_DIR}/sapi_util_flags_force_cxx_linkage.cc "")
|
|
|
|
add_library(sapi_util_flags ${SAPI_LIB_TYPE}
|
|
|
|
flag.h
|
|
|
|
"${SAPI_BINARY_DIR}/sapi_util_flags_force_cxx_linkage.cc"
|
|
|
|
)
|
|
|
|
add_library(sapi::flags ALIAS sapi_util_flags)
|
|
|
|
target_link_libraries(sapi_util_flags PUBLIC
|
|
|
|
glog::glog
|
|
|
|
# gflags::gflags
|
|
|
|
)
|
|
|
|
|
|
|
|
# sandboxed_api/util:raw_logging
|
|
|
|
add_library(sapi_util_raw_logging ${SAPI_LIB_TYPE}
|
|
|
|
raw_logging.cc
|
|
|
|
raw_logging.h
|
|
|
|
)
|
|
|
|
add_library(sapi::raw_logging ALIAS sapi_util_raw_logging)
|
2021-02-04 01:00:41 +08:00
|
|
|
target_link_libraries(sapi_util_raw_logging
|
|
|
|
PRIVATE absl::config
|
|
|
|
absl::str_format
|
|
|
|
absl::strings
|
|
|
|
sapi::strerror
|
|
|
|
sapi::base
|
|
|
|
INTERFACE absl::core_headers
|
2021-01-14 01:25:25 +08:00
|
|
|
)
|
|
|
|
|
|
|
|
# sandboxed_api/util:runfiles
|
|
|
|
add_library(sapi_util_runfiles ${SAPI_LIB_TYPE}
|
|
|
|
runfiles.h
|
|
|
|
runfiles_nobazel.cc
|
|
|
|
)
|
|
|
|
add_library(sapi::runfiles ALIAS sapi_util_runfiles)
|
|
|
|
target_link_libraries(sapi_util_runfiles PRIVATE
|
|
|
|
absl::str_format
|
|
|
|
absl::strings
|
|
|
|
sapi::file_base
|
|
|
|
sapi::base
|
|
|
|
sapi::flags
|
|
|
|
sapi::raw_logging
|
|
|
|
)
|
|
|
|
|
2019-05-06 20:03:29 +08:00
|
|
|
# sandboxed_api/util:status_proto
|
2020-03-19 01:47:02 +08:00
|
|
|
sapi_protobuf_generate_cpp(_sapi_util_status_pb_cc _sapi_util_status_pb_h
|
2019-05-06 20:03:29 +08:00
|
|
|
status.proto
|
|
|
|
)
|
2020-12-15 01:15:40 +08:00
|
|
|
add_library(sapi_util_status_proto ${SAPI_LIB_TYPE}
|
2019-05-06 20:03:29 +08:00
|
|
|
${_sapi_util_status_pb_cc}
|
|
|
|
${_sapi_util_status_pb_h}
|
|
|
|
)
|
|
|
|
add_library(sapi::status_proto ALIAS sapi_util_status_proto)
|
2019-07-26 20:50:45 +08:00
|
|
|
target_link_libraries(sapi_util_status_proto
|
|
|
|
PRIVATE sapi::base
|
|
|
|
PUBLIC protobuf::libprotobuf
|
2019-05-06 20:03:29 +08:00
|
|
|
)
|
|
|
|
|
|
|
|
# sandboxed_api/util:status
|
2020-12-15 01:15:40 +08:00
|
|
|
add_library(sapi_util_status ${SAPI_LIB_TYPE}
|
2021-07-27 19:09:37 +08:00
|
|
|
os_error.h
|
2019-05-06 20:03:29 +08:00
|
|
|
status.cc
|
|
|
|
status.h
|
|
|
|
status_macros.h
|
|
|
|
)
|
|
|
|
add_library(sapi::status ALIAS sapi_util_status)
|
2019-07-26 20:50:45 +08:00
|
|
|
target_link_libraries(sapi_util_status
|
|
|
|
PRIVATE absl::core_headers
|
2020-02-28 01:23:44 +08:00
|
|
|
absl::status
|
2019-07-26 20:50:45 +08:00
|
|
|
absl::strings
|
|
|
|
sapi::base
|
2021-07-27 19:09:37 +08:00
|
|
|
sapi::strerror
|
2020-02-28 01:23:44 +08:00
|
|
|
protobuf::libprotobuf
|
2019-07-26 20:50:45 +08:00
|
|
|
PUBLIC sapi::status_proto
|
2019-05-06 20:03:29 +08:00
|
|
|
)
|
|
|
|
|
2021-01-14 01:25:25 +08:00
|
|
|
# sandboxed_api/util:strerror
|
|
|
|
add_library(sapi_util_strerror ${SAPI_LIB_TYPE}
|
|
|
|
strerror.cc
|
|
|
|
strerror.h
|
2019-06-05 15:25:50 +08:00
|
|
|
)
|
2021-01-14 01:25:25 +08:00
|
|
|
add_library(sapi::strerror ALIAS sapi_util_strerror)
|
|
|
|
target_link_libraries(sapi_util_strerror PRIVATE
|
2021-05-18 20:37:10 +08:00
|
|
|
absl::str_format
|
2021-01-14 01:25:25 +08:00
|
|
|
sapi::base
|
2019-06-05 15:25:50 +08:00
|
|
|
)
|
|
|
|
|
2021-01-14 01:25:25 +08:00
|
|
|
# sandboxed_api/util:temp_file
|
|
|
|
add_library(sapi_util_temp_file ${SAPI_LIB_TYPE}
|
|
|
|
temp_file.cc
|
|
|
|
temp_file.h
|
2019-05-06 20:03:29 +08:00
|
|
|
)
|
2021-01-14 01:25:25 +08:00
|
|
|
add_library(sapi::temp_file ALIAS sapi_util_temp_file)
|
|
|
|
target_link_libraries(sapi_util_temp_file
|
|
|
|
PRIVATE absl::strings
|
|
|
|
sapi::fileops
|
2021-05-17 19:06:39 +08:00
|
|
|
sapi::status
|
2021-01-14 01:25:25 +08:00
|
|
|
sapi::strerror
|
|
|
|
sapi::base
|
|
|
|
PUBLIC absl::status
|
|
|
|
absl::statusor
|
2019-05-06 20:03:29 +08:00
|
|
|
)
|
|
|
|
|
2019-07-15 19:42:39 +08:00
|
|
|
if(SAPI_ENABLE_TESTS)
|
2021-01-14 01:25:25 +08:00
|
|
|
# sandboxed_api/util:file_base_test
|
|
|
|
add_executable(sapi_file_base_test
|
|
|
|
path_test.cc
|
|
|
|
)
|
|
|
|
set_target_properties(sapi_file_base_test PROPERTIES
|
|
|
|
OUTPUT_NAME file_base_test
|
|
|
|
)
|
|
|
|
target_link_libraries(sapi_file_base_test PRIVATE
|
|
|
|
absl::strings
|
|
|
|
sapi::file_base
|
|
|
|
sapi::test_main
|
|
|
|
)
|
|
|
|
gtest_discover_tests_xcompile(sapi_file_base_test)
|
|
|
|
|
|
|
|
# sandboxed_api/util:file_helpers_test
|
|
|
|
add_executable(sapi_file_helpers_test
|
|
|
|
file_helpers_test.cc
|
|
|
|
)
|
|
|
|
set_target_properties(sapi_file_helpers_test PROPERTIES
|
|
|
|
OUTPUT_NAME file_helpers_test
|
|
|
|
)
|
|
|
|
target_link_libraries(sapi_file_helpers_test PRIVATE
|
|
|
|
absl::strings
|
|
|
|
sapi::file_helpers
|
|
|
|
sapi::status_matchers
|
|
|
|
sapi::test_main
|
|
|
|
)
|
|
|
|
gtest_discover_tests_xcompile(sapi_file_helpers_test)
|
|
|
|
|
|
|
|
# sandboxed_api/util:fileops_test
|
|
|
|
add_executable(sapi_fileops_test
|
|
|
|
fileops_test.cc
|
|
|
|
)
|
|
|
|
set_target_properties(sapi_fileops_test PROPERTIES
|
|
|
|
OUTPUT_NAME fileops_test
|
|
|
|
)
|
|
|
|
target_link_libraries(sapi_fileops_test PRIVATE
|
|
|
|
absl::strings
|
|
|
|
sapi::file_helpers
|
|
|
|
sapi::fileops
|
|
|
|
sapi::status_matchers
|
|
|
|
sapi::test_main
|
|
|
|
sapi::testing
|
|
|
|
)
|
|
|
|
gtest_discover_tests_xcompile(sapi_fileops_test PROPERTIES
|
|
|
|
ENVIRONMENT "TEST_TMPDIR=/tmp"
|
|
|
|
ENVIRONMENT "TEST_SRCDIR=${PROJECT_BINARY_DIR}"
|
|
|
|
)
|
|
|
|
|
2019-07-15 19:42:39 +08:00
|
|
|
# sandboxed_api/util:status_matchers
|
2020-12-15 01:15:40 +08:00
|
|
|
add_library(sapi_util_status_matchers ${SAPI_LIB_TYPE}
|
2019-07-15 19:42:39 +08:00
|
|
|
status_matchers.h
|
|
|
|
)
|
|
|
|
add_library(sapi::status_matchers ALIAS sapi_util_status_matchers)
|
2019-07-30 21:48:16 +08:00
|
|
|
target_link_libraries(sapi_util_status_matchers
|
|
|
|
PRIVATE absl::optional
|
|
|
|
gmock
|
|
|
|
gtest
|
|
|
|
sapi::base
|
2020-02-28 01:23:44 +08:00
|
|
|
PUBLIC absl::status
|
|
|
|
sapi::status
|
2019-07-15 19:42:39 +08:00
|
|
|
)
|
|
|
|
|
|
|
|
# sandboxed_api/util:status_test
|
2020-12-14 17:13:03 +08:00
|
|
|
add_executable(sapi_status_test
|
2019-07-15 19:42:39 +08:00
|
|
|
status_test.cc
|
|
|
|
)
|
2020-12-14 17:13:03 +08:00
|
|
|
set_target_properties(sapi_status_test PROPERTIES OUTPUT_NAME status_test)
|
|
|
|
target_link_libraries(sapi_status_test PRIVATE
|
2021-01-14 01:25:25 +08:00
|
|
|
absl::status
|
|
|
|
absl::type_traits
|
2020-09-03 22:40:09 +08:00
|
|
|
sapi::status
|
2019-07-15 19:42:39 +08:00
|
|
|
sapi::status_matchers
|
|
|
|
sapi::test_main
|
|
|
|
)
|
2020-12-15 01:15:40 +08:00
|
|
|
gtest_discover_tests_xcompile(sapi_status_test)
|
2020-02-28 01:23:44 +08:00
|
|
|
|
2020-09-03 22:40:09 +08:00
|
|
|
# sandboxed_api/util:status_macros_test
|
2020-12-14 17:13:03 +08:00
|
|
|
add_executable(sapi_status_macros_test
|
2020-09-03 22:40:09 +08:00
|
|
|
status_macros_test.cc
|
2020-02-28 01:23:44 +08:00
|
|
|
)
|
2020-12-14 17:13:03 +08:00
|
|
|
set_target_properties(sapi_status_macros_test PROPERTIES
|
|
|
|
OUTPUT_NAME status_macros_test
|
|
|
|
)
|
|
|
|
target_link_libraries(sapi_status_macros_test PRIVATE
|
2020-09-03 22:40:09 +08:00
|
|
|
absl::status
|
|
|
|
absl::statusor
|
2020-02-28 01:23:44 +08:00
|
|
|
absl::type_traits
|
2021-01-14 01:25:25 +08:00
|
|
|
sapi::status_matchers
|
|
|
|
sapi::test_main
|
2020-02-28 01:23:44 +08:00
|
|
|
)
|
2020-12-15 01:15:40 +08:00
|
|
|
gtest_discover_tests_xcompile(sapi_status_macros_test)
|
2021-01-14 01:25:25 +08:00
|
|
|
|
|
|
|
# sandboxed_api/util:strerror
|
|
|
|
add_executable(sapi_strerror_test
|
|
|
|
strerror_test.cc
|
|
|
|
)
|
|
|
|
set_target_properties(sapi_strerror_test PROPERTIES
|
|
|
|
OUTPUT_NAME strerror_test
|
|
|
|
)
|
|
|
|
target_link_libraries(sapi_strerror_test PRIVATE
|
|
|
|
absl::strings
|
|
|
|
sapi::strerror
|
|
|
|
sapi::test_main
|
|
|
|
)
|
|
|
|
gtest_discover_tests_xcompile(sapi_strerror_test)
|
|
|
|
|
|
|
|
# sandboxed_api/util:temp_file_test
|
|
|
|
add_executable(sapi_temp_file_test
|
|
|
|
temp_file_test.cc
|
|
|
|
)
|
|
|
|
set_target_properties(sapi_temp_file_test PROPERTIES
|
|
|
|
OUTPUT_NAME temp_file_test
|
|
|
|
)
|
|
|
|
target_link_libraries(sapi_temp_file_test PRIVATE
|
|
|
|
sapi::file_base
|
|
|
|
sapi::fileops
|
|
|
|
sapi::status_matchers
|
|
|
|
sapi::temp_file
|
|
|
|
sapi::test_main
|
|
|
|
sapi::testing
|
|
|
|
)
|
|
|
|
gtest_discover_tests_xcompile(sapi_temp_file_test)
|
2019-07-15 19:42:39 +08:00
|
|
|
endif()
|