[Mlir-commits] [mlir] ada6256 - [mlir][sparse] cleanup of CMake files
Aart Bik
llvmlistbot at llvm.org
Wed Aug 16 13:46:17 PDT 2023
Author: Aart Bik
Date: 2023-08-16T13:46:02-07:00
New Revision: ada62568a816809a1c7a97ae82413897480f6b34
URL: https://github.com/llvm/llvm-project/commit/ada62568a816809a1c7a97ae82413897480f6b34
DIFF: https://github.com/llvm/llvm-project/commit/ada62568a816809a1c7a97ae82413897480f6b34.diff
LOG: [mlir][sparse] cleanup of CMake files
Alphabetical order, less whitespace
removed some verbose comments for readability
(which are preserved in the history if ever needed)
Reviewed By: Peiming
Differential Revision: https://reviews.llvm.org/D158114
Added:
Modified:
mlir/include/mlir/Dialect/SparseTensor/CMakeLists.txt
mlir/include/mlir/Dialect/SparseTensor/Transforms/CMakeLists.txt
mlir/lib/Dialect/SparseTensor/CMakeLists.txt
mlir/lib/Dialect/SparseTensor/IR/CMakeLists.txt
mlir/lib/Dialect/SparseTensor/Pipelines/CMakeLists.txt
Removed:
################################################################################
diff --git a/mlir/include/mlir/Dialect/SparseTensor/CMakeLists.txt b/mlir/include/mlir/Dialect/SparseTensor/CMakeLists.txt
index cb1e9d01821a2c..660deb21479d29 100644
--- a/mlir/include/mlir/Dialect/SparseTensor/CMakeLists.txt
+++ b/mlir/include/mlir/Dialect/SparseTensor/CMakeLists.txt
@@ -1,3 +1,3 @@
add_subdirectory(IR)
-add_subdirectory(Transforms)
add_subdirectory(TransformOps)
+add_subdirectory(Transforms)
diff --git a/mlir/include/mlir/Dialect/SparseTensor/Transforms/CMakeLists.txt b/mlir/include/mlir/Dialect/SparseTensor/Transforms/CMakeLists.txt
index 852b76ad12dde6..a24a94705bc838 100644
--- a/mlir/include/mlir/Dialect/SparseTensor/Transforms/CMakeLists.txt
+++ b/mlir/include/mlir/Dialect/SparseTensor/Transforms/CMakeLists.txt
@@ -3,5 +3,4 @@ mlir_tablegen(Passes.h.inc -gen-pass-decls -name SparseTensor)
mlir_tablegen(Passes.capi.h.inc -gen-pass-capi-header --prefix SparseTensor)
mlir_tablegen(Passes.capi.cpp.inc -gen-pass-capi-impl --prefix SparseTensor)
add_public_tablegen_target(MLIRSparseTensorPassIncGen)
-
add_mlir_doc(Passes SparseTensorPasses ./ -gen-pass-doc)
diff --git a/mlir/lib/Dialect/SparseTensor/CMakeLists.txt b/mlir/lib/Dialect/SparseTensor/CMakeLists.txt
index 451f7325b31454..c229ec184b5ba7 100644
--- a/mlir/lib/Dialect/SparseTensor/CMakeLists.txt
+++ b/mlir/lib/Dialect/SparseTensor/CMakeLists.txt
@@ -1,5 +1,5 @@
add_subdirectory(IR)
-add_subdirectory(Transforms)
-add_subdirectory(TransformOps)
add_subdirectory(Pipelines)
+add_subdirectory(TransformOps)
+add_subdirectory(Transforms)
add_subdirectory(Utils)
diff --git a/mlir/lib/Dialect/SparseTensor/IR/CMakeLists.txt b/mlir/lib/Dialect/SparseTensor/IR/CMakeLists.txt
index 22311aba0b90bb..b22194d45062ac 100644
--- a/mlir/lib/Dialect/SparseTensor/IR/CMakeLists.txt
+++ b/mlir/lib/Dialect/SparseTensor/IR/CMakeLists.txt
@@ -9,46 +9,23 @@
# `INTERFACE` libraries.
set(MLIRSparseTensorEnums_hdrs
mlir/Dialect/SparseTensor/IR/Enums.h)
-# This conditional is copypasta from `add_mlir_library`.
if(MSVC_IDE OR XCODE)
foreach(hdr ${MLIRSparseTensorEnums_hdrs})
set_source_files_properties(${MLIR_MAIN_INCLUDE_DIR}/${hdr}
PROPERTIES HEADER_FILE_ONLY ON)
endforeach()
endif()
-# Older versions of cmake (< 3.19) require INTERFACE libraries to separate
-# the `add_library` and `target_sources` calls.
add_library(MLIRSparseTensorEnums INTERFACE)
-# If we call target_sources naively, then the library won't be
-# installed properly (i.e., so that it can be used by projects outside
-# the llvm-project repo). To correct this, we must use BUILD_INTERFACE /
-# INSTALL_INTERFACE generator expressions to avoid paths being interpreted
-# as absolute; for more details, see <https://stackoverflow.com/a/62465051>.
-# Unfortunately BUILD_INTERFACE and INSTALL_INTERFACE require their file
-# paths to be relative to
diff erent things, hence why we use a foreach loop
-# to iterate over the sources (in case we ever need to have more than one).
foreach(hdr ${MLIRSparseTensorEnums_hdrs})
target_sources(MLIRSparseTensorEnums INTERFACE
$<BUILD_INTERFACE:${MLIR_MAIN_INCLUDE_DIR}/${hdr}>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/${hdr}>)
endforeach()
-# The `add_mlir_library_install` is required for other libraries to
-# depend on this one, but the conditional itself and the phony target
-# are copypasta from `add_mlir_library`. Afaict (wrengr), the version
-# in `add_mlir_library` is to prevent `add_mlir_library_install` from
-# raising additional errors whenever the underlying call to `add_llvm_library`
-# fails. However, since we are using `add_library` directly, I'm not
-# sure if the conditional is helpful/required here or not.
if(TARGET MLIRSparseTensorEnums)
add_mlir_library_install(MLIRSparseTensorEnums)
else()
- # Add empty "phony" target
- add_custom_target(MLIRSparseTensorEnums)
+ add_custom_target(MLIRSparseTensorEnums) # empty "phony" target
endif()
-# Older versions of cmake (i.e., 3.18.0 but not 3.24.2) disallow setting
-# the CXX_STANDARD property for INTERFACE libraries. However, this library
-# must adhere to the same CXX_STANDARD restriction as mlir_c_runner_utils.
-
add_mlir_dialect_library(MLIRSparseTensorDialect
SparseTensorDialect.cpp
diff --git a/mlir/lib/Dialect/SparseTensor/Pipelines/CMakeLists.txt b/mlir/lib/Dialect/SparseTensor/Pipelines/CMakeLists.txt
index 939d7481f1a22d..3cf530abd744e8 100644
--- a/mlir/lib/Dialect/SparseTensor/Pipelines/CMakeLists.txt
+++ b/mlir/lib/Dialect/SparseTensor/Pipelines/CMakeLists.txt
@@ -29,7 +29,7 @@ add_mlir_dialect_library(MLIRSparseTensorPipelines
)
if(MLIR_ENABLE_CUDA_RUNNER)
- # Enable gpu-to-cubin pass.
+ # Enable gpu-to-cubin pass.
target_compile_definitions(obj.MLIRSparseTensorPipelines
PRIVATE
MLIR_GPU_TO_CUBIN_PASS_ENABLE=1
More information about the Mlir-commits
mailing list