File tree Expand file tree Collapse file tree 17 files changed +333
-271
lines changed
Expand file tree Collapse file tree 17 files changed +333
-271
lines changed Original file line number Diff line number Diff line change 11*
22! .git
33! Makefile
4- ! amalgamation .sh
4+ ! amalgamate .sh
55! benchmark
66! dependencies
77! include
Original file line number Diff line number Diff line change @@ -47,7 +47,7 @@ platform:
4747steps :
4848- name : build
4949 image : gcc:8
50- commands : [ make, make amalgamate ]
50+ commands : [ make, make amalgamate_test ]
5151---
5252kind : pipeline
5353name : x64-slowtests
8787 image : gcc:8
8888 environment :
8989 EXTRA_FLAGS : -fno-exceptions
90- commands : [ make, make amalgamate ]
90+ commands : [ make, make amalgamate_test ]
9191---
9292kind : pipeline
9393name : x64-noexceptions-slowtests
@@ -139,7 +139,7 @@ platform:
139139steps :
140140- name : build
141141 image : gcc:8
142- commands : [ make, make amalgamate ]
142+ commands : [ make, make amalgamate_test ]
143143---
144144kind : pipeline
145145name : arm64-slowtests
Original file line number Diff line number Diff line change @@ -133,6 +133,11 @@ objs
133133/tests /allparserscheckfile
134134/tests /basictests
135135/tests /checkimplementation
136+ /tests /compilation_failure_tests /dangling_parser_load_should_compile
137+ /tests /compilation_failure_tests /dangling_parser_parse_padstring_should_compile
138+ /tests /compilation_failure_tests /dangling_parser_parse_stdstring_should_compile
139+ /tests /compilation_failure_tests /dangling_parser_parse_uchar_should_compile
140+ /tests /compilation_failure_tests /dangling_parser_parse_uint8_should_compile
136141/tests /compilation_failure_tests /example_compiletest_should_compile
137142/tests /errortests
138143/tests /extracting_values_example
Original file line number Diff line number Diff line change @@ -138,6 +138,15 @@ if (NOT MSVC)
138138 add_custom_target (simdjson-user-cmakecache ALL DEPENDS ${SIMDJSON_USER_CMAKECACHE} )
139139endif ()
140140
141+ #
142+ # Set up test data
143+ #
144+ enable_testing ()
145+ add_subdirectory (jsonchecker )
146+ add_subdirectory (jsonexamples )
147+ add_library (test -data INTERFACE )
148+ target_link_libraries (test -data INTERFACE jsonchecker-data jsonexamples-data )
149+
141150#
142151# Create the top level simdjson library (must be done at this level to use both src/ and include/
143152# directories) and tools
@@ -146,16 +155,11 @@ add_subdirectory(include)
146155add_subdirectory (src )
147156add_subdirectory (windows )
148157add_subdirectory (tools )
158+ add_subdirectory (singleheader )
149159
150160#
151161# Compile tools / tests / benchmarks
152162#
153- enable_testing ()
154-
155- add_library (test -data INTERFACE )
156- target_compile_definitions (test -data INTERFACE SIMDJSON_TEST_DATA_DIR= "${CMAKE_CURRENT_SOURCE_DIR} /jsonchecker/" )
157- target_compile_definitions (test -data INTERFACE SIMDJSON_BENCHMARK_DATA_DIR= "${CMAKE_CURRENT_SOURCE_DIR} /jsonexamples/" )
158- set (EXAMPLE_JSON ${CMAKE_CURRENT_SOURCE_DIR} /jsonexamples/twitter.json)
159163
160164add_subdirectory (dependencies )
161165add_subdirectory (tests )
Original file line number Diff line number Diff line change @@ -37,7 +37,7 @@ Other important files and directories:
3737* ** .drone.yml:** Definitions for Drone CI.
3838* ** .appveyor.yml:** Definitions for Appveyor CI (Windows).
3939* ** .circleci:** Definitions for Circle CI.
40- * ** amalgamation .sh:** Generates singleheader/simdjson.h and singleheader/simdjson.cpp for release.
40+ * ** amalgamate .sh:** Generates singleheader/simdjson.h and singleheader/simdjson.cpp for release.
4141* ** benchmark:** This is where we do benchmarking. Benchmarking is core to every change we make; the
4242 cardinal rule is don't regress performance without knowing exactly why, and what you're trading
4343 for it. If you're not sure what else to do to check your performance, this is always a good start:
@@ -73,7 +73,7 @@ you can regenerate them by running this at the top level:
7373make amalgamate
7474```
7575
76- The amalgamator is at `amalgamation .sh` at the top level. It generates singleheader/simdjson.h by
76+ The amalgamator is at `amalgamate .sh` at the top level. It generates singleheader/simdjson.h by
7777reading through include/simdjson.h, copy/pasting each header file into the amalgamated file at the
7878point it gets included (but only once per header). singleheader/simdjson.cpp is generated from
7979src/simdjson.cpp the same way, except files under generic/ may be included and copy/pasted multiple
Original file line number Diff line number Diff line change @@ -178,13 +178,16 @@ quicktests: run_basictests run_quickstart readme_examples readme_examples_noexce
178178slowtests : run_testjson2json_sh run_issue150_sh
179179
180180amalgamate :
181- ./amalgamation .sh
181+ singleheader/amalgamate .sh
182182
183- singleheader/simdjson.h singleheader/simdjson.cpp singleheader/amalgamation_demo .cpp : amalgamation .sh src/simdjson.cpp $(SRCHEADERS ) $(INCLUDEHEADERS )
184- ./amalgamation .sh
183+ singleheader/simdjson.h singleheader/simdjson.cpp singleheader/amalgamate_demo .cpp : singleheader/amalgamate .sh src/simdjson.cpp $(SRCHEADERS ) $(INCLUDEHEADERS )
184+ singleheader/amalgamate .sh
185185
186- singleheader/demo : singleheader/simdjson.h singleheader/simdjson.cpp singleheader/amalgamation_demo.cpp
187- $(CXX ) $(CXXFLAGS ) -o singleheader/demo singleheader/amalgamation_demo.cpp -Isingleheader
186+ singleheader/demo : singleheader/simdjson.h singleheader/simdjson.cpp singleheader/amalgamate_demo.cpp
187+ $(CXX ) $(CXXFLAGS ) -o singleheader/demo singleheader/amalgamate_demo.cpp -Isingleheader
188+
189+ amalgamate_test : singleheader/demo jsonexamples/twitter.json jsonexamples/amazon_cellphones.ndjson
190+ singleheader/demo jsonexamples/twitter.json jsonexamples/amazon_cellphones.ndjson
188191
189192submodules :
190193 -git submodule update --init --recursive
Original file line number Diff line number Diff line change 1+ set (SIMDJSON_TEST_DATA_DIR ${CMAKE_CURRENT_SOURCE_DIR} PARENT_SCOPE )
2+ add_library (jsonchecker-data INTERFACE )
3+ target_compile_definitions (jsonchecker-data INTERFACE SIMDJSON_TEST_DATA_DIR= "${CMAKE_CURRENT_SOURCE_DIR} /" )
Original file line number Diff line number Diff line change 1+ set (SIMDJSON_BENCHMARK_DATA_DIR ${CMAKE_CURRENT_SOURCE_DIR} PARENT_SCOPE )
2+ set (EXAMPLE_JSON ${CMAKE_CURRENT_SOURCE_DIR} /twitter.json PARENT_SCOPE )
3+ set (EXAMPLE_NDJSON ${CMAKE_CURRENT_SOURCE_DIR} /amazon_cellphones.ndjson PARENT_SCOPE )
4+ add_library (jsonexamples-data INTERFACE )
5+ target_compile_definitions (jsonexamples-data INTERFACE SIMDJSON_BENCHMARK_DATA_DIR= "${CMAKE_CURRENT_SOURCE_DIR} /" )
Original file line number Diff line number Diff line change 1+ #
2+ # Amalgamation
3+ #
4+ if (NOT MSVC )
5+ set (SINGLEHEADER_FILES simdjson.h simdjson.cpp amalgamate_demo.cpp README.md)
6+ add_custom_command (
7+ OUTPUT ${SINGLEHEADER_FILES}
8+ COMMAND ${CMAKE_COMMAND} -E env
9+ AMALGAMATE_SOURCE_PATH=${PROJECT_SOURCE_DIR}/src
10+ AMALGAMATE_INPUT_PATH=${PROJECT_SOURCE_DIR}/include
11+ AMALGAMATE_OUTPUT_PATH=${CMAKE_CURRENT_BINARY_DIR}
12+ ${CMAKE_CURRENT_SOURCE_DIR} /amalgamate.sh
13+ DEPENDS simdjson-source amalgamate.sh
14+ )
15+
16+ add_custom_target (amalgamate DEPENDS ${SINGLEHEADER_FILES} )
17+
18+ add_executable (amalgamate_demo amalgamate_demo.cpp )
19+ target_link_libraries (amalgamate_demo simdjson-include-source )
20+ add_test (amalgamate_demo amalgamate_demo ${EXAMPLE_JSON} ${EXAMPLE_NDJSON} )
21+ endif ()
Original file line number Diff line number Diff line change 1- c++ -O3 -std=c++17 -pthread -o amalgamation_demo amalgamation_demo.cpp && ./amalgamation_demo ../jsonexamples/twitter.json ../jsonexamples/amazon_cellphones.ndjson
1+ Try :
2+ c++ -O3 -std=c++17 -pthread -o amalgamate_demo amalgamate_demo.cpp && ./amalgamate_demo ../jsonexamples/twitter.json ../jsonexamples/amazon_cellphones.ndjson
You can’t perform that action at this time.
0 commit comments