Skip to content

Commit

Permalink
Add implicit dependency to all targets
Browse files Browse the repository at this point in the history
  • Loading branch information
petrhosek committed Jul 11, 2024
1 parent 5d3a240 commit dc5519d
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 15 deletions.
10 changes: 5 additions & 5 deletions libc/cmake/modules/LLVMLibCObjectRules.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -93,11 +93,11 @@ function(create_object_library fq_target_name)
endif()
endif()

if(fq_deps_list)
add_dependencies(${fq_target_name} ${fq_deps_list})
# Add deps as link libraries to inherit interface compile and link options.
target_link_libraries(${fq_target_name} PUBLIC ${fq_deps_list})
endif()
list(APPEND fq_deps_list libc.src.__support.macros.config)
list(REMOVE_DUPLICATES fq_deps_list)
add_dependencies(${fq_target_name} ${fq_deps_list})
# Add deps as link libraries to inherit interface compile and link options.
target_link_libraries(${fq_target_name} PUBLIC ${fq_deps_list})

set_target_properties(
${fq_target_name}
Expand Down
16 changes: 7 additions & 9 deletions utils/bazel/llvm-project-overlay/libc/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,13 @@ config_setting(
flag_values = {":mpfr": "system"},
)

################################## Base Config #################################

cc_library(
name = "__support_macros_config",
hdrs = ["src/__support/macros/config.h"],
)

################################# Include Files ################################

libc_support_library(
Expand Down Expand Up @@ -234,11 +241,6 @@ libc_support_library(
],
)

libc_support_library(
name = "__support_macros_config",
hdrs = ["src/__support/macros/config.h"],
)

libc_support_library(
name = "__support_macros_attributes",
hdrs = ["src/__support/macros/attributes.h"],
Expand All @@ -252,17 +254,13 @@ libc_support_library(
hdrs = ["src/__support/macros/optimization.h"],
deps = [
":__support_macros_attributes",
":__support_macros_config",
":__support_macros_properties_compiler",
],
)

libc_support_library(
name = "__support_macros_sanitizer",
hdrs = ["src/__support/macros/sanitizer.h"],
deps = [
":__support_macros_config",
],
)

libc_support_library(
Expand Down
2 changes: 1 addition & 1 deletion utils/bazel/llvm-project-overlay/libc/libc_build_rules.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def _libc_library(name, hidden, copts = [], deps = [], local_defines = [], **kwa
name = name,
copts = copts + libc_common_copts(),
local_defines = local_defines + LIBC_CONFIGURE_OPTIONS,
deps = deps,
deps = deps + ["//libc:__support_macros_config"],
linkstatic = 1,
**kwargs
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ def libc_test(name, srcs, libc_function_deps = [], copts = [], deps = [], local_
local_defines = local_defines + LIBC_CONFIGURE_OPTIONS,
deps = [libc_internal_target(d) for d in all_function_deps] + [
"//libc/test/UnitTest:LibcUnitTest",
"//libc:__support_macros_config",
] + deps,
features = ["-link_llvmlibc"], # Do not link libllvmlibc.a
copts = copts + libc_common_copts(),
Expand Down

0 comments on commit dc5519d

Please sign in to comment.