fix cmakelint error

This commit is contained in:
xsmq 2021-01-23 20:20:31 +08:00
parent 8170669909
commit 73b7154e55
79 changed files with 561 additions and 561 deletions

View File

@ -1,25 +1,25 @@
cmake_minimum_required(VERSION 3.14.1)
project (MindSpore)
project(MindSpore)
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 7.3.0)
message(FATAL_ERROR "GCC vesion ${CMAKE_CXX_COMPILER_VERSION} must not be less than 7.3.0")
endif ()
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 7.3.0)
message(FATAL_ERROR "GCC version ${CMAKE_CXX_COMPILER_VERSION} must not be less than 7.3.0")
endif()
include(${CMAKE_SOURCE_DIR}/cmake/options.cmake)
include(${CMAKE_SOURCE_DIR}/cmake/check_requirements.cmake)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/modules/")
if (NOT CMAKE_SYSTEM_NAME MATCHES "Windows")
if(NOT CMAKE_SYSTEM_NAME MATCHES "Windows")
add_compile_definitions(_GLIBCXX_USE_CXX11_ABI=0)
endif ()
endif()
if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
set(CMAKE_OSX_SYSROOT "")
set(CMAKE_CXX_FLAGS_RELEASE "$ENV{CXXFLAGS} -O2 -Winconsistent-missing-override -Wuser-defined-warnings -Wno-return-std-move -Wno-unused-private-field -Wno-unused-lambda-capture -Wno-sign-compare -Wno-overloaded-virtual -Wno-unneeded-internal-declaration -Wno-unused-variable -Wno-pessimizing-move -Wno-inconsistent-missing-override -DHALF_ENABLE_CPP11_USER_LITERALS=0 -D_FORTIFY_SOURCE=2")
else()
set(CMAKE_CXX_FLAGS_RELEASE "$ENV{CXXFLAGS} -O2 -Wl,--allow-shlib-undefined -DHALF_ENABLE_CPP11_USER_LITERALS=0 -D_FORTIFY_SOURCE=2")
endif()
if (ENABLE_PYTHON)
if(ENABLE_PYTHON)
add_compile_definitions(ENABLE_PYTHON)
endif()
@ -31,7 +31,7 @@ set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
set(PYBIND11_CPP_STANDARD -std=c++17)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OPTION_CXX_FLAGS}")
if (ENABLE_AKG AND (ENABLE_D OR ENABLE_GPU))
if(ENABLE_AKG AND (ENABLE_D OR ENABLE_GPU))
add_subdirectory("${CMAKE_SOURCE_DIR}/akg")
endif()
@ -46,8 +46,8 @@ find_package(Python3 3.7 COMPONENTS Interpreter Development)
if(Python3_FOUND)
set(PYTHON_INCLUDE_DIRS "${Python3_INCLUDE_DIRS}")
set(PYTHON_LIBRARIES "${Python3_LIBRARIES}")
if (WIN32)
if (Python3_DIR)
if(WIN32)
if(Python3_DIR)
message("Python3_DIR set already: " ${Python3_DIR})
else()
string(LENGTH ${PYTHON_LIBRARIES} PYTHON_LIBRARIES_LEN)
@ -70,14 +70,14 @@ include_directories(${PYTHON_INCLUDE_DIRS})
set(MS_CCSRC_PATH ${CMAKE_SOURCE_DIR}/mindspore/ccsrc)
set(MS_CCSRC_BUILD_PATH ${BUILD_PATH}/mindspore/mindspore/ccsrc)
if (ENABLE_D OR ENABLE_ACL OR ENABLE_TESTCASES)
if(ENABLE_D OR ENABLE_ACL OR ENABLE_TESTCASES)
include(${CMAKE_SOURCE_DIR}/cmake/dependency_graphengine.cmake)
endif ()
endif()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden")
add_subdirectory(mindspore/ccsrc)
add_subdirectory(mindspore/core)
if (ENABLE_TESTCASES OR ENABLE_CPP_ST)
if(ENABLE_TESTCASES OR ENABLE_CPP_ST)
add_subdirectory(tests)
endif()

View File

@ -7,7 +7,7 @@ function(find_submodule_lib module name path)
find_library(${module}_LIBRARY_DIR NAMES ${name} NAMES_PER_DIR PATHS ${path}
PATH_SUFFIXES lib
)
if ("${${module}_LIBRARY_DIR}" STREQUAL "${module}_LIBRARY_DIR-NOTFOUND")
if("${${module}_LIBRARY_DIR}" STREQUAL "${module}_LIBRARY_DIR-NOTFOUND")
message(FATAL_ERROR "${name} not found in any of following paths: ${path}")
endif()
add_library(${module} SHARED IMPORTED)
@ -16,13 +16,13 @@ function(find_submodule_lib module name path)
)
endfunction()
if (ENABLE_D OR ENABLE_ACL OR ENABLE_TESTCASES)
if(ENABLE_D OR ENABLE_ACL OR ENABLE_TESTCASES)
set(_ge_tmp_CMAKE_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX})
set(_ge_tmp_ENABLE_GITEE ${ENABLE_GITEE})
set(ENABLE_GITEE ON)
set(CMAKE_INSTALL_PREFIX ${BUILD_PATH}/graphengine)
if (ENABLE_TESTCASES)
if(ENABLE_TESTCASES)
# use slog, error manager, mmpa in non ascend mode, e.g. tests
set(GE_PREBUILD_PATH ${GE_SOURCE_DIR}/third_party/prebuild/${CMAKE_HOST_SYSTEM_PROCESSOR})
set(ENABLE_MS_TESTCASES TRUE)

View File

@ -4,7 +4,7 @@
# GTest_LIBRARY
#
if (NOT TARGET gtest)
if(NOT TARGET gtest)
set(BUILD_TESTING OFF CACHE BOOL "Disable glog test")
set(_ms_tmp_CMAKE_POSITION_INDEPENDENT_CODE ${CMAKE_POSITION_INDEPENDENT_CODE})
@ -17,7 +17,7 @@ if (NOT TARGET gtest)
set(CMAKE_MACOSX_RPATH TRUE)
set(CMAKE_CXX_FLAGS "${SECURE_CXX_FLAGS}")
if (CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER "5.0" AND CMAKE_HOST_SYSTEM_PROCESSOR MATCHES "x86_64" AND SYSTEM_TYPE MATCHES "euleros")
if(CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER "5.0" AND CMAKE_HOST_SYSTEM_PROCESSOR MATCHES "x86_64" AND SYSTEM_TYPE MATCHES "euleros")
# -D_GLIBCXX_USE_CXX11_ABI=0 added for the ABI incompatible for libtsdclient.so
# set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_GLIBCXX_USE_CXX11_ABI=0")
endif()

View File

@ -3,7 +3,7 @@
#
# PROTOBUF_LIBRARY - Link this to use protobuf
#
if (NOT TARGET protobuf::libprotobuf)
if(NOT TARGET protobuf::libprotobuf)
set(protobuf_BUILD_TESTS OFF CACHE BOOL "Disable protobuf test")
set(protobuf_BUILD_SHARED_LIBS OFF CACHE BOOL "Gen shared library")
set(_ms_tmp_CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})
@ -14,7 +14,7 @@ if (NOT TARGET protobuf::libprotobuf)
add_subdirectory(${CMAKE_CURRENT_LIST_DIR}/../third_party/protobuf/cmake ${CMAKE_BINARY_DIR}/protobuf)
set(CMAKE_CXX_FLAGS ${_ms_tmp_CMAKE_CXX_FLAGS})
endif ()
endif()
include_directories(${CMAKE_CURRENT_LIST_DIR}/../third_party/protobuf/src)
@ -47,7 +47,7 @@ function(ms_protobuf_generate c_var h_var)
COMMAND ${CMAKE_COMMAND} -E make_directory "${CMAKE_BINARY_DIR}/${rel_path}"
COMMAND protobuf::protoc -I${file_dir} --cpp_out=${CMAKE_BINARY_DIR}/${rel_path} ${abs_file}
DEPENDS protobuf::protoc ${abs_file}
COMMENT "Running C++ protocol buffer compiler on ${file}" VERBATIM )
COMMENT "Running C++ protocol buffer compiler on ${file}" VERBATIM)
endforeach()
set_source_files_properties(${${c_var}} ${${h_var}} PROPERTIES GENERATED TRUE)
@ -89,7 +89,7 @@ function(ms_protobuf_generate_py c_var h_var py_var)
COMMAND perl -pi -e "s/import (.+_pb2.*)/from . import \\1/" "${CMAKE_BINARY_DIR}/${rel_path}/${file_name}_pb2.py"
COMMAND cp "${CMAKE_BINARY_DIR}/${rel_path}/${file_name}_pb2.py" "${PROJECT_SOURCE_DIR}/mindspore/train/"
DEPENDS protobuf::protoc ${abs_file}
COMMENT "Running C++ protocol buffer compiler on ${file}" VERBATIM )
COMMENT "Running C++ protocol buffer compiler on ${file}" VERBATIM)
endforeach()
set_source_files_properties(${${c_var}} ${${h_var}} ${${py_var}} PROPERTIES GENERATED TRUE)

View File

@ -4,12 +4,12 @@
# SECUREC_LIBRARY
#
if (NOT TARGET securec)
if(NOT TARGET securec)
set(_ms_tmp_CMAKE_POSITION_INDEPENDENT_CODE ${CMAKE_POSITION_INDEPENDENT_CODE})
set(_ms_tmp_CMAKE_C_FLAGS ${CMAKE_C_FLAGS})
set(CMAKE_C_FLAGS "${SECURE_CXX_FLAGS}")
if (CMAKE_SYSTEM_NAME MATCHES "Windows")
if(CMAKE_SYSTEM_NAME MATCHES "Windows")
add_compile_definitions(SECUREC_ONLY_DECLARE_MEMSET)
endif()
add_subdirectory(${CMAKE_CURRENT_LIST_DIR}/../third_party/securec ${CMAKE_BINARY_DIR}/securec)

View File

@ -3,7 +3,7 @@
function(find_python_package out_inc out_lib)
# Use PYTHON_EXECUTABLE if it is defined, otherwise default to python
if ("${PYTHON_EXECUTABLE}" STREQUAL "")
if("${PYTHON_EXECUTABLE}" STREQUAL "")
set(PYTHON_EXECUTABLE "python3")
else()
set(PYTHON_EXECUTABLE "${PYTHON_EXECUTABLE}")
@ -15,7 +15,7 @@ function(find_python_package out_inc out_lib)
OUTPUT_VARIABLE inc)
string(STRIP "${inc}" inc)
set(${out_inc} ${inc} PARENT_SCOPE)
execute_process(
COMMAND "${PYTHON_EXECUTABLE}" -c "import distutils.sysconfig as sysconfig; import os; print(os.path.join(sysconfig.get_config_var('LIBDIR'), sysconfig.get_config_var('LDLIBRARY')))"
RESULT_VARIABLE result

View File

@ -1,10 +1,10 @@
if (ENABLE_GITEE)
if(ENABLE_GITEE)
set(REQ_URL "https://gitee.com/mirrors/abseil-cpp/repository/archive/20200225.2.tar.gz")
set(MD5 "7e84ac40ee4541f645f5b9c90c9c98e6")
else()
set(REQ_URL "https://github.com/abseil/abseil-cpp/archive/20200225.2.tar.gz")
set(MD5 "73f2b6e72f1599a9139170c29482ddc4")
endif ()
endif()
mindspore_add_pkg(absl
VER 20200225.2

View File

@ -1,14 +1,14 @@
if (ENABLE_GITEE)
if(ENABLE_GITEE)
set(REQ_URL "https://gitee.com/mirrors/c-ares/repository/archive/cares-1_15_0.tar.gz")
set(MD5 "a1e06c7eb45b96b8bff2ee1b43a4c70b")
else()
set(REQ_URL "https://github.com/c-ares/c-ares/releases/download/cares-1_15_0/c-ares-1.15.0.tar.gz")
set(MD5 "d2391da274653f7643270623e822dff7")
endif ()
endif()
mindspore_add_pkg(c-ares
VER 1.15.0
LIBS cares
LIBS cares
URL ${REQ_URL}
MD5 ${MD5}
CMAKE_OPTION -DCMAKE_BUILD_TYPE:STRING=Release

View File

@ -1,13 +1,13 @@
set(cppjieba_CXXFLAGS "-D_FORTIFY_SOURCE=2 -O2")
set(cppjieba_CFLAGS "-D_FORTIFY_SOURCE=2 -O2")
if (ENABLE_GITEE)
if(ENABLE_GITEE)
set(REQ_URL "https://gitee.com/mirrors/cppjieba/repository/archive/v5.0.3.tar.gz")
set(MD5 "ea0bdd5a654a376e2c2077daae23b376")
else()
set(REQ_URL "https://github.com/yanyiwu/cppjieba/archive/v5.0.3.tar.gz")
set(MD5 "b8b3f7a73032c9ce9daafa4f67196c8c")
endif ()
endif()
mindspore_add_pkg(cppjieba
VER 5.0.3

View File

@ -1,13 +1,13 @@
set(Eigen3_CXXFLAGS "-D_FORTIFY_SOURCE=2 -O2")
set(Eigen3_CFLAGS "-D_FORTIFY_SOURCE=2 -O2")
if (ENABLE_GITEE)
if(ENABLE_GITEE)
set(REQ_URL "https://gitee.com/mirrors/eigen-git-mirrorsource/repository/archive/3.3.7.tar.gz")
set(MD5 "cf6552a5d90c1aca4b5e0b011f65ea93")
else()
set(REQ_URL "https://gitlab.com/libeigen/eigen/-/archive/3.3.7/eigen-3.3.7.tar.gz")
set(MD5 "9e30f67e8531477de4117506fe44669b")
endif ()
endif()
mindspore_add_pkg(Eigen3
VER 3.3.7

View File

@ -1,16 +1,16 @@
set(flatbuffers_CXXFLAGS "-D_FORTIFY_SOURCE=2 -O2")
set(flatbuffers_CFLAGS "-D_FORTIFY_SOURCE=2 -O2")
if (WIN32)
set(flatbuffers_USE_STATIC_LIBS ON)
if(WIN32)
set(flatbuffers_USE_STATIC_LIBS ON)
endif()
if (ENABLE_GITEE)
if(ENABLE_GITEE)
set(REQ_URL "https://gitee.com/mirrors/flatbuffers/repository/archive/v1.11.0.tar.gz")
set(MD5 "4051dc865063ffa724c4264dea8dbbe9")
else()
set(REQ_URL "https://github.com/google/flatbuffers/archive/v1.11.0.tar.gz")
set(MD5 "02c64880acb89dbd57eebacfd67200d8")
endif ()
endif()
mindspore_add_pkg(flatbuffers
VER 1.11.0
@ -31,13 +31,13 @@ function(ms_build_flatbuffers source_schema_files
set(total_schema_dirs "")
set(total_generated_files "")
set(FLATC mindspore::flatc)
foreach (schema_dir ${source_schema_dirs})
foreach(schema_dir ${source_schema_dirs})
set(total_schema_dirs -I ${schema_dir} ${total_schema_dirs})
endforeach()
foreach(schema ${source_schema_files})
get_filename_component(filename ${schema} NAME_WE)
if (NOT ${generated_output_dir} STREQUAL "")
if(NOT ${generated_output_dir} STREQUAL "")
set(generated_file ${generated_output_dir}/${filename}_generated.h)
add_custom_command(
OUTPUT ${generated_file}
@ -55,7 +55,7 @@ function(ms_build_flatbuffers source_schema_files
add_custom_target(${custom_target_name} ALL
DEPENDS ${total_generated_files})
if (NOT ${generated_output_dir} STREQUAL "")
if(NOT ${generated_output_dir} STREQUAL "")
include_directories(${generated_output_dir})
set_property(TARGET ${custom_target_name}
PROPERTY GENERATED_OUTPUT_DIR
@ -72,15 +72,15 @@ function(ms_build_flatbuffers_lite source_schema_files
set(total_schema_dirs "")
set(total_generated_files "")
set(FLATC mindspore::flatc)
foreach (schema_dir ${source_schema_dirs})
foreach(schema_dir ${source_schema_dirs})
set(total_schema_dirs -I ${schema_dir} ${total_schema_dirs})
endforeach()
foreach(schema IN LISTS ${source_schema_files})
get_filename_component(filename ${schema} NAME_WE)
if (NOT ${generated_output_dir} STREQUAL "")
if(NOT ${generated_output_dir} STREQUAL "")
set(generated_file ${generated_output_dir}/${filename}_generated.h)
if (if_inner MATCHES "inner")
if(if_inner MATCHES "inner")
add_custom_command(
OUTPUT ${generated_file}
COMMAND ${FLATC} --gen-mutable
@ -107,7 +107,7 @@ function(ms_build_flatbuffers_lite source_schema_files
add_custom_target(${custom_target_name} ALL
DEPENDS ${total_generated_files})
if (NOT ${generated_output_dir} STREQUAL "")
if(NOT ${generated_output_dir} STREQUAL "")
include_directories(${generated_output_dir})
set_property(TARGET ${custom_target_name}
PROPERTY GENERATED_OUTPUT_DIR

View File

@ -1,12 +1,12 @@
set(glog_CXXFLAGS "-D_FORTIFY_SOURCE=2 -O2 ${SECURE_CXX_FLAGS} -D_GLIBCXX_USE_CXX11_ABI=0")
set(glog_CFLAGS "-D_FORTIFY_SOURCE=2 -O2")
if (ENABLE_GITEE)
if(ENABLE_GITEE)
set(REQ_URL "https://gitee.com/mirrors/glog/repository/archive/v0.4.0.tar.gz")
set(MD5 "22fe340ddc231e6c8e46bc295320f8ee")
else()
set(REQ_URL "https://github.com/google/glog/archive/v0.4.0.tar.gz")
set(MD5 "0daea8785e6df922d7887755c3d100d0")
endif ()
endif()
mindspore_add_pkg(glog
VER 0.4.0
LIBS glog

View File

@ -1,7 +1,7 @@
set(grpc_USE_STATIC_LIBS ON)
if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
set(grpc_CXXFLAGS "-fstack-protector-all -Wno-uninitialized -Wno-unused-parameter -fPIC -fvisibility=hidden -D_FORTIFY_SOURCE=2 -O2")
elseif (${CMAKE_SYSTEM_NAME} MATCHES "Windows")
elseif(${CMAKE_SYSTEM_NAME} MATCHES "Windows")
set(grpc_CXXFLAGS "-fstack-protector-all -Wno-maybe-uninitialized -Wno-unused-parameter -fPIC -fvisibility=hidden -D_FORTIFY_SOURCE=2 -O2")
else()
set(grpc_CXXFLAGS "-fstack-protector-all -Wno-maybe-uninitialized -Wno-unused-parameter -fPIC -fvisibility=hidden -D_FORTIFY_SOURCE=2 -D_GLIBCXX_USE_CXX11_ABI=0 -O2")
@ -10,14 +10,14 @@ endif()
set(grpc_LDFLAGS "-Wl,-z,relro,-z,now,-z,noexecstack")
if (EXISTS ${protobuf_ROOT}/lib64)
if(EXISTS ${protobuf_ROOT}/lib64)
set(_FINDPACKAGE_PROTOBUF_CONFIG_DIR "${protobuf_ROOT}/lib64/cmake/protobuf")
else()
set(_FINDPACKAGE_PROTOBUF_CONFIG_DIR "${protobuf_ROOT}/lib/cmake/protobuf")
endif()
message("grpc using Protobuf_DIR : " ${_FINDPACKAGE_PROTOBUF_CONFIG_DIR})
if (EXISTS ${absl_ROOT}/lib64)
if(EXISTS ${absl_ROOT}/lib64)
set(_FINDPACKAGE_ABSL_CONFIG_DIR "${absl_ROOT}/lib64/cmake/absl")
else()
set(_FINDPACKAGE_ABSL_CONFIG_DIR "${absl_ROOT}/lib/cmake/absl")
@ -25,17 +25,17 @@ endif()
message("grpc using absl_DIR : " ${_FINDPACKAGE_ABSL_CONFIG_DIR})
set(_CMAKE_ARGS_OPENSSL_ROOT_DIR "")
if (OPENSSL_ROOT_DIR)
if(OPENSSL_ROOT_DIR)
set(_CMAKE_ARGS_OPENSSL_ROOT_DIR "-DOPENSSL_ROOT_DIR:PATH=${OPENSSL_ROOT_DIR}")
endif()
if (ENABLE_GITEE)
if(ENABLE_GITEE)
set(REQ_URL "https://gitee.com/mirrors/grpc/repository/archive/v1.27.3.tar.gz")
set(MD5 "b8b6d8defeda0355105e3b64b4201786")
else()
set(REQ_URL "https://github.com/grpc/grpc/archive/v1.27.3.tar.gz")
set(MD5 "0c6c3fc8682d4262dd0e5e6fabe1a7e2")
endif ()
endif()
mindspore_add_pkg(grpc
VER 1.27.3

View File

@ -4,8 +4,8 @@ set(gtest_CFLAGS "-D_FORTIFY_SOURCE=2 -O2")
set(CMAKE_OPTION
-DBUILD_TESTING=OFF -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DBUILD_SHARED_LIBS=ON
-DCMAKE_MACOSX_RPATH=TRUE -Dgtest_disable_pthreads=ON)
if (BUILD_LITE)
if (PLATFORM_ARM64)
if(BUILD_LITE)
if(PLATFORM_ARM64)
set(CMAKE_OPTION -DCMAKE_TOOLCHAIN_FILE=$ENV{ANDROID_NDK}/build/cmake/android.toolchain.cmake
-DANDROID_NATIVE_API_LEVEL=19
-DANDROID_NDK=$ENV{ANDROID_NDK}
@ -14,7 +14,7 @@ if (BUILD_LITE)
-DANDROID_STL=c++_shared -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
${CMAKE_OPTION})
endif()
if (PLATFORM_ARM32)
if(PLATFORM_ARM32)
set(CMAKE_OPTION -DCMAKE_TOOLCHAIN_FILE=$ENV{ANDROID_NDK}/build/cmake/android.toolchain.cmake
-DANDROID_NATIVE_API_LEVEL=19
-DANDROID_NDK=$ENV{ANDROID_NDK}
@ -25,15 +25,15 @@ if (BUILD_LITE)
endif()
else()
set(gtest_CXXFLAGS "${gtest_CXXFLAGS} -D_GLIBCXX_USE_CXX11_ABI=0")
endif ()
endif()
if (ENABLE_GITEE)
if(ENABLE_GITEE)
set(REQ_URL "https://gitee.com/mirrors/googletest/repository/archive/release-1.8.0.tar.gz")
set(MD5 "89e13ca1aa48d370719d58010b83f62c")
else()
set(REQ_URL "https://github.com/google/googletest/archive/release-1.8.0.tar.gz")
set(MD5 "16877098823401d1bf2ed7891d7dce36")
endif ()
endif()
mindspore_add_pkg(gtest
VER 1.8.0

View File

@ -2,17 +2,17 @@ set(LIB_ICU_COMMON icuuc)
set(LIB_ICU_DATA icudata)
set(LIB_ICU_I18N icui18n)
if (ENABLE_GITEE)
if(ENABLE_GITEE)
set(REQ_URL "https://gitee.com/mirrors/icu/repository/archive/release-67-1.tar.gz")
set(MD5 "72415ffd1af3acf19f9aa3fa82c7b5bc")
else ()
else()
set(REQ_URL "https://github.com/unicode-org/icu/archive/release-67-1.tar.gz")
set(MD5 "fd525fb47d8827b0b7da78b51dd2d93f")
endif ()
endif()
if (CMAKE_SYSTEM_NAME MATCHES "Windows")
if(CMAKE_SYSTEM_NAME MATCHES "Windows")
message("icu4c thirdparty do not support windows currently.")
else ()
else()
set(JSON_FILE "{ \n\
\"strategy\": \"additive\",\n\
\"featureFilters\": {\n\
@ -21,7 +21,7 @@ else ()
}\
")
file(WRITE ${CMAKE_BINARY_DIR}/icu4c_filter.json ${JSON_FILE})
if (CMAKE_SYSTEM_NAME MATCHES "Darwin")
if(CMAKE_SYSTEM_NAME MATCHES "Darwin")
mindspore_add_pkg(icu4c
VER 67.1
LIBS ${LIB_ICU_COMMON} ${LIB_ICU_DATA} ${LIB_ICU_I18N}
@ -30,7 +30,7 @@ else ()
PATCHES ${CMAKE_SOURCE_DIR}/third_party/patch/icu4c/icu4c.patch01
CONFIGURE_COMMAND ./icu4c/source/runConfigureICU MacOSX --enable-rpath --disable-tests --disable-samples --disable-icuio --disable-extras ICU_DATA_FILTER_FILE=${CMAKE_BINARY_DIR}/icu4c_filter.json
)
else ()
else()
mindspore_add_pkg(icu4c
VER 67.1
LIBS ${LIB_ICU_COMMON} ${LIB_ICU_DATA} ${LIB_ICU_I18N}
@ -39,10 +39,10 @@ else ()
PATCHES ${CMAKE_SOURCE_DIR}/third_party/patch/icu4c/icu4c.patch01
CONFIGURE_COMMAND ./icu4c/source/runConfigureICU Linux --enable-rpath --disable-tests --disable-samples --disable-icuio --disable-extras ICU_DATA_FILTER_FILE=${CMAKE_BINARY_DIR}/icu4c_filter.json
)
endif ()
endif()
include_directories(${icu4c_INC})
add_library(mindspore::icuuc ALIAS icu4c::${LIB_ICU_COMMON})
add_library(mindspore::icudata ALIAS icu4c::${LIB_ICU_DATA})
add_library(mindspore::icui18n ALIAS icu4c::${LIB_ICU_I18N})
add_definitions(-D ENABLE_ICU4C)
endif ()
endif()

View File

@ -1,13 +1,13 @@
if (ENABLE_GITEE)
if(ENABLE_GITEE)
set(REQ_URL "https://gitee.com/mirrors/libjpeg-turbo/repository/archive/2.0.4.tar.gz")
set(MD5 "51aac2382ad1a68b2e4beb391dc1cf60")
else()
set(REQ_URL "https://github.com/libjpeg-turbo/libjpeg-turbo/archive/2.0.4.tar.gz")
set(MD5 "44c43e4a9fb352f47090804529317c88")
endif ()
endif()
if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
set(jpeg_turbo_CFLAGS "-fstack-protector-all -Wno-uninitialized -Wno-unused-parameter -fPIC -D_FORTIFY_SOURCE=2 -O2")
else()
set(jpeg_turbo_CFLAGS "-fstack-protector-all -Wno-maybe-uninitialized -Wno-unused-parameter -fPIC -D_FORTIFY_SOURCE=2 -O2")
@ -19,10 +19,10 @@ set(jpeg_turbo_LDFLAGS "-Wl,-z,relro,-z,now,-z,noexecstack,-s")
set(jpeg_turbo_USE_STATIC_LIBS ON)
set(JPEG_TURBO_PATCHE ${CMAKE_SOURCE_DIR}/third_party/patch/jpeg_turbo/jpeg_turbo.patch001)
set(CMAKE_OPTION -DCMAKE_BUILD_TYPE=Release -DCMAKE_SKIP_RPATH=TRUE -DWITH_SIMD=ON)
if (BUILD_LITE)
if(BUILD_LITE)
set(jpeg_turbo_USE_STATIC_LIBS OFF)
set(JPEG_TURBO_PATCHE ${TOP_DIR}/third_party/patch/jpeg_turbo/jpeg_turbo.patch001)
if (PLATFORM_ARM64)
if(PLATFORM_ARM64)
set(CMAKE_OPTION -DCMAKE_TOOLCHAIN_FILE=$ENV{ANDROID_NDK}/build/cmake/android.toolchain.cmake
-DANDROID_NATIVE_API_LEVEL=19
-DANDROID_NDK=$ENV{ANDROID_NDK}
@ -30,7 +30,7 @@ if (BUILD_LITE)
-DANDROID_TOOLCHAIN_NAME=aarch64-linux-android-clang
-DANDROID_STL=c++_shared -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE})
endif()
if (PLATFORM_ARM32)
if(PLATFORM_ARM32)
set(CMAKE_OPTION -DCMAKE_TOOLCHAIN_FILE=$ENV{ANDROID_NDK}/build/cmake/android.toolchain.cmake
-DANDROID_NATIVE_API_LEVEL=19
-DANDROID_NDK=$ENV{ANDROID_NDK}
@ -39,7 +39,7 @@ if (BUILD_LITE)
-DANDROID_STL=c++_shared -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE})
endif()
endif ()
endif()
mindspore_add_pkg(jpeg_turbo
VER 2.0.4

View File

@ -1,7 +1,7 @@
set(nlohmann_json_CXXFLAGS "-D_FORTIFY_SOURCE=2 -O2")
set(nlohmann_json_CFLAGS "-D_FORTIFY_SOURCE=2 -O2")
if (ENABLE_GITEE)
if(ENABLE_GITEE)
set(REQ_URL "https://gitee.com/mirrors/JSON-for-Modern-CPP/repository/archive/v3.6.1.zip")
set(MD5 "5bda78ce308e6cfcf614dcf1d5ff27a7")
set(INCLUDE "./include")
@ -9,7 +9,7 @@ else()
set(REQ_URL "https://github.com/nlohmann/json/releases/download/v3.6.1/include.zip")
set(MD5 "0dc903888211db3a0f170304cd9f3a89")
set(INCLUDE "./")
endif ()
endif()
mindspore_add_pkg(nlohmann_json
VER 3.6.1

View File

@ -1,15 +1,15 @@
set(libevent_CFLAGS "-fstack-protector-all -D_FORTIFY_SOURCE=2 -O2")
if (NOT CMAKE_SYSTEM_NAME MATCHES "Darwin")
if(NOT CMAKE_SYSTEM_NAME MATCHES "Darwin")
set(libevent_LDFLAGS "-Wl,-z,now")
endif ()
endif()
if (ENABLE_GITEE)
if(ENABLE_GITEE)
set(REQ_URL "https://gitee.com/mirrors/libevent/repository/archive/release-2.1.12-stable.tar.gz")
set(MD5 "c9036513dd9e5b4fa1c81ade23b7ead2")
else()
set(REQ_URL "https://github.com/libevent/libevent/releases/download/release-2.1.12-stable/libevent-2.1.12-stable.tar.gz")
set(MD5 "b5333f021f880fe76490d8a799cd79f4")
endif ()
endif()
mindspore_add_pkg(libevent
VER 2.1.12

View File

@ -1,4 +1,4 @@
if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
set(tiff_CXXFLAGS "-fstack-protector-all -Wno-uninitialized -Wno-unused-parameter -Wno-unused-result \
-Wno-unused-but-set-variable -fPIC -D_FORTIFY_SOURCE=2 -O2")
set(tiff_CFLAGS "-fstack-protector-all -Wno-uninitialized -Wno-unused-parameter -Wno-unused-result \
@ -8,20 +8,20 @@ else()
-Wno-unused-but-set-variable -fPIC -D_FORTIFY_SOURCE=2 -O2")
set(tiff_CFLAGS "-fstack-protector-all -Wno-maybe-uninitialized -Wno-unused-parameter -Wno-unused-result \
-Wno-unused-but-set-variable -fPIC -D_FORTIFY_SOURCE=2 -O2")
if (${CMAKE_SYSTEM_NAME} MATCHES "Windows")
set(tiff_CFLAGS "${tiff_CFLAGS} -Wno-int-to-pointer-cast -Wno-implicit-fallthrough -Wno-pointer-to-int-cast")
if(${CMAKE_SYSTEM_NAME} MATCHES "Windows")
set(tiff_CFLAGS "${tiff_CFLAGS} -Wno-int-to-pointer-cast -Wno-implicit-fallthrough -Wno-pointer-to-int-cast")
endif()
endif()
set(tiff_LDFLAGS "-Wl,-z,relro,-z,now,-z,noexecstack")
if (ENABLE_GITEE)
if(ENABLE_GITEE)
set(REQ_URL "https://gitee.com/mirrors/libtiff/repository/archive/v4.1.0.tar.gz")
set(MD5 "76b951159c8bdf47dba4803659c232d1")
else()
set(REQ_URL "https://gitlab.com/libtiff/libtiff/-/archive/v4.1.0/libtiff-v4.1.0.tar.gz")
set(MD5 "21de8d35c1b21ac82663fa9f56d3350d")
endif ()
endif()
mindspore_add_pkg(tiff
VER 4.1.0

View File

@ -1,6 +1,6 @@
set(onednn_CXXFLAGS "-D_FORTIFY_SOURCE=2 -O2")
set(onednn_CFLAGS "-D_FORTIFY_SOURCE=2 -O2")
if (CMAKE_SYSTEM_NAME MATCHES "Windows")
if(CMAKE_SYSTEM_NAME MATCHES "Windows")
mindspore_add_pkg(onednn
VER 1.6
LIBS dnnl mkldnn
@ -9,13 +9,13 @@ if (CMAKE_SYSTEM_NAME MATCHES "Windows")
URL https://github.com/oneapi-src/oneDNN/releases/download/v1.6/dnnl_win_1.6.0_cpu_vcomp.zip
MD5 fe660e34e9f73ab13a65987819a0712e)
else()
if (ENABLE_GITEE)
if(ENABLE_GITEE)
set(REQ_URL "https://gitee.com/mirrors/MKL-DNN/repository/archive/v1.6.tar.gz")
set(MD5 "44da423a3b6848990a907f99a65b26e7")
else()
set(REQ_URL "https://github.com/oneapi-src/oneDNN/archive/v1.6.tar.gz")
set(MD5 "7cf251209f774ae6d61489ad7c2c3bea")
endif ()
endif()
mindspore_add_pkg(onednn
VER 1.6
LIBS dnnl mkldnn

View File

@ -1,10 +1,10 @@
if (ENABLE_GITEE)
if(ENABLE_GITEE)
set(REQ_URL "https://gitee.com/mirrors/nccl/repository/archive/v2.7.6-1.tar.gz")
set(MD5 "220d232b30cb9bff2e54219399b9f6fb")
else()
set(REQ_URL "https://github.com/NVIDIA/nccl/archive/v2.7.6-1.tar.gz")
set(MD5 "073b19899f374c5ba07d2db02dc38f9f")
endif ()
endif()
set(nccl_CFLAGS "-D_FORTIFY_SOURCE=2 -O2")
mindspore_add_pkg(nccl

View File

@ -1,10 +1,10 @@
if (ENABLE_GITEE)
if(ENABLE_GITEE)
set(REQ_URL "https://gitee.com/mirrors/ompi/repository/archive/v4.0.3.tar.gz")
set(MD5 "f76abc92ae870feff186d790f40ae762")
else()
set(REQ_URL "https://github.com/open-mpi/ompi/archive/v4.0.3.tar.gz")
set(MD5 "86cb724e8fe71741ad3be4e7927928a2")
endif ()
endif()
set(ompi_CXXFLAGS "-D_FORTIFY_SOURCE=2 -O2")
mindspore_add_pkg(ompi

View File

@ -1,10 +1,10 @@
if (ENABLE_GITEE)
if(ENABLE_GITEE)
set(REQ_URL "https://gitee.com/mirrors/ONNX/repository/archive/v1.6.0.tar.gz")
set(MD5 "1bdbcecdd68ea8392630467646776e02")
else()
set(REQ_URL "https://github.com/onnx/onnx/releases/download/v1.6.0/onnx-1.6.0.tar.gz")
set(MD5 "512f2779d6215d4a36f366b6b9acdf1e")
endif ()
endif()
mindspore_add_pkg(ms_onnx
VER 1.6.0

View File

@ -1,4 +1,4 @@
if (ENABLE_GITEE)
if(ENABLE_GITEE)
set(REQ_URL "https://gitee.com/mirrors/OpenCL-Headers/repository/archive/v2020.06.16.tar.gz")
set(MD5 "8797a525aff953ea536ebe338a9f5ef6")
set(PKG_GIT_TAG "")
@ -14,7 +14,7 @@ else()
set(REQ_URL "https://github.com/KhronosGroup/OpenCL-CLHPP/archive/v2.0.12.tar.gz")
set(MD5 "bd00fca8f861b3b65660d719f00a58dd")
__download_pkg(OpenCL-CLHPP ${REQ_URL} ${MD5})
endif ()
endif()
function(gene_opencl BASEPATH)
string(CONCAT CL_SRC_DIR "${BASEPATH}" "/src/runtime/kernel/opencl/cl")

View File

@ -1,8 +1,8 @@
if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
set(opencv_CXXFLAGS "-fstack-protector-all -Wno-uninitialized -Wno-unused-parameter -D_FORTIFY_SOURCE=2 -O2")
set(opencv_CFLAGS "-fstack-protector-all -Wno-uninitialized -Wno-unused-parameter -D_FORTIFY_SOURCE=2 -O2")
set(opencv_LDFLAGS "-Wl")
elseif (${CMAKE_SYSTEM_NAME} MATCHES "Windows")
elseif(${CMAKE_SYSTEM_NAME} MATCHES "Windows")
set(opencv_CXXFLAGS "-fstack-protector-all -Wno-maybe-uninitialized -Wno-unused-parameter -D_FORTIFY_SOURCE=2 -O2")
set(opencv_CFLAGS "-fstack-protector-all -Wno-maybe-uninitialized -Wno-unused-parameter -D_FORTIFY_SOURCE=2 -O2")
set(opencv_CXXFLAGS "${opencv_CXXFLAGS} -Wno-attributes -Wno-unknown-pragmas")
@ -13,15 +13,15 @@ else()
set(opencv_LDFLAGS "-Wl,-z,relro,-z,now,-z,noexecstack")
endif()
if (ENABLE_GITEE)
if(ENABLE_GITEE)
set(REQ_URL "https://gitee.com/mirrors/opencv/repository/archive/4.2.0.tar.gz")
set(MD5 "00424c7c4acde1e26ebf17aaa155bf23")
else()
set(REQ_URL "https://github.com/opencv/opencv/archive/4.2.0.tar.gz")
set(MD5 "e8cb208ce2723481408b604b480183b6")
endif ()
endif()
if (WIN32)
if(WIN32)
mindspore_add_pkg(opencv
VER 4.2.0
LIBS libopencv_core420.dll.a libopencv_imgcodecs420.dll.a libopencv_imgproc420.dll.a
@ -71,7 +71,7 @@ else()
-DTIFF_LIBRARY=${tiff_LIB})
endif()
if (WIN32)
if(WIN32)
include_directories(${opencv_INC})
add_library(mindspore::opencv_core ALIAS opencv::libopencv_core420.dll.a)
add_library(mindspore::opencv_imgcodecs ALIAS opencv::libopencv_imgcodecs420.dll.a)

View File

@ -1,15 +1,15 @@
set(protobuf_USE_STATIC_LIBS ON)
if (BUILD_LITE)
if(BUILD_LITE)
set(protobuf_CXXFLAGS "-fstack-protector-all -Wno-maybe-uninitialized -Wno-unused-parameter -fPIC -fvisibility=hidden -D_FORTIFY_SOURCE=2 -O2")
else(BUILD_LITE)
if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
else()
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
set(protobuf_CXXFLAGS "-fstack-protector-all -Wno-uninitialized -Wno-unused-parameter -fPIC -fvisibility=hidden -D_FORTIFY_SOURCE=2 -O2")
elseif (${CMAKE_SYSTEM_NAME} MATCHES "Windows")
elseif(${CMAKE_SYSTEM_NAME} MATCHES "Windows")
set(protobuf_CXXFLAGS "-fstack-protector-all -Wno-maybe-uninitialized -Wno-unused-parameter -fPIC -fvisibility=hidden -D_FORTIFY_SOURCE=2 -O2")
else()
set(protobuf_CXXFLAGS "-fstack-protector-all -Wno-maybe-uninitialized -Wno-unused-parameter -fPIC -fvisibility=hidden -D_FORTIFY_SOURCE=2 -D_GLIBCXX_USE_CXX11_ABI=0 -O2")
endif()
endif(BUILD_LITE)
endif()
set(protobuf_LDFLAGS "-Wl,-z,relro,-z,now,-z,noexecstack")
set(_ms_tmp_CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})
@ -17,13 +17,13 @@ set(CMAKE_CXX_FLAGS ${_ms_tmp_CMAKE_CXX_FLAGS})
string(REPLACE " -Wall" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
string(REPLACE " -Werror" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
if (ENABLE_GITEE)
if(ENABLE_GITEE)
set(REQ_URL "https://gitee.com/mirrors/protobuf_source/repository/archive/v3.8.0.tar.gz")
set(MD5 "eba86ae9f07ba5cfbaf8af3bc4e84236")
else()
set(REQ_URL "https://github.com/protocolbuffers/protobuf/archive/v3.8.0.tar.gz")
set(MD5 "3d9e32700639618a4d2d342c99d4507a")
endif ()
endif()
mindspore_add_pkg(protobuf
VER 3.8.0
@ -90,7 +90,7 @@ function(ms_protobuf_generate_py c_var h_var py_var)
list(APPEND ${c_var} "${CMAKE_BINARY_DIR}/proto/${file_name}.pb.cc")
list(APPEND ${h_var} "${CMAKE_BINARY_DIR}/proto/${file_name}.pb.h")
list(APPEND ${py_var} "${CMAKE_BINARY_DIR}/proto/${file_name}_pb2.py")
if (WIN32)
if(WIN32)
add_custom_command(
OUTPUT "${CMAKE_BINARY_DIR}/proto/${file_name}.pb.cc"
"${CMAKE_BINARY_DIR}/proto/${file_name}.pb.h"
@ -103,7 +103,7 @@ function(ms_protobuf_generate_py c_var h_var py_var)
COMMAND perl -pi.bak -e "s/import (.+_pb2.*)/from . import \\1/" "${CMAKE_BINARY_DIR}/proto/${file_name}_pb2.py"
COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_BINARY_DIR}/proto/${file_name}_pb2.py" "${PROJECT_SOURCE_DIR}/mindspore/train/"
DEPENDS protobuf::protoc ${abs_file}
COMMENT "Running C++ protocol buffer compiler on ${file}" VERBATIM )
COMMENT "Running C++ protocol buffer compiler on ${file}" VERBATIM)
else()
add_custom_command(
OUTPUT "${CMAKE_BINARY_DIR}/proto/${file_name}.pb.cc"

View File

@ -1,13 +1,13 @@
if (ENABLE_GITEE)
if(ENABLE_GITEE)
set(REQ_URL "https://gitee.com/mirrors/ps-lite/repository/archive/34fd45cae457d59850fdcb2066467778d0673f21.zip")
set(MD5 "0d1543b8dcb0bc3610637e1643c94eb4")
else()
set(REQ_URL "https://github.com/dmlc/ps-lite/archive/34fd45cae457d59850fdcb2066467778d0673f21.zip")
set(MD5 "393c0e27b68bfaf96718caa3aa96f5a3")
endif ()
endif()
set(pslite_USE_STATIC_LIBS ON)
if (${ENABLE_IBVERBS} STREQUAL "ON")
if(${ENABLE_IBVERBS} STREQUAL "ON")
set(pslite_CXXFLAGS "USE_IBVERBS=1")
endif()
mindspore_add_pkg(pslite

View File

@ -1,34 +1,34 @@
if (ENABLE_GITEE)
if(ENABLE_GITEE)
set(REQ_URL "https://gitee.com/mirrors/sentencepiece/repository/archive/v0.1.92.tar.gz")
set(MD5 "618f5590c99884866c01cb773096c523")
else()
set(REQ_URL "https://github.com/google/sentencepiece/archive/v0.1.92.tar.gz")
set(MD5 "5dfd2241914b5598a68b2a8542ed8e91")
endif ()
endif()
if (WIN32)
set(sentencepiece_CXXFLAGS "-D_FORTIFY_SOURCE=2 -O2 -Wno-unused-result -Wno-stringop-overflow -Wno-format-extra-args -Wno-format")
set(sentencepiece_CFLAGS "-D_FORTIFY_SOURCE=2 -O2")
mindspore_add_pkg(sentencepiece
VER 0.1.92
LIBS sentencepiece sentencepiece_train
URL ${REQ_URL}
CMAKE_OPTION -DCMAKE_BUILD_TYPE=Release -DSPM_USE_BUILTIN_PROTOBUF=ON
MD5 ${MD5}
)
else ()
set(sentencepiece_CXXFLAGS "-D_FORTIFY_SOURCE=2 -O2 -Wno-unused-result -Wno-sign-compare")
set(sentencepiece_CFLAGS "-D_FORTIFY_SOURCE=2 -O2")
mindspore_add_pkg(sentencepiece
VER 0.1.92
LIBS sentencepiece sentencepiece_train
URL ${REQ_URL}
CMAKE_OPTION -DCMAKE_BUILD_TYPE=Release -DSPM_USE_BUILTIN_PROTOBUF=OFF -DSPM_ENABLE_SHARED=OFF -DPROTOBUF_INC=${protobuf_INC}
MD5 ${MD5}
PATCHES ${CMAKE_SOURCE_DIR}/third_party/patch/sentencepiece/sentencepiece.patch001
)
endif ()
if(WIN32)
set(sentencepiece_CXXFLAGS "-D_FORTIFY_SOURCE=2 -O2 -Wno-unused-result -Wno-stringop-overflow -Wno-format-extra-args -Wno-format")
set(sentencepiece_CFLAGS "-D_FORTIFY_SOURCE=2 -O2")
mindspore_add_pkg(sentencepiece
VER 0.1.92
LIBS sentencepiece sentencepiece_train
URL ${REQ_URL}
CMAKE_OPTION -DCMAKE_BUILD_TYPE=Release -DSPM_USE_BUILTIN_PROTOBUF=ON
MD5 ${MD5}
)
else()
set(sentencepiece_CXXFLAGS "-D_FORTIFY_SOURCE=2 -O2 -Wno-unused-result -Wno-sign-compare")
set(sentencepiece_CFLAGS "-D_FORTIFY_SOURCE=2 -O2")
mindspore_add_pkg(sentencepiece
VER 0.1.92
LIBS sentencepiece sentencepiece_train
URL ${REQ_URL}
CMAKE_OPTION -DCMAKE_BUILD_TYPE=Release -DSPM_USE_BUILTIN_PROTOBUF=OFF -DSPM_ENABLE_SHARED=OFF -DPROTOBUF_INC=${protobuf_INC}
MD5 ${MD5}
PATCHES ${CMAKE_SOURCE_DIR}/third_party/patch/sentencepiece/sentencepiece.patch001
)
endif()
include_directories(${sentencepiece_INC})
add_library(mindspore::sentencepiece ALIAS sentencepiece::sentencepiece)
add_library(mindspore::sentencepiece_train ALIAS sentencepiece::sentencepiece_train)

View File

@ -1,13 +1,13 @@
if (ENABLE_GITEE)
if(ENABLE_GITEE)
set(REQ_URL "https://gitee.com/mirrors/sqlite/repository/archive/version-3.32.2.tar.gz")
set(MD5 "7312cad1739d8a73b14abddc850c0afa")
else()
set(REQ_URL "https://github.com/sqlite/sqlite/archive/version-3.32.2.tar.gz")
set(MD5 "ea6d3b3289b4ac216fb06081a01ef101")
endif ()
endif()
if (WIN32)
if(WIN32)
mindspore_add_pkg(sqlite
VER 3.32.2
LIBS sqlite3
@ -17,10 +17,10 @@ if (WIN32)
CMAKE_OPTION " "
)
else ()
set(sqlite_USE_STATIC_LIBS ON)
else()
set(sqlite_USE_STATIC_LIBS ON)
set(sqlite_CXXFLAGS)
if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
set(sqlite_CFLAGS "-fstack-protector-all -Wno-uninitialized -Wno-unused-parameter -fPIC -D_FORTIFY_SOURCE=2 -O2")
else()
set(sqlite_CFLAGS "-fstack-protector-all -Wno-maybe-uninitialized -Wno-unused-parameter -fPIC -D_FORTIFY_SOURCE=2 -O2")
@ -33,7 +33,7 @@ else ()
MD5 ${MD5}
PATCHES ${CMAKE_SOURCE_DIR}/third_party/patch/sqlite/sqlite.patch001
CONFIGURE_COMMAND ./configure --enable-shared=no --disable-tcl --disable-editline --enable-json1)
endif ()
endif()
include_directories(${sqlite_INC})
add_library(mindspore::sqlite ALIAS sqlite::sqlite3)

View File

@ -1,18 +1,18 @@
set(tinyxml2_CXXFLAGS "-fstack-protector -D_FORTIFY_SOURCE=2 -O2 -Wno-unused-result")
set(tinyxml2_CFLAGS "-fstack-protector -D_FORTIFY_SOURCE=2 -O2")
if (ENABLE_GITEE)
if(ENABLE_GITEE)
set(REQ_URL "https://gitee.com/mirrors/tinyxml2/repository/archive/8.0.0.tar.gz")
set(MD5 "6a70cea637d0b17179e8bfd77860f811")
else ()
else()
set(REQ_URL "https://github.com/leethomason/tinyxml2/archive/8.0.0.tar.gz")
set(MD5 "5dc535c8b34ee621fe2128f072d275b5")
endif ()
endif()
if (NOT WIN32 AND NOT APPLE)
set(tinyxml2_LDFLAGS "-Wl,-z,relro,-z,now,-z,noexecstack")
endif ()
if(NOT WIN32 AND NOT APPLE)
set(tinyxml2_LDFLAGS "-Wl,-z,relro,-z,now,-z,noexecstack")
endif()
mindspore_add_pkg(tinyxml2
VER 8.0.0

View File

@ -1,10 +1,10 @@
if (ENABLE_GITEE)
if(ENABLE_GITEE)
set(REQ_URL "https://gitee.com/mirrors/incubator-tvm/repository/archive/v0.6.0.tar.gz")
set(MD5 "7b22965745cf1c6208a4e367fb86a585")
else()
set(REQ_URL "https://github.com/apache/incubator-tvm/release/download/v0.6.0/apache-tvm-src-v0.6.0-incubating.tar.gz")
set(MD5 "2d77a005f0046d937b99c67de82f6438")
endif ()
endif()
set(incubator_tvm_predict_CXXFLAGS "-D_FORTIFY_SOURCE=2 -O2")
set(incubator_tvm_predict_CFLAGS "-D_FORTIFY_SOURCE=2 -O2")
mindspore_add_pkg(incubator_tvm_predict

View File

@ -1,10 +1,10 @@
if (ENABLE_GITEE)
if(ENABLE_GITEE)
set(REQ_URL "https://gitee.com/mirrors/zlib/repository/archive/v1.2.11.tar.gz")
set(MD5 "be6d144068d8835e86a81b3f36b66a42")
else()
set(REQ_URL "https://github.com/madler/zlib/archive/v1.2.11.tar.gz")
set(MD5 "0095d2d2d1f3442ce1318336637b695f")
endif ()
endif()
mindspore_add_pkg(zlib
VER 1.2.11

View File

@ -1,9 +1,9 @@
set(SECURE_CXX_FLAGS "")
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
if (WIN32)
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
if(WIN32)
set(SECURE_CXX_FLAGS "-fstack-protector-all")
else()
set(SECURE_CXX_FLAGS "-fstack-protector-all -Wl,-z,relro,-z,now,-z,noexecstack")
set(SECURE_CXX_FLAGS "-fstack-protector-all -Wl,-z,relro,-z,now,-z,noexecstack")
endif()
endif()
set(_ms_tmp_CMAKE_CXX_FLAGS_F ${CMAKE_CXX_FLAGS})
@ -15,7 +15,7 @@ include(${CMAKE_SOURCE_DIR}/cmake/external_libs/json.cmake)
include(${CMAKE_SOURCE_DIR}/cmake/dependency_securec.cmake)
include(${CMAKE_SOURCE_DIR}/cmake/external_libs/protobuf.cmake)
if (MS_BUILD_GRPC)
if(MS_BUILD_GRPC)
# build dependencies of gRPC
include(${CMAKE_SOURCE_DIR}/cmake/external_libs/absl.cmake)
include(${CMAKE_SOURCE_DIR}/cmake/external_libs/c-ares.cmake)
@ -32,7 +32,7 @@ include(${CMAKE_SOURCE_DIR}/cmake/external_libs/flatbuffers.cmake)
if(USE_GLOG)
include(${CMAKE_SOURCE_DIR}/cmake/external_libs/glog.cmake)
endif()
if (ENABLE_CPU AND (ENABLE_D OR ENABLE_GPU))
if(ENABLE_CPU AND (ENABLE_D OR ENABLE_GPU))
include(${CMAKE_SOURCE_DIR}/cmake/external_libs/zeromq.cmake)
include(${CMAKE_SOURCE_DIR}/cmake/external_libs/pslite.cmake)
endif()
@ -40,21 +40,21 @@ endif()
find_package(Python3)
include_directories(${Python3_INCLUDE_DIRS})
include_directories(${CMAKE_SOURCE_DIR}/third_party)
if (ENABLE_MPI)
if(ENABLE_MPI)
include(${CMAKE_SOURCE_DIR}/cmake/external_libs/ompi.cmake)
endif()
if (ENABLE_CPU)
if(ENABLE_CPU)
include(${CMAKE_SOURCE_DIR}/cmake/external_libs/mkl_dnn.cmake)
endif()
if (ENABLE_GPU)
if (ENABLE_MPI)
if(ENABLE_GPU)
if(ENABLE_MPI)
include(${CMAKE_SOURCE_DIR}/cmake/external_libs/nccl.cmake)
endif()
endif()
if (ENABLE_GE)
if(ENABLE_GE)
include_directories(${CMAKE_SOURCE_DIR}/third_party/ge/include)
include_directories(${CMAKE_SOURCE_DIR}/third_party/ge/include/external)
include_directories(${CMAKE_SOURCE_DIR}/third_party/ge/include/external/graph)
@ -67,7 +67,7 @@ elseif(ENABLE_D OR ENABLE_ACL OR ENABLE_TESTCASES)
include_directories(${CMAKE_SOURCE_DIR}/graphengine/metadef/inc/external/graph)
endif()
if (ENABLE_GE OR ENABLE_D OR ENABLE_ACL OR ENABLE_TESTCASES)
if(ENABLE_GE OR ENABLE_D OR ENABLE_ACL OR ENABLE_TESTCASES)
include_directories(${CMAKE_SOURCE_DIR}/graphengine/inc)
include_directories(${CMAKE_SOURCE_DIR}/graphengine/inc/external)
include_directories(${CMAKE_SOURCE_DIR}/graphengine/inc/framework)
@ -78,7 +78,7 @@ if (ENABLE_GE OR ENABLE_D OR ENABLE_ACL OR ENABLE_TESTCASES)
include_directories(${CMAKE_SOURCE_DIR}/graphengine/metadef/inc/external/graph)
endif()
if (ENABLE_MINDDATA)
if(ENABLE_MINDDATA)
include(${CMAKE_SOURCE_DIR}/cmake/external_libs/icu4c.cmake)
include(${CMAKE_SOURCE_DIR}/cmake/external_libs/libtiff.cmake)
include(${CMAKE_SOURCE_DIR}/cmake/external_libs/opencv.cmake)
@ -88,7 +88,7 @@ if (ENABLE_MINDDATA)
include(${CMAKE_SOURCE_DIR}/cmake/external_libs/sentencepiece.cmake)
endif()
if (ENABLE_MINDDATA)
if(ENABLE_MINDDATA)
include(${CMAKE_SOURCE_DIR}/cmake/external_libs/jpeg_turbo.cmake)
endif()

View File

@ -14,7 +14,7 @@ option(USE_GLOG "Use glog to output log" OFF)
option(ENABLE_PROFILE "Enable pipeline profile, default off" OFF)
option(ENABLE_TIMELINE "Enable time line record" OFF)
option(ENABLE_DUMP_PROTO "Enable dump anf graph to file in ProtoBuffer format, default on" ON)
option(ENABLE_DUMP_IR "Enable dump funciton graph ir, default on" ON)
option(ENABLE_DUMP_IR "Enable dump function graph ir, default on" ON)
option(ENABLE_MPI "enable mpi" OFF)
option(ENABLE_AKG "enable akg" OFF)
option(ENABLE_DEBUGGER "enable debugger" OFF)
@ -22,59 +22,59 @@ option(ENABLE_IBVERBS "enable IBVERBS for parameter server" OFF)
option(ENABLE_PYTHON "Enable python" ON)
option(ENABLE_ACL "enable acl" OFF)
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
if (WIN32)
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
if(WIN32)
set(OPTION_CXX_FLAGS "${OPTION_CXX_FLAGS} -fstack-protector-all")
else()
set(OPTION_CXX_FLAGS "${OPTION_CXX_FLAGS} -fstack-protector-all -Wl,-z,relro,-z,now,-z,noexecstack")
endif()
endif()
if (CMAKE_SYSTEM_NAME MATCHES "Darwin")
if(CMAKE_SYSTEM_NAME MATCHES "Darwin")
set(OPTION_CXX_FLAGS "${OPTION_CXX_FLAGS} -Wsign-compare")
endif()
if (ENABLE_COVERAGE)
if(ENABLE_COVERAGE)
set(COVERAGE_COMPILER_FLAGS "-g --coverage -fprofile-arcs -ftest-coverage")
set(OPTION_CXX_FLAGS "${OPTION_CXX_FLAGS} ${COVERAGE_COMPILER_FLAGS}")
endif()
if (ENABLE_ASAN)
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
if(ENABLE_ASAN)
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
set(OPTION_CXX_FLAGS "${OPTION_CXX_FLAGS} -fsanitize=address -fsanitize-recover=address -fno-omit-frame-pointer -fsanitize=undefined")
else()
set(OPTION_CXX_FLAGS "${OPTION_CXX_FLAGS} -fsanitize=address -fno-omit-frame-pointer -static-libsan -fsanitize=undefined")
endif()
endif()
if (DEBUG_MODE)
if(DEBUG_MODE)
set(CMAKE_BUILD_TYPE "Debug")
else()
set(CMAKE_BUILD_TYPE "Release")
endif()
if ((CMAKE_SYSTEM_PROCESSOR MATCHES "aarch64") OR (CMAKE_BUILD_TYPE STREQUAL Release))
if((CMAKE_SYSTEM_PROCESSOR MATCHES "aarch64") OR (CMAKE_BUILD_TYPE STREQUAL Release))
set(PYBIND11_LTO_CXX_FLAGS FALSE)
endif()
if (NOT BUILD_PATH)
if(NOT BUILD_PATH)
set(BUILD_PATH "${CMAKE_SOURCE_DIR}/build")
endif()
if (ENABLE_GE OR ENABLE_D)
if(ENABLE_GE OR ENABLE_D)
set(ENABLE_TDTQUE ON)
endif()
if (ENABLE_GPU)
if(ENABLE_GPU)
set(ENABLE_GPUQUE ON)
add_compile_definitions(ENABLE_GPU_COLLECTIVE)
endif()
if (ENABLE_CPU)
if(ENABLE_CPU)
add_compile_definitions(ENABLE_CPU)
endif()
if (ENABLE_GE)
if(ENABLE_GE)
add_compile_definitions(ENABLE_GE)
add_compile_definitions(CUSTOM_OP)
endif()
@ -89,29 +89,29 @@ if(USE_GLOG)
add_compile_definitions(USE_GLOG)
endif()
if (ENABLE_PROFILE)
if(ENABLE_PROFILE)
add_compile_definitions(ENABLE_PROFILE)
endif()
if (ENABLE_TIMELINE)
if(ENABLE_TIMELINE)
add_compile_definitions(ENABLE_TIMELINE)
endif()
if (ENABLE_LOAD_ANF_IR)
if(ENABLE_LOAD_ANF_IR)
add_compile_definitions(ENABLE_LOAD_ANF_IR)
endif()
if (ENABLE_TESTCASES OR (NOT ENABLE_D AND NOT ENABLE_GE))
if(ENABLE_TESTCASES OR (NOT ENABLE_D AND NOT ENABLE_GE))
add_compile_definitions(NO_DLIB=1)
endif()
if(ENABLE_DUMP_IR)
add_compile_definitions(ENABLE_DUMP_IR)
endif(ENABLE_DUMP_IR)
endif()
if(ENABLE_MINDDATA)
add_compile_definitions(ENABLE_MINDDATA)
if (ENABLE_TDTQUE)
if(ENABLE_TDTQUE)
add_compile_definitions(ENABLE_TDTQUE)
endif()
endif()
@ -120,9 +120,9 @@ if(ENABLE_DEBUGGER)
add_compile_definitions(ENABLE_DEBUGGER)
endif()
if (ENABLE_DEBUGGER OR ENABLE_TESTCASES)
if(ENABLE_DEBUGGER OR ENABLE_TESTCASES)
set(MS_BUILD_GRPC ON)
endif()
if (ENABLE_MINDDATA AND NOT CMAKE_SYSTEM_NAME MATCHES "Windows")
if(ENABLE_MINDDATA AND NOT CMAKE_SYSTEM_NAME MATCHES "Windows")
set(MS_BUILD_GRPC ON)
endif()

View File

@ -9,31 +9,31 @@ set(CPACK_EXTERNAL_PACKAGE_SCRIPT ${CMAKE_SOURCE_DIR}/cmake/package_script.cmake
set(CPACK_EXTERNAL_ENABLE_STAGING true)
set(CPACK_TEMPORARY_PACKAGE_FILE_NAME ${CMAKE_SOURCE_DIR}/build/package/mindspore)
set(CPACK_TEMPORARY_INSTALL_DIRECTORY ${CMAKE_SOURCE_DIR}/build/package/mindspore)
if (ENABLE_GE)
if(ENABLE_GE)
set(CPACK_MS_BACKEND "ge")
set(CPACK_MS_TARGET "ascend-cpu")
set(CPACK_MS_PACKAGE_NAME "mindspore")
elseif (ENABLE_GPU)
elseif(ENABLE_GPU)
set(CPACK_MS_BACKEND "ms")
set(CPACK_MS_TARGET "gpu-cpu")
set(CPACK_MS_PACKAGE_NAME "mindspore-gpu")
elseif (ENABLE_D)
elseif(ENABLE_D)
set(CPACK_MS_BACKEND "ms")
set(CPACK_MS_TARGET "ascend-cpu")
set(CPACK_MS_PACKAGE_NAME "mindspore-ascend")
elseif (ENABLE_CPU)
elseif(ENABLE_CPU)
set(CPACK_MS_BACKEND "ms")
set(CPACK_MS_TARGET "cpu")
set(CPACK_MS_PACKAGE_NAME "mindspore")
elseif (ENABLE_ACL)
elseif(ENABLE_ACL)
set(CPACK_MS_BACKEND "debug")
set(CPACK_MS_TARGET "ascend-gpu-cpu")
set(CPACK_MS_PACKAGE_NAME "mindspore-ascend")
else ()
else()
set(CPACK_MS_BACKEND "debug")
set(CPACK_MS_TARGET "ascend-gpu-cpu")
set(CPACK_MS_PACKAGE_NAME "mindspore")
endif ()
endif()
include(CPack)
# set install path
@ -43,7 +43,7 @@ set(INSTALL_BASE_DIR ".")
set(INSTALL_BIN_DIR "bin")
set(INSTALL_CFG_DIR "config")
if (CMAKE_SYSTEM_NAME MATCHES "Windows")
if(CMAKE_SYSTEM_NAME MATCHES "Windows")
set(INSTALL_LIB_DIR ".")
set(onednn_LIBPATH ${onednn_LIBPATH}/../bin/)
set(glog_LIBPATH ${glog_LIBPATH}/../bin/)
@ -52,9 +52,9 @@ if (CMAKE_SYSTEM_NAME MATCHES "Windows")
set(sqlite_LIBPATH ${sqlite_LIBPATH}/../bin/)
set(tinyxml2_LIBPATH ${tinyxml2_LIBPATH}/../bin/)
set(sentencepiece_LIBPATH ${sentencepiece_LIBPATH}/../bin/)
else ()
else()
set(INSTALL_LIB_DIR "lib")
endif ()
endif()
# set package files
install(
@ -75,14 +75,14 @@ install(
COMPONENT mindspore
)
if (USE_GLOG)
if(USE_GLOG)
file(GLOB_RECURSE GLOG_LIB_LIST ${glog_LIBPATH}/libglog*)
install(
FILES ${GLOG_LIB_LIST}
DESTINATION ${INSTALL_LIB_DIR}
COMPONENT mindspore
)
endif ()
endif()
file(GLOB_RECURSE LIBEVENT_LIB_LIST
${libevent_LIBPATH}/libevent*${CMAKE_SHARED_LIBRARY_SUFFIX}*
@ -95,13 +95,13 @@ install(
COMPONENT mindspore
)
if (ENABLE_MINDDATA)
if(ENABLE_MINDDATA)
install(
TARGETS _c_dataengine _c_mindrecord
DESTINATION ${INSTALL_BASE_DIR}
COMPONENT mindspore
)
if (CMAKE_SYSTEM_NAME MATCHES "Linux")
if(CMAKE_SYSTEM_NAME MATCHES "Linux")
install(
TARGETS cache_admin cache_server
OPTIONAL
@ -133,7 +133,7 @@ if (ENABLE_MINDDATA)
DESTINATION ${INSTALL_LIB_DIR}
COMPONENT mindspore
)
if (CMAKE_SYSTEM_NAME MATCHES "Windows")
if(CMAKE_SYSTEM_NAME MATCHES "Windows")
message("icu4c does not support windows system temporarily")
else()
file(GLOB_RECURSE ICU4C_LIB_LIST
@ -147,56 +147,56 @@ if (ENABLE_MINDDATA)
COMPONENT mindspore
)
endif()
endif ()
endif()
if (ENABLE_CPU)
if (CMAKE_SYSTEM_NAME MATCHES "Linux")
if(ENABLE_CPU)
if(CMAKE_SYSTEM_NAME MATCHES "Linux")
file(GLOB_RECURSE DNNL_LIB_LIST ${onednn_LIBPATH}/libdnnl${CMAKE_SHARED_LIBRARY_SUFFIX}*)
elseif (CMAKE_SYSTEM_NAME MATCHES "Darwin")
elseif(CMAKE_SYSTEM_NAME MATCHES "Darwin")
file(GLOB_RECURSE DNNL_LIB_LIST ${onednn_LIBPATH}/libdnnl*${CMAKE_SHARED_LIBRARY_SUFFIX}*)
elseif (CMAKE_SYSTEM_NAME MATCHES "Windows")
elseif(CMAKE_SYSTEM_NAME MATCHES "Windows")
file(GLOB_RECURSE DNNL_LIB_LIST ${onednn_LIBPATH}/dnnl.dll)
endif ()
endif()
install(
FILES ${DNNL_LIB_LIST}
DESTINATION ${INSTALL_LIB_DIR}
COMPONENT mindspore
)
endif ()
endif()
if (ENABLE_MPI)
if (ENABLE_GPU)
if(ENABLE_MPI)
if(ENABLE_GPU)
install(
TARGETS _ms_mpi
DESTINATION ${INSTALL_BASE_DIR}
COMPONENT mindspore
)
endif ()
if (ENABLE_CPU)
endif()
if(ENABLE_CPU)
install(
TARGETS mpi_adapter
DESTINATION ${INSTALL_LIB_DIR}
COMPONENT mindspore
)
endif ()
endif ()
endif()
endif()
if (ENABLE_GPU)
if (ENABLE_MPI)
if(ENABLE_GPU)
if(ENABLE_MPI)
install(
TARGETS gpu_collective
DESTINATION ${INSTALL_LIB_DIR}
COMPONENT mindspore
)
endif ()
endif()
install(
TARGETS gpu_queue
DESTINATION ${INSTALL_LIB_DIR}
COMPONENT mindspore
)
endif ()
endif()
if (ENABLE_CPU AND (ENABLE_D OR ENABLE_GPU))
if(ENABLE_CPU AND (ENABLE_D OR ENABLE_GPU))
install(
TARGETS ps_cache
DESTINATION ${INSTALL_LIB_DIR}
@ -204,20 +204,20 @@ if (ENABLE_CPU AND (ENABLE_D OR ENABLE_GPU))
)
endif()
if (ENABLE_TESTCASES)
if(ENABLE_TESTCASES)
file(GLOB_RECURSE LIBEVENT_LIB_LIST
${libevent_LIBPATH}/libevent*
${libevent_LIBPATH}/libevent_pthreads*
)
endif ()
endif()
if (NOT ENABLE_GE)
if (ENABLE_D OR ENABLE_ACL)
if (DEFINED ENV{ASCEND_CUSTOM_PATH})
if(NOT ENABLE_GE)
if(ENABLE_D OR ENABLE_ACL)
if(DEFINED ENV{ASCEND_CUSTOM_PATH})
set(ASCEND_PATH $ENV{ASCEND_CUSTOM_PATH})
else ()
else()
set(ASCEND_PATH /usr/local/Ascend)
endif ()
endif()
set(ASCEND_DRIVER_PATH ${ASCEND_PATH}/driver/lib64/common)
install(
@ -226,7 +226,7 @@ if (NOT ENABLE_GE)
COMPONENT mindspore
)
if (ENABLE_D)
if(ENABLE_D)
install(
TARGETS ms_profile
DESTINATION ${INSTALL_LIB_DIR}
@ -240,8 +240,8 @@ if (NOT ENABLE_GE)
DESTINATION ${INSTALL_LIB_DIR}
COMPONENT mindspore
)
endif ()
elseif (ENABLE_TESTCASES)
endif()
elseif(ENABLE_TESTCASES)
install(
FILES
${CMAKE_BINARY_DIR}/graphengine/metadef/graph/libgraph.so
@ -250,10 +250,10 @@ if (NOT ENABLE_GE)
DESTINATION ${INSTALL_LIB_DIR}
COMPONENT mindspore
)
endif ()
endif ()
endif()
endif()
if (CMAKE_SYSTEM_NAME MATCHES "Windows")
if(CMAKE_SYSTEM_NAME MATCHES "Windows")
get_filename_component(CXX_DIR ${CMAKE_CXX_COMPILER} PATH)
file(GLOB CXX_LIB_LIST ${CXX_DIR}/*.dll)
@ -267,7 +267,7 @@ if (CMAKE_SYSTEM_NAME MATCHES "Windows")
DESTINATION ${INSTALL_LIB_DIR}
COMPONENT mindspore
)
endif ()
endif()
# set python files
file(GLOB MS_PY_LIST ${CMAKE_SOURCE_DIR}/mindspore/*.py)
@ -295,7 +295,7 @@ install(
COMPONENT mindspore
)
if ((ENABLE_D OR ENABLE_GPU) AND ENABLE_AKG)
if((ENABLE_D OR ENABLE_GPU) AND ENABLE_AKG)
set (AKG_PATH ${CMAKE_SOURCE_DIR}/build/mindspore/akg)
install(
DIRECTORY
@ -303,15 +303,15 @@ if ((ENABLE_D OR ENABLE_GPU) AND ENABLE_AKG)
DESTINATION ${INSTALL_PY_DIR}/..
COMPONENT mindspore
)
endif ()
endif()
if (EXISTS ${CMAKE_SOURCE_DIR}/mindspore/dataset)
if(EXISTS ${CMAKE_SOURCE_DIR}/mindspore/dataset)
install(
DIRECTORY ${CMAKE_SOURCE_DIR}/mindspore/dataset
DESTINATION ${INSTALL_PY_DIR}
COMPONENT mindspore
)
endif ()
endif()
## Public header files
install(

View File

@ -1,9 +1,9 @@
include(FetchContent)
set(FETCHCONTENT_QUIET OFF)
if (CMAKE_SYSTEM_NAME MATCHES "Windows" AND ${CMAKE_VERSION} VERSION_GREATER_EQUAL 3.17.0)
if(CMAKE_SYSTEM_NAME MATCHES "Windows" AND ${CMAKE_VERSION} VERSION_GREATER_EQUAL 3.17.0)
set(CMAKE_FIND_LIBRARY_SUFFIXES .dll ${CMAKE_FIND_LIBRARY_SUFFIXES})
endif ()
endif()
function(mindspore_add_submodule_obj des_submodule_objs sub_dir submodule_name_obj)
@ -20,45 +20,45 @@ function(mindspore_add_submodule_obj des_submodule_objs sub_dir submodule_name_o
endfunction()
if (DEFINED ENV{MSLIBS_CACHE_PATH})
if(DEFINED ENV{MSLIBS_CACHE_PATH})
set(_MS_LIB_CACHE $ENV{MSLIBS_CACHE_PATH})
else()
set(_MS_LIB_CACHE ${CMAKE_BINARY_DIR}/.mslib)
endif ()
endif()
message("MS LIBS CACHE PATH: ${_MS_LIB_CACHE}")
if (NOT EXISTS ${_MS_LIB_CACHE})
if(NOT EXISTS ${_MS_LIB_CACHE})
file(MAKE_DIRECTORY ${_MS_LIB_CACHE})
endif ()
endif()
if (DEFINED ENV{MSLIBS_SERVER} AND NOT ENABLE_GITEE)
if(DEFINED ENV{MSLIBS_SERVER} AND NOT ENABLE_GITEE)
set(LOCAL_LIBS_SERVER $ENV{MSLIBS_SERVER})
message("LOCAL_LIBS_SERVER: ${LOCAL_LIBS_SERVER}")
endif ()
endif()
include(ProcessorCount)
ProcessorCount(N)
if (JOBS)
if(JOBS)
set(THNUM ${JOBS})
else()
set(JOBS 8)
if (${JOBS} GREATER ${N})
if(${JOBS} GREATER ${N})
set(THNUM ${N})
else()
set(THNUM ${JOBS})
endif()
endif ()
endif()
message("set make thread num: ${THNUM}")
if(LOCAL_LIBS_SERVER)
if (NOT ENV{no_proxy})
if(NOT ENV{no_proxy})
set(ENV{no_proxy} "${LOCAL_LIBS_SERVER}")
else()
string(FIND $ENV{no_proxy} ${LOCAL_LIBS_SERVER} IP_POS)
if (${IP_POS} EQUAL -1)
if(${IP_POS} EQUAL -1)
set(ENV{no_proxy} "$ENV{no_proxy},${LOCAL_LIBS_SERVER}")
endif ()
endif ()
endif()
endif()
endif()
function(__download_pkg pkg_name pkg_url pkg_md5)
@ -92,10 +92,10 @@ function(__download_pkg_with_git pkg_name pkg_url pkg_git_commit pkg_md5)
URL_HASH MD5=${pkg_md5}
)
else()
FetchContent_Declare(
FetchContent_Declare(
${pkg_name}
GIT_REPOSITORY ${pkg_url}
GIT_TAG ${pkg_git_commit})
GIT_REPOSITORY ${pkg_url}
GIT_TAG ${pkg_git_commit})
endif()
FetchContent_GetProperties(${pkg_name})
message("download: ${${pkg_name}_SOURCE_DIR} , ${pkg_name} , ${pkg_url}")
@ -128,10 +128,10 @@ function(__find_pkg_then_add_target pkg_name pkg_exe lib_path)
foreach(_LIB_NAME ${ARGN})
set(_LIB_SEARCH_NAME ${_LIB_NAME})
set(_LIB_TYPE SHARED)
if (${pkg_name}_USE_STATIC_LIBS)
if(${pkg_name}_USE_STATIC_LIBS)
set(_LIB_SEARCH_NAME "${CMAKE_STATIC_LIBRARY_PREFIX}${_LIB_NAME}${CMAKE_STATIC_LIBRARY_SUFFIX}")
set(_LIB_TYPE STATIC)
endif ()
endif()
set(${_LIB_NAME}_LIB ${_LIB_NAME}_LIB-NOTFOUND)
find_library(${_LIB_NAME}_LIB ${_LIB_SEARCH_NAME} PATHS ${${pkg_name}_BASE_DIR}/${lib_path} NO_DEFAULT_PATH)
if(NOT ${_LIB_NAME}_LIB)
@ -139,32 +139,32 @@ function(__find_pkg_then_add_target pkg_name pkg_exe lib_path)
endif()
add_library(${pkg_name}::${_LIB_NAME} ${_LIB_TYPE} IMPORTED GLOBAL)
if (WIN32 AND ${_LIB_TYPE} STREQUAL "SHARED")
if(WIN32 AND ${_LIB_TYPE} STREQUAL "SHARED")
set_target_properties(${pkg_name}::${_LIB_NAME} PROPERTIES IMPORTED_IMPLIB_RELEASE ${${_LIB_NAME}_LIB})
else()
set_target_properties(${pkg_name}::${_LIB_NAME} PROPERTIES IMPORTED_LOCATION ${${_LIB_NAME}_LIB})
endif()
if (EXISTS ${${pkg_name}_BASE_DIR}/include)
set_target_properties(${pkg_name}::${_LIB_NAME} PROPERTIES
if(EXISTS ${${pkg_name}_BASE_DIR}/include)
set_target_properties(${pkg_name}::${_LIB_NAME} PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${${pkg_name}_BASE_DIR}/include")
endif ()
endif()
list(APPEND ${pkg_name}_LIBS ${pkg_name}::${_LIB_NAME})
message("found ${${_LIB_NAME}_LIB}")
STRING( REGEX REPLACE "(.+)/(.+)" "\\1" LIBPATH ${${_LIB_NAME}_LIB})
STRING(REGEX REPLACE "(.+)/(.+)" "\\1" LIBPATH ${${_LIB_NAME}_LIB})
set(${pkg_name}_LIBPATH ${LIBPATH} CACHE STRING INTERNAL)
endforeach(_LIB_NAME)
endforeach()
set(${pkg_name}_LIBS ${${pkg_name}_LIBS} PARENT_SCOPE)
endfunction()
function(__exec_cmd)
set(options )
set(options)
set(oneValueArgs WORKING_DIRECTORY)
set(multiValueArgs COMMAND)
cmake_parse_arguments(EXEC "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN} )
cmake_parse_arguments(EXEC "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
execute_process(COMMAND ${EXEC_COMMAND}
WORKING_DIRECTORY ${EXEC_WORKING_DIRECTORY}
@ -176,41 +176,41 @@ endfunction()
function(__check_patches pkg_patches)
# check patches
if (PKG_PATCHES)
if(PKG_PATCHES)
file(TOUCH ${_MS_LIB_CACHE}/${pkg_name}_patch.md5)
file(READ ${_MS_LIB_CACHE}/${pkg_name}_patch.md5 ${pkg_name}_PATCHES_MD5)
message("patches md5:${${pkg_name}_PATCHES_MD5}")
set(${pkg_name}_PATCHES_NEW_MD5 )
set(${pkg_name}_PATCHES_NEW_MD5)
foreach(_PATCH ${PKG_PATCHES})
file(MD5 ${_PATCH} _PF_MD5)
set(${pkg_name}_PATCHES_NEW_MD5 "${${pkg_name}_PATCHES_NEW_MD5},${_PF_MD5}")
endforeach(_PATCH)
endforeach()
if (NOT ${pkg_name}_PATCHES_MD5 STREQUAL ${pkg_name}_PATCHES_NEW_MD5)
if(NOT ${pkg_name}_PATCHES_MD5 STREQUAL ${pkg_name}_PATCHES_NEW_MD5)
set(${pkg_name}_PATCHES ${PKG_PATCHES})
file(REMOVE_RECURSE "${_MS_LIB_CACHE}/${pkg_name}-subbuild")
file(WRITE ${_MS_LIB_CACHE}/${pkg_name}_patch.md5 ${${pkg_name}_PATCHES_NEW_MD5})
message("patches changed : ${${pkg_name}_PATCHES_NEW_MD5}")
endif ()
endif ()
endif()
endif()
endfunction()
set(MS_FIND_NO_DEFAULT_PATH NO_CMAKE_PATH NO_CMAKE_ENVIRONMENT_PATH NO_SYSTEM_ENVIRONMENT_PATH
NO_CMAKE_BUILDS_PATH NO_CMAKE_PACKAGE_REGISTRY NO_CMAKE_SYSTEM_PATH
NO_CMAKE_SYSTEM_PACKAGE_REGISTRY)
set(MS_FIND_NO_DEFAULT_PATH ${MS_FIND_NO_DEFAULT_PATH} PARENT_SCOPE)
function(mindspore_add_pkg pkg_name )
function(mindspore_add_pkg pkg_name)
set(options )
set(options)
set(oneValueArgs URL MD5 GIT_REPOSITORY GIT_TAG VER EXE DIR HEAD_ONLY CMAKE_PATH RELEASE LIB_PATH CUSTOM_CMAKE)
set(multiValueArgs CMAKE_OPTION LIBS PRE_CONFIGURE_COMMAND CONFIGURE_COMMAND BUILD_OPTION INSTALL_INCS INSTALL_LIBS PATCHES SUBMODULES SOURCEMODULES ONLY_MAKE ONLY_MAKE_INCS ONLY_MAKE_LIBS)
cmake_parse_arguments(PKG "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN} )
cmake_parse_arguments(PKG "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
if (NOT PKG_LIB_PATH)
if(NOT PKG_LIB_PATH)
set(PKG_LIB_PATH lib)
endif ()
endif()
if(NOT PKG_EXE)
set(PKG_EXE 0)
@ -220,11 +220,11 @@ function(mindspore_add_pkg pkg_name )
string(TOLOWER ${pkg_name} pkg_name)
message("pkg name:${__FIND_PKG_NAME},${pkg_name}")
set(${pkg_name}_PATCHES_HASH )
set(${pkg_name}_PATCHES_HASH)
foreach(_PATCH ${PKG_PATCHES})
file(MD5 ${_PATCH} _PF_MD5)
set(${pkg_name}_PATCHES_HASH "${${pkg_name}_PATCHES_HASH},${_PF_MD5}")
endforeach(_PATCH)
endforeach()
# check options
set(${pkg_name}_CONFIG_TXT
@ -243,16 +243,16 @@ function(mindspore_add_pkg pkg_name )
set(${pkg_name}_INC ${${pkg_name}_BASE_DIR}/${PKG_HEAD_ONLY} PARENT_SCOPE)
add_library(${pkg_name} INTERFACE)
target_include_directories(${pkg_name} INTERFACE ${${pkg_name}_INC})
if (${PKG_RELEASE})
if(${PKG_RELEASE})
__find_pkg_then_add_target(${pkg_name} ${PKG_EXE} ${PKG_LIB_PATH} ${PKG_LIBS})
endif ()
endif()
return()
endif ()
endif()
set(${__FIND_PKG_NAME}_ROOT ${${pkg_name}_BASE_DIR})
set(${__FIND_PKG_NAME}_ROOT ${${pkg_name}_BASE_DIR} PARENT_SCOPE)
if (PKG_LIBS)
if(PKG_LIBS)
__find_pkg_then_add_target(${pkg_name} ${PKG_EXE} ${PKG_LIB_PATH} ${PKG_LIBS})
if(${pkg_name}_LIBS)
set(${pkg_name}_INC ${${pkg_name}_BASE_DIR}/include PARENT_SCOPE)
@ -261,28 +261,28 @@ function(mindspore_add_pkg pkg_name )
endif()
elseif(NOT PKG_HEAD_ONLY)
find_package(${__FIND_PKG_NAME} ${PKG_VER} ${MS_FIND_NO_DEFAULT_PATH})
if (${__FIND_PKG_NAME}_FOUND)
if(${__FIND_PKG_NAME}_FOUND)
set(${pkg_name}_INC ${${pkg_name}_BASE_DIR}/include PARENT_SCOPE)
message("Found pkg: ${__FIND_PKG_NAME}")
return()
endif ()
endif ()
endif()
endif()
if (NOT PKG_DIR)
if (PKG_GIT_REPOSITORY)
if(NOT PKG_DIR)
if(PKG_GIT_REPOSITORY)
__download_pkg_with_git(${pkg_name} ${PKG_GIT_REPOSITORY} ${PKG_GIT_TAG} ${PKG_MD5})
else()
__download_pkg(${pkg_name} ${PKG_URL} ${PKG_MD5})
endif()
foreach(_SUBMODULE_FILE ${PKG_SUBMODULES})
STRING( REGEX REPLACE "(.+)_(.+)" "\\1" _SUBMODEPATH ${_SUBMODULE_FILE})
STRING( REGEX REPLACE "(.+)/(.+)" "\\2" _SUBMODENAME ${_SUBMODEPATH})
STRING(REGEX REPLACE "(.+)_(.+)" "\\1" _SUBMODEPATH ${_SUBMODULE_FILE})
STRING(REGEX REPLACE "(.+)/(.+)" "\\2" _SUBMODENAME ${_SUBMODEPATH})
file(GLOB ${pkg_name}_INSTALL_SUBMODULE ${_SUBMODULE_FILE}/*)
file(COPY ${${pkg_name}_INSTALL_SUBMODULE} DESTINATION ${${pkg_name}_SOURCE_DIR}/3rdparty/${_SUBMODENAME})
endforeach (_SUBMODULE_FILE)
endforeach()
else()
set(${pkg_name}_SOURCE_DIR ${PKG_DIR})
endif ()
endif()
file(WRITE ${${pkg_name}_BASE_DIR}/options.txt ${${pkg_name}_CONFIG_TXT})
message("${pkg_name}_SOURCE_DIR : ${${pkg_name}_SOURCE_DIR}")
@ -298,32 +298,32 @@ function(mindspore_add_pkg pkg_name )
if(NOT Result EQUAL "0")
message(FATAL_ERROR "Failed patch: ${_LF_PATCH_FILE}")
endif()
endforeach(_PATCH_FILE)
endforeach()
foreach(_SOURCE_DIR ${PKG_SOURCEMODULES})
file(GLOB ${pkg_name}_INSTALL_SOURCE ${${pkg_name}_SOURCE_DIR}/${_SOURCE_DIR}/*)
file(COPY ${${pkg_name}_INSTALL_SOURCE} DESTINATION ${${pkg_name}_BASE_DIR}/${_SOURCE_DIR}/)
endforeach (_SUBMODULE_FILE)
endforeach()
file(LOCK ${${pkg_name}_BASE_DIR} DIRECTORY GUARD FUNCTION RESULT_VARIABLE ${pkg_name}_LOCK_RET TIMEOUT 600)
if(NOT ${pkg_name}_LOCK_RET EQUAL "0")
message(FATAL_ERROR "error! when try lock ${${pkg_name}_BASE_DIR} : ${${pkg_name}_LOCK_RET}")
endif()
if (PKG_CUSTOM_CMAKE)
if(PKG_CUSTOM_CMAKE)
file(GLOB ${pkg_name}_cmake ${PKG_CUSTOM_CMAKE}/CMakeLists.txt)
file(COPY ${${pkg_name}_cmake} DESTINATION ${${pkg_name}_SOURCE_DIR})
endif ()
endif()
if(${pkg_name}_SOURCE_DIR)
if (PKG_HEAD_ONLY)
if(PKG_HEAD_ONLY)
file(GLOB ${pkg_name}_SOURCE_SUBDIRS ${${pkg_name}_SOURCE_DIR}/*)
file(COPY ${${pkg_name}_SOURCE_SUBDIRS} DESTINATION ${${pkg_name}_BASE_DIR})
set(${pkg_name}_INC ${${pkg_name}_BASE_DIR}/${PKG_HEAD_ONLY} PARENT_SCOPE)
if (NOT PKG_RELEASE)
if(NOT PKG_RELEASE)
add_library(${pkg_name} INTERFACE)
target_include_directories(${pkg_name} INTERFACE ${${pkg_name}_INC})
endif ()
endif()
elseif (PKG_ONLY_MAKE)
elseif(PKG_ONLY_MAKE)
__exec_cmd(COMMAND ${CMAKE_MAKE_PROGRAM} ${${pkg_name}_CXXFLAGS} -j${THNUM}
WORKING_DIRECTORY ${${pkg_name}_SOURCE_DIR})
set(PKG_INSTALL_INCS ${PKG_ONLY_MAKE_INCS})
@ -333,23 +333,23 @@ function(mindspore_add_pkg pkg_name )
file(COPY ${${pkg_name}_INSTALL_INCS} DESTINATION ${${pkg_name}_BASE_DIR}/include)
file(COPY ${${pkg_name}_INSTALL_LIBS} DESTINATION ${${pkg_name}_BASE_DIR}/lib)
elseif (PKG_CMAKE_OPTION)
elseif(PKG_CMAKE_OPTION)
# in cmake
file(MAKE_DIRECTORY ${${pkg_name}_SOURCE_DIR}/_build)
if (${pkg_name}_CFLAGS)
if(${pkg_name}_CFLAGS)
set(${pkg_name}_CMAKE_CFLAGS "-DCMAKE_C_FLAGS=${${pkg_name}_CFLAGS}")
endif ()
if (${pkg_name}_CXXFLAGS)
endif()
if(${pkg_name}_CXXFLAGS)
set(${pkg_name}_CMAKE_CXXFLAGS "-DCMAKE_CXX_FLAGS=${${pkg_name}_CXXFLAGS}")
endif ()
endif()
if (${pkg_name}_LDFLAGS)
if (${pkg_name}_USE_STATIC_LIBS)
if(${pkg_name}_LDFLAGS)
if(${pkg_name}_USE_STATIC_LIBS)
#set(${pkg_name}_CMAKE_LDFLAGS "-DCMAKE_STATIC_LINKER_FLAGS=${${pkg_name}_LDFLAGS}")
else()
set(${pkg_name}_CMAKE_LDFLAGS "-DCMAKE_SHARED_LINKER_FLAGS=${${pkg_name}_LDFLAGS}")
endif ()
endif ()
endif()
endif()
__exec_cmd(COMMAND ${CMAKE_COMMAND} ${PKG_CMAKE_OPTION} -G ${CMAKE_GENERATOR}
${${pkg_name}_CMAKE_CFLAGS} ${${pkg_name}_CMAKE_CXXFLAGS} ${${pkg_name}_CMAKE_LDFLAGS}
@ -360,48 +360,48 @@ function(mindspore_add_pkg pkg_name )
WORKING_DIRECTORY ${${pkg_name}_SOURCE_DIR}/_build)
else()
if (${pkg_name}_CFLAGS)
if(${pkg_name}_CFLAGS)
set(${pkg_name}_MAKE_CFLAGS "CFLAGS=${${pkg_name}_CFLAGS}")
endif ()
if (${pkg_name}_CXXFLAGS)
endif()
if(${pkg_name}_CXXFLAGS)
set(${pkg_name}_MAKE_CXXFLAGS "CXXFLAGS=${${pkg_name}_CXXFLAGS}")
endif ()
if (${pkg_name}_LDFLAGS)
endif()
if(${pkg_name}_LDFLAGS)
set(${pkg_name}_MAKE_LDFLAGS "LDFLAGS=${${pkg_name}_LDFLAGS}")
endif ()
endif()
# in configure && make
if (PKG_PRE_CONFIGURE_COMMAND)
if(PKG_PRE_CONFIGURE_COMMAND)
__exec_cmd(COMMAND ${PKG_PRE_CONFIGURE_COMMAND}
WORKING_DIRECTORY ${${pkg_name}_SOURCE_DIR})
endif ()
endif()
if (PKG_CONFIGURE_COMMAND)
if(PKG_CONFIGURE_COMMAND)
__exec_cmd(COMMAND ${PKG_CONFIGURE_COMMAND}
${${pkg_name}_MAKE_CFLAGS} ${${pkg_name}_MAKE_CXXFLAGS} ${${pkg_name}_MAKE_LDFLAGS}
--prefix=${${pkg_name}_BASE_DIR}
WORKING_DIRECTORY ${${pkg_name}_SOURCE_DIR})
endif ()
endif()
set(${pkg_name}_BUILD_OPTION ${PKG_BUILD_OPTION})
if (NOT PKG_CONFIGURE_COMMAND)
if(NOT PKG_CONFIGURE_COMMAND)
set(${pkg_name}_BUILD_OPTION ${${pkg_name}_BUILD_OPTION}
${${pkg_name}_MAKE_CFLAGS} ${${pkg_name}_MAKE_CXXFLAGS} ${${pkg_name}_MAKE_LDFLAGS})
endif ()
endif()
# build
__exec_cmd(COMMAND ${CMAKE_MAKE_PROGRAM} ${${pkg_name}_BUILD_OPTION} -j${THNUM}
WORKING_DIRECTORY ${${pkg_name}_SOURCE_DIR})
if (PKG_INSTALL_INCS OR PKG_INSTALL_LIBS)
if(PKG_INSTALL_INCS OR PKG_INSTALL_LIBS)
file(GLOB ${pkg_name}_INSTALL_INCS ${${pkg_name}_SOURCE_DIR}/${PKG_INSTALL_INCS})
file(GLOB ${pkg_name}_INSTALL_LIBS ${${pkg_name}_SOURCE_DIR}/${PKG_INSTALL_LIBS})
file(COPY ${${pkg_name}_INSTALL_INCS} DESTINATION ${${pkg_name}_BASE_DIR}/include)
file(COPY ${${pkg_name}_INSTALL_LIBS} DESTINATION ${${pkg_name}_BASE_DIR}/lib)
else()
__exec_cmd(COMMAND ${CMAKE_MAKE_PROGRAM} install WORKING_DIRECTORY ${${pkg_name}_SOURCE_DIR})
endif ()
endif ()
endif()
endif()
endif()
if (PKG_LIBS)
if(PKG_LIBS)
__find_pkg_then_add_target(${pkg_name} ${PKG_EXE} ${PKG_LIB_PATH} ${PKG_LIBS})
set(${pkg_name}_INC ${${pkg_name}_BASE_DIR}/include PARENT_SCOPE)
if(NOT ${pkg_name}_LIBS)
@ -409,10 +409,10 @@ function(mindspore_add_pkg pkg_name )
endif()
else()
find_package(${__FIND_PKG_NAME} ${PKG_VER} QUIET ${MS_FIND_NO_DEFAULT_PATH})
if (${__FIND_PKG_NAME}_FOUND)
if(${__FIND_PKG_NAME}_FOUND)
set(${pkg_name}_INC ${${pkg_name}_BASE_DIR}/include PARENT_SCOPE)
message("Found pkg: ${${__FIND_PKG_NAME}_LIBRARIES}")
return()
endif ()
endif ()
endif()
endif()
endfunction()

View File

@ -1,45 +1,45 @@
file(GLOB_RECURSE KERNEL_SRC_LIST RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
"kernel_build_info.cc"
"kash/*.cc"
"common_utils.cc"
"oplib/*.cc"
"kernel_build_info.cc"
"kash/*.cc"
"common_utils.cc"
"oplib/*.cc"
)
if (CMAKE_SYSTEM_NAME MATCHES "Darwin")
if(CMAKE_SYSTEM_NAME MATCHES "Darwin")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-delete-non-abstract-non-virtual-dtor")
endif ()
endif()
if (ENABLE_D)
file(GLOB_RECURSE D_SRC_LIST RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
"kernel_query.cc"
"kernel_fusion.cc"
"akg/ascend/*.cc"
"akg/akg_kernel_json_generator.cc"
"akg/akg_kernel_json_decoder.cc"
"akg/akg_kernel_attrs_process.cc"
"akg/akg_kernel_metadata.cc"
"tbe/*.cc"
"host/*.cc"
"aicpu/*.cc"
"rts/*.cc"
"hccl/*.cc"
)
add_compile_definitions(ENABLE_D)
endif ()
if(ENABLE_D)
file(GLOB_RECURSE D_SRC_LIST RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
"kernel_query.cc"
"kernel_fusion.cc"
"akg/ascend/*.cc"
"akg/akg_kernel_json_generator.cc"
"akg/akg_kernel_json_decoder.cc"
"akg/akg_kernel_attrs_process.cc"
"akg/akg_kernel_metadata.cc"
"tbe/*.cc"
"host/*.cc"
"aicpu/*.cc"
"rts/*.cc"
"hccl/*.cc"
)
add_compile_definitions(ENABLE_D)
endif()
if (ENABLE_CPU)
if(ENABLE_CPU)
file(GLOB_RECURSE CPU_SRC_LIST RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
"cpu/*.cc"
)
if (NOT ENABLE_MPI)
if(NOT ENABLE_MPI)
list(REMOVE_ITEM CPU_SRC_LIST "cpu/allgather_cpu_kernel.cc")
list(REMOVE_ITEM CPU_SRC_LIST "cpu/reduce_scatter_cpu_kernel.cc")
list(REMOVE_ITEM CPU_SRC_LIST "cpu/embedding_look_up_comm_grad_cpu_kernel.cc")
endif ()
endif ()
endif()
endif()
if (NOT (ENABLE_CPU AND (ENABLE_D OR ENABLE_GPU)))
if(NOT (ENABLE_CPU AND (ENABLE_D OR ENABLE_GPU)))
list(REMOVE_ITEM CPU_SRC_LIST "cpu/ps/apply_momentum_ps_kernel.cc")
list(REMOVE_ITEM CPU_SRC_LIST "cpu/ps/embedding_look_up_proxy_kernel.cc")
list(REMOVE_ITEM CPU_SRC_LIST "cpu/ps/embedding_look_up_ps_kernel.cc")
@ -51,27 +51,27 @@ if (NOT (ENABLE_CPU AND (ENABLE_D OR ENABLE_GPU)))
list(REMOVE_ITEM CPU_SRC_LIST "cpu/ps/sparse_apply_lazy_adam_ps_kernel.cc")
endif()
if (ENABLE_GPU)
if(ENABLE_GPU)
file(GLOB_RECURSE CUDA_SRC_LIST RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
"gpu/*.cu"
"akg/gpu/*.cc"
"akg/akg_kernel_json_generator.cc"
"akg/akg_kernel_json_decoder.cc"
"akg/akg_kernel_attrs_process.cc"
)
)
file(GLOB_RECURSE GPU_SRC_LIST RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "gpu/*.cc")
list(REMOVE_ITEM GPU_SRC_LIST "gpu/nccl/nccl_collective_gpu_kernel.cc")
list(REMOVE_ITEM GPU_SRC_LIST "gpu/nccl/nccl_send_gpu_kernel.cc")
list(REMOVE_ITEM GPU_SRC_LIST "gpu/nccl/nccl_recv_gpu_kernel.cc")
if (ENABLE_MPI)
if(ENABLE_MPI)
include(ExternalProject)
file(GLOB_RECURSE GPU_NCCL_LIST RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "gpu/nccl/*.cc")
list(APPEND GPU_SRC_LIST ${GPU_NCCL_LIST})
endif ()
endif()
# add_library(_mindspore_kernel_cuda_obj OBJECT ${CUDA_SRC_LIST})
# add_library(_mindspore_kernel_cuda_obj OBJECT ${CUDA_SRC_LIST})
endif()
set_property(SOURCE ${KERNEL_SRC_LIST} ${CPU_SRC_LIST} ${GPU_SRC_LIST} ${D_SRC_LIST}

View File

@ -5,25 +5,25 @@ file(GLOB_RECURSE _PREACTIVATE_SRC_LIST RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
"somas/*.cc"
)
if (ENABLE_D)
if(ENABLE_D)
file(GLOB_RECURSE _D_SRC_LIST RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
"ascend/*.cc"
"graph_kernel/*.cc"
)
list(APPEND _PREACTIVATE_SRC_LIST ${_D_SRC_LIST})
endif ()
endif()
if (ENABLE_GPU)
if(ENABLE_GPU)
file(GLOB_RECURSE _GPU_SRC_LIST RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
"gpu/*.cc"
"graph_kernel/*.cc"
)
list(APPEND _PREACTIVATE_SRC_LIST ${_GPU_SRC_LIST})
endif ()
endif()
if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
set(CMAKE_CXX_FLAGS_RELEASE "$ENV{CXXFLAGS} -Wno-user-defined-warnings -Wno-inconsistent-missing-override -Wno-overloaded-virtual -Wno-unused-const-variable -Wno-pessimizing-move")
endif ()
endif()
set_property(SOURCE ${_PREACTIVATE_SRC_LIST} PROPERTY COMPILE_DEFINITIONS SUBMODULE_ID=mindspore::SubModuleId::SM_PRE_ACT)
add_library(_mindspore_backend_optimizer_obj OBJECT ${_PREACTIVATE_SRC_LIST})

View File

@ -8,28 +8,28 @@ file(GLOB_RECURSE _SESSION_SRC_LIST RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
"anf_runtime_algorithm.cc"
)
if (CMAKE_SYSTEM_NAME MATCHES "Darwin")
if(CMAKE_SYSTEM_NAME MATCHES "Darwin")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-overloaded-virtual")
endif ()
endif()
if (ENABLE_GPU)
if(ENABLE_GPU)
file(GLOB_RECURSE _GPU_SRC_LIST RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "gpu_session.cc")
list(APPEND _SESSION_SRC_LIST ${_GPU_SRC_LIST})
endif ()
endif()
if (ENABLE_CPU)
if(ENABLE_CPU)
file(GLOB_RECURSE _CPU_SRC_LIST RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "cpu_session.cc")
list(APPEND _SESSION_SRC_LIST ${_CPU_SRC_LIST})
endif ()
endif()
if (ENABLE_D)
if(ENABLE_D)
file(GLOB_RECURSE _D_SRC_LIST RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
"ascend_session.cc"
"ascend_control_parser.cc"
"ascend_inference_session.cc"
)
list(APPEND _SESSION_SRC_LIST ${_D_SRC_LIST})
endif ()
endif()
set_property(SOURCE ${_SESSION_SRC_LIST} PROPERTY COMPILE_DEFINITIONS SUBMODULE_ID=mindspore::SubModuleId::SM_SESSION)
add_library(_mindspore_backend_session_obj OBJECT ${_SESSION_SRC_LIST})

View File

@ -1,4 +1,4 @@
if (CMAKE_SYSTEM_NAME MATCHES "Windows")
if(CMAKE_SYSTEM_NAME MATCHES "Windows")
file(GLOB_RECURSE _COMMON_ALL_SRC_FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
"trans.cc"
"utils.cc"

View File

@ -5,7 +5,7 @@ set(LOAD_MINDIR_SRC
)
file(GLOB_RECURSE API_OPS_SRC ${CMAKE_CURRENT_SOURCE_DIR} "ops/*.cc")
if (ENABLE_ACL)
if(ENABLE_ACL)
add_compile_definitions(ENABLE_ACL)
include_directories(${CMAKE_SOURCE_DIR}/graphengine/ge)
include_directories(${CMAKE_BINARY_DIR}/proto/ge)
@ -16,10 +16,10 @@ if (ENABLE_ACL)
"graph/acl/*.cc"
)
endif ()
if (ENABLE_D)
endif()
if(ENABLE_D)
file(GLOB_RECURSE API_MS_INFER_SRC ${CMAKE_CURRENT_SOURCE_DIR} "python_utils.cc" "model/ms/*.cc" "graph/ms/*.cc")
endif ()
endif()
set(MSLIB_SRC ${CMAKE_CURRENT_SOURCE_DIR}/types.cc
${CMAKE_CURRENT_SOURCE_DIR}/context.cc
@ -36,32 +36,32 @@ set(MSLIB_SRC ${CMAKE_CURRENT_SOURCE_DIR}/types.cc
add_library(mindspore_shared_lib SHARED ${MSLIB_SRC})
set_target_properties(mindspore_shared_lib PROPERTIES OUTPUT_NAME mindspore)
if (CMAKE_SYSTEM_NAME MATCHES "Darwin")
if(CMAKE_SYSTEM_NAME MATCHES "Darwin")
target_link_libraries(mindspore_shared_lib PRIVATE ${PYTHON_LIBRARIES} ${SECUREC_LIBRARY}
-Wl,-force_load mindspore -Wl,-noall_load proto_input mindspore_gvar mindspore::protobuf)
else ()
else()
target_link_libraries(mindspore_shared_lib PRIVATE ${PYTHON_LIBRARIES} ${SECUREC_LIBRARY}
-Wl,--whole-archive mindspore -Wl,--no-whole-archive proto_input mindspore_gvar mindspore::protobuf)
endif ()
endif()
if (ENABLE_CPU)
if(ENABLE_CPU)
target_link_libraries(mindspore_shared_lib PRIVATE mindspore::dnnl mindspore::mkldnn)
endif ()
endif()
if (USE_GLOG)
if(USE_GLOG)
target_link_libraries(mindspore_shared_lib PRIVATE mindspore::glog)
endif ()
endif()
if (CMAKE_SYSTEM_NAME MATCHES "Linux")
if(CMAKE_SYSTEM_NAME MATCHES "Linux")
target_link_options(mindspore_shared_lib PRIVATE -Wl,-init,common_log_init)
endif ()
endif()
if (ENABLE_ACL)
if (DEFINED ENV{ASCEND_CUSTOM_PATH})
if(ENABLE_ACL)
if(DEFINED ENV{ASCEND_CUSTOM_PATH})
set(ASCEND_PATH $ENV{ASCEND_CUSTOM_PATH})
else ()
else()
set(ASCEND_PATH /usr/local/Ascend)
endif ()
endif()
set(ACL_LIB_DIR ${ASCEND_PATH}/acllib/)
set(ATLAS_ACL_LIB_DIR ${ASCEND_PATH}/ascend-toolkit/latest/acllib)
set(ATC_DIR ${ASCEND_PATH}/atc/)
@ -89,18 +89,18 @@ if (ENABLE_ACL)
${acl_retr} ${acl_cblas} ${acl_dvpp} ${acl_runtime} ${libplatform} ${libcompress} ${libopskernel}
${libaicore_utils} ${libaicpu_engine_common} ${acl})
add_dependencies(mindspore_shared_lib graph)
endif ()
endif()
# Before build inference
if (ENABLE_D)
if(ENABLE_D)
find_library(adump_server libadump_server.a ${ASCEND_RUNTIME_PATH} ${ASCEND_TOOLKIT_RUNTIME_PATH})
target_link_libraries(mindspore_shared_lib PRIVATE ${adump_server})
endif ()
endif()
if (CMAKE_SYSTEM_NAME MATCHES "Linux")
if(CMAKE_SYSTEM_NAME MATCHES "Linux")
set(MINDSPORE_RPATH $ORIGIN)
if (ENABLE_D)
if(ENABLE_D)
set(MINDSPORE_RPATH ${MINDSPORE_RPATH}:/usr/local/Ascend/nnae/latest/fwkacllib/lib64)
set(MINDSPORE_RPATH ${MINDSPORE_RPATH}:/usr/local/Ascend/ascend-toolkit/latest/fwkacllib/lib64)
set(MINDSPORE_RPATH ${MINDSPORE_RPATH}:/usr/local/Ascend/fwkacllib/lib64)
@ -111,7 +111,7 @@ if (CMAKE_SYSTEM_NAME MATCHES "Linux")
set(MINDSPORE_RPATH ${MINDSPORE_RPATH}:/usr/local/Ascend/opp/op_impl/built-in/ai_core/tbe/op_tiling)
set(MINDSPORE_RPATH ${MINDSPORE_RPATH}:/usr/local/Ascend/nnae/latest/opp/op_impl/built-in/ai_core/tbe/op_tiling)
set(MINDSPORE_RPATH ${MINDSPORE_RPATH}:/usr/local/Ascend/ascend-toolkit/latest/opp/op_impl/built-in/ai_core/tbe/op_tiling)
elseif (ENABLE_ACL)
elseif(ENABLE_ACL)
set(MINDSPORE_RPATH ${MINDSPORE_RPATH}:/usr/local/Ascend/nnae/latest/atc/lib64)
set(MINDSPORE_RPATH ${MINDSPORE_RPATH}:/usr/local/Ascend/ascend-toolkit/latest/atc/lib64)
set(MINDSPORE_RPATH ${MINDSPORE_RPATH}:/usr/local/Ascend/atc/lib64)
@ -122,7 +122,7 @@ if (CMAKE_SYSTEM_NAME MATCHES "Linux")
set(MINDSPORE_RPATH ${MINDSPORE_RPATH}:/usr/local/Ascend/opp/op_impl/built-in/ai_core/tbe/op_tiling)
set(MINDSPORE_RPATH ${MINDSPORE_RPATH}:/usr/local/Ascend/nnae/latest/opp/op_impl/built-in/ai_core/tbe/op_tiling)
set(MINDSPORE_RPATH ${MINDSPORE_RPATH}:/usr/local/Ascend/ascend-toolkit/latest/opp/op_impl/built-in/ai_core/tbe/op_tiling)
endif ()
endif()
set_target_properties(mindspore_shared_lib PROPERTIES INSTALL_RPATH ${MINDSPORE_RPATH})
endif ()
endif()

View File

@ -7,17 +7,17 @@ set(_DEBUG_SRC_LIST
"${CMAKE_CURRENT_SOURCE_DIR}/common.cc"
)
if (ENABLE_DEBUGGER)
list(APPEND _DEBUG_SRC_LIST
if(ENABLE_DEBUGGER)
list(APPEND _DEBUG_SRC_LIST
"${CMAKE_CURRENT_SOURCE_DIR}/debugger/debugger.cc"
"${CMAKE_CURRENT_SOURCE_DIR}/debugger/grpc_client.cc"
"${CMAKE_CURRENT_SOURCE_DIR}/debugger/proto_exporter.cc"
"${CMAKE_CURRENT_SOURCE_DIR}/debugger/tensor_summary.cc"
"${CMAKE_CURRENT_SOURCE_DIR}/debug_services.cc"
)
endif (ENABLE_DEBUGGER)
endif()
if (NOT CMAKE_SYSTEM_NAME MATCHES "Windows")
if(NOT CMAKE_SYSTEM_NAME MATCHES "Windows")
list(APPEND _DEBUG_SRC_LIST "${CMAKE_CURRENT_SOURCE_DIR}/common.cc")
list(APPEND _DEBUG_SRC_LIST "data_dump/dump_json_parser.cc")
list(APPEND _DEBUG_SRC_LIST "data_dump/e2e_dump_util.cc")

View File

@ -1,8 +1,8 @@
file(GLOB_RECURSE _OPTIMIZER_SRC_FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "*.cc")
if (CMAKE_SYSTEM_NAME MATCHES "Darwin")
if(CMAKE_SYSTEM_NAME MATCHES "Darwin")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-delete-non-abstract-non-virtual-dtor")
endif ()
endif()
set_property(SOURCE ${_OPTIMIZER_SRC_FILES} PROPERTY COMPILE_DEFINITIONS SUBMODULE_ID=mindspore::SubModuleId::SM_OPTIMIZER)
add_library(_mindspore_frontend_optimizer_obj OBJECT ${_OPTIMIZER_SRC_FILES})

View File

@ -1,12 +1,12 @@
file(GLOB_RECURSE _PARALLEL_SRC_FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "*.cc")
if (ENABLE_DUMP_PROTO)
if(ENABLE_DUMP_PROTO)
list(REMOVE_ITEM _PARALLEL_SRC_FILES "parallel/strategy_checkpoint/parallel_strategy_checkpoint.cc")
endif ()
endif()
if (CMAKE_SYSTEM_NAME MATCHES "Darwin")
if(CMAKE_SYSTEM_NAME MATCHES "Darwin")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-delete-non-abstract-non-virtual-dtor")
endif ()
endif()
set_property(SOURCE ${_PARALLEL_SRC_FILES} PROPERTY COMPILE_DEFINITIONS SUBMODULE_ID=mindspore::SubModuleId::SM_PARALLEL)
add_library(_mindspore_frontend_parallel_obj OBJECT ${_PARALLEL_SRC_FILES})

View File

@ -2,13 +2,13 @@ file(GLOB_RECURSE _CURRENT_SRC_FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "*.cc"
set_property(SOURCE ${_CURRENT_SRC_FILES} PROPERTY COMPILE_DEFINITIONS SUBMODULE_ID=mindspore::SubModuleId::SM_MD)
if (ENABLE_PYTHON)
if(ENABLE_PYTHON)
add_library(callback OBJECT
callback_manager.cc
py_ds_callback.cc
)
else ()
else()
add_library(callback OBJECT
callback_manager.cc
)
endif ()
endif()

View File

@ -17,6 +17,6 @@ ms_protobuf_generate(FEATURE_SRCS FEATURE_HDRS feature.proto)
add_library(core OBJECT ${DATASET_CORE_SRC_FILES} ${EXAMPLE_SRCS} ${FEATURE_SRCS})
add_dependencies(core mindspore::protobuf)
if (ENABLE_PYTHON)
if(ENABLE_PYTHON)
target_include_directories(core PRIVATE ${pybind11_INCLUDE_DIRS})
endif()

View File

@ -5,9 +5,9 @@ add_subdirectory(ir)
add_subdirectory(perf)
add_subdirectory(cache)
if (ENABLE_TDTQUE)
if(ENABLE_TDTQUE)
add_subdirectory(tdt)
endif ()
endif()
file(GLOB_RECURSE _CURRENT_SRC_FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "*.cc")
set_property(SOURCE ${_CURRENT_SRC_FILES} PROPERTY COMPILE_DEFINITIONS SUBMODULE_ID=mindspore::SubModuleId::SM_MD)
@ -22,22 +22,22 @@ set(SRC_FILES_LIST
consumers/tree_consumer.cc
serdes.cc
)
if (ENABLE_PYTHON)
if(ENABLE_PYTHON)
set(SRC_FILES_LIST
${SRC_FILES_LIST}
python_runtime_context.cc
consumers/python_tree_consumer.cc
)
endif ()
endif()
add_library(engine OBJECT ${SRC_FILES_LIST})
if (ENABLE_PYTHON)
if(ENABLE_PYTHON)
target_include_directories(engine PRIVATE ${pybind11_INCLUDE_DIRS})
endif ()
endif()
add_dependencies(engine engine-datasetops engine-datasetops-source engine-opt engine-gnn engine-perf engine-cache-client engine-datasetops-mapop)
if (ENABLE_TDTQUE)
if(ENABLE_TDTQUE)
add_dependencies(engine engine-tdt)
endif ()
endif()

View File

@ -1,7 +1,7 @@
file(GLOB_RECURSE _CURRENT_SRC_FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "*.cc")
set_property(SOURCE ${_CURRENT_SRC_FILES} PROPERTY COMPILE_DEFINITIONS SUBMODULE_ID=mindspore::SubModuleId::SM_MD)
if (ENABLE_CACHE)
if(ENABLE_CACHE)
ms_protobuf_generate(CACHE_PERF_PROTO_SRCS CACHE_PERF_PROTO_HDRS cache_perf.proto)
add_executable(cache_perf cache_perf.cc cache_msg.cc cache_perf_run.cc ${CACHE_PERF_PROTO_SRCS})
@ -13,9 +13,9 @@ if (ENABLE_CACHE)
${PYTHON_LIBRARIES}
pthread)
if (USE_GLOG)
if(USE_GLOG)
target_link_libraries(cache_perf mindspore::glog)
endif ()
endif()
add_executable(cache_pipeline cache_pipeline.cc cache_msg.cc cache_pipeline_run.cc ${CACHE_PERF_PROTO_SRCS})
target_link_libraries(cache_pipeline
@ -26,7 +26,7 @@ if (ENABLE_CACHE)
${PYTHON_LIBRARIES}
pthread)
if (USE_GLOG)
if(USE_GLOG)
target_link_libraries(cache_pipeline mindspore::glog)
endif ()
endif ()
endif()
endif()

View File

@ -25,7 +25,7 @@ set(DATASET_ENGINE_DATASETOPS_SRC_FILES
cache_merge_op.cc
)
if (ENABLE_PYTHON)
if(ENABLE_PYTHON)
set(DATASET_ENGINE_DATASETOPS_SRC_FILES
${DATASET_ENGINE_DATASETOPS_SRC_FILES}
bucket_batch_by_length_op.cc

View File

@ -22,7 +22,7 @@ set(DATASET_ENGINE_DATASETOPS_SOURCE_SRC_FILES
tf_reader_op.cc
)
if (ENABLE_PYTHON)
if(ENABLE_PYTHON)
set(DATASET_ENGINE_DATASETOPS_SOURCE_SRC_FILES
${DATASET_ENGINE_DATASETOPS_SOURCE_SRC_FILES}
generator_op.cc

View File

@ -11,11 +11,11 @@ set(DATASET_ENGINE_DATASETOPS_SOURCE_SAMPLER_SRC_FILES
weighted_random_sampler.cc
)
if (ENABLE_PYTHON)
if(ENABLE_PYTHON)
set(DATASET_ENGINE_DATASETOPS_SOURCE_SAMPLER_SRC_FILES
${DATASET_ENGINE_DATASETOPS_SOURCE_SAMPLER_SRC_FILES}
python_sampler.cc
)
endif ()
endif()
add_library(engine-datasetops-source-sampler OBJECT ${DATASET_ENGINE_DATASETOPS_SOURCE_SAMPLER_SRC_FILES})

View File

@ -11,7 +11,7 @@ set(DATASET_ENGINE_GNN_SRC_FILES
feature.cc
)
if (CMAKE_SYSTEM_NAME MATCHES "Windows")
if(CMAKE_SYSTEM_NAME MATCHES "Windows")
add_library(engine-gnn OBJECT ${DATASET_ENGINE_GNN_SRC_FILES})
else()
set(DATASET_ENGINE_GNN_SRC_FILES

View File

@ -19,11 +19,11 @@ set(DATASET_ENGINE_IR_DATASETOPS_SOURCE_SRC_FILES
voc_node.cc
)
if (ENABLE_PYTHON)
if(ENABLE_PYTHON)
set(DATASET_ENGINE_IR_DATASETOPS_SOURCE_SRC_FILES
${DATASET_ENGINE_IR_DATASETOPS_SOURCE_SRC_FILES}
generator_node.cc
)
endif ()
endif()
add_library(engine-ir-datasetops-source OBJECT ${DATASET_ENGINE_IR_DATASETOPS_SOURCE_SRC_FILES})

View File

@ -25,7 +25,7 @@ set(DATASET_ENGINE_OPT_SRC_FILES
pre/removal_pass.cc
)
if (ENABLE_PYTHON)
if(ENABLE_PYTHON)
set(DATASET_ENGINE_OPT_SRC_FILES
${DATASET_ENGINE_OPT_SRC_FILES}
post/generator_node_pass.cc

View File

@ -2,7 +2,7 @@ add_subdirectory(image)
add_subdirectory(data)
file(GLOB_RECURSE _CURRENT_SRC_FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "*.cc")
set_property(SOURCE ${_CURRENT_SRC_FILES} PROPERTY COMPILE_DEFINITIONS SUBMODULE_ID=mindspore::SubModuleId::SM_MD)
if (ENABLE_PYTHON)
if(ENABLE_PYTHON)
add_library(kernels OBJECT
data/compose_op.cc
data/random_apply_op.cc

View File

@ -2,9 +2,9 @@ file(GLOB_RECURSE _CURRENT_SRC_FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "*.cc"
set_property(SOURCE ${_CURRENT_SRC_FILES} PROPERTY COMPILE_DEFINITIONS SUBMODULE_ID=mindspore::SubModuleId::SM_MD)
add_subdirectory(soft_dvpp)
add_subdirectory(lite_cv)
if (ENABLE_ACL)
if(ENABLE_ACL)
add_subdirectory(dvpp)
endif ()
endif()
add_library(kernels-image OBJECT
affine_op.cc
auto_contrast_op.cc
@ -55,8 +55,8 @@ add_library(kernels-image OBJECT
random_color_op.cc
rotate_op.cc
)
if (ENABLE_ACL)
if(ENABLE_ACL)
add_dependencies(kernels-image kernels-soft-dvpp-image kernels-dvpp-image)
else()
add_dependencies(kernels-image kernels-soft-dvpp-image)
endif ()
endif()

View File

@ -6,7 +6,7 @@ add_library(soft-dvpp-utils OBJECT
soft_jpegd.cc
soft_vpc.cc
yuv_scaler_para_set.cc)
if (USE_GLOG)
if(USE_GLOG)
message("Soft dvpp use glog to print message.")
else()
add_compile_definitions(DVPP_UTST)

View File

@ -1,6 +1,6 @@
file(GLOB_RECURSE _CURRENT_SRC_FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "*.cc")
set_property(SOURCE ${_CURRENT_SRC_FILES} PROPERTY COMPILE_DEFINITIONS SUBMODULE_ID=mindspore::SubModuleId::SM_MD)
if (NOT (CMAKE_SYSTEM_NAME MATCHES "Windows"))
if(NOT (CMAKE_SYSTEM_NAME MATCHES "Windows"))
set(ICU_DEPEND_FILES
basic_tokenizer_op.cc
bert_tokenizer_op.cc

View File

@ -1,6 +1,6 @@
file(GLOB_RECURSE _CURRENT_SRC_FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "*.cc")
set_property(SOURCE ${_CURRENT_SRC_FILES} PROPERTY COMPILE_DEFINITIONS SUBMODULE_ID=mindspore::SubModuleId::SM_MD)
if (NOT ${CMAKE_SYSTEM_NAME} MATCHES "Linux")
if(NOT ${CMAKE_SYSTEM_NAME} MATCHES "Linux")
LIST(REMOVE_ITEM _CURRENT_SRC_FILES numa_interface.cc)
endif()
add_library(utils OBJECT ${_CURRENT_SRC_FILES})

View File

@ -20,9 +20,9 @@ set_property(SOURCE ${PARSER_SRC_FILES} PROPERTY COMPILE_DEFINITIONS SUBMODULE_I
file(GLOB_RECURSE ANALYZER_SRC_FILES "static_analysis/*.cc")
set_property(SOURCE ${ANALYZER_SRC_FILES} PROPERTY COMPILE_DEFINITIONS SUBMODULE_ID=mindspore::SubModuleId::SM_ANALYZER)
if (ENABLE_GE OR ENABLE_D)
if(ENABLE_GE OR ENABLE_D)
file(GLOB_RECURSE _PIPELINE_GE_SRC_FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "pipeline_ge.cc")
list(APPEND _PIPELINE_SRC_FILES ${_PIPELINE_GE_SRC_FILES})
endif ()
endif()
add_library(_mindspore_pipeline_jit_obj OBJECT ${_PIPELINE_SRC_FILES})

View File

@ -1,9 +1,9 @@
file(GLOB_RECURSE _PYNATIVE_SRC_LIST RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "pynative_execute.cc")
if (ENABLE_GE)
if(ENABLE_GE)
file(GLOB_RECURSE _GE_SRC_LIST RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "pynative_execute_ge.cc")
list(APPEND _PYNATIVE_SRC_LIST ${_GE_SRC_LIST})
endif ()
endif()
set_property(SOURCE ${_PYNATIVE_SRC_LIST} PROPERTY COMPILE_DEFINITIONS SUBMODULE_ID=mindspore::SubModuleId::SM_PYNATIVE)
add_library(_mindspore_pipeline_pynative_obj OBJECT ${_PYNATIVE_SRC_LIST})

View File

@ -1,6 +1,6 @@
file(GLOB_RECURSE _PS_SRC_FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "*.cc")
if (NOT (ENABLE_CPU AND (ENABLE_D OR ENABLE_GPU)))
if(NOT (ENABLE_CPU AND (ENABLE_D OR ENABLE_GPU)))
list(REMOVE_ITEM _PS_SRC_FILES "optimizer_info_builder.cc")
list(REMOVE_ITEM _PS_SRC_FILES "optimizer_info.cc")
list(REMOVE_ITEM _PS_SRC_FILES "scheduler.cc")
@ -20,13 +20,13 @@ if (NOT (ENABLE_CPU AND (ENABLE_D OR ENABLE_GPU)))
list(REMOVE_ITEM _PS_SRC_FILES "core/server_node.cc")
list(REMOVE_ITEM _PS_SRC_FILES "core/abstract_node.cc")
list(REMOVE_ITEM _PS_SRC_FILES "core/scheduler_node.cc")
endif ()
endif()
if (NOT ENABLE_D)
if(NOT ENABLE_D)
list(REMOVE_ITEM _PS_SRC_FILES "ps_cache/ascend/ascend_ps_cache.cc")
endif()
if (NOT ENABLE_GPU)
if(NOT ENABLE_GPU)
list(REMOVE_ITEM _PS_SRC_FILES "ps_cache/gpu/gpu_ps_cache.cc")
endif()

View File

@ -1,4 +1,4 @@
if (ENABLE_CPU AND (ENABLE_D OR ENABLE_GPU))
if(ENABLE_CPU AND (ENABLE_D OR ENABLE_GPU))
file(GLOB_RECURSE _PS_CACHE_SRC_FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "ps_data/*.cc")
set_property(SOURCE ${_PS_CACHE_SRC_FILES} PROPERTY COMPILE_DEFINITIONS SUBMODULE_ID=mindspore::SubModuleId::SM_PS)
add_library(ps_cache SHARED ${_PS_CACHE_SRC_FILES})

View File

@ -2,40 +2,40 @@ file(GLOB_RECURSE DEVICE_SRC_LIST RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "common/*
"kernel_info.cc" "executor/dynamic_kernel.cc" "executor/executor_callback.cc" "kernel_runtime.cc" "memory_manager.cc" "kernel_runtime_manager.cc" "convert_tensor_utils.cc"
)
if (ENABLE_GPU)
if(ENABLE_GPU)
list(APPEND DEVICE_SRC_LIST "gpu/distribution/collective_init.cc")
else ()
else()
list(APPEND DEVICE_SRC_LIST "gpu/distribution/collective_fake_init.cc")
endif ()
endif()
if (ENABLE_D)
if(ENABLE_D)
file(GLOB_RECURSE D_SRC_LIST RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "ascend/*.cc" "kernel_adjust.cc")
endif ()
endif()
if (ENABLE_CPU)
if(ENABLE_CPU)
file(GLOB_RECURSE CPU_SRC_LIST RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "cpu/*.cc")
list(REMOVE_ITEM CPU_SRC_LIST "cpu/mpi/mpi_adapter.cc" "cpu/mpi/mpi_export.cc")
endif ()
endif()
if (ENABLE_MPI)
if (ENABLE_CPU)
if(ENABLE_MPI)
if(ENABLE_CPU)
file(GLOB_RECURSE MPI_SRC_LIST "cpu/mpi/mpi_adapter.cc" "cpu/mpi/mpi_export.cc")
set_property(SOURCE ${MPI_SRC_LIST}
PROPERTY COMPILE_DEFINITIONS SUBMODULE_ID=mindspore::SubModuleId::SM_DEVICE)
add_library(mpi_adapter SHARED ${MPI_SRC_LIST})
target_link_libraries(mpi_adapter PRIVATE mindspore::ompi)
endif ()
endif()
if (ENABLE_GPU)
if(ENABLE_GPU)
set_property(SOURCE "gpu/mpi/mpi_initializer.cc"
PROPERTY COMPILE_DEFINITIONS SUBMODULE_ID=mindspore::SubModuleId::SM_DEVICE)
pybind11_add_module(_ms_mpi "gpu/mpi/mpi_initializer.cc")
target_link_libraries(_ms_mpi PRIVATE mindspore::pybind11_module mindspore::ompi)
endif ()
endif ()
endif()
endif()
# gpu
if (ENABLE_GPU)
if(ENABLE_GPU)
file(GLOB_RECURSE CUDA_SRC_LIST RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "gpu/*.cc" "gpu/*.cu")
set(GPU_QUEUE_SRCS "gpu/blocking_queue.cc" "gpu/gpu_buffer_mgr.cc")
@ -51,7 +51,7 @@ if (ENABLE_GPU)
list(REMOVE_ITEM CUDA_SRC_LIST "gpu/mpi/mpi_initializer.cc" ${GPU_COLLECTIVE_SRCS})
if (ENABLE_MPI)
if(ENABLE_MPI)
include(ExternalProject)
# gpu_collective
set_property(SOURCE ${GPU_COLLECTIVE_SRCS}
@ -59,10 +59,10 @@ if (ENABLE_GPU)
add_library(gpu_collective SHARED ${GPU_COLLECTIVE_SRCS})
target_link_libraries(gpu_collective PRIVATE mindspore::ompi mindspore::nccl)
target_link_libraries(_ms_mpi PRIVATE gpu_collective)
endif ()
endif()
# add_library(_mindspore_device_cuda_obj OBJECT ${CUDA_SRC_LIST})
endif ()
endif()
list(REMOVE_ITEM D_SRC_LIST "ascend/profiling/profiling_callback_register.cc")
set_property(SOURCE ${DEVICE_SRC_LIST} ${D_SRC_LIST} ${CPU_SRC_LIST}

View File

@ -1,7 +1,7 @@
file(GLOB_RECURSE HCCL_ADAPTER_SRC_LIST ./*.cc)
set_property(SOURCE ${HCCL_ADAPTER_SRC_LIST} PROPERTY COMPILE_DEFINITIONS SUBMODULE_ID=mindspore::SubModuleId::SM_HCCL_ADPT)
if (ENABLE_D)
if(ENABLE_D)
add_library(_mindspore_runtime_hccl_adapter_obj OBJECT ${HCCL_ADAPTER_SRC_LIST})
target_include_directories(_mindspore_runtime_hccl_adapter_obj PRIVATE ${CMAKE_BINARY_DIR}/proto/ge)
add_dependencies(_mindspore_runtime_hccl_adapter_obj graph)
endif ()
endif()

View File

@ -1,10 +1,10 @@
if (ENABLE_GE OR ENABLE_D OR ENABLE_ACL)
if(ENABLE_GE OR ENABLE_D OR ENABLE_ACL)
file(GLOB_RECURSE _TRANSFORM_SRC_LIST RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "*.cc")
list(REMOVE_ITEM _TRANSFORM_SRC_LIST "graph_ir/op_declare/hcom_ops_declare.cc")
set_property(SOURCE ${_TRANSFORM_SRC_LIST} PROPERTY COMPILE_DEFINITIONS SUBMODULE_ID=mindspore::SubModuleId::SM_GE_ADPT)
add_library(_mindspore_transform_graph_ir_obj OBJECT ${_TRANSFORM_SRC_LIST})
if (NOT ENABLE_GE)
if(NOT ENABLE_GE)
target_compile_definitions(_mindspore_transform_graph_ir_obj PRIVATE NO_GE_CLIENT)
endif()
endif ()
endif()

View File

@ -1,9 +1,9 @@
file(GLOB_RECURSE _UTILS_SRC_LIST ./*.cc)
if (NOT ENABLE_GE)
if(NOT ENABLE_GE)
file(GLOB_RECURSE _UTILS_GE_SRC_FILES ./callbacks_ge.cc)
list(REMOVE_ITEM _UTILS_SRC_LIST ${_UTILS_GE_SRC_FILES})
endif ()
endif()
set_property(SOURCE ${_UTILS_SRC_LIST} PROPERTY COMPILE_DEFINITIONS SUBMODULE_ID=mindspore::SubModuleId::SM_UTILS)
add_library(_mindspore_utils_obj OBJECT ${_UTILS_SRC_LIST})

View File

@ -14,17 +14,17 @@ file(GLOB_RECURSE CORE_SRC_LIST RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
"utils/*.cc"
"load_mindir/*.cc"
)
if (CMAKE_SYSTEM_NAME MATCHES "Windows")
if(CMAKE_SYSTEM_NAME MATCHES "Windows")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-attributes -DHAVE_SNPRINTF")
add_compile_definitions(BUILDING_DLL)
elseif (CMAKE_SYSTEM_NAME MATCHES "Darwin")
elseif(CMAKE_SYSTEM_NAME MATCHES "Darwin")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wuser-defined-warnings -Winconsistent-missing-override -Wno-delete-non-abstract-non-virtual-dtor")
endif ()
endif()
set_property(SOURCE ${CORE_SRC_LIST} PROPERTY COMPILE_DEFINITIONS SUBMODULE_ID=mindspore::SubModuleId::SM_CORE)
add_library(mindspore_core STATIC ${CORE_SRC_LIST})
target_link_libraries(mindspore_core PRIVATE mindspore_gvar)
if (USE_GLOG)
if(USE_GLOG)
target_link_libraries(mindspore_core PRIVATE mindspore::glog)
endif ()
endif()

View File

@ -2,15 +2,15 @@ file(GLOB_RECURSE MS_GVAR_SRC_LIST RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.cc)
set_property(SOURCE ${MS_GVAR_SRC_LIST} PROPERTY COMPILE_DEFINITIONS SUBMODULE_ID=mindspore::SubModuleId::SM_COMMON)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_FORTIFY_SOURCE=2 -O2")
if (CMAKE_SYSTEM_NAME MATCHES "Windows")
if(CMAKE_SYSTEM_NAME MATCHES "Windows")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-attributes -DHAVE_SNPRINTF")
add_compile_definitions(BUILDING_DLL)
elseif (CMAKE_SYSTEM_NAME MATCHES "Darwin")
elseif(CMAKE_SYSTEM_NAME MATCHES "Darwin")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror -Wuser-defined-warnings -Winconsistent-missing-override")
endif ()
endif()
add_library(mindspore_gvar SHARED ${MS_GVAR_SRC_LIST})
if (APPLE)
if(APPLE)
set_target_properties(mindspore_gvar PROPERTIES MACOSX_RPATH ON)
endif ()
endif()

View File

@ -1,8 +1,8 @@
find_package(Patch)
if (NOT Patch_FOUND)
if(NOT Patch_FOUND)
message(FATAL_ERROR "Patch not found, please set environment variable MS_PATCH_PATH to path where Patch is located, "
"usually found in GIT_PATH/usr/bin on Windows")
endif ()
endif()
include(${TOP_DIR}/cmake/external_libs/jpeg_turbo.cmake)
@ -17,7 +17,7 @@ set(CMAKE_CXX_FLAGS "$ENV{CXXFLAGS} -I/usr/local/include -std=c++17 -Wall -fPIC"
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OPTION_CXX_FLAGS}")
if (PLATFORM_ARM)
if(PLATFORM_ARM)
set(CMAKE_CXX_FLAGS_RELEASE "$ENV{CXXFLAGS} -O2 -Werror -Wno-return-std-move -Wno-unused-private-field -Wno-unused-lambda-capture -Wno-sign-compare -Wno-overloaded-virtual -Wno-unneeded-internal-declaration -Wno-unused-variable -Wno-pessimizing-move -Wno-inconsistent-missing-override -DHALF_ENABLE_CPP11_USER_LITERALS=0 -D_FORTIFY_SOURCE=2")
else()
set(CMAKE_CXX_FLAGS_RELEASE "$ENV{CXXFLAGS} -O2 -Wl,--allow-shlib-undefined -DHALF_ENABLE_CPP11_USER_LITERALS=0 -D_FORTIFY_SOURCE=2")
@ -33,7 +33,7 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-reorder")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-switch")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-sequence-point")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-variable")
if (PLATFORM_ARM)
if(PLATFORM_ARM)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-delete-non-virtual-dtor")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-uninitialized")
else()
@ -89,11 +89,11 @@ AUX_SOURCE_DIRECTORY(${MINDDATA_DIR}/util MINDDATA_UTIL_SRC_FILES)
AUX_SOURCE_DIRECTORY(${MINDDATA_DIR}/kernels/image/lite_cv MINDDATA_KERNELS_IMAGE_LITE_CV_FILES)
if (BUILD_MINDDATA STREQUAL "full")
if(BUILD_MINDDATA STREQUAL "full")
set(BUILD_MINDDATA "wrapper")
endif ()
endif()
if (BUILD_MINDDATA STREQUAL "full")
if(BUILD_MINDDATA STREQUAL "full")
include_directories("${CMAKE_SOURCE_DIR}/../ccsrc/minddata/dataset/kernels/image")
list(REMOVE_ITEM MINDDATA_API_SRC_FILES
"${MINDDATA_DIR}/api/text.cc"
@ -200,7 +200,7 @@ if (BUILD_MINDDATA STREQUAL "full")
"${MINDDATA_DIR}/kernels/image/mixup_batch_op.cc"
"${MINDDATA_DIR}/kernels/image/pad_op.cc"
"${MINDDATA_DIR}/kernels/image/posterize_op.cc"
${MINDDATA_DIR}/kernels/image/normalize_pad_op.cc
"${MINDDATA_DIR}/kernels/image/normalize_pad_op.cc"
"${MINDDATA_DIR}/kernels/image/random_affine_op.cc"
"${MINDDATA_DIR}/kernels/image/random_color_adjust_op.cc"
"${MINDDATA_DIR}/kernels/image/random_crop_and_resize_with_bbox_op.cc"
@ -260,9 +260,9 @@ if (BUILD_MINDDATA STREQUAL "full")
)
include_directories("${CMAKE_BINARY_DIR}/minddata/dataset/engine/cache")
if (BUILD_MINDDATA_EXAMPLE AND (PLATFORM_ARM32 OR PLATFORM_ARM64))
if(BUILD_MINDDATA_EXAMPLE AND (PLATFORM_ARM32 OR PLATFORM_ARM64))
set(MINDDATA_TODAPI_SRC ${CMAKE_CURRENT_SOURCE_DIR}/wrapper/MDToDApi.cc)
endif ()
endif()
add_library(minddata-lite SHARED
${MINDDATA_API_SRC_FILES}
@ -304,19 +304,19 @@ if (BUILD_MINDDATA STREQUAL "full")
)
# ref: https://github.com/android/ndk/issues/1202
if (PLATFORM_ARM32)
if(PLATFORM_ARM32)
file(GLOB_RECURSE LIBCLANG_RT_LIB $ENV{ANDROID_NDK}/libclang_rt.builtins-arm-android.a)
if (LIBCLANG_RT_LIB STREQUAL "")
if(LIBCLANG_RT_LIB STREQUAL "")
MESSAGE(FATAL_ERROR "Cannot find libclang_rt.builtins-arm-androi2d.a in $ENV{ANDROID_NDK}")
endif()
target_link_libraries(minddata-lite ${LIBCLANG_RT_LIB})
endif()
if (PLATFORM_ARM32 OR PLATFORM_ARM64)
if(PLATFORM_ARM32 OR PLATFORM_ARM64)
target_link_libraries(minddata-lite log)
elseif (BUILD_MINDDATA_EXAMPLE)
elseif(BUILD_MINDDATA_EXAMPLE)
endif()
elseif (BUILD_MINDDATA STREQUAL "wrapper")
elseif(BUILD_MINDDATA STREQUAL "wrapper")
include_directories("${MINDDATA_DIR}/kernels/image")
include_directories("${MINDDATA_DIR}/util")
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/wrapper)
@ -373,19 +373,19 @@ elseif (BUILD_MINDDATA STREQUAL "wrapper")
)
# ref: https://github.com/android/ndk/issues/1202
if (PLATFORM_ARM32)
if(PLATFORM_ARM32)
file(GLOB_RECURSE LIBCLANG_RT_LIB $ENV{ANDROID_NDK}/libclang_rt.builtins-arm-android.a)
if (LIBCLANG_RT_LIB STREQUAL "")
if(LIBCLANG_RT_LIB STREQUAL "")
MESSAGE(FATAL_ERROR "Cannot find libclang_rt.builtins-arm-androi2d.a in $ENV{ANDROID_NDK}")
endif()
target_link_libraries(minddata-lite ${LIBCLANG_RT_LIB})
endif()
if (PLATFORM_ARM32 OR PLATFORM_ARM64)
if(PLATFORM_ARM32 OR PLATFORM_ARM64)
target_link_libraries(minddata-lite log)
elseif (BUILD_MINDDATA_EXAMPLE)
elseif(BUILD_MINDDATA_EXAMPLE)
endif()
elseif (BUILD_MINDDATA STREQUAL "lite")
elseif(BUILD_MINDDATA STREQUAL "lite")
list(REMOVE_ITEM MINDDATA_CORE_SRC_FILES "${MINDDATA_DIR}/core/client.cc")
list(REMOVE_ITEM MINDDATA_KERNELS_SRC_FILES "${MINDDATA_DIR}/kernels/py_func_op.cc")
add_library(minddata_eager_mid OBJECT
@ -464,24 +464,24 @@ elseif (BUILD_MINDDATA STREQUAL "lite")
)
# ref: https://github.com/android/ndk/issues/1202
if (PLATFORM_ARM32)
if(PLATFORM_ARM32)
file(GLOB_RECURSE LIBCLANG_RT_LIB $ENV{ANDROID_NDK}/libclang_rt.builtins-arm-android.a)
if (LIBCLANG_RT_LIB STREQUAL "")
if(LIBCLANG_RT_LIB STREQUAL "")
MESSAGE(FATAL_ERROR "Cannot find libclang_rt.builtins-arm-androi2d.a in $ENV{ANDROID_NDK}")
endif()
target_link_libraries(minddata-lite ${LIBCLANG_RT_LIB})
endif()
elseif (BUILD_MINDDATA STREQUAL "lite_cv")
include_directories(${MINDDATA_DIR}/kernels/image)
message(STATUS ${MINDDATA_DIR}/kernels/image)
elseif(BUILD_MINDDATA STREQUAL "lite_cv")
include_directories(${MINDDATA_DIR}/kernels/image)
message(STATUS ${MINDDATA_DIR}/kernels/image)
add_library(minddata-lite SHARED
${MINDDATA_KERNELS_IMAGE_LITE_CV_FILES}
)
# ref: https://github.com/android/ndk/issues/1202
if (PLATFORM_ARM32)
if(PLATFORM_ARM32)
file(GLOB_RECURSE LIBCLANG_RT_LIB $ENV{ANDROID_NDK}/libclang_rt.builtins-arm-android.a)
if (LIBCLANG_RT_LIB STREQUAL "")
if(LIBCLANG_RT_LIB STREQUAL "")
MESSAGE(FATAL_ERROR "Cannot find libclang_rt.builtins-arm-androi2d.a in $ENV{ANDROID_NDK}")
endif()
target_link_libraries(minddata-lite ${LIBCLANG_RT_LIB})

View File

@ -3,16 +3,16 @@ project(nnacl)
set(NNACL_DIR ${CMAKE_CURRENT_SOURCE_DIR})
include_directories(NNACL_DIR)
if (PLATFORM_ARM32 OR PLATFORM_ARM64)
if ("${CMAKE_BUILD_TYPE}" STREQUAL "Release")
if(PLATFORM_ARM32 OR PLATFORM_ARM64)
if("${CMAKE_BUILD_TYPE}" STREQUAL "Release")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fomit-frame-pointer -fstrict-aliasing -ffunction-sections -fdata-sections -ffast-math")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fomit-frame-pointer -fstrict-aliasing -ffunction-sections -fdata-sections -ffast-math")
endif()
endif ()
if ("${X86_64_SIMD}" STREQUAL "avx")
endif()
if("${X86_64_SIMD}" STREQUAL "avx")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -msse4.1 -mavx -mavx2")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -msse4.1 -mavx -mavx2")
endif ()
endif()
########################### files ###########################
file(GLOB KERNEL_SRC
@ -22,29 +22,29 @@ file(GLOB KERNEL_SRC
${NNACL_DIR}/base/*.c
)
if (SUPPORT_TRAIN)
file (GLOB TRAIN_SRC ${NNACL_DIR}/fp32_grad/*.c)
if(SUPPORT_TRAIN)
file(GLOB TRAIN_SRC ${NNACL_DIR}/fp32_grad/*.c)
endif()
if (PLATFORM_ARM64)
if(PLATFORM_ARM64)
file(GLOB ASSEMBLY_SRC ${NNACL_DIR}/assembly/arm64/*.S)
set_property(SOURCE ${ASSEMBLY_SRC} PROPERTY LANGUAGE C)
endif()
if (PLATFORM_ARM32)
if(PLATFORM_ARM32)
file(GLOB ASSEMBLY_SRC ${NNACL_DIR}/assembly/arm32/*.S)
set_property(SOURCE ${ASSEMBLY_SRC} PROPERTY LANGUAGE C)
endif()
if ("${X86_64_SIMD}" STREQUAL "sse")
if("${X86_64_SIMD}" STREQUAL "sse")
file(GLOB ASSEMBLY_SRC ${NNACL_DIR}/x86_64_sse/*.c)
set_property(SOURCE ${ASSEMBLY_SRC} PROPERTY LANGUAGE C)
endif()
if ("${X86_64_SIMD}" STREQUAL "avx")
if("${X86_64_SIMD}" STREQUAL "avx")
file(GLOB ASSEMBLY_SRC ${NNACL_DIR}/x86_64_sse/*.c
${NNACL_DIR}/x86_64_avx/*.c
${NNACL_DIR}/assembly/avx/*.S)
${NNACL_DIR}/x86_64_avx/*.c
${NNACL_DIR}/assembly/avx/*.S)
set_property(SOURCE ${ASSEMBLY_SRC} PROPERTY LANGUAGE C)
endif()
@ -56,6 +56,6 @@ add_dependencies(nnacl fbs_src)
add_dependencies(nnacl_mid fbs_src)
########################### arm64 build optimize library ########################
if (PLATFORM_ARM64)
if(PLATFORM_ARM64)
add_subdirectory(${NNACL_DIR}/optimize)
endif()

View File

@ -4,10 +4,10 @@ file(GLOB OPS_SRC
${CMAKE_CURRENT_SOURCE_DIR}/*.cc
${CMAKE_CURRENT_SOURCE_DIR}/populate/*.cc
)
if (ENABLE_V0)
if(ENABLE_V0)
file(GLOB_RECURSE COMPAT_SRC ${CMAKE_CURRENT_SOURCE_DIR}/compat/*.cc)
set(OPS_SRC ${OPS_SRC} ${COMPAT_SRC})
endif ()
endif()
add_library(cpu_ops_mid OBJECT ${OPS_SRC})
add_dependencies(cpu_ops_mid fbs_src)

View File

@ -12,7 +12,7 @@ add_executable(benchmark
add_dependencies(benchmark fbs_src)
if (PLATFORM_ARM32 OR PLATFORM_ARM64)
if(PLATFORM_ARM32 OR PLATFORM_ARM64)
target_link_libraries(benchmark mindspore-lite)
else()
target_link_libraries(benchmark mindspore-lite pthread)

View File

@ -9,30 +9,30 @@ add_executable(benchmark_train
${CMAKE_CURRENT_SOURCE_DIR}/main.cc
${CMAKE_CURRENT_SOURCE_DIR}/net_train.cc
${COMMON_SRC})
if (WIN32)
if(WIN32)
add_dependencies(benchmark_train fbs_src mindspore-lite_static)
else ()
else()
add_dependencies(benchmark_train fbs_src)
endif ()
endif()
if (PLATFORM_ARM32 OR PLATFORM_ARM64)
if(PLATFORM_ARM32 OR PLATFORM_ARM64)
target_link_libraries(benchmark_train mindspore-lite)
else()
if (WIN32)
if(WIN32)
target_link_libraries(benchmark_train mindspore-lite_static pthread cpu_kernel_mid nnacl_mid)
else ()
else()
target_link_libraries(benchmark_train mindspore-lite pthread)
endif ()
endif()
endif()
if (PLATFORM_ARM32 OR PLATFORM_ARM64)
if(PLATFORM_ARM32 OR PLATFORM_ARM64)
install(TARGETS benchmark_train
RUNTIME DESTINATION ${MAIN_DIR}-${RUNTIME_COMPONENT_NAME}/benchmark_train COMPONENT ${RUNTIME_COMPONENT_NAME})
else()
if (WIN32)
if(WIN32)
install(TARGETS benchmark_train
RUNTIME DESTINATION ${MAIN_DIR}-${RUNTIME_COMPONENT_NAME}/benchmark_train COMPONENT ${RUNTIME_COMPONENT_NAME})
else ()
else()
install(TARGETS benchmark_train
RUNTIME DESTINATION ${MAIN_DIR}-${RUNTIME_COMPONENT_NAME}/benchmark_train COMPONENT ${RUNTIME_COMPONENT_NAME})
endif ()
endif()
endif()

View File

@ -16,6 +16,6 @@ add_library(quantizer_mid OBJECT ${QUANTIZER})
add_dependencies(quantizer_mid fbs_src)
add_dependencies(quantizer_mid fbs_inner_src)
if (ENABLE_ASAN)
if(ENABLE_ASAN)
target_link_libraries(quantizer_mid libasan libSecodefuzz)
endif ()
endif()

View File

@ -22,9 +22,9 @@ include_directories(${CMAKE_SOURCE_DIR}/src/main/cpp/${MINDSPORELITE_VERSION}/mi
#include_directories(${CMAKE_SOURCE_DIR}/src/main/cpp/include/ModelUtil)
add_library(mindspore-lite SHARED IMPORTED )
add_library(minddata-lite SHARED IMPORTED )
add_library(libmindspore-lite-fp16 SHARED IMPORTED )
add_library(mindspore-lite SHARED IMPORTED)
add_library(minddata-lite SHARED IMPORTED)
add_library(libmindspore-lite-fp16 SHARED IMPORTED)
set_target_properties(mindspore-lite PROPERTIES IMPORTED_LOCATION
${CMAKE_SOURCE_DIR}/src/main/cpp/${MINDSPORELITE_VERSION}/lib/libmindspore-lite.so)

View File

@ -1,8 +1,8 @@
#add flags
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-sign-compare")
if (ENABLE_TESTCASES)
if(ENABLE_TESTCASES)
add_subdirectory(ut)
elseif (ENABLE_CPP_ST)
elseif(ENABLE_CPP_ST)
add_subdirectory(st/cpp)
endif ()
endif()

View File

@ -1,9 +1,9 @@
SET(CMAKE_BUILD_TYPE "Debug")
if (CMAKE_SYSTEM_NAME MATCHES "Windows")
if(CMAKE_SYSTEM_NAME MATCHES "Windows")
SET(CMAKE_C_FLAGS_DEBUG "$ENV{CFLAGS} -fPIC -O0 -Wall -Wno-deprecated-declarations -g2 -ggdb -fno-inline-functions -fno-omit-frame-pointer -fstack-protector-all")
else ()
SET(CMAKE_C_FLAGS_DEBUG "$ENV{CFLAGS} -Wno-nullability-completeness -fPIC -O0 -Wall -Wno-deprecated-declarations -g2 -ggdb -fno-inline-functions -fno-omit-frame-pointer -fstack-protector-all -D_LIBCPP_INLINE_VISIBILITY='' -D'_LIBCPP_EXTERN_TEMPLATE(...)='")
endif ()
endif()
SET(CMAKE_C_FLAGS_RELEASE "$ENV{CFLAGS} -fPIC -O3 -Wall -Wno-deprecated-declarations -fstack-protector-all")
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)

View File

@ -1,4 +1,4 @@
if (CMAKE_SYSTEM_NAME MATCHES "Windows")
if(CMAKE_SYSTEM_NAME MATCHES "Windows")
list(APPEND SECUREC_SRCS "memset_s.c")
else()
aux_source_directory(. SECUREC_SRCS)