Skip to content

Commit a12b73b

Browse files
authored
Revert "Cleanup versioning strategy (#989)"
This reverts commit 12325b8.
1 parent 12325b8 commit a12b73b

File tree

9 files changed

+75
-74
lines changed

9 files changed

+75
-74
lines changed

Diff for: CMakeLists.txt

+6-9
Original file line numberDiff line numberDiff line change
@@ -63,18 +63,11 @@ if(NOT DEFINED CMAKE_BUILD_TYPE)
6363
endif()
6464

6565
project(JSONCPP
66-
# Note: version must be updated in three places when doing a release. This
67-
# annoying process ensures that amalgamate, CMake, and meson all report the
68-
# correct version.
69-
# 1. /meson.build
70-
# 2. /include/json/version.h
71-
# 3. /CMakeLists.txt
72-
# IMPORTANT: also update the SOVERSION!!
73-
VERSION 1.9.2 # <major>[.<minor>[.<patch>[.<tweak>]]]
66+
VERSION 1.9.0 # <major>[.<minor>[.<patch>[.<tweak>]]]
7467
LANGUAGES CXX)
7568

7669
message(STATUS "JsonCpp Version: ${JSONCPP_VERSION_MAJOR}.${JSONCPP_VERSION_MINOR}.${JSONCPP_VERSION_PATCH}")
77-
set( JSONCPP_SOVERSION 22 )
70+
set( JSONCPP_SOVERSION 21 )
7871

7972
option(JSONCPP_WITH_TESTS "Compile and (for jsoncpp_check) run JsonCpp test executables" ON)
8073
option(JSONCPP_WITH_POST_BUILD_UNITTEST "Automatically run unit-tests as a post build step" ON)
@@ -96,6 +89,10 @@ set(DEBUG_LIBNAME_SUFFIX "" CACHE STRING "Optional suffix to append to the libra
9689

9790
set(JSONCPP_USE_SECURE_MEMORY "0" CACHE STRING "-D...=1 to use memory-wiping allocator for STL" )
9891

92+
# File version.h is only regenerated on CMake configure step
93+
configure_file( "${PROJECT_SOURCE_DIR}/src/lib_json/version.h.in"
94+
"${PROJECT_BINARY_DIR}/include/json/version.h"
95+
NEWLINE_STYLE UNIX )
9996
configure_file( "${PROJECT_SOURCE_DIR}/version.in"
10097
"${PROJECT_BINARY_DIR}/version"
10198
NEWLINE_STYLE UNIX )

Diff for: CONTRIBUTING.md

+1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ Then,
2626
LIB_TYPE=shared
2727
#LIB_TYPE=static
2828
meson --buildtype ${BUILD_TYPE} --default-library ${LIB_TYPE} . build-${LIB_TYPE}
29+
#ninja -v -C build-${LIB_TYPE} test # This stopped working on my Mac.
2930
ninja -v -C build-${LIB_TYPE}
3031
cd build-${LIB_TYPE}
3132
meson test --no-rebuild --print-errorlogs

Diff for: amalgamate.py

100755100644
+17-21
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
#!/usr/bin/env python
2-
31
"""Amalgamate json-cpp library sources into a single source and header file.
42
53
Works with python2.6+ and python3.4+.
@@ -11,9 +9,6 @@
119
import os.path
1210
import sys
1311

14-
INCLUDE_PATH = "include/json"
15-
SRC_PATH = "src/lib_json"
16-
1712
class AmalgamationFile:
1813
def __init__(self, top_dir):
1914
self.top_dir = top_dir
@@ -71,15 +66,15 @@ def amalgamate_source(source_top_dir=None,
7166
header.add_text("/// If defined, indicates that the source file is amalgamated")
7267
header.add_text("/// to prevent private header inclusion.")
7368
header.add_text("#define JSON_IS_AMALGAMATION")
74-
header.add_file(os.path.join(INCLUDE_PATH, "version.h"))
75-
header.add_file(os.path.join(INCLUDE_PATH, "allocator.h"))
76-
header.add_file(os.path.join(INCLUDE_PATH, "config.h"))
77-
header.add_file(os.path.join(INCLUDE_PATH, "forwards.h"))
78-
header.add_file(os.path.join(INCLUDE_PATH, "features.h"))
79-
header.add_file(os.path.join(INCLUDE_PATH, "value.h"))
80-
header.add_file(os.path.join(INCLUDE_PATH, "reader.h"))
81-
header.add_file(os.path.join(INCLUDE_PATH, "writer.h"))
82-
header.add_file(os.path.join(INCLUDE_PATH, "assertions.h"))
69+
header.add_file("include/json/version.h")
70+
header.add_file("include/json/allocator.h")
71+
header.add_file("include/json/config.h")
72+
header.add_file("include/json/forwards.h")
73+
header.add_file("include/json/features.h")
74+
header.add_file("include/json/value.h")
75+
header.add_file("include/json/reader.h")
76+
header.add_file("include/json/writer.h")
77+
header.add_file("include/json/assertions.h")
8378
header.add_text("#endif //ifndef JSON_AMALGAMATED_H_INCLUDED")
8479

8580
target_header_path = os.path.join(os.path.dirname(target_source_path), header_include_path)
@@ -99,8 +94,8 @@ def amalgamate_source(source_top_dir=None,
9994
header.add_text("/// If defined, indicates that the source file is amalgamated")
10095
header.add_text("/// to prevent private header inclusion.")
10196
header.add_text("#define JSON_IS_AMALGAMATION")
102-
header.add_file(os.path.join(INCLUDE_PATH, "config.h"))
103-
header.add_file(os.path.join(INCLUDE_PATH, "forwards.h"))
97+
header.add_file("include/json/config.h")
98+
header.add_file("include/json/forwards.h")
10499
header.add_text("#endif //ifndef JSON_FORWARD_AMALGAMATED_H_INCLUDED")
105100

106101
target_forward_header_path = os.path.join(os.path.dirname(target_source_path),
@@ -121,11 +116,12 @@ def amalgamate_source(source_top_dir=None,
121116
#endif
122117
""")
123118
source.add_text("")
124-
source.add_file(os.path.join(SRC_PATH, "json_tool.h"))
125-
source.add_file(os.path.join(SRC_PATH, "json_reader.cpp"))
126-
source.add_file(os.path.join(SRC_PATH, "json_valueiterator.inl"))
127-
source.add_file(os.path.join(SRC_PATH, "json_value.cpp"))
128-
source.add_file(os.path.join(SRC_PATH, "json_writer.cpp"))
119+
lib_json = "src/lib_json"
120+
source.add_file(os.path.join(lib_json, "json_tool.h"))
121+
source.add_file(os.path.join(lib_json, "json_reader.cpp"))
122+
source.add_file(os.path.join(lib_json, "json_valueiterator.inl"))
123+
source.add_file(os.path.join(lib_json, "json_value.cpp"))
124+
source.add_file(os.path.join(lib_json, "json_writer.cpp"))
129125

130126
print("Writing amalgamated source to %r" % target_source_path)
131127
source.write_to(target_source_path)

Diff for: include/json/reader.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -378,7 +378,7 @@ bool JSON_API parseFromStream(CharReader::Factory const&,
378378
/** \brief Read from 'sin' into 'root'.
379379
*
380380
* Always keep comments from the input JSON.
381-
*
381+
*
382382
* This can be used to read a file into a particular sub-object.
383383
* For example:
384384
* \code

Diff for: include/json/version.h

-28
This file was deleted.

Diff for: meson.build

+24-13
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,33 @@
11
project(
22
'jsoncpp',
33
'cpp',
4-
5-
# Note: version must be updated in three places when doing a release. This
6-
# annoying process ensures that amalgamate, CMake, and meson all report the
7-
# correct version.
8-
# 1. /meson.build
9-
# 2. /include/json/version.h
10-
# 3. /CMakeLists.txt
11-
# IMPORTANT: also update the SOVERSION!!
12-
version : '1.9.2',
4+
version : '1.9.0',
135
default_options : [
146
'buildtype=release',
157
'cpp_std=c++11',
168
'warning_level=1'],
179
license : 'Public Domain',
1810
meson_version : '>= 0.50.0')
1911

12+
jsoncpp_ver_arr = meson.project_version().split('.')
13+
jsoncpp_major_version = jsoncpp_ver_arr[0]
14+
jsoncpp_minor_version = jsoncpp_ver_arr[1]
15+
jsoncpp_patch_version = jsoncpp_ver_arr[2]
16+
17+
jsoncpp_cdata = configuration_data()
18+
jsoncpp_cdata.set('JSONCPP_VERSION', meson.project_version())
19+
jsoncpp_cdata.set('JSONCPP_VERSION_MAJOR', jsoncpp_major_version)
20+
jsoncpp_cdata.set('JSONCPP_VERSION_MINOR', jsoncpp_minor_version)
21+
jsoncpp_cdata.set('JSONCPP_VERSION_PATCH', jsoncpp_patch_version)
22+
jsoncpp_cdata.set('JSONCPP_USE_SECURE_MEMORY',0)
23+
24+
jsoncpp_gen_sources = configure_file(
25+
input : 'src/lib_json/version.h.in',
26+
output : 'version.h',
27+
configuration : jsoncpp_cdata,
28+
install : true,
29+
install_dir : join_paths(get_option('prefix'), get_option('includedir'), 'json')
30+
)
2031

2132
jsoncpp_headers = [
2233
'include/json/allocator.h',
@@ -28,7 +39,6 @@ jsoncpp_headers = [
2839
'include/json/json.h',
2940
'include/json/reader.h',
3041
'include/json/value.h',
31-
'include/json/version.h',
3242
'include/json/writer.h']
3343
jsoncpp_include_directories = include_directories('include')
3444

@@ -46,12 +56,13 @@ endif
4656

4757
jsoncpp_lib = library(
4858
'jsoncpp',
49-
[ jsoncpp_headers,
59+
[ jsoncpp_gen_sources,
60+
jsoncpp_headers,
5061
'src/lib_json/json_tool.h',
5162
'src/lib_json/json_reader.cpp',
5263
'src/lib_json/json_value.cpp',
5364
'src/lib_json/json_writer.cpp'],
54-
soversion : 22,
65+
soversion : 21,
5566
install : true,
5667
include_directories : jsoncpp_include_directories,
5768
cpp_args: dll_export_flag)
@@ -68,7 +79,7 @@ jsoncpp_dep = declare_dependency(
6879
include_directories : jsoncpp_include_directories,
6980
link_with : jsoncpp_lib,
7081
version : meson.project_version(),
71-
)
82+
sources : jsoncpp_gen_sources)
7283

7384
# tests
7485
python = import('python3').find_python()

Diff for: src/lib_json/CMakeLists.txt

+3-2
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,9 @@ set( PUBLIC_HEADERS
4545
${JSONCPP_INCLUDE_DIR}/json/features.h
4646
${JSONCPP_INCLUDE_DIR}/json/value.h
4747
${JSONCPP_INCLUDE_DIR}/json/reader.h
48-
${JSONCPP_INCLUDE_DIR}/json/version.h
4948
${JSONCPP_INCLUDE_DIR}/json/writer.h
5049
${JSONCPP_INCLUDE_DIR}/json/assertions.h
50+
${PROJECT_BINARY_DIR}/include/json/version.h
5151
)
5252

5353
source_group( "Public API" FILES ${PUBLIC_HEADERS} )
@@ -57,7 +57,8 @@ set(jsoncpp_sources
5757
json_reader.cpp
5858
json_valueiterator.inl
5959
json_value.cpp
60-
json_writer.cpp)
60+
json_writer.cpp
61+
version.h.in)
6162

6263
# Install instructions for this target
6364
if(JSONCPP_WITH_CMAKE_PACKAGE)

Diff for: src/lib_json/version.h.in

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
// DO NOT EDIT. This file (and "version") is a template used by the build system
2+
// (either CMake or Meson) to generate a "version.h" header file.
3+
#ifndef JSON_VERSION_H_INCLUDED
4+
#define JSON_VERSION_H_INCLUDED
5+
6+
#define JSONCPP_VERSION_STRING "@JSONCPP_VERSION@"
7+
#define JSONCPP_VERSION_MAJOR @JSONCPP_VERSION_MAJOR@
8+
#define JSONCPP_VERSION_MINOR @JSONCPP_VERSION_MINOR@
9+
#define JSONCPP_VERSION_PATCH @JSONCPP_VERSION_PATCH@
10+
#define JSONCPP_VERSION_QUALIFIER
11+
#define JSONCPP_VERSION_HEXA ((JSONCPP_VERSION_MAJOR << 24) \
12+
| (JSONCPP_VERSION_MINOR << 16) \
13+
| (JSONCPP_VERSION_PATCH << 8))
14+
15+
#ifdef JSONCPP_USING_SECURE_MEMORY
16+
#undef JSONCPP_USING_SECURE_MEMORY
17+
#endif
18+
#define JSONCPP_USING_SECURE_MEMORY @JSONCPP_USE_SECURE_MEMORY@
19+
// If non-zero, the library zeroes any memory that it has allocated before
20+
// it frees its memory.
21+
22+
#endif // JSON_VERSION_H_INCLUDED

Diff for: version.txt

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
1.8.4

0 commit comments

Comments
 (0)