-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
38 lines (31 loc) · 924 Bytes
/
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
# encoding: utf-8
#
# setup.py
#
import os
import sys
from setuptools import Extension, setup
from distutils import sysconfig
FAST_MEDIAN_PATH = 'cextern/fast_median/src'
cpp_flags = []
link_flags = []
if sys.platform == "linux":
cpp_flags += ["-fPIC", "-shared", "-O3", "-march=native"]
elif sys.platform == "darwin":
cpp_flags += ["-O3", "-march=native", '-stdlib=libc++', '-mmacosx-version-min=10.9']
link_flags += ["-v", '-mmacosx-version-min=10.9']
cvars = sysconfig.get_config_vars()
cvars['LDSHARED'] = cvars['LDSHARED'].replace('-bundle', '-dynamiclib')
setup(
ext_modules=[
Extension(
name="fast_median",
sources=[os.path.join(FAST_MEDIAN_PATH, "fast_median.cpp")],
define_macros=[],
extra_compile_args=cpp_flags,
extra_link_args=link_flags,
language='c++',
optional=False
),
]
)