Skip to content

Build static extension_module lib for iOS demo apps #2038

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 6 commits 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
1 change: 1 addition & 0 deletions .github/workflows/app-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ on:
- build/build_apple_frameworks.sh
- build/test_ios_ci.sh
- examples/demo-apps/**
- extension/module/**
workflow_dispatch:

concurrency:
Expand Down
5 changes: 4 additions & 1 deletion build/executorch-config.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,12 @@ foreach(lib ${lib_list})
message("${lib} library is not found.
If needed rebuild with the proper options in CMakeLists.txt")
else()
if("${lib}" STREQUAL "extension_module")
if("${lib}" STREQUAL "extension_module" AND (NOT CMAKE_TOOLCHAIN_IOS))
add_library(${lib} SHARED IMPORTED)
else()
# Building a share library on iOS requires code signing, so it's
# easier to keep all libs as static when CMAKE_TOOLCHAIN_IOS is
# used
add_library(${lib} STATIC IMPORTED)
endif()
set_target_properties(
Expand Down
7 changes: 6 additions & 1 deletion extension/module/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,12 @@ if(NOT EXECUTORCH_ROOT)
endif()

list(TRANSFORM _extension_module__srcs PREPEND "${EXECUTORCH_ROOT}/")
add_library(extension_module SHARED ${_extension_module__srcs})
if(CMAKE_TOOLCHAIN_IOS)
# Building a share library on iOS requires code signing
add_library(extension_module STATIC ${_extension_module__srcs})
else()
add_library(extension_module SHARED ${_extension_module__srcs})
endif()
target_link_libraries(extension_module PRIVATE executorch)
target_include_directories(extension_module PUBLIC ${EXECUTORCH_ROOT}/..)
target_compile_options(extension_module PUBLIC -Wno-deprecated-declarations
Expand Down