Skip to content

Commit 046735b

Browse files
shoumikhinfacebook-github-bot
authored andcommitted
Build Module facade for OSS. (#1495)
Summary: Pull Request resolved: #1495 . Reviewed By: larryliu0820 Differential Revision: D52440934 fbshipit-source-id: e66671f2c08c4cc802da4159b8068f3bfd7071d1
1 parent b12187b commit 046735b

File tree

4 files changed

+54
-1
lines changed

4 files changed

+54
-1
lines changed

CMakeLists.txt

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,13 @@ if(NOT BUCK2)
129129
set(BUCK2 buck2)
130130
endif()
131131

132+
# Build dataloader library
133+
option(EXECUTORCH_BUILD_EXTENSION_RUNNER_MODULE
134+
"Build the extension/runner/module directory" OFF)
135+
if(NOT BUCK2)
136+
set(BUCK2 buck2)
137+
endif()
138+
132139
if(NOT PYTHON_EXECUTABLE)
133140
set(PYTHON_EXECUTABLE python3)
134141
endif()
@@ -311,6 +318,10 @@ if(EXECUTORCH_BUILD_EXTENSION_DATA_LOADER)
311318
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/extension/data_loader)
312319
endif()
313320

321+
if(EXECUTORCH_BUILD_EXTENSION_RUNNER_MODULE)
322+
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/extension/runner/module)
323+
endif()
324+
314325
option(EXECUTORCH_BUILD_XNNPACK "Build the backends/xnnpack directory" OFF)
315326
if(EXECUTORCH_BUILD_XNNPACK)
316327
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/backends/xnnpack)

build/build_apple_frameworks.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ COREML=OFF
2121
MPS=OFF
2222
XNNPACK=OFF
2323
HEADERS_PATH="include"
24-
EXECUTORCH_FRAMEWORK="executorch:libexecutorch.a,libextension_data_loader.a:$HEADERS_PATH"
24+
EXECUTORCH_FRAMEWORK="executorch:libexecutorch.a,libextension_data_loader.a,libextension_runner_module.a:$HEADERS_PATH"
2525
PORTABLE_FRAMEWORK="portable_backend:libportable_kernels.a,libportable_ops_lib.a:"
2626
COREML_FRAMEWORK="coreml_backend:libcoremldelegate.a:"
2727
MPS_FRAMEWORK="mps_backend:libmpsdelegate.a:"
@@ -112,6 +112,7 @@ cmake_build() {
112112
-DPYTHON_EXECUTABLE="$PYTHON" \
113113
-DFLATC_EXECUTABLE="$FLATC" \
114114
-DEXECUTORCH_BUILD_EXTENSION_DATA_LOADER=ON \
115+
-DEXECUTORCH_BUILD_EXTENSION_RUNNER_MODULE=ON \
115116
-DCMAKE_ARCHIVE_OUTPUT_DIRECTORY="$(pwd)" \
116117
-DIOS_DEPLOYMENT_TARGET="$IOS_DEPLOYMENT_TARGET" \
117118
-DEXECUTORCH_BUILD_COREML=$COREML \

build/cmake_deps.toml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,18 @@ deps = [
5252
"executorch",
5353
]
5454

55+
[targets.extension_runner_module]
56+
buck_targets = [
57+
"//extension/runner/module:module",
58+
]
59+
filters = [
60+
".cpp$",
61+
]
62+
deps = [
63+
"executorch",
64+
"extension_data_loader",
65+
]
66+
5567
[targets.portable_kernels]
5668
buck_targets = [
5769
# //kernels/portable:operators would be more appropriate, but buck2 doesn't
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Copyright (c) Meta Platforms, Inc. and affiliates.
2+
# All rights reserved.
3+
#
4+
# This source code is licensed under the BSD-style license found in the
5+
# LICENSE file in the root directory of this source tree.
6+
7+
# Please this file formatted by running:
8+
# ~~~
9+
# cmake-format --first-comment-is-literal=True CMakeLists.txt
10+
# ~~~
11+
12+
cmake_minimum_required(VERSION 3.19)
13+
14+
# Source root directory for executorch.
15+
if(NOT EXECUTORCH_ROOT)
16+
set(EXECUTORCH_ROOT ${CMAKE_CURRENT_SOURCE_DIR}/../..)
17+
endif()
18+
19+
list(TRANSFORM _extension_runner_module__srcs PREPEND "${EXECUTORCH_ROOT}/")
20+
add_library(extension_runner_module ${_extension_runner_module__srcs})
21+
target_include_directories(extension_runner_module PUBLIC ${EXECUTORCH_ROOT}/..)
22+
23+
24+
# Install libraries
25+
install(
26+
TARGETS extension_runner_module
27+
DESTINATION ${CMAKE_BINARY_DIR}/lib
28+
INCLUDES
29+
DESTINATION ${_common_include_directories})

0 commit comments

Comments
 (0)