Skip to content

Commit 4a738bd

Browse files
authored
Move EXECUTORCH_ENABLE_EVENT_TRACER to default preset (#10801)
### Summary TSIA ### Test plan ``` $ cmake --preset macos-arm64 && cmake --build cmake-out --parallel ``` ``` $ cmake -DEXECUTORCH_ENABLE_EVENT_TRACER=ON --preset macos-arm64 && cmake --build cmake-out --parallel CMake Error at tools/cmake/preset/default.cmake:82 (message): Use of 'EXECUTORCH_ENABLE_EVENT_TRACER' requires 'EXECUTORCH_BUILD_DEVTOOLS' to be enabled. Call Stack (most recent call first): CMakeLists.txt:53 (include) ``` ``` $ cmake -DEXECUTORCH_ENABLE_EVENT_TRACER=ON -DEXECUTORCH_BUILD_DEVTOOLS=ON --preset macos-arm64 && cmake --build cmake-out --parallel ``` cc @larryliu0820
1 parent df8fc61 commit 4a738bd

File tree

3 files changed

+15
-16
lines changed

3 files changed

+15
-16
lines changed

CMakeLists.txt

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -107,9 +107,6 @@ if(NOT EXECUTORCH_ENABLE_PROGRAM_VERIFICATION)
107107
add_definitions(-DET_ENABLE_PROGRAM_VERIFICATION=0)
108108
endif()
109109

110-
option(EXECUTORCH_ENABLE_EVENT_TRACER "Build with ET_EVENT_TRACER_ENABLED=ON"
111-
OFF
112-
)
113110
if(EXECUTORCH_ENABLE_EVENT_TRACER)
114111
add_definitions(-DET_EVENT_TRACER_ENABLED)
115112
endif()
@@ -788,11 +785,7 @@ if(EXECUTORCH_BUILD_EXECUTOR_RUNNER)
788785
endif()
789786

790787
if(EXECUTORCH_ENABLE_EVENT_TRACER)
791-
if(EXECUTORCH_BUILD_DEVTOOLS)
792-
list(APPEND _executor_runner_libs etdump flatccrt)
793-
else()
794-
message(SEND_ERROR "Use of 'EXECUTORCH_ENABLE_EVENT_TRACER' requires 'EXECUTORCH_BUILD_DEVTOOLS' to be enabled.")
795-
endif()
788+
list(APPEND _executor_runner_libs etdump flatccrt)
796789
endif()
797790

798791
if(EXECUTORCH_BUILD_COREML)

backends/xnnpack/CMakeLists.txt

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -162,14 +162,7 @@ if(NOT CMAKE_TOOLCHAIN_FILE MATCHES ".*(iOS|ios\.toolchain)\.cmake$")
162162
add_executable(xnn_executor_runner ${_xnn_executor_runner__srcs})
163163

164164
if(EXECUTORCH_ENABLE_EVENT_TRACER)
165-
if(EXECUTORCH_BUILD_DEVTOOLS)
166-
list(APPEND xnn_executor_runner_libs etdump)
167-
else()
168-
message(
169-
SEND_ERROR
170-
"Use of 'EXECUTORCH_ENABLE_EVENT_TRACER' requires 'EXECUTORCH_BUILD_DEVTOOLS' to be enabled."
171-
)
172-
endif()
165+
list(APPEND xnn_executor_runner_libs etdump)
173166
endif()
174167

175168
target_link_libraries(xnn_executor_runner gflags ${xnn_executor_runner_libs})

tools/cmake/preset/default.cmake

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,11 @@ define_overridable_option(
4949
"Build with ET_ENABLE_PROGRAM_VERIFICATION"
5050
BOOL ${_is_build_type_debug}
5151
)
52+
define_overridable_option(
53+
EXECUTORCH_ENABLE_EVENT_TRACER
54+
"Build with ET_EVENT_TRACER_ENABLED"
55+
BOOL OFF
56+
)
5257

5358
# MARK: - Validations
5459
# At this point all the options should be configured with their final value.
@@ -57,6 +62,7 @@ if(NOT EXISTS ${EXECUTORCH_PAL_DEFAULT_FILE_PATH})
5762
message(FATAL_ERROR "PAL default implementation (EXECUTORCH_PAL_DEFAULT=${EXECUTORCH_PAL_DEFAULT}) file not found: ${EXECUTORCH_PAL_DEFAULT_FILE_PATH}. Choices: posix, minimal")
5863
endif()
5964

65+
6066
string(TOLOWER "${EXECUTORCH_LOG_LEVEL}" _executorch_log_level_lower)
6167
if(_executorch_log_level_lower STREQUAL "debug")
6268
set(ET_MIN_LOG_LEVEL Debug)
@@ -69,3 +75,10 @@ elseif(_executorch_log_level_lower STREQUAL "fatal")
6975
else()
7076
message(FATAL_ERROR "Unknown EXECUTORCH_LOG_LEVEL '${EXECUTORCH_LOG_LEVEL}'. Choices: Debug, Info, Error, Fatal")
7177
endif()
78+
79+
80+
if(EXECUTORCH_ENABLE_EVENT_TRACER)
81+
if(NOT EXECUTORCH_BUILD_DEVTOOLS)
82+
message(FATAL_ERROR "Use of 'EXECUTORCH_ENABLE_EVENT_TRACER' requires 'EXECUTORCH_BUILD_DEVTOOLS' to be enabled.")
83+
endif()
84+
endif()

0 commit comments

Comments
 (0)