|
4 | 4 | # This source code is licensed under the BSD-style license found in the |
5 | 5 | # LICENSE file in the root directory of this source tree. |
6 | 6 |
|
7 | | - |
8 | 7 | cmake_minimum_required(VERSION 3.15) |
9 | 8 | set(CMAKE_CXX_STANDARD 17) |
10 | 9 | set(CMAKE_CXX_STANDARD_REQUIRED ON) |
11 | 10 |
|
12 | | -get_filename_component(EXECUTORCH_SOURCE_DIR "${CMAKE_CURRENT_LIST_DIR}/../.." ABSOLUTE) |
| 11 | +get_filename_component( |
| 12 | + EXECUTORCH_SOURCE_DIR "${CMAKE_CURRENT_LIST_DIR}/../.." ABSOLUTE |
| 13 | +) |
13 | 14 |
|
14 | 15 | if(NOT DEFINED EXYNOS_AI_LITECORE_ROOT) |
15 | | - message(FATAL_ERROR "Please define EXYNOS_AI_LIRECORE_PATH by adding cmake parameter -DEXYNOS_AI_LITECORE_ROOT=<...>") |
| 16 | + message( |
| 17 | + FATAL_ERROR |
| 18 | + "Please define EXYNOS_AI_LIRECORE_PATH by adding cmake parameter -DEXYNOS_AI_LITECORE_ROOT=<...>" |
| 19 | + ) |
16 | 20 | endif() |
17 | 21 | if(CMAKE_TOOLCHAIN_FILE MATCHES ".*(iOS|ios\.toolchain)\.cmake$") |
18 | | - message(FATAL_ERROR "IOS is not supported on Exynos.") |
| 22 | + message(FATAL_ERROR "IOS is not supported on Exynos.") |
19 | 23 | endif() |
20 | 24 |
|
21 | 25 | if(NOT FLATC_EXECUTABLE) |
22 | | - set(FLATC_EXECUTABLE flatc) |
| 26 | + set(FLATC_EXECUTABLE flatc) |
23 | 27 | endif() |
24 | 28 |
|
25 | 29 | add_compile_options(-Wall -Werror -fPIC) |
26 | 30 | if(CMAKE_BUILD_TYPE STREQUAL "Release") |
27 | | - # strip symbols |
28 | | - add_link_options("-s") |
29 | | - # hide dynamic symbols |
30 | | - set(CMAKE_C_VISIBILITY_PRESET hidden) |
31 | | - set(CMAKE_CXX_VISIBILITY_PRESET hidden) |
32 | | - add_definitions(-DNDEBUG) |
| 31 | + # strip symbols |
| 32 | + add_link_options("-s") |
| 33 | + # hide dynamic symbols |
| 34 | + set(CMAKE_C_VISIBILITY_PRESET hidden) |
| 35 | + set(CMAKE_CXX_VISIBILITY_PRESET hidden) |
| 36 | + add_definitions(-DNDEBUG) |
33 | 37 | endif() |
34 | 38 |
|
35 | 39 | include_directories( |
36 | | - ${EXECUTORCH_SOURCE_DIR}/.. |
37 | | - ${EXECUTORCH_SOURCE_DIR}/runtime/core/portable_type/c10 |
38 | | - ${EXYNOS_AI_LITECORE_ROOT} |
| 40 | + ${EXECUTORCH_SOURCE_DIR}/.. |
| 41 | + ${EXECUTORCH_SOURCE_DIR}/runtime/core/portable_type/c10 |
| 42 | + ${EXYNOS_AI_LITECORE_ROOT} |
39 | 43 | ) |
40 | 44 | add_compile_definitions(C10_USING_CUSTOM_GENERATED_MACROS) |
41 | 45 |
|
42 | 46 | if(${ANDROID}) |
43 | | - find_library(android_log log) |
| 47 | + find_library(android_log log) |
44 | 48 | endif() |
45 | 49 |
|
46 | 50 | # add logging library |
47 | 51 | add_library(enn_logging STATIC) |
48 | 52 |
|
49 | | - |
50 | 53 | if(${CMAKE_SYSTEM_PROCESSOR} MATCHES "x86_64") |
51 | | - add_subdirectory( |
52 | | - ${EXECUTORCH_SOURCE_DIR}/third-party/pybind11 |
53 | | - ${CMAKE_CURRENT_BINARY_DIR}/pybind11 |
54 | | - ) |
55 | | - add_library(PyEnnWrapperAdaptor MODULE) |
56 | | - |
57 | | - find_library(GG_API_LIB NAMES graphgen_api HINTS ${EXYNOS_AI_LITECORE_ROOT}/lib/x86_64-linux) |
58 | | - add_library(graphgen_api SHARED IMPORTED GLOBAL) |
59 | | - set_target_properties(graphgen_api PROPERTIES |
60 | | - INTERFACE_INCLUDE_DIRECTORIES "${EXYNOS_AI_LITECORE_ROOT}/include" |
61 | | - IMPORTED_LOCATION "${GG_API_LIB}" |
62 | | - ) |
63 | | - |
64 | | - |
65 | | - set(_enn_compile_options_schema ${CMAKE_CURRENT_SOURCE_DIR}/serialization/compile_options_def.fbs) |
66 | | - |
67 | | - set(_enn_schema_generate_dir "${CMAKE_BINARY_DIR}/schema/include/executorch/backends/samsung") |
68 | | - # Paths to headers generated from the .fbs files. |
69 | | - string(REGEX REPLACE "serialization/([^/]+)[.]fbs$" "\\1_generated.h" generated_header "${fbs_file}") |
70 | | - set(_enn_schema_output "${_enn_schema_generate_dir}/${generated_header}") |
71 | | - |
72 | | - # Generate the headers from the .fbs files. |
73 | | - add_custom_command( |
74 | | - OUTPUT ${_enn_schema_output} |
75 | | - COMMAND |
76 | | - ${FLATC_EXECUTABLE} --cpp --cpp-std c++11 --scoped-enums -o |
77 | | - "${_enn_schema_generate_dir}" |
78 | | - ${_enn_compile_options_schema} |
79 | | - DEPENDS ${_enn_compile_options_schema} |
80 | | - WORKING_DIRECTORY ${EXECUTORCH_SOURCE_DIR} |
81 | | - COMMENT "Generating enn compile options headers" |
82 | | - VERBATIM |
83 | | - ) |
84 | | - add_custom_target(enn_compile_options_output ALL DEPENDS ${_enn_schema_output}) |
85 | | - |
86 | | - set_target_properties(PyEnnWrapperAdaptor PROPERTIES CXX_VISIBILITY_PRESET hidden) |
87 | | - target_link_libraries(PyEnnWrapperAdaptor PRIVATE |
88 | | - pybind11::module |
89 | | - pybind11::lto |
90 | | - graphgen_api |
91 | | - enn_logging |
92 | | - ) |
93 | | - target_include_directories(PyEnnWrapperAdaptor BEFORE PRIVATE |
94 | | - ${CMAKE_BINARY_DIR}/schema/include |
95 | | - ${EXECUTORCH_SOURCE_DIR}/third-party/flatbuffers/include |
96 | | - ) |
97 | | - add_dependencies(PyEnnWrapperAdaptor enn_compile_options_output) |
98 | | - pybind11_extension(PyEnnWrapperAdaptor) |
99 | | - |
100 | | - # PyGraphWrapperAdaptor |
101 | | - add_library(PyGraphWrapperAdaptor MODULE) |
102 | | - # |
103 | | - find_library(GRAPH_WRAPPER_LIB NAMES graph_wrapper HINTS ${EXYNOS_AI_LITECORE_ROOT}/lib/x86_64-linux) |
104 | | - add_library(graph_wrapper SHARED IMPORTED GLOBAL) |
105 | | - set_target_properties(graph_wrapper PROPERTIES |
106 | | - INTERFACE_INCLUDE_DIRECTORIES "${EXYNOS_AI_LITECORE_ROOT}/include" |
107 | | - IMPORTED_LOCATION "${GRAPH_WRAPPER_LIB}" |
108 | | - ) |
109 | | - set_target_properties(PyGraphWrapperAdaptor PROPERTIES CXX_VISIBILITY_PRESET hidden) |
110 | | - target_link_libraries(PyGraphWrapperAdaptor PRIVATE |
111 | | - pybind11::module |
112 | | - pybind11::lto |
113 | | - graph_wrapper |
114 | | - enn_logging |
115 | | - ) |
116 | | - pybind11_extension(PyGraphWrapperAdaptor) |
117 | | - |
118 | | - add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/aot) |
| 54 | + add_subdirectory( |
| 55 | + ${EXECUTORCH_SOURCE_DIR}/third-party/pybind11 |
| 56 | + ${CMAKE_CURRENT_BINARY_DIR}/pybind11 |
| 57 | + ) |
| 58 | + add_library(PyEnnWrapperAdaptor MODULE) |
| 59 | + |
| 60 | + find_library( |
| 61 | + GG_API_LIB |
| 62 | + NAMES graphgen_api |
| 63 | + HINTS ${EXYNOS_AI_LITECORE_ROOT}/lib/x86_64-linux |
| 64 | + ) |
| 65 | + add_library(graphgen_api SHARED IMPORTED GLOBAL) |
| 66 | + set_target_properties( |
| 67 | + graphgen_api |
| 68 | + PROPERTIES INTERFACE_INCLUDE_DIRECTORIES |
| 69 | + "${EXYNOS_AI_LITECORE_ROOT}/include" IMPORTED_LOCATION |
| 70 | + "${GG_API_LIB}" |
| 71 | + ) |
| 72 | + |
| 73 | + set(_enn_compile_options_schema |
| 74 | + ${CMAKE_CURRENT_SOURCE_DIR}/serialization/compile_options_def.fbs |
| 75 | + ) |
| 76 | + |
| 77 | + set(_enn_schema_generate_dir |
| 78 | + "${CMAKE_BINARY_DIR}/schema/include/executorch/backends/samsung" |
| 79 | + ) |
| 80 | + # Paths to headers generated from the .fbs files. |
| 81 | + string(REGEX REPLACE "serialization/([^/]+)[.]fbs$" "\\1_generated.h" |
| 82 | + generated_header "${fbs_file}" |
| 83 | + ) |
| 84 | + set(_enn_schema_output "${_enn_schema_generate_dir}/${generated_header}") |
| 85 | + |
| 86 | + # Generate the headers from the .fbs files. |
| 87 | + add_custom_command( |
| 88 | + OUTPUT ${_enn_schema_output} |
| 89 | + COMMAND ${FLATC_EXECUTABLE} --cpp --cpp-std c++11 --scoped-enums -o |
| 90 | + "${_enn_schema_generate_dir}" ${_enn_compile_options_schema} |
| 91 | + DEPENDS ${_enn_compile_options_schema} |
| 92 | + WORKING_DIRECTORY ${EXECUTORCH_SOURCE_DIR} |
| 93 | + COMMENT "Generating enn compile options headers" |
| 94 | + VERBATIM |
| 95 | + ) |
| 96 | + add_custom_target( |
| 97 | + enn_compile_options_output ALL DEPENDS ${_enn_schema_output} |
| 98 | + ) |
| 99 | + |
| 100 | + set_target_properties( |
| 101 | + PyEnnWrapperAdaptor PROPERTIES CXX_VISIBILITY_PRESET hidden |
| 102 | + ) |
| 103 | + target_link_libraries( |
| 104 | + PyEnnWrapperAdaptor PRIVATE pybind11::module pybind11::lto graphgen_api |
| 105 | + enn_logging |
| 106 | + ) |
| 107 | + target_include_directories( |
| 108 | + PyEnnWrapperAdaptor BEFORE |
| 109 | + PRIVATE ${CMAKE_BINARY_DIR}/schema/include |
| 110 | + ${EXECUTORCH_SOURCE_DIR}/third-party/flatbuffers/include |
| 111 | + ) |
| 112 | + add_dependencies(PyEnnWrapperAdaptor enn_compile_options_output) |
| 113 | + pybind11_extension(PyEnnWrapperAdaptor) |
| 114 | + |
| 115 | + # PyGraphWrapperAdaptor |
| 116 | + add_library(PyGraphWrapperAdaptor MODULE) |
| 117 | + # |
| 118 | + find_library( |
| 119 | + GRAPH_WRAPPER_LIB |
| 120 | + NAMES graph_wrapper |
| 121 | + HINTS ${EXYNOS_AI_LITECORE_ROOT}/lib/x86_64-linux |
| 122 | + ) |
| 123 | + add_library(graph_wrapper SHARED IMPORTED GLOBAL) |
| 124 | + set_target_properties( |
| 125 | + graph_wrapper |
| 126 | + PROPERTIES INTERFACE_INCLUDE_DIRECTORIES |
| 127 | + "${EXYNOS_AI_LITECORE_ROOT}/include" IMPORTED_LOCATION |
| 128 | + "${GRAPH_WRAPPER_LIB}" |
| 129 | + ) |
| 130 | + set_target_properties( |
| 131 | + PyGraphWrapperAdaptor PROPERTIES CXX_VISIBILITY_PRESET hidden |
| 132 | + ) |
| 133 | + target_link_libraries( |
| 134 | + PyGraphWrapperAdaptor PRIVATE pybind11::module pybind11::lto graph_wrapper |
| 135 | + enn_logging |
| 136 | + ) |
| 137 | + pybind11_extension(PyGraphWrapperAdaptor) |
| 138 | + |
| 139 | + add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/aot) |
119 | 140 | endif() |
120 | 141 |
|
121 | | - |
122 | 142 | if(${ANDROID}) |
123 | | - target_link_libraries(enn_logging PRIVATE ${android_log}) |
124 | | - add_library(enn_backend STATIC) |
125 | | - target_link_libraries(enn_backend PRIVATE enn_logging) |
126 | | - executorch_target_link_options_shared_lib(enn_backend) |
127 | | - target_compile_options(enn_backend PRIVATE -Wno-deprecated-declarations) |
128 | | - |
129 | | - set(__enn_executor_runner_srcs ${EXECUTORCH_SOURCE_DIR}/examples/samsung/executor_runner/enn_executor_runner.cpp) |
130 | | - add_executable(enn_executor_runner ${__enn_executor_runner_srcs}) |
131 | | - add_dependencies(enn_executor_runner enn_backend) |
132 | | - target_link_libraries(enn_executor_runner PRIVATE |
133 | | - enn_logging |
134 | | - enn_backend |
135 | | - gflags |
136 | | - executorch |
137 | | - extension_data_loader |
138 | | - portable_ops_lib |
139 | | - ) |
140 | | - set_target_properties(enn_executor_runner PROPERTIES CXX_VISIBILITY_PRESET hidden) |
141 | | - install( |
142 | | - TARGETS enn_backend enn_logging |
143 | | - EXPORT ExecuTorchTargets |
144 | | - DESTINATION lib |
145 | | - ) |
| 143 | + target_link_libraries(enn_logging PRIVATE ${android_log}) |
| 144 | + add_library(enn_backend STATIC) |
| 145 | + target_link_libraries(enn_backend PRIVATE enn_logging) |
| 146 | + executorch_target_link_options_shared_lib(enn_backend) |
| 147 | + target_compile_options(enn_backend PRIVATE -Wno-deprecated-declarations) |
| 148 | + |
| 149 | + set(__enn_executor_runner_srcs |
| 150 | + ${EXECUTORCH_SOURCE_DIR}/examples/samsung/executor_runner/enn_executor_runner.cpp |
| 151 | + ) |
| 152 | + add_executable(enn_executor_runner ${__enn_executor_runner_srcs}) |
| 153 | + add_dependencies(enn_executor_runner enn_backend) |
| 154 | + target_link_libraries( |
| 155 | + enn_executor_runner PRIVATE enn_logging enn_backend gflags executorch |
| 156 | + extension_data_loader portable_ops_lib |
| 157 | + ) |
| 158 | + set_target_properties( |
| 159 | + enn_executor_runner PROPERTIES CXX_VISIBILITY_PRESET hidden |
| 160 | + ) |
| 161 | + install( |
| 162 | + TARGETS enn_backend enn_logging |
| 163 | + EXPORT ExecuTorchTargets |
| 164 | + DESTINATION lib |
| 165 | + ) |
146 | 166 | endif() |
147 | 167 |
|
148 | 168 | add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/runtime) |
0 commit comments