Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is it possible to generate bindings on Windows? #16

Open
Keithcat1 opened this issue Sep 21, 2021 · 3 comments
Open

Is it possible to generate bindings on Windows? #16

Keithcat1 opened this issue Sep 21, 2021 · 3 comments

Comments

@Keithcat1
Copy link

Given a header file, is it possible to generate bindings on Windows and create an extension module without requiring Cling at runtime. There's something like this in the docs but it's only for CMake I think.

@wlav
Copy link
Owner

wlav commented Sep 21, 2021

cppyy does not function without Cling. What distinguishes it from other binders, its run-time behavior, is impossible without Cling.

The cmake interface (which was contributed; I've not used it myself) has as goal to collect all possible C++ entities at build time into a structured package of Python modules, to make pythonizations easier and to make things like dir() and tab-completion work better (the normal __dir__ by CPyCppyy isn't 100% complete, but then again, given that the run-time is extensible, nothing ever is :) ). The actual bindings are still done at run-time.

I've been toying at some point with generating C++ bindings that would then use CFFI (being C-based, CFFI has a much lighter footprint), but since then several Clang-based generators (targeting pybind11) have cropped up, making the point moot. See e.g. AutoWIG or binder.

I understand the problem on Windows, as opposed to other platforms: users are unlikely to have a system compiler with associated C++ headers. However, if the PCH is distributed with the application (e.g. with pyinstaller), then no compiler is necessary.

There are yet better ways. In particular, it would be useful to have CPyCppyy and cppyy-backend wheels for Windows so that these do not need to be compiled, as well has splitting the PCH up in pre-compiled modules, which could then also be shipped for any other code to be bound. However, I haven't had time to create the necessary infrastructure and for sure, building the wheels for the various Python versions requires resources that I don't have. (Perhaps it can be solved with Cling building the wheels, but in that case, you'd still need the Python headers installed.) It would probably be more efficient to add Windows support on Conda.

@Keithcat1
Copy link
Author

Does PyInstaller currently support this?

@wlav
Copy link
Owner

wlav commented Oct 4, 2021

What does "this" refer to? Packaging the PCH? Yes. Enabling modules? That has nothing to do with PyInstaller. You can hack cppyy-cling to enable them, but I haven't tested them on Windows and upstream says that "it should mostly work, but there may be issues."

I'm in the process of revamping an old Intel-based Macbook. Then I'll have a Windows box (through VMWare) again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants