[llvm] [offload][cmake] always define pythonize_bool macro (PR #96028)
via llvm-commits
llvm-commits at lists.llvm.org
Tue Jun 18 23:39:49 PDT 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-offload
Author: Wu Yingcong (yingcong-wu)
<details>
<summary>Changes</summary>
I use the following cmake config to build offload and openmp
```
cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release -DLLVM_TARGETS_TO_BUILD="X86" -DLLVM_ENABLE_PROJECTS="clang;openmp" -DLLVM_ENABLE_RUNTIMES="offload" -DLLVM_LIT_ARGS="-vv -a" -DLLVM_ENABLE_ASSERTIONS=ON ../llvm
```
and got the following error:
```
CMake Error at /tmp/build-llvm/llvm/offload/CMakeLists.txt:321 (pythonize_bool):
Unknown CMake command "pythonize_bool".
```
After some search I find out that the "correct" way to build this is putting openmp and offload to the ENABLE_RUNTIMES like
```
cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release -DLLVM_TARGETS_TO_BUILD="X86" -DLLVM_ENABLE_PROJECTS="clang" -DLLVM_ENABLE_RUNTIMES="openmp;offload" -DLLVM_LIT_ARGS="-vv -a" -DLLVM_ENABLE_ASSERTIONS=ON ../llvm
```
.
But since we don't forbid to config them using openmp as PROJECT and offload as RUNTIME, then we probably support it. The fix is to always define the pythonize_bool macro. For cmake, it is okay to redefine a macro, it does not cause a warning or else.
---
Full diff: https://github.com/llvm/llvm-project/pull/96028.diff
1 Files Affected:
- (modified) offload/CMakeLists.txt (+7-7)
``````````diff
diff --git a/offload/CMakeLists.txt b/offload/CMakeLists.txt
index ead2aed414ffe..4cd97a6a5ff63 100644
--- a/offload/CMakeLists.txt
+++ b/offload/CMakeLists.txt
@@ -282,15 +282,15 @@ if(OPENMP_STANDALONE_BUILD)
${LLVM_LIBRARY_DIRS}
REQUIRED
)
+endif()
- macro(pythonize_bool var)
- if (${var})
- set(${var} True)
- else()
- set(${var} False)
- endif()
- endmacro()
+macro(pythonize_bool var)
+if (${var})
+ set(${var} True)
+else()
+ set(${var} False)
endif()
+endmacro()
if(OPENMP_STANDALONE_BUILD OR TARGET omp)
# Check LIBOMP_HAVE_VERSION_SCRIPT_FLAG
``````````
</details>
https://github.com/llvm/llvm-project/pull/96028
More information about the llvm-commits
mailing list