Skip to content

Commit 6cba4d1

Browse files
digantdesaifacebook-github-bot
authored andcommitted
Enable logging in Release mode
Summary: Sometimes, esp when using the Portable library, Release mode is the only viable option to get a resonable binary size and performance, even to debug stuff. Differential Revision: D49876324 fbshipit-source-id: 501d96304b8e37452a1a58e289d57cfc62ebbcdd
1 parent 7c68ec6 commit 6cba4d1

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

CMakeLists.txt

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,20 @@ endif()
5959
# directory, before and after this command is invoked - targets in
6060
# sub-directories added after this command is invoked
6161
if(CMAKE_BUILD_TYPE STREQUAL "Release")
62+
# To enable logging in Release mode
63+
option(
64+
EXECUTORCH_ENABLE_LOGGING_RELEASE_MODE
65+
"Enable logging in release mode" OFF)
66+
67+
set(_ET_LOG_ENABLE 0)
68+
if (${EXECUTORCH_ENABLE_LOGGING_RELEASE_MODE})
69+
set(_ET_LOG_ENABLE 1)
70+
endif()
71+
6272
# Avoid pulling in the logging strings, which can be large.
63-
add_definitions(-DET_LOG_ENABLED=0)
64-
# Avoid pulling in the flatbuffer data verification logic, which can add about
65-
# 20kB.
73+
add_definitions(-DET_LOG_ENABLED=${_ET_LOG_ENABLE})
74+
# Avoid pulling in the flatbuffer data verification
75+
# logic, which can add about 20kB.
6676
add_definitions(-DET_ENABLE_PROGRAM_VERIFICATION=0)
6777
endif()
6878

0 commit comments

Comments
 (0)