Reputation: 659
Here I found how to write setup.py
file for compiling my own C/C++ modules for python, but I can't specify more than one include directories from command line.
Please tell me the syntax how should I specify a list of directories from command line for setup.py
.
Upvotes: 5
Views: 6886
Reputation: 24089
alternative option inside setup.py
:
#! /bin/python
environ['CPPFLAGS'] = '-I/usr/local/opt/openssl/include -I/usr/include -I/usr/local/include'
environ['LDFLAGS'] = '-L/usr/local/opt/lib1/lib -L/usr/local/opt/lib2/lib'
alternative option from unix cli:
#! /bin/bash
export CPPFLAGS='-I/usr/local/opt/openssl/include -I/usr/include -I/usr/local/include'
export LDFLAGS='-L/usr/local/opt/lib1/lib -L/usr/local/opt/lib2/lib'
fyi, I used the environ
example to install pycurl
from my projects setup.py after searching for a long time.
Upvotes: 2
Reputation: 44112
The help for setup.py
tells, you can specify multiple values delimited by ":"
Shortened output:
$ python setup.py build_ext --help
Common commands: (see '--help-commands' for more)
setup.py build will build the package underneath 'build/'
setup.py install will install the package
Options for 'build_ext' command:
--include-dirs (-I) list of directories to search for header files
(separated by ':')
Upvotes: 4
Reputation: 659
I found the solution it should look like this
python setup.py build_ext --inplace --library-dirs=lib_dir1;lib_dir2 --include-dirs=inc_dir1;inc_dir2
Upvotes: 9