Fixed building on macos

This commit is contained in:
Bartek Kryza
2023-01-07 14:41:26 +01:00
parent a1a9d4ae99
commit 0ace023985
6 changed files with 15 additions and 11 deletions

View File

@@ -20,7 +20,15 @@
.DEFAULT_GOAL := debug
NUMPROC ?= $(shell nproc)
OS_UNAME := $(shell uname -s)
ifeq ($(OS_UNAME),Linux)
NUMPROC ?= $(shell nproc)
else ifeq ($(OS_UNAME),Darwin)
NUMPROC ?= $(shell sysctl -n hw.logicalcpu)
else
NUMPROC ?= 1
endif
LLVM_VERSION ?=
CMAKE_CXX_FLAGS ?=

View File

@@ -26,7 +26,6 @@ namespace clanguml::common::visitor {
translation_unit_visitor::translation_unit_visitor(
clang::SourceManager &sm, const clanguml::config::diagram &config)
: source_manager_{sm}
, config_{config}
{
if (config.comment_parser() == config::comment_parser_t::plain) {
comment_visitor_ =

View File

@@ -103,8 +103,6 @@ protected:
private:
clang::SourceManager &source_manager_;
[[maybe_unused]] const clanguml::config::diagram &config_;
std::unique_ptr<comment::comment_visitor> comment_visitor_;
};
} // namespace clanguml::common::visitor

View File

@@ -24,11 +24,11 @@
namespace clanguml::include_diagram::visitor {
translation_unit_visitor::translation_unit_visitor(clang::SourceManager &sm,
translation_unit_visitor::translation_unit_visitor(
clang::SourceManager & /*sm*/,
clanguml::include_diagram::model::diagram &diagram,
const clanguml::config::include_diagram &config)
: source_manager_{sm}
, diagram_{diagram}
: diagram_{diagram}
, config_{config}
{
}

View File

@@ -104,8 +104,6 @@ public:
void finalize() { }
private:
[[maybe_unused]] clang::SourceManager &source_manager_;
// Reference to the output diagram model
clanguml::include_diagram::model::diagram &diagram_;

View File

@@ -52,13 +52,14 @@ std::string get_process_output(const std::string &command)
std::array<char, kBufferSize> buffer{};
std::string result;
#if defined(__linux) || defined(__unix)
#if defined(__linux) || defined(__unix) || defined(__APPLE__)
std::unique_ptr<FILE, decltype(&pclose)> pipe(
popen(command.c_str(), "r"), pclose);
#elif defined(WINDOWS) || defined(_WIN32) || defined(WIN32)
#elif defined(_WIN32)
std::unique_ptr<FILE, decltype(&_pclose)> pipe(
_popen(command.c_str(), "r"), _pclose);
#endif
if (!pipe) {
throw std::runtime_error("popen() failed!");
}