-
Notifications
You must be signed in to change notification settings - Fork 1
/
setup.py
110 lines (103 loc) · 3.07 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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
from setuptools import setup, Extension
from Cython.Build import cythonize
import os
import platform
import glob
libraries = {
"Linux": [
"bgfx-shared-libRelease",
#"z", "jpeg", "png", "webp", "jbig85",
"SDL2", "SDL2_image", "SDL2_mixer",
"assimp",
"chipmunk",
"openal",
"FLAC", "opus",
"ogg", "vorbis", "vorbisfile", "vorbisenc",
"freetype", "harfbuzz",
"cimgui",
],
"Windows": [
"bgfx-shared-libRelease",
"SDL2main", "SDL2", "SDL2_image", "SDL2_mixer", "SDL2_net",
"assimp",
"chipmunk",
"openal-1",
"FLAC-8", "opus-0", "opusfile-0", "vorbis-0", "vorbisfile-3",
"webp-7",
"zlib1",
"freetype-6", "harfbuzz-0",
"cimgui",
#"cgltf",
"xxhash",
],
}
language = "c"
release_args = ["-w", "-std=c11", "-O3", "-ffast-math", "-march=native"]
debug_args = ["-w", "-std=c11", "-O0"]
#args = debug_args
args = release_args
macros = [
("CIMGUI_DEFINE_ENUMS_AND_STRUCTS", True),
("CGLTF_IMPLEMENTATION", True),
("STB_IMAGE_IMPLEMENTATION", True),
("STBI_FAILURE_USERMSG", True),
("CGLM_CLIPSPACE_INCLUDE_ALL", True),
("CGLM_ALL_UNALIGNED", True),
]
include_dirs = ["./pyorama/libs/include"]
library_dirs = {
"Linux": ["./pyorama/libs/shared/Linux"],
"Windows": ["./pyorama/libs/shared/Windows"],
}
annotate = True
quiet = False
directives = {
"binding": True,
"boundscheck": False,
"cdivision": True,
"initializedcheck": False,
"language_level": "3",
"nonecheck": False,
"wraparound": False,
}
if __name__ == "__main__":
system = platform.system()
old_path = os.environ["PATH"]
os.environ["PATH"] = old_path + os.pathsep + library_dirs[system][0]
libs = libraries[system]
lib_dirs = library_dirs[system]
extensions = []
ext_modules = []
#create extensions
for path, dirs, file_names in os.walk("."):
for file_name in file_names:
if file_name.endswith("pyx"):
ext_path = "{0}/{1}".format(path, file_name)
ext_name = ext_path \
.replace("./", "") \
.replace("/", ".") \
.replace(".pyx", "")
ext = Extension(
name=ext_name,
sources=[ext_path],
libraries=libs,
language=language,
extra_compile_args=args,
include_dirs=include_dirs,
library_dirs=lib_dirs,
runtime_library_dirs=lib_dirs,
define_macros=macros,
)
extensions.append(ext)
#setup all extensions
ext_modules = cythonize(
extensions,
annotate=annotate,
compiler_directives=directives,
quiet=quiet,
#gdb_debug=True
)
setup(
ext_modules=ext_modules,
)
os.environ["PATH"] = old_path