Skip to content

Commit

Permalink
Fix build (tested locally on ubuntu and in githubaction container) (2…
Browse files Browse the repository at this point in the history
…2.10 22:54)
  • Loading branch information
Hexlord committed Oct 22, 2020
1 parent 57c2d5a commit 24bf736
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 5 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/example.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
mkdir ${{runner.workspace}}/llvm
tar -xf clang+llvm-11.0.0-x86_64-linux-gnu-ubuntu-20.04.tar.xz -C ${{runner.workspace}}/llvm
echo "${{runner.workspace}}/llvm/clang+llvm-11.0.0-x86_64-linux-gnu-ubuntu-20.04/bin" >> $GITHUB_PATH
- uses: actions/checkout@v2
with:
submodules: 'true'
Expand All @@ -41,4 +41,4 @@ jobs:
- name: Run Example
working-directory: ${{runner.workspace}}/build
shell: bash
run: ./${{runner.workspace}}/build/Example
run: ./Example
24 changes: 23 additions & 1 deletion Example/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,26 @@ target_link_libraries(Example MetaCPP)

# MetaCPP automatic reflection
include(../CMake/MetaPrebuild.cmake)
meta_generate(Example "objects.hpp" "Generated.hpp" "Generated.cpp" "")

if(NOT DEFINED META_GENERATE_FLAGS)
set(META_GENERATE_FLAGS "")
endif()
if(DEFINED CLANG_INCLUDE_DIR)
set(META_GENERATE_FLAGS "${META_GENERATE_FLAGS} --flag -I${CLANG_INCLUDE_DIR}")
else()
# Fire all weapons
set(CLANG_INCLUDE_CANDIDATES "/usr/local/lib/clang/12.0.0/include")
set(CLANG_INCLUDE_CANDIDATES "${CLANG_INCLUDE_CANDIDATES};/usr/lib/llvm-12/lib/clang/12.0.0/include")
set(CLANG_INCLUDE_CANDIDATES "${CLANG_INCLUDE_CANDIDATES};/usr/local/lib/clang/11.0.0/include")
set(CLANG_INCLUDE_CANDIDATES "${CLANG_INCLUDE_CANDIDATES};/usr/lib/llvm-11/lib/clang/11.0.0/include")
set(CLANG_INCLUDE_CANDIDATES "${CLANG_INCLUDE_CANDIDATES};/usr/local/lib/clang/10.0.0/include")
set(CLANG_INCLUDE_CANDIDATES "${CLANG_INCLUDE_CANDIDATES};/usr/lib/llvm-10/lib/clang/10.0.0/include")
foreach(CLANG_INCLUDE_CANDIDATE ${CLANG_INCLUDE_CANDIDATES})
if(EXISTS ${CLANG_INCLUDE_CANDIDATE})
set(META_GENERATE_FLAGS "${META_GENERATE_FLAGS} --flag -I${CLANG_INCLUDE_CANDIDATE}")
break()
endif()
endforeach()
endif()

meta_generate(Example "objects.hpp" "Generated.hpp" "Generated.cpp" "${META_GENERATE_FLAGS}")
2 changes: 1 addition & 1 deletion MetaCPP-CLI/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ find_Package(Clang REQUIRED)

# LLVM
link_directories(${LLVM_LIB_DIR})
# add_definitions(${LLVM_COMPILE_FLAGS})
#add_definitions(${LLVM_COMPILE_FLAGS})
add_definitions(-fno-rtti) # this should match the LLVM rtti flag

set(MetaCPPCLI_SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR})
Expand Down
2 changes: 1 addition & 1 deletion MetaCPP/src/MetaCPP/Type.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ namespace metacpp {

bool Type::HasSize() const {
const std::string& name = m_QualifiedName.GetName();
return name != "void" && name != "_Alloc_hider";
return name != "void" && name != "_Alloc_hider" && m_Access == AccessSpecifier::PUBLIC;
}

const std::vector<Method>& Type::GetMethods() const {
Expand Down

0 comments on commit 24bf736

Please sign in to comment.