diff --git a/CMakeLists.txt b/CMakeLists.txt index 2b3e6227acb58b3d8b3bf132fecf60c5298f172f..bcab53eb12a87881900894e3ab1e657d17d6af1f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.6) +cmake_minimum_required(VERSION 3.0) option(USE_OPENMP "openmp support" OFF) project(paddle-mobile) diff --git a/tools/build.sh b/tools/build.sh index baa9fe1097b774418899cb20f2f1e63520fa7792..e7eadd738935f782c6a8d98cae400b7b2b771e98 100755 --- a/tools/build.sh +++ b/tools/build.sh @@ -92,6 +92,32 @@ build_for_android() { make -j 8 } + +build_for_arm_linux() { + MODE="Release" + ARM_LINUX="arm-linux" + + if [ "${#NETS}" -gt 1 ]; then + cmake .. \ + -B"../build/release/arm-linux" \ + -DCMAKE_BUILD_TYPE="${MODE}" \ +# -DCMAKE_TOOLCHAIN_FILE="./tools/toolchains/arm-linux-gnueabihf.cmake" \ + -DCMAKE_CXX_FLAGS="-std=c++14 -mcpu=cortex-a53 -mtune=cortex-a53 -mfpu=neon-vfpv4 -mfloat-abi=hard -ftree-vectorize -funsafe-math-optimizations -pipe -mlittle-endian -munaligned-access" \ + -DNET="${NETS}" \ + -D"V7"=true + else + cmake .. \ + -B"../build/release/arm-linux" \ + -DCMAKE_BUILD_TYPE="${MODE}" \ + -DCMAKE_TOOLCHAIN_FILE="./tools/toolchains/arm-linux-gnueabihf.cmake" \ + -DCMAKE_CXX_FLAGS="-std=c++14 -mcpu=cortex-a53 -mtune=cortex-a53 -mfpu=neon-vfpv4 -mfloat-abi=hard -ftree-vectorize -funsafe-math-optimizations -pipe -mlittle-endian -munaligned-access" \ + -D"V7"=true + fi + + cd "../build/release/arm-linux" + make -j 8 +} + build_for_ios() { # rm -rf "../build" PLATFORM="ios" @@ -135,7 +161,7 @@ if [ $# -lt 1 ]; then echo "sample usage: ./build.sh android" else params=($@) - for(( i=1; i<$#; i++ )); do + for(( i=1; i<$#; i++ )); do if [ ${i} != 1 ]; then NETS=$NETS$";" fi @@ -162,6 +188,8 @@ else if [ $1 = "android" ]; then build_for_android + elif [ $1 = "arm_linux" ]; then + build_for_arm_linux elif [ $1 = "ios" ]; then build_for_ios else diff --git a/tools/toolchains/arm-linux-gnueabihf.cmake b/tools/toolchains/arm-linux-gnueabihf.cmake new file mode 100644 index 0000000000000000000000000000000000000000..7db42c7e73f4cfabce670bb2bc691e4b5bd314a2 --- /dev/null +++ b/tools/toolchains/arm-linux-gnueabihf.cmake @@ -0,0 +1,11 @@ +# CMake toolchain file for building ARM software on Linux environment + +set(CMAKE_SYSTEM_NAME Linux) +set(CMAKE_SYSTEM_PROCESSOR arm) +set(CMAKE_SYSTEM_VERSION 1) + +message("if U build on platform . this is right.") +set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) +set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) +set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) +set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY) \ No newline at end of file