From 42214976648e768d0a525dd6e5f84a1f300c25ae Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Mon, 10 Apr 2023 09:03:38 +0200 Subject: external, src/world: add tsl::robin_map --- .gitmodules | 3 +++ editor/CMakeLists.txt | 2 +- external/CMakeLists.txt | 10 ++++++---- external/robin-map | 1 + serialize/CMakeLists.txt | 1 + src/CMakeLists.txt | 1 + src/world.hpp | 3 ++- test/CMakeLists.txt | 2 +- 8 files changed, 16 insertions(+), 7 deletions(-) create mode 160000 external/robin-map diff --git a/.gitmodules b/.gitmodules index fd4fc9fd..0f55e625 100644 --- a/.gitmodules +++ b/.gitmodules @@ -25,3 +25,6 @@ [submodule "luajit"] path = external/luajit url = https://github.com/WohlSoft/LuaJIT.git +[submodule "robin-map"] + path = external/robin-map + url = https://github.com/Tessil/robin-map.git diff --git a/editor/CMakeLists.txt b/editor/CMakeLists.txt index 306c95f4..0eb7bcb7 100644 --- a/editor/CMakeLists.txt +++ b/editor/CMakeLists.txt @@ -10,7 +10,7 @@ else() endif() add_library(${self}_o OBJECT "${res}" "${sources}") -target_link_libraries(${self}_o PUBLIC MagnumIntegration::ImGui fmt::fmt nlohmann_json::nlohmann_json) +target_link_libraries(${self}_o PUBLIC MagnumIntegration::ImGui fmt::fmt nlohmann_json::nlohmann_json tsl::robin_map) if(WIN32) target_sources(${self}_o PRIVATE "../main/floormat.rc") diff --git a/external/CMakeLists.txt b/external/CMakeLists.txt index ad383f36..024c2c4e 100644 --- a/external/CMakeLists.txt +++ b/external/CMakeLists.txt @@ -217,12 +217,12 @@ function(message m) endif() endfunction() +set(system "") +if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.25) + set(system "SYSTEM") +endif() if(FLOORMAT_SUBMODULE-DEPENDENCIES) sets(PATH IMGUI_DIR "${CMAKE_CURRENT_SOURCE_DIR}/imgui") - set(system "") - if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.25) - set(system "SYSTEM") - endif() function(fm_add_sdl2) if(FLOORMAT_SUBMODULE-SDL2) @@ -285,6 +285,8 @@ if(FLOORMAT_SUBMODULE-DEPENDENCIES) fm_add_libs() endif() +add_subdirectory(robin-map ${system}) + if(FLOORMAT_SUBMODULE-DEPENDENCIES) if(MSVC) target_compile_options(CorradeTestSuiteObjects PRIVATE -EHsc) diff --git a/external/robin-map b/external/robin-map new file mode 160000 index 00000000..851a59e0 --- /dev/null +++ b/external/robin-map @@ -0,0 +1 @@ +Subproject commit 851a59e0e3063ee0e23089062090a73fd3de482d diff --git a/serialize/CMakeLists.txt b/serialize/CMakeLists.txt index 45d7704e..bede6c6c 100644 --- a/serialize/CMakeLists.txt +++ b/serialize/CMakeLists.txt @@ -17,6 +17,7 @@ if(WIN32 OR MAGNUM_BUILD_PLUGINS_STATIC) target_link_libraries(${self} PUBLIC MagnumPlugins::StbImageImporter Magnum::TgaImporter + tsl::robin_map ) endif() if(WIN32) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index a03235e8..4aa9dbb4 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -7,4 +7,5 @@ target_link_libraries( Magnum::Magnum Magnum::Shaders fmt::fmt + tsl::robin_map ) diff --git a/src/world.hpp b/src/world.hpp index 4b8ce797..90067c35 100644 --- a/src/world.hpp +++ b/src/world.hpp @@ -6,6 +6,7 @@ #include "compat/exception.hpp" #include #include +#include template<> struct std::hash final { @@ -31,7 +32,7 @@ private: } _last_chunk; std::unordered_map _chunks; - std::unordered_map> _entities; + tsl::robin_map> _entities; size_t _last_collection = 0; size_t _collect_every = 64; std::shared_ptr _unique_id = std::make_shared('A'); diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index bca15714..20b66a6d 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -4,7 +4,7 @@ file(GLOB sources "*.cpp" CONFIGURE_ARGS) file(MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/test") add_library(${self}_o OBJECT "${sources}") -target_link_libraries(${self}_o PUBLIC Magnum::GL Magnum::Trade nlohmann_json::nlohmann_json fmt::fmt) +target_link_libraries(${self}_o PUBLIC Magnum::GL Magnum::Trade nlohmann_json::nlohmann_json fmt::fmt tsl::robin_map) if(APPLE) target_link_libraries(${self}_o PUBLIC Magnum::WindowlessCglApplication) -- cgit v1.2.3