build: don't disable assert on tests

This fixes #2 where meson errors about tests and assert being disabled.
This commit is contained in:
Christian Hergert
2018-08-22 13:04:16 -07:00
parent 6ead0097de
commit 6f635ad371
4 changed files with 32 additions and 32 deletions

View File

@ -68,7 +68,7 @@ libsysprof_deps = [
]
version_link_arg = '-Wl,--version-script,' + join_paths(meson.current_source_dir(), 'sysprof.map')
libsysprof_c_args = [ '-DSP_ENABLE_GOBJECT' ]
libsysprof_c_args = release_flags + ['-DSP_ENABLE_GOBJECT']
if get_option('with_sysprofd') != 'none'
libsysprof_deps += dependency('polkit-gobject-1')
@ -77,6 +77,7 @@ endif
libsysprof_capture = static_library('sysprof-capture-' + libsysprof_api_version,
libsysprof_capture_sources,
c_args: release_flags,
dependencies: libsysprof_capture_deps,
install: true,
)
@ -120,7 +121,7 @@ if get_option('enable_gtk')
dependency('gtk+-3.0', version: '>=3.22.0'),
]
libsysprof_ui_c_args = [ '-DSP_ENABLE_GOBJECT' ]
libsysprof_ui_c_args = release_flags + ['-DSP_ENABLE_GOBJECT']
libsysprof_ui = shared_library('sysprof-ui-' + libsysprof_api_version,
libsysprof_ui_resources + libsysprof_ui_sources,

View File

@ -103,24 +103,21 @@ endif
add_project_arguments(global_c_args, language: 'c')
release_flags = []
global_link_args = []
test_link_args = [
'-Wl,-z,relro',
'-Wl,-z,now',
]
if not get_option('buildtype').startswith('debug')
# TODO: Maybe reuse 'b_ndebug' option
add_global_arguments([
release_flags += [
'-DG_DISABLE_CAST_CHECKS',
'-DG_DISABLE_ASSERT',
], language: 'c')
]
test_link_args += [
'-Wl,-Bsymbolic',
'-fno-plt',
]
endif
foreach arg: test_link_args

View File

@ -11,21 +11,17 @@ sysprof_sources = [
'sp-window-settings.h',
]
sysprof_resources = gnome.compile_resources(
'sp-resources', 'resources/sysprof.gresource.xml',
sysprof_resources = gnome.compile_resources('sp-resources', 'resources/sysprof.gresource.xml',
source_dir: 'resources',
c_name: 'sysprof',
c_name: 'sysprof',
)
sysprof = executable('sysprof',
sysprof_resources + sysprof_sources,
dependencies: [
libsysprof_ui_dep,
cc.find_library('m', required: false),
],
c_args: exe_c_args,
link_args: exe_link_args,
install: true,
sysprof = executable('sysprof', sysprof_resources + sysprof_sources,
gui_app: true,
install: true,
c_args: release_flags + exe_c_args,
dependencies: [libsysprof_ui_dep, cc.find_library('m', required: false)],
link_args: exe_link_args,
)
endif

View File

@ -6,38 +6,44 @@ test_env = [
'MALLOC_CHECK_=2',
]
test_capture = executable('test-capture',
'test-capture.c',
test_cflags = [
'-DTEST_DATA_DIR="@0@/data/"'.format(meson.current_source_dir()),
'-I' + join_paths(meson.source_root(), 'lib'),
]
test_capture = executable('test-capture', 'test-capture.c',
c_args: test_cflags,
dependencies: libsysprof_capture_dep,
)
test('test-capture', test_capture, env: test_env)
test_capture_cursor = executable('test-capture-cursor',
'test-capture-cursor.c',
test_capture_cursor = executable('test-capture-cursor', 'test-capture-cursor.c',
c_args: test_cflags,
dependencies: libsysprof_dep,
)
test('test-capture-cursor', test_capture_cursor, env: test_env)
test_kallsyms = executable('test-kallsyms',
['test-kallsyms.c', '../lib/sp-kallsyms.c'],
# Use ./tests/test-kallsyms /proc/kallsyms to test (as user or root)
test_kallsyms = executable('test-kallsyms', ['test-kallsyms.c', '../lib/sp-kallsyms.c'],
c_args: test_cflags,
dependencies: libsysprof_dep,
)
if get_option('enable_gtk')
test_model_filter = executable('test-model-filter',
'test-model-filter.c',
test_model_filter = executable('test-model-filter', 'test-model-filter.c',
c_args: test_cflags,
dependencies: libsysprof_ui_dep,
)
test('test-model-filter', test_model_filter, env: test_env)
test_process_model = executable('test-process-model',
'test-process-model.c',
test_process_model = executable('test-process-model', 'test-process-model.c',
c_args: test_cflags,
dependencies: libsysprof_ui_dep,
)
test_zoom = executable('test-zoom',
'test-zoom.c',
test_zoom = executable('test-zoom', 'test-zoom.c',
c_args: test_cflags,
dependencies: libsysprof_ui_dep,
)
test('test-zoom', test_zoom, env: test_env)