Fixed building and tests on macos
This commit is contained in:
@@ -66,8 +66,6 @@ apt install ccache cmake libyaml-cpp-dev clang-12 libclang-12-dev libclang-cpp12
|
|||||||
# macos
|
# macos
|
||||||
brew install ccache cmake llvm yaml-cpp
|
brew install ccache cmake llvm yaml-cpp
|
||||||
```
|
```
|
||||||
> Please note that on macos this tool is not fully functional, i.e. several test cases fail. The build instructions are
|
|
||||||
> provided for development purposes only.
|
|
||||||
|
|
||||||
Then proceed with building the sources:
|
Then proceed with building the sources:
|
||||||
|
|
||||||
@@ -79,12 +77,17 @@ make release
|
|||||||
release/clang-uml --help
|
release/clang-uml --help
|
||||||
|
|
||||||
# To build using a specific installed version of LLVM use:
|
# To build using a specific installed version of LLVM use:
|
||||||
LLVM_VERSION=13 make release
|
LLVM_VERSION=14 make release
|
||||||
|
|
||||||
# Optionally
|
# Optionally
|
||||||
make install
|
make install
|
||||||
# or
|
# or
|
||||||
export PATH=$PATH:$PWD/release
|
export PATH=$PATH:$PWD/release
|
||||||
|
|
||||||
|
# On macos, it is necessary to build clang-uml using the same llvm against which it is linked, e.g.
|
||||||
|
export CC=/usr/local/opt/llvm/bin/clang
|
||||||
|
export CCX=/usr/local/opt/llvm/bin/clang++
|
||||||
|
LLVM_VERSION=14 make release
|
||||||
```
|
```
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|||||||
@@ -133,6 +133,9 @@ bool translation_unit_visitor::VisitEnumDecl(clang::EnumDecl *enm)
|
|||||||
if (enm->getNameAsString().empty())
|
if (enm->getNameAsString().empty())
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
if (!diagram().should_include(enm->getQualifiedNameAsString()))
|
||||||
|
return true;
|
||||||
|
|
||||||
LOG_DBG("= Visiting enum declaration {} at {}",
|
LOG_DBG("= Visiting enum declaration {} at {}",
|
||||||
enm->getQualifiedNameAsString(),
|
enm->getQualifiedNameAsString(),
|
||||||
enm->getLocation().printToString(source_manager_));
|
enm->getLocation().printToString(source_manager_));
|
||||||
@@ -304,6 +307,9 @@ bool translation_unit_visitor::VisitCXXRecordDecl(clang::CXXRecordDecl *cls)
|
|||||||
if (source_manager_.isInSystemHeader(cls->getSourceRange().getBegin()))
|
if (source_manager_.isInSystemHeader(cls->getSourceRange().getBegin()))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
if (!diagram().should_include(cls->getQualifiedNameAsString()))
|
||||||
|
return true;
|
||||||
|
|
||||||
LOG_DBG("= Visiting class declaration {} at {}",
|
LOG_DBG("= Visiting class declaration {} at {}",
|
||||||
cls->getQualifiedNameAsString(),
|
cls->getQualifiedNameAsString(),
|
||||||
cls->getLocation().printToString(source_manager_));
|
cls->getLocation().printToString(source_manager_));
|
||||||
|
|||||||
@@ -154,6 +154,12 @@ void class_diagram::initialize_template_aliases()
|
|||||||
if (!template_aliases().count("std::basic_string<char>")) {
|
if (!template_aliases().count("std::basic_string<char>")) {
|
||||||
template_aliases().insert({"std::basic_string<char>", "std::string"});
|
template_aliases().insert({"std::basic_string<char>", "std::string"});
|
||||||
}
|
}
|
||||||
|
if (!template_aliases().count("std::basic_string<char,std::char_traits<"
|
||||||
|
"char>,std::allocator<char>>")) {
|
||||||
|
template_aliases().insert({"std::basic_string<char,std::char_traits<"
|
||||||
|
"char>,std::allocator<char>>",
|
||||||
|
"std::string"});
|
||||||
|
}
|
||||||
if (!template_aliases().count("std::basic_string<wchar_t>")) {
|
if (!template_aliases().count("std::basic_string<wchar_t>")) {
|
||||||
template_aliases().insert(
|
template_aliases().insert(
|
||||||
{"std::basic_string<wchar_t>", "std::wstring"});
|
{"std::basic_string<wchar_t>", "std::wstring"});
|
||||||
|
|||||||
@@ -7,6 +7,10 @@ set(CMAKE_CXX_STANDARD 17)
|
|||||||
set(TEST_DISABLE_WARNINGS "-Wno-unused-parameter -Wno-unused-private-field -Wno-unused-variable -Wno-attributes")
|
set(TEST_DISABLE_WARNINGS "-Wno-unused-parameter -Wno-unused-private-field -Wno-unused-variable -Wno-attributes")
|
||||||
|
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${LIBCLANG_CXXFLAGS} ${TEST_DISABLE_WARNINGS}")
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${LIBCLANG_CXXFLAGS} ${TEST_DISABLE_WARNINGS}")
|
||||||
|
if(APPLE)
|
||||||
|
# Without this, clang-uml test cases fail with error saying that clang cannot find stdarg.h
|
||||||
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -I${LLVM_LIBRARY_DIR}/clang/${LLVM_PACKAGE_VERSION}/include")
|
||||||
|
endif(APPLE)
|
||||||
|
|
||||||
file(GLOB_RECURSE TEST_CASE_SOURCES t*/*.cc)
|
file(GLOB_RECURSE TEST_CASE_SOURCES t*/*.cc)
|
||||||
file(GLOB_RECURSE TEST_CASE_CONFIGS t*/.clang-uml)
|
file(GLOB_RECURSE TEST_CASE_CONFIGS t*/.clang-uml)
|
||||||
|
|||||||
@@ -17,3 +17,6 @@ diagrams:
|
|||||||
- clanguml::t00039::ns3::F<T>
|
- clanguml::t00039::ns3::F<T>
|
||||||
relationships:
|
relationships:
|
||||||
- inheritance
|
- inheritance
|
||||||
|
exclude:
|
||||||
|
namespaces:
|
||||||
|
- std
|
||||||
@@ -17,3 +17,5 @@ diagrams:
|
|||||||
exclude:
|
exclude:
|
||||||
specializations:
|
specializations:
|
||||||
- clanguml::t00042::C<T>
|
- clanguml::t00042::C<T>
|
||||||
|
namespaces:
|
||||||
|
- std
|
||||||
@@ -48,7 +48,6 @@ TEST_CASE("t00048", "[test-case][class]")
|
|||||||
REQUIRE_THAT(puml, IsBaseClass(_A("Base"), _A("A")));
|
REQUIRE_THAT(puml, IsBaseClass(_A("Base"), _A("A")));
|
||||||
REQUIRE_THAT(puml, IsBaseClass(_A("Base"), _A("B")));
|
REQUIRE_THAT(puml, IsBaseClass(_A("Base"), _A("B")));
|
||||||
|
|
||||||
|
|
||||||
save_puml(
|
save_puml(
|
||||||
"./" + config.output_directory() + "/" + diagram->name + ".puml", puml);
|
"./" + config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user