From 7e4461989459222c2f5cea93da451aae01fcd839 Mon Sep 17 00:00:00 2001 From: Xiaoyang LI Date: Fri, 20 Sep 2019 12:42:15 +0800 Subject: [PATCH] cherry-pick: Fix Mac & arm-linux build error (#2083) --- cmake/lite.cmake | 12 +++++++----- lite/backends/arm/math/gemm_prepacked_int8.cc | 1 + lite/backends/x86/CMakeLists.txt | 6 ++++-- lite/operators/range_op.cc | 1 + lite/tools/build.sh | 8 ++++++-- 5 files changed, 19 insertions(+), 9 deletions(-) diff --git a/cmake/lite.cmake b/cmake/lite.cmake index 552e4e71f2..18aa0f5f82 100644 --- a/cmake/lite.cmake +++ b/cmake/lite.cmake @@ -165,11 +165,13 @@ function(lite_cc_binary TARGET) ) cc_binary(${TARGET} SRCS ${args_SRCS} DEPS ${deps} ${args_DEPS}) target_compile_options(${TARGET} BEFORE PRIVATE -Wno-ignored-qualifiers) - # strip binary target to reduce size - add_custom_command(TARGET ${TARGET} POST_BUILD - COMMAND "${CMAKE_STRIP}" -s - "${TARGET}" - COMMENT "Strip debug symbols done on final executable file.") + if (NOT APPLE) + # strip binary target to reduce size + add_custom_command(TARGET ${TARGET} POST_BUILD + COMMAND "${CMAKE_STRIP}" -s + "${TARGET}" + COMMENT "Strip debug symbols done on final executable file.") + endif() # collect targets need to compile for lite if (NOT args_EXCLUDE_COMPILE_DEPS) add_dependencies(lite_compile_deps ${TARGET}) diff --git a/lite/backends/arm/math/gemm_prepacked_int8.cc b/lite/backends/arm/math/gemm_prepacked_int8.cc index d7e04bfc60..93dfdfe7d9 100644 --- a/lite/backends/arm/math/gemm_prepacked_int8.cc +++ b/lite/backends/arm/math/gemm_prepacked_int8.cc @@ -198,6 +198,7 @@ inline void gemm_int8_kernel(const int8_t* a_ptr, bool is_relu, int k, int rem); + // clang-format off #ifdef __aarch64__ #define GEMM_INT8_KERNEL \ diff --git a/lite/backends/x86/CMakeLists.txt b/lite/backends/x86/CMakeLists.txt index 34e0800130..63b41ae77d 100644 --- a/lite/backends/x86/CMakeLists.txt +++ b/lite/backends/x86/CMakeLists.txt @@ -4,10 +4,12 @@ endif() configure_file(cupti_lib_path.h.in ${CMAKE_CURRENT_BINARY_DIR}/cupti_lib_path.h) configure_file(warpctc_lib_path.h.in ${CMAKE_CURRENT_BINARY_DIR}/warpctc_lib_path.h) - +lite_cc_library(target_wrapper_x86 SRCS target_wrapper.cc) +if (LITE_ON_MODEL_OPTIMIZE_TOOL) + return() +endif(LITE_ON_MODEL_OPTIMIZE_TOOL) lite_cc_library(dynamic_loader SRCS dynamic_loader.cc DEPS glog gflags) lite_cc_library(dynload_mklml SRCS mklml.cc DEPS dynamic_loader mklml) -lite_cc_library(target_wrapper_x86 SRCS target_wrapper.cc) lite_cc_library(x86_cpu_info SRCS cpu_info.cc DEPS xbyak) add_subdirectory(jit) diff --git a/lite/operators/range_op.cc b/lite/operators/range_op.cc index 1426e07d8c..ccfbe18719 100644 --- a/lite/operators/range_op.cc +++ b/lite/operators/range_op.cc @@ -13,6 +13,7 @@ // limitations under the License. #include "lite/operators/range_op.h" +#include #include #include "lite/core/op_registry.h" diff --git a/lite/tools/build.sh b/lite/tools/build.sh index 1ff5752dba..d56a5f81cb 100755 --- a/lite/tools/build.sh +++ b/lite/tools/build.sh @@ -56,8 +56,12 @@ function build_model_optimize_tool { prepare_thirdparty mkdir -p build.model_optimize_tool cd build.model_optimize_tool - cmake .. -DWITH_LITE=ON -DLITE_ON_MODEL_OPTIMIZE_TOOL=ON -DWITH_TESTING=OFF -DLITE_BUILD_EXTRA=ON - make model_optimize_tool -j$NUM_CORES_FOR_COMPILE + cmake .. -DWITH_LITE=ON \ + -DLITE_ON_MODEL_OPTIMIZE_TOOL=ON \ + -DWITH_TESTING=OFF \ + -DLITE_BUILD_EXTRA=ON \ + -DWITH_MKL=OFF + make model_optimize_tool -j$NUM_PROC } function make_tiny_publish_so { -- GitLab