mirror of
https://github.com/json-c/json-c.git
synced 2026-04-09 23:39:06 +08:00
meson: use static library for tests
Needed as tests use private APIs that are not exported. Signed-off-by: Rosen Penev <rosenp@gmail.com>
This commit is contained in:
@@ -225,6 +225,12 @@ endif
|
|||||||
|
|
||||||
add_project_arguments(cc.get_supported_arguments('-Wno-unused-parameter'), language : 'c')
|
add_project_arguments(cc.get_supported_arguments('-Wno-unused-parameter'), language : 'c')
|
||||||
|
|
||||||
|
sym = cc.get_supported_link_arguments(
|
||||||
|
'-Wl,--version-script,@0@/json-c.sym'.format(
|
||||||
|
meson.current_source_dir(),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
|
||||||
# Source files
|
# Source files
|
||||||
sources = files(
|
sources = files(
|
||||||
'arraylist.c', 'debug.c', 'json_c_version.c', 'json_object.c',
|
'arraylist.c', 'debug.c', 'json_c_version.c', 'json_object.c',
|
||||||
@@ -249,6 +255,7 @@ libjson = library('json-c',
|
|||||||
include_directories: inc,
|
include_directories: inc,
|
||||||
dependencies: bsd_dep,
|
dependencies: bsd_dep,
|
||||||
install: true,
|
install: true,
|
||||||
|
link_args: sym,
|
||||||
version: '5.4.0',
|
version: '5.4.0',
|
||||||
soversion: '5',
|
soversion: '5',
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -1,5 +1,16 @@
|
|||||||
test_includes = include_directories('.')
|
#This hack is needed for Windows tests
|
||||||
test_deps = [jsonc_dep]
|
test_lib = static_library(
|
||||||
|
'jsonctest',
|
||||||
|
objects: libjson.extract_all_objects(
|
||||||
|
recursive: false,
|
||||||
|
),
|
||||||
|
install: false,
|
||||||
|
)
|
||||||
|
|
||||||
|
test_deps = declare_dependency(
|
||||||
|
include_directories: '..',
|
||||||
|
link_with: test_lib,
|
||||||
|
)
|
||||||
|
|
||||||
# List of test sources and expected output files
|
# List of test sources and expected output files
|
||||||
test_cases = [
|
test_cases = [
|
||||||
@@ -53,7 +64,6 @@ foreach t : test_cases
|
|||||||
name = t[0]
|
name = t[0]
|
||||||
expected = t[1]
|
expected = t[1]
|
||||||
exe = executable(name, name + '.c',
|
exe = executable(name, name + '.c',
|
||||||
include_directories: test_includes,
|
|
||||||
dependencies: test_deps
|
dependencies: test_deps
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user