Welcome to mirror list, hosted at ThFree Co, Russian Federation.

CMakeLists.txt « stored « src « core - github.com/bareos/bareos.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 3a5e112911d5481aa64b312c18468fb19c8a4222 (plain)
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
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
#   BAREOS® - Backup Archiving REcovery Open Sourced
#
#   Copyright (C) 2017-2022 Bareos GmbH & Co. KG
#
#   This program is Free Software; you can redistribute it and/or
#   modify it under the terms of version three of the GNU Affero General Public
#   License as published by the Free Software Foundation and included
#   in the file LICENSE.
#
#   This program is distributed in the hope that it will be useful, but
#   WITHOUT ANY WARRANTY; without even the implied warranty of
#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
#   Affero General Public License for more details.
#
#   You should have received a copy of the GNU Affero General Public License
#   along with this program; if not, write to the Free Software
#   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
#   02110-1301, USA.
message("Entering ${CMAKE_CURRENT_SOURCE_DIR}")

if(HAVE_WIN32)
  include_directories(
    ${PROJECT_SOURCE_DIR}/src/win32/generic
    ${PROJECT_SOURCE_DIR}/src/win32/stored
    ${PROJECT_SOURCE_DIR}/src/stored/backends
  )
endif()

# BACKENDS  ####
if(NOT build_client_only)
  set(BACKENDS "")
  list(APPEND BACKENDS unix_tape_device.d)
  list(APPEND BACKENDS unix_fifo_device.d)
  if(${HAVE_GLUSTERFS})
    list(APPEND BACKENDS gfapi_device.d)
  endif()
  if(TARGET droplet)
    list(APPEND BACKENDS droplet_device.d)
  endif()
  set(BACKENDS
      ${BACKENDS}
      PARENT_SCOPE
  )
  message("Backends are now ${BACKENDS}")
endif()

set(LIBBAREOSSD_SRCS
    acquire.cc
    ansi_label.cc
    askdir.cc
    autochanger.cc
    autochanger_resource.cc
    block.cc
    bsr.cc
    butil.cc
    crc32/crc32.cc
    dev.cc
    device.cc
    device_control_record.cc
    device_resource.cc
    ebcdic.cc
    label.cc
    lock.cc
    mount.cc
    read_record.cc
    record.cc
    reserve.cc
    scan.cc
    sd_backends.cc
    sd_device_control_record.cc
    sd_plugins.cc
    sd_stats.cc
    spool.cc
    stored_globals.cc
    stored_conf.cc
    vol_mgr.cc
    wait.cc
)

set(SDSRCS
    append.cc
    askdir.cc
    authenticate.cc
    dir_cmd.cc
    fd_cmds.cc
    job.cc
    mac.cc
    ndmp_tape.cc
    read.cc
    sd_cmds.cc
    sd_stats.cc
    socket_server.cc
    status.cc
)

if(HAVE_WIN32)
  list(APPEND SDSRCS ../win32/generic/main.cc ../win32/generic/service.cc
       ../win32/stored/storedres.rc
  )
endif()

set(BTAPESRCS btape.cc)
if(HAVE_WIN32)
  list(APPEND BTAPESRCS ../win32/stored/btaperes.rc)
endif()

set(BLSSRCS bls.cc)
if(HAVE_WIN32)
  list(APPEND BLSSRCS ../win32/stored/blsres.rc)
endif()

set(BEXTRACTSRS bextract.cc)
if(HAVE_WIN32)
  list(APPEND BEXTRACTSRS ../win32/stored/bextractres.rc)
endif()

set(BSCANSRCS bscan.cc)
if(HAVE_WIN32)
  list(APPEND BSCANSRCS ../win32/stored/bscanres.rc)
endif()

set(BCOPYSRCS bcopy.cc)

set(STORED_RESTYPES autochanger device director ndmp messages storage)

set(BACKEND_OBJECTS "") # backend shared objects

if(${HAVE_DYNAMIC_SD_BACKENDS})
  if(GFAPI_LIBRARIES)
    list(APPEND BACKEND_OBJECTS libbareossd-gfapi)
  endif()

  if(TARGET droplet)
    list(APPEND BACKEND_OBJECTS libbareossd-droplet)
    list(APPEND BACKEND_OBJECTS libbareossd-chunked)
  endif()

  set(LIBBAREOSSD_LIBRARIES bareos Threads::Threads ${BACKEND_OBJECTS})
  message(STATUS "BACKEND_OBJECTS ARE ${BACKEND_OBJECTS}")
else()
  if(TARGET droplet)
    list(APPEND LIBBAREOSSD_LIBRARIES droplet)
  endif()
  if(${HAVE_GFAPI})
    list(APPEND LIBBAREOSSD_LIBRARIES ${GFAPI_LIBRARIES})
  endif()
  set(LIBBAREOSSD_LIBRARIES bareos ${LIBBAREOSSD_LIBRARIES})
  message(STATUS "LIBBAREOSSD_LIBRARIES ARE ${LIBBAREOSSD_LIBRARIES}")
endif()

add_library(bareossd SHARED ${LIBBAREOSSD_SRCS})
target_link_libraries(bareossd PRIVATE bareos Threads::Threads)
set_target_properties(
  bareossd PROPERTIES VERSION "${BAREOS_NUMERIC_VERSION}"
                      SOVERSION "${BAREOS_VERSION_MAJOR}"
)

if(NOT ${HAVE_DYNAMIC_SD_BACKENDS})
  target_link_libraries(bareossd PRIVATE ${LIBBAREOSSD_LIBRARIES})
endif()

add_library(stored_objects STATIC ${SDSRCS})
add_executable(bareos-sd stored.cc)

target_link_libraries(
  bareos-sd PRIVATE stored_objects bareos bareossd bareosfind Threads::Threads
                    CLI11::CLI11
)

if(HAVE_WIN32)
  target_sources(bareos-sd PRIVATE ../win32/generic/main.cc)
  target_link_libraries(bareos-sd PRIVATE comctl32)
endif()
if(HAVE_NDMP)
  target_link_libraries(stored_objects PRIVATE bareosndmp)
  target_link_libraries(bareos-sd PRIVATE bareosndmp)
endif()

add_executable(bls ${BLSSRCS})
target_link_libraries(bls PRIVATE bareos bareossd bareosfind CLI11::CLI11)

add_executable(bextract ${BEXTRACTSRS})
target_link_libraries(bextract PRIVATE bareossd bareosfind bareos CLI11::CLI11)

add_executable(bscan ${BSCANSRCS})
target_link_libraries(
  bscan PRIVATE bareos bareossd bareosfind bareossql CLI11::CLI11
)

add_executable(btape ${BTAPESRCS})
target_link_libraries(btape PRIVATE bareossd bareos CLI11::CLI11)

add_executable(bcopy ${BCOPYSRCS})

target_link_libraries(bcopy PRIVATE bareossd bareos CLI11::CLI11)

install(TARGETS bareossd DESTINATION ${libdir})

install(TARGETS bareos-sd bls bextract bscan btape bcopy
        DESTINATION "${sbindir}"
)

install(CODE "set(BACKENDS \"${BACKENDS}\")")
install(CODE "set(configtemplatedir \"${configtemplatedir}\")")
install(CODE "set(SRC_DIR \"${PROJECT_SOURCE_DIR}\")")
install(SCRIPT ${PROJECT_SOURCE_DIR}/cmake/install-stored-configfiles.cmake)

install(DIRECTORY DESTINATION "${archivedir}")

add_subdirectory(backends)

if(TARGET droplet)
  target_compile_definitions(bareossd PRIVATE HAVE_BAREOSSD_DROPLET_DEVICE)
endif()