• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright 2023 Google LLC
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7#      http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14
15add_library(nearby_protocol nearby_protocol.cc)
16
17target_link_libraries(nearby_protocol
18        "${NEARBY_ROOT}/target/release/${CMAKE_STATIC_LIBRARY_PREFIX}np_c_ffi${CMAKE_STATIC_LIBRARY_SUFFIX}"
19        absl::statusor)
20
21target_include_directories(nearby_protocol PUBLIC
22        include/
23        ${CMAKE_SOURCE_DIR}/np_c_ffi/include/cpp/)
24
25target_include_directories(nearby_protocol PRIVATE
26        ${CMAKE_SOURCE_DIR}/np_c_ffi/include/cpp/internal/)
27
28add_subdirectory(sample)
29
30# shared testing utilities between sample, tests, and fuzzers
31add_library(shared_test_util shared/shared_test_util.cc)
32target_include_directories(shared_test_util PUBLIC shared/)
33target_include_directories(shared_test_util PRIVATE include/)
34target_link_libraries(shared_test_util nearby_protocol absl::statusor)
35
36if (ENABLE_TESTS)
37    message(STATUS "Enabling np_ffi tests")
38    add_subdirectory(tests)
39    add_subdirectory(benchmarks)
40endif ()
41
42if (ENABLE_FUZZ)
43    message(STATUS "Enabling np_ffi fuzzers")
44    add_subdirectory(fuzz)
45endif ()
46