diff options
author | Kane York <kanepyork@gmail.com> | 2020-08-04T23·44-0700 |
---|---|---|
committer | kanepyork <rikingcoding@gmail.com> | 2020-08-05T04·11+0000 |
commit | 3c3527e16bf1d0bf57207dcc54975534f5252225 (patch) | |
tree | 43eae1e4f72dee522fedbb2375da4f8b7103e8ca /third_party/nix/src/libstore/CMakeLists.txt | |
parent | 28c7e926ea48e4f5e57b9b8d1a70ccc494b2c188 (diff) |
feat(3p/nix): add MockBinaryCacheStore r/1595
This adds an implementation of BinaryCacheStore to be used by tests exercising both the logic inherent to BinaryCacheStore and more general Store tests. A new library target, nixstoremock, is created to indicate that this file is intended only for use in tests and not in user-facing code. Change-Id: Ib68f777238843a4f3a2303db8a69735fbc22d161 Reviewed-on: https://cl.tvl.fyi/c/depot/+/1645 Tested-by: BuildkiteCI Reviewed-by: glittershark <grfn@gws.fyi>
Diffstat (limited to 'third_party/nix/src/libstore/CMakeLists.txt')
-rw-r--r-- | third_party/nix/src/libstore/CMakeLists.txt | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/third_party/nix/src/libstore/CMakeLists.txt b/third_party/nix/src/libstore/CMakeLists.txt index 4bfbb165f6b2..246377cc9b8d 100644 --- a/third_party/nix/src/libstore/CMakeLists.txt +++ b/third_party/nix/src/libstore/CMakeLists.txt @@ -1,8 +1,11 @@ # -*- mode: cmake; -*- add_library(nixstore SHARED) +add_library(nixstoremock SHARED) set_property(TARGET nixstore PROPERTY CXX_STANDARD 17) +set_property(TARGET nixstoremock PROPERTY CXX_STANDARD 17) include_directories(${PROJECT_BINARY_DIR}) # for config.h target_include_directories(nixstore PUBLIC "${nix_SOURCE_DIR}/src") +target_include_directories(nixstoremock PUBLIC "${nix_SOURCE_DIR}/src") # The database schema is stored in schema.sql, but needs to be # available during the build as static data. @@ -101,8 +104,24 @@ target_link_libraries(nixstore sodium ) +target_sources(nixstoremock + PUBLIC + mock-binary-cache-store.hh + + PRIVATE + mock-binary-cache-store.cc +) + +target_link_libraries(nixstoremock + nixstore + + absl::btree + absl::flat_hash_map + glog +) + configure_file("nix-store.pc.in" "${PROJECT_BINARY_DIR}/nix-store.pc" @ONLY) INSTALL(FILES "${PROJECT_BINARY_DIR}/nix-store.pc" DESTINATION "${PKGCONFIG_INSTALL_DIR}") INSTALL(FILES ${HEADER_FILES} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/nix/libstore) -INSTALL(TARGETS nixstore DESTINATION ${CMAKE_INSTALL_LIBDIR}) +INSTALL(TARGETS nixstore nixstoremock DESTINATION ${CMAKE_INSTALL_LIBDIR}) |