diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index e3e25d44f62dbce6d4977f3b5d9a940ce0201c4a..a617b85ab19ed790768366aa93ca6fd721d6c3b3 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -34,7 +34,7 @@ Python 3 K40: - curl -L -O -k https://gitlab.tiker.net/inducer/ci-support/raw/master/build-and-test-py-project.sh - "export LD_LIBRARY_PATH=/usr/local/cuda/lib64:$LD_LIBRARY_PATH" - ". ./build-and-test-py-project.sh" - + # https://github.com/illinois-scicomp/machine-shop-maintenance/issues/7 allow_failure: true @@ -47,10 +47,10 @@ Python 3 K40: Documentation: script: - EXTRA_INSTALL="numpy mako" - - curl -L -O -k https://gitlab.tiker.net/inducer/ci-support/raw/master/build-docs.sh - - ". ./build-docs.sh" + - curl -L -O -k https://gitlab.tiker.net/inducer/ci-support/raw/master/ci-support.sh + - ". ./ci-support.sh" + - build_py_project_in_venv + - build_docs --no-check tags: - python3 - nvidia-titan-x - only: - - master diff --git a/aksetup_helper.py b/aksetup_helper.py index f90d085284f00e6a6cd2a44e6b9bd63a857485f3..a168adf7a381ca8c33d005493030bdf7fab9addf 100644 --- a/aksetup_helper.py +++ b/aksetup_helper.py @@ -162,10 +162,12 @@ def hack_distutils(debug=False, fast_link=True, what_opt=3): from distutils import sysconfig cvars = sysconfig.get_config_vars() - cflags = cvars.get('OPT') + + bad_prefixes = ['-g', '-O', '-Wstrict-prototypes', '-DNDEBUG'] + + cflags = cvars.get("OPT") if cflags: - cflags = remove_prefixes(cflags.split(), - ['-g', '-O', '-Wstrict-prototypes', '-DNDEBUG']) + cflags = remove_prefixes(cflags.split(), bad_prefixes) if debug: cflags.append("-g") else: @@ -175,11 +177,17 @@ def hack_distutils(debug=False, fast_link=True, what_opt=3): cflags.append("-O%s" % what_opt) cflags.append("-DNDEBUG") - cvars['OPT'] = str.join(' ', cflags) - if "BASECFLAGS" in cvars: - cvars["CFLAGS"] = cvars["BASECFLAGS"] + " " + cvars["OPT"] - else: - assert "CFLAGS" in cvars + cvars["OPT"] = str.join(' ', cflags) + + cflags = cvars.get("CONFIGURE_CFLAGS") + if cflags: + cflags = remove_prefixes(cflags.split(), bad_prefixes) + cvars["CONFIGURE_CFLAGS"] = str.join(' ', cflags) + + if "BASECFLAGS" in cvars: + cvars["CFLAGS"] = cvars["BASECFLAGS"] + " " + cvars.get("OPT", "") + else: + assert "CFLAGS" in cvars if fast_link: for varname in ["LDSHARED", "BLDSHARED"]: @@ -935,23 +943,42 @@ class PybindBuildExtCommand(NumpyBuildExtCommand): 'unix': [], } - if sys.platform == 'darwin': - c_opts['unix'] += ['-stdlib=libc++', '-mmacosx-version-min=10.7'] - def build_extensions(self): ct = self.compiler.compiler_type opts = self.c_opts.get(ct, []) + cxx_opts = [] + if ct in ['unix', 'mingw32']: opts.append('-DVERSION_INFO="%s"' % self.distribution.get_version()) - opts.append(cpp_flag(self.compiler)) + cxx_opts.append(cpp_flag(self.compiler)) if has_flag(self.compiler, '-fvisibility=hidden'): opts.append('-fvisibility=hidden') + if sys.platform == 'darwin': + if has_flag(self.compiler, '-stdlib=libc++'): + opts.append('-stdlib=libc++') + if has_flag(self.compiler, '-mmacosx-version-min=10.7'): + opts.append('-mmacosx-version-min=10.7') elif ct == 'msvc': opts.append('/DVERSION_INFO=\\"%s\\"' % self.distribution.get_version()) for ext in self.extensions: ext.extra_compile_args = ext.extra_compile_args + opts - NumpyBuildExtCommand.build_extensions(self) + prev__compile = self.compiler._compile + + # -std=... used on C files causes an error on Apple LLVM + # https://gitlab.tiker.net/inducer/pymetis/-/jobs/102421 + def _compile(obj, src, ext, cc_args, extra_postargs, pp_opts): + if ext == ".cpp": + cc_args = cc_args + cxx_opts + + return prev__compile(obj, src, ext, cc_args, extra_postargs, pp_opts) + + self.compiler._compile = _compile + + try: + NumpyBuildExtCommand.build_extensions(self) + finally: + self.compiler._compile = prev__compile # }}}