blob: 246377cc9b8d4f26687b8d72026c9b26b36958c1 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
|
# -*- 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.
#
# These commands create an includeable source-file out of it.
file(READ "schema.sql" NIX_SCHEMA)
string(CONFIGURE
"#pragma once
namespace nix {
constexpr char kNixSqlSchema[] = R\"(${NIX_SCHEMA})\";
}"
NIX_SCHEMA_GEN)
file(WRITE ${PROJECT_BINARY_DIR}/generated/schema.sql.hh "${NIX_SCHEMA_GEN}")
set(HEADER_FILES
binary-cache-store.hh
builtins.hh
crypto.hh
derivations.hh
download.hh
fs-accessor.hh
globals.hh
local-store.hh
machines.hh
nar-accessor.hh
nar-info-disk-cache.hh
nar-info.hh
parsed-derivations.hh
pathlocks.hh
profiles.hh
references.hh
remote-fs-accessor.hh
remote-store.hh
rpc-store.hh
s3-binary-cache-store.hh
s3.hh
serve-protocol.hh
sqlite.hh
ssh.hh
store-api.hh
worker-protocol.hh
)
target_sources(nixstore
PUBLIC
${HEADER_FILES}
PRIVATE
${PROJECT_BINARY_DIR}/generated/schema.sql.hh
binary-cache-store.cc
build.cc
crypto.cc
derivations.cc
download.cc
export-import.cc
gc.cc
globals.cc
http-binary-cache-store.cc
legacy-ssh-store.cc
local-binary-cache-store.cc
local-fs-store.cc
local-store.cc
machines.cc
misc.cc
nar-accessor.cc
nar-info.cc
nar-info-disk-cache.cc
optimise-store.cc
parsed-derivations.cc
pathlocks.cc
profiles.cc
references.cc
remote-fs-accessor.cc
remote-store.cc
rpc-store.cc
s3-binary-cache-store.cc
sqlite.cc
ssh.cc
ssh-store.cc
store-api.cc
builtins/buildenv.cc
builtins/fetchurl.cc
)
target_link_libraries(nixstore
nixproto
nixutil
CURL::libcurl
SQLite::SQLite3
absl::strings
glog
seccomp
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 nixstoremock DESTINATION ${CMAKE_INSTALL_LIBDIR})
|