Skip to content

Commit 556e1a2

Browse files
authored
Enable cmake argument passthrough in the SYCL configure wrapper (#17587)
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. CHERRY-PICK OF: c62abae Patch-by: Luke Drummond <[email protected]>
1 parent 9d185d1 commit 556e1a2

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

buildbot/configure.py

+4-3
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__, "../..")
@@ -244,6 +244,7 @@ def do_configure(args):
244244
]
245245
)
246246

247+
cmake_cmd += passthrough_args
247248
print("[Cmake Command]: {}".format(" ".join(map(shlex.quote, cmake_cmd))))
248249

249250
try:
@@ -398,11 +399,11 @@ def main():
398399
"--native-cpu-libclc-targets",
399400
help="Target triples for libclc, used by the Native CPU backend",
400401
)
401-
args = parser.parse_args()
402+
args, passthrough_args = parser.parse_known_intermixed_args()
402403

403404
print("args:{}".format(args))
404405

405-
return do_configure(args)
406+
return do_configure(args, passthrough_args)
406407

407408

408409
if __name__ == "__main__":

sycl/doc/GetStartedGuide.md

+5-4
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,8 @@ Secondly, set the `CUDA_LIB_PATH` environment variable and pass the CMake
228228
variable `CUDA_TOOLKIT_ROOT_DIR` as follows:
229229

230230
```sh
231-
CUDA_LIB_PATH=/path/to/cuda/toolkit/lib64/stubs CC=gcc CXX=g++ python $DPCPP_HOME/llvm/buildbot/configure.py --cuda --cmake-opt="-DCUDA_TOOLKIT_ROOT_DIR=/path/to/cuda/toolkit"
231+
CC=gcc CXX=g++ python $DPCPP_HOME/llvm/buildbot/configure.py \
232+
--cuda -DCUDA_Toolkit_ROOT=/path/to/cuda/toolkit
232233

233234
CUDA_LIB_PATH=/path/to/cuda/toolkit/lib64/stubs CC=gcc CXX=g++ python $DPCPP_HOME/llvm/buildbot/compile.py
234235

@@ -256,12 +257,12 @@ instruction on how to install this refer to
256257

257258
The DPC++ build assumes that ROCm is installed in `/opt/rocm`, if it is
258259
installed somewhere else, the directory must be provided through the CMake
259-
variable `UR_HIP_ROCM_DIR` which can be passed using the
260-
`--cmake-opt` option of `configure.py` as follows:
260+
variable `UR_HIP_ROCM_DIR` which can be passed through to cmake using the
261+
configure helper script as follows:
261262

262263
```sh
263264
python $DPCPP_HOME/llvm/buildbot/configure.py --hip \
264-
--cmake-opt=-DUR_HIP_ROCM_DIR=/usr/local/rocm
265+
-DUR_HIP_ROCM_DIR=/usr/local/rocm
265266
```
266267
If further customization is required — for instance when the layout of
267268
individual directories can not be inferred from `UR_HIP_ROCM_DIR`

sycl/doc/design/SYCLNativeCPU.md

+1-3
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,7 @@ SYCL Native CPU uses [libclc](https://github.com/intel/llvm/tree/sycl/libclc) to
4747
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):
4848

4949
```
50-
python3 buildbot/configure.py \
51-
--native_cpu \
52-
--cmake-opt=-DNATIVECPU_USE_OCK=Off
50+
python3 buildbot/configure.py --native_cpu -DNATIVECPU_USE_OCK=Off
5351
```
5452

5553
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)