Skip to content
Merged
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
21 changes: 1 addition & 20 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -100,15 +100,6 @@ else()
set(_default_release_disabled_options ON)
endif()

# Let users override which PAL defaults to use.
#
# TODO(dbort): Add another option that lets users point to a specific source
# file; if set, would override the default option.
set(EXECUTORCH_PAL_DEFAULT
"posix"
CACHE STRING
"Which PAL default implementation to use: one of {posix, minimal}"
)

if(NOT EXECUTORCH_ENABLE_LOGGING)
# Avoid pulling in the logging strings, which can be large. Note that this
Expand Down Expand Up @@ -477,17 +468,7 @@ list(FILTER _executorch_core__srcs EXCLUDE REGEX
)

# Add the source file that maps to the requested default PAL implementation.
if(EXECUTORCH_PAL_DEFAULT MATCHES "^(posix|minimal)$")
message(STATUS "executorch: Using PAL default '${EXECUTORCH_PAL_DEFAULT}'")
list(APPEND _executorch_core__srcs
"runtime/platform/default/${EXECUTORCH_PAL_DEFAULT}.cpp"
)
else()
message(
FATAL_ERROR "Unknown EXECUTORCH_PAL_DEFAULT \"${EXECUTORCH_PAL_DEFAULT}\". "
"Expected one of {posix, minimal}."
)
endif()
list(APPEND _executorch_core__srcs ${EXECUTORCH_PAL_DEFAULT_FILE_PATH})

add_library(executorch_core ${_executorch_core__srcs})

Expand Down
30 changes: 28 additions & 2 deletions tools/cmake/preset/default.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,36 @@ endif()

# MARK: - Overridable Options

define_overridable_option(EXECUTORCH_ENABLE_LOGGING "Build with ET_LOG_ENABLED" BOOL ${_is_build_type_debug})
define_overridable_option(EXECUTORCH_BUILD_COREML "Build the Core ML backend" BOOL OFF)
define_overridable_option(
EXECUTORCH_ENABLE_LOGGING
"Build with ET_LOG_ENABLED"
BOOL ${_is_build_type_debug}
)
define_overridable_option(
EXECUTORCH_BUILD_COREML
"Build the Core ML backend"
BOOL OFF
)
define_overridable_option(
EXECUTORCH_FLATBUFFERS_MAX_ALIGNMENT
"Exir lets users set the alignment of tensor data embedded in the flatbuffer, and some users need an alignment larger than the default, which is typically 32."
STRING 1024
)
define_overridable_option(
EXECUTORCH_PAL_DEFAULT
"Which PAL default implementation to use. Choices: posix, minimal"
STRING "posix"
)
define_overridable_option(
EXECUTORCH_PAL_DEFAULT_FILE_PATH
"PAL implementation file path"
STRING "${PROJECT_SOURCE_DIR}/runtime/platform/default/${EXECUTORCH_PAL_DEFAULT}.cpp"
)


# MARK: - Validations
# At this point all the options should be configured with their final value.

if(NOT EXISTS ${EXECUTORCH_PAL_DEFAULT_FILE_PATH})
message(FATAL_ERROR "PAL default implementation (EXECUTORCH_PAL_DEFAULT=${EXECUTORCH_PAL_DEFAULT}) file not found: ${EXECUTORCH_PAL_DEFAULT_FILE_PATH}. Choices: posix, minimal")
endif()
Loading