Guess include and lib directory using capnp executable
This commit is contained in:
committed by
Jacob Alexander
parent
a7efe4e3f8
commit
722579d671
9
setup.py
9
setup.py
@@ -11,6 +11,7 @@ import sys
|
||||
from distutils.command.clean import clean as _clean
|
||||
from distutils.errors import CompileError
|
||||
from distutils.extension import Extension
|
||||
from distutils.spawn import find_executable
|
||||
|
||||
from setuptools import setup
|
||||
|
||||
@@ -113,10 +114,16 @@ class build_libcapnp_ext(build_ext_c):
|
||||
elif force_system_libcapnp:
|
||||
need_build = False
|
||||
else:
|
||||
# Try to use capnp executable to find include and lib path
|
||||
capnp_executable = find_executable("capnp")
|
||||
if capnp_executable:
|
||||
self.include_dirs += [os.path.join(os.path.dirname(capnp_executable), '..', 'include')]
|
||||
self.library_dirs += [os.path.join(os.path.dirname(capnp_executable), '..', 'lib')]
|
||||
|
||||
# Try to autodetect presence of library. Requires compile/run
|
||||
# step so only works for host (non-cross) compliation
|
||||
try:
|
||||
test_build()
|
||||
test_build(include_dirs=self.include_dirs, library_dirs=self.library_dirs)
|
||||
need_build = False
|
||||
except CompileError:
|
||||
need_build = True
|
||||
|
||||
Reference in New Issue
Block a user