Skip to content
Snippets Groups Projects
meson.build 3.12 KiB
Newer Older
  • Learn to ignore specific revisions
  • project('EMPER', 'c', 'cpp',
    		version: '0.0.1-alpha1-SNAPSHOT',
    		default_options : [
    		  'warning_level=3',
    		  'c_std=gnu11',
    
    		  'cpp_std=c++2a',
    
    		  'b_ndebug=if-release',
    		  'werror=true',
    		])
    
    thread_dep = dependency('threads')
    
    uring_dep = dependency('liburing')
    emper_dependencies = [thread_dep, uring_dep]
    
    boost_thread_dep = dependency('boost', modules : ['thread'], required: false)
    
    
    tools_dir = join_paths(meson.source_root(), 'tools')
    
    
    		   command: join_paths(tools_dir, 'check-iwyu'))
    
    conf_data = configuration_data()
    
    option_urcu = get_option('userspace_rcu')
    
    conf_data.set('EMPER_LIBURCU', option_urcu)
    if option_urcu
    	liburcu_dep = dependency('liburcu')
    	emper_dependencies += [liburcu_dep]
    endif
    
    
    cpp_compiler = meson.get_compiler('cpp')
    if cpp_compiler.has_header('compare')
      conf_data.set('EMPER_HAS_COMPARE_H', true)
    endif
    
    
    conf_data.set('EMPER_WORKER_SLEEP', get_option('worker_sleep'))
    
    conf_data.set('EMPER_WORKER_WAKEUP_STRATEGY', get_option('worker_wakeup_strategy'))
    
    conf_data.set('EMPER_LOCKED_WS_QUEUE', get_option('locked_ws_queue'))
    conf_data.set('EMPER_LOCKED_MPSC_QUEUE', get_option('locked_mpsc_queue'))
    
    conf_data.set('EMPER_OVERFLOW_QUEUE', get_option('overflow_queue'))
    
    conf_data.set('EMPER_STATS', get_option('stats'))
    
    conf_data.set('EMPER_OVERFLOW_QUEUE', get_option('overflow_queue'))
    
    conf_data.set('EMPER_BLOCKED_CONTEXT_SET', get_option('blocked_context_set'))
    
    semaphore_impl = get_option('wakeup_semaphore_implementation')
    conf_data.set('EMPER_' + semaphore_impl.to_upper() + '_WAKEUP_SEMAPHORE', true)
    
    
    locked_unbounded_queue_impl = get_option('locked_unbounded_queue_implementation')
    if locked_unbounded_queue_impl == 'boost_shared_mutex'
    
    	if not boost_thread_dep.found()
    		error('Boost thread module not found, but locked_unbounded_queue_implementation set to boost_shared_mutex')
    	endif
    
    	emper_dependencies += [boost_thread_dep]
    endif
    conf_data.set('EMPER_' + locked_unbounded_queue_impl.to_upper() + '_LOCKED_UNBOUNDED_QUEUE', true)
    
    
    default_scheduling_strategy = get_option('default_scheduling_strategy')
    conf_data.set('EMPER_DEFAULT_SCHEDULING_STRATEGY_' + default_scheduling_strategy.to_upper(), true)
    
    
    log_level = get_option('log_level')
    if log_level == 'automatic'
    	# output only error messages in release builds
    
    	log_level = get_option('debug') ? 'ALL' : 'Info'
    
    endif
    conf_data.set('EMPER_LOG_LEVEL', log_level)
    
    conf_data.set('EMPER_LOG_TIMESTAMP', get_option('log_timestamp'))
    
    option_io =  get_option('io')
    if option_io
    	conf_data.set('EMPER_IO', true)
    endif
    
    io_bool_options = [
    	'uring_sqpoll',
    
    ]
    
    io_raw_options = [
    	'worker_uring_entries',
    ]
    
    foreach option : io_bool_options
    	value = get_option('io_' + option)
    	if value == true and not option_io
    		error('io_' + option + ' defined without io')
    	endif
    	conf_data.set('EMPER_IO_' + option.to_upper(), value)
    endforeach
    
    foreach option : io_raw_options
    	conf_data.set('EMPER_IO_' + option.to_upper(), get_option('io_' + option))
    endforeach
    
    
    io_cq_lock_impl = get_option('io_cq_lock_implementation')
    conf_data.set('EMPER_IO_CQ_LOCK_' + io_cq_lock_impl.to_upper(), true)
    
    
    subdir('emper')
    subdir('tests')
    subdir('apps')
    subdir('eval')
    subdir('doc')