| 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 | # when hislicon SDK was installed, toolchain was installed in the path as below: |
| 5 | set(CMAKE_C_COMPILER "/opt/hisi-linux/x86-arm/arm-hisiv600-linux/target/bin/arm-hisiv600-linux-gcc") |
| 6 | set(CMAKE_CXX_COMPILER "/opt/hisi-linux/x86-arm/arm-hisiv600-linux/target/bin/arm-hisiv600-linux-g++") |
| 7 | set(CMAKE_FIND_ROOT_PATH "/opt/hisi-linux/x86-arm/arm-hisiv600-linux") |
| 8 | |
| 9 | # set searching rules for cross-compiler |
| 10 | if(NOT CMAKE_FIND_ROOT_PATH_MODE_PROGRAM) |
| 11 | set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) |
| 12 | endif() |
| 13 | if(NOT CMAKE_FIND_ROOT_PATH_MODE_LIBRARY) |
| 14 | set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) |
| 15 | endif() |
| 16 | if(NOT CMAKE_FIND_ROOT_PATH_MODE_INCLUDE) |
| 17 | set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) |
| 18 | endif() |
| 19 | if(NOT CMAKE_FIND_ROOT_PATH_MODE_PACKAGE) |
| 20 | set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY) |
| 21 | endif() |
| 22 | |
| 23 | # set ${CMAKE_C_FLAGS} and ${CMAKE_CXX_FLAGS}flag for cross-compiled process |
| 24 | set(CMAKE_CXX_FLAGS "-march=armv7-a -mfloat-abi=softfp -mfpu=neon ${CMAKE_CXX_FLAGS}") |
| 25 | |
| 26 | # cache flags |
| 27 | set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS}" CACHE STRING "c flags") |
| 28 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}" CACHE STRING "c++ flags") |