jsoncpp/meson.build

120 lines
3.0 KiB
Meson
Raw Normal View History

2017-06-26 06:11:51 +02:00
project(
'jsoncpp',
'cpp',
# Note: version must be updated in three places when doing a release. This
# annoying process ensures that amalgamate, CMake, and meson all report the
# correct version.
# 1. /meson.build
# 2. /include/json/version.h
# 3. /CMakeLists.txt
# IMPORTANT: also update the SOVERSION!!
version : '1.9.4',
2017-06-26 06:11:51 +02:00
default_options : [
'buildtype=release',
'cpp_std=c++11',
2017-06-26 06:11:51 +02:00
'warning_level=1'],
license : 'Public Domain',
meson_version : '>= 0.49.0')
2017-06-26 06:11:51 +02:00
jsoncpp_headers = files([
2017-06-26 06:11:51 +02:00
'include/json/allocator.h',
'include/json/assertions.h',
'include/json/config.h',
'include/json/json_features.h',
2017-06-26 06:11:51 +02:00
'include/json/forwards.h',
'include/json/json.h',
'include/json/reader.h',
'include/json/value.h',
'include/json/version.h',
'include/json/writer.h',
])
2017-06-26 06:11:51 +02:00
jsoncpp_include_directories = include_directories('include')
install_headers(
jsoncpp_headers,
subdir : 'json')
if get_option('default_library') == 'shared' and meson.get_compiler('cpp').get_id() == 'msvc'
dll_export_flag = '-DJSON_DLL_BUILD'
dll_import_flag = '-DJSON_DLL'
else
dll_export_flag = []
dll_import_flag = []
endif
2017-06-26 06:11:51 +02:00
jsoncpp_lib = library(
'jsoncpp', files([
2017-06-26 06:11:51 +02:00
'src/lib_json/json_reader.cpp',
'src/lib_json/json_value.cpp',
'src/lib_json/json_writer.cpp',
]),
2021-11-03 11:39:54 -05:00
soversion : 25,
2017-06-26 06:11:51 +02:00
install : true,
include_directories : jsoncpp_include_directories,
cpp_args: dll_export_flag)
2017-06-26 06:11:51 +02:00
import('pkgconfig').generate(
libraries : jsoncpp_lib,
version : meson.project_version(),
name : 'jsoncpp',
filebase : 'jsoncpp',
description : 'A C++ library for interacting with JSON')
# for libraries bundling jsoncpp
jsoncpp_dep = declare_dependency(
2017-06-26 06:11:51 +02:00
include_directories : jsoncpp_include_directories,
link_with : jsoncpp_lib,
version : meson.project_version())
2017-06-26 06:11:51 +02:00
# tests
if meson.is_subproject() or not get_option('tests')
subdir_done()
endif
python = import('python').find_installation()
2017-06-26 06:11:51 +02:00
jsoncpp_test = executable(
'jsoncpp_test', files([
'src/test_lib_json/jsontest.cpp',
2019-06-26 17:40:59 -04:00
'src/test_lib_json/main.cpp',
'src/test_lib_json/fuzz.cpp',
]),
2017-06-26 06:11:51 +02:00
include_directories : jsoncpp_include_directories,
link_with : jsoncpp_lib,
install : false,
cpp_args: dll_import_flag)
2017-06-26 06:11:51 +02:00
test(
'unittest_jsoncpp_test',
jsoncpp_test)
jsontestrunner = executable(
'jsontestrunner',
'src/jsontestrunner/main.cpp',
include_directories : jsoncpp_include_directories,
link_with : jsoncpp_lib,
install : false,
cpp_args: dll_import_flag)
2017-06-26 06:11:51 +02:00
test(
'unittest_jsontestrunner',
python,
args : [
'-B',
join_paths(meson.current_source_dir(), 'test/runjsontests.py'),
jsontestrunner,
2019-11-14 10:52:13 -08:00
join_paths(meson.current_source_dir(), 'test/data')],
2017-06-26 06:11:51 +02:00
)
test(
'jsonchecker_jsontestrunner',
python,
is_parallel : false,
args : [
'-B',
join_paths(meson.current_source_dir(), 'test/runjsontests.py'),
'--with-json-checker',
jsontestrunner,
2019-11-14 10:52:13 -08:00
join_paths(meson.current_source_dir(), 'test/data')],
workdir : join_paths(meson.current_source_dir(), 'test/data'),
)