@@ -78,8 +78,9 @@ if(NOT EXECUTORCH_ENABLE_LOGGING)
78
78
endif ()
79
79
80
80
# Configure log level. Must be one of debug, info, error, fatal.
81
- set (EXECUTORCH_LOG_LEVEL "Info" CACHE STRING
82
- "Build with the given ET_MIN_LOG_LEVEL value" )
81
+ set (EXECUTORCH_LOG_LEVEL
82
+ "Info"
83
+ CACHE STRING "Build with the given ET_MIN_LOG_LEVEL value" )
83
84
string (TOLOWER "${EXECUTORCH_LOG_LEVEL} " LOG_LEVEL_LOWER )
84
85
if (LOG_LEVEL_LOWER STREQUAL "debug" )
85
86
add_definitions (-DET_MIN_LOG_LEVEL=Debug )
@@ -90,9 +91,10 @@ elseif(LOG_LEVEL_LOWER STREQUAL "error")
90
91
elseif (LOG_LEVEL_LOWER STREQUAL "fatal" )
91
92
add_definitions (-DET_MIN_LOG_LEVEL=Fatal )
92
93
else ()
93
- message (SEND_ERROR
94
- "Unknown log level \" ${EXECUTORCH_LOG_LEVEL} \" . Expected one of Debug, " +
95
- "Info, Error, or Fatal." )
94
+ message (
95
+ SEND_ERROR
96
+ "Unknown log level \" ${EXECUTORCH_LOG_LEVEL} \" . Expected one of Debug, "
97
+ + "Info, Error, or Fatal." )
96
98
endif ()
97
99
98
100
option (EXECUTORCH_ENABLE_PROGRAM_VERIFICATION
@@ -105,16 +107,15 @@ if(NOT EXECUTORCH_ENABLE_PROGRAM_VERIFICATION)
105
107
add_definitions (-DET_ENABLE_PROGRAM_VERIFICATION=0 )
106
108
endif ()
107
109
108
- option (EXECUTORCH_ENABLE_EVENT_TRACER
109
- "Build with ET_EVENT_TRACER_ENABLED=ON"
110
+ option (EXECUTORCH_ENABLE_EVENT_TRACER "Build with ET_EVENT_TRACER_ENABLED=ON"
110
111
OFF )
111
112
if (EXECUTORCH_ENABLE_EVENT_TRACER )
112
113
add_definitions (-DET_EVENT_TRACER_ENABLED )
113
114
endif ()
114
115
115
- # -ffunction-sections -fdata-sections: breaks function and
116
- # data into sections so they can be properly gc'd. -s: strip symbol.
117
- # -fno-exceptions -fno-rtti: disables exceptions and runtime type.
116
+ # -ffunction-sections -fdata-sections: breaks function and data into sections so
117
+ # they can be properly gc'd. -s: strip symbol. -fno-exceptions -fno-rtti:
118
+ # disables exceptions and runtime type.
118
119
set (CMAKE_CXX_FLAGS_RELEASE
119
120
"-ffunction-sections -fdata-sections -fno-exceptions -fno-rtti" )
120
121
if (NOT APPLE )
@@ -132,47 +133,40 @@ endif()
132
133
133
134
set (CMAKE_CXX_FLAGS_DEBUG "-O0 -g" )
134
135
135
- # Option to register quantized ops with quantized kernels. See
136
- # kernels/quantized/CMakeLists.txt
137
- option (REGISTER_QUANTIZED_OPS
138
- "Register quantized ops defined in kernels/quantized/ " OFF )
136
+ option ( EXECUTORCH_BUILD_ANDROID_JNI "Build Android JNI" OFF )
137
+
138
+ option (EXECUTORCH_BUILD_ARM_BAREMETAL
139
+ "Build the Arm Baremetal flow for Cortex-M and Ethos-U " OFF )
139
140
140
- option (EXECUTORCH_BUILD_SIZE_TEST "Whether to build size test " OFF )
141
+ option (EXECUTORCH_BUILD_COREML "Build the Core ML backend " OFF )
141
142
142
- # Build xnn_executor_runner which depends on XNNPACK
143
- option (EXECUTORCH_BUILD_XNNPACK
144
- "Build xnn_executor_runner which depends on XNNPACK" OFF )
143
+ option (EXECUTORCH_BUILD_EXTENSION_AOT_UTIL "Build the AOT Util extension" OFF )
145
144
146
- # Build the vulkan delegate along with the vulkan executor_runner
147
- option (EXECUTORCH_BUILD_VULKAN
148
- "Build the Vulkan delegate and the Vulkan executor_runner" OFF )
145
+ option (EXECUTORCH_BUILD_EXTENSION_DATA_LOADER "Build the Data Loader extension"
146
+ OFF )
149
147
150
- option (EXECUTORCH_BUILD_SDK
151
- "Build the ExecuTorch SDK library and the SDK example runner." )
148
+ option (EXECUTORCH_BUILD_EXTENSION_MODULE "Build the Module extension" OFF )
152
149
153
- # Build mps_executor_runner which depends on MPSGraph framework
154
- option (EXECUTORCH_BUILD_MPS "Build mps_executor_runner which depends on MPS"
150
+ option (EXECUTORCH_BUILD_EXTENSION_RUNNER_UTIL "Build the Runner Util extension"
155
151
OFF )
156
152
157
- # Build dataloader extension library
158
- option (EXECUTORCH_BUILD_EXTENSION_DATA_LOADER
159
- "Build the extension/data_loader directory" OFF )
153
+ option (EXECUTORCH_BUILD_GTESTS "Build googletest based test binaries" OFF )
154
+
155
+ option (EXECUTORCH_BUILD_MPS "Build the MPS backend" OFF )
156
+
157
+ option (EXECUTORCH_BUILD_PYBIND "Build the Python Bindings" OFF )
158
+
159
+ option (EXECUTORCH_BUILD_QNN "Build the Qualcomm backend" OFF )
160
160
161
- # Build module extension library
162
- option (EXECUTORCH_BUILD_EXTENSION_MODULE
163
- "Build the extension/module directory" OFF )
161
+ option (REGISTER_QUANTIZED_OPS "Build the quantized kernels" OFF )
164
162
165
- # Build the runner_util extension library
166
- option (EXECUTORCH_BUILD_EXTENSION_RUNNER_UTIL
167
- "Build the extension/runner_util directory" OFF )
163
+ option (EXECUTORCH_BUILD_SDK "Build the ExecuTorch SDK" )
168
164
169
- # Build test binaries that rely on googletest
170
- option (EXECUTORCH_BUILD_GTESTS
171
- "Build googletest based test binaries" OFF )
165
+ option (EXECUTORCH_BUILD_SIZE_TEST "Build the size test" OFF )
172
166
173
- # Build the AOT util extension library
174
- option ( EXECUTORCH_BUILD_EXTENSION_AOT_UTIL
175
- "Build the extension/aot_util directory " OFF )
167
+ option ( EXECUTORCH_BUILD_XNNPACK " Build the XNNPACK backend" OFF )
168
+
169
+ option ( EXECUTORCH_BUILD_VULKAN "Build the Vulkan backend " OFF )
176
170
177
171
if (NOT BUCK2 )
178
172
set (BUCK2 buck2 )
@@ -258,11 +252,21 @@ if(EXECUTORCH_BUILD_FLATC)
258
252
)
259
253
endif ()
260
254
set (FLATC_EXECUTABLE flatc )
261
- set (FLATBUFFERS_BUILD_FLATC ON CACHE BOOL "" )
262
- set (FLATBUFFERS_BUILD_FLATHASH OFF CACHE BOOL "" )
263
- set (FLATBUFFERS_BUILD_FLATLIB OFF CACHE BOOL "" )
264
- set (FLATBUFFERS_BUILD_TESTS OFF CACHE BOOL "" )
265
- set (FLATBUFFERS_INSTALL OFF CACHE BOOL "" )
255
+ set (FLATBUFFERS_BUILD_FLATC
256
+ ON
257
+ CACHE BOOL "" )
258
+ set (FLATBUFFERS_BUILD_FLATHASH
259
+ OFF
260
+ CACHE BOOL "" )
261
+ set (FLATBUFFERS_BUILD_FLATLIB
262
+ OFF
263
+ CACHE BOOL "" )
264
+ set (FLATBUFFERS_BUILD_TESTS
265
+ OFF
266
+ CACHE BOOL "" )
267
+ set (FLATBUFFERS_INSTALL
268
+ OFF
269
+ CACHE BOOL "" )
266
270
add_subdirectory (third-party/flatbuffers )
267
271
endif ()
268
272
if (NOT FLATC_EXECUTABLE )
@@ -313,6 +317,10 @@ add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/kernels/optimized)
313
317
314
318
add_subdirectory (${CMAKE_CURRENT_SOURCE_DIR} /configurations )
315
319
320
+ if (REGISTER_QUANTIZED_OPS )
321
+ add_subdirectory (${CMAKE_CURRENT_SOURCE_DIR} /kernels/quantized )
322
+ endif ()
323
+
316
324
#
317
325
# gflags: Commandline flag host library.
318
326
#
@@ -343,7 +351,6 @@ if(EXECUTORCH_BUILD_EXECUTOR_RUNNER)
343
351
344
352
# Generate lib to register quantized ops
345
353
if (REGISTER_QUANTIZED_OPS )
346
- add_subdirectory (${CMAKE_CURRENT_SOURCE_DIR} /kernels/quantized )
347
354
list (APPEND _executor_runner_libs quantized_ops_lib )
348
355
endif ()
349
356
@@ -387,7 +394,6 @@ if(EXECUTORCH_BUILD_EXTENSION_AOT_UTIL)
387
394
add_subdirectory (${CMAKE_CURRENT_SOURCE_DIR} /extension/aot_util )
388
395
endif ()
389
396
390
- option (EXECUTORCH_BUILD_XNNPACK "Build the backends/xnnpack directory" OFF )
391
397
if (EXECUTORCH_BUILD_XNNPACK )
392
398
add_subdirectory (${CMAKE_CURRENT_SOURCE_DIR} /backends/xnnpack )
393
399
endif ()
@@ -396,36 +402,28 @@ if(EXECUTORCH_BUILD_VULKAN)
396
402
add_subdirectory (${CMAKE_CURRENT_SOURCE_DIR} /backends/vulkan )
397
403
endif ()
398
404
399
- option (EXECUTORCH_BUILD_ANDROID_JNI "Build Android JNI" OFF )
400
405
if (EXECUTORCH_BUILD_ANDROID_JNI )
401
406
add_subdirectory (${CMAKE_CURRENT_SOURCE_DIR} /examples/models/llama2/runner )
402
407
add_subdirectory (${CMAKE_CURRENT_SOURCE_DIR} /extension/android )
403
408
endif ()
404
409
405
- option (EXECUTORCH_BUILD_QNN "Build the backends/qualcomm directory" OFF )
406
410
if (EXECUTORCH_BUILD_QNN )
407
411
add_subdirectory (${CMAKE_CURRENT_SOURCE_DIR} /backends/qualcomm )
408
412
endif ()
409
413
410
- option (EXECUTORCH_BUILD_ARM_BAREMETAL
411
- "Build the Arm Baremetal flow for Cortex-M and Ethos-U" OFF )
412
414
if (EXECUTORCH_BUILD_ARM_BAREMETAL )
413
415
add_subdirectory (${CMAKE_CURRENT_SOURCE_DIR} /backends/arm )
414
416
endif ()
415
417
416
- option (EXECUTORCH_BUILD_MPS "Build the MPS Backend" OFF )
417
418
if (EXECUTORCH_BUILD_MPS )
418
419
add_subdirectory (${CMAKE_CURRENT_SOURCE_DIR} /backends/apple/mps )
419
420
endif ()
420
421
421
- option (EXECUTORCH_BUILD_COREML "Build the Core ML Backend" OFF )
422
422
if (EXECUTORCH_BUILD_COREML )
423
423
add_subdirectory (${CMAKE_CURRENT_SOURCE_DIR} /backends/apple/coreml )
424
424
endif ()
425
425
426
- option (EXECUTORCH_BUILD_PYBIND "Build the Python Bindings" OFF )
427
426
if (EXECUTORCH_BUILD_PYBIND )
428
-
429
427
add_subdirectory (${CMAKE_CURRENT_SOURCE_DIR} /third-party/pybind11 )
430
428
431
429
if (NOT EXECUTORCH_BUILD_EXTENSION_DATA_LOADER )
@@ -462,8 +460,7 @@ if(EXECUTORCH_BUILD_PYBIND)
462
460
util
463
461
${CMAKE_CURRENT_SOURCE_DIR} /extension/evalue_util/print_evalue.cpp
464
462
${CMAKE_CURRENT_SOURCE_DIR} /extension/aten_util/aten_bridge.cpp
465
- ${CMAKE_CURRENT_SOURCE_DIR} /util/read_file.cpp
466
- )
463
+ ${CMAKE_CURRENT_SOURCE_DIR} /util/read_file.cpp )
467
464
target_include_directories (util PUBLIC ${_common_include_directories}
468
465
${TORCH_INCLUDE_DIRS} )
469
466
target_compile_options (util PUBLIC ${_pybind_compile_options} )
@@ -475,20 +472,19 @@ if(EXECUTORCH_BUILD_PYBIND)
475
472
PUBLIC EXECUTORCH_PYTHON_MODULE_NAME=portable_lib )
476
473
target_include_directories (portable_lib PRIVATE ${TORCH_INCLUDE_DIRS} )
477
474
target_compile_options (portable_lib PUBLIC ${_pybind_compile_options} )
478
- target_link_libraries (portable_lib
479
- PUBLIC
480
- ${TORCH_PYTHON_LIBRARY}
481
- bundled_program
482
- etdump
483
- executorch
484
- extension_data_loader
485
- portable_ops_lib
486
- util
487
- torch
488
- ${PYBIND_LINK_COREML}
489
- ${PYBIND_LINK_MPS}
490
- ${PYBIND_LINK_XNNPACK}
491
- )
475
+ target_link_libraries (
476
+ portable_lib
477
+ PUBLIC ${TORCH_PYTHON_LIBRARY}
478
+ bundled_program
479
+ etdump
480
+ executorch
481
+ extension_data_loader
482
+ portable_ops_lib
483
+ util
484
+ torch
485
+ ${PYBIND_LINK_COREML}
486
+ ${PYBIND_LINK_MPS}
487
+ ${PYBIND_LINK_XNNPACK} )
492
488
493
489
install (TARGETS portable_lib
494
490
LIBRARY DESTINATION executorch/extension/pybindings )
0 commit comments