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

CMakeLists.txt « python « filed « plugins « src « core - github.com/bareos/bareos.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 08af03d73a5cc07fbf3e0ffe5ac3889aef0d6a55 (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
215
216
217
218
219
220
221
222
223
224
225
226
227
228
#   BAREOS® - Backup Archiving REcovery Open Sourced
#
#   Copyright (C) 2020-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.

include(BareosDisableWarnings)

if(Python2_FOUND)
  add_library(python-fd MODULE python-fd.cc)
  set_target_properties(
    python-fd PROPERTIES PREFIX "" LIBRARY_OUTPUT_DIRECTORY ..
  )
  install(
    TARGETS python-fd
    DESTINATION ${plugindir}
    COMPONENT filedaemon
  )
  target_link_libraries(python-fd ${Python2_LIBRARIES} bareos)
  target_include_directories(python-fd PUBLIC ${Python2_INCLUDE_DIRS})
  target_compile_definitions(python-fd PUBLIC PY2MODDIR=\"${Python2_SITEARCH}\")
  target_compile_options(python-fd PUBLIC ${Python2_CCSHARED})
  add_dependencies(bareos-fd python-fd)
  add_dependencies(python-fd bareosfd-python2-module)
endif()

if(Python3_FOUND)
  add_library(python3-fd MODULE python-fd.cc)
  set_target_properties(
    python3-fd PROPERTIES PREFIX "" LIBRARY_OUTPUT_DIRECTORY ..
  )
  install(
    TARGETS python3-fd
    DESTINATION ${plugindir}
    COMPONENT filedaemon
  )
  target_link_libraries(python3-fd ${Python3_LIBRARIES} bareos)
  target_include_directories(python3-fd PUBLIC ${Python3_INCLUDE_DIRS})
  target_compile_definitions(
    python3-fd PUBLIC PY3MODDIR=\"${Python3_SITEARCH}\"
  )
  add_dependencies(bareos-fd python3-fd)
  add_dependencies(python3-fd bareosfd-python3-module)
endif()

if(Python2_FOUND)
  add_executable(bareosfd-python2-module-tester test/python-fd-module-tester.cc)
  target_link_libraries(
    bareosfd-python2-module-tester ${Python2_LIBRARIES} bareos
  )
  target_include_directories(
    bareosfd-python2-module-tester PUBLIC ${Python2_INCLUDE_DIRS}
  )
  target_compile_options(
    bareosfd-python2-module-tester PUBLIC ${Python2_CCSHARED}
  )
  add_test(NAME bareosfd-python2-module-tester
           COMMAND ${CMAKE_CURRENT_BINARY_DIR}/bareosfd-python2-module-tester
  )
  set_property(
    TEST bareosfd-python2-module-tester
    PROPERTY
      ENVIRONMENT
      PYTHONPATH=${CMAKE_CURRENT_SOURCE_DIR}/test/:${CMAKE_CURRENT_BINARY_DIR}/pythonmodules:${CMAKE_CURRENT_SOURCE_DIR}/pyfiles
      "LSAN_OPTIONS=fast_unwind_on_malloc=0 suppressions=${CMAKE_CURRENT_SOURCE_DIR}/test/lsan-suppressions.txt"
  )
  if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
    set_property(TEST bareosfd-python2-module-tester PROPERTY DISABLED true)
  endif()
endif()

if(Python3_FOUND AND NOT HAVE_WIN32)
  add_executable(bareosfd-python3-module-tester test/python-fd-module-tester.cc)
  target_link_libraries(
    bareosfd-python3-module-tester ${Python3_LIBRARIES} bareos
  )
  target_include_directories(
    bareosfd-python3-module-tester PUBLIC ${Python3_INCLUDE_DIRS}
  )

  add_test(NAME bareosfd-python3-module-tester
           COMMAND ${CMAKE_CURRENT_BINARY_DIR}/bareosfd-python3-module-tester
  )
  set_property(
    TEST bareosfd-python3-module-tester
    PROPERTY
      ENVIRONMENT
      PYTHONPATH=${CMAKE_CURRENT_SOURCE_DIR}/test/:${CMAKE_CURRENT_BINARY_DIR}/python3modules:${CMAKE_CURRENT_SOURCE_DIR}/pyfiles
      "LSAN_OPTIONS=fast_unwind_on_malloc=0 suppressions=${CMAKE_CURRENT_SOURCE_DIR}/test/lsan-suppressions.txt"
  )
endif()

if(Python2_FOUND)
  add_library(bareosfd-python2-module MODULE module/bareosfd.cc)
  install(TARGETS bareosfd-python2-module DESTINATION ${Python2_SITEARCH})
  set_target_properties(
    bareosfd-python2-module
    PROPERTIES PREFIX ""
               C_STANDARD 11
               # SUFFIX ${Python2_EXT_SUFFIX}
               LIBRARY_OUTPUT_DIRECTORY pythonmodules
               LIBRARY_OUTPUT_NAME bareosfd
               LINK_FLAGS "${Python2_BLDSHARED_FLAGS}"
               LINKER_LANGUAGE CXX
               INCLUDE_DIRECTORIES "${pymod2_include_dirs}"
  )
  target_compile_options(bareosfd-python2-module PUBLIC -fno-strict-aliasing)
  if(NOT "${Python2_CCSHARED}" STREQUAL "")
    target_compile_options(bareosfd-python2-module PUBLIC ${Python2_CCSHARED})
  endif()
  bareos_disable_warnings(
    TARGET bareosfd-python2-module WARNINGS -Wc99-designator
  )
  target_link_libraries(bareosfd-python2-module bareos ${Python2_LIBRARIES})

  add_test(NAME bareosfd-python2-module
           COMMAND ${Python2_EXECUTABLE}
                   ${CMAKE_CURRENT_SOURCE_DIR}/test/bareosfd_test.py
  )
  set_property(
    TEST bareosfd-python2-module
    PROPERTY
      ENVIRONMENT
      "PYTHONPATH=${CMAKE_CURRENT_BINARY_DIR}/pythonmodules:${CMAKE_CURRENT_SOURCE_DIR}/test"
      LD_LIBRARY_PATH=${CMAKE_CURRENT_BINARY_DIR}/../../../lib
      "ASAN_OPTIONS=detect_leaks=0 verify_asan_link_order=0"
  )
  set_tests_properties(bareosfd-python2-module PROPERTIES LABELS "broken")
endif()

if(Python3_FOUND)
  add_library(bareosfd-python3-module MODULE module/bareosfd.cc)
  install(TARGETS bareosfd-python3-module DESTINATION ${Python3_SITEARCH})
  set_target_properties(
    bareosfd-python3-module
    PROPERTIES PREFIX ""
               C_STANDARD 11
               SUFFIX ${Python3_EXT_SUFFIX}
               LIBRARY_OUTPUT_DIRECTORY python3modules
               LIBRARY_OUTPUT_NAME bareosfd
               LINK_FLAGS "${Python3_BLDSHARED_FLAGS}"
               LINKER_LANGUAGE CXX
               INCLUDE_DIRECTORIES "${pymod3_include_dirs}"
  )
  target_compile_options(bareosfd-python3-module PUBLIC -fno-strict-aliasing)
  if(NOT "${Python3_CCSHARED}" STREQUAL "")
    set_property(
      TARGET bareosfd-python3-module PROPERTY COMPILE_OPTIONS
                                              ${Python3_CCSHARED}
    )
  endif()
  bareos_disable_warnings(
    TARGET bareosfd-python3-module WARNINGS -Wc99-designator
  )
  target_link_libraries(bareosfd-python3-module bareos ${Python3_LIBRARIES})

  add_test(NAME bareosfd-python3-module
           COMMAND ${Python3_EXECUTABLE}
                   ${CMAKE_CURRENT_SOURCE_DIR}/test/bareosfd_test.py
  )

  set_property(
    TEST bareosfd-python3-module
    PROPERTY
      ENVIRONMENT
      "PYTHONPATH=${CMAKE_CURRENT_BINARY_DIR}/python3modules:${CMAKE_CURRENT_SOURCE_DIR}/test"
      LD_LIBRARY_PATH=${CMAKE_CURRENT_BINARY_DIR}/../../../lib
      "ASAN_OPTIONS=detect_leaks=0 verify_asan_link_order=0"
  )
  add_test(
    NAME python-simple-test-example
    COMMAND python ${CMAKE_CURRENT_SOURCE_DIR}/test/simple-test-example.py
    WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/test
  )
  set_property(
    # add current directory for documentation only
    TEST python-simple-test-example PROPERTY ENVIRONMENT PYTHONPATH=./
  )
  set_property(TEST python-simple-test-example PROPERTY DISABLED true)
endif()

set(PYFILES
    pyfiles/BareosFdPluginBaseclass.py
    pyfiles/BareosFdWrapper.py
    pyfiles/BareosFdPluginLocalFileset.py
    pyfiles/BareosFdPluginLocalFilesBaseclass.py
    pyfiles/bareos-fd-local-fileset.py
    ldap/bareos-fd-ldap.py
    ldap/BareosFdPluginLDAP.py
    mariabackup/BareosFdPluginMariabackup.py
    mariabackup/bareos-fd-mariabackup.py
    ovirt/bareos-fd-ovirt.py
    ovirt/BareosFdPluginOvirt.py
    percona-xtrabackup/bareos-fd-percona-xtrabackup.py
    percona-xtrabackup/BareosFdPluginPerconaXtraBackup.py
    postgres/bareos-fd-postgres.py
    postgres/BareosFdPluginPostgres.py
    vmware/bareos-fd-vmware.py
    vmware/BareosFdPluginVMware.py
    libcloud/BareosLibcloudApi.py
    libcloud/bareos-fd-libcloud.py
    libcloud/BareosFdPluginLibcloud.py
)

install(
  FILES ${PYFILES}
  DESTINATION ${plugindir}
  COMPONENT filedaemon
)

install(
  DIRECTORY libcloud/bareos_libcloud_api
  DESTINATION ${plugindir}
  COMPONENT filedaemon
)