73 lines
2.2 KiB
Meson
73 lines
2.2 KiB
Meson
cgo_cflags =''
|
|
cgo_ldflags = ''
|
|
|
|
if with_debug
|
|
cgo_cflags += '-fsanitize=address -g -DWITH_DEBUG=1 '
|
|
cgo_ldflags += '-fsanitize=address -g '
|
|
endif
|
|
|
|
apiserver_ext_deps = [
|
|
libxce_dep,
|
|
c_capnproto_dep,
|
|
ssl_dep,
|
|
tinylog_dep,
|
|
math_dep,
|
|
rt_dep,
|
|
]
|
|
|
|
foreach e: apiserver_ext_deps
|
|
cflags_result = run_command(pkgconfig, '--cflags', e.name(), check: false)
|
|
|
|
if cflags_result.returncode() == 0
|
|
cgo_cflags += ' '
|
|
cgo_cflags += cflags_result.stdout().strip()
|
|
endif
|
|
ldflags_result = run_command(pkgconfig, '--libs', e.name(), check: false)
|
|
|
|
if ldflags_result.returncode() == 0
|
|
cgo_ldflags += ' '
|
|
cgo_ldflags += ldflags_result.stdout().strip()
|
|
endif
|
|
endforeach
|
|
|
|
apiserver_deps = [
|
|
apiserver_ext_deps,
|
|
libxce_dep,
|
|
]
|
|
|
|
cgo_cflags += ' -I@CURRENT_SOURCE_DIR@/../include -I@CURRENT_SOURCE_DIR@/include -I@BUILD_ROOT@/lib '
|
|
cgo_ldflags += ' -L@BUILD_ROOT@/lib -L@BUILD_ROOT@/apiserver -lxce'
|
|
|
|
go_env = environment()
|
|
go_env.set('CGO_CFLAGS', cgo_cflags)
|
|
go_env.set('CGO_LDFLAGS', cgo_ldflags)
|
|
go_env.set('BUILDTYPE', get_option('buildtype'))
|
|
go_env.set('FIX_ENVARS','CGO_CFLAGS CGO_LDFLAGS')
|
|
go_env.set('DEPENDENCIES','thread math')
|
|
go_env.set('ENVARS', 'CURRENT_SOURCE_DIR BUILD_ROOT')
|
|
|
|
#libapiserver_src = [
|
|
# 'src/init.c',
|
|
#]
|
|
|
|
#libapiserver_incdir = include_directories('../include', 'include', '../lib')
|
|
|
|
#libapiserver_shared = shared_library('apiserver',
|
|
# libapiserver_src,
|
|
# include_directories: [libapiserver_incdir],
|
|
# dependencies: [libxce_dep],
|
|
# install: true)
|
|
|
|
apiserver = custom_target('apiserver',
|
|
input: 'cmd/main.go',
|
|
output: 'apiserver',
|
|
command: [env_program,
|
|
'CURRENT_SOURCE_DIR="@CURRENT_SOURCE_DIR@"',
|
|
'BUILD_ROOT="@BUILD_ROOT@"',
|
|
go_build_program,
|
|
'@INPUT@', '@OUTPUT@'],
|
|
env: go_env,
|
|
depends: [libxce],
|
|
install: true,
|
|
install_dir: get_option('prefix') / 'bin')
|
|
|