@@ -91,68 +91,22 @@ set(CMAKE_INSTALL_RPATH_USE_LINK_PATH ON)
9191# Instead please use `find_package(executorch REQUIRED)` in the example
9292# directory and add a new executable in the example `CMakeLists.txt`.
9393
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-
11394if (NOT EXECUTORCH_ENABLE_LOGGING)
11495 # Avoid pulling in the logging strings, which can be large. Note that this
11596 # will set the compiler flag for all targets in this directory, and for all
11697 # subdirectories included after this point.
11798 add_definitions (-DET_LOG_ENABLED=0)
11899endif ()
119100
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} )
141102
142- option (EXECUTORCH_ENABLE_PROGRAM_VERIFICATION
143- "Build with ET_ENABLE_PROGRAM_VERIFICATION"
144- ${_default_release_disabled_options}
145- )
146103if (NOT EXECUTORCH_ENABLE_PROGRAM_VERIFICATION)
147104 # Avoid pulling in the flatbuffer data verification logic, which can add about
148105 # 20kB. Note that this will set the compiler flag for all targets in this
149106 # directory, and for all subdirectories included after this point.
150107 add_definitions (-DET_ENABLE_PROGRAM_VERIFICATION=0)
151108endif ()
152109
153- option (EXECUTORCH_ENABLE_EVENT_TRACER "Build with ET_EVENT_TRACER_ENABLED=ON"
154- OFF
155- )
156110if (EXECUTORCH_ENABLE_EVENT_TRACER)
157111 add_definitions (-DET_EVENT_TRACER_ENABLED)
158112endif ()
@@ -166,85 +120,14 @@ if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
166120 set (CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -s" )
167121endif ()
168122
169- option (OPTIMIZE_SIZE "Build executorch runtime optimizing for binary size" OFF )
170- if (OPTIMIZE_SIZE)
123+ if (EXECUTORCH_OPTIMIZE_SIZE)
171124 # -Os: Optimize for size.
172125 set (CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -Os" )
173126else ()
174127 # -O2: Moderate opt.
175128 set (CMAKE_CXX_FLAGS_RELEASE "-O2 ${CMAKE_CXX_FLAGS_RELEASE} " )
176129endif ()
177130
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-
248131#
249132# pthreadpool: build pthreadpool library. Disable on unsupported platforms
250133#
@@ -477,17 +360,7 @@ list(FILTER _executorch_core__srcs EXCLUDE REGEX
477360)
478361
479362# 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} )
491364
492365add_library (executorch_core ${_executorch_core__srcs} )
493366
@@ -566,7 +439,9 @@ if(EXECUTORCH_BUILD_KERNELS_OPTIMIZED)
566439 find_package_torch_headers()
567440endif ()
568441
569- if (BUILD_EXECUTORCH_PORTABLE_OPS)
442+ add_subdirectory (${CMAKE_CURRENT_SOURCE_DIR} /kernels/portable/cpu/util)
443+
444+ if (EXECUTORCH_BUILD_PORTABLE_OPS)
570445 add_subdirectory (${CMAKE_CURRENT_SOURCE_DIR} /kernels/portable)
571446endif ()
572447
@@ -579,7 +454,7 @@ add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/configurations)
579454#
580455# gflags: Commandline flag host library.
581456#
582- option (EXECUTORCH_BUILD_GFLAGS "Build the gflags library." ON )
457+
583458if (EXECUTORCH_BUILD_GFLAGS)
584459 add_subdirectory (third-party/gflags)
585460endif ()
@@ -839,11 +714,7 @@ if(EXECUTORCH_BUILD_EXECUTOR_RUNNER)
839714 endif ()
840715
841716 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)
847718 endif ()
848719
849720 if (EXECUTORCH_BUILD_COREML)
0 commit comments