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

Add support for external_includes #267

Closed
wants to merge 6 commits into from
Closed
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
1 change: 1 addition & 0 deletions cuda/private/actions/compile.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ def compile(
include_paths = common.includes,
quote_include_paths = common.quote_includes,
system_include_paths = common.system_includes,
external_include_paths = common.external_includes,
defines = common.local_defines + common.defines,
host_defines = common.host_local_defines + common.host_defines,
ptxas_flags = common.ptxas_flags,
Expand Down
1 change: 1 addition & 0 deletions cuda/private/actions/dlink.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,7 @@ def _wrapper_device_link(
includes = common.includes,
system_includes = common.system_includes,
quote_includes = common.quote_includes,
external_includes = common.external_includes,
# suppress cuda mode as c++ mode
compile_flags = ["-x", "c++"],
host_compile_flags = common.host_compile_flags,
Expand Down
9 changes: 9 additions & 0 deletions cuda/private/cuda_helper.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,7 @@ def _create_common_info(
includes = [],
quote_includes = [],
system_includes = [],
external_includes = [],
headers = [],
transitive_headers = [],
defines = [],
Expand All @@ -197,6 +198,7 @@ def _create_common_info(
includes: include paths. Can be used with `#include <...>` and `#include "..."`.
quote_includes: include paths. Can be used with `#include "..."`.
system_includes: include paths. Can be used with `#include <...>`.
external_includes: include paths for external sources. Warnings in these files can be silenced.
headers: headers directly relate with this target.
transitive_headers: headers transitively gather from `deps`.
defines: public `#define`s. Pass to compiler driver directly. Will be seen by downstream targets.
Expand All @@ -215,6 +217,7 @@ def _create_common_info(
includes = includes,
quote_includes = quote_includes,
system_includes = system_includes,
external_includes = external_includes,
headers = depset(headers, transitive = transitive_headers),
defines = defines,
local_defines = local_defines,
Expand Down Expand Up @@ -249,11 +252,13 @@ def _create_common(ctx):
includes = merged_cc_info.compilation_context.includes.to_list()
system_includes = []
quote_includes = []
external_includes = []
quote_includes.extend(_resolve_workspace_root_includes(ctx))
for inc in attr.includes:
system_includes.extend(_resolve_includes(ctx, inc))
system_includes.extend(merged_cc_info.compilation_context.system_includes.to_list())
quote_includes.extend(merged_cc_info.compilation_context.quote_includes.to_list())
external_includes.extend(merged_cc_info.compilation_context.external_includes.to_list())

# gather header info
public_headers = []
Expand Down Expand Up @@ -298,6 +303,7 @@ def _create_common(ctx):
includes = includes,
quote_includes = quote_includes,
system_includes = system_includes,
external_includes = external_includes,
headers = headers,
transitive_headers = transitive_headers,
defines = defines,
Expand Down Expand Up @@ -396,6 +402,7 @@ def _create_compile_variables(
include_paths = [],
quote_include_paths = [],
system_include_paths = [],
external_include_paths = [],
defines = [],
host_defines = [],
ptxas_flags = [],
Expand All @@ -415,6 +422,7 @@ def _create_compile_variables(
include_paths: include paths. Can be used with `#include <...>` and `#include "..."`.
quote_include_paths: include paths. Can be used with `#include "..."`.
system_include_paths: include paths. Can be used with `#include <...>`.
external_include_paths: include paths.
defines: `#define`s. Pass to compiler driver directly.
host_defines: `#define`s. Pass to host compiler.
ptxas_flags: flags pass to `ptxas`.
Expand All @@ -436,6 +444,7 @@ def _create_compile_variables(
include_paths = include_paths,
quote_include_paths = quote_include_paths,
system_include_paths = system_include_paths,
external_include_paths = external_include_paths,
defines = defines,
host_defines = host_defines,
ptxas_flags = ptxas_flags,
Expand Down
1 change: 1 addition & 0 deletions cuda/private/rules/cuda_library.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ def _cuda_library_impl(ctx):
includes = depset(common.includes),
quote_includes = depset(common.quote_includes),
system_includes = depset(common.system_includes),
external_includes = depset(common.external_includes),
defines = depset(common.host_defines),
local_defines = depset(common.host_local_defines),
)
Expand Down
1 change: 1 addition & 0 deletions cuda/private/rules/cuda_objects.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ def _cuda_objects_impl(ctx):
includes = depset(common.includes),
system_includes = depset(common.system_includes),
quote_includes = depset(common.quote_includes),
external_includes = depset(common.external_includes),
defines = depset(common.host_defines),
local_defines = depset(common.host_local_defines),
)
Expand Down
Loading