forked from iree-org/iree-test-suites
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
128 lines (108 loc) · 3.68 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
# Copyright 2024 The IREE Authors
#
# Licensed under the Apache License v2.0 with LLVM Exceptions.
# See https://llvm.org/LICENSE.txt for license information.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
cmake_minimum_required(VERSION 3.21...3.24)
#-------------------------------------------------------------------------------
# Project configuration
#-------------------------------------------------------------------------------
project(iree-test-suites-matmul C CXX)
set(CMAKE_C_STANDARD 11)
set(CMAKE_CXX_STANDARD 17)
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
# Baseline requirements.
find_package(Python3 COMPONENTS Interpreter REQUIRED)
#-------------------------------------------------------------------------------
# Core project dependency
#-------------------------------------------------------------------------------
option(IREE_USE_LOCAL_REPO "Uses a local repository instead of fetching on-demand." OFF)
set(IREE_LOCAL_REPO_PATH "" CACHE STRING "Local repository path")
set(IREE_PACKAGE_ROOT_DIR "${CMAKE_CURRENT_LIST_DIR}")
set(IREE_PACKAGE_ROOT_PREFIX "iree-test-suites")
set(IREE_BUILD_COMPILER OFF)
set(IREE_BUILD_SAMPLES OFF)
# We should also be able to set -DIREE_BUILD_TESTS=OFF, but this currently
# depends on the core project's CMake functions like iree_native_test and
# iree_bytecode_module.
set(IREE_BUILD_TESTS ON)
if(IREE_USE_LOCAL_REPO)
message(STATUS "Using IREE repo at path '${IREE_LOCAL_REPO_PATH}'")
list(APPEND CMAKE_MESSAGE_INDENT " ")
add_subdirectory(${IREE_LOCAL_REPO_PATH} ${CMAKE_CURRENT_BINARY_DIR}/iree EXCLUDE_FROM_ALL)
list(POP_BACK CMAKE_MESSAGE_INDENT)
else()
message(STATUS "Fetching the core IREE repo (this may take a few minutes)...")
list(APPEND CMAKE_MESSAGE_INDENT " ")
# Note: for log output, set -DFETCHCONTENT_QUIET=OFF,
# see https://gitlab.kitware.com/cmake/cmake/-/issues/18238#note_440475
include(FetchContent)
# TODO(scotttodd): pin to a version from a stable release?
FetchContent_Declare(
iree
GIT_REPOSITORY https://github.com/iree-org/iree.git
GIT_TAG f1319fc3404a2c97bfc76c6ee2268a96954a1b2c # 2024-08-16
GIT_SUBMODULES_RECURSE OFF
GIT_SHALLOW OFF
GIT_PROGRESS ON
USES_TERMINAL_DOWNLOAD ON
EXCLUDE_FROM_ALL
)
FetchContent_MakeAvailable(iree)
FetchContent_GetProperties(iree SOURCE_DIR IREE_SOURCE_DIR)
list(POP_BACK CMAKE_MESSAGE_INDENT)
endif()
#-------------------------------------------------------------------------------
# Test code
#-------------------------------------------------------------------------------
enable_testing(iree-test-suites-matmul)
add_custom_target(iree-test-suites-matmul-deps
COMMENT
"Building matmul test suite deps"
)
iree_cc_library(
NAME
test_utils
HDRS
"test_utils.h"
SRCS
"test_utils.c"
DEPS
iree::base
iree::base::internal
iree::base::internal::cpu
iree::base::internal::flags
iree::base::internal::path
iree::hal
iree::modules::hal
iree::tooling::context_util
iree::tooling::device_util
iree::vm
iree::vm::cc
PUBLIC
)
iree_cc_binary(
NAME
iree-e2e-matmul-test
SRCS
"iree-e2e-matmul-test.cc"
DEPS
::test_utils
iree::base
iree::base::internal
iree::base::internal::cpu
iree::base::internal::flags
iree::base::internal::path
iree::hal
iree::modules::hal
iree::tooling::context_util
iree::tooling::device_util
iree::vm
iree::vm::cc
)
#-------------------------------------------------------------------------------
# Tests
#-------------------------------------------------------------------------------
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR})
include(iree_e2e_generated_runner_test)
add_subdirectory(tests)