Skip to content

Commit

Permalink
explicit pmtv formatter header, new EMBEDDED & IWYU integration
Browse files Browse the repository at this point in the history
this is a follow-up of:
* primarily: [Move formatting code to a different header file ...](gnuradio/pmt#111)
* optional 'EMBEDDED' flag that is tied to the 'MinSizeRel' build target to disable/minimise code features for embedded systems (e.g. code-size, console printouts, etc.)
* integration of [Include What You Use](https://github.com/include-what-you-use/include-what-you-use) tool (optional, if available/installed

Signed-off-by: Ralph J. Steinhagen <r.steinhagen@gsi.de>
  • Loading branch information
RalphSteinhagen committed Apr 28, 2024
1 parent 5e15e84 commit f18b70f
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
9 changes: 9 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ elseif(CMAKE_BUILD_TYPE MATCHES RelWithDebInfo)
set(ALL_COMPILER_FLAGS "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} ${CMAKE_CXX_FLAGS}")
elseif(CMAKE_BUILD_TYPE MATCHES MinSizeRel)
set(ALL_COMPILER_FLAGS "${CMAKE_CXX_FLAGS_MINSIZEREL} ${CMAKE_CXX_FLAGS}")
# 'EMBEDDED is used to disable/minimise code features for embedded systems (e.g. code-size, console printouts, etc.)
add_compile_definitions(EMBEDDED)
endif()
# Replace ; with space
string(REPLACE ";" " " ALL_COMPILER_FLAGS "${ALL_COMPILER_FLAGS}")
Expand All @@ -68,6 +70,13 @@ elseif(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
add_compile_options(-fdiagnostics-color=always)
endif()

# Include What You Use tooling: https://github.com/include-what-you-use/include-what-you-use
find_program(INCLUDE_WHAT_YOU_USE_TOOL_PATH NAMES include-what-you-use iwyu)
if(INCLUDE_WHAT_YOU_USE_TOOL_PATH)
message(" using 'Include What You Use' path: (${INCLUDE_WHAT_YOU_USE_TOOL_PATH})")
set_property(GLOBAL PROPERTY CMAKE_CXX_INCLUDE_WHAT_YOU_USE ${INCLUDE_WHAT_YOU_USE_TOOL_PATH})
endif()

# Mainly for FMT
set(CMAKE_POSITION_INDEPENDENT_CODE TRUE)

Expand Down
2 changes: 1 addition & 1 deletion blocks/basic/test/qa_PythonBlock.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ def process_bulk(ins, outs):

bool throws = false;
try {
myBlock.applyChangedSettings(); // needed for unit-test only when executed outside a Scheduler/Graph
myBlock.settings().applyStagedParameters(); // needed for unit-test only when executed outside a Scheduler/Graph
} catch (const std::exception &ex) {
throws = true;
fmt::println("myBlock.processBulk(...) - correctly threw SyntaxError exception:\n {}", ex.what());
Expand Down
2 changes: 2 additions & 0 deletions core/include/gnuradio-4.0/Tag.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@

#include <pmtv/pmt.hpp>

#include <pmtv/format.hpp>

#include <gnuradio-4.0/meta/utils.hpp>

#include "reflection.hpp"
Expand Down

0 comments on commit f18b70f

Please sign in to comment.