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 .DEFAULT_GOAL := debug
OS_UNAME := $(shell uname -s)
ifeq ($(OS_UNAME),Linux)
NUMPROC ?= $(shell nproc) NUMPROC ?= $(shell nproc)
else ifeq ($(OS_UNAME),Darwin)
NUMPROC ?= $(shell sysctl -n hw.logicalcpu)
else
NUMPROC ?= 1
endif
LLVM_VERSION ?= LLVM_VERSION ?=
CMAKE_CXX_FLAGS ?= CMAKE_CXX_FLAGS ?=

View File

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

View File

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

View File

@@ -24,11 +24,11 @@
namespace clanguml::include_diagram::visitor { 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, clanguml::include_diagram::model::diagram &diagram,
const clanguml::config::include_diagram &config) const clanguml::config::include_diagram &config)
: source_manager_{sm} : diagram_{diagram}
, diagram_{diagram}
, config_{config} , config_{config}
{ {
} }

View File

@@ -104,8 +104,6 @@ public:
void finalize() { } void finalize() { }
private: private:
[[maybe_unused]] clang::SourceManager &source_manager_;
// Reference to the output diagram model // Reference to the output diagram model
clanguml::include_diagram::model::diagram &diagram_; 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::array<char, kBufferSize> buffer{};
std::string result; std::string result;
#if defined(__linux) || defined(__unix) #if defined(__linux) || defined(__unix) || defined(__APPLE__)
std::unique_ptr<FILE, decltype(&pclose)> pipe( std::unique_ptr<FILE, decltype(&pclose)> pipe(
popen(command.c_str(), "r"), pclose); popen(command.c_str(), "r"), pclose);
#elif defined(WINDOWS) || defined(_WIN32) || defined(WIN32) #elif defined(_WIN32)
std::unique_ptr<FILE, decltype(&_pclose)> pipe( std::unique_ptr<FILE, decltype(&_pclose)> pipe(
_popen(command.c_str(), "r"), _pclose); _popen(command.c_str(), "r"), _pclose);
#endif #endif
if (!pipe) { if (!pipe) {
throw std::runtime_error("popen() failed!"); throw std::runtime_error("popen() failed!");
} }