Skip to content

Commit 4853727

Browse files
huydhnfacebook-github-bot
authored andcommitted
Build static extension_module lib for iOS demo apps (#2038)
Summary: Building the demo apps on iOS is broken after #2022 because it switches the `extension_module` library from a static to a shared one. AFAIK, the latter requires code signing and it's failing on CI with the following error `Signing for "extension_module" requires a development team` I'm not quite sure what would be the best way to address this, but keeping the library as a static one for iOS build seems like an easy workaround. Pull Request resolved: #2038 Reviewed By: larryliu0820 Differential Revision: D54047521 Pulled By: huydhn fbshipit-source-id: e752f29bb1fefd355525a40d586f89659119a625
1 parent f707590 commit 4853727

File tree

3 files changed

+11
-2
lines changed

3 files changed

+11
-2
lines changed

.github/workflows/app-build.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ on:
1414
- build/build_apple_frameworks.sh
1515
- build/test_ios_ci.sh
1616
- examples/demo-apps/**
17+
- extension/module/**
1718
workflow_dispatch:
1819

1920
concurrency:

build/executorch-config.cmake

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,12 @@ foreach(lib ${lib_list})
5353
message("${lib} library is not found.
5454
If needed rebuild with the proper options in CMakeLists.txt")
5555
else()
56-
if("${lib}" STREQUAL "extension_module")
56+
if("${lib}" STREQUAL "extension_module" AND (NOT CMAKE_TOOLCHAIN_IOS))
5757
add_library(${lib} SHARED IMPORTED)
5858
else()
59+
# Building a share library on iOS requires code signing, so it's
60+
# easier to keep all libs as static when CMAKE_TOOLCHAIN_IOS is
61+
# used
5962
add_library(${lib} STATIC IMPORTED)
6063
endif()
6164
set_target_properties(

extension/module/CMakeLists.txt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,12 @@ if(NOT EXECUTORCH_ROOT)
1717
endif()
1818

1919
list(TRANSFORM _extension_module__srcs PREPEND "${EXECUTORCH_ROOT}/")
20-
add_library(extension_module SHARED ${_extension_module__srcs})
20+
if(CMAKE_TOOLCHAIN_IOS)
21+
# Building a share library on iOS requires code signing
22+
add_library(extension_module STATIC ${_extension_module__srcs})
23+
else()
24+
add_library(extension_module SHARED ${_extension_module__srcs})
25+
endif()
2126
target_link_libraries(extension_module PRIVATE executorch)
2227
target_include_directories(extension_module PUBLIC ${EXECUTORCH_ROOT}/..)
2328
target_compile_options(extension_module PUBLIC -Wno-deprecated-declarations

0 commit comments

Comments
 (0)