Skip to content

Move dependent options to default preset #10805

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 13, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 1 addition & 27 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -128,22 +128,6 @@ else()
set(CMAKE_CXX_FLAGS_RELEASE "-O2 ${CMAKE_CXX_FLAGS_RELEASE}")
endif()

#
# pthreadpool: build pthreadpool library. Disable on unsupported platforms
#
cmake_dependent_option(
EXECUTORCH_BUILD_PTHREADPOOL "Build pthreadpool library." ON
"NOT EXECUTORCH_BUILD_ARM_BAREMETAL" OFF
)

#
# cpuinfo: build cpuinfo library. Disable on unsupported platforms
#
cmake_dependent_option(
EXECUTORCH_BUILD_CPUINFO "Build cpuinfo library." ON
"NOT EXECUTORCH_BUILD_ARM_BAREMETAL" OFF
)

add_subdirectory(third-party)

if(EXECUTORCH_BUILD_EXTENSION_TRAINING)
Expand Down Expand Up @@ -475,14 +459,6 @@ install(
)
install(FILES tools/cmake/executorch-config.cmake DESTINATION lib/cmake/ExecuTorch)

#
# executor_runner: Host tool that demonstrates program execution.
#
cmake_dependent_option(
EXECUTORCH_BUILD_EXECUTOR_RUNNER "Build the executor_runner executable" ON
"NOT CMAKE_TOOLCHAIN_IOS" OFF
)

# Add googletest if any test targets should be built
if(BUILD_TESTING)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/third-party/googletest)
Expand Down Expand Up @@ -571,9 +547,7 @@ if(EXECUTORCH_BUILD_EXTENSION_TENSOR)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/extension/tensor)
endif()

if(EXECUTORCH_BUILD_PTHREADPOOL
AND EXECUTORCH_BUILD_CPUINFO
)
if(EXECUTORCH_BUILD_PTHREADPOOL AND EXECUTORCH_BUILD_CPUINFO)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/extension/threadpool)
endif()

Expand Down
11 changes: 0 additions & 11 deletions tools/cmake/Utils.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,6 @@ 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_CPUINFO : ${EXECUTORCH_BUILD_CPUINFO}"
)
message(STATUS " EXECUTORCH_BUILD_EXECUTOR_RUNNER : "
"${EXECUTORCH_BUILD_EXECUTOR_RUNNER}"
)
message(
STATUS
" EXECUTORCH_BUILD_PTHREADPOOL : ${EXECUTORCH_BUILD_PTHREADPOOL}"
)
endfunction()

# This is the funtion to use -Wl, --whole-archive to link static library NB:
Expand Down
38 changes: 38 additions & 0 deletions tools/cmake/preset/default.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,35 @@ define_overridable_option(
BOOL ON
)

if(EXECUTORCH_BUILD_ARM_BAREMETAL)
set(_default_executorch_build_pthreadpool OFF)
set(_default_executorch_build_cpuinfo OFF)
else()
set(_default_executorch_build_pthreadpool ON)
set(_default_executorch_build_cpuinfo ON)
endif()
define_overridable_option(
EXECUTORCH_BUILD_PTHREADPOOL
"Build pthreadpool library."
BOOL ${_default_executorch_build_pthreadpool}
)
define_overridable_option(
EXECUTORCH_BUILD_CPUINFO
"Build cpuinfo library."
BOOL ${_default_executorch_build_cpuinfo}
)

# TODO(jathu): move this to platform specific presets when created
set(_default_executorch_build_executor_runner ON)
if(APPLE AND "${SDK_NAME}" STREQUAL "iphoneos")
set(_default_executorch_build_executor_runner OFF)
endif()
define_overridable_option(
EXECUTORCH_BUILD_EXECUTOR_RUNNER
"Build the executor_runner executable"
BOOL ${_default_executorch_build_executor_runner}
)

# MARK: - Validations
# At this point all the options should be configured with their final value.

Expand Down Expand Up @@ -232,3 +261,12 @@ if(EXECUTORCH_ENABLE_EVENT_TRACER)
message(FATAL_ERROR "Use of 'EXECUTORCH_ENABLE_EVENT_TRACER' requires 'EXECUTORCH_BUILD_DEVTOOLS' to be enabled.")
endif()
endif()


if(EXECUTORCH_BUILD_ARM_BAREMETAL)
if(EXECUTORCH_BUILD_PTHREADPOOL)
message(FATAL_ERROR "Cannot enable both EXECUTORCH_BUILD_PTHREADPOOL and EXECUTORCH_BUILD_ARM_BAREMETAL")
elseif(EXECUTORCH_BUILD_CPUINFO)
message(FATAL_ERROR "Cannot enable both EXECUTORCH_BUILD_CPUINFO and EXECUTORCH_BUILD_ARM_BAREMETAL")
endif()
endif()
Loading