forked from mindspore-Ecosystem/mindspore
!36372 improve third party compilation
Merge pull request !36372 from xulei/improve_3rd_party
This commit is contained in:
commit
3a3c4a3fc0
|
@ -110,10 +110,11 @@ if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
if(IS_DIRECTORY "${MACOSX_XCODE_SDK_PATH}/${MACOSX_FIND_SDK_NAME}.sdk")
|
if(IS_DIRECTORY "${MACOSX_XCODE_SDK_PATH}/${MACOSX_FIND_SDK_NAME}.sdk")
|
||||||
set(ENV{SDKROOT} "${MACOSX_XCODE_SDK_PATH}/${MACOSX_FIND_SDK_NAME}.sdk")
|
set(CMAKE_OSX_SYSROOT "${MACOSX_XCODE_SDK_PATH}/${MACOSX_FIND_SDK_NAME}.sdk")
|
||||||
else()
|
else()
|
||||||
set(ENV{SDKROOT} "${MACOSX_CLT_SDK_PATH}/${MACOSX_FIND_SDK_NAME}.sdk")
|
set(CMAKE_OSX_SYSROOT "${MACOSX_CLT_SDK_PATH}/${MACOSX_FIND_SDK_NAME}.sdk")
|
||||||
endif()
|
endif()
|
||||||
|
set(ENV{SDKROOT} ${CMAKE_OSX_SYSROOT})
|
||||||
endif()
|
endif()
|
||||||
message("macosx sdkroot: $ENV{SDKROOT}")
|
message("macosx sdkroot: $ENV{SDKROOT}")
|
||||||
# set macosx deployment target based on SDK
|
# set macosx deployment target based on SDK
|
||||||
|
@ -136,6 +137,7 @@ if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
|
||||||
else()
|
else()
|
||||||
set(CMAKE_OSX_DEPLOYMENT_TARGET "10.15")
|
set(CMAKE_OSX_DEPLOYMENT_TARGET "10.15")
|
||||||
endif()
|
endif()
|
||||||
|
set(ENV{MACOSX_DEPLOYMENT_TARGET} ${CMAKE_OSX_DEPLOYMENT_TARGET})
|
||||||
endif()
|
endif()
|
||||||
message("macosx deployment target version: ${CMAKE_OSX_DEPLOYMENT_TARGET}")
|
message("macosx deployment target version: $ENV{MACOSX_DEPLOYMENT_TARGET}")
|
||||||
endif()
|
endif()
|
||||||
|
|
|
@ -114,6 +114,7 @@ function(__find_pkg_then_add_target pkg_name pkg_exe lib_path)
|
||||||
message("_FIND:${${pkg_name}_BASE_DIR}")
|
message("_FIND:${${pkg_name}_BASE_DIR}")
|
||||||
|
|
||||||
if(pkg_exe)
|
if(pkg_exe)
|
||||||
|
unset(${pkg_exe}_EXE CACHE)
|
||||||
find_program(${pkg_exe}_EXE ${pkg_exe} PATHS ${${pkg_name}_BASE_DIR}/bin NO_DEFAULT_PATH)
|
find_program(${pkg_exe}_EXE ${pkg_exe} PATHS ${${pkg_name}_BASE_DIR}/bin NO_DEFAULT_PATH)
|
||||||
if(NOT ${pkg_exe}_EXE)
|
if(NOT ${pkg_exe}_EXE)
|
||||||
return()
|
return()
|
||||||
|
@ -206,7 +207,6 @@ endfunction()
|
||||||
set(MS_FIND_NO_DEFAULT_PATH NO_CMAKE_PATH NO_CMAKE_ENVIRONMENT_PATH NO_SYSTEM_ENVIRONMENT_PATH
|
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_BUILDS_PATH NO_CMAKE_PACKAGE_REGISTRY NO_CMAKE_SYSTEM_PATH
|
||||||
NO_CMAKE_SYSTEM_PACKAGE_REGISTRY)
|
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)
|
||||||
|
@ -239,6 +239,9 @@ function(mindspore_add_pkg pkg_name)
|
||||||
"${CMAKE_CXX_COMPILER_VERSION}-${CMAKE_C_COMPILER_VERSION}
|
"${CMAKE_CXX_COMPILER_VERSION}-${CMAKE_C_COMPILER_VERSION}
|
||||||
${ARGN} - ${${pkg_name}_USE_STATIC_LIBS}- ${${pkg_name}_PATCHES_HASH}
|
${ARGN} - ${${pkg_name}_USE_STATIC_LIBS}- ${${pkg_name}_PATCHES_HASH}
|
||||||
${${pkg_name}_CXXFLAGS}--${${pkg_name}_CFLAGS}--${${pkg_name}_LDFLAGS}")
|
${${pkg_name}_CXXFLAGS}--${${pkg_name}_CFLAGS}--${${pkg_name}_LDFLAGS}")
|
||||||
|
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
|
||||||
|
set(${pkg_name}_CONFIG_TXT "${${pkg_name}_CONFIG_TXT}--${CMAKE_OSX_DEPLOYMENT_TARGET}")
|
||||||
|
endif()
|
||||||
string(REPLACE ";" "-" ${pkg_name}_CONFIG_TXT ${${pkg_name}_CONFIG_TXT})
|
string(REPLACE ";" "-" ${pkg_name}_CONFIG_TXT ${${pkg_name}_CONFIG_TXT})
|
||||||
string(MD5 ${pkg_name}_CONFIG_HASH ${${pkg_name}_CONFIG_TXT})
|
string(MD5 ${pkg_name}_CONFIG_HASH ${${pkg_name}_CONFIG_TXT})
|
||||||
|
|
||||||
|
@ -268,7 +271,7 @@ function(mindspore_add_pkg pkg_name)
|
||||||
return()
|
return()
|
||||||
endif()
|
endif()
|
||||||
elseif(NOT PKG_HEAD_ONLY)
|
elseif(NOT PKG_HEAD_ONLY)
|
||||||
find_package(${__FIND_PKG_NAME} ${PKG_VER} ${MS_FIND_NO_DEFAULT_PATH})
|
find_package(${__FIND_PKG_NAME} ${PKG_VER} PATHS ${${pkg_name}_BASE_DIR} ${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)
|
set(${pkg_name}_INC ${${pkg_name}_BASE_DIR}/include PARENT_SCOPE)
|
||||||
message("Found pkg: ${__FIND_PKG_NAME}")
|
message("Found pkg: ${__FIND_PKG_NAME}")
|
||||||
|
|
Loading…
Reference in New Issue