[all-commits] [llvm/llvm-project] f87484: Fix libnvptxcompiler_static.a absolute path (#115015)

Zichen Lu via All-commits all-commits at lists.llvm.org
Wed Nov 6 02:51:39 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: f87484d5910c1c708bfd93ef588d6ff8307e2477
      https://github.com/llvm/llvm-project/commit/f87484d5910c1c708bfd93ef588d6ff8307e2477
  Author: Zichen Lu <mikaovo2000 at gmail.com>
  Date:   2024-11-06 (Wed, 06 Nov 2024)

  Changed paths:
    M mlir/lib/Target/LLVM/CMakeLists.txt

  Log Message:
  -----------
  Fix libnvptxcompiler_static.a absolute path (#115015)

Now when building llvm-solid with `-DMLIR_ENABLE_NVPTXCOMPILER=ON`,
there will be an absolute path (`/path/to/libnvptxcompiler_static.a`) in
MLIRNVVMTarget dependencies (in
`/build/path/install/lib/cmake/mlir/MLIRTargets.cmake`). For example,

```cmake
set_target_properties(MLIRNVVMTarget PROPERTIES
  INTERFACE_LINK_LIBRARIES "MLIRIR;MLIRExecutionEngineUtils;MLIRSupport;MLIRGPUDialect;MLIRTargetLLVM;MLIRNVVMToLLVMIRTranslation;LLVMSupport;/path/to/libnvptxcompiler_static.a"
)
```

If downstream project uses pre-built llvm and depends on MLIRNVVMTarget,
it may fail to build due to the absence of the
`libnvptxcompiler_static.a` absolute path.

After this commit, there will no absolute path in
`/build/path/install/lib/cmake/mlir/MLIRTargets.cmake`

```cmake
set_target_properties(MLIRNVVMTarget PROPERTIES
  INTERFACE_LINK_LIBRARIES "MLIRIR;MLIRExecutionEngineUtils;MLIRSupport;MLIRGPUDialect;MLIRTargetLLVM;MLIRNVVMToLLVMIRTranslation;LLVMSupport;\$<LINK_ONLY:MLIR_NVPTXCOMPILER_LIB>"
)
```

Then downstream project can modify `libnvptxcompiler_static.a` path and
use cmake to build. For example,

```cmake
# find_library(...)

add_library(MLIR_NVPTXCOMPILER_LIB STATIC IMPORTED GLOBAL)
set_property(TARGET MLIR_NVPTXCOMPILER_LIB PROPERTY IMPORTED_LOCATION ${...})  
```



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list