From 265032da8f012624c407de367e84cb39c1a28bf2 Mon Sep 17 00:00:00 2001 From: "Bryan W. Weber" Date: Wed, 12 Jun 2019 12:29:57 -0400 Subject: [PATCH] Remove build-system specific env vars on macOS The isysroot and mmacosx-min-version flags are needed to build the Cantera library, but not to actually use it on macOS. They should be removed because users don't need these and should use the SDK installed with XCode. --- samples/cxx/SConscript | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/samples/cxx/SConscript b/samples/cxx/SConscript index 2bc2427da..7265787e1 100644 --- a/samples/cxx/SConscript +++ b/samples/cxx/SConscript @@ -40,7 +40,18 @@ set(CMAKE_EXE_LINKER_FLAGS ${CMAKE_EXE_LINKER_FLAGS} ${OpenMP_EXE_LINKER_FLAGS}) localenv['boost_inc_dir']) + tuple(localenv['extra_inc_dirs']) libdirs = ((localenv['ct_libdir'], localenv['sundials_libdir'], localenv['blas_lapack_dir']) + tuple(localenv['extra_lib_dirs'])) - localenv['tmpl_compiler_flags'] = repr(localenv['CCFLAGS'] + localenv['CXXFLAGS']) + # Remove sysroot and macOS min version flags in templated output files + # Users should compile against their local SDKs, which should be backwards + # compatible with the SDK used for building. This only applies to the + # conda package for now. + if env['OS'] == 'Darwin' and os.environ.get('CONDA_BUILD', False): + ccFlags = [] + for flag in localenv['CCFLAGS'] + localenv['CXXFLAGS']: + if not flag.startswith(('-isysroot', '-mmacosx', '/App')): + ccFlags.append(flag) + else: + ccFlags = localenv['CCFLAGS'] + localenv['CXXFLAGS'] + localenv['tmpl_compiler_flags'] = repr(ccFlags) localenv['tmpl_cantera_frameworks'] = repr(localenv['FRAMEWORKS']) localenv['tmpl_cantera_incdirs'] = repr([x for x in incdirs if x]) localenv['cmake_cantera_incdirs'] = ' '.join(quoted(x) for x in incdirs if x) @@ -72,7 +83,7 @@ set(CMAKE_EXE_LINKER_FLAGS ${CMAKE_EXE_LINKER_FLAGS} ${OpenMP_EXE_LINKER_FLAGS}) ## Generate Makefiles to be installed mak_path = pjoin(localenv['ct_incroot'], 'cantera', 'Cantera.mak') - localenv['mak_compiler_flags'] = ' '.join(localenv['CCFLAGS'] + localenv['CXXFLAGS']) + localenv['mak_compiler_flags'] = ' '.join(ccFlags) if ' ' in mak_path: # There is no reasonable way to handle spaces in Makefile 'include' # statement, so we fall back to using the relative path instead