Skip to content

Commit a17e2a4

Browse files
committed
Modernized cmake and relicenced under BSL
1 parent cdd8eed commit a17e2a4

27 files changed

Lines changed: 234 additions & 623 deletions

CMakeLists.txt

Lines changed: 37 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -1,63 +1,31 @@
1-
cmake_minimum_required( VERSION 3.10 )
1+
# Copyright (c) Darrell Wright
2+
#
3+
# Distributed under the Boost Software License, Version 1.0. (See accompanying
4+
# file LICENSE or copy at http://www.boost.org/LICENSE_1_0.txt)
5+
#
6+
# Official repository: https://github.com/beached/json_to_cpp
7+
#
28

3-
project( json_to_cpp_prj )
49

5-
include( ExternalProject )
10+
cmake_minimum_required(VERSION 3.13)
611

7-
find_package( Boost 1.60.0 COMPONENTS system date_time iostreams program_options filesystem regex unit_test_framework REQUIRED )
12+
project("json_to_cpp"
13+
VERSION "1.0.0"
14+
DESCRIPTION "Try to use the JSON structures to make C++ structures and bindings"
15+
HOMEPAGE_URL "https://github.com/beached/json_to_cpp"
16+
LANGUAGES C CXX)
817

9-
find_package( CURL )
10-
find_package( Threads REQUIRED )
18+
set(CMAKE_CXX_STANDARD 17 CACHE STRING "The C++ standard whose features are requested.")
19+
set(CMAKE_CXX_STANDARD_REQUIRED ON)
20+
set(CMAKE_CXX_EXTENSIONS OFF)
1121

12-
enable_testing( )
13-
add_definitions( -DBOOST_TEST_DYN_LINK )
22+
find_package( Boost 1.60.0 COMPONENTS program_options REQUIRED )
23+
find_package( CURL REQUIRED )
24+
find_package( OpenSSL REQUIRED )
25+
add_subdirectory(extern)
1426

15-
16-
set( CMAKE_CXX_STANDARD 17 CACHE STRING "The C++ standard whose features are requested.")
17-
18-
include( "${CMAKE_SOURCE_DIR}/dependent_projects/CMakeListsCompiler.txt" )
19-
20-
if( "${CMAKE_BUILD_TYPE}" STREQUAL "Debug" )
21-
set( GLEAN_CACHE "${CMAKE_SOURCE_DIR}/.glean/debug" )
22-
set( GLEAN_CACHE2 "${CMAKE_SOURCE_DIR}/.glean/release" )
23-
elseif( "${CMAKE_BUILD_TYPE}" STREQUAL "Release" )
24-
set( GLEAN_CACHE "${CMAKE_SOURCE_DIR}/.glean/release" )
25-
set( GLEAN_CACHE2 "${CMAKE_SOURCE_DIR}/.glean/debug" )
26-
else( )
27-
set( GLEAN_CACHE "${CMAKE_SOURCE_DIR}/.glean/release" )
28-
set( GLEAN_CACHE2 "${CMAKE_SOURCE_DIR}/.glean/debug" )
29-
endif( )
30-
31-
message( "Building for: ${CMAKE_BUILD_TYPE}" )
32-
message( "Checking for glean cache: '${GLEAN_CACHE}'" )
33-
if( EXISTS "${GLEAN_CACHE}" )
34-
message( "using glean dependencies at ${GLEAN_CACHE}" )
35-
add_custom_target( dependency_stub )
36-
include_directories( SYSTEM "${GLEAN_CACHE}/include" )
37-
link_directories( "${GLEAN_CACHE}/lib" )
38-
elseif( EXISTS "${GLEAN_CACHE2}" )
39-
message( "looks like glean is in use but missing ${GLEAN_CACHE}" )
40-
elseif( EXISTS "${CMAKE_SOURCE_DIR}/glean.cmake" )
41-
message( "glean.cmake detected" )
42-
include( "${CMAKE_SOURCE_DIR}/glean.cmake" )
43-
add_library( dependency_stub STATIC "${CMAKE_SOURCE_DIR}/dependent_projects/stub.cpp" )
44-
add_dependencies( dependency_stub ${DEP_PROJECT_DEPS} )
45-
include_directories( SYSTEM "${CMAKE_BINARY_DIR}/install/include" )
46-
link_directories( "${CMAKE_BINARY_DIR}/install/lib" )
47-
endif( )
48-
49-
set( HEADER_FOLDER "include" )
50-
set( SOURCE_FOLDER "src" )
51-
set( TEST_FOLDER "tests" )
52-
53-
include_directories( SYSTEM "${CMAKE_BINARY_DIR}/install/include" )
54-
include_directories( ${HEADER_FOLDER} )
55-
include_directories( SYSTEM ${OPENSSL_INCLUDE_DIR} )
56-
include_directories( SYSTEM ${CURL_INCLUDE_DIRS} )
57-
include_directories( SYSTEM ${Boost_INCLUDE_DIRS} )
58-
59-
link_directories( "${CMAKE_BINARY_DIR}/install/lib" )
60-
link_directories( ${Boost_LIBRARY_DIRS} )
27+
set( HEADER_FOLDER include )
28+
set( SOURCE_FOLDER src )
6129

6230
set( HEADER_FILES
6331
${HEADER_FOLDER}/curl_t.h
@@ -82,17 +50,22 @@ set( SOURCE_FILES
8250
${SOURCE_FOLDER}/ti_array.cpp
8351
${SOURCE_FOLDER}/ti_kv.cpp
8452
${SOURCE_FOLDER}/ti_object.cpp
53+
${SOURCE_FOLDER}/main.cpp
8554
)
8655

87-
add_library( json_to_cpp_lib ${HEADER_FILES} ${SOURCE_FILES} )
88-
add_dependencies( json_to_cpp_lib dependency_stub )
89-
target_link_libraries( json_to_cpp_lib utf_range utf_string ${Boost_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} )
90-
91-
add_executable( json_to_cpp ${HEADER_FILES} ${SOURCE_FOLDER}/main.cpp )
92-
add_dependencies( json_to_cpp dependency_stub )
93-
target_link_libraries( json_to_cpp json_to_cpp_lib parse_json utf_range ${Boost_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} ${CURL_LIBRARIES} )
56+
add_executable( ${PROJECT_NAME} ${HEADER_FILES} ${SOURCE_FILES} )
57+
target_link_libraries( ${PROJECT_NAME} PRIVATE
58+
daw::parse_json
59+
daw::utf_range
60+
daw::header_libraries
61+
Boost::program_options
62+
daw::libtemp_file
63+
date::date
64+
OpenSSL::SSL
65+
OpenSSL::Crypto
66+
CURL::libcurl
67+
)
68+
target_include_directories( ${PROJECT_NAME} PRIVATE ${HEADER_FOLDER} )
9469

95-
#install( TARGETS json_to_cpp DESTINATION lib )
96-
install( TARGETS json_to_cpp DESTINATION bin )
97-
#install( DIRECTORY ${HEADER_FOLDER}/ DESTINATION include/daw/json_to_cpp )
70+
install(TARGETS ${PROJECT_NAME} RUNTIME DESTINATION bin)
9871

LICENSE

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,25 @@
1-
MIT License
1+
Copyright (c) Darrell Wright
22

3-
Copyright (c) 2016-2019 Darrell Wright
3+
Boost Software License - Version 1.0 - August 17th, 2003
44

5-
Permission is hereby granted, free of charge, to any person obtaining a copy
6-
of this software and associated documentation files (the "Software"), to deal
7-
in the Software without restriction, including without limitation the rights
8-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9-
copies of the Software, and to permit persons to whom the Software is
10-
furnished to do so, subject to the following conditions:
5+
Permission is hereby granted, free of charge, to any person or organization
6+
obtaining a copy of the software and accompanying documentation covered by
7+
this license (the "Software") to use, reproduce, display, distribute,
8+
execute, and transmit the Software, and to prepare derivative works of the
9+
Software, and to permit third-parties to whom the Software is furnished to
10+
do so, all subject to the following:
1111

12-
The above copyright notice and this permission notice shall be included in all
13-
copies or substantial portions of the Software.
12+
The copyright notices in the Software and this entire statement, including
13+
the above license grant, this restriction and the following disclaimer,
14+
must be included in all copies of the Software, in whole or in part, and
15+
all derivative works of the Software, unless such copies or derivative
16+
works are solely in the form of machine-executable object code generated by
17+
a source language processor.
1418

1519
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1620
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21-
SOFTWARE.
21+
FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
22+
SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
23+
FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
24+
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
25+
DEALINGS IN THE SOFTWARE.

dependent_projects/CMakeListsCompiler.txt

Lines changed: 0 additions & 19 deletions
This file was deleted.

dependent_projects/stub.cpp

Lines changed: 0 additions & 27 deletions
This file was deleted.

extern/CMakeLists.txt

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# Copyright (c) Darrell Wright
2+
#
3+
# Distributed under the Boost Software License, Version 1.0. (See accompanying
4+
# file LICENSE or copy at http://www.boost.org/LICENSE_1_0.txt)
5+
#
6+
# Official repository: https://github.com/beached/json_to_cpp
7+
#
8+
9+
# This prevents tests running on dependencies
10+
option( DAW_ENABLE_TESTING "Build unit tests" OFF )
11+
if( DAW_ENABLE_TESTING )
12+
set( DAW_ENABLE_TESTING OFF )
13+
endif( )
14+
15+
include( FetchContent )
16+
set( FETCHCONTENT_UPDATES_DISCONNECTED ON )
17+
18+
FetchContent_Declare(
19+
daw_header_libraries
20+
GIT_REPOSITORY https://github.com/beached/header_libraries.git
21+
)
22+
23+
FetchContent_Declare(
24+
daw_utf_range
25+
GIT_REPOSITORY https://github.com/beached/utf_range.git
26+
)
27+
28+
FetchContent_Declare(
29+
daw_parse_json
30+
GIT_REPOSITORY https://github.com/beached/parse_json.git
31+
)
32+
33+
FetchContent_Declare(
34+
daw_libtemp_file
35+
GIT_REPOSITORY https://github.com/beached/libtemp_file.git
36+
)
37+
38+
option( ENABLE_DATE_TESTING "" OFF )
39+
option( USE_SYSTEM_TZ_DB "" ON )
40+
FetchContent_Declare(
41+
date
42+
GIT_REPOSITORY https://github.com/howardhinnant/date.git
43+
)
44+
45+
FetchContent_MakeAvailable(daw_header_libraries daw_utf_range daw_parse_json daw_libtemp_file date )
46+

glean.cmake

Lines changed: 0 additions & 47 deletions
This file was deleted.

glean.json

Lines changed: 0 additions & 39 deletions
This file was deleted.

include/curl_t.h

Lines changed: 4 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,10 @@
1-
// The MIT License (MIT)
1+
// Copyright (c) Darrell Wright
22
//
3-
// Copyright (c) 2019 Darrell Wright
3+
// Distributed under the Boost Software License, version 1.0. (see accompanying
4+
// file license or copy at http://www.boost.org/license_1_0.txt)
45
//
5-
// Permission is hereby granted, free of charge, to any person obtaining a copy
6-
// of this software and associated documentation files( the "Software" ), to
7-
// deal in the Software without restriction, including without limitation the
8-
// rights to use, copy, modify, merge, publish, distribute, sublicense, and / or
9-
// sell copies of the Software, and to permit persons to whom the Software is
10-
// furnished to do so, subject to the following conditions:
6+
// Official repository: https://github.com/beached/daw_json_link
117
//
12-
// The above copyright notice and this permission notice shall be included in
13-
// all copies or substantial portions of the Software.
14-
//
15-
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16-
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17-
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE
18-
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19-
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20-
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21-
// SOFTWARE.
228

239
#pragma once
2410

0 commit comments

Comments
 (0)