Skip to content

Commit

Permalink
fix bugs on Clang and GCC
Browse files Browse the repository at this point in the history
  • Loading branch information
Ubpa committed Jan 23, 2021
1 parent f544478 commit b3c3217
Show file tree
Hide file tree
Showing 8 changed files with 34 additions and 7 deletions.
2 changes: 1 addition & 1 deletion include/UECS/CmptPtr.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ namespace Ubpa::UECS {
else if constexpr (mode == AccessMode::LATEST)
return Latest<Cmpt>{p};
else
static_assert(false);
static_assert(always_false<Cmpt>);
}
private:
friend class EntityMngr;
Expand Down
2 changes: 1 addition & 1 deletion include/UECS/EntityMngr.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ namespace Ubpa::UECS {
// nullptr if not singleton
CmptPtr GetSingleton(TypeID) const;
template<typename Cmpt>
Cmpt* GetSingleton() const { return GetSingleton(TypeID_of<Cmpt>).As<Cmpt>(); }
Cmpt* GetSingleton() const { return GetSingleton(TypeID_of<Cmpt>).template As<Cmpt>(); }

// filter's all contains cmpt
template<typename Cmpt>
Expand Down
1 change: 1 addition & 0 deletions include/UECS/RTDCmptTraits.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

#include <unordered_map>
#include <functional>
#include <string>

namespace Ubpa::UECS {
// run-time dynamic component traits
Expand Down
1 change: 1 addition & 0 deletions include/UECS/SystemTraits.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#include <functional>
#include <unordered_map>
#include <array>
#include <string>

namespace Ubpa::UECS {
class World;
Expand Down
3 changes: 2 additions & 1 deletion include/UECS/details/Archetype.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
#include "TypeIDSet.h"
#include "Chunk.h"

#include <UTemplate/Typelist.h>
#include <UTemplate/TypeList.h>
#include <memory_resource>

namespace Ubpa::UECS {
class EntityMngr;
Expand Down
4 changes: 2 additions & 2 deletions include/UECS/details/EntityMngr.inl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

#include "../CmptTag.h"

#include <UTemplate/Typelist.h>
#include <UTemplate/TypeList.h>
#include <UTemplate/Func.h>

namespace Ubpa::UECS {
Expand Down Expand Up @@ -151,7 +151,7 @@ namespace Ubpa::UECS {

std::vector<Cmpt*> rst;

const auto& archetypes = QueryArchetypes(filter);
const auto& archetypes = QueryArchetypes(EntityQuery{filter});
std::size_t num = 0;
for (const auto& archetype : archetypes)
num += archetype->EntityNum();
Expand Down
21 changes: 21 additions & 0 deletions src/core/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
set(c_options "")
if(MSVC)
#..
elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
list(APPEND c_options "-pthread")
elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
list(APPEND c_options "-pthread")
endif()
set(l_options "")
if(MSVC)
#..
elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
list(APPEND l_options "-lpthread")
elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
list(APPEND l_options "-lpthread")
endif()

Ubpa_AddTarget(
MODE STATIC
RET_TARGET_NAME tname
Expand All @@ -8,6 +25,10 @@ Ubpa_AddTarget(
Ubpa::UGraphviz_core
INC
"${PROJECT_SOURCE_DIR}/include"
C_OPTION
${c_options}
L_OPTION
${l_options}
)

target_precompile_headers(${tname} PRIVATE "${PROJECT_SOURCE_DIR}/include/UECS/World.h")
7 changes: 5 additions & 2 deletions src/core/SysFuncGraph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,11 @@ bool SysFuncGraph::HaveEdge(SystemFunc* x, SystemFunc* y) const {
assert(HaveVertex(x) && HaveVertex(y));
assert(x != y);
const auto& adjVs = adjList.at(x);
auto target = find(adjVs.begin(), adjVs.end(), y);
return target != adjVs.end();
for(auto* adjV : adjVs){
if(adjV == y)
return true;
}
return false;
}

bool SysFuncGraph::HavePath(SystemFunc* x, SystemFunc* y) const {
Expand Down

0 comments on commit b3c3217

Please sign in to comment.