Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -688,7 +688,7 @@ if(openPMD_HAVE_PYTHON)

if(EMSCRIPTEN)
set_target_properties(openPMD.py PROPERTIES
PREFIX "")
PREFIX "" SUFFIX ".emscripten_wasm32.so")
else()
pybind11_extension(openPMD.py)
endif()
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[build-system]
requires = [
"setuptools>=42",
"setuptools>=57.4",
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Introduces the env var SETUPTOOLS_EXT_SUFFIX (ref)

"wheel",
"cmake>=3.15.0,<4.0.0",
"pybind11>=2.6.2,<3.0.0"
Expand Down
25 changes: 17 additions & 8 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,18 @@ def run(self):
for ext in self.extensions:
self.build_extension(ext)

def get_ext_filename(self, ext_name):
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overwritten temporarily since it looks like the build_wheel step does not have the same env vars in pyoide than the earlier steps during build.

Wheel packaging still does not pick up the openpmd_api_cxx shared lib though...

r"""Convert the name of an extension (eg. "foo.bar") into the name
of the file from which it will be loaded (eg. "foo/bar.so", or
"foo\bar.pyd").
"""
from distutils.sysconfig import get_config_var
ext_path = ext_name.split('.')
ext_suffix = os.getenv('SETUPTOOLS_EXT_SUFFIX', None)
if ext_suffix is None:
ext_suffix = get_config_var('EXT_SUFFIX')
return os.path.join(*ext_path) + ext_suffix

def build_extension(self, ext):
extdir = os.path.abspath(os.path.dirname(
self.get_ext_fullpath(ext.name)
Expand All @@ -44,10 +56,9 @@ def build_extension(self, ext):
extdir += os.path.sep

cmake_args = [
'-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=' +
os.path.join(extdir, "openpmd_api"),
# '-DCMAKE_RUNTIME_OUTPUT_DIRECTORY=' + extdir,
'-DCMAKE_PYTHON_OUTPUT_DIRECTORY=' + extdir,
'-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=' + extdir,
# '-DCMAKE_RUNTIME_OUTPUT_DIRECTORY=' + os.path.join(extdir, "../"),
'-DCMAKE_PYTHON_OUTPUT_DIRECTORY=' + os.path.join(extdir, "../"),
'-DPython_EXECUTABLE=' + sys.executable,
'-DopenPMD_USE_PYTHON:BOOL=ON',
# variants
Expand Down Expand Up @@ -87,9 +98,7 @@ def build_extension(self, ext):
if platform.system() == "Windows":
cmake_args += [
'-DCMAKE_LIBRARY_OUTPUT_DIRECTORY_{}={}'.format(
cfg.upper(),
os.path.join(extdir, "openpmd_api")
)
cfg.upper(), extdir)
]
if sys.maxsize > 2**32:
cmake_args += ['-A', 'x64']
Expand Down Expand Up @@ -186,7 +195,7 @@ def build_extension(self, ext):
'Source': 'https://github.com/openPMD/openPMD-api',
'Tracker': 'https://github.com/openPMD/openPMD-api/issues',
},
ext_modules=[CMakeExtension('openpmd_api_cxx')],
ext_modules=[CMakeExtension('openpmd_api.openpmd_api_cxx')],
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Playing with declaring the full sub-module here does not help either with the install pick-up-to-wheel issue.

cmdclass=dict(build_ext=CMakeBuild),
# scripts=['openpmd-ls'],
zip_safe=False,
Expand Down