File tree Expand file tree Collapse file tree 9 files changed +169
-3
lines changed
Expand file tree Collapse file tree 9 files changed +169
-3
lines changed Original file line number Diff line number Diff line change 1+ name : CI
2+
3+ on :
4+ push :
5+ branches : [ "master" ]
6+ pull_request :
7+ branches : [ "master" ]
8+ workflow_dispatch :
9+
10+ jobs :
11+ build-x86 :
12+ name : x86 Build
13+ runs-on : ubuntu-latest
14+ steps :
15+ - uses : actions/checkout@v3
16+
17+ - name : Prepare 3rdparty
18+ run : git submodule update --init
19+
20+ - name : Build x86
21+ run : sh ./build.sh
22+
23+ - name : Upload x86 artifact
24+ uses : actions/upload-artifact@v4
25+ with :
26+ name : build-x86
27+ path : build/install/
28+
29+ build-aarch64 :
30+ name : aarch64 Build
31+ runs-on : ubuntu-latest
32+ steps :
33+ - uses : actions/checkout@v3
34+
35+ - name : Prepare 3rdparty
36+ run : git submodule update --init
37+
38+ - name : Build aarch64
39+ run : sh ./build_aarch64.sh
40+
41+ - name : Upload aarch64 artifact
42+ uses : actions/upload-artifact@v4
43+ with :
44+ name : build-aarch64
45+ path : build_aarch64/install/
Original file line number Diff line number Diff line change 1- build
1+ build *
22.vscode
Original file line number Diff line number Diff line change 1+ if (NOT DEFINED CMAKE_INSTALL_PREFIX )
2+ set (CMAKE_INSTALL_PREFIX "${CMAKE_BINARY_DIR} /install" CACHE PATH "Installation Directory" )
3+ endif ()
4+
5+ if (NOT CMAKE_BUILD_TYPE )
6+ set (CMAKE_BUILD_TYPE Release CACHE STRING "Choose the type of build" FORCE)
7+ endif ()
8+
19project (opus-mt-en-zh-axera)
10+ #C++17
11+ set (CMAKE_CXX_STANDARD 17)
12+ set (CMAKE_CXX_STANDARD_REQUIRED ON )
213
314add_subdirectory (third-party/sentencepiece)
415
@@ -26,8 +37,22 @@ add_library(ax_translate SHARED
2637 src/ax_devices.cpp
2738 )
2839
29- target_link_libraries (ax_translate PRIVATE sentencepiece)
40+ target_link_libraries (ax_translate PRIVATE sentencepiece dl )
3041
3142
3243add_executable (test_translate tests/test_translate.cpp)
33- target_link_libraries (test_translate PRIVATE ax_translate)
44+ target_link_libraries (test_translate PRIVATE ax_translate)
45+
46+ install (TARGETS ax_translate
47+ LIBRARY DESTINATION lib
48+ ARCHIVE DESTINATION lib
49+ RUNTIME DESTINATION bin
50+ )
51+
52+ install (TARGETS test_translate
53+ LIBRARY DESTINATION lib
54+ ARCHIVE DESTINATION lib
55+ RUNTIME DESTINATION bin
56+ )
57+
58+ install (FILES include /ax_translate.h include /ax_devices.h DESTINATION include )
Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+ mkdir build
3+ cd build
4+
5+ cmake -DCMAKE_BUILD_TYPE=Release ..
6+ cmake -DCMAKE_BUILD_TYPE=Release ..
7+
8+ make -j16
9+ make install
Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+
3+ echo " aarch64"
4+
5+ mkdir build_aarch64
6+ cd build_aarch64
7+
8+
9+ # 下载失败可以使用其他方式下载并放到在 $build_dir 目录,参考如下命令解压
10+ URL=" https://developer.arm.com/-/media/Files/downloads/gnu-a/9.2-2019.12/binrel/gcc-arm-9.2-2019.12-x86_64-aarch64-none-linux-gnu.tar.xz"
11+ FOLDER=" gcc-arm-9.2-2019.12-x86_64-aarch64-none-linux-gnu"
12+
13+ aarch64-none-linux-gnu-gcc -v
14+ if [ $? -ne 0 ]; then
15+ # Check if the file exists
16+ if [ ! -f " $FOLDER .tar.xz" ]; then
17+ # Download the file
18+ echo " Downloading $URL "
19+ wget " $URL " -O " $FOLDER .tar.xz"
20+ else
21+ echo " $FOLDER .tar.xz already exists"
22+ fi
23+
24+ # Check if the folder exists
25+ if [ ! -d " $FOLDER " ]; then
26+ # Extract the file
27+ echo " Extracting $FOLDER .tar.xz"
28+ tar -xf " $FOLDER .tar.xz"
29+ else
30+ echo " $FOLDER already exists"
31+ fi
32+
33+ export PATH=$PATH :$PWD /$FOLDER /bin/
34+ aarch64-none-linux-gnu-gcc -v
35+ if [ $? -ne 0 ]; then
36+ echo " Error: aarch64-none-linux-gnu-gcc not found"
37+ exit 1
38+ fi
39+ else
40+ echo " aarch64-none-linux-gnu-gcc already exists"
41+ fi
42+
43+
44+ cmake -DCMAKE_TOOLCHAIN_FILE=../toolchains/aarch64-none-linux-gnu.toolchain.cmake \
45+ -DCMAKE_BUILD_TYPE=Release \
46+ ..
47+
48+ cmake -DCMAKE_TOOLCHAIN_FILE=../toolchains/aarch64-none-linux-gnu.toolchain.cmake \
49+ -DCMAKE_BUILD_TYPE=Release \
50+ ..
51+
52+
53+ make -j16
54+ make install
Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+ mkdir build
3+ cd build
4+
5+ cmake -DCMAKE_BUILD_TYPE=Release ..
6+ cmake -DCMAKE_BUILD_TYPE=Release ..
7+
8+ make -j16
9+ make install
Original file line number Diff line number Diff line change 1+ # set cross-compiled system type, it's better not use the type which cmake cannot recognized.
2+ SET (CMAKE_SYSTEM_NAME Linux)
3+ SET (CMAKE_SYSTEM_PROCESSOR aarch64)
4+
5+ # aarch64-linux-gnu-gcc DO NOT need to be installed, so make sure aarch64-linux-gnu-gcc and aarch64-linux-gnu-g++ can be found in $PATH:
6+ SET (CMAKE_C_COMPILER "aarch64-none-linux-gnu-gcc" )
7+ SET (CMAKE_CXX_COMPILER "aarch64-none-linux-gnu-g++" )
8+
9+ # set searching rules for cross-compiler
10+ SET (CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
11+ SET (CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
12+ SET (CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
Original file line number Diff line number Diff line change 1+ # set cross-compiled system type, it's better not use the type which cmake cannot recognized.
2+ SET (CMAKE_SYSTEM_NAME Linux)
3+ SET (CMAKE_SYSTEM_PROCESSOR arm)
4+
5+ # gcc-arm-linux-gnueabi DO NOT need to be installed, so make sure arm-linux-gnueabihf-gcc and arm-linux-gnueabihf-g++ can be found in $PATH:
6+ SET (CMAKE_C_COMPILER "arm-linux-gnueabihf-gcc" )
7+ SET (CMAKE_CXX_COMPILER "arm-linux-gnueabihf-g++" )
8+
9+ # set searching rules for cross-compiler
10+ SET (CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
11+ SET (CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
12+ SET (CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
You can’t perform that action at this time.
0 commit comments