-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathsetup.py
More file actions
93 lines (83 loc) · 2.44 KB
/
setup.py
File metadata and controls
93 lines (83 loc) · 2.44 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
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
import os
from setuptools import setup, Extension
from setuptools.command.build_ext import build_ext
from wheel.bdist_wheel import bdist_wheel
cmp_core_sources = [
os.path.join("dds/dep/cmp_core/shaders", x)
for x in [
"bc1_encode_kernel.cpp",
"bc2_encode_kernel.cpp",
"bc3_encode_kernel.cpp",
"bc4_encode_kernel.cpp",
"bc5_encode_kernel.cpp",
"bc6_encode_kernel.cpp",
"bc7_encode_kernel.cpp",
]
]
dds_sources = [
os.path.join("dds/", x)
for x in [
"gli_format_names.cpp",
"process_image.cpp",
]
]
include_dirs = [
"dds",
"dds/dep/cmp_core/shaders",
"dds/dep/cmp_core/source",
"dds/dep/fmt/include",
"dds/dep/gli",
"dds/dep/gli/external",
"dds/dep/gsl/include",
]
ext_modules = [
Extension(
"dds_sys",
sources=["dds/dds_bindings.cpp"] + cmp_core_sources + dds_sources,
define_macros=[
("FMT_HEADER_ONLY", "1"),
('Py_LIMITED_API', 0x03080000),
],
include_dirs=include_dirs,
py_limited_api=True,
),
]
class bdist_wheel_abi3(bdist_wheel):
def get_tag(self):
python, abi, plat = super().get_tag()
if python.startswith("cp"):
# on CPython, our wheels are abi3 and compatible back to 3.8
return "cp38", "abi3", plat
return python, abi, plat
from pathlib import Path
long_description = (Path(__file__).parent / "README.md").read_text()
class build_ext_cxx17(build_ext):
def build_extensions(self):
c = self.compiler.compiler_type
if c == 'msvc':
for e in self.extensions:
e.extra_compile_args = ['/std:c++latest']
else:
for e in self.extensions:
e.extra_compile_args = ['-std=c++17']
build_ext.build_extensions(self)
setup(
name="pydds",
version="0.0.8",
description="DDS (including BC7) decompression bindings",
long_description=long_description,
long_description_content_type="text/markdown",
classifiers=[
"Development Status :: 3 - Alpha",
"License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)",
"Natural Language :: English",
"Programming Language :: Python :: 3 :: Only",
],
cmdclass={
"bdist_wheel": bdist_wheel_abi3,
"build_ext": build_ext_cxx17,
},
packages=["dds"],
ext_modules=ext_modules,
install_requires=["Pillow"]
)