Skip to content

Commit ae76189

Browse files
authored
Enable cmake argument passthrough in the SYCL configure wrapper (#17189)
Hundreds of `--cmake-opt=-DFOO=BAR` on the command line make it hard to see the wood for the trees, so introduce an alternative which is to simply pass unknown argument flags straight through to cmake. This should make using the wrapper a little more pleasant and readable.
1 parent 2975d26 commit ae76189

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

buildbot/configure.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import sys
77

88

9-
def do_configure(args):
9+
def do_configure(args, passthrough_args):
1010
# Get absolute path to source directory
1111
abs_src_dir = os.path.abspath(
1212
args.src_dir if args.src_dir else os.path.join(__file__, "../..")
@@ -255,6 +255,7 @@ def do_configure(args):
255255
]
256256
)
257257

258+
cmake_cmd += passthrough_args
258259
print("[Cmake Command]: {}".format(" ".join(map(shlex.quote, cmake_cmd))))
259260

260261
try:
@@ -417,11 +418,11 @@ def main():
417418
"--native-cpu-libclc-targets",
418419
help="Target triples for libclc, used by the Native CPU backend",
419420
)
420-
args = parser.parse_args()
421+
args, passthrough_args = parser.parse_known_intermixed_args()
421422

422423
print("args:{}".format(args))
423424

424-
return do_configure(args)
425+
return do_configure(args, passthrough_args)
425426

426427

427428
if __name__ == "__main__":

sycl/doc/GetStartedGuide.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,8 @@ headers.
222222
Secondly pass the CMake variable `CUDAToolkit_ROOT` as follows:
223223

224224
```sh
225-
CC=gcc CXX=g++ python $DPCPP_HOME/llvm/buildbot/configure.py --cuda --cmake-opt="-DCUDAToolkit_ROOT=/path/to/cuda/toolkit"
225+
CC=gcc CXX=g++ python $DPCPP_HOME/llvm/buildbot/configure.py \
226+
--cuda -DCUDA_Toolkit_ROOT=/path/to/cuda/toolkit
226227

227228
CC=gcc CXX=g++ python $DPCPP_HOME/llvm/buildbot/compile.py
228229

@@ -250,12 +251,12 @@ instruction on how to install this refer to
250251

251252
The DPC++ build assumes that ROCm is installed in `/opt/rocm`, if it is
252253
installed somewhere else, the directory must be provided through the CMake
253-
variable `UR_HIP_ROCM_DIR` which can be passed using the
254-
`--cmake-opt` option of `configure.py` as follows:
254+
variable `UR_HIP_ROCM_DIR` which can be passed through to cmake using the
255+
configure helper script as follows:
255256

256257
```sh
257258
python $DPCPP_HOME/llvm/buildbot/configure.py --hip \
258-
--cmake-opt=-DUR_HIP_ROCM_DIR=/usr/local/rocm
259+
-DUR_HIP_ROCM_DIR=/usr/local/rocm
259260
```
260261
If further customization is required — for instance when the layout of
261262
individual directories can not be inferred from `UR_HIP_ROCM_DIR`

sycl/doc/design/SYCLNativeCPU.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,7 @@ SYCL Native CPU uses [libclc](https://github.com/intel/llvm/tree/sycl/libclc) to
5454
SYCL Native CPU uses the [oneAPI Construction Kit](https://github.com/codeplaysoftware/oneapi-construction-kit) (OCK) in order to support some core SYCL functionalities and improve performances, the OCK is fetched by default when SYCL Native CPU is enabled, and can optionally be disabled using the `NATIVECPU_USE_OCK` CMake variable (please note that disabling the OCK will result in limited functionalities and performances on the SYCL Native CPU backend):
5555

5656
```
57-
python3 buildbot/configure.py \
58-
--native_cpu \
59-
--cmake-opt=-DNATIVECPU_USE_OCK=Off
57+
python3 buildbot/configure.py --native_cpu -DNATIVECPU_USE_OCK=Off
6058
```
6159

6260
By default the oneAPI Construction Kit is pulled at the project's configure time using CMake `FetchContent`. This behaviour can be overridden by setting `NATIVECPU_OCK_USE_FETCHCONTENT=Off` and `OCK_SOURCE_DIR=<path>`

0 commit comments

Comments
 (0)