check gcc version, check patch is found or not

This commit is contained in:
zhoufeng 2020-04-26 11:02:20 +08:00
parent 3b625ac9ae
commit e0c3ec6c79
2 changed files with 19 additions and 2 deletions

View File

@ -1,5 +1,10 @@
cmake_minimum_required(VERSION 3.14)
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 ()
include(${CMAKE_SOURCE_DIR}/cmake/options.cmake)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/modules/")
@ -18,7 +23,16 @@ set(PYBIND11_CPP_STANDARD -std=c++17)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OPTION_CXX_FLAGS}")
find_package(Threads)
find_package(Patch)
if (DEFINED ENV{MS_PATCH_PATH})
find_program(Patch_EXECUTABLE patch PATHS $ENV{MS_PATCH_PATH})
set(Patch_FOUND ${Patch_EXECUTABLE})
else ()
find_package(Patch)
endif ()
if (NOT Patch_FOUND)
message(FATAL_ERROR "Patch not found, please set env variable MS_PATCH_PATH, "
"usually locate in GIT_PATH/usr/bin in windows")
endif ()
message(PATCH_EXECUTABLE = ${Patch_EXECUTABLE})
include(${CMAKE_SOURCE_DIR}/cmake/mind_expression.cmake)

View File

@ -153,7 +153,10 @@ endif ()
if (CMAKE_SYSTEM_NAME MATCHES "Windows")
get_filename_component(CXX_DIR ${CMAKE_CXX_COMPILER} PATH)
file(GLOB CXX_LIB_LIST ${CXX_DIR}/*.dll)
file(GLOB VC_LIB_LIST $ENV{SystemRoot}/System32/msvcp140.dll $ENV{SystemRoot}/System32/vcomp140.dll)
string(REPLACE "\\" "/" SystemRoot $ENV{SystemRoot})
file(GLOB VC_LIB_LIST ${SystemRoot}/System32/msvcp140.dll ${SystemRoot}/System32/vcomp140.dll)
file(GLOB JPEG_LIB_LIST ${jpeg_turbo_LIBPATH}/*.dll)
file(GLOB SQLITE_LIB_LIST ${sqlite_LIBPATH}/*.dll)
install(