Skip to content

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

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

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

Conversation

@aldanor

@aldanoraldanor commented Jun 23, 2017

Copy link
Copy Markdown
Member

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
MemberAuthor

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
aldanorforce-pushed the feature/get-include-shortcut branch from 8858d37 to 6e395f5CompareJune 25, 2017 09:45
@aldanoraldanor changed the title python -m pybind11 prints include pathpython -m pybind11 --includes prints include pathsJun 25, 2017
@aldanor

aldanor commented Jun 25, 2017

Copy link
Copy Markdown
MemberAuthor

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
MemberAuthor

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

@dean0x7d

Copy link
Copy Markdown
Member

LGTM

@dean0x7d
dean0x7d merged commit 6b442ff into pybind:masterJun 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
@dean0x7ddean0x7d modified the milestone: v2.2Aug 13, 2017
@rwgkrwgk mentioned this pull request Feb 9, 2023
Sign up for freeto 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

@aldanor@jagerman@dean0x7d