-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy path_msbuild.py
63 lines (56 loc) · 1.65 KB
/
_msbuild.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
from os import getenv
from pathlib import Path
from pymsbuild import *
from pymsbuild.cython import *
METADATA = {
"Metadata-Version": "2.1",
"Name": "obs-python",
"Version": "1.0.0",
"Author": "Steve Dower",
"Author-email": "[email protected]",
"Description": File("README.md"),
"Description-Content-Type": "text/markdown",
"Classifier": [
"Development Status :: 3 - Alpha",
"Programming Language :: Python :: 3.6",
],
}
OBS_INCLUDE = Path(getenv("OBS_SOURCE")) / "libobs"
CL_COMPILE = ItemDefinition(
"ClCompile",
AdditionalIncludeDirectories=ConditionalValue(f"{OBS_INCLUDE};", prepend=True)
)
PXD_INCLUDE = Path.cwd() / "src/obs"
PYX_COMPILE = ItemDefinition(
"PyxCompile",
IncludeDirs=ConditionalValue(f"{PXD_INCLUDE};", prepend=True)
)
LIBS = Path.cwd() / "deps/obs"
LINK = ItemDefinition(
"Link",
AdditionalDependencies=ConditionalValue("obs.lib;", prepend=True),
AdditionalLibraryDirectories=ConditionalValue(str(LIBS) + ";", prepend=True)
)
PACKAGE = Package(
"obs",
PyFile(r"obs\*.py"),
CythonPydFile(
"_helper",
CL_COMPILE,
PYX_COMPILE,
LINK,
CythonIncludeFile(r"obs\_obs.pxd"),
PyxFile(r"obs\_helper.pyx"),
),
source="src",
)
def init_PACKAGE(wheel_tag=None):
ext = {
"py36-cp36-win_amd64": ".cp36-win_amd64.pyd",
"py37-cp37-win_amd64": ".cp37-win_amd64.pyd",
"py38-cp38-win_amd64": ".cp38-win_amd64.pyd",
"py39-cp39-win_amd64": ".cp39-win_amd64.pyd",
}.get(wheel_tag, ".pyd")
for p in PACKAGE:
if isinstance(p, PydFile):
p.options["TargetExt"] = ext