[PATCH] D80022: [MLIR] Use `MLIR_INCLUDE_TESTS` to conditionally compile tests.
Alexandre Rames via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri May 15 11:25:13 PDT 2020
arames created this revision.
Herald added subscribers: llvm-commits, jurahul, Kayjukh, frgossen, grosul1, Joonsoo, stephenneuendorffer, liufengdb, aartbik, lucyrfox, mgester, arpith-jacob, nicolasvasilache, antiagainst, shauheen, jpienaar, rriddle, mehdi_amini, mgorny.
Herald added a project: LLVM.
arames edited the summary of this revision.
arames added reviewers: jpienaar, mehdi_amini.
This is equivalent to what is done for other projects (e.g. clang).
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D80022
Files:
mlir/CMakeLists.txt
mlir/tools/mlir-opt/CMakeLists.txt
mlir/tools/mlir-opt/mlir-opt.cpp
Index: mlir/tools/mlir-opt/mlir-opt.cpp
===================================================================
--- mlir/tools/mlir-opt/mlir-opt.cpp
+++ mlir/tools/mlir-opt/mlir-opt.cpp
@@ -93,6 +93,7 @@
"allow-unregistered-dialect",
cl::desc("Allow operation with no registered dialects"), cl::init(false));
+#ifdef MLIR_INCLUDE_TESTS
void registerTestPasses() {
registerConvertToTargetEnvPass();
registerInliner();
@@ -131,6 +132,7 @@
registerTestVectorToSCFPass();
registerVectorizerTestPass();
}
+#endif
static cl::opt<bool>
showDialects("show-dialects",
@@ -140,7 +142,9 @@
int main(int argc, char **argv) {
registerAllDialects();
registerAllPasses();
+#ifdef MLIR_INCLUDE_TESTS
registerTestPasses();
+#endif
InitLLVM y(argc, argv);
// Register any command line options.
Index: mlir/tools/mlir-opt/CMakeLists.txt
===================================================================
--- mlir/tools/mlir-opt/CMakeLists.txt
+++ mlir/tools/mlir-opt/CMakeLists.txt
@@ -10,24 +10,30 @@
AsmParser
)
+if(MLIR_INCLUDE_TESTS)
+ set(test_libs
+ MLIRAffineTransformsTestPasses
+ MLIRSPIRVTestPasses
+ MLIRTestDialect
+ MLIRTestIR
+ MLIRTestPass
+ MLIRTestTransforms
+ )
+endif()
+
set(LIBS
${dialect_libs}
${conversion_libs}
+ ${test_libs}
MLIRLoopAnalysis
- MLIRAffineTransformsTestPasses
MLIRAnalysis
MLIRDialect
MLIREDSC
MLIROptLib
MLIRParser
MLIRPass
- MLIRSPIRVTestPasses
MLIRTransforms
MLIRTransformUtils
- MLIRTestDialect
- MLIRTestIR
- MLIRTestPass
- MLIRTestTransforms
MLIRSupport
MLIRIR
)
Index: mlir/CMakeLists.txt
===================================================================
--- mlir/CMakeLists.txt
+++ mlir/CMakeLists.txt
@@ -34,6 +34,10 @@
set(MLIR_CUDA_RUNNER_ENABLED 0 CACHE BOOL "Enable building the mlir CUDA runner")
set(MLIR_VULKAN_RUNNER_ENABLED 0 CACHE BOOL "Enable building the mlir Vulkan runner")
+option(MLIR_INCLUDE_TESTS
+ "Generate build targets for the MLIR unit tests."
+ ${LLVM_INCLUDE_TESTS})
+
include_directories( "include")
include_directories( ${MLIR_INCLUDE_DIR})
@@ -44,8 +48,11 @@
add_subdirectory(include/mlir)
add_subdirectory(lib)
-add_subdirectory(unittests)
-add_subdirectory(test)
+if (MLIR_INCLUDE_TESTS)
+ add_definitions(-DMLIR_INCLUDE_TESTS)
+ add_subdirectory(unittests)
+ add_subdirectory(test)
+endif()
# Tools needs to come late to ensure that MLIR_ALL_LIBS is populated.
# Generally things after this point may depend on MLIR_ALL_LIBS or libMLIR.so.
add_subdirectory(tools)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D80022.264289.patch
Type: text/x-patch
Size: 2586 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200515/f7e6325b/attachment.bin>
More information about the llvm-commits
mailing list