| @@ -22,7 +22,7 @@ if (ENABLE_OPEN_SRC) | |||||
| # for CPU/GPU mode, find c_sec and slog from local prebuild | # for CPU/GPU mode, find c_sec and slog from local prebuild | ||||
| if(NOT ENABLE_D AND NOT GE_ONLY) | if(NOT ENABLE_D AND NOT GE_ONLY) | ||||
| set(GE_PREBUILD_PATH ${GE_SOURCE_DIR}/third_party/prebuild/${CMAKE_HOST_SYSTEM_PROCESSOR}) | |||||
| set(GE_PREBUILD_PATH ${GE_CODE_DIR}/third_party/prebuild/${CMAKE_HOST_SYSTEM_PROCESSOR}) | |||||
| find_module(slog libslog.so ${GE_PREBUILD_PATH}) | find_module(slog libslog.so ${GE_PREBUILD_PATH}) | ||||
| # if D_LINK_PATH is set in environment variables, search libraries in given path | # if D_LINK_PATH is set in environment variables, search libraries in given path | ||||
| elseif(DEFINED ENV{D_LINK_PATH}) | elseif(DEFINED ENV{D_LINK_PATH}) | ||||
| @@ -117,7 +117,7 @@ build_graphengine() | |||||
| CMAKE_ARGS="${CMAKE_ARGS} -DENABLE_GE_ST=ON" | CMAKE_ARGS="${CMAKE_ARGS} -DENABLE_GE_ST=ON" | ||||
| fi | fi | ||||
| CMAKE_ARGS="${CMAKE_ARGS} -DENABLE_OPEN_SRC=True | |||||
| CMAKE_ARGS="${CMAKE_ARGS} -DENABLE_OPEN_SRC=True" | |||||
| echo "${CMAKE_ARGS}" | echo "${CMAKE_ARGS}" | ||||
| cmake ${CMAKE_ARGS} ../.. | cmake ${CMAKE_ARGS} ../.. | ||||
| make ${VERBOSE} -j${THREAD_NUM} | make ${VERBOSE} -j${THREAD_NUM} | ||||
| @@ -16,7 +16,7 @@ set(protobuf_LDFLAGS "-Wl,-z,relro,-z,now,-z,noexecstack") | |||||
| ExternalProject_Add(protobuf_build | ExternalProject_Add(protobuf_build | ||||
| URL https://github.com/protocolbuffers/protobuf/archive/v3.8.0.tar.gz | URL https://github.com/protocolbuffers/protobuf/archive/v3.8.0.tar.gz | ||||
| #URL /home/txd/workspace/linux_cmake/pkg/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 | |||||
| #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> | DOWNLOAD_COMMAND ${CMAKE_COMMAND} -E copy_directory ${GE_CODE_DIR}/../third_party/protobuf/src/protobuf-3.8.0 <SOURCE_DIR> | ||||
| #CONFIGURE_COMMAND ${CMAKE_COMMAND} | #CONFIGURE_COMMAND ${CMAKE_COMMAND} | ||||
| #-DCMAKE_INSTALL_LIBDIR=${CMAKE_INSTALL_LIBDIR} | #-DCMAKE_INSTALL_LIBDIR=${CMAKE_INSTALL_LIBDIR} | ||||
| @@ -4,7 +4,7 @@ add_subdirectory(graph/build/memory) | |||||
| add_subdirectory(ge_local_engine) | add_subdirectory(ge_local_engine) | ||||
| add_subdirectory(host_cpu_engine) | add_subdirectory(host_cpu_engine) | ||||
| add_subdirectory(executor) | add_subdirectory(executor) | ||||
| #add_subdirectory(offline) | |||||
| add_subdirectory(offline) | |||||
| set(PROTO_LIST | set(PROTO_LIST | ||||
| "${METADEF_DIR}/proto/fusion_model.proto" | "${METADEF_DIR}/proto/fusion_model.proto" | ||||
| @@ -704,6 +704,42 @@ target_link_libraries(ge_compiler | |||||
| -ldl | -ldl | ||||
| ) | ) | ||||
| ############ libascendcl.so ############ | |||||
| add_library(opensrc_ascendc SHARED ${DUMMY_OBJ}) | |||||
| target_link_libraries(opensrc_ascendcl PRIVATE | |||||
| -Wl, --whole-archive | |||||
| ge_executor | |||||
| ascendcl_static | |||||
| ge_common_static | |||||
| graph_static | |||||
| protobuf_static | |||||
| register_static | |||||
| error_manager_static | |||||
| adump_server | |||||
| msprofiler | |||||
| -Wl, --no-whole-archive | |||||
| -Wl, --no-as-needed | |||||
| c_sec | |||||
| runtime | |||||
| mmpa | |||||
| slog | |||||
| msprof | |||||
| ascend_hal_stub | |||||
| -Wl, --as-needed | |||||
| $<$<NOT:$<STREQUAL:${TARGET_SYSTEM_NAME}, Android>>:-lrt> | |||||
| -ldl | |||||
| $<$<STREQUAL:${TARGET_SYSTEM_NAME}, Android>:-llog> | |||||
| json | |||||
| ) | |||||
| set_target_properties(opensrc_ascendc PROPERTIES | |||||
| OUTPUT_NAME ascendcl | |||||
| ) | |||||
| file(GENERATE OUTPUT ${CMAKE_BINARY_DIR}/dummy.c CONTENT "") | |||||
| add_library(dummy_obj OBJECT ${CMAKE_BINARY_DIR}/dummy.c) | |||||
| set(DUMMY_OBJ $<TARGET_OBJECTS:dummy_obj>) | |||||
| ################################################################## | ################################################################## | ||||
| add_custom_command( | add_custom_command( | ||||
| @@ -786,6 +822,7 @@ target_include_directories(fwk_stub_ge_runner PRIVATE | |||||
| ${GE_CODE_DIR}/inc/external | ${GE_CODE_DIR}/inc/external | ||||
| ${GE_CODE_DIR}/inc/framework | ${GE_CODE_DIR}/inc/framework | ||||
| ${GE_CODE_DIR}/inc/framework/common | ${GE_CODE_DIR}/inc/framework/common | ||||
| ${METADEF_DIR}/inc/external | |||||
| ${METADEF_DIR}/inc/external/graph | ${METADEF_DIR}/inc/external/graph | ||||
| ${METADEF_DIR}/inc/graph | ${METADEF_DIR}/inc/graph | ||||
| #### yellow zone #### | #### yellow zone #### | ||||
| @@ -90,6 +90,7 @@ target_include_directories(ge_executor PRIVATE | |||||
| ${GE_CODE_DIR}/inc | ${GE_CODE_DIR}/inc | ||||
| ${GE_CODE_DIR}/inc/external | ${GE_CODE_DIR}/inc/external | ||||
| ${GE_CODE_DIR}/inc/framework | ${GE_CODE_DIR}/inc/framework | ||||
| ${GE_CODE_DIR}/third_party/fwkacllib/inc | |||||
| ${METADEF_DIR}/inc | ${METADEF_DIR}/inc | ||||
| ${METADEF_DIR}/inc/external | ${METADEF_DIR}/inc/external | ||||
| ${METADEF_DIR}/inc/external/graph | ${METADEF_DIR}/inc/external/graph | ||||
| @@ -34,6 +34,7 @@ target_include_directories(ge_local_engine PRIVATE | |||||
| ${GE_CODE_DIR}/inc | ${GE_CODE_DIR}/inc | ||||
| ${GE_CODE_DIR}/inc/external | ${GE_CODE_DIR}/inc/external | ||||
| ${GE_CODE_DIR}/inc/framework | ${GE_CODE_DIR}/inc/framework | ||||
| ${GE_CODE_DIR}/third_party/fwkacllib/inc | |||||
| ${METADEF_DIR}/inc | ${METADEF_DIR}/inc | ||||
| ${METADEF_DIR}/inc/external | ${METADEF_DIR}/inc/external | ||||
| ${METADEF_DIR}/inc/external/graph | ${METADEF_DIR}/inc/external/graph | ||||
| @@ -73,6 +74,7 @@ target_include_directories(atc_ge_local_engine PRIVATE | |||||
| ${GE_CODE_DIR}/inc | ${GE_CODE_DIR}/inc | ||||
| ${GE_CODE_DIR}/inc/external | ${GE_CODE_DIR}/inc/external | ||||
| ${GE_CODE_DIR}/inc/framework | ${GE_CODE_DIR}/inc/framework | ||||
| ${GE_CODE_DIR}/third_party/fwkacllib/inc | |||||
| ${METADEF_DIR}/inc | ${METADEF_DIR}/inc | ||||
| ${METADEF_DIR}/inc/external | ${METADEF_DIR}/inc/external | ||||
| ${METADEF_DIR}/inc/external/graph | ${METADEF_DIR}/inc/external/graph | ||||
| @@ -113,6 +115,7 @@ target_include_directories(ge_local_opskernel_builder PRIVATE | |||||
| ${GE_CODE_DIR}/inc | ${GE_CODE_DIR}/inc | ||||
| ${GE_CODE_DIR}/inc/external | ${GE_CODE_DIR}/inc/external | ||||
| ${GE_CODE_DIR}/inc/framework | ${GE_CODE_DIR}/inc/framework | ||||
| ${GE_CODE_DIR}/third_party/fwkacllib/inc | |||||
| ${METADEF_DIR}/inc | ${METADEF_DIR}/inc | ||||
| ${METADEF_DIR}/inc/external | ${METADEF_DIR}/inc/external | ||||
| ${METADEF_DIR}/inc/external/graph | ${METADEF_DIR}/inc/external/graph | ||||
| @@ -147,6 +150,7 @@ target_include_directories(atc_ge_local_opskernel_builder PRIVATE | |||||
| ${GE_CODE_DIR}/inc | ${GE_CODE_DIR}/inc | ||||
| ${GE_CODE_DIR}/inc/external | ${GE_CODE_DIR}/inc/external | ||||
| ${GE_CODE_DIR}/inc/framework | ${GE_CODE_DIR}/inc/framework | ||||
| ${GE_CODE_DIR}/third_party/fwkacllib/inc | |||||
| ${METADEF_DIR}/inc | ${METADEF_DIR}/inc | ||||
| ${METADEF_DIR}/inc/external | ${METADEF_DIR}/inc/external | ||||
| ${METADEF_DIR}/inc/external/graph | ${METADEF_DIR}/inc/external/graph | ||||
| @@ -186,6 +190,7 @@ target_include_directories(ge_local_opskernel_builder_static PRIVATE | |||||
| ${GE_CODE_DIR}/inc | ${GE_CODE_DIR}/inc | ||||
| ${GE_CODE_DIR}/inc/external | ${GE_CODE_DIR}/inc/external | ||||
| ${GE_CODE_DIR}/inc/framework | ${GE_CODE_DIR}/inc/framework | ||||
| ${GE_CODE_DIR}/third_party/fwkacllib/inc | |||||
| ${METADEF_DIR}/inc | ${METADEF_DIR}/inc | ||||
| ${METADEF_DIR}/inc/external | ${METADEF_DIR}/inc/external | ||||
| ${METADEF_DIR}/inc/external/graph | ${METADEF_DIR}/inc/external/graph | ||||
| @@ -31,6 +31,7 @@ target_include_directories(ge_memory PRIVATE | |||||
| ${METADEF_DIR}/inc/external | ${METADEF_DIR}/inc/external | ||||
| ${METADEF_DIR}/inc/external/graph | ${METADEF_DIR}/inc/external/graph | ||||
| ${GE_CODE_DIR}/inc/framework | ${GE_CODE_DIR}/inc/framework | ||||
| ${GE_CODE_DIR}/third_party/fwkacllib/inc | |||||
| #### yellow zone #### | #### yellow zone #### | ||||
| ${GE_CODE_DIR}/../inc | ${GE_CODE_DIR}/../inc | ||||
| ) | ) | ||||
| @@ -28,6 +28,7 @@ target_include_directories(host_cpu_engine PRIVATE | |||||
| ${GE_CODE_DIR}/inc | ${GE_CODE_DIR}/inc | ||||
| ${GE_CODE_DIR}/inc/external | ${GE_CODE_DIR}/inc/external | ||||
| ${GE_CODE_DIR}/inc/framework | ${GE_CODE_DIR}/inc/framework | ||||
| ${GE_CODE_DIR}/third_party/fwkacllib/inc | |||||
| ${METADEF_DIR}/inc | ${METADEF_DIR}/inc | ||||
| ${METADEF_DIR}/inc/external | ${METADEF_DIR}/inc/external | ||||
| ${METADEF_DIR}/inc/external/graph | ${METADEF_DIR}/inc/external/graph | ||||
| @@ -66,6 +67,7 @@ target_include_directories(atc_host_cpu_engine PRIVATE | |||||
| ${GE_CODE_DIR}/inc | ${GE_CODE_DIR}/inc | ||||
| ${GE_CODE_DIR}/inc/external | ${GE_CODE_DIR}/inc/external | ||||
| ${GE_CODE_DIR}/inc/framework | ${GE_CODE_DIR}/inc/framework | ||||
| ${GE_CODE_DIR}/third_party/fwkacllib/inc | |||||
| ${METADEF_DIR}/inc | ${METADEF_DIR}/inc | ||||
| ${METADEF_DIR}/inc/external | ${METADEF_DIR}/inc/external | ||||
| ${METADEF_DIR}/inc/external/graph | ${METADEF_DIR}/inc/external/graph | ||||
| @@ -105,6 +107,7 @@ target_include_directories(host_cpu_opskernel_builder PRIVATE | |||||
| ${GE_CODE_DIR}/inc | ${GE_CODE_DIR}/inc | ||||
| ${GE_CODE_DIR}/inc/external | ${GE_CODE_DIR}/inc/external | ||||
| ${GE_CODE_DIR}/inc/framework | ${GE_CODE_DIR}/inc/framework | ||||
| ${GE_CODE_DIR}/third_party/fwkacllib/inc | |||||
| ${METADEF_DIR}/inc | ${METADEF_DIR}/inc | ||||
| ${METADEF_DIR}/inc/external | ${METADEF_DIR}/inc/external | ||||
| ${METADEF_DIR}/inc/external/graph | ${METADEF_DIR}/inc/external/graph | ||||
| @@ -138,6 +141,7 @@ target_include_directories(atc_host_cpu_opskernel_builder PRIVATE | |||||
| ${GE_CODE_DIR}/inc | ${GE_CODE_DIR}/inc | ||||
| ${GE_CODE_DIR}/inc/external | ${GE_CODE_DIR}/inc/external | ||||
| ${GE_CODE_DIR}/inc/framework | ${GE_CODE_DIR}/inc/framework | ||||
| ${GE_CODE_DIR}/third_party/fwkacllib/inc | |||||
| ${METADEF_DIR}/inc | ${METADEF_DIR}/inc | ||||
| ${METADEF_DIR}/inc/external | ${METADEF_DIR}/inc/external | ||||
| ${METADEF_DIR}/inc/external/graph | ${METADEF_DIR}/inc/external/graph | ||||
| @@ -176,6 +180,7 @@ target_include_directories(host_cpu_opskernel_builder_static PRIVATE | |||||
| ${GE_CODE_DIR}/inc | ${GE_CODE_DIR}/inc | ||||
| ${GE_CODE_DIR}/inc/external | ${GE_CODE_DIR}/inc/external | ||||
| ${GE_CODE_DIR}/inc/framework | ${GE_CODE_DIR}/inc/framework | ||||
| ${GE_CODE_DIR}/third_party/fwkacllib/inc | |||||
| ${METADEF_DIR}/inc | ${METADEF_DIR}/inc | ||||
| ${METADEF_DIR}/inc/external | ${METADEF_DIR}/inc/external | ||||
| ${METADEF_DIR}/inc/external/graph | ${METADEF_DIR}/inc/external/graph | ||||
| @@ -21,6 +21,7 @@ target_include_directories(engine PRIVATE | |||||
| ${GE_CODE_DIR}/inc/framework | ${GE_CODE_DIR}/inc/framework | ||||
| ${GE_CODE_DIR}/inc/framework/common | ${GE_CODE_DIR}/inc/framework/common | ||||
| ${GE_CODE_DIR}/inc/external | ${GE_CODE_DIR}/inc/external | ||||
| ${GE_CODE_DIR}/third_party/fwkacllib/inc | |||||
| ${METADEF_DIR}/inc | ${METADEF_DIR}/inc | ||||
| ${METADEF_DIR}/inc/external | ${METADEF_DIR}/inc/external | ||||
| ${CMAKE_BINARY_DIR} | ${CMAKE_BINARY_DIR} | ||||
| @@ -1,4 +1,4 @@ | |||||
| From f568b2731ac5356673e43361d718bb12704e05a9 Mon Sep 17 00:00:00 2001 | |||||
| From 455c9812d70646fe725896d597d6c953bf5a09ac Mon Sep 17 00:00:00 2001 | |||||
| From: taoxiangdong <taoxiangdong1@huawei.com> | From: taoxiangdong <taoxiangdong1@huawei.com> | ||||
| Date: Wed, 14 Oct 2020 22:14:01 +0800 | Date: Wed, 14 Oct 2020 22:14:01 +0800 | ||||
| Subject: [PATCH] add securec cmake script | Subject: [PATCH] add securec cmake script | ||||
| @@ -10,15 +10,15 @@ Subject: [PATCH] add securec cmake script | |||||
| diff --git a/CMakeLists.txt b/CMakeLists.txt | diff --git a/CMakeLists.txt b/CMakeLists.txt | ||||
| new file mode 100755 | new file mode 100755 | ||||
| index 0000000..7d59953 | |||||
| index 0000000..9b91fb2 | |||||
| --- /dev/null | --- /dev/null | ||||
| +++ b/CMakeLists.txt | +++ b/CMakeLists.txt | ||||
| @@ -0,0 +1,86 @@ | @@ -0,0 +1,86 @@ | ||||
| +cmake_minimum_required(VERSION 3.14) | +cmake_minimum_required(VERSION 3.14) | ||||
| +project (Securec) | |||||
| +project(Securec) | |||||
| +file(GLOB SRC_LIST RELATIVE ${CMAKE_CURRENT_LIST_DIR} | +file(GLOB SRC_LIST RELATIVE ${CMAKE_CURRENT_LIST_DIR} | ||||
| + "src/vsprintf_s.c" | + "src/vsprintf_s.c" | ||||
| + "src/wmemmove_s" | |||||
| + "src/wmemmove_s.c" | |||||
| + "src/strncat_s.c" | + "src/strncat_s.c" | ||||
| + "src/vsnprintf_s.c" | + "src/vsnprintf_s.c" | ||||
| + "src/fwscanf_s.c" | + "src/fwscanf_s.c" | ||||
| @@ -59,7 +59,7 @@ index 0000000..7d59953 | |||||
| + ) | + ) | ||||
| + | + | ||||
| +include_directories(./include) | +include_directories(./include) | ||||
| +include_directories(../src) | |||||
| +include_directories(./src) | |||||
| +add_library(shared_c_sec SHARED ${SRC_LIST}) | +add_library(shared_c_sec SHARED ${SRC_LIST}) | ||||
| + | + | ||||
| +target_compile_options(shared_c_sec PRIVATE | +target_compile_options(shared_c_sec PRIVATE | ||||
| @@ -71,7 +71,7 @@ index 0000000..7d59953 | |||||
| +target_compile_definitions(shared_c_sec PRIVATE | +target_compile_definitions(shared_c_sec PRIVATE | ||||
| + NDEBUG | + NDEBUG | ||||
| + SECUREC_SUPPORT_STRTOLD=1 | + SECUREC_SUPPORT_STRTOLD=1 | ||||
| +) | |||||
| + ) | |||||
| + | + | ||||
| +add_library(static_c_sec STATIC ${SRC_LIST}) | +add_library(static_c_sec STATIC ${SRC_LIST}) | ||||
| + | + | ||||
| @@ -82,10 +82,10 @@ index 0000000..7d59953 | |||||
| + -O1 | + -O1 | ||||
| +) | +) | ||||
| + | + | ||||
| +target_compile_options(static_c_sec PRIVATE | |||||
| +target_compile_definitions(static_c_sec PRIVATE | |||||
| + NDEBUG | + NDEBUG | ||||
| + SECUREC_SUPPORT_STRTOLD=1 | + SECUREC_SUPPORT_STRTOLD=1 | ||||
| +) | |||||
| + ) | |||||
| + | + | ||||
| +set_target_properties(static_c_sec | +set_target_properties(static_c_sec | ||||
| + PROPERTIES | + PROPERTIES | ||||