-
Notifications
You must be signed in to change notification settings - Fork 6
/
setup.py
131 lines (123 loc) · 2.99 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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
"""
Copyright(C) 2023-2024 Wojciech Graj
Copyright(C) 2024 Lena Bertho
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
"""
import sys
from typing import Union
import numpy
from Cython.Build import cythonize
from setuptools import Extension, setup
doom_src = (
"am_map.c",
"d_event.c",
"d_items.c",
"d_iwad.c",
"d_loop.c",
"d_main.c",
"d_mode.c",
"d_net.c",
"doomdef.c",
"doomgeneric.c",
"doomstat.c",
"dstrings.c",
"dummy.c",
"f_finale.c",
"f_wipe.c",
"g_game.c",
"hu_lib.c",
"hu_stuff.c",
"i_cdmus.c",
"i_endoom.c",
"i_input.c",
"i_joystick.c",
"i_scale.c",
"i_sound.c",
"i_system.c",
"i_timer.c",
"i_video.c",
"info.c",
"m_argv.c",
"m_bbox.c",
"m_cheat.c",
"m_config.c",
"m_controls.c",
"m_fixed.c",
"m_menu.c",
"m_misc.c",
"m_random.c",
"memio.c",
"p_ceilng.c",
"p_doors.c",
"p_enemy.c",
"p_floor.c",
"p_inter.c",
"p_lights.c",
"p_map.c",
"p_maputl.c",
"p_mobj.c",
"p_plats.c",
"p_pspr.c",
"p_saveg.c",
"p_setup.c",
"p_sight.c",
"p_spec.c",
"p_switch.c",
"p_telept.c",
"p_tick.c",
"p_user.c",
"r_bsp.c",
"r_data.c",
"r_draw.c",
"r_main.c",
"r_plane.c",
"r_segs.c",
"r_sky.c",
"r_things.c",
"s_sound.c",
"sha1.c",
"sounds.c",
"st_lib.c",
"st_stuff.c",
"statdump.c",
"tables.c",
"v_video.c",
"w_checksum.c",
"w_file.c",
"w_file_stdc.c",
"w_main.c",
"w_wad.c",
"wi_stuff.c",
"z_zone.c",
)
libraries: list[str] = []
define_macros: list[tuple[str, Union[str, None]]] = []
extra_link_args: list[str] = []
if sys.platform == "win32":
libraries.append("user32")
elif sys.platform == "darwin":
define_macros.extend([("NORMALUNIX", None), ("_DEFAULT_SOURCE", None)])
else:
define_macros.extend([("NORMALUNIX", None), ("LINUX", None),
("_DEFAULT_SOURCE", None)])
setup(ext_modules=cythonize([
Extension("cydoomgeneric",
sources=["./cydoomgeneric/cydoomgeneric.pyx"] +
[f"./doomgeneric/{src}" for src in doom_src],
include_dirs=["./doomgeneric",
numpy.get_include()],
define_macros=define_macros,
extra_link_args=extra_link_args,
libraries=libraries),
],
build_dir="build",
language_level=3),
package_data={"cydoomgeneric": ["py.typed", "__init__.pyi"]},
packages=["cydoomgeneric"])