xref: /aosp_15_r20/external/executorch/extension/llm/runner/CMakeLists.txt (revision 523fa7a60841cd1ecfb9cc4201f1ca8b03ed023a)
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#
8# Build llm runner lib.
9#
10# ### Editing this file ###
11#
12# This file should be formatted with
13# ~~~
14# cmake-format -i CMakeLists.txt
15# ~~~
16# It should also be cmake-lint clean.
17#
18
19if(NOT EXECUTORCH_ROOT)
20  set(EXECUTORCH_ROOT ${CMAKE_CURRENT_SOURCE_DIR}/../../..)
21endif()
22
23include(${EXECUTORCH_ROOT}/build/Utils.cmake)
24include(${EXECUTORCH_ROOT}/build/Codegen.cmake)
25
26#
27# The `_<target>_srcs` lists are defined by including ${EXECUTORCH_SRCS_FILE}.
28#
29set(EXECUTORCH_SRCS_FILE
30    "${CMAKE_CURRENT_BINARY_DIR}/../../../executorch_srcs.cmake"
31)
32
33extract_sources(${EXECUTORCH_SRCS_FILE})
34
35include(${EXECUTORCH_SRCS_FILE})
36
37# build llm runner library
38list(TRANSFORM _extension_llm_runner__srcs PREPEND "${EXECUTORCH_ROOT}/")
39
40target_include_directories(
41  extension_module INTERFACE ${_common_include_directories}
42)
43
44add_library(extension_llm_runner STATIC ${_extension_llm_runner__srcs})
45
46set(runner_deps executorch extension_data_loader extension_module
47                extension_tensor
48)
49
50target_link_libraries(extension_llm_runner PUBLIC ${runner_deps})
51
52target_include_directories(
53  extension_llm_runner INTERFACE ${_common_include_directories}
54                                 ${EXECUTORCH_ROOT}
55)
56