Skip to content

Commit

Permalink
[armlinux] Fix compile error on cxx demo (#5693)
Browse files Browse the repository at this point in the history
* add opencl intro on compile_linux.md

* fix compiler error on armlinux cxx demo
  • Loading branch information
zhaoyang-star authored Mar 12, 2021
1 parent 008849e commit af6805f
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 2 deletions.
7 changes: 7 additions & 0 deletions docs/source_compile/compile_linux.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,13 @@ inference_lite_lib.armlinux.armv8
--opt_model_dir: 输入模型的绝对路径,需要为opt转化之后的模型
```

- 编译支持 OpenCL 的预测库

```
./lite/tools/build_linux.sh --with_opencl=ON
```


- 编译 瑞芯微(Rockchip) NPU 预测库方法,详情请参考:[PaddleLite使用RK NPU预测部署](../demo_guides/rockchip_npu)

```shell
Expand Down
21 changes: 20 additions & 1 deletion lite/demo/cxx/armlinux_mobilenetv1_full_demo/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ cmake_minimum_required(VERSION 2.8)

set(TARGET mobilenet_full_api)

# Set ARMLINUX_ARCH_ABI to armv8 or armv7 or armv7hf
set(ARMLINUX_ARCH_ABI armv8)

# 1. path to Paddle-Lite lib
set(LITE_DIR "${PROJECT_SOURCE_DIR}/../../../cxx")

Expand All @@ -11,7 +14,23 @@ link_directories(${LITE_DIR}/lib)
include_directories(${LITE_DIR}/include)

# 3. compile options
add_definitions(-std=c++11 -g -O3 -pthread)
if(ARMLINUX_ARCH_ABI STREQUAL "armv8")
set(CMAKE_C_COMPILER "aarch64-linux-gnu-gcc")
set(CMAKE_CXX_COMPILER "aarch64-linux-gnu-g++")
elseif(ARMLINUX_ARCH_ABI STREQUAL "armv7")
set(CMAKE_C_COMPILER "arm-linux-gnueabi-gcc")
set(CMAKE_CXX_COMPILER "arm-linux-gnueabi-g++")
elseif(ARMLINUX_ARCH_ABI STREQUAL "armv7hf")
set(CMAKE_C_COMPILER "arm-linux-gnueabihf-gcc")
set(CMAKE_CXX_COMPILER "arm-linux-gnueabihf-g++")
else()
message(FATAL_ERROR "Illegal ARMLINUX_ARCH_ABI: ${ARMLINUX_ARCH_ABI}")
endif()

message(STATUS "armlinux CMAKE_C_COMPILER: ${CMAKE_C_COMPILER}")
message(STATUS "armlinux CMAKE_CXX_COMPILER: ${CMAKE_CXX_COMPILER}")

add_definitions(-std=c++11 -O3 -pthread)
set(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR})

# 4.add executable output
Expand Down
21 changes: 20 additions & 1 deletion lite/demo/cxx/armlinux_mobilenetv1_light_demo/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ cmake_minimum_required(VERSION 2.8)

set(TARGET mobilenet_light_api)

# Set ARMLINUX_ARCH_ABI to armv8 or armv7 or armv7hf
set(ARMLINUX_ARCH_ABI armv8)

# 1. path to Paddle-Lite lib
set(LITE_DIR "${PROJECT_SOURCE_DIR}/../../../cxx")

Expand All @@ -11,7 +14,23 @@ link_directories(${LITE_DIR}/lib)
include_directories(${LITE_DIR}/include)

# 3. compile options
add_definitions(-std=c++11 -g -O3 -pthread)
if(ARMLINUX_ARCH_ABI STREQUAL "armv8")
set(CMAKE_C_COMPILER "aarch64-linux-gnu-gcc")
set(CMAKE_CXX_COMPILER "aarch64-linux-gnu-g++")
elseif(ARMLINUX_ARCH_ABI STREQUAL "armv7")
set(CMAKE_C_COMPILER "arm-linux-gnueabi-gcc")
set(CMAKE_CXX_COMPILER "arm-linux-gnueabi-g++")
elseif(ARMLINUX_ARCH_ABI STREQUAL "armv7hf")
set(CMAKE_C_COMPILER "arm-linux-gnueabihf-gcc")
set(CMAKE_CXX_COMPILER "arm-linux-gnueabihf-g++")
else()
message(FATAL_ERROR "Illegal ARMLINUX_ARCH_ABI: ${ARMLINUX_ARCH_ABI}")
endif()

message(STATUS "armlinux CMAKE_C_COMPILER: ${CMAKE_C_COMPILER}")
message(STATUS "armlinux CMAKE_CXX_COMPILER: ${CMAKE_CXX_COMPILER}")

add_definitions(-std=c++11 -O3 -pthread)
set(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR})

# 4.add executable output
Expand Down

0 comments on commit af6805f

Please sign in to comment.