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
30 changes: 30 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -89,3 +89,33 @@ jobs:

- name: Test
run: ctest --test-dir build --output-on-failure

build-with-parent-event-hub:
name: build-with-parent-event-hub-${{ matrix.platform }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- platform: linux
os: ubuntu-22.04
- platform: windows
os: windows-latest
- platform: macos
os: macos-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: true

- name: Configure parent-provided event hub fixture
run: >
cmake -S tests/cmake/parent_event_hub -B build-parent-event-hub -G Ninja

- name: Build parent-provided event hub fixture
run: cmake --build build-parent-event-hub --parallel

- name: Test parent-provided event hub fixture
run: ctest --test-dir build-parent-event-hub --output-on-failure
18 changes: 10 additions & 8 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -66,14 +66,16 @@ if(CONSOLIX_USE_CXXOPTS)
endif()

if(CONSOLIX_USE_EVENT_HUB)
set(EVENT_HUB_CPP_BUILD_EXAMPLES OFF CACHE BOOL "Build event-hub-cpp examples" FORCE)
set(EVENT_HUB_CPP_BUILD_TESTS OFF CACHE BOOL "Build event-hub-cpp tests" FORCE)
set(EVENT_HUB_CPP_USE_TIME_SHIELD OFF CACHE BOOL "Enable optional time-shield-cpp integration" FORCE)

add_subdirectory(
${CMAKE_CURRENT_SOURCE_DIR}/external/event-hub-cpp
${CMAKE_CURRENT_BINARY_DIR}/external/event-hub-cpp
)
if(NOT TARGET event_hub::event_hub)
set(EVENT_HUB_CPP_BUILD_EXAMPLES OFF CACHE BOOL "Build event-hub-cpp examples" FORCE)
set(EVENT_HUB_CPP_BUILD_TESTS OFF CACHE BOOL "Build event-hub-cpp tests" FORCE)
set(EVENT_HUB_CPP_USE_TIME_SHIELD OFF CACHE BOOL "Enable optional time-shield-cpp integration" FORCE)

add_subdirectory(
${CMAKE_CURRENT_SOURCE_DIR}/external/event-hub-cpp
${CMAKE_CURRENT_BINARY_DIR}/external/event-hub-cpp
)
endif()
target_link_libraries(Consolix INTERFACE event_hub::event_hub)
endif()

Expand Down
31 changes: 31 additions & 0 deletions tests/cmake/parent_event_hub/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
cmake_minimum_required(VERSION 3.14)

project(consolix_parent_event_hub LANGUAGES CXX)

add_library(event_hub_cpp INTERFACE)
add_library(event_hub::event_hub ALIAS event_hub_cpp)

set(CONSOLIX_CXX_STANDARD 17 CACHE STRING "" FORCE)
set(CONSOLIX_USE_LOGIT OFF CACHE BOOL "" FORCE)
set(CONSOLIX_USE_JSON OFF CACHE BOOL "" FORCE)
set(CONSOLIX_USE_CXXOPTS OFF CACHE BOOL "" FORCE)
set(CONSOLIX_USE_EVENT_HUB ON CACHE BOOL "" FORCE)
set(CONSOLIX_BUILD_EXAMPLES OFF CACHE BOOL "" FORCE)
set(CONSOLIX_BUILD_TESTS OFF CACHE BOOL "" FORCE)
add_subdirectory(
"${CMAKE_CURRENT_LIST_DIR}/../../.."
"${CMAKE_CURRENT_BINARY_DIR}/consolix"
)

get_target_property(consolix_link_libraries Consolix INTERFACE_LINK_LIBRARIES)
if(NOT "event_hub::event_hub" IN_LIST consolix_link_libraries)
message(FATAL_ERROR "Consolix must link the parent-provided event hub target")
endif()

add_custom_target(parent_event_hub_target_smoke ALL)

enable_testing()
add_test(
NAME parent_event_hub_target_smoke
COMMAND ${CMAKE_COMMAND} --build ${CMAKE_BINARY_DIR} --target parent_event_hub_target_smoke
)
Loading