-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.py
More file actions
49 lines (40 loc) · 994 Bytes
/
setup.py
File metadata and controls
49 lines (40 loc) · 994 Bytes
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
import os
import glob
import pybind11
from setuptools import find_packages, setup, Extension
# ------------------------------------------- #
LIBRARY_NAME = "dgs"
CSRC_DIR = "csrc"
CSRC_DIR_ABSOLUTE = os.path.join(os.path.abspath(os.path.dirname(__file__)), "csrc")
# ------------------------------------------- #
def get_extension():
linkArgs = [ ] if os.name == "nt" else [ "-O3" ]
compileArgs = ([
"/O2"
] if os.name == "nt" else [
"-O3",
"-Wno-missing-braces"
])
srcs = list(
glob.glob(os.path.join(CSRC_DIR, "src", "*.c"))
)
srcs.append(
os.path.join(CSRC_DIR, "ext.cpp")
)
includeDirs = [
os.path.join(CSRC_DIR_ABSOLUTE, "include"),
os.path.join(CSRC_DIR_ABSOLUTE, "external"),
pybind11.get_include()
]
return Extension(
f"{LIBRARY_NAME}._C",
srcs,
include_dirs=includeDirs,
extra_compile_args=compileArgs,
extra_link_args=linkArgs
)
# ------------------------------------------- #
setup(
ext_modules=[ get_extension() ],
cmdclass={},
)