-
Notifications
You must be signed in to change notification settings - Fork 7
/
setup.py
57 lines (48 loc) · 1.3 KB
/
setup.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
setup.py
Created by Stephan Hügel on 2016-07-25
"""
import sys
from setuptools import setup, Extension
from Cython.Build import cythonize
import numpy
# # Set dynamic RPATH differently, depending on platform
ldirs = []
ddirs = []
if "linux" in sys.platform:
# from http://stackoverflow.com/a/10252190/416626
# the $ORIGIN trick is not perfect, though
ldirs = ["-Wl,-rpath", "-Wl,$ORIGIN/"]
platform_lib = "liblonlat_bng.so"
if sys.platform == "darwin":
# You must compile your binary with rpath support for this to work
# RUSTFLAGS="-C rpath" cargo build --release
platform_lib = "liblonlat_bng.dylib"
ldirs = ["-Wl,-rpath", "-Wl,@loader_path/"]
if sys.platform == "win32":
ddirs = ["src/convertbng/header.h"]
platform_lib = "lonlat_bng.dll"
extension = Extension(
name="convertbng.cutil",
sources=["src/convertbng/cutil.pyx"],
libraries=["lonlat_bng"],
depends=ddirs,
language="c",
include_dirs=["src/convertbng", numpy.get_include()],
library_dirs=["src/convertbng"],
extra_link_args=ldirs,
)
extensions = cythonize(
[
extension,
],
compiler_directives={"language_level": "3"},
)
setup(
package_data={
"convertbng": [platform_lib],
},
ext_modules=[extension],
)