fix cmake lists and move hashmap decl to hashmap.h
parent
79900dbf1a
commit
147c46a1a4
|
@ -45,8 +45,9 @@ else()
|
||||||
set(PARSE_FILES "")
|
set(PARSE_FILES "")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(EXISTS libraries/parallel-hashmap)
|
if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/libraries/parallel-hashmap)
|
||||||
include_directories(libraries/parallel-hashmap)
|
message("Found Parallel Hashmaps")
|
||||||
|
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/libraries/parallel-hashmap)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
#include zlib if the user has it.
|
#include zlib if the user has it.
|
||||||
|
@ -73,9 +74,9 @@ target_include_directories(BLT PUBLIC ${CMAKE_CURRENT_BINARY_DIR}/config/)
|
||||||
if(${ZLIB_FOUND})
|
if(${ZLIB_FOUND})
|
||||||
target_link_libraries(BLT PUBLIC ZLIB::ZLIB)
|
target_link_libraries(BLT PUBLIC ZLIB::ZLIB)
|
||||||
endif()
|
endif()
|
||||||
if(EXISTS ${CMAKE_SOURCE_DIR}/libraries/parallel-hashmap)
|
if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/libraries/parallel-hashmap)
|
||||||
message("Including phmap")
|
message("Including phmap")
|
||||||
target_include_directories(BLT PUBLIC libraries/parallel-hashmap)
|
target_include_directories(BLT PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/libraries/parallel-hashmap)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(MSVC)
|
if(MSVC)
|
||||||
|
|
|
@ -17,27 +17,7 @@
|
||||||
#include "blt/std/filesystem.h"
|
#include "blt/std/filesystem.h"
|
||||||
#include "blt/std/logging.h"
|
#include "blt/std/logging.h"
|
||||||
|
|
||||||
#ifndef HASHMAP
|
#include <blt/std/hashmap.h>
|
||||||
#if defined __has_include && __has_include(<parallel_hashmap/phmap.h>)
|
|
||||||
#define HASHMAP HASHMAP
|
|
||||||
#include <parallel_hashmap/phmap.h>
|
|
||||||
#include <parallel_hashmap/phmap_fwd_decl.h>
|
|
||||||
template<typename K, typename V>
|
|
||||||
using HASHMAP = phmap::flat_hash_map<K, V>();
|
|
||||||
template<typename K>
|
|
||||||
using HASHSET = phmap::flat_hash_set<K>();
|
|
||||||
#else
|
|
||||||
#define HASHMAP HASHMAP
|
|
||||||
#include <unordered_map>
|
|
||||||
#include <unordered_set>
|
|
||||||
|
|
||||||
template<typename K, typename V>
|
|
||||||
using HASHMAP = std::unordered_map<K, V>();
|
|
||||||
|
|
||||||
template<typename K>
|
|
||||||
using HASHSET = std::unordered_set<K>();
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
namespace blt::nbt {
|
namespace blt::nbt {
|
||||||
|
|
||||||
|
|
|
@ -11,30 +11,7 @@
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <initializer_list>
|
#include <initializer_list>
|
||||||
#include <optional>
|
#include <optional>
|
||||||
|
#include <blt/std/hashmap.h>
|
||||||
#ifndef HASHMAP
|
|
||||||
#if defined __has_include && __has_include(<parallel_hashmap/phmap.h>)
|
|
||||||
#define HASHMAP HASHMAP
|
|
||||||
|
|
||||||
#include <parallel_hashmap/phmap.h>
|
|
||||||
#include <parallel_hashmap/phmap_fwd_decl.h>
|
|
||||||
|
|
||||||
template<typename K, typename V>
|
|
||||||
using HASHMAP = phmap::flat_hash_map<K, V>();
|
|
||||||
template<typename K>
|
|
||||||
using HASHSET = phmap::flat_hash_set<K>();
|
|
||||||
#else
|
|
||||||
#define HASHMAP HASHMAP
|
|
||||||
#include <unordered_map>
|
|
||||||
#include <unordered_set>
|
|
||||||
|
|
||||||
template<typename K, typename V>
|
|
||||||
using HASHMAP = std::unordered_map<K, V>();
|
|
||||||
|
|
||||||
template<typename K>
|
|
||||||
using HASHSET = std::unordered_set<K>();
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
namespace blt::parser {
|
namespace blt::parser {
|
||||||
|
|
||||||
|
|
|
@ -1,11 +0,0 @@
|
||||||
/*
|
|
||||||
* Created by Brett on 31/03/23.
|
|
||||||
* Licensed under GNU General Public License V3.0
|
|
||||||
* See LICENSE file for license detail
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef BLT_HASH_MAP_H
|
|
||||||
#define BLT_HASH_MAP_H
|
|
||||||
|
|
||||||
|
|
||||||
#endif //BLT_HASH_MAP_H
|
|
|
@ -0,0 +1,30 @@
|
||||||
|
/*
|
||||||
|
* Created by Brett on 31/03/23.
|
||||||
|
* Licensed under GNU General Public License V3.0
|
||||||
|
* See LICENSE file for license detail
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef BLT_HASH_MAP_H
|
||||||
|
#define BLT_HASH_MAP_H
|
||||||
|
|
||||||
|
#ifndef HASHMAP
|
||||||
|
#if defined __has_include && __has_include(<parallel_hashmap/phmap.h>)
|
||||||
|
#include <parallel_hashmap/phmap.h>
|
||||||
|
#include <parallel_hashmap/phmap_fwd_decl.h>
|
||||||
|
template<typename K, typename V>
|
||||||
|
using HASHMAP = phmap::flat_hash_map<K, V>;
|
||||||
|
template<typename K>
|
||||||
|
using HASHSET = phmap::flat_hash_set<K>;
|
||||||
|
#else
|
||||||
|
#include <unordered_map>
|
||||||
|
#include <unordered_set>
|
||||||
|
|
||||||
|
template<typename K, typename V>
|
||||||
|
using HASHMAP = std::unordered_map<K, V>;
|
||||||
|
|
||||||
|
template<typename K>
|
||||||
|
using HASHSET = std::unordered_set<K>;
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif //BLT_HASH_MAP_H
|
|
@ -7,7 +7,7 @@
|
||||||
#ifndef BLT_TESTS_HASHMAP_TEXTS_H
|
#ifndef BLT_TESTS_HASHMAP_TEXTS_H
|
||||||
#define BLT_TESTS_HASHMAP_TEXTS_H
|
#define BLT_TESTS_HASHMAP_TEXTS_H
|
||||||
|
|
||||||
#include <blt/std/hash_map.h>
|
#include <blt/std/hashmap.h>
|
||||||
|
|
||||||
inline static int test_hashmaps(){
|
inline static int test_hashmaps(){
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue