Merge pull request !62 from zhaoxinxin/developmentpull/62/MERGE
| @@ -3,7 +3,6 @@ if (HAVE_GFLAGS) | |||
| endif() | |||
| include(ExternalProject) | |||
| #set(CMAKE_INSTALL_PREFIX ${PARSER_DIR}/output) | |||
| if ((${CMAKE_INSTALL_PREFIX} STREQUAL /usr/local) OR | |||
| (${CMAKE_INSTALL_PREFIX} STREQUAL "C:/Program Files (x86)/ascend")) | |||
| @@ -11,6 +10,7 @@ if ((${CMAKE_INSTALL_PREFIX} STREQUAL /usr/local) OR | |||
| message(STATUS "No install prefix selected, default to ${CMAKE_INSTALL_PREFIX}.") | |||
| endif() | |||
| set (gflags_CXXFLAGS "-D_GLIBCXX_USE_CXX11_ABI=0 -Dgoogle=ascend_private") | |||
| if (ENABLE_GITEE) | |||
| set(REQ_URL "https://gitee.com/mirrors/gflags/repository/archive/v2.2.2.tar.gz") | |||
| set(MD5 "") | |||
| @@ -22,8 +22,8 @@ endif () | |||
| ExternalProject_Add(gflags_build | |||
| URL ${REQ_URL} | |||
| #URL /home/txd/workspace/linux_cmake/pkg/protobuf-3.8.0.tar.gz | |||
| #SOURCE_DIR ${PARSER_DIR}/../../third_party/gflags/src/gflags-2.2.2 | |||
| CONFIGURE_COMMAND ${CMAKE_COMMAND} -DCMAKE_CXX_FLAGS="-D_GLIBCXX_USE_CXX11_ABI=0" -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX}/gflags <SOURCE_DIR> | |||
| #SOURCE_DIR ${METADEF_DIR}/../../third_party/gflags/src/gflags-2.2.2 | |||
| CONFIGURE_COMMAND ${CMAKE_COMMAND} -DCMAKE_CXX_FLAGS=${gflags_CXXFLAGS} -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX}/gflags <SOURCE_DIR> | |||
| BUILD_COMMAND $(MAKE) | |||
| INSTALL_COMMAND $(MAKE) install | |||
| EXCLUDE_FROM_ALL TRUE | |||
| @@ -19,25 +19,20 @@ else() | |||
| set(MD5 "3d9e32700639618a4d2d342c99d4507a") | |||
| endif () | |||
| set(protobuf_CXXFLAGS "-Wno-maybe-uninitialized -Wno-unused-parameter -fPIC -fstack-protector-all -D_FORTIFY_SOURCE=2 -D_GLIBCXX_USE_CXX11_ABI=0 -O2") | |||
| set(protobuf_CXXFLAGS "-Wno-maybe-uninitialized -Wno-unused-parameter -fPIC -fstack-protector-all -D_FORTIFY_SOURCE=2 -D_GLIBCXX_USE_CXX11_ABI=0 -O2 -Dgoogle=ascend_private") | |||
| set(protobuf_LDFLAGS "-Wl,-z,relro,-z,now,-z,noexecstack") | |||
| ExternalProject_Add(protobuf_build | |||
| URL ${REQ_URL} | |||
| #URL /home/txd/workspace/linux_cmake/pkg/protobuf-3.8.0.tar.gz | |||
| #SOURCE_DIR ${PARSER_DIR}/../third_party/protobuf/src/protobuf-3.8.0 | |||
| #DOWNLOAD_COMMAND ${CMAKE_COMMAND} -E copy_directory ${PARSER_DIR}/../third_party/protobuf/src/protobuf-3.8.0 <SOURCE_DIR> | |||
| #CONFIGURE_COMMAND ${CMAKE_COMMAND} | |||
| #-DCMAKE_INSTALL_LIBDIR=${CMAKE_INSTALL_LIBDIR} | |||
| #-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER} | |||
| #-DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER} | |||
| #-DCMAKE_LINKER=${CMAKE_LINKER} | |||
| #-DCMAKE_AR=${CMAKE_AR} | |||
| #-DCMAKE_RANLIB=${CMAKE_RANLIB} | |||
| #-Dprotobuf_WITH_ZLIB=OFF | |||
| #-Dprotobuf_BUILD_TESTS=OFF -DBUILD_SHARED_LIBS=ON -DCMAKE_CXX_FLAGS=${protobuf_CXXFLAGS} -DCMAKE_CXX_LDFLAGS=${protobuf_LDFLAGS} -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX}/protobuf <SOURCE_DIR>/cmake | |||
| CONFIGURE_COMMAND cd <SOURCE_DIR> | |||
| && ./autogen.sh && cd <BINARY_DIR> && <SOURCE_DIR>/configure --prefix=${CMAKE_INSTALL_PREFIX}/protobuf --with-zlib=no CC=${CMAKE_C_COMPILER} CXX=${CMAKE_CXX_COMPILER} CXXFLAGS=${protobuf_CXXFLAGS} LDFLAGS=${protobuf_LDFLAGS} | |||
| && bash -c "sed -i 's|^hardcode_libdir_flag_spec=.*|hardcode_libdir_flag_spec=\"\"|g' libtool && sed -i 's|^runpath_var=LD_RUN_PATH|runpath_var=DIE_RPATH_DIE|g' libtool" | |||
| URL https://github.com/protocolbuffers/protobuf/archive/v3.8.0.tar.gz | |||
| CONFIGURE_COMMAND ${CMAKE_COMMAND} | |||
| -Dprotobuf_WITH_ZLIB=OFF | |||
| -DCMAKE_INSTALL_LIBDIR=${CMAKE_INSTALL_LIBDIR} | |||
| -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER} | |||
| -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER} | |||
| -DCMAKE_LINKER=${CMAKE_LINKER} | |||
| -DCMAKE_AR=${CMAKE_AR} | |||
| -DCMAKE_RANLIB=${CMAKE_RANLIB} | |||
| -DLIB_PREFIX=ascend_ | |||
| -Dprotobuf_BUILD_TESTS=OFF -DBUILD_SHARED_LIBS=ON -DCMAKE_CXX_FLAGS=${protobuf_CXXFLAGS} -DCMAKE_CXX_LDFLAGS=${protobuf_LDFLAGS} -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX}/protobuf <SOURCE_DIR>/cmake | |||
| BUILD_COMMAND $(MAKE) | |||
| INSTALL_COMMAND $(MAKE) install | |||
| EXCLUDE_FROM_ALL TRUE | |||
| @@ -46,23 +41,25 @@ include(GNUInstallDirs) | |||
| set(PROTOBUF_SHARED_PKG_DIR ${CMAKE_INSTALL_PREFIX}/protobuf) | |||
| add_library(protobuf SHARED IMPORTED) | |||
| add_library(ascend_protobuf SHARED IMPORTED) | |||
| file(MAKE_DIRECTORY ${PROTOBUF_SHARED_PKG_DIR}/include) | |||
| set_target_properties(protobuf PROPERTIES | |||
| IMPORTED_LOCATION ${PROTOBUF_SHARED_PKG_DIR}/lib/libprotobuf.so | |||
| set_target_properties(ascend_protobuf PROPERTIES | |||
| IMPORTED_LOCATION ${PROTOBUF_SHARED_PKG_DIR}/${CMAKE_INSTALL_LIBDIR}/libascend_protobuf.so | |||
| ) | |||
| target_include_directories(protobuf INTERFACE ${PROTOBUF_SHARED_PKG_DIR}/include) | |||
| target_include_directories(ascend_protobuf INTERFACE ${PROTOBUF_SHARED_PKG_DIR}/include) | |||
| set(INSTALL_BASE_DIR "") | |||
| set(INSTALL_LIBRARY_DIR lib) | |||
| install(FILES ${PROTOBUF_SHARED_PKG_DIR}/lib/libprotobuf.so ${PROTOBUF_SHARED_PKG_DIR}/lib/libprotobuf.so.19.0.0 OPTIONAL | |||
| install(FILES ${PROTOBUF_SHARED_PKG_DIR}/${CMAKE_INSTALL_LIBDIR}/ascend_protobuf.so.3.8.0.0 OPTIONAL | |||
| DESTINATION ${INSTALL_LIBRARY_DIR}) | |||
| install(FILES ${PROTOBUF_SHARED_PKG_DIR}/${CMAKE_INSTALL_LIBDIR}/ascend_protobuf.so OPTIONAL | |||
| DESTINATION ${INSTALL_LIBRARY_DIR}) | |||
| add_dependencies(protobuf protobuf_build) | |||
| add_dependencies(ascend_protobuf protobuf_build) | |||
| #set(HAVE_PROTOBUF TRUE CACHE BOOL "protobuf build add") | |||
| set(HAVE_PROTOBUF TRUE) | |||
| @@ -16,7 +16,7 @@ else() | |||
| set(MD5 "3d9e32700639618a4d2d342c99d4507a") | |||
| endif () | |||
| set(protobuf_CXXFLAGS "-Wno-maybe-uninitialized -Wno-unused-parameter -fPIC -fstack-protector-all -D_FORTIFY_SOURCE=2 -D_GLIBCXX_USE_CXX11_ABI=0 -O2") | |||
| set(protobuf_CXXFLAGS "-Wno-maybe-uninitialized -Wno-unused-parameter -fPIC -fstack-protector-all -D_FORTIFY_SOURCE=2 -D_GLIBCXX_USE_CXX11_ABI=0 -O2 -Dgoogle=ascend_private") | |||
| set(protobuf_LDFLAGS "-Wl,-z,relro,-z,now,-z,noexecstack") | |||
| set(PROTOBUF_STATIC_PKG_DIR ${CMAKE_INSTALL_PREFIX}/protobuf_static) | |||
| ExternalProject_Add(protobuf_static_build | |||
| @@ -38,14 +38,14 @@ ExternalProject_Add(protobuf_static_build | |||
| ) | |||
| include(GNUInstallDirs) | |||
| add_library(protobuf_static_lib STATIC IMPORTED) | |||
| add_library(ascend_protobuf_static_lib STATIC IMPORTED) | |||
| set_target_properties(protobuf_static_lib PROPERTIES | |||
| IMPORTED_LOCATION ${PROTOBUF_STATIC_PKG_DIR}/${CMAKE_INSTALL_LIBDIR}/libprotobuf.a | |||
| set_target_properties(ascend_protobuf_static_lib PROPERTIES | |||
| IMPORTED_LOCATION ${PROTOBUF_STATIC_PKG_DIR}/${CMAKE_INSTALL_LIBDIR}/libascend_protobuf.a | |||
| ) | |||
| add_library(protobuf_static INTERFACE) | |||
| target_include_directories(protobuf_static INTERFACE ${PROTOBUF_STATIC_PKG_DIR}/include) | |||
| target_link_libraries(protobuf_static INTERFACE protobuf_static_lib) | |||
| add_library(ascend_protobuf_static INTERFACE) | |||
| target_include_directories(ascend_protobuf_static INTERFACE ${PROTOBUF_STATIC_PKG_DIR}/include) | |||
| target_link_libraries(ascend_protobuf_static INTERFACE ascend_protobuf_static_lib) | |||
| add_dependencies(protobuf_static protobuf_static_build) | |||
| add_dependencies(ascend_protobuf_static protobuf_static_build) | |||
| @@ -1 +1 @@ | |||
| Subproject commit d08620f627a7fb8087271c2dea0677f8a00b96d4 | |||
| Subproject commit 0d0d2fb016d44f9a575ad8f8c2cb8858bba3acec | |||
| @@ -52,6 +52,7 @@ target_compile_options(fmk_parser PRIVATE | |||
| target_compile_definitions(fmk_parser PRIVATE | |||
| PROTOBUF_INLINE_NOT_IN_HEADERS=0 | |||
| google=ascend_private | |||
| ) | |||
| target_include_directories(fmk_parser PRIVATE | |||
| @@ -91,7 +92,7 @@ target_include_directories(fmk_parser PRIVATE | |||
| target_link_libraries(fmk_parser | |||
| $<BUILD_INTERFACE:intf_pub> | |||
| -Wl,--no-as-needed | |||
| protobuf | |||
| ascend_protobuf | |||
| error_manager | |||
| parser_common | |||
| graph | |||
| @@ -35,6 +35,7 @@ target_compile_options(parser_common PRIVATE | |||
| target_compile_definitions(parser_common PRIVATE | |||
| PROTOBUF_INLINE_NOT_IN_HEADERS=0 | |||
| google=ascend_private | |||
| ) | |||
| target_include_directories(parser_common PRIVATE | |||
| @@ -74,7 +75,7 @@ target_link_libraries(parser_common PRIVATE | |||
| $<BUILD_INTERFACE:intf_pub> | |||
| -Wl,--no-as-needed | |||
| graph | |||
| protobuf | |||
| ascend_protobuf | |||
| register | |||
| c_sec | |||
| slog | |||
| @@ -5,7 +5,7 @@ include $(CLEAR_VARS) | |||
| LOCAL_MODULE := libparser_common | |||
| LOCAL_CFLAGS += -DPROTOBUF_INLINE_NOT_IN_HEADERS=0 | |||
| LOCAL_CFLAGS += -Werror | |||
| LOCAL_CFLAGS += -Werror -Dgoogle=ascend_private | |||
| ifeq ($(DEBUG), 1) | |||
| LOCAL_CFLAGS += -g -O0 | |||
| endif | |||
| @@ -83,7 +83,7 @@ LOCAL_C_INCLUDES := \ | |||
| third_party/openssl/include/x86/include \ | |||
| LOCAL_SHARED_LIBRARIES := \ | |||
| libprotobuf \ | |||
| libascend_protobuf \ | |||
| libslog \ | |||
| libgraph \ | |||
| libmmpa \ | |||
| @@ -52,7 +52,7 @@ include $(CLEAR_VARS) | |||
| LOCAL_MODULE := libfmk_parser | |||
| LOCAL_CFLAGS += -DPROTOBUF_INLINE_NOT_IN_HEADERS=0 | |||
| LOCAL_CFLAGS += -Werror | |||
| LOCAL_CFLAGS += -Werror -Dgoogle=ascend_private | |||
| ifeq ($(DEBUG), 1) | |||
| LOCAL_CFLAGS += -g -O0 | |||
| endif | |||
| @@ -107,7 +107,7 @@ LOCAL_SRC_FILES += $(FMK_COMMON_SRC_FILES) | |||
| LOCAL_C_INCLUDES := $(COMMON_LOCAL_C_INCLUDES) | |||
| LOCAL_SHARED_LIBRARIES := \ | |||
| libprotobuf \ | |||
| libascend_protobuf \ | |||
| libslog \ | |||
| libmmpa \ | |||
| libc_sec \ | |||
| @@ -22,6 +22,7 @@ target_compile_options(fmk_onnx_parser PRIVATE | |||
| target_compile_definitions(fmk_onnx_parser PRIVATE | |||
| PROTOBUF_INLINE_NOT_IN_HEADERS=0 | |||
| google=ascend_private | |||
| ) | |||
| target_include_directories(fmk_onnx_parser PRIVATE | |||
| @@ -61,7 +62,7 @@ target_include_directories(fmk_onnx_parser PRIVATE | |||
| target_link_libraries(fmk_onnx_parser PRIVATE | |||
| $<BUILD_INTERFACE:intf_pub> | |||
| -Wl,--no-as-needed | |||
| protobuf | |||
| ascend_protobuf | |||
| register | |||
| c_sec | |||
| parser_common | |||
| @@ -6,7 +6,7 @@ include $(CLEAR_VARS) | |||
| LOCAL_MODULE := libfmk_onnx_parser | |||
| LOCAL_CFLAGS += -DPROTOBUF_INLINE_NOT_IN_HEADERS=0 | |||
| LOCAL_CFLAGS += -Werror | |||
| LOCAL_CFLAGS += -Werror -Dgoogle=ascend_private | |||
| ifeq ($(DEBUG), 1) | |||
| LOCAL_CFLAGS += -g -O0 | |||
| endif | |||
| @@ -38,7 +38,7 @@ LOCAL_C_INCLUDES := \ | |||
| third_party/openssl/include/x86/include \ | |||
| LOCAL_SHARED_LIBRARIES := \ | |||
| libprotobuf \ | |||
| libascend_protobuf \ | |||
| libslog \ | |||
| libmmpa \ | |||
| libc_sec \ | |||
| @@ -7,6 +7,10 @@ protobuf_generate(ge PROTO_SRCS PROTO_HDRS ${PROTO_LIST}) | |||
| ############ lib_caffe_parser.so ############ | |||
| add_library(_caffe_parser SHARED ${PROTO_SRCS}) | |||
| target_compile_definitions(_caffe_parser PRIVATE | |||
| google=ascend_private | |||
| ) | |||
| target_include_directories(_caffe_parser PRIVATE | |||
| ${CMAKE_CURRENT_LIST_DIR} | |||
| ) | |||
| @@ -14,7 +18,7 @@ target_include_directories(_caffe_parser PRIVATE | |||
| target_link_libraries(_caffe_parser PRIVATE | |||
| $<BUILD_INTERFACE:intf_pub> | |||
| -Wl,--no-as-needed | |||
| protobuf | |||
| ascend_protobuf | |||
| -Wl,--as-needed | |||
| ) | |||
| @@ -4,6 +4,7 @@ include $(CLEAR_VARS) | |||
| LOCAL_MODULE := lib_caffe_parser | |||
| LOCAL_CFLAGS += -Dgoogle=ascend_private | |||
| ifeq ($(DEBUG), 1) | |||
| LOCAL_CFLAGS += -g -O0 | |||
| endif | |||
| @@ -15,6 +16,6 @@ LOCAL_C_INCLUDES := \ | |||
| third_party/protobuf/include \ | |||
| LOCAL_SHARED_LIBRARIES := \ | |||
| libprotobuf \ | |||
| libascend_protobuf \ | |||
| include $(BUILD_HOST_SHARED_LIBRARY) | |||