forked from pytorch/executorch
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
81 lines (68 loc) · 2.33 KB
/
CMakeLists.txt
File metadata and controls
81 lines (68 loc) · 2.33 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
# Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
#
# Simple CMake build system for size_test demo.
#
# ### Editing this file ###
#
# This file should be formatted with
# ~~~
# cmake-format -i CMakeLists.txt
# ~~~
# It should also be cmake-lint clean.
#
cmake_minimum_required(VERSION 3.19)
project(size_test)
set(CMAKE_CXX_STANDARD 17)
set(EXECUTORCH_ROOT ${CMAKE_CURRENT_SOURCE_DIR}/..)
include(${EXECUTORCH_ROOT}/tools/cmake/Codegen.cmake)
include(${EXECUTORCH_ROOT}/tools/cmake/Utils.cmake)
# Find prebuilt executorch library
list(APPEND CMAKE_FIND_ROOT_PATH ${CMAKE_CURRENT_BINARY_DIR}/../)
find_package(executorch CONFIG REQUIRED FIND_ROOT_PATH_BOTH)
# Let files say "include <executorch/path/to/header.h>".
set(_common_include_directories ${EXECUTORCH_ROOT}/..)
#
# The `_<target>_srcs` lists are defined by executorch_load_build_variables.
#
executorch_load_build_variables()
# Since extract_sources.py is not returning absolute values, we need to patch
# the source paths.
list(TRANSFORM _size_test__srcs PREPEND "${EXECUTORCH_ROOT}/")
#
# size_test: minimal binary with no ops and no delegate backend
#
# TODO(larryliu0820): Add EXECUTORCH_BUILD_EXECUTABLES to not build executable
# when we cross compile to ios
add_executable(size_test ${_size_test__srcs})
target_link_libraries(size_test executorch extension_data_loader)
if(NOT CMAKE_BUILD_TYPE STREQUAL "Debug")
target_link_options_gc_sections(size_test)
endif()
#
# size_test_all_ops: binary with portable ops and no delegate backend
#
add_executable(size_test_all_ops ${_size_test__srcs})
target_link_libraries(
size_test_all_ops executorch extension_data_loader portable_ops_lib
portable_kernels
)
if(NOT CMAKE_BUILD_TYPE STREQUAL "Debug")
target_link_options_gc_sections(size_test_all_ops)
endif()
#
# size_test_all_optimized_ops: binary with optimized ops and no delegate backend
#
if(EXECUTORCH_BUILD_KERNELS_OPTIMIZED)
add_executable(size_test_all_optimized_ops ${_size_test__srcs})
target_link_libraries(
size_test_all_optimized_ops executorch extension_data_loader
optimized_native_cpu_ops_lib
)
if(NOT CMAKE_BUILD_TYPE STREQUAL "Debug")
target_link_options_gc_sections(size_test_all_optimized_ops)
endif()
endif()