parent
b9244c3081
commit
9d6f983611
@ -1,133 +1,55 @@
|
||||
# Copyright 2019-2020 Huawei Technologies Co., Ltd
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
# ============================================================================
|
||||
|
||||
cmake_minimum_required(VERSION 3.14)
|
||||
project (GraphEngine[CXX])
|
||||
set(CMAKE_CXX_STANDARD 17)
|
||||
add_compile_definitions(_GLIBCXX_USE_CXX11_ABI=0)
|
||||
|
||||
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR})
|
||||
set(GE_SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR})
|
||||
set(GE_PROTO_DIR ${GE_SOURCE_DIR}/)
|
||||
set(GE_CODE_DIR ${CMAKE_CURRENT_LIST_DIR})
|
||||
|
||||
if (NOT BUILD_PATH)
|
||||
set(BUILD_PATH "${CMAKE_SOURCE_DIR}/build")
|
||||
endif()
|
||||
# architecture: aarch64 or x86_64
|
||||
message(STATUS "System architecture: ${CMAKE_HOST_SYSTEM_PROCESSOR}")
|
||||
# system: euleros or ubuntu
|
||||
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
||||
execute_process(
|
||||
COMMAND bash "-c" "cat /etc/os-release | grep ^ID= | awk -F '=' '{print $2}'"
|
||||
OUTPUT_VARIABLE SYSTEM_TYPE
|
||||
)
|
||||
MESSAGE(STATUS "System type: ${SYSTEM_TYPE}.")
|
||||
endif()
|
||||
|
||||
# download json headers, rather than whole repository
|
||||
include(${GE_SOURCE_DIR}/cmake/ge_utils.cmake)
|
||||
include(${GE_SOURCE_DIR}/cmake/external_libs/json.cmake)
|
||||
include(${GE_SOURCE_DIR}/cmake/external_libs/eigen.cmake)
|
||||
include(${GE_SOURCE_DIR}/cmake/external_libs/gtest.cmake)
|
||||
include(${GE_SOURCE_DIR}/cmake/external_libs/protobuf.cmake)
|
||||
include(${GE_SOURCE_DIR}/cmake/external_libs/onnx.cmake)
|
||||
include(${GE_SOURCE_DIR}/cmake/external_libs/securec.cmake)
|
||||
set(CMAKE_SKIP_RPATH TRUE)
|
||||
option(ENABLE_OPEN_SRC "Enable graphengine compile in opensource." FALSE)
|
||||
|
||||
if (ENABLE_OPEN_SRC)
|
||||
set(HI_PYTHON python3.7)
|
||||
|
||||
include(cmake/external_libs/protobuf_shared.cmake)
|
||||
include(cmake/external_libs/protoc.cmake)
|
||||
include(cmake/external_libs/gflags.cmake)
|
||||
include(cmake/external_libs/securec.cmake)
|
||||
include(cmake/external_libs/json.cmake)
|
||||
include(cmake/FindModule.cmake)
|
||||
include(cmake/intf_pub_linux.cmake)
|
||||
|
||||
# for CPU/GPU mode, find c_sec and slog from local prebuild
|
||||
if(NOT ENABLE_D AND NOT GE_ONLY)
|
||||
set(GE_PREBUILD_PATH ${GE_SOURCE_DIR}/third_party/prebuild/${CMAKE_HOST_SYSTEM_PROCESSOR})
|
||||
find_library(slog libslog.so ${GE_PREBUILD_PATH})
|
||||
# if D_LINK_PATH is set in environment variables, search libraries in given path
|
||||
elseif(DEFINED ENV{D_LINK_PATH})
|
||||
# D_LINK_PATH is set
|
||||
set(GE_LIB_PATH $ENV{D_LINK_PATH})
|
||||
set(GE_SYS_ARCH "")
|
||||
if(CMAKE_HOST_SYSTEM_PROCESSOR MATCHES "x86_64")
|
||||
# x86 ubuntu
|
||||
set(GE_SYS_ARCH "x86_64")
|
||||
elseif(CMAKE_HOST_SYSTEM_PROCESSOR MATCHES "aarch64")
|
||||
# arm euleros
|
||||
set(GE_SYS_ARCH "aarch64")
|
||||
else()
|
||||
message(FATAL_ERROR "Running on a unsupported architecture: ${SYSTEM_TYPE}, build terminated")
|
||||
endif()
|
||||
set(GE_LIB_PATH ${GE_LIB_PATH}/${GE_SYS_ARCH})
|
||||
find_library(slog libslog.so ${GE_LIB_PATH})
|
||||
find_library(mmpa libmmpa.so ${GE_LIB_PATH})
|
||||
find_library(runtime libruntime.so ${GE_LIB_PATH})
|
||||
find_library(msprof libmsprof.so ${GE_LIB_PATH})
|
||||
find_library(register libregister.so ${GE_LIB_PATH})
|
||||
find_library(hccl libhccl.so ${GE_LIB_PATH})
|
||||
find_library(resource libresource.so ${GE_LIB_PATH})
|
||||
find_library(error_manager liberror_manager.so ${GE_LIB_PATH})
|
||||
else()
|
||||
# Ascend mode
|
||||
if(DEFINED ENV{ASCEND_CUSTOM_PATH})
|
||||
set(ASCEND_DIR $ENV{ASCEND_CUSTOM_PATH})
|
||||
else()
|
||||
set(ASCEND_DIR /usr/local/Ascend)
|
||||
endif()
|
||||
|
||||
set(ASCEND_DRIVER_DIR ${ASCEND_DIR}/driver/lib64/common)
|
||||
set(ASCEND_RUNTIME_DIR ${ASCEND_DIR}/fwkacllib/lib64)
|
||||
find_library(slog libslog.so ${ASCEND_DRIVER_DIR})
|
||||
find_library(mmpa libmmpa.so ${ASCEND_DRIVER_DIR})
|
||||
find_library(msprof libmsprof.so ${ASCEND_DRIVER_DIR})
|
||||
|
||||
find_library(hccl libhccl.so ${ASCEND_RUNTIME_DIR})
|
||||
find_library(runtime libruntime.so ${ASCEND_RUNTIME_DIR})
|
||||
find_library(register libregister.so ${ASCEND_RUNTIME_DIR})
|
||||
find_library(resource libresource.so ${ASCEND_RUNTIME_DIR})
|
||||
find_library(error_manager liberror_manager.so ${ASCEND_RUNTIME_DIR})
|
||||
endif()
|
||||
|
||||
# add compile flags
|
||||
if ("${CMAKE_BUILD_TYPE}" STREQUAL "Debug")
|
||||
message("Build in Debug mode")
|
||||
set(CMAKE_C_FLAGS "-O0 -g -Wall -fstack-protector-all -Wl,-z,relro,-z,now,-z,noexecstack -pipe -fPIC ${CMAKE_C_FLAGS}")
|
||||
set(CMAKE_CXX_FLAGS "-O0 -g -Wall -fstack-protector-all -Wl,-z,relro,-z,now,-z,noexecstack -pipe -fPIC ${CMAKE_CXX_FLAGS}")
|
||||
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -rdynamic")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -rdynamic")
|
||||
endif()
|
||||
find_module(slog libslog.so ${ASCEND_DRIVER_DIR})
|
||||
find_module(mmpa libmmpa.so ${ASCEND_DRIVER_DIR})
|
||||
find_module(msprof libmsprof.so ${ASCEND_DRIVER_DIR})
|
||||
find_module(hccl libhccl.so ${ASCEND_RUNTIME_DIR})
|
||||
find_module(adump_server libadump_server.a ${ASCEND_RUNTIME_DIR})
|
||||
find_module(runtime libruntime.so ${ASCEND_RUNTIME_DIR})
|
||||
find_module(runtime_compile libruntime_compile.so ${ASCEND_RUNTIME_DIR})
|
||||
find_module(resource libresource.so ${ASCEND_RUNTIME_DIR})
|
||||
find_module(error_manager liberror_manager.so ${ASCEND_RUNTIME_DIR})
|
||||
find_module(ascend_hal_stub libascend_hal.so ${ASCEND_DRIVER_DIR})
|
||||
|
||||
set(METADEF_DIR ${CMAKE_CURRENT_LIST_DIR}/metadef)
|
||||
set(PARSER_DIR ${CMAKE_CURRENT_LIST_DIR}/parser)
|
||||
set(GE_DEPEND_DIR ${CMAKE_CURRENT_LIST_DIR}/..)
|
||||
|
||||
add_subdirectory(metadef)
|
||||
#add_subdirectory(metadef/graph)
|
||||
#add_subdirectory(metadef/register)
|
||||
else()
|
||||
set(CMAKE_C_FLAGS "-O2 -Wall -fPIC -fstack-protector-all -Wl,-z,relro,-z,now,-z,noexecstack -pipe ${CMAKE_C_FLAGS}")
|
||||
set(CMAKE_CXX_FLAGS "-O2 -Wall -fPIC -fstack-protector-all -Wl,-z,relro,-z,now,-z,noexecstack -pipe ${CMAKE_CXX_FLAGS}")
|
||||
set(METADEF_DIR ${CMAKE_CURRENT_LIST_DIR}/../metadef)
|
||||
set(PARSER_DIR ${CMAKE_CURRENT_LIST_DIR}/../parser)
|
||||
set(GE_DEPEND_DIR ${CMAKE_CURRENT_LIST_DIR}/..)
|
||||
endif()
|
||||
|
||||
# force __FILE__ to show relative path of file, from source directory, as cmake project makes __FILE__ absolute directory
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D__FILE__='\"$(subst $(realpath ${CMAKE_SOURCE_DIR})/,,$(abspath $<))\"' -Wno-builtin-macro-redefined")
|
||||
|
||||
# compile libraries from following directories
|
||||
# libgraph is compiled in any situation
|
||||
add_subdirectory(${GE_SOURCE_DIR}/metadef/graph)
|
||||
if(ENABLE_D)
|
||||
# if MindSpore compiles in D mode, compile the following libraries
|
||||
add_subdirectory(${GE_SOURCE_DIR}/ge/common)
|
||||
add_subdirectory(${GE_SOURCE_DIR}/ge/ge_runtime)
|
||||
elseif(GE_ONLY)
|
||||
# standalone GraphEngine compiles all following libraries
|
||||
add_subdirectory(${GE_SOURCE_DIR}/ge/common)
|
||||
add_subdirectory(${GE_SOURCE_DIR}/ge/ge_runtime)
|
||||
add_subdirectory(${GE_SOURCE_DIR}/ge/ge_local_engine)
|
||||
add_subdirectory(${GE_SOURCE_DIR}/ge/graph/build/memory)
|
||||
add_subdirectory(${GE_SOURCE_DIR}/ge/)
|
||||
add_subdirectory(${GE_SOURCE_DIR}/ge/plugin/engine)
|
||||
endif()
|
||||
|
||||
# if (ENABLE_GE_COV OR ENABLE_GE_UT OR ENABLE_GE_ST)
|
||||
# add_subdirectory(tests)
|
||||
# endif()
|
||||
|
||||
add_subdirectory(ge)
|
||||
|
@ -0,0 +1,23 @@
|
||||
#[[
|
||||
module - the name of export imported target
|
||||
name - find the library name
|
||||
path - find the library path
|
||||
#]]
|
||||
function(find_module module name path)
|
||||
if (TARGET ${module})
|
||||
return()
|
||||
endif()
|
||||
find_library(${module}_LIBRARY_DIR NAMES ${name} NAMES_PER_DIR PATHS ${path}
|
||||
PATH_SUFFIXES lib
|
||||
)
|
||||
|
||||
message(STATUS "find ${name} location ${${module}_LIBRARY_DIR}")
|
||||
if ("${${module}_LIBRARY_DIR}" STREQUAL "${module}_LIBRARY_DIR-NOTFOUND")
|
||||
message(FATAL_ERROR "${name} not found in ${path}")
|
||||
endif()
|
||||
|
||||
add_library(${module} SHARED IMPORTED)
|
||||
set_target_properties(${module} PROPERTIES
|
||||
IMPORTED_LOCATION ${${module}_LIBRARY_DIR}
|
||||
)
|
||||
endfunction()
|
@ -1,13 +0,0 @@
|
||||
set(Eigen3_CXXFLAGS "-D_FORTIFY_SOURCE=2 -O2")
|
||||
set(Eigen3_CFLAGS "-D_FORTIFY_SOURCE=2 -O2")
|
||||
set(Eigen3_NS "ge_")
|
||||
graphengine_add_pkg(Eigen3
|
||||
VER 3.3.7
|
||||
URL https://gitlab.com/libeigen/eigen/-/archive/3.3.7/eigen-3.3.7.tar.gz
|
||||
MD5 9e30f67e8531477de4117506fe44669b
|
||||
CMAKE_OPTION -DBUILD_TESTING=OFF)
|
||||
|
||||
find_package(Eigen3 3.3.7 REQUIRED ${GE_FIND_NO_DEFAULT_PATH})
|
||||
set_property(TARGET Eigen3::Eigen PROPERTY IMPORTED_GLOBAL TRUE)
|
||||
add_library(graphengine::eigen ALIAS Eigen3::Eigen)
|
||||
include_directories(${EIGEN3_INCLUDE_DIRS})
|
@ -0,0 +1,38 @@
|
||||
if (HAVE_GFLAGS)
|
||||
return()
|
||||
endif()
|
||||
|
||||
include(ExternalProject)
|
||||
#set(CMAKE_INSTALL_PREFIX ${GE_CODE_DIR}/output)
|
||||
|
||||
if ((${CMAKE_INSTALL_PREFIX} STREQUAL /usr/local) OR
|
||||
(${CMAKE_INSTALL_PREFIX} STREQUAL "C:/Program Files (x86)/ascend"))
|
||||
set(CMAKE_INSTALL_PREFIX ${GE_CODE_DIR}/output CACHE STRING "path for install()" FORCE)
|
||||
message(STATUS "No install prefix selected, default to ${CMAKE_INSTALL_PREFIX}.")
|
||||
endif()
|
||||
|
||||
ExternalProject_Add(gflags_build
|
||||
#URL http://tfk.inhuawei.com/api/containers/container1/download/protobuf-3.8.0.tar.gz
|
||||
#URL /home/txd/workspace/linux_cmake/pkg/protobuf-3.8.0.tar.gz
|
||||
SOURCE_DIR ${GE_CODE_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>
|
||||
BUILD_COMMAND $(MAKE)
|
||||
INSTALL_COMMAND $(MAKE) install
|
||||
EXCLUDE_FROM_ALL TRUE
|
||||
)
|
||||
|
||||
set(GFLAGS_PKG_DIR ${CMAKE_INSTALL_PREFIX}/gflags)
|
||||
|
||||
add_library(gflags_static STATIC IMPORTED)
|
||||
|
||||
set_target_properties(gflags_static PROPERTIES
|
||||
IMPORTED_LOCATION ${GFLAGS_PKG_DIR}/lib/libgflags.a
|
||||
)
|
||||
|
||||
add_library(gflags INTERFACE)
|
||||
target_include_directories(gflags INTERFACE ${GFLAGS_PKG_DIR}/include)
|
||||
target_link_libraries(gflags INTERFACE gflags_static)
|
||||
|
||||
add_dependencies(gflags gflags_build)
|
||||
|
||||
set(HAVE_GFLAGS TRUE CACHE BOOL "gflags build add")
|
@ -1,16 +0,0 @@
|
||||
set(ge_gtest_CXXFLAGS "-D_FORTIFY_SOURCE=2 -O2 -fstack-protector-all -Wl,-z,relro,-z,now,-z,noexecstack")
|
||||
set(ge_gtest_CFLAGS "-D_FORTIFY_SOURCE=2 -O2 -fstack-protector-all -Wl,-z,relro,-z,now,-z,noexecstack")
|
||||
|
||||
graphengine_add_pkg(ge_gtest
|
||||
VER 1.8.0
|
||||
LIBS gtest gtest_main
|
||||
URL https://github.com/google/googletest/archive/release-1.8.0.tar.gz
|
||||
MD5 16877098823401d1bf2ed7891d7dce36
|
||||
CMAKE_OPTION -DBUILD_TESTING=OFF -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DBUILD_SHARED_LIBS=ON
|
||||
-DCMAKE_MACOSX_RPATH=TRUE -Dgtest_disable_pthreads=ON)
|
||||
|
||||
add_library(graphengine::gtest ALIAS ge_gtest::gtest)
|
||||
add_library(graphengine::gtest_main ALIAS ge_gtest::gtest_main)
|
||||
include_directories(${ge_gtest_INC})
|
||||
file(COPY ${ge_gtest_INC}/../lib/libgtest.so DESTINATION ${CMAKE_SOURCE_DIR}/build/graphengine)
|
||||
file(COPY ${ge_gtest_INC}/../lib/libgtest_main.so DESTINATION ${CMAKE_SOURCE_DIR}/build/graphengine)
|
@ -1,9 +1,23 @@
|
||||
set(nlohmann_json_CXXFLAGS "-D_FORTIFY_SOURCE=2 -O2")
|
||||
set(nlohmann_json_CFLAGS "-D_FORTIFY_SOURCE=2 -O2")
|
||||
graphengine_add_pkg(ge_nlohmann_json
|
||||
VER 3.6.1
|
||||
HEAD_ONLY ./
|
||||
URL https://github.com/nlohmann/json/releases/download/v3.6.1/include.zip
|
||||
MD5 0dc903888211db3a0f170304cd9f3a89)
|
||||
include_directories(${ge_nlohmann_json_INC})
|
||||
add_library(graphengine::json ALIAS ge_nlohmann_json)
|
||||
if (HAVE_JSON)
|
||||
return()
|
||||
endif()
|
||||
|
||||
include(ExternalProject)
|
||||
|
||||
set(JSON_SRC_DIR ${GE_CODE_DIR}/../third_party/json/include)
|
||||
ExternalProject_Add(json_build
|
||||
#URL https://github.com/nlohmann/json/releases/download/v3.6.1/include.zip
|
||||
#URL /home/txd/workspace/cloud_code/pkg/include.zip
|
||||
SOURCE_DIR ${JSON_SRC_DIR}
|
||||
CONFIGURE_COMMAND ""
|
||||
BUILD_COMMAND ""
|
||||
INSTALL_COMMAND ""
|
||||
EXCLUDE_FROM_ALL TRUE
|
||||
)
|
||||
|
||||
|
||||
add_library(json INTERFACE)
|
||||
target_include_directories(json INTERFACE ${JSON_SRC_DIR})
|
||||
add_dependencies(json json_build)
|
||||
|
||||
set(HAVE_JSON TRUE CACHE BOOL "json build add")
|
||||
|
@ -1,5 +1,29 @@
|
||||
graphengine_add_pkg(onnx
|
||||
VER 1.6.0
|
||||
HEAD_ONLY ./
|
||||
URL https://github.com/onnx/onnx/releases/download/v1.6.0/onnx-1.6.0.tar.gz
|
||||
MD5 512f2779d6215d4a36f366b6b9acdf1e)
|
||||
include(ExternalProject)
|
||||
|
||||
#set(ONNX_SRC_DIR /home/txd/workspace/cloud_code/graphengine/build/graphengine/open_source/onnx)
|
||||
#set(ONNX_PROTO ${ONNX_SRC_DIR}/onnx/onnx.proto)
|
||||
set(ONNX_PROTO_DIR ${CMAKE_BINARY_DIR}/onnx)
|
||||
set(ONNX_PROTO_FILE ${ONNX_PROTO_DIR}/onnx.proto)
|
||||
file(MAKE_DIRECTORY ${ONNX_PROTO_DIR})
|
||||
|
||||
ExternalProject_Add(onnx
|
||||
#URL https://github.com/onnx/onnx/releases/download/v1.6.0/onnx-1.6.0.tar.gz
|
||||
URL /home/txd/workspace/cloud_code/pkg/onnx-1.6.0.tar.gz
|
||||
#URL_HASH SHA256=3b88c3fe521151651a0403c4d131cb2e0311bd28b753ef692020a432a81ce345
|
||||
#SOURCE_DIR ${ONNX_SRC_DIR}
|
||||
CONFIGURE_COMMAND ""
|
||||
BUILD_COMMAND ""
|
||||
#INSTALL_COMMAND ""
|
||||
INSTALL_COMMAND ${CMAKE_COMMAND} -E copy <SOURCE_DIR>/onnx/onnx.proto ${ONNX_PROTO_FILE}
|
||||
#BUILD_ALWAYS TRUE
|
||||
EXCLUDE_FROM_ALL TRUE
|
||||
)
|
||||
|
||||
macro(onnx_protobuf_generate comp c_var h_var)
|
||||
add_custom_command(OUTPUT ${ONNX_PROTO_FILE}
|
||||
DEPENDS onnx
|
||||
)
|
||||
ge_protobuf_generate(${comp} ${c_var} ${h_var} ${ONNX_PROTO_FILE})
|
||||
endmacro()
|
||||
|
||||
|
||||
|
@ -1,54 +0,0 @@
|
||||
if (NOT TARGET protobuf::protobuf)
|
||||
set(protobuf_USE_STATIC_LIBS ON)
|
||||
set(protobuf_CXXFLAGS "-Wno-maybe-uninitialized -Wno-unused-parameter -fPIC -fstack-protector-all -D_FORTIFY_SOURCE=2 -O2")
|
||||
set(protobuf_LDFLAGS "-Wl,-z,relro,-z,now,-z,noexecstack")
|
||||
set(_ge_tmp_CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})
|
||||
string(REPLACE " -Wall" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
|
||||
string(REPLACE " -Werror" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
|
||||
graphengine_add_pkg(protobuf
|
||||
VER 3.8.0
|
||||
LIBS protobuf
|
||||
EXE protoc
|
||||
URL https://github.com/protocolbuffers/protobuf/archive/v3.8.0.tar.gz
|
||||
MD5 3d9e32700639618a4d2d342c99d4507a
|
||||
CMAKE_PATH ../cmake/
|
||||
CMAKE_OPTION -Dprotobuf_BUILD_TESTS=OFF -Dprotobuf_BUILD_SHARED_LIBS=OFF)
|
||||
set(CMAKE_CXX_FLAGS ${_ge_tmp_CMAKE_CXX_FLAGS})
|
||||
endif()
|
||||
add_library(graphengine::protobuf ALIAS protobuf::protobuf)
|
||||
set(PROTOBUF_LIBRARY protobuf::protobuf)
|
||||
include_directories(${protobuf_INC})
|
||||
include_directories(${protobuf_DIRPATH}/src)
|
||||
|
||||
function(ge_protobuf_generate comp c_var h_var)
|
||||
if(NOT ARGN)
|
||||
message(SEND_ERROR "Error: ge_protobuf_generate() called without any proto files")
|
||||
return()
|
||||
endif()
|
||||
|
||||
set(${c_var})
|
||||
set(${h_var})
|
||||
|
||||
foreach(file ${ARGN})
|
||||
get_filename_component(abs_file ${file} ABSOLUTE)
|
||||
get_filename_component(file_name ${file} NAME_WE)
|
||||
get_filename_component(file_dir ${abs_file} PATH)
|
||||
|
||||
list(APPEND ${c_var} "${CMAKE_BINARY_DIR}/proto/${comp}/proto/${file_name}.pb.cc")
|
||||
list(APPEND ${h_var} "${CMAKE_BINARY_DIR}/proto/${comp}/proto/${file_name}.pb.h")
|
||||
|
||||
add_custom_command(
|
||||
OUTPUT "${CMAKE_BINARY_DIR}/proto/${comp}/proto/${file_name}.pb.cc"
|
||||
"${CMAKE_BINARY_DIR}/proto/${comp}/proto/${file_name}.pb.h"
|
||||
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
|
||||
COMMAND ${CMAKE_COMMAND} -E make_directory "${CMAKE_BINARY_DIR}/proto/${comp}/proto"
|
||||
COMMAND protobuf::protoc -I${file_dir} --cpp_out=${CMAKE_BINARY_DIR}/proto/${comp}/proto ${abs_file}
|
||||
DEPENDS protobuf::protoc ${abs_file}
|
||||
COMMENT "Running C++ protocol buffer compiler on ${file}" VERBATIM )
|
||||
endforeach()
|
||||
|
||||
set_source_files_properties(${${c_var}} ${${h_var}} PROPERTIES GENERATED TRUE)
|
||||
set(${c_var} ${${c_var}} PARENT_SCOPE)
|
||||
set(${h_var} ${${h_var}} PARENT_SCOPE)
|
||||
|
||||
endfunction()
|
@ -0,0 +1,59 @@
|
||||
if (HAVE_PROTOBUF)
|
||||
return()
|
||||
endif()
|
||||
|
||||
include(ExternalProject)
|
||||
include(GNUInstallDirs)
|
||||
|
||||
if ((${CMAKE_INSTALL_PREFIX} STREQUAL /usr/local) OR
|
||||
(${CMAKE_INSTALL_PREFIX} STREQUAL "C:/Program Files (x86)/ascend"))
|
||||
set(CMAKE_INSTALL_PREFIX ${GE_CODE_DIR}/output CACHE STRING "path for install()" FORCE)
|
||||
message(STATUS "No install prefix selected, default to ${CMAKE_INSTALL_PREFIX}.")
|
||||
endif()
|
||||
|
||||
set(protobuf_CXXFLAGS "-Wno-maybe-uninitialized -Wno-unused-parameter -fPIC -fstack-protector-all -D_FORTIFY_SOURCE=2 $<$<STREQUAL:${PRODUCT_SIDE},host>:-D_GLIBCXX_USE_CXX11_ABI=0> -O2")
|
||||
set(protobuf_LDFLAGS "-Wl,-z,relro,-z,now,-z,noexecstack")
|
||||
ExternalProject_Add(protobuf_build
|
||||
#URL http://tfk.inhuawei.com/api/containers/container1/download/protobuf-3.8.0.tar.gz
|
||||
#URL /home/txd/workspace/linux_cmake/pkg/protobuf-3.8.0.tar.gz
|
||||
#SOURCE_DIR ${GE_CODE_DIR}/third_party/protobuf/src/protobuf-3.8.0
|
||||
DOWNLOAD_COMMAND ${CMAKE_COMMAND} -E copy_directory ${GE_CODE_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"
|
||||
BUILD_COMMAND $(MAKE)
|
||||
INSTALL_COMMAND $(MAKE) install
|
||||
EXCLUDE_FROM_ALL TRUE
|
||||
)
|
||||
include(GNUInstallDirs)
|
||||
|
||||
set(PROTOBUF_SHARED_PKG_DIR ${CMAKE_INSTALL_PREFIX}/protobuf)
|
||||
|
||||
add_library(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
|
||||
)
|
||||
|
||||
target_include_directories(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
|
||||
DESTINATION ${INSTALL_LIBRARY_DIR})
|
||||
|
||||
add_dependencies(protobuf protobuf_build)
|
||||
|
||||
set(HAVE_PROTOBUF TRUE CACHE BOOL "protobuf build add")
|
@ -0,0 +1,43 @@
|
||||
include(ExternalProject)
|
||||
include(GNUInstallDirs)
|
||||
#set(CMAKE_INSTALL_PREFIX ${GE_CODE_DIR}/output)
|
||||
|
||||
if ((${CMAKE_INSTALL_PREFIX} STREQUAL /usr/local) OR
|
||||
(${CMAKE_INSTALL_PREFIX} STREQUAL "C:/Program Files (x86)/ascend"))
|
||||
set(CMAKE_INSTALL_PREFIX ${GE_CODE_DIR}/output CACHE STRING "path for install()" FORCE)
|
||||
message(STATUS "No install prefix selected, default to ${CMAKE_INSTALL_PREFIX}.")
|
||||
endif()
|
||||
|
||||
set(protobuf_CXXFLAGS "-Wno-maybe-uninitialized -Wno-unused-parameter -fPIC -fstack-protector-all -D_FORTIFY_SOURCE=2 $<$<STREQUAL:${PRODUCT_SIDE},host>:-D_GLIBCXX_USE_CXX11_ABI=0> -O2")
|
||||
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
|
||||
#URL http://tfk.inhuawei.com/api/containers/container1/download/protobuf-3.8.0.tar.gz
|
||||
#URL /home/txd/workspace/linux_cmake/pkg/protobuf-3.8.0.tar.gz
|
||||
SOURCE_DIR ${GE_CODE_DIR}/../third_party/protobuf/src/protobuf-3.8.0
|
||||
CONFIGURE_COMMAND ${CMAKE_COMMAND}
|
||||
-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
|
||||
-DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
|
||||
-DCMAKE_INSTALL_LIBDIR=${CMAKE_INSTALL_LIBDIR}
|
||||
-DCMAKE_LINKER=${CMAKE_LINKER}
|
||||
-DCMAKE_AR=${CMAKE_AR}
|
||||
-DCMAKE_RANLIB=${CMAKE_RANLIB}
|
||||
-Dprotobuf_WITH_ZLIB=OFF
|
||||
-Dprotobuf_BUILD_TESTS=OFF -DCMAKE_CXX_FLAGS=${protobuf_CXXFLAGS} -DCMAKE_CXX_LDFLAGS=${protobuf_LDFLAGS} -DCMAKE_INSTALL_PREFIX=${PROTOBUF_STATIC_PKG_DIR} <SOURCE_DIR>/cmake
|
||||
BUILD_COMMAND $(MAKE)
|
||||
INSTALL_COMMAND $(MAKE) install
|
||||
EXCLUDE_FROM_ALL TRUE
|
||||
)
|
||||
include(GNUInstallDirs)
|
||||
|
||||
add_library(protobuf_static_lib STATIC IMPORTED)
|
||||
|
||||
set_target_properties(protobuf_static_lib PROPERTIES
|
||||
IMPORTED_LOCATION ${PROTOBUF_STATIC_PKG_DIR}/${CMAKE_INSTALL_LIBDIR}/libprotobuf.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_dependencies(protobuf_static protobuf_static_build)
|
@ -0,0 +1,102 @@
|
||||
if (HAVE_PROTOC)
|
||||
return()
|
||||
endif()
|
||||
|
||||
include(ExternalProject)
|
||||
include(GNUInstallDirs)
|
||||
#set(CMAKE_INSTALL_PREFIX ${GE_CODE_DIR}/output)
|
||||
|
||||
if ((${CMAKE_INSTALL_PREFIX} STREQUAL /usr/local) OR
|
||||
(${CMAKE_INSTALL_PREFIX} STREQUAL "C:/Program Files (x86)/ascend"))
|
||||
set(CMAKE_INSTALL_PREFIX ${GE_CODE_DIR}/output CACHE STRING "path for install()" FORCE)
|
||||
message(STATUS "No install prefix selected, default to ${CMAKE_INSTALL_PREFIX}.")
|
||||
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_LDFLAGS "-Wl,-z,relro,-z,now,-z,noexecstack")
|
||||
ExternalProject_Add(protoc_build
|
||||
#URL http://tfk.inhuawei.com/api/containers/container1/download/protobuf-3.8.0.tar.gz
|
||||
#URL /home/txd/workspace/linux_cmake/pkg/protobuf-3.8.0.tar.gz
|
||||
SOURCE_DIR ${GE_CODE_DIR}/../third_party/protobuf/src/protobuf-3.8.0
|
||||
CONFIGURE_COMMAND ${CMAKE_COMMAND} -Dprotobuf_WITH_ZLIB=OFF -Dprotobuf_BUILD_TESTS=OFF -DBUILD_SHARED_LIBS=OFF -DCMAKE_CXX_FLAGS=${protobuf_CXXFLAGS} -DCMAKE_CXX_LDFLAGS=${protobuf_LDFLAGS} -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX}/protoc <SOURCE_DIR>/cmake
|
||||
BUILD_COMMAND $(MAKE)
|
||||
INSTALL_COMMAND $(MAKE) install
|
||||
EXCLUDE_FROM_ALL TRUE
|
||||
)
|
||||
|
||||
set(PROTOC_PKG_DIR ${CMAKE_INSTALL_PREFIX}/protoc)
|
||||
|
||||
set(protoc_EXECUTABLE ${PROTOC_PKG_DIR}/${CMAKE_INSTALL_BINDIR}/protoc)
|
||||
|
||||
function(protobuf_generate comp c_var h_var)
|
||||
if(NOT ARGN)
|
||||
message(SEND_ERROR "Error: protobuf_generate() called without any proto files")
|
||||
return()
|
||||
endif()
|
||||
set(${c_var})
|
||||
set(${h_var})
|
||||
|
||||
foreach(file ${ARGN})
|
||||
get_filename_component(abs_file ${file} ABSOLUTE)
|
||||
get_filename_component(file_name ${file} NAME_WE)
|
||||
get_filename_component(file_dir ${abs_file} PATH)
|
||||
get_filename_component(parent_subdir ${file_dir} NAME)
|
||||
|
||||
if("${parent_subdir}" STREQUAL "proto")
|
||||
set(proto_output_path ${CMAKE_BINARY_DIR}/proto/${comp}/proto)
|
||||
else()
|
||||
set(proto_output_path ${CMAKE_BINARY_DIR}/proto/${comp}/proto/${parent_subdir})
|
||||
endif()
|
||||
list(APPEND ${c_var} "${proto_output_path}/${file_name}.pb.cc")
|
||||
list(APPEND ${h_var} "${proto_output_path}/${file_name}.pb.h")
|
||||
|
||||
add_custom_command(
|
||||
OUTPUT "${proto_output_path}/${file_name}.pb.cc" "${proto_output_path}/${file_name}.pb.h"
|
||||
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
|
||||
COMMAND ${CMAKE_COMMAND} -E make_directory "${proto_output_path}"
|
||||
COMMAND ${protoc_EXECUTABLE} -I${file_dir} --cpp_out=${proto_output_path} ${abs_file}
|
||||
DEPENDS protoc_build ${abs_file}
|
||||
COMMENT "Running C++ protocol buffer compiler on ${file}" VERBATIM )
|
||||
endforeach()
|
||||
|
||||
set_source_files_properties(${${c_var}} ${${h_var}} PROPERTIES GENERATED TRUE)
|
||||
set(${c_var} ${${c_var}} PARENT_SCOPE)
|
||||
set(${h_var} ${${h_var}} PARENT_SCOPE)
|
||||
|
||||
endfunction()
|
||||
|
||||
function(protobuf_generate_py comp py_var)
|
||||
if(NOT ARGN)
|
||||
message(SEND_ERROR "Error: protobuf_generate_py() called without any proto files")
|
||||
return()
|
||||
endif()
|
||||
set(${py_var})
|
||||
|
||||
foreach(file ${ARGN})
|
||||
get_filename_component(abs_file ${file} ABSOLUTE)
|
||||
get_filename_component(file_name ${file} NAME_WE)
|
||||
get_filename_component(file_dir ${abs_file} PATH)
|
||||
get_filename_component(parent_subdir ${file_dir} NAME)
|
||||
|
||||
if("${parent_subdir}" STREQUAL "proto")
|
||||
set(proto_output_path ${CMAKE_BINARY_DIR}/proto/${comp}/proto)
|
||||
else()
|
||||
set(proto_output_path ${CMAKE_BINARY_DIR}/proto/${comp}/proto/${parent_subdir})
|
||||
endif()
|
||||
list(APPEND ${py_var} "${proto_output_path}/${file_name}_pb2.py")
|
||||
|
||||
add_custom_command(
|
||||
OUTPUT "${proto_output_path}/${file_name}_pb2.py"
|
||||
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
|
||||
COMMAND ${CMAKE_COMMAND} -E make_directory "${proto_output_path}"
|
||||
COMMAND ${protoc_EXECUTABLE} -I${file_dir} --python_out=${proto_output_path} ${abs_file}
|
||||
DEPENDS protoc_build ${abs_file}
|
||||
COMMENT "Running PYTHON protocol buffer compiler on ${file}" VERBATIM )
|
||||
endforeach()
|
||||
|
||||
set_source_files_properties(${${py_var}} PROPERTIES GENERATED TRUE)
|
||||
set(${py_var} ${${py_var}} PARENT_SCOPE)
|
||||
|
||||
endfunction()
|
||||
|
||||
set(HAVE_PROTOC TRUE CACHE BOOL "protoc build add")
|
@ -1,11 +1,60 @@
|
||||
graphengine_add_pkg(securec
|
||||
VER 1.1.10
|
||||
URL https://gitee.com/openeuler/bounds_checking_function/repository/archive/v1.1.10.tar.gz
|
||||
MD5 0782dd2351fde6920d31a599b23d8c91
|
||||
LIBS c_sec
|
||||
PATCHES ${GE_SOURCE_DIR}/third_party/patch/securec/securec.patch001
|
||||
CMAKE_OPTION "-DCMAKE_BUILD_TYPE=Release"
|
||||
if (HAVE_C_SEC)
|
||||
return()
|
||||
endif()
|
||||
|
||||
include(ExternalProject)
|
||||
|
||||
if ((${CMAKE_INSTALL_PREFIX} STREQUAL /usr/local) OR
|
||||
(${CMAKE_INSTALL_PREFIX} STREQUAL "C:/Program Files (x86)/ascend"))
|
||||
set(CMAKE_INSTALL_PREFIX ${GE_CODE_DIR}/output CACHE STRING "path for install()" FORCE)
|
||||
message(STATUS "No install prefix selected, default to ${CMAKE_INSTALL_PREFIX}.")
|
||||
endif()
|
||||
|
||||
ExternalProject_Add(c_sec_build
|
||||
#URL http://tfk.inhuawei.com/api/containers/container1/download/protobuf-3.8.0.tar.gz
|
||||
#URL /home/txd/workspace/linux_cmake/pkg/protobuf-3.8.0.tar.gz
|
||||
SOURCE_DIR ${GE_CODE_DIR}/../libc_sec
|
||||
CONFIGURE_COMMAND ${CMAKE_COMMAND}
|
||||
-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
|
||||
-DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
|
||||
-DCMAKE_LINKER=${CMAKE_LINKER}
|
||||
-DCMAKE_AR=${CMAKE_AR}
|
||||
-DCMAKE_RANLIB=${CMAKE_RANLIB}
|
||||
-DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX}/c_sec <SOURCE_DIR>
|
||||
BUILD_COMMAND $(MAKE)
|
||||
INSTALL_COMMAND $(MAKE) install
|
||||
EXCLUDE_FROM_ALL TRUE
|
||||
)
|
||||
include_directories(${securec_INC})
|
||||
file(COPY ${securec_INC}/../lib/libc_sec.so DESTINATION ${CMAKE_SOURCE_DIR}/build/graphengine)
|
||||
add_library(graphengine::securec ALIAS securec::c_sec)
|
||||
|
||||
set(C_SEC_PKG_DIR ${CMAKE_INSTALL_PREFIX}/c_sec)
|
||||
|
||||
add_library(c_sec SHARED IMPORTED)
|
||||
|
||||
file(MAKE_DIRECTORY ${C_SEC_PKG_DIR}/include)
|
||||
|
||||
set_target_properties(c_sec PROPERTIES
|
||||
IMPORTED_LOCATION ${C_SEC_PKG_DIR}/lib/libc_sec.so
|
||||
)
|
||||
|
||||
target_include_directories(c_sec INTERFACE ${C_SEC_PKG_DIR}/include)
|
||||
|
||||
add_dependencies(c_sec c_sec_build)
|
||||
|
||||
set(INSTALL_BASE_DIR "")
|
||||
set(INSTALL_LIBRARY_DIR lib)
|
||||
|
||||
install(FILES ${C_SEC_PKG_DIR}/lib/libc_sec.so OPTIONAL
|
||||
DESTINATION ${INSTALL_LIBRARY_DIR})
|
||||
|
||||
add_library(c_sec_static_lib STATIC IMPORTED)
|
||||
set_target_properties(c_sec_static_lib PROPERTIES
|
||||
IMPORTED_LOCATION ${C_SEC_PKG_DIR}/lib/libc_sec.a
|
||||
)
|
||||
|
||||
add_library(c_sec_static INTERFACE)
|
||||
target_include_directories(c_sec_static INTERFACE ${C_SEC_PKG_DIR}/include)
|
||||
target_link_libraries(c_sec_static INTERFACE c_sec_static_lib)
|
||||
|
||||
add_dependencies(c_sec_static c_sec_build)
|
||||
|
||||
set(HAVE_C_SEC TRUE CACHE BOOL "c_sec build add")
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,52 @@
|
||||
|
||||
add_library(intf_pub INTERFACE)
|
||||
|
||||
target_compile_options(intf_pub INTERFACE
|
||||
-Wall
|
||||
-fPIC
|
||||
-fstack-protector-strong
|
||||
)
|
||||
target_compile_definitions(intf_pub INTERFACE
|
||||
$<$<STREQUAL:${PRODUCT_SIDE},host>:_GLIBCXX_USE_CXX11_ABI=0>
|
||||
$<$<CONFIG:Release>:CFG_BUILD_NDEBUG>
|
||||
$<$<CONFIG:Debug>:CFG_BUILD_DEBUG>
|
||||
WIN64=1
|
||||
LINUX=0
|
||||
)
|
||||
target_link_options(intf_pub INTERFACE
|
||||
-Wl,-z,relro
|
||||
-Wl,-z,now
|
||||
-Wl,-z,noexecstack
|
||||
$<$<CONFIG:Release>:-Wl,--build-id=none>
|
||||
)
|
||||
target_link_directories(intf_pub INTERFACE
|
||||
)
|
||||
|
||||
add_library(intf_ccec INTERFACE)
|
||||
target_compile_options(intf_ccec INTERFACE
|
||||
-mcpu=cortex-a73
|
||||
--target=aarch64-linux-android29
|
||||
--sysroot=${HCC_PATH}/../sysroot
|
||||
-L${HCC_PATH}/../lib/gcc/aarch64-linux-android/4.9.x
|
||||
-Wall
|
||||
-fPIC
|
||||
-fstack-protector-strong
|
||||
)
|
||||
target_compile_definitions(intf_ccec INTERFACE
|
||||
$<$<STREQUAL:${PRODUCT_SIDE},host>:_GLIBCXX_USE_CXX11_ABI=0>
|
||||
$<$<CONFIG:Release>:CFG_BUILD_NDEBUG>
|
||||
$<$<CONFIG:Debug>:CFG_BUILD_DEBUG>
|
||||
)
|
||||
|
||||
target_link_options(intf_ccec INTERFACE
|
||||
-mcpu=cortex-a73
|
||||
--target=aarch64-linux-android29
|
||||
--sysroot=${HCC_PATH}/../sysroot
|
||||
-L${HCC_PATH}/../lib/gcc/aarch64-linux-android/4.9.x
|
||||
-Wl,-cce-host-android
|
||||
-Wl,-z,relro
|
||||
-Wl,-z,now
|
||||
-Wl,-z,noexecstack
|
||||
$<$<CONFIG:Release>:-Wl,--build-id=none>
|
||||
)
|
||||
|
@ -0,0 +1,32 @@
|
||||
if (HAVE_PUB)
|
||||
return()
|
||||
endif()
|
||||
|
||||
add_library(intf_pub INTERFACE)
|
||||
|
||||
target_compile_options(intf_pub INTERFACE
|
||||
-Wall
|
||||
-fPIC
|
||||
$<IF:$<STREQUAL:${CMAKE_SYSTEM_NAME},centos>,-fstack-protector-all,-fstack-protector-strong>
|
||||
$<$<COMPILE_LANGUAGE:CXX>:-std=c++11>
|
||||
)
|
||||
target_compile_definitions(intf_pub INTERFACE
|
||||
$<$<STREQUAL:${PRODUCT_SIDE},host>:_GLIBCXX_USE_CXX11_ABI=0>
|
||||
$<$<CONFIG:Release>:CFG_BUILD_NDEBUG>
|
||||
$<$<CONFIG:Debug>:CFG_BUILD_DEBUG>
|
||||
WIN64=1
|
||||
LINUX=0
|
||||
)
|
||||
target_link_options(intf_pub INTERFACE
|
||||
-Wl,-z,relro
|
||||
-Wl,-z,now
|
||||
-Wl,-z,noexecstack
|
||||
$<$<CONFIG:Release>:-Wl,--build-id=none>
|
||||
)
|
||||
target_link_directories(intf_pub INTERFACE
|
||||
)
|
||||
target_link_libraries(intf_pub INTERFACE
|
||||
-lpthread
|
||||
)
|
||||
|
||||
set(HAVE_PUB TRUE CACHE BOOL "pub add")
|
@ -0,0 +1,24 @@
|
||||
|
||||
add_library(intf_pub INTERFACE)
|
||||
|
||||
target_compile_options(intf_pub INTERFACE
|
||||
-Wall
|
||||
-fPIC
|
||||
$<IF:$<STREQUAL:${OS_TYPE},centos>,-fstack-protector-all,-fstack-protector-strong>
|
||||
$<$<COMPILE_LANGUAGE:CXX>:-std=c++11>
|
||||
)
|
||||
target_compile_definitions(intf_pub INTERFACE
|
||||
$<$<STREQUAL:${PRODUCT_SIDE},host>:_GLIBCXX_USE_CXX11_ABI=0>
|
||||
OS_TYPE=WIN64
|
||||
WIN64=1
|
||||
LINUX=0
|
||||
$<$<CONFIG:Release>:CFG_BUILD_NDEBUG>
|
||||
$<$<CONFIG:Debug>:CFG_BUILD_DEBUG>
|
||||
)
|
||||
target_link_options(intf_pub INTERFACE
|
||||
$<$<CONFIG:Release>:-Wl,--build-id=none>
|
||||
)
|
||||
target_link_directories(intf_pub INTERFACE
|
||||
)
|
||||
target_link_libraries(intf_pub INTERFACE
|
||||
)
|
File diff suppressed because it is too large
Load Diff
@ -1,72 +0,0 @@
|
||||
# Copyright 2019-2020 Huawei Technologies Co., Ltd
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
# ============================================================================
|
||||
|
||||
# libge_client.so
|
||||
# add all proto files, generate corresponding .h and .cc files
|
||||
set(CMAKE_CXX_FLAGS "-Wno-unused-variable ${CMAKE_CXX_FLAGS}")
|
||||
file(GLOB PROTO_LIST RELATIVE ${CMAKE_CURRENT_LIST_DIR}
|
||||
"../proto/ge_api.proto"
|
||||
)
|
||||
|
||||
file(GLOB PROTO_HEADER_LIST RELATIVE ${CMAKE_CURRENT_LIST_DIR}
|
||||
"../proto/ge_ir.proto"
|
||||
"../proto/task.proto"
|
||||
"../proto/om.proto"
|
||||
"../proto/insert_op.proto"
|
||||
)
|
||||
|
||||
file(GLOB SRC_LIST RELATIVE ${CMAKE_CURRENT_LIST_DIR}
|
||||
"ge_api.cc"
|
||||
"ge_prof.cc"
|
||||
)
|
||||
|
||||
ge_protobuf_generate(ge PROTO_SRCS PROTO_HDRS ${PROTO_LIST})
|
||||
ge_protobuf_generate(ge PROTO_HEADER_SRCS PROTO_HEADER_HDRS ${PROTO_HEADER_LIST})
|
||||
|
||||
# include directories
|
||||
include_directories(${CMAKE_CURRENT_LIST_DIR})
|
||||
include_directories(${GE_SOURCE_DIR}/ge)
|
||||
include_directories(${GE_SOURCE_DIR}/inc)
|
||||
include_directories(${GE_SOURCE_DIR}/inc/external)
|
||||
include_directories(${GE_SOURCE_DIR}/inc/common)
|
||||
include_directories(${GE_SOURCE_DIR}/inc/framework)
|
||||
include_directories(${GE_SOURCE_DIR}/metadef/inc)
|
||||
include_directories(${GE_SOURCE_DIR}/metadef/inc/external/graph)
|
||||
include_directories(${GE_SOURCE_DIR}/metadef/inc/graph)
|
||||
include_directories(${GE_SOURCE_DIR}/third_party/fwkacllib/inc)
|
||||
include_directories(${GE_SOURCE_DIR}/third_party/fwkacllib/inc/cce)
|
||||
include_directories(${CMAKE_BINARY_DIR})
|
||||
include_directories(${CMAKE_BINARY_DIR}/proto/ge)
|
||||
|
||||
############ libge_client.so ################
|
||||
add_library(ge_client SHARED ${SRC_LIST} ${PROTO_SRCS} ${PROTO_HEADER_HDRS})
|
||||
target_compile_definitions(ge_client PRIVATE
|
||||
Werror
|
||||
PROTOBUF_INLINE_NOT_IN_HEADERS=0
|
||||
REUSE_MEMORY=1
|
||||
PLATFORM_CLOUD)
|
||||
target_link_libraries(ge_client
|
||||
graph
|
||||
ge_compiler
|
||||
ge_common
|
||||
${PROTOBUF_LIBRARY}
|
||||
${register}
|
||||
${c_sec}
|
||||
${slog}
|
||||
${mmpa}
|
||||
${runtime}
|
||||
${msprof}
|
||||
rt
|
||||
dl)
|
@ -0,0 +1 @@
|
||||
../../proto/ge_api.proto
|
@ -0,0 +1 @@
|
||||
../../proto/ge_ir.proto
|
@ -0,0 +1 @@
|
||||
../../proto/insert_op.proto
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue