@@ -20,27 +20,57 @@ if (ENABLE_OPEN_SRC) | |||
include(cmake/FindModule.cmake) | |||
include(cmake/intf_pub_linux.cmake) | |||
if(DEFINED ENV{ASCEND_CUSTOM_PATH}) | |||
set(ASCEND_DIR $ENV{ASCEND_CUSTOM_PATH}) | |||
# 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_module(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_module(slog libslog.so ${GE_LIB_PATH}) | |||
find_module(mmpa libmmpa.so ${GE_LIB_PATH}) | |||
find_module(msprof libmsprof.so ${GE_LIB_PATH}) | |||
find_module(hccl libhccl.so ${GE_LIB_PATH}) | |||
find_module(adump_server libadump_server.a ${GE_LIB_PATH}) | |||
find_module(runtime libruntime.so ${GE_LIB_PATH}) | |||
find_module(runtime_compile libruntime_compile.so ${GE_LIB_PATH}) | |||
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}) | |||
else() | |||
set(ASCEND_DIR /usr/local/Ascend) | |||
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) | |||
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) | |||
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_ATC_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}) | |||
endif() | |||
set(ASCEND_DRIVER_DIR ${ASCEND_DIR}/driver/lib64) | |||
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) | |||
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_ATC_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}/..) | |||
@@ -117,6 +117,7 @@ build_graphengine() | |||
CMAKE_ARGS="${CMAKE_ARGS} -DENABLE_GE_ST=ON" | |||
fi | |||
CMAKE_ARGS="${CMAKE_ARGS} -DENABLE_OPEN_SRC=True | |||
echo "${CMAKE_ARGS}" | |||
cmake ${CMAKE_ARGS} ../.. | |||
make ${VERBOSE} -j${THREAD_NUM} | |||
@@ -13,7 +13,8 @@ endif() | |||
ExternalProject_Add(c_sec_build | |||
URL https://gitee.com/openeuler/libboundscheck/repository/archive/v1.1.10.tar.gz | |||
#URL /home/txd/workspace/linux_cmake/pkg/protobuf-3.8.0.tar.gz | |||
SOURCE_DIR ${GE_CODE_DIR}/../libc_sec | |||
#SOURCE_DIR ${GE_CODE_DIR}/../libc_sec | |||
PATCH_COMMAND patch -p1 < ${GE_CODE_DIR}/third_party/patch/securec/0001-add-securec-cmake-script.patch | |||
CONFIGURE_COMMAND ${CMAKE_COMMAND} | |||
-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER} | |||
-DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER} | |||
@@ -360,6 +360,8 @@ target_include_directories(ge_runner PRIVATE | |||
#### blue zone | |||
${ASCEND_DIR}/driver/include | |||
${ASCEND_DIR}/fwkacllib/include | |||
${GE_CODE_DIR}/third_party/fwkacllib/inc | |||
${GE_CODE_DIR}/third_party/fwkacllib/inc/toolchain | |||
) | |||
target_link_libraries(ge_runner | |||
@@ -678,6 +680,8 @@ target_include_directories(ge_compiler PRIVATE | |||
#### blue zone | |||
${ASCEND_DIR}/driver/include | |||
${ASCEND_DIR}/fwkacllib/include | |||
${GE_CODE_DIR}/third_party/fwkacllib/inc | |||
${GE_CODE_DIR}/third_party/fwkacllib/inc/toolchain | |||
) | |||
target_link_libraries(ge_compiler | |||
@@ -96,6 +96,8 @@ target_include_directories(ge_common PRIVATE | |||
${GE_DEPEND_DIR}/inc/cce | |||
#### blue zone #### | |||
#${GE_DEPEND_DIR}/include | |||
${GE_CODE_DIR}/third_party/fwkacllib/inc | |||
${GE_CODE_DIR}/third_party/fwkacllib/inc/toolchain | |||
) | |||
target_link_libraries(ge_common PRIVATE | |||
@@ -147,6 +149,8 @@ target_include_directories(ge_common_static PRIVATE | |||
${GE_DEPEND_DIR}/inc/cce | |||
#### blue zone #### | |||
#${GE_DEPEND_DIR}/include | |||
${GE_CODE_DIR}/third_party/fwkacllib/inc | |||
${GE_CODE_DIR}/third_party/fwkacllib/inc/toolchain | |||
) | |||
target_link_libraries(ge_common_static PRIVATE | |||
@@ -0,0 +1,105 @@ | |||
From f568b2731ac5356673e43361d718bb12704e05a9 Mon Sep 17 00:00:00 2001 | |||
From: taoxiangdong <taoxiangdong1@huawei.com> | |||
Date: Wed, 14 Oct 2020 22:14:01 +0800 | |||
Subject: [PATCH] add securec cmake script | |||
--- | |||
CMakeLists.txt | 86 ++++++++++++++++++++++++++++++++++++++++++++++++++ | |||
1 file changed, 86 insertions(+) | |||
create mode 100755 CMakeLists.txt | |||
diff --git a/CMakeLists.txt b/CMakeLists.txt | |||
new file mode 100755 | |||
index 0000000..7d59953 | |||
--- /dev/null | |||
+++ b/CMakeLists.txt | |||
@@ -0,0 +1,86 @@ | |||
+cmake_minimum_required(VERSION 3.14) | |||
+project (Securec) | |||
+file(GLOB SRC_LIST RELATIVE ${CMAKE_CURRENT_LIST_DIR} | |||
+ "src/vsprintf_s.c" | |||
+ "src/wmemmove_s" | |||
+ "src/strncat_s.c" | |||
+ "src/vsnprintf_s.c" | |||
+ "src/fwscanf_s.c" | |||
+ "src/scanf_s.c" | |||
+ "src/strcat_s.c" | |||
+ "src/sscanf_s.c" | |||
+ "src/secureprintoutput_w.c" | |||
+ "src/wmemcpy_s.c" | |||
+ "src/wcsncat_s.c" | |||
+ "src/secureprintoutput_a.c" | |||
+ "src/secureinput_w.c" | |||
+ "src/memcpy_s.c" | |||
+ "src/fscanf_s.c" | |||
+ "src/vswscanf_s.c" | |||
+ "src/secureinput_a.c" | |||
+ "src/sprintf_s.c" | |||
+ "src/memmove_s.c" | |||
+ "src/swscanf_s.c" | |||
+ "src/snprintf_s.c" | |||
+ "src/vscanf_s.c" | |||
+ "src/vswprintf_s.c" | |||
+ "src/wcscpy_s.c" | |||
+ "src/vfwscanf_s.c" | |||
+ "src/memset_s.c" | |||
+ "src/wscanf_s.c" | |||
+ "src/vwscanf_s.c" | |||
+ "src/strtok_s.c" | |||
+ "src/wcsncpy_s.c" | |||
+ "src/vfscanf_s.c" | |||
+ "src/vsscanf_s.c" | |||
+ "src/wcstok_s.c" | |||
+ "src/securecutil.c" | |||
+ "src/gets_s.c" | |||
+ "src/swprintf_s.c" | |||
+ "src/strcpy_s.c" | |||
+ "src/wcscat_s.c" | |||
+ "src/strncpy_s.c" | |||
+ ) | |||
+ | |||
+include_directories(./include) | |||
+include_directories(../src) | |||
+add_library(shared_c_sec SHARED ${SRC_LIST}) | |||
+ | |||
+target_compile_options(shared_c_sec PRIVATE | |||
+ -I/usr/local/include | |||
+ -Werror | |||
+ -Wall | |||
+ -O1 | |||
+) | |||
+target_compile_definitions(shared_c_sec PRIVATE | |||
+ NDEBUG | |||
+ SECUREC_SUPPORT_STRTOLD=1 | |||
+) | |||
+ | |||
+add_library(static_c_sec STATIC ${SRC_LIST}) | |||
+ | |||
+target_compile_options(static_c_sec PRIVATE | |||
+ -I/usr/local/include | |||
+ -Werror | |||
+ -Wall | |||
+ -O1 | |||
+) | |||
+ | |||
+target_compile_options(static_c_sec PRIVATE | |||
+ NDEBUG | |||
+ SECUREC_SUPPORT_STRTOLD=1 | |||
+) | |||
+ | |||
+set_target_properties(static_c_sec | |||
+ PROPERTIES | |||
+ OUTPUT_NAME c_sec | |||
+) | |||
+set_target_properties(shared_c_sec | |||
+ PROPERTIES | |||
+ OUTPUT_NAME c_sec | |||
+) | |||
+install(TARGETS shared_c_sec static_c_sec OPTIONAL | |||
+ DESTINATION lib) | |||
+install(FILES "./include/securec.h" | |||
+ "./include/securectype.h" | |||
+ DESTINATION include) | |||
-- | |||
2.17.1 | |||