-
Notifications
You must be signed in to change notification settings - Fork 13
/
CMakeLists.txt
162 lines (134 loc) · 5.43 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
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
# SPDX-FileCopyrightText: 2022 The IREE bare-metal Arm 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
#-------------------------------------------------------------------------------
# VMVX sample, float
#-------------------------------------------------------------------------------
if(IREE_HAL_EXECUTABLE_LOADER_VMVX_MODULE)
add_executable(sample_vmvx_sync "")
target_sources(sample_vmvx_sync
PRIVATE
simple_embedding_float.c
device_vmvx_sync.c
)
set(_COMPILE_ARGS)
list(APPEND _COMPILE_ARGS "--output-format=vm-bytecode")
list(APPEND _COMPILE_ARGS "--iree-hal-target-backends=vmvx")
list(APPEND _COMPILE_ARGS "${IREE_SOURCE_DIR}/samples/simple_embedding/simple_embedding_test.mlir")
list(APPEND _COMPILE_ARGS "-o")
list(APPEND _COMPILE_ARGS "simple_embedding_test_bytecode_module_vmvx.vmfb")
add_custom_command(
OUTPUT "simple_embedding_test_bytecode_module_vmvx.vmfb"
COMMAND ${_COMPILE_TOOL_EXECUTABLE} ${_COMPILE_ARGS}
)
set(_GEN_EMBED_ARGS)
list(APPEND _GEN_EMBED_ARGS "--output_header=simple_embedding_test_bytecode_module_vmvx_c.h")
list(APPEND _GEN_EMBED_ARGS "--output_impl=simple_embedding_test_bytecode_module_vmvx_c.c")
list(APPEND _GEN_EMBED_ARGS "--identifier=iree_samples_simple_embedding_test_module_vmvx")
list(APPEND _GEN_EMBED_ARGS "--flatten")
list(APPEND _GEN_EMBED_ARGS "simple_embedding_test_bytecode_module_vmvx.vmfb")
add_custom_command(
OUTPUT
"simple_embedding_test_bytecode_module_vmvx_c.h"
"simple_embedding_test_bytecode_module_vmvx_c.c"
COMMAND iree-c-embed-data ${_GEN_EMBED_ARGS}
DEPENDS iree-c-embed-data simple_embedding_test_bytecode_module_vmvx.vmfb
)
add_library(simple_embedding_test_bytecode_module_vmvx STATIC "")
target_sources(simple_embedding_test_bytecode_module_vmvx
PRIVATE
simple_embedding_test_bytecode_module_vmvx_c.c
simple_embedding_test_bytecode_module_vmvx_c.h
)
set_target_properties(sample_vmvx_sync PROPERTIES OUTPUT_NAME sample_vmvx_sync)
target_include_directories(sample_vmvx_sync
PRIVATE
${CMAKE_CURRENT_BINARY_DIR}
)
target_link_libraries(sample_vmvx_sync
PRIVATE
simple_embedding_test_bytecode_module_vmvx
iree::base
iree::hal
iree::hal::drivers::local_sync::sync_driver
iree::hal::local
iree::hal::local::loaders::vmvx_module_loader
iree::modules::hal
iree::vm
iree::vm::bytecode::module
firmware
utils
write
)
add_binary(sample_vmvx_sync)
add_ihex(sample_vmvx_sync)
endif()
#-------------------------------------------------------------------------------
# DYLIB sample, int32
#-------------------------------------------------------------------------------
if(IREE_HAL_EXECUTABLE_LOADER_EMBEDDED_ELF)
add_executable(sample_embedded_sync "")
target_sources(sample_embedded_sync
PRIVATE
simple_embedding_int.c
device_embedded_sync.c
)
set(_COMPILE_ARGS)
list(APPEND _COMPILE_ARGS "--output-format=vm-bytecode")
list(APPEND _COMPILE_ARGS "--iree-hal-target-backends=llvm-cpu")
list(APPEND _COMPILE_ARGS "--iree-llvmcpu-target-triple=${IREE_LLVM_TARGET_TRIPLE}")
list(APPEND _COMPILE_ARGS "--iree-llvmcpu-target-cpu=${ARM_CPU}")
list(APPEND _COMPILE_ARGS "--iree-llvmcpu-target-float-abi=${IREE_LLVM_TARGET_FLOAT_ABI}")
list(APPEND _COMPILE_ARGS "--iree-llvmcpu-debug-symbols=false")
list(APPEND _COMPILE_ARGS "--iree-vm-bytecode-module-strip-source-map=true")
list(APPEND _COMPILE_ARGS "--iree-vm-emit-polyglot-zip=false")
list(APPEND _COMPILE_ARGS "${CMAKE_CURRENT_SOURCE_DIR}/simple_embedding_int_test.mlir")
list(APPEND _COMPILE_ARGS "-o")
list(APPEND _COMPILE_ARGS "simple_embedding_test_module_dylib_arm_32.vmfb")
add_custom_command(
OUTPUT "simple_embedding_test_module_dylib_arm_32.vmfb"
COMMAND ${_COMPILE_TOOL_EXECUTABLE} ${_COMPILE_ARGS}
)
set(_GEN_EMBED_ARGS)
list(APPEND _GEN_EMBED_ARGS "--output_header=simple_embedding_test_module_dylib_arm_32.h")
list(APPEND _GEN_EMBED_ARGS "--output_impl=simple_embedding_test_module_dylib_arm_32.c")
list(APPEND _GEN_EMBED_ARGS "--identifier=iree_samples_simple_embedding_test_module_dylib_arm_32")
list(APPEND _GEN_EMBED_ARGS "--flatten")
list(APPEND _GEN_EMBED_ARGS "simple_embedding_test_module_dylib_arm_32.vmfb")
add_custom_command(
OUTPUT
"simple_embedding_test_module_dylib_arm_32.h"
"simple_embedding_test_module_dylib_arm_32.c"
COMMAND iree-c-embed-data ${_GEN_EMBED_ARGS}
DEPENDS iree-c-embed-data simple_embedding_test_module_dylib_arm_32.vmfb
)
add_library(simple_embedding_test_bytecode_module_dylib STATIC "")
target_sources(simple_embedding_test_bytecode_module_dylib
PRIVATE
simple_embedding_test_module_dylib_arm_32.c
simple_embedding_test_module_dylib_arm_32.h
)
target_include_directories(sample_embedded_sync
PRIVATE
${CMAKE_CURRENT_BINARY_DIR}
)
target_link_libraries(sample_embedded_sync
PRIVATE
simple_embedding_test_bytecode_module_dylib
iree::base
iree::hal
iree::hal::drivers::local_sync::sync_driver
iree::hal::local
iree::hal::local::loaders::embedded_elf_loader
iree::modules::hal
iree::vm
iree::vm::bytecode::module
firmware
utils
write
)
add_binary(sample_embedded_sync)
add_ihex(sample_embedded_sync)
endif()