Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename conly to enable_cxx and flip default behavior #44

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
2 changes: 1 addition & 1 deletion build_tools/py/cffi.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ def dbx_cffi_module(
visibility = visibility,
setup_requires = ["//pip/cffi"],
ignore_missing_static_libraries = ignore_missing_static_libraries,
conly = conly,
enable_cxx = not conly,
tags = tags,
import_test_tags = import_test_tags,
)
14 changes: 7 additions & 7 deletions build_tools/py/py.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ ROOT_PLACEHOLDER = "____root____"
# Only applies to environment variables.
BUILDROOT_PLACEHOLDER = "____buildroot____"

def _add_vpip_compiler_args(ctx, cc_toolchain, copts, conly, args):
def _add_vpip_compiler_args(ctx, cc_toolchain, copts, enable_cxx, args):
# Set the compiler to the crosstool compilation driver.
feature_configuration = cc_common.configure_features(
ctx = ctx,
Expand All @@ -77,7 +77,7 @@ def _add_vpip_compiler_args(ctx, cc_toolchain, copts, conly, args):
)
c_compiler = cc_common.get_tool_for_action(
feature_configuration = feature_configuration,
action_name = C_COMPILE_ACTION_NAME if conly else CPP_COMPILE_ACTION_NAME,
action_name = CPP_COMPILE_ACTION_NAME if enable_cxx else C_COMPILE_ACTION_NAME,
)
archiver = cc_common.get_tool_for_action(
feature_configuration = feature_configuration,
Expand All @@ -91,16 +91,16 @@ def _add_vpip_compiler_args(ctx, cc_toolchain, copts, conly, args):
# flags are added in addition to whatever other flags distutils sees fit to
# use. distutils does not distinguish between compilation of C and C++; we
# must pass the C++ flags through CFLAGS if there is any C++ in the extension
# module. Passing C++ options when compiling C is basically harmless. At most,
# it generates some warnings that no one ever has to look at.
# module. Passing C++ options when compiling C is basically harmless but some
# stricter compilers such as clang 13 (or newer) will see this as an error.
compile_variables = cc_common.create_compile_variables(
feature_configuration = feature_configuration,
cc_toolchain = cc_toolchain,
user_compile_flags = copts,
)
compiler_options = cc_common.get_memory_inefficient_command_line(
feature_configuration = feature_configuration,
action_name = C_COMPILE_ACTION_NAME if conly else CPP_COMPILE_ACTION_NAME,
action_name = CPP_COMPILE_ACTION_NAME if enable_cxx else C_COMPILE_ACTION_NAME,
variables = compile_variables,
)
args.add_all(compiler_options, format_each = "--compile-flags=%s")
Expand Down Expand Up @@ -170,7 +170,7 @@ def _build_wheel(ctx, wheel, python_interp, sdist_tar):
outputs = [wheel]

cc_toolchain = find_cpp_toolchain(ctx)
link_env = _add_vpip_compiler_args(ctx, cc_toolchain, ctx.attr.copts, ctx.attr.conly, command_args)
link_env = _add_vpip_compiler_args(ctx, cc_toolchain, ctx.attr.copts, ctx.attr.enable_cxx, command_args)

inputs_direct = []
inputs_trans = [
Expand Down Expand Up @@ -543,7 +543,7 @@ _piplib_attrs = {
"deps": attr.label_list(allow_files = True),
"data": attr.label_list(allow_files = True),
"copts": attr.string_list(),
"conly": attr.bool(default = False),
"enable_cxx": attr.bool(default = False),
"global_options": attr.string_list(),
"build_options": attr.string_list(),
"extra_path": attr.string_list(),
Expand Down