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 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')