Skip to content

Commit

Permalink
Use new yaml parser for grc (#478)
Browse files Browse the repository at this point in the history
* Use new Yaml parser for grc
* Remove yaml-cpp dependency
* yaml: Fix common_blocks types to be loaded by YAML
* yaml: Fix clang-build when loading property map
* Fix qa_Settings types when building with clang

Signed-off-by: Daniel Nicoletti <[email protected]>
  • Loading branch information
dantti authored Dec 6, 2024
1 parent 1b4931f commit 216bc26
Show file tree
Hide file tree
Showing 13 changed files with 300 additions and 403 deletions.
8 changes: 0 additions & 8 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -250,13 +250,6 @@ FetchContent_Declare(
GIT_TAG v2.0.1 # latest tag as of 2023-12-18
)

FetchContent_Declare(
yaml-cpp
GIT_REPOSITORY https://github.com/jbeder/yaml-cpp.git
GIT_TAG 0.8.0
PATCH_COMMAND git apply ${CMAKE_CURRENT_SOURCE_DIR}/patches/yaml-cpp/0001-Avoid-static-reference-to-temporary.patch
UPDATE_DISCONNECTED 1)

FetchContent_Declare(
vir-simd
GIT_REPOSITORY https://github.com/mattkretz/vir-simd.git
Expand All @@ -271,7 +264,6 @@ FetchContent_MakeAvailable(
fmt
pmt
ut
yaml-cpp
vir-simd
cpp-httplib)

Expand Down
26 changes: 21 additions & 5 deletions blocks/basic/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,23 @@
add_library(gr-basic INTERFACE)
add_library(
gr-basic
INTERFACE
include/gnuradio-4.0/basic/clock_source.hpp
include/gnuradio-4.0/basic/common_blocks.hpp
include/gnuradio-4.0/basic/ConverterBlocks.hpp
include/gnuradio-4.0/basic/DataSink.hpp
include/gnuradio-4.0/basic/function_generator.hpp
include/gnuradio-4.0/basic/FunctionGenerator.hpp
include/gnuradio-4.0/basic/PythonBlock.hpp
include/gnuradio-4.0/basic/PythonInterpreter.hpp
include/gnuradio-4.0/basic/Selector.hpp
include/gnuradio-4.0/basic/SignalGenerator.hpp
include/gnuradio-4.0/basic/StreamToDataSet.hpp
include/gnuradio-4.0/basic/SyncBlock.hpp
include/gnuradio-4.0/basic/Trigger.hpp)
target_link_libraries(gr-basic INTERFACE gnuradio-core gnuradio-algorithm)
target_include_directories(gr-basic INTERFACE $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include/> $<INSTALL_INTERFACE:include/>)
target_include_directories(gr-basic INTERFACE $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include/>
$<INSTALL_INTERFACE:include/>)

if (ENABLE_TESTING)
add_subdirectory(test)
endif ()
if(ENABLE_TESTING)
add_subdirectory(test)
endif()
4 changes: 2 additions & 2 deletions blocks/basic/include/gnuradio-4.0/basic/common_blocks.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class builtin_multiply : public gr::Block<builtin_multiply<T>> {
template<typename T>
class builtin_counter : public gr::Block<builtin_counter<T>> {
public:
static std::size_t s_event_count;
static gr::Size_t s_event_count;

gr::PortIn<T> in;
gr::PortOut<T> out;
Expand All @@ -53,7 +53,7 @@ class builtin_counter : public gr::Block<builtin_counter<T>> {
};

template<typename T>
std::size_t builtin_counter<T>::s_event_count = 0;
gr::Size_t builtin_counter<T>::s_event_count = 0;

template<typename T>
struct MultiAdder : public gr::Block<MultiAdder<T>> {
Expand Down
70 changes: 57 additions & 13 deletions core/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,20 +1,64 @@
add_library(gnuradio-core INTERFACE)
target_include_directories(gnuradio-core INTERFACE $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include/> $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/src> $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/include> $<INSTALL_INTERFACE:include/>)
target_link_libraries(gnuradio-core INTERFACE gnuradio-options gnuradio-meta magic_enum pmtv vir yaml-cpp::yaml-cpp)
add_library(
gnuradio-core
INTERFACE
include/gnuradio-4.0/Settings.hpp
include/gnuradio-4.0/annotated.hpp
include/gnuradio-4.0/AtomicBitset.hpp
include/gnuradio-4.0/Block.hpp
include/gnuradio-4.0/BlockModel.hpp
include/gnuradio-4.0/BlockRegistry.hpp
include/gnuradio-4.0/BlockTraits.hpp
include/gnuradio-4.0/Buffer.hpp
include/gnuradio-4.0/BufferSkeleton.hpp
include/gnuradio-4.0/CircularBuffer.hpp
include/gnuradio-4.0/ClaimStrategy.hpp
include/gnuradio-4.0/DataSet.hpp
include/gnuradio-4.0/Graph_yaml_importer.hpp
include/gnuradio-4.0/Graph.hpp
include/gnuradio-4.0/HistoryBuffer.hpp
include/gnuradio-4.0/LifeCycle.hpp
include/gnuradio-4.0/Message.hpp
include/gnuradio-4.0/plugin.hpp
include/gnuradio-4.0/PluginLoader.hpp
include/gnuradio-4.0/Port.hpp
include/gnuradio-4.0/PortTraits.hpp
include/gnuradio-4.0/Profiler.hpp
include/gnuradio-4.0/reader_writer_lock.hpp
include/gnuradio-4.0/Scheduler.hpp
include/gnuradio-4.0/Sequence.hpp
include/gnuradio-4.0/Settings.hpp
include/gnuradio-4.0/Tag.hpp
include/gnuradio-4.0/TriggerMatcher.hpp
include/gnuradio-4.0/WaitStrategy.hpp
include/gnuradio-4.0/YamlPmt.hpp)
target_include_directories(
gnuradio-core
INTERFACE $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include/>
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/src>
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/include>
$<INSTALL_INTERFACE:include/>)
target_link_libraries(
gnuradio-core
INTERFACE gnuradio-options
gnuradio-meta
magic_enum
pmtv
vir)

# configure a header file to pass the CMake settings to the source code
configure_file("${PROJECT_SOURCE_DIR}/cmake/config.hpp.in" "${CMAKE_CURRENT_BINARY_DIR}/include/gnuradio-4.0/config.hpp" @ONLY)
# TODO: install configure file... but not really meaningful for header only library, since compile flags are defined by the user...
configure_file("${PROJECT_SOURCE_DIR}/cmake/config.hpp.in"
"${CMAKE_CURRENT_BINARY_DIR}/include/gnuradio-4.0/config.hpp" @ONLY)
# TODO: install configure file... but not really meaningful for header only library, since compile flags are defined by
# the user...

install(
TARGETS gnuradio-core
EXPORT graphTargets
PUBLIC_HEADER DESTINATION include/
)
TARGETS gnuradio-core
EXPORT graphTargets
PUBLIC_HEADER DESTINATION include/)

add_subdirectory(src)

if (ENABLE_TESTING)
add_subdirectory(test)
add_subdirectory(benchmarks)
endif ()
if(ENABLE_TESTING)
add_subdirectory(test)
add_subdirectory(benchmarks)
endif()
Loading

0 comments on commit 216bc26

Please sign in to comment.