From 8b261c133f9560f326537fc794641aa9ee4119c5 Mon Sep 17 00:00:00 2001 From: rstein Date: Tue, 20 Feb 2024 17:28:24 +0100 Subject: [PATCH] bump to latest GR4.0-alpha --- CMakeLists.txt | 10 +++++++++- blocklib/picoscope/Picoscope.hpp | 11 +++++------ blocklib/timing/CMakeLists.txt | 2 +- blocklib/timing/include/timing.hpp | 4 ++-- blocklib/timing/test/CMakeLists.txt | 7 ++++--- 5 files changed, 21 insertions(+), 13 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1c3f4eb..68b7331 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -12,6 +12,14 @@ if (NOT DEFINED GR_DIGITIZERS_TOPLEVEL_PROJECT) endif () endif () +if(CMAKE_CXX_COMPILER_ID MATCHES ".*Clang") # set default C++ STL to Clang's libc++ when using Clang + add_compile_options(-stdlib=libc++ -fcolor-diagnostics) + set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -stdlib=libc++ -lc++") + set(CLANG true) +elseif(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") + add_compile_options(-fdiagnostics-color=always) +endif() + list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules) include(cmake/CMakeRC.cmake) @@ -21,7 +29,7 @@ set(ENABLE_TESTING OFF) FetchContent_Declare( graph-prototype GIT_REPOSITORY https://github.com/fair-acc/graph-prototype.git - GIT_TAG c9b2dd33dcfaf7ab56dc6b1c42b73f46e7dfc001 # main as of 2024-02-01 + GIT_TAG ed9738d809d4f89ddbbee49fd9a3bbd87c27bfab # main as of 2024-02-20 ) FetchContent_Declare( diff --git a/blocklib/picoscope/Picoscope.hpp b/blocklib/picoscope/Picoscope.hpp index d79742b..cead451 100644 --- a/blocklib/picoscope/Picoscope.hpp +++ b/blocklib/picoscope/Picoscope.hpp @@ -301,8 +301,7 @@ struct Picoscope : public gr::Block, gr::Supported } if (ps_state.data_finished) { - std::atomic_store_explicit(&this->state, gr::lifecycle::State::STOPPED, std::memory_order_release); - this->state.notify_all(); + this->requestStop(); this->publishTag({ { gr::tag::END_OF_STREAM, true } }, 0); return { 0, 0, DONE }; } @@ -495,14 +494,14 @@ struct Picoscope : public gr::Block, gr::Supported processDriverData(std::size_t nrSamples, std::size_t offset) { std::vector triggerOffsets; - using ChannelOutputRange = decltype(ps_state.channels[0].data_writer.reserve_output_range(1)); + using ChannelOutputRange = decltype(ps_state.channels[0].data_writer.reserve(1)); std::vector channelOutputs; channelOutputs.reserve(ps_state.channels.size()); for (std::size_t channelIdx = 0; channelIdx < ps_state.channels.size(); ++channelIdx) { auto &channel = ps_state.channels[channelIdx]; - channelOutputs.push_back(channel.data_writer.reserve_output_range(nrSamples)); + channelOutputs.push_back(channel.data_writer.reserve(nrSamples)); auto &output = channelOutputs[channelIdx]; const auto driverData = std::span(channel.driver_buffer).subspan(offset, nrSamples); @@ -543,7 +542,7 @@ struct Picoscope : public gr::Block, gr::Supported if (tagsToWrite == 0) { continue; } - auto writeTags = channel.tag_writer.reserve_output_range(tagsToWrite); + auto writeTags = channel.tag_writer.reserve(tagsToWrite); if (writeSignalInfo) { // raw index is index - 1 writeTags[0].index = static_cast(ps_state.produced_worker - 1); @@ -652,7 +651,7 @@ struct Picoscope : public gr::Block, gr::Supported void reportError(Error ec) { - auto out = ps_state.errors.writer.reserve_output_range(1); + auto out = ps_state.errors.writer.reserve(1); out[0] = { ps_state.produced_worker, ec }; out.publish(1); } diff --git a/blocklib/timing/CMakeLists.txt b/blocklib/timing/CMakeLists.txt index 25a5f0e..4e23c99 100644 --- a/blocklib/timing/CMakeLists.txt +++ b/blocklib/timing/CMakeLists.txt @@ -1,4 +1,4 @@ -if (NOT EMSCRIPTEN) +if (NOT EMSCRIPTEN AND NOT CLANG) add_library(timing INTERFACE) target_include_directories(timing INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/include/) diff --git a/blocklib/timing/include/timing.hpp b/blocklib/timing/include/timing.hpp index 0897d60..92d9db1 100644 --- a/blocklib/timing/include/timing.hpp +++ b/blocklib/timing/include/timing.hpp @@ -124,14 +124,14 @@ class Timing { static_assert(position + bitsize <= 64); // assert that we only consider existing bits static_assert(std::numeric_limits::max() >= ((1UL << bitsize) - 1)); // make sure the data fits into the return type return static_cast((value >> position) & ((1UL << bitsize) - 1)); - }; + } template static constexpr uint64_t fromField(FieldType value) { static_assert(position + bitsize <= 64); static_assert(std::numeric_limits::max() >= ((1UL << bitsize) - 1)); return ((value & ((1UL << bitsize) - 1)) << position); - }; + } explicit Event(uint64_t timestamp = 0, uint64_t id = 1UL << 60, uint64_t param= 0, uint16_t _flags = 0, uint64_t _executed = 0) : // id diff --git a/blocklib/timing/test/CMakeLists.txt b/blocklib/timing/test/CMakeLists.txt index f1e44be..5f9f0ad 100644 --- a/blocklib/timing/test/CMakeLists.txt +++ b/blocklib/timing/test/CMakeLists.txt @@ -12,6 +12,7 @@ function(add_ut_test TEST_NAME) add_test(NAME ${TEST_NAME} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} ${CMAKE_CURRENT_BINARY_DIR}/${TEST_NAME}) endfunction() -add_ut_test(qa_timing) -target_link_libraries(qa_timing PRIVATE timing PkgConfig::saftlib PkgConfig::etherbone) - +if(NOT EMSCRIPTEN AND NOT CLANG) ## clang/libc++ does not support the require features to convert from TAI to UTC and 'std::views::enumerate' + add_ut_test(qa_timing) + target_link_libraries(qa_timing PRIVATE timing PkgConfig::saftlib PkgConfig::etherbone) +endif()