File tree Expand file tree Collapse file tree 2 files changed +48
-0
lines changed Expand file tree Collapse file tree 2 files changed +48
-0
lines changed Original file line number Diff line number Diff line change @@ -51,6 +51,12 @@ if(TAOCPP_JSON_BUILD_EXAMPLES)
5151 add_subdirectory (src/example/json)
5252endif ()
5353
54+ # performance
55+ option (TAOCPP_JSON_BUILD_PERFORMANCE "Build performance programs" ${TAOCPP_JSON_IS_MAIN_PROJECT} )
56+ if (TAOCPP_JSON_BUILD_PERFORMANCE)
57+ add_subdirectory (src/perf/json)
58+ endif ()
59+
5460option (TAOCPP_JSON_INSTALL "Generate the install target" ${TAOCPP_JSON_IS_MAIN_PROJECT} )
5561if (TAOCPP_JSON_INSTALL)
5662 include (CMakePackageConfigHelpers)
Original file line number Diff line number Diff line change 1+ cmake_minimum_required (VERSION 3.8...3.19)
2+
3+ set (perfsources
4+ benchmark.cpp
5+ parse_file.cpp
6+ pretty_print_file.cpp
7+ print_double.cpp
8+ print_file.cpp
9+ sizes.cpp
10+ syntax_only.cpp
11+ )
12+
13+ # file(GLOB ...) is used to validate the above list of perf_sources
14+ file (GLOB glob_perf_sources RELATIVE ${CMAKE_CURRENT_LIST_DIR} *.cpp)
15+
16+ foreach (perfsourcefile ${perfsources} )
17+ if (${perfsourcefile} IN_LIST glob_perf_sources)
18+ list (REMOVE_ITEM glob_perf_sources ${perfsourcefile} )
19+ else ()
20+ message (SEND_ERROR "File ${perfsourcefile} is missing from src/perf/json" )
21+ endif ()
22+ get_filename_component (exename ${perfsourcefile} NAME_WE )
23+ set (exename "tao-json-perf-${exename} " )
24+ add_executable (${exename} ${perfsourcefile} )
25+ target_link_libraries (${exename} PRIVATE taocpp::json)
26+ set_target_properties (${exename} PROPERTIES
27+ CXX_STANDARD 11
28+ CXX_STANDARD_REQUIRED ON
29+ CXX_EXTENSIONS OFF
30+ )
31+ if (MSVC )
32+ target_compile_options (${exename} PRIVATE /W4 /WX /utf-8)
33+ else ()
34+ target_compile_options (${exename} PRIVATE -pedantic -Wall -Wextra -Wshadow -Werror)
35+ endif ()
36+ endforeach ()
37+
38+ if (glob_perf_sources)
39+ foreach (ignored_source_file ${glob_perf_sources} )
40+ message (SEND_ERROR "File ${ignored_source_file} in src/perf/json is ignored" )
41+ endforeach ()
42+ endif ()
You can’t perform that action at this time.
0 commit comments