Skip to content

Conversation

@tintor
Copy link

@tintor tintor commented Dec 21, 2024

Enables sharing of code and definitions between shaders and C/C++ code.
Enables setting optimization level (-O) and setting defines (-D) from bazel.

…n 'srcs' attribute to be #include-d

Enables sharing of code and definitions between shaders and C/C++ code.
Enables setting optimization level (-O) and setting defines (-D) from bazel.
incdirs_dict[parent_dir] = True
incdirs_list = []
for d in sorted(incdirs_dict.keys()):
incdirs_list.append("-I" + d)
Copy link
Owner

Choose a reason for hiding this comment

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

I don't think having every source file parent path as an include directory for every file is very expected, no?

Does glslc not already find headers relative to the source files?

default = '',
values = [''] + _shader_stages,
),
"opts": attr.string_list(default = []),
Copy link
Owner

Choose a reason for hiding this comment

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

instead of a general opts could we emulate what the cc_* libraries do and have a defines attribute for defines etc? https://bazel.build/reference/be/c-cpp#cc_library.defines

@zaucy
Copy link
Owner

zaucy commented Dec 21, 2024

Enables setting optimization level (-O)

understand this desire! However these should be controlled by bazels compilation option (-c). It can be accessed in a rule with ctx.var["COMPILATION_MODE"] (here's an example: https://github.com/ecsact-dev/rules_ecsact/blob/5990b9c370463ff39e34984be156800d384b0750/ecsact/private/ecsact_binary.bzl#L65)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants