forked from iree-org/iree-nvgpu
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.bazel_to_cmake.cfg.py
More file actions
28 lines (21 loc) · 906 Bytes
/
Copy path.bazel_to_cmake.cfg.py
File metadata and controls
28 lines (21 loc) · 906 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# Copyright 2023 The OpenXLA Authors
#
# Licensed under the Apache License v2.0 with LLVM Exceptions.
# See https://llvm.org/LICENSE.txt for license information.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
import re
import bazel_to_cmake_targets
DEFAULT_ROOT_DIRS = ["compiler"]
REPO_MAP = {
# Since this is the @openxla_nvgpu repo, map to empty since all internal
# targets are of the form "//compiler", not "@openxla_nvgpu//compiler".
"@openxla_nvgpu": "",
}
class CustomTargetConverter(bazel_to_cmake_targets.TargetConverter):
def _convert_unmatched_target(self, target: str) -> str:
"""Converts unmatched targets in a repo specific way."""
# Map //compiler/src/(.*) -> the relative part
m = re.match(f"^//compiler/src/(.+)", target)
if m:
return [self._convert_to_cmake_path(m.group(1))]
raise ValueError(f"No target matching for {target}")