2017-06-26 06:11:51 +02:00
|
|
|
project(
|
|
|
|
'jsoncpp',
|
|
|
|
'cpp',
|
2019-08-13 22:41:43 -07:00
|
|
|
|
|
|
|
# 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!!
|
2020-09-25 19:19:16 -07:00
|
|
|
version : '1.9.4',
|
2017-06-26 06:11:51 +02:00
|
|
|
default_options : [
|
|
|
|
'buildtype=release',
|
2017-12-21 01:22:40 -06:00
|
|
|
'cpp_std=c++11',
|
2017-06-26 06:11:51 +02:00
|
|
|
'warning_level=1'],
|
|
|
|
license : 'Public Domain',
|
2019-11-08 19:49:16 -08:00
|
|
|
meson_version : '>= 0.49.0')
|
2017-06-26 06:11:51 +02:00
|
|
|
|
|
|
|
|
2020-01-07 02:23:50 +01:00
|
|
|
jsoncpp_headers = files([
|
2017-06-26 06:11:51 +02:00
|
|
|
'include/json/allocator.h',
|
|
|
|
'include/json/assertions.h',
|
|
|
|
'include/json/config.h',
|
2019-09-25 14:04:53 -07:00
|
|
|
'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',
|
2019-08-13 22:41:43 -07:00
|
|
|
'include/json/version.h',
|
2020-01-07 02:23:50 +01:00
|
|
|
'include/json/writer.h',
|
|
|
|
])
|
2017-06-26 06:11:51 +02:00
|
|
|
jsoncpp_include_directories = include_directories('include')
|
|
|
|
|
|
|
|
install_headers(
|
|
|
|
jsoncpp_headers,
|
|
|
|
subdir : 'json')
|
|
|
|
|
2018-06-18 11:28:56 +02:00
|
|
|
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
|
2018-06-23 17:34:40 -05:00
|
|
|
dll_export_flag = []
|
|
|
|
dll_import_flag = []
|
2018-06-18 11:28:56 +02:00
|
|
|
endif
|
|
|
|
|
2017-06-26 06:11:51 +02:00
|
|
|
jsoncpp_lib = library(
|
2020-01-07 02:23:50 +01:00
|
|
|
'jsoncpp', files([
|
2017-06-26 06:11:51 +02:00
|
|
|
'src/lib_json/json_reader.cpp',
|
|
|
|
'src/lib_json/json_value.cpp',
|
2020-01-07 02:23:50 +01:00
|
|
|
'src/lib_json/json_writer.cpp',
|
|
|
|
]),
|
2020-04-30 17:58:07 +08:00
|
|
|
soversion : 24,
|
2017-06-26 06:11:51 +02:00
|
|
|
install : true,
|
2018-06-18 11:28:56 +02:00
|
|
|
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
|
2017-09-16 11:19:30 +01:00
|
|
|
jsoncpp_dep = declare_dependency(
|
2017-06-26 06:11:51 +02:00
|
|
|
include_directories : jsoncpp_include_directories,
|
|
|
|
link_with : jsoncpp_lib,
|
2020-01-07 02:23:50 +01:00
|
|
|
version : meson.project_version())
|
2017-06-26 06:11:51 +02:00
|
|
|
|
|
|
|
# tests
|
2020-01-07 02:23:50 +01:00
|
|
|
if meson.is_subproject() or not get_option('tests')
|
|
|
|
subdir_done()
|
|
|
|
endif
|
|
|
|
|
2020-06-03 12:19:51 +02:00
|
|
|
python = import('python').find_installation()
|
2017-06-26 06:11:51 +02:00
|
|
|
|
|
|
|
jsoncpp_test = executable(
|
2020-01-07 02:23:50 +01:00
|
|
|
'jsoncpp_test', files([
|
|
|
|
'src/test_lib_json/jsontest.cpp',
|
2019-06-26 17:40:59 -04:00
|
|
|
'src/test_lib_json/main.cpp',
|
2020-01-07 02:23:50 +01:00
|
|
|
'src/test_lib_json/fuzz.cpp',
|
|
|
|
]),
|
2017-06-26 06:11:51 +02:00
|
|
|
include_directories : jsoncpp_include_directories,
|
|
|
|
link_with : jsoncpp_lib,
|
2018-06-18 11:28:56 +02:00
|
|
|
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,
|
2018-06-18 11:28:56 +02:00
|
|
|
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
|
|
|
)
|
2019-11-14 10:41:25 -08:00
|
|
|
test(
|
|
|
|
'jsonchecker_jsontestrunner',
|
|
|
|
python,
|
2020-04-24 09:24:22 -05:00
|
|
|
is_parallel : false,
|
2019-11-14 10:41:25 -08:00
|
|
|
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'),
|
2019-11-14 10:41:25 -08:00
|
|
|
)
|