diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2023-04-10 09:03:38 +0200 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2023-04-10 10:35:00 +0200 |
commit | 42214976648e768d0a525dd6e5f84a1f300c25ae (patch) | |
tree | 2309ca7af25cb04bcdfbcef0b294fb65bee91b00 | |
parent | 94acd44723424f8ff5a9532c3030a637956c738a (diff) |
external, src/world: add tsl::robin_map
-rw-r--r-- | .gitmodules | 3 | ||||
-rw-r--r-- | editor/CMakeLists.txt | 2 | ||||
-rw-r--r-- | external/CMakeLists.txt | 10 | ||||
m--------- | external/robin-map | 0 | ||||
-rw-r--r-- | serialize/CMakeLists.txt | 1 | ||||
-rw-r--r-- | src/CMakeLists.txt | 1 | ||||
-rw-r--r-- | src/world.hpp | 3 | ||||
-rw-r--r-- | test/CMakeLists.txt | 2 |
8 files changed, 15 insertions, 7 deletions
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 +Subproject 851a59e0e3063ee0e23089062090a73fd3de482 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 <unordered_map> #include <memory> +#include <tsl/robin_map.h> template<> struct std::hash<floormat::chunk_coords_> final { @@ -31,7 +32,7 @@ private: } _last_chunk; std::unordered_map<chunk_coords_, chunk> _chunks; - std::unordered_map<object_id, std::weak_ptr<entity>> _entities; + tsl::robin_map<object_id, std::weak_ptr<entity>> _entities; size_t _last_collection = 0; size_t _collect_every = 64; std::shared_ptr<char> _unique_id = std::make_shared<char>('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) |