Skip to content

Commit 38a7ca8

Browse files
vtavanaantonwolfy
andauthored
update build_locally.py (#1677)
* update build_locally.py * fix pre-commit * add comments --------- Co-authored-by: Anton <[email protected]>
1 parent b46e0f6 commit 38a7ca8

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

scripts/build_locally.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,12 +58,31 @@ def run(
5858
cmake_args += [
5959
"--cmake-executable=" + cmake_executable,
6060
]
61+
62+
# if dpctl is locally built using `script/build_locally.py`, it is needed
63+
# to pass the -DDpctl_ROOT=$(python -m dpctl --cmakedir)
64+
# if dpctl is conda installed, it is optional to pass this parameter
65+
process = subprocess.Popen(
66+
["python", "-m", "dpctl", "--cmakedir"],
67+
stdout=subprocess.PIPE,
68+
stderr=subprocess.PIPE,
69+
)
70+
output, error = process.communicate()
71+
if process.returncode == 0:
72+
cmake_dir = output.decode("utf-8").strip()
73+
else:
74+
raise RuntimeError(
75+
"Failed to retrieve dpctl cmake directory: "
76+
+ error.decode("utf-8").strip()
77+
)
78+
6179
cmake_args += [
6280
"--build-type=" + build_type,
6381
"--generator=" + build_system,
6482
"--",
6583
"-DCMAKE_C_COMPILER:PATH=" + c_compiler,
6684
"-DCMAKE_CXX_COMPILER:PATH=" + cxx_compiler,
85+
"-DDpctl_ROOT=" + cmake_dir,
6786
]
6887
if verbose:
6988
cmake_args += [

0 commit comments

Comments
 (0)