Commit 4b5eaa12 authored by Matthieu Dorier's avatar Matthieu Dorier

improved the way setup.py looks for libraries

parent 0b9c595b
from distutils.core import setup
from distutils.extension import Extension
from distutils.sysconfig import get_config_vars
import pkgconfig
import os
import os.path
import sys
......@@ -9,33 +10,59 @@ import sys
os.environ['OPT'] = " ".join(
flag for flag in opt.split() if flag != '-Wstrict-prototypes'
)
python_version = str(sys.version_info[0])+str(sys.version_info[1])
# Find out if Numpy is present
try:
import numpy
has_numpy = 1
except ImportError:
has_numpy = 0
if has_numpy == 1:
client_libs=['boost_python','margo','bake-client', 'boost_numpy']
else:
client_libs=['boost_python','margo','bake-client']
# Find out the dependencies using pkgconfig
# For client...
pk = pkgconfig.parse('bake-client')
client_libraries = pk['libraries']
client_libraries.append('boost_python'+python_version)
if(has_numpy == 1):
client_libraries.append('boost_numpy'+python_version)
client_library_dirs = pk['library_dirs']
client_include_dirs = pk['include_dirs']
client_include_dirs.append(".")
# For server...
pk = pkgconfig.parse('bake-server')
server_libraries = pk['libraries']
server_libraries.append('boost_python'+python_version)
server_library_dirs = pk['library_dirs']
server_include_dirs = pk['include_dirs']
server_include_dirs.append(".")
# For target...
pk = pkgconfig.parse('uuid')
target_libraries = pk['libraries']
target_library_dirs = pk['library_dirs']
target_include_dirs = pk['include_dirs']
target_include_dirs.append('.')
pk = pkgconfig.parse('bake-server')
target_include_dirs.extend(pk['include_dirs'])
pybake_server_module = Extension('_pybakeserver', ["pybake/src/server.cpp"],
libraries=['boost_python','margo','bake-server'],
include_dirs=['.'],
depends=[])
libraries=server_libraries,
library_dirs=server_library_dirs,
include_dirs=server_include_dirs,
depends=["pybake/src/server.cpp"])
pybake_client_module = Extension('_pybakeclient', ["pybake/src/client.cpp"],
libraries=client_libs,
include_dirs=['.'],
depends=[],
libraries=client_libraries,
library_dirs=client_library_dirs,
include_dirs=client_include_dirs,
depends=["pybake/src/client.cpp"],
define_macros=[('HAS_NUMPY', has_numpy)])
pybake_target_module = Extension('_pybaketarget', ["pybake/src/target.cpp"],
libraries=['boost_python', 'uuid' ],
include_dirs=['.'],
depends=[])
libraries=target_libraries,
library_dirs=target_library_dirs,
include_dirs=target_include_dirs,
depends=["pybake/src/target.cpp"])
setup(name='pybake',
version='0.1',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment