Skip to content

Commit 6bc55ec

Browse files
SoapGentoodota17
authored andcommitted
Meson updates (#1124)
* Modernize meson.build * Make tests optional * Use `files()` for quick sanity checks * Bump version to 1.9.3 * Bump SOVERSION, as some functions were removed and structs were changed, as determined by libabigail.
1 parent f11611c commit 6bc55ec

File tree

4 files changed

+26
-18
lines changed

4 files changed

+26
-18
lines changed

CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ project(JSONCPP
7070
# 2. /include/json/version.h
7171
# 3. /CMakeLists.txt
7272
# IMPORTANT: also update the SOVERSION!!
73-
VERSION 1.9.2 # <major>[.<minor>[.<patch>[.<tweak>]]]
73+
VERSION 1.9.3 # <major>[.<minor>[.<patch>[.<tweak>]]]
7474
LANGUAGES CXX)
7575

7676
message(STATUS "JsonCpp Version: ${JSONCPP_VERSION_MAJOR}.${JSONCPP_VERSION_MINOR}.${JSONCPP_VERSION_PATCH}")

include/json/version.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@
99
// 3. /CMakeLists.txt
1010
// IMPORTANT: also update the SOVERSION!!
1111

12-
#define JSONCPP_VERSION_STRING "1.9.2"
12+
#define JSONCPP_VERSION_STRING "1.9.3"
1313
#define JSONCPP_VERSION_MAJOR 1
1414
#define JSONCPP_VERSION_MINOR 9
15-
#define JSONCPP_VERSION_PATCH 2
15+
#define JSONCPP_VERSION_PATCH 3
1616
#define JSONCPP_VERSION_QUALIFIER
1717
#define JSONCPP_VERSION_HEXA \
1818
((JSONCPP_VERSION_MAJOR << 24) | (JSONCPP_VERSION_MINOR << 16) | \

meson.build

+18-15
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ project(
99
# 2. /include/json/version.h
1010
# 3. /CMakeLists.txt
1111
# IMPORTANT: also update the SOVERSION!!
12-
version : '1.9.2',
12+
version : '1.9.3',
1313
default_options : [
1414
'buildtype=release',
1515
'cpp_std=c++11',
@@ -18,7 +18,7 @@ project(
1818
meson_version : '>= 0.49.0')
1919

2020

21-
jsoncpp_headers = [
21+
jsoncpp_headers = files([
2222
'include/json/allocator.h',
2323
'include/json/assertions.h',
2424
'include/json/config.h',
@@ -28,7 +28,8 @@ jsoncpp_headers = [
2828
'include/json/reader.h',
2929
'include/json/value.h',
3030
'include/json/version.h',
31-
'include/json/writer.h']
31+
'include/json/writer.h',
32+
])
3233
jsoncpp_include_directories = include_directories('include')
3334

3435
install_headers(
@@ -44,13 +45,12 @@ else
4445
endif
4546

4647
jsoncpp_lib = library(
47-
'jsoncpp',
48-
[ jsoncpp_headers,
49-
'src/lib_json/json_tool.h',
48+
'jsoncpp', files([
5049
'src/lib_json/json_reader.cpp',
5150
'src/lib_json/json_value.cpp',
52-
'src/lib_json/json_writer.cpp'],
53-
soversion : 22,
51+
'src/lib_json/json_writer.cpp',
52+
]),
53+
soversion : 23,
5454
install : true,
5555
include_directories : jsoncpp_include_directories,
5656
cpp_args: dll_export_flag)
@@ -66,18 +66,21 @@ import('pkgconfig').generate(
6666
jsoncpp_dep = declare_dependency(
6767
include_directories : jsoncpp_include_directories,
6868
link_with : jsoncpp_lib,
69-
version : meson.project_version(),
70-
)
69+
version : meson.project_version())
7170

7271
# tests
73-
python = import('python').find_installation()
72+
if meson.is_subproject() or not get_option('tests')
73+
subdir_done()
74+
endif
75+
76+
python = import('python').find_installation('python3')
7477

7578
jsoncpp_test = executable(
76-
'jsoncpp_test',
77-
[ 'src/test_lib_json/jsontest.cpp',
78-
'src/test_lib_json/jsontest.h',
79+
'jsoncpp_test', files([
80+
'src/test_lib_json/jsontest.cpp',
7981
'src/test_lib_json/main.cpp',
80-
'src/test_lib_json/fuzz.cpp'],
82+
'src/test_lib_json/fuzz.cpp',
83+
]),
8184
include_directories : jsoncpp_include_directories,
8285
link_with : jsoncpp_lib,
8386
install : false,

meson_options.txt

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
option(
2+
'tests',
3+
type : 'boolean',
4+
value : true,
5+
description : 'Enable building tests')

0 commit comments

Comments
 (0)