CMake targets for SAPI, add find_package() support for libffi

This change adds CMake targets for the actual Sandboxed API library. On its
own, this is not very useful, as there is no CMake equivalent to the
sapi_library() rule, yet. This will be worked on next.

PiperOrigin-RevId: 257177362
Change-Id: Ic06c945ab534b27306021d970a83691aae2e7e60
This commit is contained in:
Christian Blichmann 2019-07-09 06:12:49 -07:00 committed by Copybara-Service
parent b5d85f5e56
commit 6b24025860
2 changed files with 135 additions and 1 deletions

View File

@ -71,9 +71,10 @@ endif()
find_package(gflags REQUIRED) find_package(gflags REQUIRED)
find_package(glog REQUIRED) find_package(glog REQUIRED)
find_package(Protobuf REQUIRED)
find_package(Libcap REQUIRED) find_package(Libcap REQUIRED)
find_package(Libffi REQUIRED)
find_package(ZLIB REQUIRED) find_package(ZLIB REQUIRED)
find_package(Protobuf REQUIRED)
set(CMAKE_FIND_LIBRARY_SUFFIXES ${_sapi_saved_CMAKE_FIND_LIBRARY_SUFFIXES}) set(CMAKE_FIND_LIBRARY_SUFFIXES ${_sapi_saved_CMAKE_FIND_LIBRARY_SUFFIXES})

View File

@ -16,6 +16,20 @@ add_subdirectory(bazel) # For filewrapper
add_subdirectory(sandbox2) add_subdirectory(sandbox2)
add_subdirectory(util) add_subdirectory(util)
# sandboxed_api:proto_arg
sapi_protobuf_generate_cpp(_sapi_proto_arg_pb_cc _sapi_proto_arg_pb_h
proto_arg.proto
)
add_library(sapi_proto_arg_proto STATIC
${_sapi_proto_arg_pb_cc}
${_sapi_proto_arg_pb_h}
)
add_library(sapi::proto_arg_proto ALIAS sapi_proto_arg_proto)
target_link_libraries(sapi_proto_arg_proto PRIVATE
protobuf::libprotobuf
sapi::base
)
# sandboxed_api:embed_file # sandboxed_api:embed_file
add_library(sapi_embed_file STATIC add_library(sapi_embed_file STATIC
embed_file.cc embed_file.cc
@ -35,3 +49,122 @@ target_link_libraries(sapi_embed_file PRIVATE
sapi::raw_logging sapi::raw_logging
sapi::status sapi::status
) )
# sandboxed_api:sapi
add_library(sapi_sapi STATIC
sandbox.cc
sandbox.h
transaction.cc
transaction.h
)
add_library(sapi::sapi ALIAS sapi_sapi)
target_link_libraries(sapi_sapi PRIVATE
absl::core_headers
absl::flat_hash_map
absl::memory
absl::str_format
absl::strings
absl::synchronization
sandbox2::bpf_helper
sandbox2::client
sandbox2::file_base
sandbox2::fileops
sandbox2::runfiles
sandbox2::sandbox2
sandbox2::strerror
sandbox2::util
sapi::base
sapi::embed_file
sapi::status
sapi::vars
)
# sandboxed_api:call
add_library(sapi_call STATIC
call.h
)
add_library(sapi::call ALIAS sapi_call)
target_link_libraries(sapi_call PRIVATE
absl::core_headers
sapi::var_type
sapi::base
)
# sandboxed_api:lenval_core
add_library(sapi_lenval_core STATIC
lenval_core.h
)
add_library(sapi::lenval_core ALIAS sapi_lenval_core)
target_link_libraries(sapi_lenval_core PRIVATE
sapi::base
)
# sandboxed_api:var_type
add_library(sapi_var_type STATIC
var_type.h
)
add_library(sapi::var_type ALIAS sapi_var_type)
target_link_libraries(sapi_var_type PRIVATE
sapi::base
)
# sandboxed_api:vars
add_library(sapi_vars STATIC
proto_helper.h
rpcchannel.cc
rpcchannel.h
var_abstract.cc
var_abstract.h
var_array.h
var_int.cc
var_int.h
var_lenval.cc
var_lenval.h
var_pointable.cc
var_pointable.h
var_proto.h
var_ptr.h
var_reg.h
var_struct.h
var_void.h
vars.h
)
add_library(sapi::vars ALIAS sapi_vars)
target_link_libraries(sapi_vars PRIVATE
absl::core_headers
absl::str_format
absl::strings
absl::synchronization
glog::glog
sandbox2::comms
sapi::base
sapi::call
sapi::lenval_core
sapi::proto_arg_proto
sapi::status
sapi::statusor
sapi::var_type
)
# sandboxed_api:client
add_library(sapi_client STATIC
client.cc
)
add_library(sapi::client ALIAS sapi_client)
target_link_libraries(sapi_client PRIVATE
absl::core_headers
absl::strings
glog::glog
libffi::libffi
sandbox2::client
sandbox2::comms
sandbox2::forkingclient
sapi::base
sapi::call
sapi::flags
sapi::lenval_core
sapi::vars
)
# sandboxed_api:sapi_test
# TODO(cblichmann): Add sapi_test once generator can be invoked via CMake