Skip to content

Commit fbe2c92

Browse files
committed
move dependent options
1 parent 6eebdd1 commit fbe2c92

File tree

2 files changed

+28
-19
lines changed

2 files changed

+28
-19
lines changed

CMakeLists.txt

+1-19
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)
@@ -569,9 +553,7 @@ if(EXECUTORCH_BUILD_EXTENSION_TENSOR)
569553
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/extension/tensor)
570554
endif()
571555

572-
if(EXECUTORCH_BUILD_PTHREADPOOL
573-
AND EXECUTORCH_BUILD_CPUINFO
574-
)
556+
if(EXECUTORCH_BUILD_PTHREADPOOL AND EXECUTORCH_BUILD_CPUINFO)
575557
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/extension/threadpool)
576558
endif()
577559

tools/cmake/preset/default.cmake

+27
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,24 @@ 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+
208226
# MARK: - Validations
209227
# At this point all the options should be configured with their final value.
210228

@@ -232,3 +250,12 @@ if(EXECUTORCH_ENABLE_EVENT_TRACER)
232250
message(FATAL_ERROR "Use of 'EXECUTORCH_ENABLE_EVENT_TRACER' requires 'EXECUTORCH_BUILD_DEVTOOLS' to be enabled.")
233251
endif()
234252
endif()
253+
254+
255+
if(EXECUTORCH_BUILD_ARM_BAREMETAL)
256+
if(EXECUTORCH_BUILD_PTHREADPOOL)
257+
message(FATAL_ERROR "Cannot enable both EXECUTORCH_BUILD_PTHREADPOOL and EXECUTORCH_BUILD_ARM_BAREMETAL")
258+
elseif(EXECUTORCH_BUILD_CPUINFO)
259+
message(FATAL_ERROR "Cannot enable both EXECUTORCH_BUILD_CPUINFO and EXECUTORCH_BUILD_ARM_BAREMETAL")
260+
endif()
261+
endif()

0 commit comments

Comments
 (0)