From fc56ee8a250ae87f36451104cde0c53d5df3b0ce Mon Sep 17 00:00:00 2001 From: ubpa Date: Mon, 22 Feb 2021 15:24:21 +0800 Subject: [PATCH] update with UTemplate --- CMakeLists.txt | 6 +++--- README.md | 10 ++++------ include/UECS/AccessTypeID.h | 2 +- include/UECS/CmptTag.h | 6 +++--- include/UECS/config.h | 6 +++--- include/UECS/details/Archetype.inl | 8 ++++---- include/UECS/details/Chunk.h | 4 ++-- include/UECS/details/SystemFunc.inl | 2 +- include/UECS/details/Util.inl | 2 +- src/app/CmptHashCode/main.cpp | 2 +- src/core/CMakeLists.txt | 12 ++++++++++++ 11 files changed, 35 insertions(+), 25 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1cd0b2a..2cdfa2b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,6 @@ cmake_minimum_required(VERSION 3.14 FATAL_ERROR) -project(UECS VERSION 0.15.0) +project(UECS VERSION 0.15.1) message(STATUS "[Project] ${PROJECT_NAME}") include(cmake/InitUCMake.cmake) @@ -8,8 +8,8 @@ Ubpa_InitUCMake(VERSION 0.6.4) Ubpa_InitProject() -Ubpa_AddDep(UTemplate 0.6.0) -Ubpa_AddDep(UGraphviz 0.2.0) +Ubpa_AddDep(UTemplate 0.7.1) +Ubpa_AddDep(UGraphviz 0.2.0) Ubpa_AddSubDirsRec(include) Ubpa_AddSubDirsRec(src) diff --git a/README.md b/README.md index 3d7d16c..1878322 100644 --- a/README.md +++ b/README.md @@ -18,13 +18,11 @@ **U**bpa **E**ntity-**C**omponent-**S**ystem in Unity3D-style -## Environment +## Compiler compatibility -- Compiler - - MSVC: >=1926 - - GCC: >= 10 - - Clang: >= 10 -- C++ 20 +- Clang/LLVM >= 10.0 +- GCC >= 10.0 +- MSVC >= 1926 ## Documentation diff --git a/include/UECS/AccessTypeID.h b/include/UECS/AccessTypeID.h index 2627fa5..31e7084 100644 --- a/include/UECS/AccessTypeID.h +++ b/include/UECS/AccessTypeID.h @@ -4,7 +4,7 @@ #include "details/Util.h" -#include +#include #include diff --git a/include/UECS/CmptTag.h b/include/UECS/CmptTag.h index 689ab5a..478403c 100644 --- a/include/UECS/CmptTag.h +++ b/include/UECS/CmptTag.h @@ -14,9 +14,9 @@ namespace Ubpa::UECS { // 6. Latest> enum class AccessMode : std::size_t { - LAST_FRAME = 0b000, // LastFrame - WRITE = 0b001, // Write / Cmpt* - LATEST = 0b010, // Latest / const Cmpt* + LAST_FRAME = 0b000, // LastFrame + WRITE = 0b001, // Write / Cmpt* + LATEST = 0b010, // Latest / const Cmpt* }; template diff --git a/include/UECS/config.h b/include/UECS/config.h index 9fbf108..1b8ec80 100644 --- a/include/UECS/config.h +++ b/include/UECS/config.h @@ -5,10 +5,10 @@ namespace Ubpa::UECS { // Cache-Lines size is (typically) 64 bytes // it has to be an exponent of 2 and >= 16 - constexpr std::size_t CHUNK_ALIGNMENT = 64; + constexpr std::size_t ChunkAlignment = 64; // 16384 bytes : 16 KB - // it has to be a multiple of UECS_CHUNK_ALIGNMENT and an exponent of 2 - constexpr std::size_t CHUNK_SIZE = 16384; + // it has to be a multiple of ChunkAlignment and an exponent of 2 + constexpr std::size_t ChunkSize = 16384; } diff --git a/include/UECS/details/Archetype.inl b/include/UECS/details/Archetype.inl index 279ea17..22cc433 100644 --- a/include/UECS/details/Archetype.inl +++ b/include/UECS/details/Archetype.inl @@ -9,7 +9,7 @@ namespace Ubpa::UECS { types(GenTypeIDSet()), chunkAllocator{ chunkAllocator } { - static_assert(IsSet_v>, + static_assert(IsUnique_v>, "... must be different"); cmptTraits.Register(); (cmptTraits.Register(), ...); @@ -19,7 +19,7 @@ namespace Ubpa::UECS { template Archetype* Archetype::Add(const Archetype* from) { static_assert(sizeof...(Cmpts) > 0); - static_assert(IsSet_v>, + static_assert(IsUnique_v>, "... must be different"); assert(!(from->types.Contains(TypeID_of) &&...)); @@ -39,7 +39,7 @@ namespace Ubpa::UECS { std::tuple> Archetype::Create(Entity e) { static_assert((std::is_constructible_v &&...), " isn't constructible"); - static_assert(IsSet_v>, + static_assert(IsUnique_v>, "... must be different"); assert((types.Contains(TypeID_of) &&...) && types.data.size() == 1 + sizeof...(Cmpts)); @@ -58,7 +58,7 @@ namespace Ubpa::UECS { template TypeIDSet Archetype::GenTypeIDSet() { if constexpr (sizeof...(Cmpts) > 0) { - static_assert(IsSet_v>, + static_assert(IsUnique_v>, "... must be different"); constexpr std::array types = { TypeID_of... }; diff --git a/include/UECS/details/Chunk.h b/include/UECS/details/Chunk.h index ba40bdc..0d31ebb 100644 --- a/include/UECS/details/Chunk.h +++ b/include/UECS/details/Chunk.h @@ -9,8 +9,8 @@ namespace Ubpa::UECS { using byte = uint8_t; static_assert(sizeof(byte) == 1); - struct alignas(CHUNK_ALIGNMENT) Chunk { - static constexpr std::size_t size = CHUNK_SIZE; + struct alignas(ChunkAlignment) Chunk { + static constexpr std::size_t size = ChunkSize; struct Layout { std::size_t capacity; diff --git a/include/UECS/details/SystemFunc.inl b/include/UECS/details/SystemFunc.inl index 4ee363c..4651f83 100644 --- a/include/UECS/details/SystemFunc.inl +++ b/include/UECS/details/SystemFunc.inl @@ -143,7 +143,7 @@ namespace Ubpa::UECS::details { using ArgList = FuncTraits_ArgList; using DecayedArgList = Transform_t; - static_assert(IsSet_v, "details::System_::Pack: 's argument types must be a set"); + static_assert(IsUnique_v, "details::System_::Pack: 's argument types must be a set"); using TaggedCmptList = Filter_t; diff --git a/include/UECS/details/Util.inl b/include/UECS/details/Util.inl index 0de3752..09afc68 100644 --- a/include/UECS/details/Util.inl +++ b/include/UECS/details/Util.inl @@ -1,6 +1,6 @@ #pragma once -#include +#include namespace Ubpa::UECS { constexpr std::size_t hash_combine(std::size_t x, std::size_t y) noexcept { diff --git a/src/app/CmptHashCode/main.cpp b/src/app/CmptHashCode/main.cpp index c5aa61c..553c231 100644 --- a/src/app/CmptHashCode/main.cpp +++ b/src/app/CmptHashCode/main.cpp @@ -1,4 +1,4 @@ -#include +#include #include diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt index 28bcebe..ec3545f 100644 --- a/src/core/CMakeLists.txt +++ b/src/core/CMakeLists.txt @@ -6,6 +6,16 @@ elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") list(APPEND c_options "-pthread") endif() + +set(c_options_private "") +if(MSVC) + list(APPEND c_options_private "/MP") +elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") + # +elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") + # +endif() + set(l_options "") if(MSVC) #.. @@ -27,6 +37,8 @@ Ubpa_AddTarget( "${PROJECT_SOURCE_DIR}/include" C_OPTION ${c_options} + C_OPTION_PRIVATE + ${c_options_private} L_OPTION ${l_options} )