Browse Source

update atc cmakelist

tags/v1.1.0
taoxiangdong 3 years ago
parent
commit
4e5550be4a
4 changed files with 17 additions and 6 deletions
  1. +5
    -0
      CMakeLists.txt
  2. +1
    -2
      cmake/external_libs/protobuf_shared.cmake
  3. +1
    -1
      cmake/external_libs/protobuf_static.cmake
  4. +10
    -3
      ge/CMakeLists.txt

+ 5
- 0
CMakeLists.txt View File

@@ -49,6 +49,8 @@ if (ENABLE_OPEN_SRC)
find_module(resource libresource.so ${GE_LIB_PATH})
find_module(error_manager liberror_manager.so ${GE_LIB_PATH})
find_module(ascend_hal_stub libascend_hal.so ${GE_LIB_PATH})
find_module(error_manager_static liberror_manager.a ${GE_LIB_PATH})
find_module(msprofiler libmsprofiler.a ${GE_LIB_PATH})
else()
if(DEFINED ENV{ASCEND_CUSTOM_PATH})
set(ASCEND_DIR $ENV{ASCEND_CUSTOM_PATH})
@@ -59,6 +61,7 @@ if (ENABLE_OPEN_SRC)
set(ASCEND_DRIVER_COMMON_DIR ${ASCEND_DIR}/driver/lib64/common)
set(ASCEND_RUNTIME_DIR ${ASCEND_DIR}/fwkacllib/lib64)
set(ASCEND_ATC_DIR ${ASCEND_DIR}/atc/lib64)
set(ASCEND_ACL_DIR ${ASCEND_DIR}/acllib/lib64)
find_module(slog libslog.so ${ASCEND_DRIVER_DIR})
find_module(mmpa libmmpa.so ${ASCEND_DRIVER_DIR})
find_module(msprof libmsprof.so ${ASCEND_DRIVER_DIR})
@@ -69,6 +72,8 @@ if (ENABLE_OPEN_SRC)
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})
find_module(error_manager_static liberror_manager.a ${ASCEND_ACL_DIR})
find_module(msprofiler libmsprofiler.a ${ASCEND_ACL_DIR})
endif()

set(METADEF_DIR ${CMAKE_CURRENT_LIST_DIR}/metadef)


+ 1
- 2
cmake/external_libs/protobuf_shared.cmake View File

@@ -10,8 +10,7 @@ if ((${CMAKE_INSTALL_PREFIX} STREQUAL /usr/local) OR
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_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(protobuf_build
URL https://github.com/protocolbuffers/protobuf/archive/v3.8.0.tar.gz


+ 1
- 1
cmake/external_libs/protobuf_static.cmake View File

@@ -8,7 +8,7 @@ if ((${CMAKE_INSTALL_PREFIX} STREQUAL /usr/local) OR
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_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")
set(PROTOBUF_STATIC_PKG_DIR ${CMAKE_INSTALL_PREFIX}/protobuf_static)
ExternalProject_Add(protobuf_static_build


+ 10
- 3
ge/CMakeLists.txt View File

@@ -441,6 +441,7 @@ set(INFER_SRC_LIST
"graph/partition/engine_place.cc"
"graph/partition/graph_partition.cc"
"graph/partition/dynamic_shape_partition.cc"
"graph/partition/stage_partition.cc"
"generator/ge_generator.cc"
"generator/generator_api.cc"
"graph/manager/graph_var_manager.cc"
@@ -712,7 +713,15 @@ add_library(dummy_obj OBJECT ${CMAKE_BINARY_DIR}/dummy.c)
set(DUMMY_OBJ $<TARGET_OBJECTS:dummy_obj>)

add_library(opensrc_ascendcl SHARED ${DUMMY_OBJ})

target_compile_options(opensrc_ascendcl PRIVATE
-O2
-fvisibility=hidden
)
target_link_options(opensrc_ascendcl PRIVATE
-rdynamic
-Wl,-Bsymbolic
-Wl,--exclude-libs,ALL
)
target_link_libraries(opensrc_ascendcl PRIVATE
-Wl, --whole-archive
ge_executor
@@ -733,9 +742,7 @@ target_link_libraries(opensrc_ascendcl PRIVATE
msprof
ascend_hal_stub
-Wl, --as-needed
$<$<NOT:$<STREQUAL:${TARGET_SYSTEM_NAME}, Android>>:-lrt>
-ldl
$<$<STREQUAL:${TARGET_SYSTEM_NAME}, Android>:-llog>
json
)



Loading…
Cancel
Save