Out of tree buildbot

Hi everyone,

The out of tree buildbot is staging here [1] and the corresponding
patch to zorg is in review here [2]. Please leave a comment or reply
to this email if you think anything looks wrong about what it's doing
or if there are any additional CMake flags that we should be passing.

Thanks,
Diana

TL;DR, here are the commands it runs:

build_llvm> cmake -DLLVM_TARGETS_TO_BUILD=AArch64
-DCMAKE_CXX_STANDARD=17 -DLLVM_ENABLE_WERROR=OFF
-DLLVM_ENABLE_ASSERTIONS=ON -DCMAKE_BUILD_TYPE=Release -GNinja
'-DLLVM_ENABLE_PROJECTS=llvm;mlir' '-DLLVM_LIT_ARGS=-v -vv'
../llvm-project/llvm

build_llvm> ninja

build_flang> cmake -DFLANG_ENABLE_WERROR=ON -DCMAKE_BUILD_TYPE=Release
-GNinja -DLLVM_DIR:PATH=../../build_llvm/lib/cmake/llvm
-DMLIR_DIR:PATH=../../build_llvm/lib/cmake/mlir ../llvm-project/flang

build_flang> ninja check-all

[1] http://ex40-01.tcwglab.linaro.org:8012/builders/flang-aarch64-ubuntu-out-of-tree
[2] https://reviews.llvm.org/D87085

Hi everyone,

The out of tree buildbot is staging here [1] and the corresponding
patch to zorg is in review here [2]. Please leave a comment or reply
to this email if you think anything looks wrong about what it's doing
or if there are any additional CMake flags that we should be passing.

Thanks,
Diana

TL;DR, here are the commands it runs:

build_llvm> cmake -DLLVM_TARGETS_TO_BUILD=AArch64
-DCMAKE_CXX_STANDARD=17 -DLLVM_ENABLE_WERROR=OFF
-DLLVM_ENABLE_ASSERTIONS=ON -DCMAKE_BUILD_TYPE=Release -GNinja
'-DLLVM_ENABLE_PROJECTS=llvm;mlir' '-DLLVM_LIT_ARGS=-v -vv'
../llvm-project/llvm

Just noticed I should probably move the LLVM_LIT_ARGS to the second
cmake command, since that's the one running any tests :smiley: But do point
out anything else!

FYI, you can use CMAKE_PREFIX_PATH rather than LLVM_DIR and MLIR_DIR to make your out-of-tree cmake command a little simpler.

With your setup I think it would be: -DCMAKE_PREFIX_PATH=../../build_llvm

Tim

    External email: Use caution opening links or attachments

    >
    > Hi everyone,
    >
    > The out of tree buildbot is staging here [1] and the corresponding
    > patch to zorg is in review here [2]. Please leave a comment or reply
    > to this email if you think anything looks wrong about what it's doing
    > or if there are any additional CMake flags that we should be passing.
    >
    > Thanks,
    > Diana
    >
    > TL;DR, here are the commands it runs:
    >
    > build_llvm> cmake -DLLVM_TARGETS_TO_BUILD=AArch64
    > -DCMAKE_CXX_STANDARD=17 -DLLVM_ENABLE_WERROR=OFF
    > -DLLVM_ENABLE_ASSERTIONS=ON -DCMAKE_BUILD_TYPE=Release -GNinja
    > '-DLLVM_ENABLE_PROJECTS=llvm;mlir' '-DLLVM_LIT_ARGS=-v -vv'
    > ../llvm-project/llvm

    Just noticed I should probably move the LLVM_LIT_ARGS to the second
    cmake command, since that's the one running any tests :smiley: But do point
    out anything else!

FYI, you can use CMAKE_PREFIX_PATH rather than LLVM_DIR and MLIR_DIR to make your out-of-tree cmake command a little simpler.

With your setup I think it would be: -DCMAKE_PREFIX_PATH=../../build_llvm

Interesting point! I was using LLVM_DIR and MLIR_DIR since that's what
the docs say and that's what people are most likely to use in real
life. Is setting CMAKE_PREFIX_PATH preferred? If so, I can update both
the buildbot and the readme to use that.

Thanks,
Diana

Replacing LLVM_DIR/MLIR_DIR/CLANG_DIR with something more generic would be nice.

AFAIK, both CMAKE_PREFIX_PATH and CMAKE_MODULE_PATH are used by CMake when searching directories. But I always get slightly confused by the exact relation between these variables and various CMake commands.

I'm not a CMake expert, but IIUC we need to make sure that:

* CMake's `find_package` finds LLVM/MLIR/CLANG (e.g. https://github.com/llvm/llvm-project/blob/master/flang/CMakeLists.txt#L59)
* CMake's `include` finds, among others, AddLLVM.cmake (https://github.com/llvm/llvm-project/blob/master/flang/CMakeLists.txt#L82)

Just my 2p.

-Andrzej

I don't know if there is a reason to prefer CMAKE_PREFIX_PATH or LLVM_DIR+MLIR_DIR. My experiences is that they work equally well.

When they are missing, the error message suggests either solution:
        Add the installation prefix of "MLIR" to CMAKE_PREFIX_PATH or set
        "MLIR_DIR" to a directory containing one of the above files.

Tim

    External email: Use caution opening links or attachments

    Replacing LLVM_DIR/MLIR_DIR/CLANG_DIR with something more generic would
    be nice.

    AFAIK, both CMAKE_PREFIX_PATH and CMAKE_MODULE_PATH are used by CMake
    when searching directories. But I always get slightly confused by the
    exact relation between these variables and various CMake commands.

    I'm not a CMake expert, but IIUC we need to make sure that:

    * CMake's `find_package` finds LLVM/MLIR/CLANG (e.g.
    https://github.com/llvm/llvm-project/blob/master/flang/CMakeLists.txt#L59)
    * CMake's `include` finds, among others, AddLLVM.cmake
    (https://github.com/llvm/llvm-project/blob/master/flang/CMakeLists.txt#L82)

    Just my 2p.

    -Andrzej