diff --git a/CMakeLists.txt b/CMakeLists.txt index c79db032539..bae7732f881 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -128,74 +128,6 @@ else() set(CMAKE_CXX_FLAGS_RELEASE "-O2 ${CMAKE_CXX_FLAGS_RELEASE}") endif() -option(EXECUTORCH_BUILD_ARM_BAREMETAL - "Build the Arm Baremetal flow for Cortex-M and Ethos-U" OFF -) - -option(EXECUTORCH_BUILD_KERNELS_CUSTOM "Build the custom kernels" OFF) - -option(EXECUTORCH_BUILD_KERNELS_CUSTOM_AOT "Build the custom ops lib for AOT" - OFF -) - -option(EXECUTORCH_BUILD_EXTENSION_DATA_LOADER "Build the Data Loader extension" - OFF -) - -option(EXECUTORCH_BUILD_EXTENSION_FLAT_TENSOR "Build the Flat Tensor extension" - OFF -) - -option(EXECUTORCH_BUILD_EXTENSION_LLM "Build the LLM extension" - OFF -) - -option(EXECUTORCH_BUILD_EXTENSION_MODULE "Build the Module extension" OFF) - -option(EXECUTORCH_BUILD_EXTENSION_RUNNER_UTIL "Build the Runner Util extension" - OFF -) - -option(EXECUTORCH_BUILD_EXTENSION_TENSOR "Build the Tensor extension" OFF) - -option(EXECUTORCH_BUILD_EXTENSION_TRAINING "Build the training extension" OFF) - -option(EXECUTORCH_BUILD_MPS "Build the MPS backend" OFF) - -option(EXECUTORCH_BUILD_NEURON "Build the backends/mediatek directory" OFF) - -option(EXECUTORCH_BUILD_OPENVINO "Build the Openvino backend" OFF) - -option(EXECUTORCH_BUILD_PYBIND "Build the Python Bindings" OFF) - -option(EXECUTORCH_BUILD_QNN "Build the Qualcomm backend" OFF) - -option(EXECUTORCH_BUILD_KERNELS_OPTIMIZED "Build the optimized kernels" OFF) - -option(EXECUTORCH_BUILD_KERNELS_QUANTIZED "Build the quantized kernels" OFF) - -option(EXECUTORCH_BUILD_DEVTOOLS "Build the ExecuTorch Developer Tools") - -option(EXECUTORCH_BUILD_TESTS "Build CMake-based unit tests" OFF) - -option(EXECUTORCH_NNLIB_OPT "Build Cadence backend Hifi nnlib kernel" OFF) - -option(EXECUTORCH_CADENCE_CPU_RUNNER "Build Cadence backend CPU runner" OFF) - -option(EXECUTORCH_BUILD_SIZE_TEST "Build the size test" OFF) - -option(EXECUTORCH_BUILD_XNNPACK "Build the XNNPACK backend" OFF) - -option(EXECUTORCH_BUILD_VULKAN "Build the Vulkan backend" OFF) - -option(BUILD_EXECUTORCH_PORTABLE_OPS "Build portable_ops library" ON) - -option(EXECUTORCH_USE_DL "Use libdl library" ON) - -option(EXECUTORCH_BUILD_CADENCE "Build the Cadence DSP backend" OFF) - -option(EXECUTORCH_BUILD_CORTEX_M "Build the Cortex-M backend" OFF) - # # pthreadpool: build pthreadpool library. Disable on unsupported platforms # @@ -509,7 +441,7 @@ endif() add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/kernels/portable/cpu/util) -if(BUILD_EXECUTORCH_PORTABLE_OPS) +if(EXECUTORCH_BUILD_PORTABLE_OPS) add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/kernels/portable) endif() @@ -522,7 +454,7 @@ add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/configurations) # # gflags: Commandline flag host library. # -option(EXECUTORCH_BUILD_GFLAGS "Build the gflags library." ON) + if(EXECUTORCH_BUILD_GFLAGS) add_subdirectory(third-party/gflags) endif() diff --git a/backends/cadence/build_cadence_fusionG3.sh b/backends/cadence/build_cadence_fusionG3.sh index 9e18448a76d..3ced26f8577 100644 --- a/backends/cadence/build_cadence_fusionG3.sh +++ b/backends/cadence/build_cadence_fusionG3.sh @@ -46,7 +46,7 @@ if $STEPWISE_BUILD; then -DEXECUTORCH_ENABLE_LOGGING=ON \ -DEXECUTORCH_ENABLE_PROGRAM_VERIFICATION=ON \ -DEXECUTORCH_USE_DL=OFF \ - -DBUILD_EXECUTORCH_PORTABLE_OPS=ON \ + -DEXECUTORCH_BUILD_PORTABLE_OPS=ON \ -DEXECUTORCH_BUILD_KERNELS_CUSTOM=OFF \ -DPYTHON_EXECUTABLE=python3 \ -DEXECUTORCH_FUSION_G3_OPT=ON \ @@ -72,7 +72,7 @@ else -DEXECUTORCH_ENABLE_LOGGING=ON \ -DEXECUTORCH_ENABLE_PROGRAM_VERIFICATION=ON \ -DEXECUTORCH_USE_DL=OFF \ - -DBUILD_EXECUTORCH_PORTABLE_OPS=ON \ + -DEXECUTORCH_BUILD_PORTABLE_OPS=ON \ -DEXECUTORCH_BUILD_KERNELS_CUSTOM=OFF \ -DPYTHON_EXECUTABLE=python3 \ -DEXECUTORCH_FUSION_G3_OPT=ON \ diff --git a/backends/cadence/build_cadence_hifi4.sh b/backends/cadence/build_cadence_hifi4.sh index 67f3b7ca7f1..70f026fe0b2 100644 --- a/backends/cadence/build_cadence_hifi4.sh +++ b/backends/cadence/build_cadence_hifi4.sh @@ -45,7 +45,7 @@ if $STEPWISE_BUILD; then -DEXECUTORCH_ENABLE_LOGGING=ON \ -DEXECUTORCH_ENABLE_PROGRAM_VERIFICATION=ON \ -DEXECUTORCH_USE_DL=OFF \ - -DBUILD_EXECUTORCH_PORTABLE_OPS=ON \ + -DEXECUTORCH_BUILD_PORTABLE_OPS=ON \ -DEXECUTORCH_BUILD_KERNELS_CUSTOM=OFF \ -DPYTHON_EXECUTABLE=python3 \ -DEXECUTORCH_NNLIB_OPT=ON \ @@ -70,7 +70,7 @@ else -DEXECUTORCH_ENABLE_LOGGING=ON \ -DEXECUTORCH_ENABLE_PROGRAM_VERIFICATION=ON \ -DEXECUTORCH_USE_DL=OFF \ - -DBUILD_EXECUTORCH_PORTABLE_OPS=ON \ + -DEXECUTORCH_BUILD_PORTABLE_OPS=ON \ -DEXECUTORCH_BUILD_KERNELS_CUSTOM=OFF \ -DPYTHON_EXECUTABLE=python3 \ -DEXECUTORCH_NNLIB_OPT=ON \ diff --git a/tools/cmake/Utils.cmake b/tools/cmake/Utils.cmake index 937fb432635..773ee1c578b 100644 --- a/tools/cmake/Utils.cmake +++ b/tools/cmake/Utils.cmake @@ -29,99 +29,17 @@ function(executorch_print_configuration_summary) message(STATUS " CMAKE_TOOLCHAIN_FILE : ${CMAKE_TOOLCHAIN_FILE}") message(STATUS " BUCK2 : ${BUCK2}") message(STATUS " PYTHON_EXECUTABLE : ${PYTHON_EXECUTABLE}") - message(STATUS " EXECUTORCH_BUILD_ARM_BAREMETAL : " - "${EXECUTORCH_BUILD_ARM_BAREMETAL}" - ) - message(STATUS " EXECUTORCH_BUILD_CADENCE : " - "${EXECUTORCH_BUILD_CADENCE}" - ) message( STATUS " EXECUTORCH_BUILD_CPUINFO : ${EXECUTORCH_BUILD_CPUINFO}" ) - message( - STATUS - " EXECUTORCH_BUILD_DEVTOOLS : ${EXECUTORCH_BUILD_DEVTOOLS}" - ) message(STATUS " EXECUTORCH_BUILD_EXECUTOR_RUNNER : " "${EXECUTORCH_BUILD_EXECUTOR_RUNNER}" ) - message(STATUS " EXECUTORCH_BUILD_EXTENSION_DATA_LOADER : " - "${EXECUTORCH_BUILD_EXTENSION_DATA_LOADER}" - ) - message(STATUS " EXECUTORCH_BUILD_EXTENSION_FLAT_TENSOR : " - "${EXECUTORCH_BUILD_EXTENSION_FLAT_TENSOR}" - ) - message(STATUS " EXECUTORCH_BUILD_EXTENSION_LLM : " - "${EXECUTORCH_BUILD_EXTENSION_LLM}" - ) - message(STATUS " EXECUTORCH_BUILD_EXTENSION_MODULE : " - "${EXECUTORCH_BUILD_EXTENSION_MODULE}" - ) - message(STATUS " EXECUTORCH_BUILD_EXTENSION_RUNNER_UTIL : " - "${EXECUTORCH_BUILD_EXTENSION_RUNNER_UTIL}" - ) - message(STATUS " EXECUTORCH_BUILD_EXTENSION_TENSOR : " - "${EXECUTORCH_BUILD_EXTENSION_TENSOR}" - ) - message(STATUS " EXECUTORCH_BUILD_EXTENSION_TRAINING : " - "${EXECUTORCH_BUILD_EXTENSION_TRAINING}" - ) - message( - STATUS - " EXECUTORCH_BUILD_GFLAGS : ${EXECUTORCH_BUILD_GFLAGS}" - ) - message(STATUS " EXECUTORCH_BUILD_KERNELS_CUSTOM : " - "${EXECUTORCH_BUILD_KERNELS_CUSTOM}" - ) - message(STATUS " EXECUTORCH_BUILD_KERNELS_CUSTOM_AOT : " - "${EXECUTORCH_BUILD_KERNELS_CUSTOM_AOT}" - ) - message(STATUS " EXECUTORCH_BUILD_KERNELS_OPTIMIZED : " - "${EXECUTORCH_BUILD_KERNELS_OPTIMIZED}" - ) - message(STATUS " EXECUTORCH_BUILD_KERNELS_QUANTIZED : " - "${EXECUTORCH_BUILD_KERNELS_QUANTIZED}" - ) - message( - STATUS " EXECUTORCH_BUILD_MPS : ${EXECUTORCH_BUILD_MPS}" - ) - message( - STATUS - " EXECUTORCH_BUILD_NEURON : ${EXECUTORCH_BUILD_NEURON}" - ) - message( - STATUS - " EXECUTORCH_BUILD_OPENVINO : ${EXECUTORCH_BUILD_OPENVINO}" - ) message( STATUS " EXECUTORCH_BUILD_PTHREADPOOL : ${EXECUTORCH_BUILD_PTHREADPOOL}" ) - message( - STATUS - " EXECUTORCH_BUILD_PYBIND : ${EXECUTORCH_BUILD_PYBIND}" - ) - message( - STATUS " EXECUTORCH_BUILD_QNN : ${EXECUTORCH_BUILD_QNN}" - ) - message( - STATUS - " EXECUTORCH_BUILD_SIZE_TEST : ${EXECUTORCH_BUILD_SIZE_TEST}" - ) - message( - STATUS - " EXECUTORCH_BUILD_TESTS : ${EXECUTORCH_BUILD_TESTS}" - ) - message( - STATUS - " EXECUTORCH_BUILD_VULKAN : ${EXECUTORCH_BUILD_VULKAN}" - ) - message( - STATUS - " EXECUTORCH_BUILD_XNNPACK : ${EXECUTORCH_BUILD_XNNPACK}" - ) - endfunction() # This is the funtion to use -Wl, --whole-archive to link static library NB: diff --git a/tools/cmake/preset/default.cmake b/tools/cmake/preset/default.cmake index 8020c20667f..1fdd54976aa 100644 --- a/tools/cmake/preset/default.cmake +++ b/tools/cmake/preset/default.cmake @@ -59,6 +59,151 @@ define_overridable_option( "Build executorch runtime optimizing for binary size" BOOL OFF ) +define_overridable_option( + EXECUTORCH_BUILD_ARM_BAREMETAL + "Build the Arm Baremetal flow for Cortex-M and Ethos-U" + BOOL OFF +) +define_overridable_option( + EXECUTORCH_BUILD_KERNELS_CUSTOM + "Build the custom kernels" + BOOL OFF +) +define_overridable_option( + EXECUTORCH_BUILD_KERNELS_CUSTOM_AOT + "Build the custom ops lib for AOT" + BOOL OFF +) +define_overridable_option( + EXECUTORCH_BUILD_EXTENSION_DATA_LOADER + "Build the Data Loader extension" + BOOL OFF +) +define_overridable_option( + EXECUTORCH_BUILD_EXTENSION_FLAT_TENSOR + "Build the Flat Tensor extension" + BOOL OFF +) +define_overridable_option( + EXECUTORCH_BUILD_EXTENSION_LLM + "Build the LLM extension" + BOOL OFF +) +define_overridable_option( + EXECUTORCH_BUILD_EXTENSION_MODULE + "Build the Module extension" + BOOL OFF +) +define_overridable_option( + EXECUTORCH_BUILD_EXTENSION_RUNNER_UTIL + "Build the Runner Util extension" + BOOL OFF +) +define_overridable_option( + EXECUTORCH_BUILD_EXTENSION_TENSOR + "Build the Tensor extension" + BOOL OFF +) +define_overridable_option( + EXECUTORCH_BUILD_EXTENSION_TRAINING + "Build the training extension" + BOOL OFF +) +define_overridable_option( + EXECUTORCH_BUILD_MPS + "Build the MPS backend" + BOOL OFF +) +define_overridable_option( + EXECUTORCH_BUILD_NEURON + "Build the backends/mediatek directory" + BOOL OFF +) +define_overridable_option( + EXECUTORCH_BUILD_OPENVINO + "Build the Openvino backend" + BOOL OFF +) +define_overridable_option( + EXECUTORCH_BUILD_PYBIND + "Build the Python Bindings" + BOOL OFF +) +define_overridable_option( + EXECUTORCH_BUILD_QNN + "Build the Qualcomm backend" + BOOL OFF +) +define_overridable_option( + EXECUTORCH_BUILD_KERNELS_OPTIMIZED + "Build the optimized kernels" + BOOL OFF +) +define_overridable_option( + EXECUTORCH_BUILD_KERNELS_QUANTIZED + "Build the quantized kernels" + BOOL OFF +) +define_overridable_option( + EXECUTORCH_BUILD_DEVTOOLS + "Build the ExecuTorch Developer Tools" + BOOL OFF +) +define_overridable_option( + EXECUTORCH_BUILD_TESTS + "Build CMake-based unit tests" + BOOL OFF +) +define_overridable_option( + EXECUTORCH_NNLIB_OPT + "Build Cadence backend Hifi nnlib kernel" + BOOL OFF +) +define_overridable_option( + EXECUTORCH_CADENCE_CPU_RUNNER + "Build Cadence backend CPU runner" + BOOL OFF +) +define_overridable_option( + EXECUTORCH_BUILD_SIZE_TEST + "Build the size test" + BOOL OFF +) +define_overridable_option( + EXECUTORCH_BUILD_XNNPACK + "Build the XNNPACK backend" + BOOL OFF +) +define_overridable_option( + EXECUTORCH_BUILD_VULKAN + "Build the Vulkan backend" + BOOL OFF +) +define_overridable_option( + EXECUTORCH_BUILD_PORTABLE_OPS + "Build portable_ops library" + BOOL ON +) +define_overridable_option( + EXECUTORCH_USE_DL + "Use libdl library" + BOOL ON +) +define_overridable_option( + EXECUTORCH_BUILD_CADENCE + "Build the Cadence DSP backend" + BOOL OFF +) +define_overridable_option( + EXECUTORCH_BUILD_CORTEX_M + "Build the Cortex-M backend" + BOOL OFF +) +define_overridable_option( + EXECUTORCH_BUILD_GFLAGS + "Build the gflags library." + BOOL ON +) # MARK: - Validations # At this point all the options should be configured with their final value.