llvm-flang: Only build offload code if cuda enabled (#17466)

* llvm-flang Only build offload code if cuda enabled

The current version executes `cmake(*args)` always as part of the post install.  If device offload is not part of the build, this results in referencing `args` without it being set and the error:

```
==> Error: UnboundLocalError: local variable 'args' referenced before assignment

```

Looking at prevoous version of `llvm-package.py` this whole routine appears to be only required for offload, some indent `cmake/make/install` to be under the `if`.

* Update package.py

Add comment
This commit is contained in:
Dr Owain Kenway 2020-07-11 15:02:53 +01:00 committed by GitHub
parent 5e50dc5acb
commit 9629f571bc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -238,6 +238,7 @@ def post_install(self):
spec['libelf'].prefix.include,
spec['hwloc'].prefix.include))
# Only build if offload target.
cmake(*args)
make()
make('install')