File tree Expand file tree Collapse file tree 4 files changed +62
-1
lines changed Expand file tree Collapse file tree 4 files changed +62
-1
lines changed Original file line number Diff line number Diff line change @@ -562,6 +562,10 @@ if(EXECUTORCH_BUILD_EXTENSION_LLM)
562562 add_subdirectory (${CMAKE_CURRENT_SOURCE_DIR} /extension/llm/tokenizers)
563563endif ()
564564
565+ if (EXECUTORCH_BUILD_EXTENSION_LLM_APPLE)
566+ add_subdirectory (${CMAKE_CURRENT_SOURCE_DIR} /extension/llm/apple )
567+ endif ()
568+
565569if (EXECUTORCH_BUILD_EXTENSION_LLM_RUNNER)
566570 add_subdirectory (${CMAKE_CURRENT_SOURCE_DIR} /extension/llm/runner)
567571endif ()
Original file line number Diff line number Diff line change 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 -i CMakeLists.txt
10+ # ~~~
11+
12+ cmake_minimum_required (VERSION 3.19)
13+
14+ enable_language (Swift)
15+
16+ # Source root directory for executorch.
17+ if (NOT EXECUTORCH_ROOT)
18+ set (EXECUTORCH_ROOT ${CMAKE_CURRENT_SOURCE_DIR} /../../..)
19+ endif ()
20+
21+ add_library (extension_llm_apple)
22+
23+ file (GLOB OBJC_SOURCES
24+ ExecuTorchLLM/Exported/*.m
25+ ExecuTorchLLM/Exported/*.mm
26+ )
27+
28+ target_sources (extension_llm_apple PRIVATE
29+ ${OBJC_SOURCES}
30+ )
31+
32+ target_include_directories (extension_llm_apple
33+ PUBLIC ExecuTorchLLM/Exported
34+ )
35+
36+ if (NOT TARGET extension_llm_runner)
37+ add_subdirectory (
38+ ${EXECUTORCH_ROOT} /extension/llm/runner
39+ ${CMAKE_CURRENT_BINARY_DIR} /../runner
40+ )
41+ endif ()
42+
43+ find_library (FOUNDATION_FRAMEWORK Foundation)
44+ target_link_libraries (extension_llm_apple
45+ PRIVATE extension_llm_runner ${FOUNDATION_FRAMEWORK}
46+ )
47+
48+ set_source_files_properties (${OBJC_SOURCES} PROPERTIES COMPILE_FLAGS
49+ "-fobjc-arc"
50+ "-fno-exceptions"
51+ "-fno-rtti"
52+ )
Original file line number Diff line number Diff line change @@ -20,7 +20,7 @@ set_overridable_option(EXECUTORCH_BUILD_MPS ON)
2020set_overridable_option(EXECUTORCH_XNNPACK_SHARED_WORKSPACE ON )
2121set_overridable_option(EXECUTORCH_BUILD_EXTENSION_APPLE ON )
2222set_overridable_option(EXECUTORCH_BUILD_EXTENSION_DATA_LOADER ON )
23- set_overridable_option(EXECUTORCH_BUILD_EXTENSION_LLM_RUNNER ON )
23+ set_overridable_option(EXECUTORCH_BUILD_EXTENSION_LLM_APPLE ON )
2424set_overridable_option(EXECUTORCH_BUILD_EXTENSION_MODULE ON )
2525set_overridable_option(EXECUTORCH_BUILD_EXTENSION_FLAT_TENSOR ON )
2626set_overridable_option(EXECUTORCH_BUILD_EXTENSION_TENSOR ON )
Original file line number Diff line number Diff line change @@ -94,6 +94,11 @@ define_overridable_option(
9494 "Build the LLM extension"
9595 BOOL OFF
9696)
97+ define_overridable_option(
98+ EXECUTORCH_BUILD_EXTENSION_LLM_APPLE
99+ "Build the LLM Apple extension"
100+ BOOL OFF
101+ )
97102define_overridable_option(
98103 EXECUTORCH_BUILD_EXTENSION_MODULE
99104 "Build the Module extension"
You can’t perform that action at this time.
0 commit comments