Skip to content

[executorch][cmake] Add EXECUTORCH_ENABLE_LOGGING and EXECUTORCH_ENABLE_PROGRAM_VERIFICATION #617

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

Closed
wants to merge 1 commit into from
Closed
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: 22 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -54,15 +54,31 @@ if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Debug)
endif()

# https://cmake.org/cmake/help/latest/command/add_definitions.html Adds
# definitions to the compiler command line for - targets in the current
# directory, before and after this command is invoked - targets in
# sub-directories added after this command is invoked
# _default_release_disabled_targets: default value for options that should be
# disabled in Release mode by default. Users can still manually enable them,
# though.
if(CMAKE_BUILD_TYPE STREQUAL "Release")
# Avoid pulling in the logging strings, which can be large.
set(_default_release_disabled_targets OFF)
else()
set(_default_release_disabled_targets ON)
endif()

option(EXECUTORCH_ENABLE_LOGGING "Build with ET_LOG_ENABLED"
${_default_release_disabled_targets})
if(NOT EXECUTORCH_ENABLE_LOGGING)
# Avoid pulling in the logging strings, which can be large. Note that this
# will set the compiler flag for all targets in this directory, and for all
# subdirectories included after this point.
add_definitions(-DET_LOG_ENABLED=0)
endif()

option(EXECUTORCH_ENABLE_PROGRAM_VERIFICATION
"Build with ET_ENABLE_PROGRAM_VERIFICATION"
${_default_release_disabled_targets})
if(NOT EXECUTORCH_ENABLE_PROGRAM_VERIFICATION)
# Avoid pulling in the flatbuffer data verification logic, which can add about
# 20kB.
# 20kB. Note that this will set the compiler flag for all targets in this
# directory, and for all subdirectories included after this point.
add_definitions(-DET_ENABLE_PROGRAM_VERIFICATION=0)
endif()

Expand Down
11 changes: 6 additions & 5 deletions build/Utils.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ function(executorch_print_configuration_summary)
message(STATUS " BUCK2 : ${BUCK2}")
message(STATUS " PYTHON_EXECUTABLE : ${PYTHON_EXECUTABLE}")
message(STATUS " FLATC_EXECUTABLE : ${FLATC_EXECUTABLE}")
message(
STATUS " EXECUTORCH_ENABLE_LOGGING : ${EXECUTORCH_ENABLE_LOGGING}")
message(STATUS " EXECUTORCH_ENABLE_PROGRAM_VERIFICATION : "
"${EXECUTORCH_ENABLE_PROGRAM_VERIFICATION}")
message(
STATUS " EXECUTORCH_BUILD_HOST_TARGETS : ${EXECUTORCH_BUILD_HOST_TARGETS}")
message(STATUS " EXECUTORCH_BUILD_FLATC : ${EXECUTORCH_BUILD_FLATC}")
Expand All @@ -40,11 +44,8 @@ function(executorch_print_configuration_summary)
)
message(
STATUS " REGISTER_EXAMPLE_CUSTOM_OPS : ${REGISTER_EXAMPLE_CUSTOM_OPS}")
message(
STATUS
" EXECUTORCH_BUILD_EXTENSION_DATA_LOADER : "
"${EXECUTORCH_BUILD_EXTENSION_DATA_LOADER}"
)
message(STATUS " EXECUTORCH_BUILD_EXTENSION_DATA_LOADER : "
"${EXECUTORCH_BUILD_EXTENSION_DATA_LOADER}")
message(STATUS " EXECUTORCH_BUILD_XNNPACK : ${EXECUTORCH_BUILD_XNNPACK}")
endfunction()

Expand Down