|
| 1 | +cmake_minimum_required(VERSION 3.28) |
| 2 | + |
| 3 | +# Create executable for file_to_stream integration test |
| 4 | +add_executable(file_to_stream file_to_stream.cpp) |
| 5 | + |
| 6 | +target_link_libraries(file_to_stream |
| 7 | + PRIVATE |
| 8 | + sparrow-ipc |
| 9 | + sparrow::sparrow |
| 10 | + sparrow::json_reader |
| 11 | +) |
| 12 | + |
| 13 | +set_target_properties(file_to_stream |
| 14 | + PROPERTIES |
| 15 | + CXX_STANDARD 20 |
| 16 | + CXX_STANDARD_REQUIRED ON |
| 17 | + CXX_EXTENSIONS OFF |
| 18 | +) |
| 19 | + |
| 20 | +target_include_directories(file_to_stream |
| 21 | + PRIVATE |
| 22 | + ${CMAKE_SOURCE_DIR}/include |
| 23 | + ${CMAKE_BINARY_DIR}/generated |
| 24 | +) |
| 25 | + |
| 26 | +add_dependencies(file_to_stream generate_flatbuffers_headers) |
| 27 | + |
| 28 | +# Create executable for stream_to_file integration test |
| 29 | +add_executable(stream_to_file stream_to_file.cpp) |
| 30 | + |
| 31 | +target_link_libraries(stream_to_file |
| 32 | + PRIVATE |
| 33 | + sparrow-ipc |
| 34 | + sparrow::sparrow |
| 35 | +) |
| 36 | + |
| 37 | +set_target_properties(stream_to_file |
| 38 | + PROPERTIES |
| 39 | + CXX_STANDARD 20 |
| 40 | + CXX_STANDARD_REQUIRED ON |
| 41 | + CXX_EXTENSIONS OFF |
| 42 | +) |
| 43 | + |
| 44 | +target_include_directories(stream_to_file |
| 45 | + PRIVATE |
| 46 | + ${CMAKE_SOURCE_DIR}/include |
| 47 | + ${CMAKE_BINARY_DIR}/generated |
| 48 | +) |
| 49 | + |
| 50 | +add_dependencies(stream_to_file generate_flatbuffers_headers) |
| 51 | + |
| 52 | +# Create test executable for integration tools |
| 53 | +add_executable(test_integration_tools main.cpp test_integration_tools.cpp) |
| 54 | + |
| 55 | +target_link_libraries(test_integration_tools |
| 56 | + PRIVATE |
| 57 | + sparrow-ipc |
| 58 | + sparrow::sparrow |
| 59 | + sparrow::json_reader |
| 60 | + doctest::doctest |
| 61 | + arrow-testing-data |
| 62 | +) |
| 63 | + |
| 64 | +target_compile_definitions(test_integration_tools |
| 65 | + PRIVATE |
| 66 | + INTEGRATION_TOOLS_DIR="${CMAKE_CURRENT_BINARY_DIR}" |
| 67 | +) |
| 68 | + |
| 69 | +set_target_properties(test_integration_tools |
| 70 | + PROPERTIES |
| 71 | + CXX_STANDARD 20 |
| 72 | + CXX_STANDARD_REQUIRED ON |
| 73 | + CXX_EXTENSIONS OFF |
| 74 | +) |
| 75 | + |
| 76 | +target_include_directories(test_integration_tools |
| 77 | + PRIVATE |
| 78 | + ${CMAKE_SOURCE_DIR}/include |
| 79 | + ${CMAKE_BINARY_DIR}/generated |
| 80 | +) |
| 81 | + |
| 82 | +add_dependencies(test_integration_tools generate_flatbuffers_headers file_to_stream stream_to_file) |
| 83 | + |
| 84 | +# Register with CTest |
| 85 | +enable_testing() |
| 86 | +add_test(NAME integration_tools_test COMMAND test_integration_tools) |
| 87 | + |
| 88 | +# On Windows, copy required DLLs |
| 89 | +if(WIN32) |
| 90 | + add_custom_command( |
| 91 | + TARGET file_to_stream POST_BUILD |
| 92 | + COMMAND ${CMAKE_COMMAND} -E copy_if_different |
| 93 | + "$<TARGET_FILE:sparrow::sparrow>" |
| 94 | + "$<TARGET_FILE_DIR:file_to_stream>" |
| 95 | + COMMAND ${CMAKE_COMMAND} -E copy_if_different |
| 96 | + "$<TARGET_FILE:sparrow-ipc>" |
| 97 | + "$<TARGET_FILE_DIR:file_to_stream>" |
| 98 | + COMMAND ${CMAKE_COMMAND} -E copy_if_different |
| 99 | + "$<TARGET_FILE:sparrow::json_reader>" |
| 100 | + "$<TARGET_FILE_DIR:file_to_stream>" |
| 101 | + COMMENT "Copying DLLs to file_to_stream executable directory" |
| 102 | + ) |
| 103 | + |
| 104 | + add_custom_command( |
| 105 | + TARGET stream_to_file POST_BUILD |
| 106 | + COMMAND ${CMAKE_COMMAND} -E copy_if_different |
| 107 | + "$<TARGET_FILE:sparrow::sparrow>" |
| 108 | + "$<TARGET_FILE_DIR:stream_to_file>" |
| 109 | + COMMAND ${CMAKE_COMMAND} -E copy_if_different |
| 110 | + "$<TARGET_FILE:sparrow-ipc>" |
| 111 | + "$<TARGET_FILE_DIR:stream_to_file>" |
| 112 | + COMMENT "Copying DLLs to stream_to_file executable directory" |
| 113 | + ) |
| 114 | + |
| 115 | + add_custom_command( |
| 116 | + TARGET test_integration_tools POST_BUILD |
| 117 | + COMMAND ${CMAKE_COMMAND} -E copy_if_different |
| 118 | + "$<TARGET_FILE:sparrow::sparrow>" |
| 119 | + "$<TARGET_FILE_DIR:test_integration_tools>" |
| 120 | + COMMAND ${CMAKE_COMMAND} -E copy_if_different |
| 121 | + "$<TARGET_FILE:sparrow-ipc>" |
| 122 | + "$<TARGET_FILE_DIR:test_integration_tools>" |
| 123 | + COMMAND ${CMAKE_COMMAND} -E copy_if_different |
| 124 | + "$<TARGET_FILE:sparrow::json_reader>" |
| 125 | + "$<TARGET_FILE_DIR:test_integration_tools>" |
| 126 | + COMMENT "Copying DLLs to test_integration_tools executable directory" |
| 127 | + ) |
| 128 | +endif() |
| 129 | + |
| 130 | +set_target_properties(file_to_stream stream_to_file test_integration_tools PROPERTIES FOLDER "Integration Tests") |
0 commit comments