|
@@ -1,10 +1,14 @@
|
|
#! /usr/bin/env python
|
|
#! /usr/bin/env python
|
|
#
|
|
#
|
|
# See README for usage instructions.
|
|
# See README for usage instructions.
|
|
|
|
+from distutils import util
|
|
import glob
|
|
import glob
|
|
import os
|
|
import os
|
|
|
|
+import pkg_resources
|
|
|
|
+import re
|
|
import subprocess
|
|
import subprocess
|
|
import sys
|
|
import sys
|
|
|
|
+import sysconfig
|
|
import platform
|
|
import platform
|
|
|
|
|
|
# We must use setuptools, not distutils, because we need to use the
|
|
# We must use setuptools, not distutils, because we need to use the
|
|
@@ -186,6 +190,18 @@ if __name__ == '__main__':
|
|
extra_compile_args.append('-Wno-invalid-offsetof')
|
|
extra_compile_args.append('-Wno-invalid-offsetof')
|
|
extra_compile_args.append('-Wno-sign-compare')
|
|
extra_compile_args.append('-Wno-sign-compare')
|
|
|
|
|
|
|
|
+ # https://developer.apple.com/documentation/xcode_release_notes/xcode_10_release_notes
|
|
|
|
+ # C++ projects must now migrate to libc++ and are recommended to set a
|
|
|
|
+ # deployment target of macOS 10.9 or later, or iOS 7 or later.
|
|
|
|
+ if sys.platform == 'darwin':
|
|
|
|
+ mac_target = sysconfig.get_config_var('MACOSX_DEPLOYMENT_TARGET')
|
|
|
|
+ if mac_target and (pkg_resources.parse_version(mac_target) <
|
|
|
|
+ pkg_resources.parse_version('10.9.0')):
|
|
|
|
+ os.environ['MACOSX_DEPLOYMENT_TARGET'] = '10.9'
|
|
|
|
+ os.environ['_PYTHON_HOST_PLATFORM'] = re.sub(
|
|
|
|
+ r'macosx-[0-9]+\.[0-9]+-(.+)', r'macosx-10.9-\1',
|
|
|
|
+ util.get_platform())
|
|
|
|
+
|
|
# https://github.com/Theano/Theano/issues/4926
|
|
# https://github.com/Theano/Theano/issues/4926
|
|
if sys.platform == 'win32':
|
|
if sys.platform == 'win32':
|
|
extra_compile_args.append('-D_hypot=hypot')
|
|
extra_compile_args.append('-D_hypot=hypot')
|