Skip to content
Merged
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
7 changes: 4 additions & 3 deletions MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,23 @@ module(

bazel_dep(name = "abc", version = "0.62-yosyshq")
bazel_dep(name = "abseil-cpp", version = "20260107.0")
bazel_dep(name = "bazel_skylib", version = "1.7.1")
bazel_dep(name = "coin-or-lemon", version = "1.3.1")
bazel_dep(name = "platforms", version = "0.0.11")
bazel_dep(name = "bazel_skylib", version = "1.7.1")
bazel_dep(name = "rules_bison", version = "0.3.1")
bazel_dep(name = "rules_cc", version = "0.1.2")
bazel_dep(name = "rules_flex", version = "0.3.1")
bazel_dep(name = "rules_bison", version = "0.3.1")
bazel_dep(name = "rules_jvm_external", version = "6.4")
bazel_dep(name = "rules_shell", version = "0.6.1")
bazel_dep(name = "rules_scala")
git_override(
module_name = "rules_scala",
commit = "1aced658083aac6c636fcc03b7cd3952a426eda7",
remote = "https://github.com/bazelbuild/rules_scala",
)

bazel_dep(name = "rules_shell", version = "0.6.1")
bazel_dep(name = "rules_verilator", version = "0.1.0")
bazel_dep(name = "swig", version = "4.3.0.bcr.2")
bazel_dep(name = "verilator", version = "5.036.bcr.3")

BOOST_VERSION = "1.89.0.bcr.2"
Expand Down
6 changes: 4 additions & 2 deletions MODULE.bazel.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

33 changes: 0 additions & 33 deletions WORKSPACE
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🥇

This file was deleted.

20 changes: 17 additions & 3 deletions bazel/python_wrap_cc.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ def _python_wrap_cc_impl(ctx):
if len(ctx.files.srcs) > 1 and not ctx.attr.root_swig_src:
fail("If multiple src files are provided, root_swig_src must be specified.")

swig_lib_dir = ctx.file._swig_swg.dirname

root_file = ctx.file.root_swig_src or ctx.files.srcs[0]

cc_outfile_name = ctx.attr.out or (ctx.attr.name + ".cc")
Expand Down Expand Up @@ -85,8 +87,9 @@ def _python_wrap_cc_impl(ctx):
outputs = [cc_output_file, py_output_file],
inputs = src_inputs,
arguments = [args],
tools = ctx.files._swig,
executable = ([file for file in ctx.files._swig if file.basename == "swig"][0]),
env = {"SWIG_LIB": swig_lib_dir},
tools = ctx.files._swig_lib,
executable = ctx.executable._swig,
)
return [
DefaultInfo(files = depset([cc_output_file, py_output_file])),
Expand Down Expand Up @@ -130,9 +133,20 @@ python_wrap_cc = rule(
doc = "args to pass directly to the swig binary",
),
"_swig": attr.label(
default = "@org_swig//:swig_stable",
default = "@swig",
allow_files = True,
cfg = "exec",
executable = True,
),
"_swig_lib": attr.label(
default = "@swig//:lib_python",
allow_files = True,
),
"_swig_swg": attr.label(
default = "@swig//:swig_swg",
allow_single_file = True,
doc = "SWIG swig.swg library file used for determining SWIG_LIB " +
"env variable (internal attribute).",
),
},
)
36 changes: 25 additions & 11 deletions bazel/tcl_wrap_cc.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ def _tcl_wrap_cc_impl(ctx):
if len(ctx.files.srcs) > 1 and not ctx.attr.root_swig_src:
fail("If multiple src files are provided, root_swig_src must be specified.")

swig_lib_dir = ctx.file._swig_swg.dirname
root_file = ctx.file.root_swig_src or ctx.files.srcs[0]

outfile_name = ctx.attr.out or (ctx.attr.name + ".cc")
Expand All @@ -68,18 +69,19 @@ def _tcl_wrap_cc_impl(ctx):
args.add("-namespace")
args.add("-prefix")
args.add(ctx.attr.namespace_prefix)
args.add_all(swig_options.to_list())
args.add_all(includes_paths.to_list(), format_each = "-I%s")
args.add("-o")
args.add(output_file.path)
args.add(root_file.path)
args.add_all(swig_options.to_list())
args.add_all(includes_paths.to_list(), format_each = "-I%s")
args.add("-o")
args.add(output_file.path)
args.add(root_file.path)

ctx.actions.run(
outputs = [output_file],
inputs = src_inputs,
arguments = [args],
tools = ctx.files._swig,
executable = ([file for file in ctx.files._swig if file.basename == "swig"][0]),
env = {"SWIG_LIB": swig_lib_dir},
tools = ctx.files._swig_lib,
executable = ctx.executable._swig,
)

output_files = [output_file]
Expand All @@ -92,10 +94,11 @@ def _tcl_wrap_cc_impl(ctx):
runtime_args.add(runtime_header)
ctx.actions.run(
outputs = [runtime_header],
inputs = [],
inputs = depset(ctx.files._swig_lib),
arguments = [runtime_args],
tools = [ctx.attr._swig.files_to_run],
executable = ([file for file in ctx.files._swig if file.basename == "swig"][0]),
env = {"SWIG_LIB": swig_lib_dir},
executable = ctx.executable._swig,
tools = ctx.files._swig_lib,
toolchain = None,
)
output_files.append(runtime_header)
Expand Down Expand Up @@ -149,9 +152,20 @@ tcl_wrap_cc = rule(
doc = "args to pass directly to the swig binary",
),
"_swig": attr.label(
default = "@org_swig//:swig_stable",
default = "@swig",
executable = True,
allow_files = True,
cfg = "exec",
),
"_swig_lib": attr.label(
default = "@swig//:lib_tcl",
allow_files = True,
),
"_swig_swg": attr.label(
default = "@swig//:swig_swg",
allow_single_file = True,
doc = "SWIG swig.swg library file used for determining SWIG_LIB " +
"env variable (internal attribute).",
),
},
)