bundle headers in seperate dir for all OSes

This commit is contained in:
Johannes Pohl
2017-02-28 18:16:03 +01:00
parent 7553575211
commit 00aec862ee
4 changed files with 6 additions and 4 deletions

View File

@@ -95,13 +95,14 @@ def get_ext_modules():
def get_device_modules():
include_dir = os.path.realpath(os.path.join(os.curdir, "src/urh/dev/native/includes"))
if sys.platform == "win32":
if platform.architecture()[0] != "64bit":
return [] # only 64 bit python supported for native device backends
NATIVES = ["rtlsdr", "hackrf"]
result = []
include_dir = os.path.realpath(os.path.join(os.curdir, "src/urh/dev/native/lib/win"))
lib_dir = os.path.realpath(os.path.join(os.curdir, "src/urh/dev/native/lib/win"))
for native in NATIVES:
result.append(Extension("urh.dev.native.lib."+native, ["src/urh/dev/native/lib/{}.cpp".format(native)],
@@ -110,7 +111,6 @@ def get_device_modules():
include_dirs=[include_dir],
language="c++"))
return result
compiler = ccompiler.new_compiler()
@@ -128,23 +128,25 @@ def get_device_modules():
scriptdir = os.path.realpath(os.path.dirname(__file__))
sys.path.append(os.path.realpath(os.path.join(scriptdir, "src", "urh", "dev", "native", "lib")))
for dev_name, params in devices.items():
if compiler.has_function(params["test_function"], libraries=(params["lib"],)):
if compiler.has_function(params["test_function"], libraries=(params["lib"], ), include_dirs=[include_dir]):
print("\nWill compile with native {0} support\n".format(params["lib"], dev_name))
e = Extension("urh.dev.native.lib." + dev_name,
["src/urh/dev/native/lib/{0}{1}".format(dev_name, EXT)],
extra_compile_args=[OPEN_MP_FLAG],
extra_link_args=[OPEN_MP_FLAG],
language="c++",
include_dirs=[include_dir],
libraries=[params["lib"]])
extensions.append(e)
elif dev_name in fallbacks:
print("Trying fallback for {0}".format(dev_name))
params = fallbacks[dev_name]
dev_name += "_fallback"
if compiler.has_function(params["test_function"], libraries=(params["lib"],)):
if compiler.has_function(params["test_function"], libraries=(params["lib"],), include_dirs=[include_dir],):
print("\nWill compile with native {0} support\n".format(dev_name))
e = Extension("urh.dev.native.lib." + dev_name,
["src/urh/dev/native/lib/{0}{1}".format(dev_name, EXT)],
include_dirs=[include_dir],
extra_compile_args=[OPEN_MP_FLAG],
extra_link_args=[OPEN_MP_FLAG],
language="c++",