Skip to content

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

Merged
dean0x7d merged 1 commit intopybind:masterfrom
aldanor:feature/get-include-shortcut
Jun 28, 2017
Merged

python -m pybind11 --includes prints include paths#921
dean0x7d merged 1 commit intopybind:masterfrom
aldanor:feature/get-include-shortcut

Conversation

@aldanor
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
Member Author

aldanor commented Jun 27, 2017

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

@dean0x7d
Copy link
Copy Markdown
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
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.

3 participants