Skip to content

Commit 1a5ca2a

Browse files
authored
Merge pull request #49 from gpilab/develop
gpi_make improvements
2 parents ddd95b4 + 0c2b471 commit 1a5ca2a

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

lib/gpi/make.py

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -280,6 +280,8 @@ def make(GPI_PREFIX=None):
280280
parser.add_option('--ignore-system-libs', dest='ignore_sys', default=False,
281281
action='store_true',
282282
help="Ignore the system libraries (e.g. for conda build).")
283+
parser.add_option('--osx-ver', dest='osx_target_ver',
284+
help="Override tgt. version for OSX builds (must be '10.X').")
283285

284286
parser.add_option(
285287
'-v', '--verbose', dest='verbose', default=False, action="store_true",
@@ -314,18 +316,20 @@ def make(GPI_PREFIX=None):
314316
print((Cl.FAIL + "ERROR: no targets specified." + Cl.ESC))
315317
sys.exit(ERROR_NO_VALID_TARGETS)
316318

319+
default_cpp = True
317320
if options.ignore_gpirc:
318321
print('Ignoring the ~/.gpirc...')
319-
322+
else:
320323
# USER MAKE config
321-
if not options.ignore_gpirc:
322324
if (len(Config.MAKE_CFLAGS) + len(Config.MAKE_LIBS) + len(Config.MAKE_INC_DIRS) + len(Config.MAKE_LIB_DIRS)) > 0:
323325
print("Adding USER include dirs")
324326
# add user libs
325327
libraries += Config.MAKE_LIBS
326328
include_dirs += Config.MAKE_INC_DIRS
327329
library_dirs += Config.MAKE_LIB_DIRS
328330
extra_compile_args += Config.MAKE_CFLAGS
331+
if any("c++" in cflag for cflag in Config.MAKE_CFLAGS):
332+
default_cpp = False
329333

330334
# Anaconda environment includes
331335
# includes FFTW and eigen
@@ -415,8 +419,11 @@ def make(GPI_PREFIX=None):
415419
# force only x86_64
416420
os.environ["ARCHFLAGS"] = '-arch x86_64'
417421

418-
# force 10.7 compatibility
419-
os.environ["MACOSX_DEPLOYMENT_TARGET"] = '10.9'
422+
# force 10.9 compatibility unless override is passed
423+
if options.osx_target_ver is not None:
424+
os.environ["MACOSX_DEPLOYMENT_TARGET"] = options.osx_target_ver
425+
else:
426+
os.environ["MACOSX_DEPLOYMENT_TARGET"] = '10.9'
420427

421428
# for malloc.h
422429
if not options.ignore_sys:
@@ -466,7 +473,8 @@ def make(GPI_PREFIX=None):
466473
print("Failed to perform auto-formatting with \'astyle\'. Do you have it installed?")
467474
sys.exit(ERROR_EXTERNAL_APP)
468475

469-
extra_compile_args.append('-std=c++98')
476+
if default_cpp:
477+
extra_compile_args.append('-std=c++11')
470478

471479
mod_name = target['fn'].split("_PyMOD")[0]
472480
extra_compile_args.append('-DMOD_NAME=' + mod_name)

0 commit comments

Comments
 (0)