未验证 提交 85914800 编写于 作者: H hong 提交者: GitHub

fix ninja compile error (#48435)

* fix lite rocksdb ninja compile error

* remove useless code

* fix bug
上级 8d9fdd8b
......@@ -35,6 +35,21 @@ if(LITE_WITH_XPU)
endif()
endif()
if(WITH_ARM)
if(LITE_WITH_XPU)
set(LITE_OUTPUT_BIN_DIR inference_lite_lib.armlinux.armv8.xpu)
elseif(LITE_WITH_NNADAPTER)
message("Enable LITE_WITH_NNADAPTER")
if(NNADAPTER_WITH_HUAWEI_ASCEND_NPU)
set(LITE_OUTPUT_BIN_DIR inference_lite_lib.armlinux.armv8.nnadapter)
endif()
else()
set(LITE_OUTPUT_BIN_DIR inference_lite_lib.armlinux.armv8)
endif()
else()
set(LITE_OUTPUT_BIN_DIR inference_lite_lib)
endif()
if(LITE_WITH_NNADAPTER)
add_definitions(-DLITE_SUBGRAPH_WITH_NNADAPTER)
if(NNADAPTER_WITH_HUAWEI_ASCEND_NPU)
......@@ -50,6 +65,12 @@ if(NOT LITE_SOURCE_DIR OR NOT LITE_BINARY_DIR)
set(LITE_PROJECT extern_lite)
set(LITE_PREFIX_DIR ${THIRD_PARTY_PATH}/lite)
set(LITE_INSTALL_DIR ${THIRD_PARTY_PATH}/install/lite)
set(LITE_BINARY_DIR ${LITE_PREFIX_DIR}/src/extern_lite-build)
set(LITE_SOURCE_DIR ${LITE_PREFIX_DIR}/src/extern_lite)
set(LITE_SHARED_LIB
${LITE_BINARY_DIR}/${LITE_OUTPUT_BIN_DIR}/cxx/lib/libpaddle_full_api_shared.so
)
if(NOT LITE_GIT_TAG)
set(LITE_GIT_TAG 81ef66554099800c143a0feff6e0a491b3b0d12e)
......@@ -61,7 +82,8 @@ if(NOT LITE_SOURCE_DIR OR NOT LITE_BINARY_DIR)
# No quotes, so cmake can resolve it as a command with arguments.
if(WITH_ARM)
set(LITE_BUILD_COMMAND $(MAKE) publish_inference -j)
set(LITE_BUILD_COMMAND ${CMAKE_COMMAND} --build . --target
publish_inference -j)
message(WARNING "BUILD_COMMAND: ${LITE_BUILD_COMMAND}")
set(LITE_OPTIONAL_ARGS
-DWITH_MKL=OFF
......@@ -110,9 +132,11 @@ if(NOT LITE_SOURCE_DIR OR NOT LITE_BINARY_DIR)
-DCMAKE_POSITION_INDEPENDENT_CODE=ON
-DCMAKE_BUILD_TYPE=${THIRD_PARTY_BUILD_TYPE}
${EXTERNAL_OPTIONAL_ARGS}
${LITE_OPTIONAL_ARGS})
${LITE_OPTIONAL_ARGS}
BUILD_BYPRODUCTS ${LITE_SHARED_LIB})
else()
set(LITE_BUILD_COMMAND $(MAKE) publish_inference -j)
set(LITE_BUILD_COMMAND ${CMAKE_COMMAND} --build . --target
publish_inference -j)
set(LITE_OPTIONAL_ARGS
-DWITH_MKL=ON
-DLITE_WITH_CUDA=OFF
......@@ -157,28 +181,9 @@ if(NOT LITE_SOURCE_DIR OR NOT LITE_BINARY_DIR)
-DCMAKE_POSITION_INDEPENDENT_CODE=ON
-DCMAKE_BUILD_TYPE=${THIRD_PARTY_BUILD_TYPE}
${EXTERNAL_OPTIONAL_ARGS}
${LITE_OPTIONAL_ARGS})
${LITE_OPTIONAL_ARGS}
BUILD_BYPRODUCTS ${LITE_SHARED_LIB})
endif()
ExternalProject_Get_Property(${LITE_PROJECT} BINARY_DIR)
ExternalProject_Get_Property(${LITE_PROJECT} SOURCE_DIR)
set(LITE_BINARY_DIR ${BINARY_DIR})
set(LITE_SOURCE_DIR ${SOURCE_DIR})
endif()
if(WITH_ARM)
if(LITE_WITH_XPU)
set(LITE_OUTPUT_BIN_DIR inference_lite_lib.armlinux.armv8.xpu)
elseif(LITE_WITH_NNADAPTER)
message("Enable LITE_WITH_NNADAPTER")
if(NNADAPTER_WITH_HUAWEI_ASCEND_NPU)
set(LITE_OUTPUT_BIN_DIR inference_lite_lib.armlinux.armv8.nnadapter)
endif()
else()
set(LITE_OUTPUT_BIN_DIR inference_lite_lib.armlinux.armv8)
endif()
else()
set(LITE_OUTPUT_BIN_DIR inference_lite_lib)
endif()
message(STATUS "Paddle-lite BINARY_DIR: ${LITE_BINARY_DIR}")
......@@ -199,12 +204,9 @@ function(external_lite_libs alias path)
endfunction()
external_lite_libs(
lite_full_static
lite_full_shared
${LITE_BINARY_DIR}/${LITE_OUTPUT_BIN_DIR}/cxx/lib/libpaddle_full_api_shared.so
)
set(LITE_SHARED_LIB
${LITE_BINARY_DIR}/${LITE_OUTPUT_BIN_DIR}/cxx/lib/libpaddle_full_api_shared.so
)
if(LITE_WITH_NNADAPTER)
set(LITE_NNADAPTER_LIB
......@@ -214,13 +216,13 @@ if(LITE_WITH_NNADAPTER)
lite_nnadapter
${LITE_BINARY_DIR}/${LITE_OUTPUT_BIN_DIR}/cxx/lib/libnnadapter.so
${LITE_BINARY_DIR}/${LITE_OUTPUT_BIN_DIR}/cxx/lib/libhuawei_ascend_npu.so)
set(LITE_DEPS lite_full_static lite_nnadapter)
set(LITE_DEPS lite_full_shared lite_nnadapter)
set(LITE_NNADAPTER_NPU_LIB
${LITE_BINARY_DIR}/${LITE_OUTPUT_BIN_DIR}/cxx/lib/libhuawei_ascend_npu.so
)
endif()
else()
set(LITE_DEPS lite_full_static)
set(LITE_DEPS lite_full_shared)
endif()
add_definitions(-DPADDLE_WITH_LITE)
......
......@@ -39,18 +39,17 @@ ExternalProject_Add(
-DWITH_GFLAGS=OFF
-DCMAKE_CXX_FLAGS=${ROCKSDB_CMAKE_CXX_FLAGS}
-DCMAKE_C_FLAGS=${CMAKE_C_FLAGS}
# BUILD_BYPRODUCTS ${ROCKSDB_PREFIX_DIR}/src/extern_rocksdb/librocksdb.a
INSTALL_COMMAND
mkdir -p ${ROCKSDB_INSTALL_DIR}/lib/ && cp
${ROCKSDB_PREFIX_DIR}/src/extern_rocksdb/librocksdb.a ${ROCKSDB_LIBRARIES}
&& cp -r ${ROCKSDB_PREFIX_DIR}/src/extern_rocksdb/include
${ROCKSDB_INSTALL_DIR}/
BUILD_IN_SOURCE 1
BYPRODUCTS ${ROCKSDB_LIBRARIES})
add_dependencies(extern_rocksdb snappy)
BUILD_BYPRODUCTS ${ROCKSDB_LIBRARIES})
add_library(rocksdb STATIC IMPORTED GLOBAL)
add_dependencies(extern_rocksdb snappy)
set_property(TARGET rocksdb PROPERTY IMPORTED_LOCATION ${ROCKSDB_LIBRARIES})
add_dependencies(rocksdb extern_rocksdb)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册