forked from urschrei/convertbng
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.py
More file actions
58 lines (49 loc) · 1.32 KB
/
Copy pathsetup.py
File metadata and controls
58 lines (49 loc) · 1.32 KB
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
58
#!/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 = ["convertbng/header.h"]
platform_lib = "lonlat_bng.dll"
extensions = Extension(
"convertbng.cutil",
sources=["convertbng/cutil.pyx"],
libraries=["lonlat_bng"],
depends=ddirs,
language="c",
include_dirs=["convertbng", numpy.get_include()],
library_dirs=["convertbng"],
extra_compile_args=["-O3"],
extra_link_args=ldirs,
)
extensions = cythonize(
[
extensions,
],
compiler_directives={"language_level": "3"},
)
setup(
package_data={
"convertbng": [platform_lib],
},
ext_modules=extensions,
)