|
| 1 | +# Copyright (c) 2025 Samsung Electronics Co. LTD |
| 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 | +cmake_minimum_required(VERSION 3.15) |
| 8 | +set(CMAKE_CXX_STANDARD 17) |
| 9 | +set(CMAKE_CXX_STANDARD_REQUIRED ON) |
| 10 | +project(samsung_example) |
| 11 | + |
| 12 | +# Source root directory for executorch. |
| 13 | +if(NOT EXECUTORCH_ROOT) |
| 14 | + set(EXECUTORCH_ROOT ${CMAKE_CURRENT_SOURCE_DIR}/../..) |
| 15 | +endif() |
| 16 | + |
| 17 | +include(${EXECUTORCH_ROOT}/tools/cmake/Utils.cmake) |
| 18 | +include(${EXECUTORCH_ROOT}/tools/cmake/Codegen.cmake) |
| 19 | + |
| 20 | +if(NOT PYTHON_EXECUTABLE) |
| 21 | + resolve_python_executable() |
| 22 | +endif() |
| 23 | + |
| 24 | +if(NOT CMAKE_BUILD_TYPE) |
| 25 | + set(CMAKE_BUILD_TYPE RelWithDebInfo) |
| 26 | +endif() |
| 27 | + |
| 28 | +if(CMAKE_TOOLCHAIN_FILE MATCHES ".*(iOS|ios\.toolchain)\.cmake$") |
| 29 | + message(FATAL_ERROR "ios is not supported by Samsung AI system.") |
| 30 | +endif() |
| 31 | + |
| 32 | +# prebuilt libraries. executorch package should contain portable_ops_lib, |
| 33 | +# etdump, bundled_program. |
| 34 | +find_package(executorch CONFIG REQUIRED) |
| 35 | +target_compile_options(executorch INTERFACE -DET_EVENT_TRACER_ENABLED) |
| 36 | +find_package(gflags REQUIRED) |
| 37 | + |
| 38 | +set(_common_compile_options -Wno-deprecated-declarations -fPIC) |
| 39 | + |
| 40 | +add_compile_options(-Wall -Werror -fPIC) |
| 41 | + |
| 42 | +message("Build Samsung Android Examples") |
| 43 | + |
| 44 | +set(__enn_executor_runner__srcs |
| 45 | + ${CMAKE_CURRENT_LIST_DIR}/executor_runner/enn_executor_runner.cpp |
| 46 | +) |
| 47 | + |
| 48 | +add_executable(enn_executor_runner ${__enn_executor_runner__srcs}) |
| 49 | + |
| 50 | +target_include_directories(enn_executor_runner PRIVATE ${EXECUTORCH_ROOT}/..) |
| 51 | + |
| 52 | +target_compile_options(enn_executor_runner PRIVATE ${_common_compile_options}) |
| 53 | + |
| 54 | +target_link_libraries( |
| 55 | + enn_executor_runner PRIVATE enn_logging enn_backend gflags executorch |
| 56 | + extension_data_loader portable_ops_lib |
| 57 | +) |
| 58 | + |
| 59 | +set_target_properties( |
| 60 | + enn_executor_runner PROPERTIES CXX_VISIBILITY_PRESET hidden |
| 61 | +) |
0 commit comments