Skip to content

Commit 191faea

Browse files
authored
Merge pull request simdjson#853 from furkanusta/windows-parsingchecks
Enable numberparsingcheck and stringparsingcheck on MSVC
2 parents 1153aaf + 1e9488d commit 191faea

File tree

4 files changed

+17
-9
lines changed

4 files changed

+17
-9
lines changed

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)