Skip to content

Commit af968c5

Browse files
committed
Merge branch 'master' of github.com:simdjson/simdjson into cmake-flags
2 parents 940c8fc + f93dbe5 commit af968c5

File tree

9 files changed

+667
-657
lines changed

9 files changed

+667
-657
lines changed

benchmark/checkperf.cmake

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,9 @@ if (Git_FOUND)
5858
# - second, cmake ..
5959
add_custom_command(
6060
OUTPUT ${SIMDJSON_CHECKPERF_DIR}/build/cmake_install.cmake # We make many things but this seems the most cross-platform one we can depend on
61-
COMMAND ${CMAKE_COMMAND} -DSIMDJSON_GOOGLE_BENCHMARKS=OFF -DSIMDJSON_COMPETITION=OFF -G ${CMAKE_GENERATOR} ..
61+
COMMAND
62+
${CMAKE_COMMAND} -E env CXX=${CMAKE_CXX_COMPILER} CC=${CMAKE_C_COMPILER}
63+
${CMAKE_COMMAND} -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -DSIMDJSON_GOOGLE_BENCHMARKS=OFF -DSIMDJSON_COMPETITION=OFF -G ${CMAKE_GENERATOR} ..
6264
WORKING_DIRECTORY ${SIMDJSON_CHECKPERF_DIR}/build
6365
DEPENDS ${SIMDJSON_CHECKPERF_DIR}/build/CMakeCache.txt
6466
)

include/CMakeLists.txt

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,3 @@ target_include_directories(simdjson-headers INTERFACE
1111
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCDIR}>)
1212

1313
install(TARGETS simdjson-headers EXPORT simdjson-config INCLUDES DESTINATION include)
14-
install(DIRECTORY simdjson DESTINATION include FILES_MATCHING PATTERN *.h)
15-
install(DIRECTORY simdjson DESTINATION include FILES_MATCHING PATTERN *.hpp)
16-
install(FILES simdjson.h DESTINATION include)

singleheader/CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,6 @@ else(MSVC)
7272
# "make amalgamate" to generate the header files directly and update the original source
7373
#
7474
add_custom_target(amalgamate DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/simdjson.cpp ${CMAKE_CURRENT_SOURCE_DIR}/simdjson.h ${CMAKE_CURRENT_SOURCE_DIR}/amalgamate_demo.cpp ${CMAKE_CURRENT_SOURCE_DIR}/README.md)
75-
7675
endif(MSVC)
7776

7877

@@ -96,3 +95,5 @@ add_dependencies(simdjson-singleheader-source amalgamate)
9695
add_executable(amalgamate_demo $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/amalgamate_demo.cpp>)
9796
target_link_libraries(amalgamate_demo simdjson-singleheader-include-source simdjson-internal-flags simdjson-flags)
9897
add_test(amalgamate_demo amalgamate_demo ${EXAMPLE_JSON} ${EXAMPLE_NDJSON})
98+
99+
install(FILES simdjson.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})

singleheader/amalgamate.sh

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@
66
set -e
77

88
SCRIPTPATH="$( cd "$(dirname "$0")" ; pwd -P )"
9-
9+
PROJECTPATH=$(realpath "$SCRIPTPATH/..");
1010
echo "We are about to amalgamate all simdjson files into one source file. "
1111
echo "See https://www.sqlite.org/amalgamation.html and https://en.wikipedia.org/wiki/Single_Compilation_Unit for rationale. "
1212

13-
if [ -z "$AMALGAMATE_SOURCE_PATH" ]; then AMALGAMATE_SOURCE_PATH="$SCRIPTPATH/../src"; fi
14-
if [ -z "$AMALGAMATE_INCLUDE_PATH" ]; then AMALGAMATE_INCLUDE_PATH="$SCRIPTPATH/../include"; fi
13+
if [ -z "$AMALGAMATE_SOURCE_PATH" ]; then AMALGAMATE_SOURCE_PATH=$(realpath "$SCRIPTPATH/../src"); fi
14+
if [ -z "$AMALGAMATE_INCLUDE_PATH" ]; then AMALGAMATE_INCLUDE_PATH=$(realpath "$SCRIPTPATH/../include"); fi
1515
if [ -z "$AMALGAMATE_OUTPUT_PATH" ]; then AMALGAMATE_OUTPUT_PATH="$SCRIPTPATH"; fi
1616

1717
# this list excludes the "src/generic headers"
@@ -66,8 +66,9 @@ function doinclude()
6666
function dofile()
6767
{
6868
file="$1/$2"
69+
RELFILE=${file#"$PROJECTPATH/"}
6970
# Last lines are always ignored. Files should end by an empty lines.
70-
echo "/* begin file ${2} */"
71+
echo "/* begin file $RELFILE */"
7172
# echo "#line 8 \"$1\"" ## redefining the line/file is not nearly as useful as it sounds for debugging. It breaks IDEs.
7273
while IFS= read -r line || [ -n "$line" ];
7374
do

src/jsoncharutils.h

Lines changed: 640 additions & 639 deletions
Large diffs are not rendered by default.

tests/CMakeLists.txt

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,12 @@ include(${PROJECT_SOURCE_DIR}/tests/add_cpp_test.cmake)
4242
#
4343
# These tests explicitly do #include "simdjson.cpp" so they can override stuff
4444
#
45-
if (NOT MSVC) # Can't get simdjson-source to compile on Windows for some reason.
46-
add_cpp_test(numberparsingcheck LABELS acceptance per_implementation)
47-
target_link_libraries(numberparsingcheck simdjson-include-source)
48-
add_cpp_test(stringparsingcheck LABELS acceptance per_implementation)
49-
target_link_libraries(stringparsingcheck simdjson-include-source)
50-
endif()
45+
add_cpp_test(numberparsingcheck LABELS acceptance per_implementation)
46+
target_link_libraries(numberparsingcheck simdjson-include-source simdjson-windows-headers)
47+
target_compile_definitions(numberparsingcheck PRIVATE NOMINMAX)
48+
add_cpp_test(stringparsingcheck LABELS acceptance per_implementation)
49+
target_link_libraries(stringparsingcheck simdjson-include-source simdjson-windows-headers)
50+
target_compile_definitions(stringparsingcheck PRIVATE NOMINMAX)
5151

5252
# All remaining tests link with simdjson proper
5353
link_libraries(simdjson)

tests/numberparsingcheck.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
#include <cstring>
2-
#include <dirent.h>
32
#include <inttypes.h>
43
#include <math.h>
54
#include <stdbool.h>
@@ -10,6 +9,11 @@
109
#define JSON_TEST_NUMBERS
1110
#endif
1211

12+
#ifndef _MSC_VER
13+
#include <dirent.h>
14+
#else
15+
#include <dirent_portable.h>
16+
#endif
1317
#include "simdjson.h"
1418

1519
// ulp distance

tests/stringparsingcheck.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
#include <cassert>
22
#include <climits>
33
#include <cstring>
4-
#include <dirent.h>
54
#include <inttypes.h>
65
#include <iostream>
76
#include <math.h>
@@ -13,6 +12,11 @@
1312
#define JSON_TEST_STRINGS
1413
#endif
1514

15+
#ifndef _MSC_VER
16+
#include <dirent.h>
17+
#else
18+
#include <dirent_portable.h>
19+
#endif
1620
#include "simdjson.h"
1721

1822
char *fullpath;

windows/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
add_library(simdjson-windows-headers INTERFACE)
22
if(MSVC)
33
target_include_directories(simdjson-windows-headers INTERFACE .)
4-
endif()
4+
endif()

0 commit comments

Comments
 (0)