Skip to content

Commit

Permalink
[setup] compile with -g0 on posix
Browse files Browse the repository at this point in the history
  • Loading branch information
marscher committed Jan 26, 2018
1 parent f4d87e6 commit 8c6d53b
Showing 1 changed file with 16 additions and 11 deletions.
27 changes: 16 additions & 11 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,8 @@ def extensions():
assert os.path.exists(pybind_inc)

exts = []

lib_prefix = 'lib' if sys.platform.startswith('win') else ''
common_cflags = ['-O3', ]

clustering_module = \
Extension('pyemma.coordinates.clustering._ext',
Expand All @@ -116,7 +116,7 @@ def extensions():
language='c++',
libraries=[lib_prefix+'theobald'],
library_dirs=[mdtraj.capi()['lib_dir']],
extra_compile_args=['-O3'])
extra_compile_args=common_cflags)

covar_module = \
Extension('pyemma._ext.variational.estimators.covar_c._covartools',
Expand All @@ -126,19 +126,19 @@ def extensions():
pybind_inc,
],
language='c++',
extra_compile_args=['-O3'])
extra_compile_args=common_cflags)

eig_qr_module = \
Extension('pyemma._ext.variational.solvers.eig_qr.eig_qr',
sources=['pyemma/_ext/variational/solvers/eig_qr/eig_qr.pyx'],
include_dirs=['pyemma/_ext/variational/solvers/eig_qr/', np_inc],
extra_compile_args=['-std=c99', '-O3'])
extra_compile_args=['-std=c99'] + common_cflags)

orderedset = \
Extension('pyemma._ext.orderedset._orderedset',
sources=['pyemma/_ext/orderedset/_orderedset.pyx'],
include_dirs=[np_inc],
extra_compile_args=['-O3'])
extra_compile_args=['-std=c99'] + common_cflags)

exts += [clustering_module,
covar_module,
Expand Down Expand Up @@ -229,15 +229,20 @@ def build_extensions(self):

# setup OpenMP support
openmp_enabled, needs_gomp = detect_openmp()
if openmp_enabled:
warnings.warn('enabled openmp')
omp_compiler_args = ['-fopenmp']
omp_libraries = ['-lgomp'] if needs_gomp else []
omp_defines = [('USE_OPENMP', None)]
# debug
dbg_flag = ['-g0' if not self.debug else '-g']

for ext in self.extensions:
if ext.language == 'c++':
ext.extra_compile_args = opts
ext.extra_compile_args = opts + dbg_flag
elif ext.language is None: # C
ext.extra_compile_args += dbg_flag
if openmp_enabled:
warnings.warn('enabled openmp')
omp_compiler_args = ['-fopenmp']
omp_libraries = ['-lgomp'] if needs_gomp else []
omp_defines = [('USE_OPENMP', None)]
ext.extra_compile_args += omp_compiler_args
ext.extra_link_args += omp_libraries
ext.define_macros += omp_defines
Expand Down Expand Up @@ -284,7 +289,7 @@ def build_extensions(self):
'tqdm',
],
zip_safe=False,
entry_points = {
entry_points={
'console_scripts': ['pyemma_list_models=pyemma._base.serialization.cli:main']
}
)
Expand Down

0 comments on commit 8c6d53b

Please sign in to comment.