2020-03-27 14:49:12 +08:00
|
|
|
set(SECURE_CXX_FLAGS "")
|
2021-01-23 20:20:31 +08:00
|
|
|
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
|
|
|
|
if(WIN32)
|
2020-04-15 17:36:48 +08:00
|
|
|
set(SECURE_CXX_FLAGS "-fstack-protector-all")
|
|
|
|
else()
|
2021-01-23 20:20:31 +08:00
|
|
|
set(SECURE_CXX_FLAGS "-fstack-protector-all -Wl,-z,relro,-z,now,-z,noexecstack")
|
2020-04-15 17:36:48 +08:00
|
|
|
endif()
|
2020-03-27 14:49:12 +08:00
|
|
|
endif()
|
|
|
|
set(_ms_tmp_CMAKE_CXX_FLAGS_F ${CMAKE_CXX_FLAGS})
|
2022-08-26 10:48:53 +08:00
|
|
|
|
|
|
|
if(NOT MSVC)
|
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden")
|
|
|
|
endif()
|
|
|
|
|
2021-12-06 17:32:22 +08:00
|
|
|
set(TOP_DIR ${CMAKE_SOURCE_DIR})
|
2020-03-27 14:49:12 +08:00
|
|
|
|
|
|
|
include(cmake/utils.cmake)
|
2022-08-26 17:41:48 +08:00
|
|
|
include(${CMAKE_SOURCE_DIR}/cmake/external_libs/robin.cmake)
|
2020-03-27 14:49:12 +08:00
|
|
|
include(${CMAKE_SOURCE_DIR}/cmake/external_libs/eigen.cmake)
|
|
|
|
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)
|
2020-06-11 22:42:57 +08:00
|
|
|
|
2021-01-23 20:20:31 +08:00
|
|
|
if(MS_BUILD_GRPC)
|
2020-06-11 22:42:57 +08:00
|
|
|
# build dependencies of gRPC
|
2021-04-08 12:04:45 +08:00
|
|
|
include(${CMAKE_SOURCE_DIR}/cmake/external_libs/openssl.cmake)
|
2020-06-11 22:42:57 +08:00
|
|
|
include(${CMAKE_SOURCE_DIR}/cmake/external_libs/absl.cmake)
|
|
|
|
include(${CMAKE_SOURCE_DIR}/cmake/external_libs/c-ares.cmake)
|
|
|
|
include(${CMAKE_SOURCE_DIR}/cmake/external_libs/zlib.cmake)
|
2021-08-18 02:49:12 +08:00
|
|
|
include(${CMAKE_SOURCE_DIR}/cmake/external_libs/re2.cmake)
|
2020-06-11 22:42:57 +08:00
|
|
|
# build gRPC
|
|
|
|
include(${CMAKE_SOURCE_DIR}/cmake/external_libs/grpc.cmake)
|
2020-08-18 19:31:57 +08:00
|
|
|
# build event
|
|
|
|
include(${CMAKE_SOURCE_DIR}/cmake/external_libs/libevent.cmake)
|
2020-06-11 22:42:57 +08:00
|
|
|
endif()
|
|
|
|
|
2020-03-27 14:49:12 +08:00
|
|
|
include(${CMAKE_SOURCE_DIR}/cmake/external_libs/pybind11.cmake)
|
|
|
|
MESSAGE("go to link flatbuffers")
|
|
|
|
include(${CMAKE_SOURCE_DIR}/cmake/external_libs/flatbuffers.cmake)
|
|
|
|
if(USE_GLOG)
|
|
|
|
include(${CMAKE_SOURCE_DIR}/cmake/external_libs/glog.cmake)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
find_package(Python3)
|
|
|
|
include_directories(${Python3_INCLUDE_DIRS})
|
|
|
|
include_directories(${CMAKE_SOURCE_DIR}/third_party)
|
2021-01-23 20:20:31 +08:00
|
|
|
if(ENABLE_MPI)
|
2020-08-05 22:07:45 +08:00
|
|
|
include(${CMAKE_SOURCE_DIR}/cmake/external_libs/ompi.cmake)
|
|
|
|
endif()
|
|
|
|
|
2021-01-23 20:20:31 +08:00
|
|
|
if(ENABLE_CPU)
|
2020-03-27 14:49:12 +08:00
|
|
|
include(${CMAKE_SOURCE_DIR}/cmake/external_libs/mkl_dnn.cmake)
|
|
|
|
endif()
|
|
|
|
|
2022-08-25 15:43:02 +08:00
|
|
|
if(MSVC)
|
|
|
|
include(${CMAKE_SOURCE_DIR}/cmake/external_libs/dirent.cmake)
|
|
|
|
endif()
|
|
|
|
|
2022-10-06 19:53:06 +08:00
|
|
|
if(ENABLE_GPU AND GPU_BACKEND_CUDA)
|
2022-05-27 15:29:40 +08:00
|
|
|
include(${CMAKE_SOURCE_DIR}/cmake/external_libs/cub.cmake)
|
2021-01-23 20:20:31 +08:00
|
|
|
if(ENABLE_MPI)
|
2020-04-06 11:22:47 +08:00
|
|
|
include(${CMAKE_SOURCE_DIR}/cmake/external_libs/nccl.cmake)
|
|
|
|
endif()
|
2020-03-27 14:49:12 +08:00
|
|
|
endif()
|
|
|
|
|
2022-01-06 15:29:15 +08:00
|
|
|
if(ENABLE_D OR ENABLE_ACL OR ENABLE_TESTCASES)
|
2020-09-18 14:09:16 +08:00
|
|
|
include_directories(${CMAKE_SOURCE_DIR}/graphengine/inc)
|
|
|
|
include_directories(${CMAKE_SOURCE_DIR}/graphengine/inc/external)
|
|
|
|
include_directories(${CMAKE_SOURCE_DIR}/graphengine/inc/framework)
|
|
|
|
include_directories(${CMAKE_SOURCE_DIR}/graphengine/third_party/fwkacllib/inc)
|
2022-03-21 20:26:52 +08:00
|
|
|
include_directories(${CMAKE_SOURCE_DIR}/graphengine/third_party/fwkacllib/inc/aicpu)
|
2020-09-18 14:09:16 +08:00
|
|
|
include_directories(${CMAKE_SOURCE_DIR}/graphengine/third_party/fwkacllib/inc/toolchain)
|
2020-12-14 11:18:03 +08:00
|
|
|
include_directories(${CMAKE_SOURCE_DIR}/graphengine/metadef/inc)
|
|
|
|
include_directories(${CMAKE_SOURCE_DIR}/graphengine/metadef/inc/external)
|
|
|
|
include_directories(${CMAKE_SOURCE_DIR}/graphengine/metadef/inc/external/graph)
|
2020-09-18 14:09:16 +08:00
|
|
|
endif()
|
|
|
|
|
2021-01-23 20:20:31 +08:00
|
|
|
if(ENABLE_MINDDATA)
|
2020-05-05 16:51:05 +08:00
|
|
|
include(${CMAKE_SOURCE_DIR}/cmake/external_libs/icu4c.cmake)
|
2020-03-27 14:49:12 +08:00
|
|
|
include(${CMAKE_SOURCE_DIR}/cmake/external_libs/opencv.cmake)
|
|
|
|
include(${CMAKE_SOURCE_DIR}/cmake/external_libs/sqlite.cmake)
|
2020-05-09 15:38:47 +08:00
|
|
|
include(${CMAKE_SOURCE_DIR}/cmake/external_libs/tinyxml2.cmake)
|
2020-04-30 11:02:47 +08:00
|
|
|
include(${CMAKE_SOURCE_DIR}/cmake/external_libs/cppjieba.cmake)
|
2020-07-15 10:09:02 +08:00
|
|
|
include(${CMAKE_SOURCE_DIR}/cmake/external_libs/sentencepiece.cmake)
|
2020-03-27 14:49:12 +08:00
|
|
|
endif()
|
|
|
|
|
2021-01-23 20:20:31 +08:00
|
|
|
if(ENABLE_MINDDATA)
|
2020-08-03 14:49:30 +08:00
|
|
|
include(${CMAKE_SOURCE_DIR}/cmake/external_libs/jpeg_turbo.cmake)
|
|
|
|
endif()
|
|
|
|
|
2021-09-06 15:10:44 +08:00
|
|
|
if(ENABLE_TESTCASES OR ENABLE_CPP_ST)
|
|
|
|
include(${CMAKE_SOURCE_DIR}/cmake/external_libs/gtest.cmake)
|
|
|
|
endif()
|
|
|
|
|
2020-03-27 14:49:12 +08:00
|
|
|
set(CMAKE_CXX_FLAGS ${_ms_tmp_CMAKE_CXX_FLAGS_F})
|