Skip to content

Commit aa53d87

Browse files
committed
Generate test data when tests are built
1 parent 8c600ca commit aa53d87

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

jsonexamples/CMakeLists.txt

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
set(SIMDJSON_BENCHMARK_DATA_DIR ${CMAKE_CURRENT_BINARY_DIR} PARENT_SCOPE)
22
set(EXAMPLE_JSON ${CMAKE_CURRENT_BINARY_DIR}/twitter.json PARENT_SCOPE)
33
set(EXAMPLE_NDJSON ${CMAKE_CURRENT_BINARY_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_BINARY_DIR}/")
64

75
# Copy static files to the build dir so they live alongside the generated ones
86
file(GLOB_RECURSE example_files RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.json *.ndjson)
@@ -11,3 +9,8 @@ foreach(example_file ${example_files})
119
endforeach(example_file)
1210

1311
add_subdirectory(generated)
12+
13+
add_library(jsonexamples-data INTERFACE)
14+
target_compile_definitions(jsonexamples-data INTERFACE SIMDJSON_BENCHMARK_DATA_DIR="${CMAKE_CURRENT_BINARY_DIR}/")
15+
add_dependencies(jsonexamples-data ${example_files})
16+
add_dependencies(jsonexamples-data generated-data)

jsonexamples/generated/CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,7 @@ if (RUBY_EXECUTABLE)
1111
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
1212
)
1313
add_custom_target(generated-data DEPENDS ${generated_files})
14+
else (RUBY_EXECUTABLE)
15+
# TODO make this work without Ruby and make it part of the normal build
16+
add_custom_target(generated-data)
1417
endif (RUBY_EXECUTABLE)

0 commit comments

Comments
 (0)