Skip to content

Commit

Permalink
update build_locally.py (#1677)
Browse files Browse the repository at this point in the history
* update build_locally.py

* fix pre-commit

* add comments

---------

Co-authored-by: Anton <100830759+antonwolfy@users.noreply.github.com>
  • Loading branch information
vtavana and antonwolfy authored Feb 3, 2024
1 parent b46e0f6 commit 38a7ca8
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions scripts/build_locally.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 += [
Expand Down

0 comments on commit 38a7ca8

Please sign in to comment.