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

Make bazel_to_cmake configurable. #12765

Merged
merged 3 commits into from
Mar 28, 2023
Merged

Make bazel_to_cmake configurable. #12765

merged 3 commits into from
Mar 28, 2023

Conversation

stellaraccident
Copy link
Collaborator

This reworks bazel_to_cmake so that it searches for a .bazel_to_cmake.cfg.py file and uses its location as the root of the repository.

This file is also evaluated and provides repository-specific configuration for the tool.

There may still be some work to fully generalize but this should get us pretty close to being able to use bazel_to_cmake in related OpenXLA projects.

Progress on #12520 for letting us use bazel_to_cmake in out of tree plugin repositories.

This reworks bazel_to_cmake so that it searches for a .bazel_to_cmake.cfg.py file and uses its location as the root of the repository.

This file is also evaluated and provides repository-specific configuration for the tool.

There may still be some work to fully generalize but this should get us pretty close to being able to use bazel_to_cmake in related OpenXLA projects.

Progress on #12520 for letting us use bazel_to_cmake in out of tree plugin repositories.
build_tools/bazel_to_cmake/bazel_to_cmake.py Outdated Show resolved Hide resolved
build_tools/bazel_to_cmake/bazel_to_cmake.py Outdated Show resolved Hide resolved
build_tools/bazel_to_cmake/bazel_to_cmake.py Show resolved Hide resolved
build_tools/bazel_to_cmake/bazel_to_cmake.py Show resolved Hide resolved
build_tools/bazel_to_cmake/bazel_to_cmake_converter.py Outdated Show resolved Hide resolved
self._converter.body += (
f"list(REMOVE_ITEM {glob_var} {self._expand_cmake_var(exclude_var)})\n"
)
return [self._expand_cmake_var(var) for var in glob_vars]

# TODO(gcmn) implement these types of functions in a less hard-coded way
def platform_trampoline_deps(self, basename, path="base"):
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe move this to the IREE config?

f"{td_file_block}"
f"{outs_block}"
f"{tblgen_block}"
f")\n\n")

def iree_gentbl_cc_library(self, **kwargs):
Copy link
Contributor

Choose a reason for hiding this comment

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

There are still a lot of iree_* functions in here. Should we move these to the IREE config? Or is the idea that they're general enough that other repos could use them? We should probably rename them and move promote them to some separate place in that case, but this is OK for now.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I was trying to split the difference between things that were "private to IREE" and things that would be used as part of openxla projects that depend on IREE. Things I judged in the latter category stayed central.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ok this is fine for now. Just thinking that as the boundary becomes clearer we should probably rename/migrate/generalize. We might also want to enable some way of including multiple configs, like one loading another or something.

build_tools/bazel_to_cmake/bazel_to_cmake_converter.py Outdated Show resolved Hide resolved
build_tools/bazel_to_cmake/bazel_to_cmake_targets.py Outdated Show resolved Hide resolved
@stellaraccident
Copy link
Collaborator Author

PTAL

@stellaraccident stellaraccident merged commit 6f24a2f into main Mar 28, 2023
@stellaraccident stellaraccident deleted the bazel_to_cmake_cfg branch March 28, 2023 00:08
@jpienaar jpienaar mentioned this pull request Apr 3, 2023
jpienaar pushed a commit that referenced this pull request May 1, 2023
This reworks bazel_to_cmake so that it searches for a
.bazel_to_cmake.cfg.py file and uses its location as the root of the
repository.

This file is also evaluated and provides repository-specific
configuration for the tool.

There may still be some work to fully generalize but this should get us
pretty close to being able to use bazel_to_cmake in related OpenXLA
projects.

Progress on #12520 for letting us use bazel_to_cmake in out of tree
plugin repositories.
NatashaKnk pushed a commit to NatashaKnk/iree that referenced this pull request Jul 6, 2023
This reworks bazel_to_cmake so that it searches for a
.bazel_to_cmake.cfg.py file and uses its location as the root of the
repository.

This file is also evaluated and provides repository-specific
configuration for the tool.

There may still be some work to fully generalize but this should get us
pretty close to being able to use bazel_to_cmake in related OpenXLA
projects.

Progress on iree-org#12520 for letting us use bazel_to_cmake in out of tree
plugin repositories.
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