2020-03-27 14:49:12 +08:00
|
|
|
set(SECURE_CXX_FLAGS "")
|
|
|
|
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
|
2020-04-15 17:36:48 +08:00
|
|
|
if (WIN32)
|
|
|
|
set(SECURE_CXX_FLAGS "-fstack-protector-all")
|
|
|
|
else()
|
|
|
|
set(SECURE_CXX_FLAGS "-fstack-protector-all -Wl,-z,relro,-z,now,-z,noexecstack")
|
|
|
|
endif()
|
2020-03-27 14:49:12 +08:00
|
|
|
endif()
|
|
|
|
set(_ms_tmp_CMAKE_CXX_FLAGS_F ${CMAKE_CXX_FLAGS})
|
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden")
|
|
|
|
|
|
|
|
include(cmake/utils.cmake)
|
|
|
|
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
|
|
|
|
2020-08-14 14:56:27 +08:00
|
|
|
SET(MS_BUILD_GRPC 0)
|
2020-08-03 14:49:30 +08:00
|
|
|
if (ENABLE_DEBUGGER OR ENABLE_SERVING OR ENABLE_TESTCASES)
|
2020-08-14 14:56:27 +08:00
|
|
|
SET(MS_BUILD_GRPC 1)
|
|
|
|
endif()
|
|
|
|
if (ENABLE_MINDDATA AND NOT CMAKE_SYSTEM_NAME MATCHES "Windows")
|
|
|
|
SET(MS_BUILD_GRPC 1)
|
|
|
|
endif()
|
|
|
|
if ("${MS_BUILD_GRPC}")
|
2020-06-11 22:42:57 +08:00
|
|
|
# build dependencies of gRPC
|
|
|
|
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)
|
|
|
|
# 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()
|
2020-07-21 16:37:24 +08:00
|
|
|
if (ENABLE_CPU AND (ENABLE_D OR ENABLE_GPU))
|
2020-06-08 15:31:37 +08:00
|
|
|
include(${CMAKE_SOURCE_DIR}/cmake/external_libs/zeromq.cmake)
|
|
|
|
include(${CMAKE_SOURCE_DIR}/cmake/external_libs/pslite.cmake)
|
|
|
|
endif()
|
2020-03-27 14:49:12 +08:00
|
|
|
|
|
|
|
find_package(Python3)
|
|
|
|
include_directories(${Python3_INCLUDE_DIRS})
|
|
|
|
include_directories(${CMAKE_SOURCE_DIR}/third_party)
|
2020-08-05 22:07:45 +08:00
|
|
|
if (ENABLE_MPI)
|
|
|
|
include(${CMAKE_SOURCE_DIR}/cmake/external_libs/ompi.cmake)
|
|
|
|
endif()
|
|
|
|
|
2020-03-27 14:49:12 +08:00
|
|
|
if (ENABLE_CPU)
|
|
|
|
include(${CMAKE_SOURCE_DIR}/cmake/external_libs/mkl_dnn.cmake)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if (ENABLE_GPU)
|
2020-04-06 11:22:47 +08:00
|
|
|
if (ENABLE_MPI)
|
|
|
|
include(${CMAKE_SOURCE_DIR}/cmake/external_libs/nccl.cmake)
|
|
|
|
endif()
|
2020-03-27 14:49:12 +08:00
|
|
|
endif()
|
|
|
|
|
|
|
|
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)
|
2020-03-23 17:33:56 +08:00
|
|
|
elseif(ENABLE_D OR ENABLE_TESTCASES)
|
2020-03-27 14:49:12 +08:00
|
|
|
include_directories(${CMAKE_SOURCE_DIR}/graphengine/inc)
|
|
|
|
include_directories(${CMAKE_SOURCE_DIR}/graphengine/inc/ops)
|
|
|
|
include_directories(${CMAKE_SOURCE_DIR}/graphengine/inc/external)
|
|
|
|
include_directories(${CMAKE_SOURCE_DIR}/graphengine/inc/external/graph)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
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/libtiff.cmake)
|
|
|
|
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()
|
|
|
|
|
2020-08-03 14:49:30 +08:00
|
|
|
if (ENABLE_MINDDATA OR ENABLE_SERVING)
|
|
|
|
include(${CMAKE_SOURCE_DIR}/cmake/external_libs/jpeg_turbo.cmake)
|
|
|
|
endif()
|
|
|
|
|
2020-03-27 14:49:12 +08:00
|
|
|
include(${CMAKE_SOURCE_DIR}/cmake/external_libs/gtest.cmake)
|
|
|
|
include(${CMAKE_SOURCE_DIR}/cmake/external_libs/onnx.cmake)
|
|
|
|
set(CMAKE_CXX_FLAGS ${_ms_tmp_CMAKE_CXX_FLAGS_F})
|