blob: d5942cbdc55e5976dce43aa603e68fddead9f8c3 [file] [log] [blame]
Ben Vanik185d30c2019-09-19 14:24:11 -07001# 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
powderluv2e2fc9c2019-10-23 10:09:44 -070015cmake_minimum_required(VERSION 3.12)
Ben Vanik512d2d32019-09-20 13:22:34 -070016cmake_policy(SET CMP0077 NEW)
17set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
Ben Vanik185d30c2019-09-19 14:24:11 -070018
19#-------------------------------------------------------------------------------
20# Project configuration
21#-------------------------------------------------------------------------------
22
23project(iree CXX)
24set(IREE_IDE_FOLDER IREE)
25set_property(GLOBAL PROPERTY USE_FOLDERS ON)
26
Ben Vanik512d2d32019-09-20 13:22:34 -070027option(IREE_ENABLE_DEBUG "Enables debugging of the VM." ON)
28option(IREE_ENABLE_TRACING "Enables WTF tracing." OFF)
29
Ben Vanikcc2aff92019-09-24 10:23:55 -070030option(IREE_BUILD_COMPILER "Builds the IREE compiler." OFF)
Ben Vanik512d2d32019-09-20 13:22:34 -070031option(IREE_BUILD_TESTS "Builds IREE unit tests." ON)
Ben Vanik6b112ef2019-10-03 10:45:14 -070032option(IREE_BUILD_SAMPLES "Builds IREE sample projects." ON)
Ben Vanik512d2d32019-09-20 13:22:34 -070033option(IREE_BUILD_DEBUGGER "Builds the IREE debugger app." OFF)
34
Ben Vanik185d30c2019-09-19 14:24:11 -070035#-------------------------------------------------------------------------------
36# IREE-specific CMake configuration
37#-------------------------------------------------------------------------------
38
39list(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 Vanik512d2d32019-09-20 13:22:34 -070043
44include(iree_macros)
Ben Vanik185d30c2019-09-19 14:24:11 -070045include(iree_copts)
Ben Vanik6b112ef2019-10-03 10:45:14 -070046include(iree_cc_binary)
Ben Vanik185d30c2019-09-19 14:24:11 -070047include(iree_cc_library)
48include(iree_cc_test)
Ben Vanikcc2aff92019-09-24 10:23:55 -070049include(iree_tablegen_library)
Ben Vanik185d30c2019-09-19 14:24:11 -070050
Ben Vanikb8fe0862019-09-25 09:26:03 -070051string(JOIN " " CMAKE_CXX_FLAGS ${IREE_DEFAULT_COPTS})
52
Ben Vanik185d30c2019-09-19 14:24:11 -070053#-------------------------------------------------------------------------------
54# Third-party dependencies
55#-------------------------------------------------------------------------------
56
Ben Vanikcc2aff92019-09-24 10:23:55 -070057list(APPEND CMAKE_MODULE_PATH
58 ${CMAKE_CURRENT_LIST_DIR}/third_party/flatbuffers/CMake/
59)
60
Ben Vanik512d2d32019-09-20 13:22:34 -070061include(external_cc_library)
62include(flatbuffer_cc_library)
63
64add_subdirectory(build_tools/third_party/ruy EXCLUDE_FROM_ALL)
Ben Vanik512d2d32019-09-20 13:22:34 -070065
66add_subdirectory(third_party/abseil-cpp EXCLUDE_FROM_ALL)
67add_subdirectory(third_party/flatbuffers EXCLUDE_FROM_ALL)
Ben Vanik246bc912019-09-19 15:22:12 -070068add_subdirectory(third_party/googletest EXCLUDE_FROM_ALL)
Ben Vanik512d2d32019-09-20 13:22:34 -070069add_subdirectory(third_party/vulkan_headers EXCLUDE_FROM_ALL)
Ben Vanik185d30c2019-09-19 14:24:11 -070070
Ben Vanikcc2aff92019-09-24 10:23:55 -070071if(${IREE_BUILD_COMPILER})
72 add_subdirectory(third_party/llvm-project/llvm EXCLUDE_FROM_ALL)
Ben Vanik6b112ef2019-10-03 10:45:14 -070073 include(external_tablegen_library)
74 add_subdirectory(build_tools/third_party/tensorflow/tensorflow/compiler/mlir/xla EXCLUDE_FROM_ALL)
Ben Vanikcc2aff92019-09-24 10:23:55 -070075endif()
76
Scott Toddf7003552019-11-11 09:14:19 -080077if(${IREE_BUILD_DEBUGGER} OR ${IREE_BUILD_SAMPLES})
78 add_subdirectory(third_party/sdl2 EXCLUDE_FROM_ALL)
79endif()
80
Ben Vanik185d30c2019-09-19 14:24:11 -070081#-------------------------------------------------------------------------------
82# IREE top-level libraries
83#-------------------------------------------------------------------------------
84
85add_subdirectory(iree/base)
Ben Vanik512d2d32019-09-20 13:22:34 -070086add_subdirectory(iree/hal)
Scott Todd9d821b32019-10-16 16:46:47 -070087add_subdirectory(iree/rt)
Ben Vanik512d2d32019-09-20 13:22:34 -070088add_subdirectory(iree/schemas)
Ben Vanik512d2d32019-09-20 13:22:34 -070089add_subdirectory(iree/vm)
Ben Vanikcc2aff92019-09-24 10:23:55 -070090
91if(${IREE_BUILD_COMPILER})
92 add_subdirectory(iree/compiler)
93endif()
Ben Vanik6b112ef2019-10-03 10:45:14 -070094
95add_subdirectory(iree/tools)
96
97if(${IREE_BUILD_SAMPLES})
98 add_subdirectory(iree/samples)
99endif()