Skip to content

Commit

Permalink
core: logging: Correctly handle Boost log dependency for older versions
Browse files Browse the repository at this point in the history
Some older versions of Boost have a dependency on boost.system.  Add it
to the dependency list.

Also fix use of PISP_LOGGING_ENABLE in case it is not defined in
external projects.  This has a knock-on effect of breaking builds
because of missing include dependencies, so fix it!

Signed-off-by: Naushir Patuck <[email protected]>
  • Loading branch information
naushir committed Oct 30, 2023
1 parent 51367fa commit c0af289
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 2 deletions.
2 changes: 2 additions & 0 deletions src/libpisp/backend/backend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
*/
#include "backend.hpp"

#include <cstring>

#include "common/logging.hpp"

using namespace libpisp;
Expand Down
2 changes: 2 additions & 0 deletions src/libpisp/backend/backend_prepare.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@
*/
#include "backend.hpp"

#include <algorithm>
#include <cmath>
#include <cstring>
#include <string>

#include "common/logging.hpp"
Expand Down
2 changes: 1 addition & 1 deletion src/libpisp/backend/tiling/split_stage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ int SplitStage::PushEndDown(int input_end, Dir dir)
return input_interval_.End();
}

void SplitStage::PushEndUp(int output_end, [[maybe_unused]] Dir dir)
void SplitStage::PushEndUp([[maybe_unused]] int output_end, [[maybe_unused]] Dir dir)
{
PISP_LOG(debug, "(" << name_ << ") Enter with output_end " << output_end);
// Genuinely nothing to do here, but we just like to log the usual trace information for consistency.
Expand Down
14 changes: 14 additions & 0 deletions src/libpisp/common/logging.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,14 @@
*/
#pragma once

#include <cassert>

#ifndef PISP_LOGGING_ENABLE
#define PISP_LOGGING_ENABLE 0
#endif

#if PISP_LOGGING_ENABLE

#include <boost/log/trivial.hpp>

#define PISP_LOG(sev, stuff) \
Expand All @@ -14,6 +22,12 @@ do { \
BOOST_LOG_TRIVIAL(sev) << __FUNCTION__ << ": " << stuff; \
} while (0)

#else

#define PISP_LOG(sev, stuff) do { } while(0)

#endif

#define PISP_ASSERT(x) assert(x)

namespace libpisp
Expand Down
2 changes: 2 additions & 0 deletions src/libpisp/frontend/frontend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
*/
#include "frontend.hpp"

#include <cstddef>

#include "common/logging.hpp"
#include "common/utils.hpp"

Expand Down
2 changes: 1 addition & 1 deletion src/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ pisp_deps = [
dependency('threads')
]

logging_dep = dependency('boost', modules : ['log', 'log_setup', 'thread'], required : get_option('logging'))
logging_dep = dependency('boost', modules : ['log', 'log_setup', 'thread', 'system'], required : get_option('logging'))
if logging_dep.found()
logging_args = ['-DPISP_LOGGING_ENABLE=1', '-DBOOST_BIND_GLOBAL_PLACEHOLDERS', '-DBOOST_LOG_DYN_LINK=1']
pisp_deps += logging_dep
Expand Down

0 comments on commit c0af289

Please sign in to comment.