Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 19 additions & 1 deletion .github/workflows/linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ jobs:
-DCMAKE_INSTALL_PREFIX=$CONDA_PREFIX \
-DCMAKE_PREFIX_PATH=$CONDA_PREFIX \
-DSPARROW_IPC_BUILD_SHARED=${{ matrix.build_shared }} \
-DSPARROW_IPC_BUILD_TESTS=ON
-DSPARROW_IPC_BUILD_TESTS=ON \
-DSPARROW_IPC_BUILD_EXAMPLES=ON

- name: Build sparrow-ipc
working-directory: build
Expand All @@ -50,6 +51,14 @@ jobs:
working-directory: build
run: cmake --build . --target run_tests_with_junit_report

- name: Build example
working-directory: build
run: cmake --build . --target write_and_read_streams

- name: Run example
working-directory: build
run: cmake --build . --target run_example

- name: Install
working-directory: build
run: cmake --install .
Expand All @@ -71,6 +80,7 @@ jobs:
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \
-DSPARROW_IPC_BUILD_SHARED=${{ matrix.build_shared }} \
-DSPARROW_IPC_BUILD_TESTS=ON \
-DSPARROW_IPC_BUILD_EXAMPLES=ON \
-DFETCH_DEPENDENCIES_WITH_CMAKE=MISSING

- name: Build sparrow-ipc
Expand All @@ -85,6 +95,14 @@ jobs:
working-directory: build
run: cmake --build . --target run_tests_with_junit_report

- name: Build example
working-directory: build
run: cmake --build . --target write_and_read_streams

- name: Run example
working-directory: build
run: cmake --build . --target run_example

- name: Install
working-directory: build
run: sudo cmake --install .
20 changes: 19 additions & 1 deletion .github/workflows/osx.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ jobs:
-DCMAKE_INSTALL_PREFIX=$CONDA_PREFIX \
-DCMAKE_PREFIX_PATH=$CONDA_PREFIX \
-DSPARROW_IPC_BUILD_SHARED=${{ matrix.build_shared }} \
-DSPARROW_IPC_BUILD_TESTS=ON
-DSPARROW_IPC_BUILD_TESTS=ON \
-DSPARROW_IPC_BUILD_EXAMPLES=ON

- name: Build sparrow-ipc
working-directory: build
Expand All @@ -55,6 +56,14 @@ jobs:
working-directory: build
run: cmake --build . --target run_tests_with_junit_report

- name: Build example
working-directory: build
run: cmake --build . --target write_and_read_streams

- name: Run example
working-directory: build
run: cmake --build . --target run_example

- name: Install
working-directory: build
run: cmake --install .
Expand All @@ -81,6 +90,7 @@ jobs:
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \
-DSPARROW_IPC_BUILD_SHARED=${{ matrix.build_shared }} \
-DSPARROW_IPC_BUILD_TESTS=ON \
-DSPARROW_IPC_BUILD_EXAMPLES=ON \
-DFETCH_DEPENDENCIES_WITH_CMAKE=MISSING

- name: Build sparrow-ipc
Expand All @@ -95,6 +105,14 @@ jobs:
working-directory: build
run: cmake --build . --target run_tests_with_junit_report

- name: Build example
working-directory: build
run: cmake --build . --target write_and_read_streams

- name: Run example
working-directory: build
run: cmake --build . --target run_example

- name: Install
working-directory: build
run: sudo cmake --install .
20 changes: 19 additions & 1 deletion .github/workflows/windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ jobs:
-DCMAKE_INSTALL_PREFIX=$CONDA_PREFIX \
-DCMAKE_PREFIX_PATH=$GLOB_PREFIX_PATH \
-DSPARROW_IPC_BUILD_SHARED=${{ matrix.build_shared }} \
-DSPARROW_IPC_BUILD_TESTS=ON
-DSPARROW_IPC_BUILD_TESTS=ON \
-DSPARROW_IPC_BUILD_EXAMPLES=ON

- name: Build sparrow-ipc
working-directory: build
Expand All @@ -55,6 +56,14 @@ jobs:
run: |
cmake --build . --config ${{ matrix.build_type }} --target run_tests_with_junit_report

- name: Build example
working-directory: build
run: cmake --build . --config ${{ matrix.build_type }} --target write_and_read_streams

- name: Run example
working-directory: build
run: cmake --build . --config ${{ matrix.build_type }} --target run_example

- name: Install
working-directory: build
run: cmake --install . --config ${{ matrix.build_type }}
Expand All @@ -80,6 +89,7 @@ jobs:
cmake -S ./ -B ./build \
-DSPARROW_IPC_BUILD_SHARED=${{ matrix.build_shared }} \
-DSPARROW_IPC_BUILD_TESTS=ON \
-DSPARROW_IPC_BUILD_EXAMPLES=ON \
-DFETCH_DEPENDENCIES_WITH_CMAKE=MISSING \
$TEST_COVERAGE_ACTIVATION

Expand All @@ -95,6 +105,14 @@ jobs:
working-directory: build
run: cmake --build . --config ${{ matrix.build_type }} --target run_tests_with_junit_report

- name: Build example
working-directory: build
run: cmake --build . --config ${{ matrix.build_type }} --target write_and_read_streams

- name: Run example
working-directory: build
run: cmake --build . --config ${{ matrix.build_type }} --target run_example

- name: Install
working-directory: build
run: cmake --install . --config ${{ matrix.build_type }}
Expand Down
10 changes: 10 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,9 @@ MESSAGE(STATUS "🔧 Build tests: ${SPARROW_IPC_BUILD_TESTS}")
OPTION(SPARROW_IPC_BUILD_DOCS "Build sparrow-ipc documentation" OFF)
MESSAGE(STATUS "🔧 Build docs: ${SPARROW_IPC_BUILD_DOCS}")

OPTION(SPARROW_IPC_BUILD_EXAMPLES "Build sparrow-ipc examples" OFF)
MESSAGE(STATUS "🔧 Build examples: ${SPARROW_IPC_BUILD_EXAMPLES}")

# Code coverage
# =============
OPTION(SPARROW_IPC_ENABLE_COVERAGE "Enable sparrow-ipc test coverage" OFF)
Expand Down Expand Up @@ -270,6 +273,13 @@ if(SPARROW_IPC_BUILD_DOCS)
add_subdirectory(docs)
endif()

# Examples
# ========
if(SPARROW_IPC_BUILD_EXAMPLES)
message(STATUS "🔨 Create examples targets")
add_subdirectory(examples)
endif()

# Installation
# ============
include(GNUInstallDirs)
Expand Down
4 changes: 2 additions & 2 deletions cmake/external_dependencies.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ endif()
find_package_or_fetch(
PACKAGE_NAME sparrow
GIT_REPOSITORY https://github.com/man-group/sparrow.git
TAG 1.1.2
TAG 1.2.0
)
unset(CREATE_JSON_READER_TARGET)

Expand Down Expand Up @@ -111,7 +111,7 @@ if(SPARROW_IPC_BUILD_TESTS)

# Iterate over all the files in the arrow-testing-data source directiory. When it's a gz, extract in place.
file(GLOB_RECURSE arrow_testing_data_targz_files CONFIGURE_DEPENDS
"${arrow-testing_SOURCE_DIR}/data/arrow-ipc-stream/integration/1.0.0-littleendian/*.json.gz"
"${arrow-testing_SOURCE_DIR}/data/arrow-ipc-stream/integration/cpp-21.0.0/*.json.gz"
)
foreach(file_path IN LISTS arrow_testing_data_targz_files)
cmake_path(GET file_path PARENT_PATH parent_dir)
Expand Down
55 changes: 55 additions & 0 deletions examples/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
cmake_minimum_required(VERSION 3.28)

# Create executable for the write_and_read_streams example
add_executable(write_and_read_streams write_and_read_streams.cpp)

# Link against sparrow-ipc and its dependencies
target_link_libraries(write_and_read_streams
PRIVATE
sparrow-ipc
sparrow::sparrow
arrow-testing-data
)

# Set C++ standard to match the main project
set_target_properties(write_and_read_streams
PROPERTIES
CXX_STANDARD 20
CXX_STANDARD_REQUIRED ON
CXX_EXTENSIONS OFF
)

# Include directories for headers
target_include_directories(write_and_read_streams
PRIVATE
${CMAKE_SOURCE_DIR}/include
${CMAKE_BINARY_DIR}/generated
)

# Ensure generated flatbuffer headers are available
add_dependencies(write_and_read_streams generate_flatbuffers_headers)

# Optional: Copy to build directory for easy execution
if(WIN32)
# On Windows, copy required DLLs
add_custom_command(
TARGET write_and_read_streams POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different
"$<TARGET_FILE:sparrow::sparrow>"
"$<TARGET_FILE_DIR:write_and_read_streams>"
COMMAND ${CMAKE_COMMAND} -E copy_if_different
"$<TARGET_FILE:sparrow-ipc>"
"$<TARGET_FILE_DIR:write_and_read_streams>"
COMMENT "Copying sparrow and sparrow-ipc DLLs to example executable directory"
)
endif()

# Create a custom target to easily run the example
add_custom_target(run_example
COMMAND write_and_read_streams
DEPENDS write_and_read_streams
COMMENT "Running write_and_read_streams example"
USES_TERMINAL
)

set_target_properties(run_example PROPERTIES FOLDER "Examples")
Loading
Loading