diff --git a/CMakeLists.txt b/CMakeLists.txt index be4924c029a..1ab84e29916 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -19,7 +19,12 @@ if(NOT CMAKE_SYSTEM_NAME MATCHES "Windows") endif() if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") - set(CMAKE_OSX_SYSROOT "") + exec_program(sw_vers ARGS -productVersion OUTPUT_VARIABLE MACOSX_SYSTEM_VERSION) + if(NOT DEFINED ENV{MACOSX_DEPLOYMENT_TARGET}) + set(CMAKE_OSX_DEPLOYMENT_TARGET ${MACOSX_SYSTEM_VERSION} CACHE STRING + "minimum macosx deployment target version" FORCE) + endif() + message("macosx deployment target version: ${CMAKE_OSX_DEPLOYMENT_TARGET}") set(CMAKE_CXX_FLAGS_RELEASE "$ENV{CXXFLAGS} -O2 -Winconsistent-missing-override -Wno-user-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 \ diff --git a/cmake/package_mac.cmake b/cmake/package_mac.cmake index 6ae6cd179c7..4f581e8a209 100644 --- a/cmake/package_mac.cmake +++ b/cmake/package_mac.cmake @@ -16,6 +16,7 @@ set(CPACK_ENABLE_SYM_FILE ${ENABLE_SYM_FILE}) set(CPACK_CMAKE_BUILD_TYPE ${CMAKE_BUILD_TYPE}) set(CPACK_PYTHON_EXE ${Python3_EXECUTABLE}) set(CPACK_PYTHON_VERSION ${Python3_VERSION_MAJOR}.${Python3_VERSION_MINOR}) +set(CPACK_OSX_DEPLOYMENT_TARGET ${CMAKE_OSX_DEPLOYMENT_TARGET}) if(ENABLE_GPU) diff --git a/cmake/package_script.cmake b/cmake/package_script.cmake index b181bbe27fb..491b954d460 100644 --- a/cmake/package_script.cmake +++ b/cmake/package_script.cmake @@ -32,16 +32,18 @@ if(CMAKE_SYSTEM_NAME MATCHES "Linux") string(TOLOWER linux_${CMAKE_HOST_SYSTEM_PROCESSOR} PLATFORM_TAG) elseif(CMAKE_SYSTEM_NAME MATCHES "Darwin") if(PYTHON_VERSION MATCHES "3.9") - set(PY_TAGS "py39-none") + set(PY_TAGS "cp39-cp39") elseif(PYTHON_VERSION MATCHES "3.8") - set(PY_TAGS "py38-none") + set(PY_TAGS "cp38-cp38") elseif(PYTHON_VERSION MATCHES "3.7") - set(PY_TAGS "py37-none") + set(PY_TAGS "cp37-cp37m") else() message("Could not find 'Python 3.9' OR 'Python 3.8' or 'Python 3.7'") return() endif() - set(PLATFORM_TAG "any") + string(REGEX MATCH "[0-9]+.[0-9]+" MACOSX_SDK_VERSION "${CPACK_OSX_DEPLOYMENT_TARGET}") + string(REPLACE "." "_" MACOSX_PACKAGE_VERSION "${MACOSX_SDK_VERSION}") + string(TOLOWER macosx_${MACOSX_PACKAGE_VERSION}_${CMAKE_HOST_SYSTEM_PROCESSOR} PLATFORM_TAG) elseif(CMAKE_SYSTEM_NAME MATCHES "Windows") if(PYTHON_VERSION MATCHES "3.9") set(PY_TAGS "cp39-cp39")