Skip to content
Merged
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
39 changes: 35 additions & 4 deletions mojo/private/toolchain.BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,32 @@ load("@rules_cc//cc:defs.bzl", "cc_import")
load("@rules_mojo//mojo:mojo_import.bzl", "mojo_import")
load("@rules_mojo//mojo:toolchain.bzl", "mojo_toolchain")

_INTERNAL_LIBRARIES = [
_COMPILER_LIBRARIES = [
(
paths.split_extension(library)[0],
library,
)
for library in glob(
[
# Globbed to allow .so or .dylib
"lib/libAsyncRTRuntimeGlobals.*",
"lib/libMSupportGlobals.*",
],
allow_empty = False,
) + glob(
# Only used in Mojo 1.3+
[
"lib/libLLVMSupport.*",
"lib/libLLVM.*",
"lib/libMLIR.*",
"lib/MDriverCompilation.*",
"lib/libclangBasic.*",
],
allow_empty = True,
)
]

_RUNTIME_LIBRARIES = [
(
paths.split_extension(library)[0],
library,
Expand All @@ -16,6 +41,12 @@ _INTERNAL_LIBRARIES = [
"lib/libMSupportGlobals.*",
],
allow_empty = False,
) + glob(
# Only used in Mojo 1.3+
[
"lib/libLLVMSupport.*",
],
allow_empty = True,
)
]

Expand All @@ -25,7 +56,7 @@ _INTERNAL_LIBRARIES = [
shared_library = library,
visibility = ["//visibility:private"],
)
for name, library in _INTERNAL_LIBRARIES
for name, library in set(_RUNTIME_LIBRARIES + _COMPILER_LIBRARIES)
]

mojo_import(
Expand All @@ -35,10 +66,10 @@ mojo_import(

mojo_toolchain(
name = "mojo_toolchain",
extra_tools = [lib[1] for lib in _INTERNAL_LIBRARIES],
extra_tools = [lib[1] for lib in _COMPILER_LIBRARIES],
implicit_deps = [
name
for name, _ in _INTERNAL_LIBRARIES
for name, _ in _RUNTIME_LIBRARIES
] + ([":std"] if "{INCLUDE_MOJOPKGS}" else []),
lld = "bin/lld",
mojo = "bin/mojo",
Expand Down
Loading