aboutsummaryrefslogtreecommitdiffstats
path: root/common/router2.cc
diff options
context:
space:
mode:
authorwhitequark <whitequark@whitequark.org>2021-03-10 06:18:42 +0000
committerwhitequark <whitequark@whitequark.org>2021-03-10 06:18:42 +0000
commit979e7b8709c77e30a6b01345e6541cbb7c03e7a8 (patch)
tree4d0da6dd965b2445efe8c5f8d6b9701baff8b9ac /common/router2.cc
parentd1f44fe91ad29b45c715918c97fba4bb243c631f (diff)
downloadnextpnr-979e7b8709c77e30a6b01345e6541cbb7c03e7a8.tar.gz
nextpnr-979e7b8709c77e30a6b01345e6541cbb7c03e7a8.tar.bz2
nextpnr-979e7b8709c77e30a6b01345e6541cbb7c03e7a8.zip
Only depend on Abseil in threaded builds.
Abseil has a hard dependency on threads (not just in the build system but in many places in the base libraries), so there is no way to use it on WASI at the moment.
Diffstat (limited to 'common/router2.cc')
-rw-r--r--common/router2.cc6
1 files changed, 6 insertions, 0 deletions
diff --git a/common/router2.cc b/common/router2.cc
index 0a3a4e94..b145db81 100644
--- a/common/router2.cc
+++ b/common/router2.cc
@@ -27,7 +27,9 @@
*/
#include "router2.h"
+#if !defined(NPNR_DISABLE_THREADS)
#include <absl/container/flat_hash_map.h>
+#endif
#include <algorithm>
#include <boost/container/flat_map.hpp>
#include <chrono>
@@ -191,7 +193,11 @@ struct Router2
}
}
+#if defined(NPNR_DISABLE_THREADS)
+ std::unordered_map<WireId, int> wire_to_idx;
+#else
absl::flat_hash_map<WireId, int> wire_to_idx;
+#endif
std::vector<PerWireData> flat_wires;
PerWireData &wire_data(WireId w) { return flat_wires[wire_to_idx.at(w)]; }