Skip to content

Commit

Permalink
Make fcidecomp build conditional to C++14 instead of C++11
Browse files Browse the repository at this point in the history
  • Loading branch information
t20100 committed Jul 4, 2024
1 parent e7a64a7 commit cd4b1e8
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -467,6 +467,7 @@ def finalize_options(self):
self.distribution.ext_modules = [
ext for ext in self.distribution.ext_modules
if '-std=c++14' not in ext.extra_compile_args
and not (isinstance(ext, HDF5PluginExtension) and ext.cpp14_required)
]

if not self.hdf5plugin_config.use_cpp20:
Expand Down Expand Up @@ -605,7 +606,17 @@ def build_extensions(self):
class HDF5PluginExtension(Extension):
"""Extension adding specific things to build a HDF5 plugin"""

def __init__(self, name, sse2=None, avx2=None, cpp11=None, cpp11_required=False, cpp20_required=False, **kwargs):
def __init__(
self,
name,
sse2=None,
avx2=None,
cpp11=None,
cpp11_required=False,
cpp14_required=False,
cpp20_required=False,
**kwargs
):
Extension.__init__(self, name, **kwargs)

if not self.depends:
Expand All @@ -632,6 +643,7 @@ def __init__(self, name, sse2=None, avx2=None, cpp11=None, cpp11_required=False,
self.avx2 = avx2 if avx2 is not None else {}
self.cpp11 = cpp11 if cpp11 is not None else {}
self.cpp11_required = cpp11_required
self.cpp14_required = cpp14_required
self.cpp20_required = cpp20_required

@property
Expand Down Expand Up @@ -1105,16 +1117,15 @@ def get_fcidecomp_plugin():

extra_compile_args = ['-O3', '-ffast-math', '-std=c99', '-fopenmp']
extra_compile_args += ['/Ox', '/fp:fast', '/openmp']
extra_link_args = ['-fopenmp', '/openmp']
extra_link_args = ['-lstdc++', '-fopenmp', '/openmp']

return HDF5PluginExtension(
"hdf5plugin.plugins.libh5fcidecomp",
sources=glob(f"{fcidecomp_dir}/fcicomp-*/src/*.c"),
include_dirs=glob(f"{fcidecomp_dir}/fcicomp-*/include") + get_charls_clib('include_dirs'),
extra_compile_args=extra_compile_args,
extra_link_args=extra_link_args,
cpp11={'extra_link_args': ['-lstdc++']},
cpp11_required=True,
cpp14_required=True,
define_macros=[('CHARLS_STATIC', 1), ('LOGGING', 1)],
)

Expand Down

0 comments on commit cd4b1e8

Please sign in to comment.