-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: try implement build everything in
build.rs
- Loading branch information
Showing
6 changed files
with
219 additions
and
95 deletions.
There are no files selected for viewing
This file contains 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 |
---|---|---|
|
@@ -8,4 +8,6 @@ npm-debug.log | |
cargo.log | ||
cross.log | ||
lib/*.js | ||
bin/**/* | ||
bin/**/* | ||
.venv | ||
/qairt |
This file contains 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,110 @@ | ||
cmake_minimum_required(VERSION 3.10) | ||
project(executorch_all) | ||
|
||
set(CMAKE_CXX_STANDARD 17) | ||
set(CMAKE_POSITION_INDEPENDENT_CODE ON) | ||
|
||
include(executorch/build/Utils.cmake) | ||
|
||
# CONFIG | ||
|
||
option(EXECUTORCH_INSTALL_PATH "Path to install executorch" "" FORCE) | ||
|
||
set(link_libraries "executorch" "executorch_core") | ||
if (CMAKE_BUILD_TYPE STREQUAL "Debug") | ||
list( | ||
APPEND link_libraries | ||
extension_data_loader | ||
extension_module_static | ||
portable_ops_lib | ||
portable_kernels | ||
) | ||
else() | ||
list( | ||
APPEND link_libraries | ||
extension_data_loader | ||
extension_module_static | ||
optimized_native_cpu_ops_lib | ||
optimized_kernels | ||
portable_kernels | ||
eigen_blas | ||
quantized_ops_lib | ||
quantized_kernels | ||
custom_ops | ||
extension_tensor | ||
extension_runner_util | ||
cpuinfo | ||
pthreadpool | ||
xnnpack_backend | ||
XNNPACK | ||
microkernels-prod | ||
) | ||
if (CMAKE_SYSTEM_NAME STREQUAL "Windows" AND CMAKE_SYSTEM_PROCESSOR STREQUAL "ARM64") | ||
list(APPEND link_libraries "qnn_executorch_backend") | ||
endif() | ||
if (CMAKE_SYSTEM_NAME STREQUAL "Darwin") | ||
set(ET_CMAKE_ARGS "${ET_CMAKE_ARGS} -DEXECUTORCH_BUILD_COREML=ON") | ||
endif() | ||
endif() | ||
|
||
set(executorch_DIR ${EXECUTORCH_INSTALL_PATH}) | ||
find_package(executorch REQUIRED CONFIG) | ||
|
||
# TOKENIZERS | ||
|
||
set(ABSL_ENABLE_INSTALL ON) | ||
set(ABSL_PROPAGATE_CXX_STD ON) | ||
add_subdirectory(executorch/extension/llm/third-party/abseil-cpp) | ||
add_subdirectory(executorch/extension/llm/third-party/re2) | ||
add_subdirectory(executorch/extension/llm/third-party/sentencepiece) | ||
|
||
file(GLOB_RECURSE TOKENIZER_SRCS | ||
executorch/extension/llm/tokenizer/bpe_tokenizer.cpp | ||
executorch/extension/llm/tokenizer/tiktoken.cpp | ||
) | ||
file(GLOB_RECURSE TOKENIZER_HDRS | ||
executorch/extension/llm/tokenizer/*.h | ||
) | ||
add_library(tokenizer STATIC | ||
${TOKENIZER_SRCS} | ||
${TOKENIZER_HDRS} | ||
) | ||
target_include_directories(tokenizer PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) | ||
|
||
# list( | ||
# APPEND link_libraries | ||
# tokenizer | ||
# re2::re2 | ||
# sentencepiece-static | ||
# ) | ||
|
||
|
||
# ALL | ||
|
||
add_library(executorch_all INTERFACE) | ||
|
||
target_link_options_shared_lib(executorch) | ||
if (CMAKE_BUILD_TYPE STREQUAL "Debug") | ||
target_link_options_shared_lib(portable_ops_lib) | ||
else() | ||
target_link_options_shared_lib(optimized_native_cpu_ops_lib) | ||
target_link_options_shared_lib(quantized_ops_lib) | ||
target_link_options_shared_lib(custom_ops) | ||
target_link_options_shared_lib(xnnpack_backend) | ||
if (CMAKE_SYSTEM_NAME STREQUAL "Windows" AND CMAKE_SYSTEM_PROCESSOR STREQUAL "ARM64") | ||
target_link_options_shared_lib(qnn_executorch_backend) | ||
endif() | ||
if (CMAKE_SYSTEM_NAME STREQUAL "Darwin") | ||
target_link_options_shared_lib(coremldelegate) | ||
endif() | ||
endif() | ||
|
||
target_link_libraries(executorch_all INTERFACE ${link_libraries}) | ||
|
||
# INSTALL | ||
|
||
install(TARGETS executorch_all | ||
LIBRARY DESTINATION lib | ||
ARCHIVE DESTINATION lib | ||
RUNTIME DESTINATION bin | ||
) |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains 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 |
---|---|---|
|
@@ -25,3 +25,5 @@ libc = "0.2" | |
cc = "1.1.21" | ||
cpp_build = "0.5" | ||
build-target = "0.4" | ||
cmake = "0.1" | ||
project-root = "*" |
This file contains 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 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,17 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
|
||
TARGET_OS=$1 | ||
TARGET_ARCH=$2 | ||
OUT_DIR=$3 | ||
|
||
if [ -z "$TARGET_OS" ] || [ -z "$TARGET_ARCH" ]; then | ||
echo "Usage: $0 <target_os> <target_arch>" | ||
exit 1 | ||
fi | ||
|
||
if [ "$TARGET_OS" = "windows" ] && [ "$TARGET_ARCH" = "aarch64" ]; then | ||
echo "Cross compiling for Windows on ARM64 is not supported" | ||
exit 1 | ||
fi |