diff options
author | Stephen Neuendorffer <stephen.neuendorffer@xilinx.com> | 2020-10-04 15:17:34 -0700 |
---|---|---|
committer | Stephen Neuendorffer <stephen.neuendorffer@xilinx.com> | 2020-10-04 15:17:34 -0700 |
commit | b0dce6b37f15f487064223f7e3e6a5701a9d7bff (patch) | |
tree | 597330f65e8e560a9b1ef796393759b1d01a6f4b /mlir | |
parent | 37010d4ddf477d3cc60792a92918af5f2f6e42c3 (diff) | |
download | llvm-b0dce6b37f15f487064223f7e3e6a5701a9d7bff.zip llvm-b0dce6b37f15f487064223f7e3e6a5701a9d7bff.tar.gz llvm-b0dce6b37f15f487064223f7e3e6a5701a9d7bff.tar.bz2 |
Revert "[RFC] Factor out repetitive cmake patterns for llvm-style projects"
This reverts commit e9b87f43bde8b5f0d8a79c5884fdce639b12e0ca.
There are issues with macros generating macros without an obvious simple fix
so I'm going to revert this and try something different.
Diffstat (limited to 'mlir')
-rw-r--r-- | mlir/CMakeLists.txt | 31 | ||||
-rw-r--r-- | mlir/cmake/modules/AddMLIR.cmake | 9 | ||||
-rw-r--r-- | mlir/examples/standalone/CMakeLists.txt | 9 | ||||
-rw-r--r-- | mlir/examples/standalone/standalone-opt/CMakeLists.txt | 2 | ||||
-rw-r--r-- | mlir/examples/standalone/standalone-translate/CMakeLists.txt | 2 | ||||
-rw-r--r-- | mlir/examples/toy/CMakeLists.txt | 2 | ||||
-rw-r--r-- | mlir/test/Examples/standalone/test.toy | 1 | ||||
-rw-r--r-- | mlir/tools/mlir-cpu-runner/CMakeLists.txt | 2 | ||||
-rw-r--r-- | mlir/tools/mlir-cuda-runner/CMakeLists.txt | 2 | ||||
-rw-r--r-- | mlir/tools/mlir-linalg-ods-gen/CMakeLists.txt | 2 | ||||
-rw-r--r-- | mlir/tools/mlir-opt/CMakeLists.txt | 2 | ||||
-rw-r--r-- | mlir/tools/mlir-reduce/CMakeLists.txt | 2 | ||||
-rw-r--r-- | mlir/tools/mlir-rocm-runner/CMakeLists.txt | 2 | ||||
-rw-r--r-- | mlir/tools/mlir-translate/CMakeLists.txt | 2 | ||||
-rw-r--r-- | mlir/tools/mlir-vulkan-runner/CMakeLists.txt | 2 |
15 files changed, 28 insertions, 44 deletions
diff --git a/mlir/CMakeLists.txt b/mlir/CMakeLists.txt index ffba3be..50511fd 100644 --- a/mlir/CMakeLists.txt +++ b/mlir/CMakeLists.txt @@ -21,10 +21,6 @@ set_target_properties(mlir-headers PROPERTIES FOLDER "Misc") add_dependencies(mlir-headers mlir-generic-headers) add_custom_target(mlir-doc) -# Get a bunch of LLVM-style default options. -include(LLVMProjectOptions) -add_llvm_project_options(mlir) - # Build the CUDA conversions and run according tests if the NVPTX backend # is available if ("NVPTX" IN_LIST LLVM_TARGETS_TO_BUILD) @@ -48,6 +44,13 @@ set(MLIR_CUDA_RUNNER_ENABLED 0 CACHE BOOL "Enable building the mlir CUDA runner" set(MLIR_ROCM_RUNNER_ENABLED 0 CACHE BOOL "Enable building the mlir ROCm 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}) + +option(MLIR_INCLUDE_INTEGRATION_TESTS + "Generate build targets for the MLIR integration tests.") + #------------------------------------------------------------------------------- # Python Bindings Configuration # Requires: @@ -80,46 +83,42 @@ if(MLIR_BINDINGS_PYTHON_ENABLED) "extension = '${PYTHON_MODULE_EXTENSION}") endif() -# Get a bunch of default targets -include(LLVMProjectTargets) -add_llvm_project_targets(mlir) - include_directories( "include") include_directories( ${MLIR_INCLUDE_DIR}) # Adding tools/mlir-tblgen here as calling add_tablegen sets some variables like # MLIR_TABLEGEN_EXE in PARENT_SCOPE which gets lost if that folder is included # from another directory like tools -if (MLIR_INCLUDE_TOOLS) - add_subdirectory(tools/mlir-tblgen) -endif() +add_subdirectory(tools/mlir-tblgen) add_subdirectory(include/mlir) add_subdirectory(lib) # C API needs all dialects for registration, but should be built before tests. add_subdirectory(lib/CAPI) if (MLIR_INCLUDE_TESTS) + add_definitions(-DMLIR_INCLUDE_TESTS) add_subdirectory(unittests) add_subdirectory(test) endif() if (MLIR_INCLUDE_INTEGRATION_TESTS) + add_definitions(-DMLIR_INCLUDE_INTEGRATION_TESTS) add_subdirectory(integration_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. -if (MLIR_INCLUDE_TOOLS) - add_subdirectory(tools) -endif() +add_subdirectory(tools) -if (MLIR_INCLUDE_EXAMPLES) +if( LLVM_INCLUDE_EXAMPLES ) add_subdirectory(examples) endif() +option(MLIR_INCLUDE_DOCS "Generate build targets for the MLIR docs." + ${LLVM_INCLUDE_DOCS}) if (MLIR_INCLUDE_DOCS) add_subdirectory(docs) endif() -if (NOT MLIR_INSTALL_TOOLCHAIN_ONLY) +if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY) install(DIRECTORY include/mlir include/mlir-c DESTINATION include COMPONENT mlir-headers diff --git a/mlir/cmake/modules/AddMLIR.cmake b/mlir/cmake/modules/AddMLIR.cmake index 56742db..8394c05 100644 --- a/mlir/cmake/modules/AddMLIR.cmake +++ b/mlir/cmake/modules/AddMLIR.cmake @@ -24,12 +24,7 @@ function(add_mlir_interface interface) endfunction() -# Generate Documentation using the mlir-doc rule -# doc_filename: the basename of a .td tablegen file -# command: the tablegen command to run, typically "-gen-op-doc", -# "-gen-pass-doc", or "-gen-dialect-doc" -# output_file: the basename of a .md markdown file to be output -# output_directory: the directory to place the output +# Generate Documentation function(add_mlir_doc doc_filename command output_file output_directory) set(LLVM_TARGET_DEFINITIONS ${doc_filename}.td) tablegen(MLIR ${output_file}.md ${command} "-I${MLIR_MAIN_INCLUDE_DIR}" "-I${MLIR_INCLUDE_DIR}") @@ -45,7 +40,7 @@ function(add_mlir_doc doc_filename command output_file output_directory) endfunction() # Declare an mlir library which can be compiled in libMLIR.so -# In addition to everything that llvm_add_library accepts, this +# In addition to everything that llvm_add_librar accepts, this # also has the following option: # EXCLUDE_FROM_LIBMLIR # Don't include this library in libMLIR.so. This option should be used diff --git a/mlir/examples/standalone/CMakeLists.txt b/mlir/examples/standalone/CMakeLists.txt index 721efae..45dc808 100644 --- a/mlir/examples/standalone/CMakeLists.txt +++ b/mlir/examples/standalone/CMakeLists.txt @@ -31,17 +31,8 @@ list(APPEND CMAKE_MODULE_PATH "${LLVM_CMAKE_DIR}") include(TableGen) include(AddLLVM) include(AddMLIR) - -# Get a bunch of LLVM-style default options. -include(LLVMProjectOptions) -add_llvm_project_options(standalone) - include(HandleLLVMOptions) -# Get a bunch of default targets -include(LLVMProjectTargets) -add_llvm_project_targets(standalone) - include_directories(${LLVM_INCLUDE_DIRS}) include_directories(${MLIR_INCLUDE_DIRS}) include_directories(${PROJECT_SOURCE_DIR}/include) diff --git a/mlir/examples/standalone/standalone-opt/CMakeLists.txt b/mlir/examples/standalone/standalone-opt/CMakeLists.txt index e4b12e0..06bbb47 100644 --- a/mlir/examples/standalone/standalone-opt/CMakeLists.txt +++ b/mlir/examples/standalone/standalone-opt/CMakeLists.txt @@ -6,7 +6,7 @@ set(LIBS MLIROptLib MLIRStandalone ) -add_standalone_tool(standalone-opt standalone-opt.cpp) +add_llvm_executable(standalone-opt standalone-opt.cpp) llvm_update_compile_flags(standalone-opt) target_link_libraries(standalone-opt PRIVATE ${LIBS}) diff --git a/mlir/examples/standalone/standalone-translate/CMakeLists.txt b/mlir/examples/standalone/standalone-translate/CMakeLists.txt index 15aa237..137f794 100644 --- a/mlir/examples/standalone/standalone-translate/CMakeLists.txt +++ b/mlir/examples/standalone/standalone-translate/CMakeLists.txt @@ -5,7 +5,7 @@ set(LLVM_LINK_COMPONENTS get_property(dialect_libs GLOBAL PROPERTY MLIR_DIALECT_LIBS) get_property(translation_libs GLOBAL PROPERTY MLIR_TRANSLATION_LIBS) -add_standalone_tool(standalone-translate +add_llvm_executable(standalone-translate standalone-translate.cpp ) llvm_update_compile_flags(standalone-translate) diff --git a/mlir/examples/toy/CMakeLists.txt b/mlir/examples/toy/CMakeLists.txt index 39f6bd0..56002b1 100644 --- a/mlir/examples/toy/CMakeLists.txt +++ b/mlir/examples/toy/CMakeLists.txt @@ -3,7 +3,7 @@ set_target_properties(Toy PROPERTIES FOLDER Examples) macro(add_toy_chapter name) add_dependencies(Toy ${name}) - add_mlir_example(${name} ${ARGN}) + add_llvm_example(${name} ${ARGN}) endmacro(add_toy_chapter name) add_subdirectory(Ch1) diff --git a/mlir/test/Examples/standalone/test.toy b/mlir/test/Examples/standalone/test.toy index cd183c9..7b4a9c2 100644 --- a/mlir/test/Examples/standalone/test.toy +++ b/mlir/test/Examples/standalone/test.toy @@ -1,5 +1,4 @@ # RUN: %cmake %mlir_src_root/examples/standalone -DCMAKE_CXX_COMPILER=%host_cxx -DCMAKE_C_COMPILER=%host_cc -DMLIR_DIR=%llvm_lib_dir/cmake/mlir ; %cmake --build . --target check-standalone | tee %t | FileCheck %s -# RUN: %cmake --build . --target mlir-doc # CHECK: Passed: 3 # UNSUPPORTED: windows, android diff --git a/mlir/tools/mlir-cpu-runner/CMakeLists.txt b/mlir/tools/mlir-cpu-runner/CMakeLists.txt index 7cd811287..596012c 100644 --- a/mlir/tools/mlir-cpu-runner/CMakeLists.txt +++ b/mlir/tools/mlir-cpu-runner/CMakeLists.txt @@ -4,7 +4,7 @@ set(LLVM_LINK_COMPONENTS nativecodegen ) -add_mlir_tool(mlir-cpu-runner +add_llvm_tool(mlir-cpu-runner mlir-cpu-runner.cpp ) llvm_update_compile_flags(mlir-cpu-runner) diff --git a/mlir/tools/mlir-cuda-runner/CMakeLists.txt b/mlir/tools/mlir-cuda-runner/CMakeLists.txt index 16daca8..5488262d7 100644 --- a/mlir/tools/mlir-cuda-runner/CMakeLists.txt +++ b/mlir/tools/mlir-cuda-runner/CMakeLists.txt @@ -68,7 +68,7 @@ if(MLIR_CUDA_RUNNER_ENABLED) LIST(APPEND targets_to_link "LLVM${t}") ENDFOREACH(t) - add_mlir_tool(mlir-cuda-runner + add_llvm_tool(mlir-cuda-runner mlir-cuda-runner.cpp DEPENDS diff --git a/mlir/tools/mlir-linalg-ods-gen/CMakeLists.txt b/mlir/tools/mlir-linalg-ods-gen/CMakeLists.txt index c27857b..bc9a0c1 100644 --- a/mlir/tools/mlir-linalg-ods-gen/CMakeLists.txt +++ b/mlir/tools/mlir-linalg-ods-gen/CMakeLists.txt @@ -2,7 +2,7 @@ set(LLVM_LINK_COMPONENTS Core Support ) -add_mlir_tool(mlir-linalg-ods-gen +add_llvm_tool(mlir-linalg-ods-gen mlir-linalg-ods-gen.cpp ) llvm_update_compile_flags(mlir-linalg-ods-gen) diff --git a/mlir/tools/mlir-opt/CMakeLists.txt b/mlir/tools/mlir-opt/CMakeLists.txt index 65a328f..483dcfe 100644 --- a/mlir/tools/mlir-opt/CMakeLists.txt +++ b/mlir/tools/mlir-opt/CMakeLists.txt @@ -50,7 +50,7 @@ add_mlir_library(MLIRMlirOptMain ${LIBS} ) -add_mlir_tool(mlir-opt +add_llvm_tool(mlir-opt mlir-opt.cpp DEPENDS diff --git a/mlir/tools/mlir-reduce/CMakeLists.txt b/mlir/tools/mlir-reduce/CMakeLists.txt index 8e4a42f..958c2c9 100644 --- a/mlir/tools/mlir-reduce/CMakeLists.txt +++ b/mlir/tools/mlir-reduce/CMakeLists.txt @@ -43,7 +43,7 @@ set(LIBS MLIRTransformUtils ) -add_mlir_tool(mlir-reduce +add_llvm_tool(mlir-reduce OptReductionPass.cpp Passes/OpReducer.cpp ReductionNode.cpp diff --git a/mlir/tools/mlir-rocm-runner/CMakeLists.txt b/mlir/tools/mlir-rocm-runner/CMakeLists.txt index 3c90bea..2c0791d 100644 --- a/mlir/tools/mlir-rocm-runner/CMakeLists.txt +++ b/mlir/tools/mlir-rocm-runner/CMakeLists.txt @@ -104,7 +104,7 @@ if(MLIR_ROCM_RUNNER_ENABLED) LIST(APPEND targets_to_link "LLVM${t}") ENDFOREACH(t) - add_mlir_tool(mlir-rocm-runner + add_llvm_tool(mlir-rocm-runner mlir-rocm-runner.cpp DEPENDS diff --git a/mlir/tools/mlir-translate/CMakeLists.txt b/mlir/tools/mlir-translate/CMakeLists.txt index cc7ff64..99b98f9 100644 --- a/mlir/tools/mlir-translate/CMakeLists.txt +++ b/mlir/tools/mlir-translate/CMakeLists.txt @@ -5,7 +5,7 @@ set(LLVM_LINK_COMPONENTS get_property(dialect_libs GLOBAL PROPERTY MLIR_DIALECT_LIBS) get_property(translation_libs GLOBAL PROPERTY MLIR_TRANSLATION_LIBS) -add_mlir_tool(mlir-translate +add_llvm_tool(mlir-translate mlir-translate.cpp ) llvm_update_compile_flags(mlir-translate) diff --git a/mlir/tools/mlir-vulkan-runner/CMakeLists.txt b/mlir/tools/mlir-vulkan-runner/CMakeLists.txt index c11b4ef..c7a03259 100644 --- a/mlir/tools/mlir-vulkan-runner/CMakeLists.txt +++ b/mlir/tools/mlir-vulkan-runner/CMakeLists.txt @@ -85,7 +85,7 @@ if (MLIR_VULKAN_RUNNER_ENABLED) LIST(APPEND targets_to_link "LLVM${t}") ENDFOREACH(t) - add_mlir_tool(mlir-vulkan-runner + add_llvm_tool(mlir-vulkan-runner mlir-vulkan-runner.cpp ) add_dependencies(mlir-vulkan-runner vulkan-runtime-wrappers) |