Skip to content

Commit 909d49f

Browse files
yingcong-wuAlexisPerry
authored andcommitted
[offload][cmake] always define pythonize_bool macro (llvm#96028)
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.
1 parent 22a5702 commit 909d49f

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

offload/CMakeLists.txt

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -282,15 +282,15 @@ if(OPENMP_STANDALONE_BUILD)
282282
${LLVM_LIBRARY_DIRS}
283283
REQUIRED
284284
)
285+
endif()
285286

286-
macro(pythonize_bool var)
287-
if (${var})
288-
set(${var} True)
289-
else()
290-
set(${var} False)
291-
endif()
292-
endmacro()
287+
macro(pythonize_bool var)
288+
if (${var})
289+
set(${var} True)
290+
else()
291+
set(${var} False)
293292
endif()
293+
endmacro()
294294

295295
if(OPENMP_STANDALONE_BUILD OR TARGET omp)
296296
# Check LIBOMP_HAVE_VERSION_SCRIPT_FLAG

0 commit comments

Comments
 (0)