@@ -91,68 +91,22 @@ set(CMAKE_INSTALL_RPATH_USE_LINK_PATH ON)
91
91
# Instead please use `find_package(executorch REQUIRED)` in the example
92
92
# directory and add a new executable in the example `CMakeLists.txt`.
93
93
94
- # _default_release_disabled_options: default value for options that should be
95
- # disabled in Release mode by default. Users can still manually enable them,
96
- # though.
97
- if (CMAKE_BUILD_TYPE STREQUAL "Release" )
98
- set (_default_release_disabled_options OFF )
99
- else ()
100
- set (_default_release_disabled_options ON )
101
- endif ()
102
-
103
- # Let users override which PAL defaults to use.
104
- #
105
- # TODO(dbort): Add another option that lets users point to a specific source
106
- # file; if set, would override the default option.
107
- set (EXECUTORCH_PAL_DEFAULT
108
- "posix"
109
- CACHE STRING
110
- "Which PAL default implementation to use: one of {posix, minimal}"
111
- )
112
-
113
94
if (NOT EXECUTORCH_ENABLE_LOGGING )
114
95
# Avoid pulling in the logging strings, which can be large. Note that this
115
96
# will set the compiler flag for all targets in this directory, and for all
116
97
# subdirectories included after this point.
117
98
add_definitions (-DET_LOG_ENABLED=0 )
118
99
endif ()
119
100
120
- # Configure log level. Must be one of debug, info, error, fatal.
121
- set (EXECUTORCH_LOG_LEVEL
122
- "Info"
123
- CACHE STRING "Build with the given ET_MIN_LOG_LEVEL value"
124
- )
125
- string (TOLOWER "${EXECUTORCH_LOG_LEVEL} " LOG_LEVEL_LOWER )
126
- if (LOG_LEVEL_LOWER STREQUAL "debug" )
127
- add_definitions (-DET_MIN_LOG_LEVEL=Debug )
128
- elseif (LOG_LEVEL_LOWER STREQUAL "info" )
129
- add_definitions (-DET_MIN_LOG_LEVEL=Info )
130
- elseif (LOG_LEVEL_LOWER STREQUAL "error" )
131
- add_definitions (-DET_MIN_LOG_LEVEL=Error )
132
- elseif (LOG_LEVEL_LOWER STREQUAL "fatal" )
133
- add_definitions (-DET_MIN_LOG_LEVEL=Fatal )
134
- else ()
135
- message (
136
- SEND_ERROR
137
- "Unknown log level \" ${EXECUTORCH_LOG_LEVEL} \" . Expected one of Debug, "
138
- + "Info, Error, or Fatal."
139
- )
140
- endif ()
101
+ add_definitions (-DET_MIN_LOG_LEVEL=${ET_MIN_LOG_LEVEL} )
141
102
142
- option (EXECUTORCH_ENABLE_PROGRAM_VERIFICATION
143
- "Build with ET_ENABLE_PROGRAM_VERIFICATION"
144
- ${_default_release_disabled_options}
145
- )
146
103
if (NOT EXECUTORCH_ENABLE_PROGRAM_VERIFICATION )
147
104
# Avoid pulling in the flatbuffer data verification logic, which can add about
148
105
# 20kB. Note that this will set the compiler flag for all targets in this
149
106
# directory, and for all subdirectories included after this point.
150
107
add_definitions (-DET_ENABLE_PROGRAM_VERIFICATION=0 )
151
108
endif ()
152
109
153
- option (EXECUTORCH_ENABLE_EVENT_TRACER "Build with ET_EVENT_TRACER_ENABLED=ON"
154
- OFF
155
- )
156
110
if (EXECUTORCH_ENABLE_EVENT_TRACER )
157
111
add_definitions (-DET_EVENT_TRACER_ENABLED )
158
112
endif ()
@@ -166,85 +120,14 @@ if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
166
120
set (CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -s" )
167
121
endif ()
168
122
169
- option (OPTIMIZE_SIZE "Build executorch runtime optimizing for binary size" OFF )
170
- if (OPTIMIZE_SIZE )
123
+ if (EXECUTORCH_OPTIMIZE_SIZE )
171
124
# -Os: Optimize for size.
172
125
set (CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -Os" )
173
126
else ()
174
127
# -O2: Moderate opt.
175
128
set (CMAKE_CXX_FLAGS_RELEASE "-O2 ${CMAKE_CXX_FLAGS_RELEASE} " )
176
129
endif ()
177
130
178
- option (EXECUTORCH_BUILD_ANDROID_JNI "Build Android JNI" OFF )
179
-
180
- option (EXECUTORCH_BUILD_ARM_BAREMETAL
181
- "Build the Arm Baremetal flow for Cortex-M and Ethos-U" OFF
182
- )
183
-
184
- option (EXECUTORCH_BUILD_KERNELS_CUSTOM "Build the custom kernels" OFF )
185
-
186
- option (EXECUTORCH_BUILD_KERNELS_CUSTOM_AOT "Build the custom ops lib for AOT"
187
- OFF
188
- )
189
-
190
- option (EXECUTORCH_BUILD_EXTENSION_DATA_LOADER "Build the Data Loader extension"
191
- OFF
192
- )
193
-
194
- option (EXECUTORCH_BUILD_EXTENSION_FLAT_TENSOR "Build the Flat Tensor extension"
195
- OFF
196
- )
197
-
198
- option (EXECUTORCH_BUILD_EXTENSION_LLM "Build the LLM extension"
199
- OFF
200
- )
201
-
202
- option (EXECUTORCH_BUILD_EXTENSION_MODULE "Build the Module extension" OFF )
203
-
204
- option (EXECUTORCH_BUILD_EXTENSION_RUNNER_UTIL "Build the Runner Util extension"
205
- OFF
206
- )
207
-
208
- option (EXECUTORCH_BUILD_EXTENSION_TENSOR "Build the Tensor extension" OFF )
209
-
210
- option (EXECUTORCH_BUILD_EXTENSION_TRAINING "Build the training extension" OFF )
211
-
212
- option (EXECUTORCH_BUILD_MPS "Build the MPS backend" OFF )
213
-
214
- option (EXECUTORCH_BUILD_NEURON "Build the backends/mediatek directory" OFF )
215
-
216
- option (EXECUTORCH_BUILD_OPENVINO "Build the Openvino backend" OFF )
217
-
218
- option (EXECUTORCH_BUILD_PYBIND "Build the Python Bindings" OFF )
219
-
220
- option (EXECUTORCH_BUILD_QNN "Build the Qualcomm backend" OFF )
221
-
222
- option (EXECUTORCH_BUILD_KERNELS_OPTIMIZED "Build the optimized kernels" OFF )
223
-
224
- option (EXECUTORCH_BUILD_KERNELS_QUANTIZED "Build the quantized kernels" OFF )
225
-
226
- option (EXECUTORCH_BUILD_DEVTOOLS "Build the ExecuTorch Developer Tools" )
227
-
228
- option (EXECUTORCH_BUILD_TESTS "Build CMake-based unit tests" OFF )
229
-
230
- option (EXECUTORCH_NNLIB_OPT "Build Cadence backend Hifi nnlib kernel" OFF )
231
-
232
- option (EXECUTORCH_CADENCE_CPU_RUNNER "Build Cadence backend CPU runner" OFF )
233
-
234
- option (EXECUTORCH_BUILD_SIZE_TEST "Build the size test" OFF )
235
-
236
- option (EXECUTORCH_BUILD_XNNPACK "Build the XNNPACK backend" OFF )
237
-
238
- option (EXECUTORCH_BUILD_VULKAN "Build the Vulkan backend" OFF )
239
-
240
- option (BUILD_EXECUTORCH_PORTABLE_OPS "Build portable_ops library" ON )
241
-
242
- option (EXECUTORCH_USE_DL "Use libdl library" ON )
243
-
244
- option (EXECUTORCH_BUILD_CADENCE "Build the Cadence DSP backend" OFF )
245
-
246
- option (EXECUTORCH_BUILD_CORTEX_M "Build the Cortex-M backend" OFF )
247
-
248
131
#
249
132
# pthreadpool: build pthreadpool library. Disable on unsupported platforms
250
133
#
@@ -477,17 +360,7 @@ list(FILTER _executorch_core__srcs EXCLUDE REGEX
477
360
)
478
361
479
362
# Add the source file that maps to the requested default PAL implementation.
480
- if (EXECUTORCH_PAL_DEFAULT MATCHES "^(posix|minimal)$" )
481
- message (STATUS "executorch: Using PAL default '${EXECUTORCH_PAL_DEFAULT} '" )
482
- list (APPEND _executorch_core__srcs
483
- "runtime/platform/default/${EXECUTORCH_PAL_DEFAULT} .cpp"
484
- )
485
- else ()
486
- message (
487
- FATAL_ERROR "Unknown EXECUTORCH_PAL_DEFAULT \" ${EXECUTORCH_PAL_DEFAULT} \" . "
488
- "Expected one of {posix, minimal}."
489
- )
490
- endif ()
363
+ list (APPEND _executorch_core__srcs ${EXECUTORCH_PAL_DEFAULT_FILE_PATH} )
491
364
492
365
add_library (executorch_core ${_executorch_core__srcs} )
493
366
@@ -566,7 +439,9 @@ if(EXECUTORCH_BUILD_KERNELS_OPTIMIZED)
566
439
find_package_torch_headers ()
567
440
endif ()
568
441
569
- if (BUILD_EXECUTORCH_PORTABLE_OPS )
442
+ add_subdirectory (${CMAKE_CURRENT_SOURCE_DIR} /kernels/portable/cpu/util )
443
+
444
+ if (EXECUTORCH_BUILD_PORTABLE_OPS )
570
445
add_subdirectory (${CMAKE_CURRENT_SOURCE_DIR} /kernels/portable )
571
446
endif ()
572
447
@@ -579,7 +454,7 @@ add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/configurations)
579
454
#
580
455
# gflags: Commandline flag host library.
581
456
#
582
- option ( EXECUTORCH_BUILD_GFLAGS "Build the gflags library." ON )
457
+
583
458
if (EXECUTORCH_BUILD_GFLAGS )
584
459
add_subdirectory (third-party/gflags )
585
460
endif ()
@@ -839,11 +714,7 @@ if(EXECUTORCH_BUILD_EXECUTOR_RUNNER)
839
714
endif ()
840
715
841
716
if (EXECUTORCH_ENABLE_EVENT_TRACER )
842
- if (EXECUTORCH_BUILD_DEVTOOLS )
843
- list (APPEND _executor_runner_libs etdump flatccrt )
844
- else ()
845
- message (SEND_ERROR "Use of 'EXECUTORCH_ENABLE_EVENT_TRACER' requires 'EXECUTORCH_BUILD_DEVTOOLS' to be enabled." )
846
- endif ()
717
+ list (APPEND _executor_runner_libs etdump flatccrt )
847
718
endif ()
848
719
849
720
if (EXECUTORCH_BUILD_COREML )
0 commit comments