From e170ea03cf39448960250bf8b949be9690a7379a Mon Sep 17 00:00:00 2001 From: tensor-tang Date: Fri, 24 May 2019 19:32:06 +0800 Subject: [PATCH] fix cmake deps and update dockerfile (#17635) --- Dockerfile.android | 42 ++++++++++---------- paddle/fluid/lite/CMakeLists.txt | 28 ++++++------- paddle/fluid/lite/api/CMakeLists.txt | 3 +- paddle/fluid/lite/kernels/arm/CMakeLists.txt | 3 +- 4 files changed, 39 insertions(+), 37 deletions(-) diff --git a/Dockerfile.android b/Dockerfile.android index 185740df1b0..2245a1e71a6 100644 --- a/Dockerfile.android +++ b/Dockerfile.android @@ -1,35 +1,36 @@ +# A image for building paddle cross compile FROM ubuntu:16.04 +MAINTAINER PaddlePaddle Authors -RUN echo '\ -deb main restricted universe multiverse\n\ -deb -updates main restricted universe multiverse\n\ -deb -backports main restricted universe multiverse\n\ -deb -security main restricted universe multiverse\n'\ -> /etc/apt/sources.list -RUN sed -ie 's||http://mirrors.tuna.tsinghua.edu.cn/ubuntu/|' /etc/apt/sources.list -RUN sed -ie 's||xenial|' /etc/apt/sources.list +ARG UBUNTU_MIRROR +RUN /bin/bash -c '\ +if [[ -n ${UBUNTU_MIRROR} ]]; then \ +sed -i 's#http://archive.ubuntu.com/ubuntu#${UBUNTU_MIRROR}#g' /etc/apt/sources.list; fi' RUN apt-get update && apt-get upgrade -y RUN apt-get install -y --no-install-recommends \ + clang-format-3.8 \ + cmake-curses-gui \ curl \ - unzip \ + fish \ + gawk \ + gcc \ + g++ \ git \ + graphviz \ make \ - cmake-curses-gui \ + patch \ python \ python-pip \ python-setuptools \ - clang-format-5.0 \ - graphviz \ - g++-arm-linux-gnueabi \ - gcc-arm-linux-gnueabi \ - gcc \ - g++ + unzip \ + vim \ + wget + RUN apt-get autoremove -y && apt-get clean -RUN ln -s clang-format-5.0 /usr/bin/clang-format -RUN pip install -i https://pypi.tuna.tsinghua.edu.cn/simple --upgrade pip -RUN pip install -i https://pypi.tuna.tsinghua.edu.cn/simple wheel -RUN pip install -i https://pypi.tuna.tsinghua.edu.cn/simple pre-commit +RUN ln -s clang-format-3.8 /usr/bin/clang-format +RUN pip install --upgrade pip +RUN pip install pre-commit wheel RUN cd /tmp && curl -O https://dl.google.com/android/repository/android-ndk-r17c-linux-x86_64.zip RUN curl -O https://mms-res.cdn.bcebos.com/cmake-3.10.3-Linux-x86_64.tar.gz && \ tar xzf cmake-3.10.3-Linux-x86_64.tar.gz && \ @@ -38,3 +39,4 @@ RUN curl -O https://mms-res.cdn.bcebos.com/cmake-3.10.3-Linux-x86_64.tar.gz && \ mv /usr/bin/ccmake /usr/bin/ccmake.bak && ln -s /opt/cmake-3.10/bin/ccmake /usr/bin/ccmake RUN cd /opt && unzip /tmp/android-ndk-r17c-linux-x86_64.zip ENV NDK_ROOT /opt/android-ndk-r17c +RUN rm -rf /tmp/android-ndk-r17c-linux-x86_64.zip /cmake-3.10.3-Linux-x86_64.tar.gz diff --git a/paddle/fluid/lite/CMakeLists.txt b/paddle/fluid/lite/CMakeLists.txt index a1a1f2ab681..ba05973a863 100644 --- a/paddle/fluid/lite/CMakeLists.txt +++ b/paddle/fluid/lite/CMakeLists.txt @@ -30,31 +30,34 @@ function(lite_download_and_uncompress INSTALL_DIR URL FILENAME) ) endfunction() -function (lite_deps DEPS) +function (lite_deps TARGET) set(options "") set(oneValueArgs "") - set(multiValueArgs DEPS X86_DEPS CUDA_DEPS ARM_DEPS) + set(multiValueArgs DEPS X86_DEPS CUDA_DEPS ARM_DEPS ARGS) cmake_parse_arguments(lite_deps "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) - set(${DEPS} ${lite_deps_DEPS} PARENT_SCOPE) + set(deps ${lite_deps_DEPS}) if(LITE_WITH_X86) foreach(var ${lite_deps_X86_DEPS}) - set(${DEPS} ${${DEPS}} ${var} PARENT_SCOPE) - endforeach() + set(deps ${deps} ${var}) + endforeach(var) endif() if(LITE_WITH_CUDA) foreach(var ${lite_deps_CUDA_DEPS}) - set(${DEPS} ${${DEPS}} ${var} PARENT_SCOPE) - endforeach() + set(deps ${deps} ${var}) + endforeach(var) endif() if(LITE_WITH_ARM) foreach(var ${lite_deps_ARM_DEPS}) - set(${DEPS} ${${DEPS}} ${var} PARENT_SCOPE) - endforeach() + set(deps ${deps} ${var}) + endforeach(var) endif() + + set(${TARGET} ${deps} PARENT_SCOPE) + endfunction() function(lite_cc_library TARGET) @@ -68,8 +71,7 @@ function(lite_cc_library TARGET) DEPS ${args_DEPS} X86_DEPS ${args_X86_DEPS} CUDA_DEPS ${args_CUDA_DEPS} - ARM_DEPS ${args_ARM_DEPS} - ) + ARM_DEPS ${args_ARM_DEPS}) cc_library(${TARGET} SRCS ${args_SRCS} DEPS ${deps} ${args_DEPS}) endfunction() @@ -85,9 +87,7 @@ function(lite_cc_binary TARGET) DEPS ${args_DEPS} X86_DEPS ${args_X86_DEPS} CUDA_DEPS ${args_CUDA_DEPS} - ARM_DEPS ${args_ARM_DEPS} - ) - + ARM_DEPS ${args_ARM_DEPS}) cc_binary(${TARGET} SRCS ${args_SRCS} DEPS ${deps} ${args_DEPS}) endfunction() diff --git a/paddle/fluid/lite/api/CMakeLists.txt b/paddle/fluid/lite/api/CMakeLists.txt index 3ec3eb155f1..cea38089fbe 100644 --- a/paddle/fluid/lite/api/CMakeLists.txt +++ b/paddle/fluid/lite/api/CMakeLists.txt @@ -17,7 +17,8 @@ endif() cc_library(light_api_lite SRCS light_api.cc DEPS ${light_api_deps} ${ops_lite} ${host_kernels}) message(STATUS "get ops ${ops_lite}") -message(STATUS "get kernels ${host_kernels} ${arm_kernels}") +message(STATUS "get Host kernels ${host_kernels}") +message(STATUS "get ARM kernels ${arm_kernels}") include(ExternalProject) set(LITE_URL "http://paddle-inference-dist.bj.bcebos.com" CACHE STRING "inference download url") diff --git a/paddle/fluid/lite/kernels/arm/CMakeLists.txt b/paddle/fluid/lite/kernels/arm/CMakeLists.txt index b4001a003c3..b5fc0bdea8a 100644 --- a/paddle/fluid/lite/kernels/arm/CMakeLists.txt +++ b/paddle/fluid/lite/kernels/arm/CMakeLists.txt @@ -13,7 +13,6 @@ set(arm_kernels fc_compute_arm relu_compute_arm mul_compute_arm - scale_compute_arm - ) + scale_compute_arm) set(arm_kernels "${arm_kernels}" CACHE INTERNAL "arm kernels") -- GitLab