-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Samsung AI LiteCore - buildsystem: separate backend and example builds. #22582
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Jiseong-oh
wants to merge
3
commits into
main
Choose a base branch
from
build-split
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,61 @@ | ||
| # Copyright (c) 2025 Samsung Electronics Co. LTD | ||
| # 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. | ||
|
|
||
| cmake_minimum_required(VERSION 3.15) | ||
| set(CMAKE_CXX_STANDARD 17) | ||
| set(CMAKE_CXX_STANDARD_REQUIRED ON) | ||
| project(samsung_example) | ||
|
|
||
| # Source root directory for executorch. | ||
| if(NOT EXECUTORCH_ROOT) | ||
| set(EXECUTORCH_ROOT ${CMAKE_CURRENT_SOURCE_DIR}/../..) | ||
| endif() | ||
|
|
||
| include(${EXECUTORCH_ROOT}/tools/cmake/Utils.cmake) | ||
| include(${EXECUTORCH_ROOT}/tools/cmake/Codegen.cmake) | ||
|
|
||
| if(NOT PYTHON_EXECUTABLE) | ||
| resolve_python_executable() | ||
| endif() | ||
|
|
||
| if(NOT CMAKE_BUILD_TYPE) | ||
| set(CMAKE_BUILD_TYPE RelWithDebInfo) | ||
| endif() | ||
|
|
||
| if(CMAKE_TOOLCHAIN_FILE MATCHES ".*(iOS|ios\.toolchain)\.cmake$") | ||
| message(FATAL_ERROR "ios is not supported by Samsung AI system.") | ||
| endif() | ||
|
|
||
| # prebuilt libraries. executorch package should contain portable_ops_lib, | ||
| # etdump, bundled_program. | ||
| find_package(executorch CONFIG REQUIRED) | ||
| target_compile_options(executorch INTERFACE -DET_EVENT_TRACER_ENABLED) | ||
| find_package(gflags REQUIRED) | ||
|
|
||
| set(_common_compile_options -Wno-deprecated-declarations -fPIC) | ||
|
|
||
| add_compile_options(-Wall -Werror -fPIC) | ||
|
|
||
| message("Build Samsung Android Examples") | ||
|
|
||
| set(__enn_executor_runner__srcs | ||
| ${CMAKE_CURRENT_LIST_DIR}/executor_runner/enn_executor_runner.cpp | ||
| ) | ||
|
|
||
| add_executable(enn_executor_runner ${__enn_executor_runner__srcs}) | ||
|
|
||
| target_include_directories(enn_executor_runner PRIVATE ${EXECUTORCH_ROOT}/..) | ||
|
|
||
| target_compile_options(enn_executor_runner PRIVATE ${_common_compile_options}) | ||
|
|
||
| target_link_libraries( | ||
| enn_executor_runner PRIVATE enn_logging enn_backend gflags executorch | ||
| extension_data_loader portable_ops_lib | ||
| ) | ||
|
|
||
| set_target_properties( | ||
| enn_executor_runner PROPERTIES CXX_VISIBILITY_PRESET hidden | ||
| ) | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| #!/bin/bash | ||
|
|
||
| set -e | ||
|
|
||
| BASE_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" | ||
| PROJECT_DIR=$(realpath ${BASE_DIR}/../../) | ||
|
|
||
| echo PROJECT_DIR=${PROJECT_DIR} | ||
|
|
||
| if [[ -z ${ANDROID_NDK_ROOT} ]]; then | ||
| echo "Please export ANDROID_NDK_ROOT" | ||
| exit 1 | ||
| fi | ||
|
|
||
| ANDROID_ABI=arm64-v8a | ||
| ANDROID_PLATFORM=android-28 # Trace requires over android-23 | ||
|
|
||
| echo ANDROID_NDK_ROOT=${ANDROID_NDK_ROOT} | ||
| echo ANDROID_ABI=${ANDROID_ABI} | ||
| echo ANDROID_PLATFORM=${ANDROID_PLATFORM} | ||
|
|
||
| main() { | ||
| cd "$PROJECT_DIR" | ||
| local build_dir_root="build_samsung_android" | ||
| local example_root="examples/samsung" | ||
| local build_dir_example="$PROJECT_DIR/${build_dir_root}/${example_root}" | ||
| local cmake_prefix_path="$PROJECT_DIR/${build_dir_root}/lib/cmake/ExecuTorch;$PROJECT_DIR/${build_dir_root}/third-party/gflags;$PROJECT_DIR/${build_dir_root}/lib/cmake/tokenizers;$PROJECT_DIR/${build_dir_root}/lib/cmake/re2;$PROJECT_DIR/${build_dir_root}/lib/cmake/absl;" | ||
|
|
||
| echo build_dir=${build_dir_root} | ||
| echo build_dir_example=${build_dir_example} | ||
| echo cmake_prefix_path=${cmake_prefix_path} | ||
|
|
||
| cmake -DCMAKE_PREFIX_PATH=${cmake_prefix_path} \ | ||
| -DCMAKE_TOOLCHAIN_FILE="$ANDROID_NDK_ROOT/build/cmake/android.toolchain.cmake" \ | ||
| -DANDROID_NDK=$ANDROID_NDK \ | ||
| -DANDROID_ABI="$ANDROID_ABI" \ | ||
| -DANDROID_PLATFORM=$ANDROID_PLATFORM \ | ||
| -DCMAKE_FIND_ROOT_PATH_MODE_PACKAGE=BOTH \ | ||
| -DCMAKE_BUILD_TYPE=Release \ | ||
| -B"${build_dir_example}" \ | ||
| "$PROJECT_DIR/${example_root}" | ||
| cmake --build build_samsung_android/examples/samsung/ --config Release | ||
| } | ||
|
|
||
| main "$@" |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.