Skip to content

Commit b79fe0c

Browse files
committed
move dependent options
1 parent 3434d78 commit b79fe0c

File tree

3 files changed

+39
-38
lines changed

3 files changed

+39
-38
lines changed

CMakeLists.txt

+1-27
Original file line numberDiff line numberDiff line change
@@ -128,22 +128,6 @@ else()
128128
set(CMAKE_CXX_FLAGS_RELEASE "-O2 ${CMAKE_CXX_FLAGS_RELEASE}")
129129
endif()
130130

131-
#
132-
# pthreadpool: build pthreadpool library. Disable on unsupported platforms
133-
#
134-
cmake_dependent_option(
135-
EXECUTORCH_BUILD_PTHREADPOOL "Build pthreadpool library." ON
136-
"NOT EXECUTORCH_BUILD_ARM_BAREMETAL" OFF
137-
)
138-
139-
#
140-
# cpuinfo: build cpuinfo library. Disable on unsupported platforms
141-
#
142-
cmake_dependent_option(
143-
EXECUTORCH_BUILD_CPUINFO "Build cpuinfo library." ON
144-
"NOT EXECUTORCH_BUILD_ARM_BAREMETAL" OFF
145-
)
146-
147131
add_subdirectory(third-party)
148132

149133
if(EXECUTORCH_BUILD_EXTENSION_TRAINING)
@@ -473,14 +457,6 @@ install(
473457
)
474458
install(FILES tools/cmake/executorch-config.cmake DESTINATION lib/cmake/ExecuTorch)
475459

476-
#
477-
# executor_runner: Host tool that demonstrates program execution.
478-
#
479-
cmake_dependent_option(
480-
EXECUTORCH_BUILD_EXECUTOR_RUNNER "Build the executor_runner executable" ON
481-
"NOT CMAKE_TOOLCHAIN_IOS" OFF
482-
)
483-
484460
# Add googletest if any test targets should be built
485461
if(BUILD_TESTING)
486462
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/third-party/googletest)
@@ -569,9 +545,7 @@ if(EXECUTORCH_BUILD_EXTENSION_TENSOR)
569545
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/extension/tensor)
570546
endif()
571547

572-
if(EXECUTORCH_BUILD_PTHREADPOOL
573-
AND EXECUTORCH_BUILD_CPUINFO
574-
)
548+
if(EXECUTORCH_BUILD_PTHREADPOOL AND EXECUTORCH_BUILD_CPUINFO)
575549
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/extension/threadpool)
576550
endif()
577551

tools/cmake/Utils.cmake

-11
Original file line numberDiff line numberDiff line change
@@ -29,17 +29,6 @@ function(executorch_print_configuration_summary)
2929
message(STATUS " CMAKE_TOOLCHAIN_FILE : ${CMAKE_TOOLCHAIN_FILE}")
3030
message(STATUS " BUCK2 : ${BUCK2}")
3131
message(STATUS " PYTHON_EXECUTABLE : ${PYTHON_EXECUTABLE}")
32-
message(
33-
STATUS
34-
" EXECUTORCH_BUILD_CPUINFO : ${EXECUTORCH_BUILD_CPUINFO}"
35-
)
36-
message(STATUS " EXECUTORCH_BUILD_EXECUTOR_RUNNER : "
37-
"${EXECUTORCH_BUILD_EXECUTOR_RUNNER}"
38-
)
39-
message(
40-
STATUS
41-
" EXECUTORCH_BUILD_PTHREADPOOL : ${EXECUTORCH_BUILD_PTHREADPOOL}"
42-
)
4332
endfunction()
4433

4534
# This is the funtion to use -Wl, --whole-archive to link static library NB:

tools/cmake/preset/default.cmake

+38
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,35 @@ define_overridable_option(
205205
BOOL ON
206206
)
207207

208+
if(EXECUTORCH_BUILD_ARM_BAREMETAL)
209+
set(_default_executorch_build_pthreadpool OFF)
210+
set(_default_executorch_build_cpuinfo OFF)
211+
else()
212+
set(_default_executorch_build_pthreadpool ON)
213+
set(_default_executorch_build_cpuinfo ON)
214+
endif()
215+
define_overridable_option(
216+
EXECUTORCH_BUILD_PTHREADPOOL
217+
"Build pthreadpool library."
218+
BOOL ${_default_executorch_build_pthreadpool}
219+
)
220+
define_overridable_option(
221+
EXECUTORCH_BUILD_CPUINFO
222+
"Build cpuinfo library."
223+
BOOL ${_default_executorch_build_cpuinfo}
224+
)
225+
226+
# TODO(jathu): move this to platform specific presets when created
227+
set(_default_executorch_build_executor_runner ON)
228+
if(APPLE AND ${SDK_NAME} STREQUAL "iphoneos")
229+
set(_default_executorch_build_executor_runner OFF)
230+
endif()
231+
define_overridable_option(
232+
EXECUTORCH_BUILD_EXECUTOR_RUNNER
233+
"Build the executor_runner executable"
234+
BOOL ${_default_executorch_build_executor_runner}
235+
)
236+
208237
# MARK: - Validations
209238
# At this point all the options should be configured with their final value.
210239

@@ -232,3 +261,12 @@ if(EXECUTORCH_ENABLE_EVENT_TRACER)
232261
message(FATAL_ERROR "Use of 'EXECUTORCH_ENABLE_EVENT_TRACER' requires 'EXECUTORCH_BUILD_DEVTOOLS' to be enabled.")
233262
endif()
234263
endif()
264+
265+
266+
if(EXECUTORCH_BUILD_ARM_BAREMETAL)
267+
if(EXECUTORCH_BUILD_PTHREADPOOL)
268+
message(FATAL_ERROR "Cannot enable both EXECUTORCH_BUILD_PTHREADPOOL and EXECUTORCH_BUILD_ARM_BAREMETAL")
269+
elseif(EXECUTORCH_BUILD_CPUINFO)
270+
message(FATAL_ERROR "Cannot enable both EXECUTORCH_BUILD_CPUINFO and EXECUTORCH_BUILD_ARM_BAREMETAL")
271+
endif()
272+
endif()

0 commit comments

Comments
 (0)