Ben Vanik | 185d30c | 2019-09-19 14:24:11 -0700 | [diff] [blame] | 1 | # Copyright 2019 Google LLC |
| 2 | # |
| 3 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | # you may not use this file except in compliance with the License. |
| 5 | # You may obtain a copy of the License at |
| 6 | # |
| 7 | # https://www.apache.org/licenses/LICENSE-2.0 |
| 8 | # |
| 9 | # Unless required by applicable law or agreed to in writing, software |
| 10 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | # See the License for the specific language governing permissions and |
| 13 | # limitations under the License. |
| 14 | |
powderluv | 2e2fc9c | 2019-10-23 10:09:44 -0700 | [diff] [blame] | 15 | cmake_minimum_required(VERSION 3.12) |
Ben Vanik | 512d2d3 | 2019-09-20 13:22:34 -0700 | [diff] [blame] | 16 | cmake_policy(SET CMP0077 NEW) |
| 17 | set(CMAKE_EXPORT_COMPILE_COMMANDS ON) |
Ben Vanik | 185d30c | 2019-09-19 14:24:11 -0700 | [diff] [blame] | 18 | |
| 19 | #------------------------------------------------------------------------------- |
| 20 | # Project configuration |
| 21 | #------------------------------------------------------------------------------- |
| 22 | |
| 23 | project(iree CXX) |
| 24 | set(IREE_IDE_FOLDER IREE) |
| 25 | set_property(GLOBAL PROPERTY USE_FOLDERS ON) |
| 26 | |
Ben Vanik | 512d2d3 | 2019-09-20 13:22:34 -0700 | [diff] [blame] | 27 | option(IREE_ENABLE_DEBUG "Enables debugging of the VM." ON) |
| 28 | option(IREE_ENABLE_TRACING "Enables WTF tracing." OFF) |
| 29 | |
Ben Vanik | cc2aff9 | 2019-09-24 10:23:55 -0700 | [diff] [blame] | 30 | option(IREE_BUILD_COMPILER "Builds the IREE compiler." OFF) |
Ben Vanik | 512d2d3 | 2019-09-20 13:22:34 -0700 | [diff] [blame] | 31 | option(IREE_BUILD_TESTS "Builds IREE unit tests." ON) |
Ben Vanik | 6b112ef | 2019-10-03 10:45:14 -0700 | [diff] [blame] | 32 | option(IREE_BUILD_SAMPLES "Builds IREE sample projects." ON) |
Ben Vanik | 512d2d3 | 2019-09-20 13:22:34 -0700 | [diff] [blame] | 33 | option(IREE_BUILD_DEBUGGER "Builds the IREE debugger app." OFF) |
| 34 | |
Ben Vanik | 185d30c | 2019-09-19 14:24:11 -0700 | [diff] [blame] | 35 | #------------------------------------------------------------------------------- |
| 36 | # IREE-specific CMake configuration |
| 37 | #------------------------------------------------------------------------------- |
| 38 | |
| 39 | list(APPEND CMAKE_MODULE_PATH |
| 40 | ${CMAKE_CURRENT_LIST_DIR}/build_tools/cmake/ |
| 41 | ${CMAKE_CURRENT_LIST_DIR}/third_party/abseil-cpp/absl/copts/ |
| 42 | ) |
Ben Vanik | 512d2d3 | 2019-09-20 13:22:34 -0700 | [diff] [blame] | 43 | |
| 44 | include(iree_macros) |
Ben Vanik | 185d30c | 2019-09-19 14:24:11 -0700 | [diff] [blame] | 45 | include(iree_copts) |
Ben Vanik | 6b112ef | 2019-10-03 10:45:14 -0700 | [diff] [blame] | 46 | include(iree_cc_binary) |
Ben Vanik | 185d30c | 2019-09-19 14:24:11 -0700 | [diff] [blame] | 47 | include(iree_cc_library) |
| 48 | include(iree_cc_test) |
Ben Vanik | cc2aff9 | 2019-09-24 10:23:55 -0700 | [diff] [blame] | 49 | include(iree_tablegen_library) |
Ben Vanik | 185d30c | 2019-09-19 14:24:11 -0700 | [diff] [blame] | 50 | |
Ben Vanik | b8fe086 | 2019-09-25 09:26:03 -0700 | [diff] [blame] | 51 | string(JOIN " " CMAKE_CXX_FLAGS ${IREE_DEFAULT_COPTS}) |
| 52 | |
Ben Vanik | 185d30c | 2019-09-19 14:24:11 -0700 | [diff] [blame] | 53 | #------------------------------------------------------------------------------- |
| 54 | # Third-party dependencies |
| 55 | #------------------------------------------------------------------------------- |
| 56 | |
Ben Vanik | cc2aff9 | 2019-09-24 10:23:55 -0700 | [diff] [blame] | 57 | list(APPEND CMAKE_MODULE_PATH |
| 58 | ${CMAKE_CURRENT_LIST_DIR}/third_party/flatbuffers/CMake/ |
| 59 | ) |
| 60 | |
Ben Vanik | 512d2d3 | 2019-09-20 13:22:34 -0700 | [diff] [blame] | 61 | include(external_cc_library) |
| 62 | include(flatbuffer_cc_library) |
| 63 | |
| 64 | add_subdirectory(build_tools/third_party/ruy EXCLUDE_FROM_ALL) |
Ben Vanik | 512d2d3 | 2019-09-20 13:22:34 -0700 | [diff] [blame] | 65 | |
| 66 | add_subdirectory(third_party/abseil-cpp EXCLUDE_FROM_ALL) |
| 67 | add_subdirectory(third_party/flatbuffers EXCLUDE_FROM_ALL) |
Ben Vanik | 246bc91 | 2019-09-19 15:22:12 -0700 | [diff] [blame] | 68 | add_subdirectory(third_party/googletest EXCLUDE_FROM_ALL) |
Ben Vanik | 512d2d3 | 2019-09-20 13:22:34 -0700 | [diff] [blame] | 69 | add_subdirectory(third_party/vulkan_headers EXCLUDE_FROM_ALL) |
Ben Vanik | 185d30c | 2019-09-19 14:24:11 -0700 | [diff] [blame] | 70 | |
Ben Vanik | cc2aff9 | 2019-09-24 10:23:55 -0700 | [diff] [blame] | 71 | if(${IREE_BUILD_COMPILER}) |
| 72 | add_subdirectory(third_party/llvm-project/llvm EXCLUDE_FROM_ALL) |
Ben Vanik | 6b112ef | 2019-10-03 10:45:14 -0700 | [diff] [blame] | 73 | include(external_tablegen_library) |
| 74 | add_subdirectory(build_tools/third_party/tensorflow/tensorflow/compiler/mlir/xla EXCLUDE_FROM_ALL) |
Ben Vanik | cc2aff9 | 2019-09-24 10:23:55 -0700 | [diff] [blame] | 75 | endif() |
| 76 | |
Scott Todd | f700355 | 2019-11-11 09:14:19 -0800 | [diff] [blame^] | 77 | if(${IREE_BUILD_DEBUGGER} OR ${IREE_BUILD_SAMPLES}) |
| 78 | add_subdirectory(third_party/sdl2 EXCLUDE_FROM_ALL) |
| 79 | endif() |
| 80 | |
Ben Vanik | 185d30c | 2019-09-19 14:24:11 -0700 | [diff] [blame] | 81 | #------------------------------------------------------------------------------- |
| 82 | # IREE top-level libraries |
| 83 | #------------------------------------------------------------------------------- |
| 84 | |
| 85 | add_subdirectory(iree/base) |
Ben Vanik | 512d2d3 | 2019-09-20 13:22:34 -0700 | [diff] [blame] | 86 | add_subdirectory(iree/hal) |
Scott Todd | 9d821b3 | 2019-10-16 16:46:47 -0700 | [diff] [blame] | 87 | add_subdirectory(iree/rt) |
Ben Vanik | 512d2d3 | 2019-09-20 13:22:34 -0700 | [diff] [blame] | 88 | add_subdirectory(iree/schemas) |
Ben Vanik | 512d2d3 | 2019-09-20 13:22:34 -0700 | [diff] [blame] | 89 | add_subdirectory(iree/vm) |
Ben Vanik | cc2aff9 | 2019-09-24 10:23:55 -0700 | [diff] [blame] | 90 | |
| 91 | if(${IREE_BUILD_COMPILER}) |
| 92 | add_subdirectory(iree/compiler) |
| 93 | endif() |
Ben Vanik | 6b112ef | 2019-10-03 10:45:14 -0700 | [diff] [blame] | 94 | |
| 95 | add_subdirectory(iree/tools) |
| 96 | |
| 97 | if(${IREE_BUILD_SAMPLES}) |
| 98 | add_subdirectory(iree/samples) |
| 99 | endif() |