Newer
Older
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
project('ca-tango-db-cache-mgr', 'cpp', version : '1.0.0',
default_options : ['c_std=c17', 'cpp_std=c++17'])
project_description = 'Connect to tango attribute configuration change events to update the database cache'
srv_version = meson.project_version() # set in project()
# enable pinfo cuprintf
cpp_arguments = [ '-DCUMBIA_DEBUG_OUTPUT=1', '-DCATANGODBCACHEMGR_VERSION="' + srv_version + '"' ]
openssldep = dependency('openssl')
curldep = dependency('libcurl')
# for activities / threads
cumbiadep = dependency('cumbia', version: '>=1.4.0')
systemd_dep = dependency('systemd')
caserverlib_dep = dependency('caserver-lib')
redisdep = dependency('redis++')
nlohmann_json_dep = dependency('nlohmann_json', required : false)
if not nlohmann_json_dep.found()
message('nlohmann_json installation not found: trying subproject method')
message('refer to https://gitlab.com/PWMA/canone3/-/blob/master/nchan-setup/ubuntu-install.md')
# nlohmann_json dependency is added as subdir 'nlohmann-json-include'
nlohmann_json_proj = subproject('nlohmann-json-include')
nlohmann_json_dep = nlohmann_json_proj.get_variable('nlohmann_json_dep')
endif
# tango library
tangodep = dependency('tango')
includedirs = include_directories('src')
deps = [ dependency('threads'),
openssldep,
tangodep,
nlohmann_json_dep,
curldep,
cumbiadep,
caserverlib_dep,
systemd_dep,
redisdep ]
##
### Systemd section
### please edit meson_options.txt in the root dir
##
if systemd_dep.found()
deps += systemd_dep
servicedir = get_option('systemd_service_dir')
if servicedir == ''
servicedir = systemd_dep.get_pkgconfig_variable('systemdsystemunitdir')
endif
message('systemd dir: ' + servicedir)
# ca-tango-db-cache-mgr.service.in
# @prefix@/bin/caserver -p @default_port@ -u "@default_nginx_url@ -a @auth_url@
sysd_conf = configuration_data()
sysd_conf.set('prefix', get_option('prefix'))
sysd_conf.set('user', get_option('user'))
if(get_option('logfile') != '')
if (get_option('logfile') != 'console' and get_option('logfile') != 'syslog')
sysd_conf.set('logfile', join_paths(get_option('prefix'), get_option('logdir'), get_option('logfile')))
else
sysd_conf.set('logfile', get_option('logfile'))
endif
endif
if(get_option('loglev') != '')
sysd_conf.set('log_level', get_option('loglev'))
endif
if(get_option('port') != '')
sysd_conf.set('port', get_option('port'))
endif
if(get_option('address') != '')
sysd_conf.set('address', get_option('address'))
endif
if get_option('conf_file') != ''
sysd_conf.set('conf_file', '-c ' + join_paths( get_option('prefix'), get_option('conf_dir'), get_option('conf_file')))
endif
systemd_unit = configure_file(install_dir: servicedir,
configuration : sysd_conf,
input : 'ca-tango-db-cache-mgr.service.in',
output : 'ca-tango-db-cache-mgr.service')
endif
##
### end systemd section
##
if get_option('conf_file') != ''
install_data(get_option('conf_file'), install_dir : join_paths( get_option('prefix'), get_option('conf_dir')))
endif
headers = [
'src/config.h',
'src/ca-tango-db-cache-mgr.h',
'src/casupjsoniz.h',
'src/casupcurl.h',
'src/catdbcacheu.h',
'src/catdbcaredisu.h'
]
sources = [
'src/ca-tango-db-cache-mgr.cpp',
'src/main.cpp',
'src/casupjsoniz.cpp',
'src/casupcurl.cpp',
'src/catdbcacheu.cpp',
'src/catdbcaredisu.cpp'
]
executable('ca-tango-db-cache-mgr',
sources, dependencies : deps, cpp_args : cpp_arguments,
include_directories : includedirs,
install : true)
### ====================================== documentation ===========================
doxygen = find_program('doxygen', required : false)
if not doxygen.found()
error('MESON_SKIP_TEST doxygen not found.')
endif
doxydata = configuration_data()
doxydata.set('VERSION', meson.project_version())
if find_program('dot', required : false).found()
# In the real world this would set the variable
# to YES. However we set it to NO so that the
# list of generated files is always the same
# so tests always pass.
doxydata.set('HAVE_DOT', 'YES')
else
doxydata.set('HAVE_DOT', 'NO')
endif
message('\n\033[1;32m*\n*\033[0m enable subdir(\'doc\') in meson.build to generate documentation\n\033[1;32m*\033[0m\n')
# subdir('doc')