/
CMakeLists.txt
148 lines (136 loc) · 4.84 KB
/
CMakeLists.txt
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
# BAREOS® - Backup Archiving REcovery Open Sourced
#
# Copyright (C) 2020-2024 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)
include(BareosConfigureFile)
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(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(Python3_FOUND)
add_library(bareosfd-python3-module MODULE module/bareosfd.cc)
install(
TARGETS bareosfd-python3-module
DESTINATION ${Python3_SITEARCH}
COMPONENT filedaemon
)
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}"
CXX_STANDARD 17
)
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()
bareos_configure_file(GLOB_RECURSE "ldap/python-ldap-conf.d/*" COPY)
set(PYFILES
pyfiles/BareosFdPluginBaseclass.py
pyfiles/BareosFdWrapper.py
pyfiles/BareosFdPluginLocalFilesBaseclass.py
pyfiles/bareos-fd-local-fileset.py
ldap/bareos-fd-ldap.py
mariabackup/bareos-fd-mariabackup.py
percona-xtrabackup/bareos-fd-percona-xtrabackup.py
postgresql/bareos-fd-postgresql.py
vmware/bareos-fd-vmware.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
)
include(DebugEdit)