Skip to content

Commit

Permalink
Build examples.
Browse files Browse the repository at this point in the history
  • Loading branch information
andreiavrammsd committed Oct 8, 2023
1 parent 0da44cd commit a40ed21
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/cmake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ jobs:
working-directory: ${{github.workspace}}/build
shell: bash
# Execute the build. You can specify a specific target with "--target <NAME>"
run: cmake --build . --config ${{ matrix.config.build_type }} --target channel_test11 channel_test14 channel_test17
run: cmake --build . --config ${{ matrix.config.build_type }} --target tests examples

- name: Test
working-directory: ${{github.workspace}}/build
Expand Down
12 changes: 10 additions & 2 deletions examples/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,18 @@ function(add_example NAME)
add_executable(${NAME} ${ARGN})

set_target_warnings(${NAME} PRIVATE)
target_link_libraries(${NAME} -ltsan)
target_compile_options(${NAME} PRIVATE -fsanitize=thread)

if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
target_link_libraries(${NAME} -ltsan)
target_compile_options(${NAME} PRIVATE -fsanitize=thread)
endif()

add_dependencies(examples ${NAME})
endfunction()

add_custom_target(examples)

# Examples
add_example(example_basic basic.cpp)
add_example(example_close close.cpp)
add_example(example_move move.cpp)
Expand Down
4 changes: 4 additions & 0 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,12 @@ function(package_add_test TESTNAME)
endif ()

add_test(NAME ${TESTNAME} COMMAND ${TESTNAME})

add_dependencies(tests ${TESTNAME})
endfunction()

add_custom_target(tests)

# Tests
package_add_test(channel_test11 channel_test.cpp blocking_iterator_test.cpp)
package_add_test(channel_test14 channel_test.cpp blocking_iterator_test.cpp)
Expand Down

0 comments on commit a40ed21

Please sign in to comment.