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

python -m pybind11 --includes prints include paths #921

Merged
merged 1 commit into from
Jun 28, 2017

Conversation

aldanor
Copy link
Member

@aldanor aldanor commented Jun 23, 2017

A very minor/cosmetic addition, makes building modules manually slightly easier:

$ c++ -I `python -m pybind11`

instead of

$ c++ -I `python -c 'import pybind11; print(pybind11.get_include())'`

The docs in #907 could also get updated if this gets accepted.

@jagerman
Copy link
Member

I realize there's no __main__ at all at the moment, but I'd be a bit more receptive to this if it put the print statement behind an argument, so that you need to invoke something like python -m pybind11 --includes, which leads the door wide open for making it do other nifty things in the future.

@aldanor
Copy link
Member Author

aldanor commented Jun 24, 2017

Agreed, good point re: --includes. Would you expect it to behave the same as python-config? (i.e., prefix the include paths with -I on Linux/macOS).

@jagerman
Copy link
Member

That's probably the most convenient. Perhaps throw in the Python includes, too?

@aldanor aldanor force-pushed the feature/get-include-shortcut branch from 8858d37 to 6e395f5 Compare June 25, 2017 09:45
@aldanor aldanor changed the title python -m pybind11 prints include path python -m pybind11 --includes prints include paths Jun 25, 2017
@aldanor
Copy link
Member Author

aldanor commented Jun 25, 2017

Alright.

python -m pybind11 --includes

now prints include flags for both Python (borrowed from python3-config code) and pybind11.

(This is a first step, but it'd be nice to eventually integrate other stuff like recommended cflags (e.g. fvisibility-hidden, or exception flags on windows), ldflags (e.g. undefined dynamic_lookup on OS X), and extension-suffix -- so that we can remove python-config/python3-config from the docs.)

@aldanor
Copy link
Member Author

aldanor commented Jun 27, 2017

Does this look better now; anything else to do here?

@dean0x7d
Copy link
Member

LGTM

@dean0x7d dean0x7d merged commit 6b442ff into pybind:master Jun 28, 2017
aldanor added a commit to aldanor/pybind11 that referenced this pull request Jul 23, 2017
aldanor added a commit to aldanor/pybind11 that referenced this pull request Jul 23, 2017
@dean0x7d dean0x7d modified the milestone: v2.2 Aug 13, 2017
@rwgk rwgk mentioned this pull request Feb 9, 2023
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

Successfully merging this pull request may close these issues.

None yet

3 participants