From 38a7ca8fdef58595d0ddc6909568a0a7ce1a95bd Mon Sep 17 00:00:00 2001 From: vtavana <120411540+vtavana@users.noreply.github.com> Date: Fri, 2 Feb 2024 22:35:49 -0600 Subject: [PATCH] update `build_locally.py` (#1677) * update build_locally.py * fix pre-commit * add comments --------- Co-authored-by: Anton <100830759+antonwolfy@users.noreply.github.com> --- scripts/build_locally.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/scripts/build_locally.py b/scripts/build_locally.py index c8ff30d34ce..a0e5c55edc9 100644 --- a/scripts/build_locally.py +++ b/scripts/build_locally.py @@ -58,12 +58,31 @@ def run( cmake_args += [ "--cmake-executable=" + cmake_executable, ] + + # if dpctl is locally built using `script/build_locally.py`, it is needed + # to pass the -DDpctl_ROOT=$(python -m dpctl --cmakedir) + # if dpctl is conda installed, it is optional to pass this parameter + process = subprocess.Popen( + ["python", "-m", "dpctl", "--cmakedir"], + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + ) + output, error = process.communicate() + if process.returncode == 0: + cmake_dir = output.decode("utf-8").strip() + else: + raise RuntimeError( + "Failed to retrieve dpctl cmake directory: " + + error.decode("utf-8").strip() + ) + cmake_args += [ "--build-type=" + build_type, "--generator=" + build_system, "--", "-DCMAKE_C_COMPILER:PATH=" + c_compiler, "-DCMAKE_CXX_COMPILER:PATH=" + cxx_compiler, + "-DDpctl_ROOT=" + cmake_dir, ] if verbose: cmake_args += [