Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 19 additions & 3 deletions library/src/system/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,11 +1,27 @@
load("//:CPPVARIABLES.bzl", "DDS_CPPOPTS", "DDS_LINKOPTS", "DDS_LOCAL_DEFINES", "DDS_SCHEDULER_DEFINE")
load("@rules_cc//cc:defs.bzl", "cc_library")

# Native builds keep parallel_boards.cpp unchanged. Emscripten builds swap in
# parallel_boards_wasm.cpp so the wasm32 heap worker cap cannot affect host
# codegen of the hot parallel_all_boards_n translation unit.
_PARALLEL_BOARDS_SRC = select({
"//:build_wasm": ["parallel_boards_wasm.cpp"],
"//conditions:default": ["parallel_boards.cpp"],
})

_SYSTEM_SRCS = glob(
["*.cpp"],
exclude = [
"parallel_boards.cpp",
"parallel_boards_wasm.cpp",
],
) + _PARALLEL_BOARDS_SRC

# system, system_util_log, and system_util_stats compile the same sources with
# different feature defines. Link at most one variant into a binary.
cc_library(
name = "system",
srcs = glob(["*.cpp"]),
srcs = _SYSTEM_SRCS,
hdrs = glob(["*.hpp", "util/*.hpp"]),
visibility = ["//visibility:public"],
includes = ["."],
Expand All @@ -27,7 +43,7 @@ cc_library(
# Variant with Utilities logging enabled for tests that assert log behavior
cc_library(
name = "system_util_log",
srcs = glob(["*.cpp"]),
srcs = _SYSTEM_SRCS,
hdrs = glob(["*.hpp", "util/*.hpp"]),
visibility = ["//visibility:public"],
includes = ["."],
Expand All @@ -47,7 +63,7 @@ cc_library(

cc_library(
name = "system_util_stats",
srcs = glob(["*.cpp"]),
srcs = _SYSTEM_SRCS,
hdrs = glob(["*.hpp", "util/*.hpp"]),
visibility = ["//visibility:public"],
includes = ["."],
Expand Down
5 changes: 5 additions & 0 deletions library/src/system/parallel_boards.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@

#include "parallel_boards.hpp"

// NOTE: parallel_boards_wasm.cpp is a wasm-only copy of this file so the
// Emscripten worker-count memory cap does not affect native codegen. Keep the
// worker pool and parallel_all_boards_n logic in sync with that file; only
// resolve_worker_count should differ (WASM heap cap).

#include <algorithm>
#include <atomic>
#include <condition_variable>
Expand Down
Loading
Loading