xref: /aosp_15_r20/external/executorch/examples/models/phi-3-mini/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# ### Editing this file ###
8#
9# This file should be formatted with
10# ~~~
11# cmake-format -i CMakeLists.txt
12# ~~~
13# It should also be cmake-lint clean.
14#
15
16cmake_minimum_required(VERSION 3.19)
17project(phi_3_mini_runner)
18
19set(CMAKE_CXX_STANDARD 17)
20set(CMAKE_CXX_STANDARD_REQUIRED True)
21set(CMAKE_BUILD_TYPE Release)
22
23# Set options for executorch build.
24option(EXECUTORCH_BUILD_EXTENSION_DATA_LOADER "" ON)
25option(EXECUTORCH_BUILD_EXTENSION_MODULE "" ON)
26option(EXECUTORCH_BUILD_EXTENSION_TENSOR "" ON)
27option(EXECUTORCH_BUILD_KERNELS_OPTIMIZED "" ON)
28option(EXECUTORCH_BUILD_XNNPACK "" ON)
29
30add_subdirectory(
31  ${CMAKE_CURRENT_SOURCE_DIR}/../../.. ${CMAKE_BINARY_DIR}/../../..
32)
33if(NOT TARGET gflags)
34  add_subdirectory(
35    ${CMAKE_CURRENT_SOURCE_DIR}/../../../third-party/gflags
36    ${CMAKE_BINARY_DIR}/gflags
37  )
38endif()
39
40add_executable(
41  phi_3_mini_runner
42  main.cpp runner.cpp
43  ${CMAKE_CURRENT_SOURCE_DIR}/../../../extension/llm/sampler/sampler.cpp
44  ${CMAKE_CURRENT_SOURCE_DIR}/../../../extension/llm/tokenizer/bpe_tokenizer.cpp
45)
46target_include_directories(
47  phi_3_mini_runner
48  PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../../../third-party/gflags/src
49)
50target_link_libraries(
51  phi_3_mini_runner PRIVATE executorch extension_module_static extension_tensor
52                            optimized_native_cpu_ops_lib xnnpack_backend gflags
53)
54