-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprepareBuildFiles.py
More file actions
130 lines (114 loc) · 3.23 KB
/
prepareBuildFiles.py
File metadata and controls
130 lines (114 loc) · 3.23 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
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
#!/usr/bin/env python
# coding: utf-8
# Runs great on Python 3.13.15 (x64)
import os
import json
from datetime import datetime
import errno
import typing
template = """\
pushd %%~dp0
(
cmake.exe ^
-G "%(generatorName)s" ^
-A "%(arch)s" ^
-T %(toolSetName)s ^
-D PGVER=%(PGVER)s ^
-D CPU=%(CPU)s ^
-D CMAKE_GENERATOR_INSTANCE="%(CMAKE_GENERATOR_INSTANCE)s" ^
..
) && (
msbuild pg_bigm.sln /p:Configuration=Release
) || (
pause
)
popd
"""
def makeDirs(path):
try:
os.makedirs(path)
except OSError as e:
if e.errno != errno.EEXIST:
raise
def writeTextFile(path, body):
print("Writing %s" % (path,))
f = open(path, "w")
f.write(body)
f.close()
buildAll = []
packer = []
combinations = (
("PG96", "9.6", "x86"),
("PG96", "9.6", "x64"),
("PG100", "10.0", "x86"),
("PG100", "10.0", "x64"),
("PG110", "11.0", "x64"),
("PG120", "12.0", "x64"),
("PG130", "13.0", "x64"),
("PG140", "14.0", "x64"),
("PG150", "15.0", "x64"),
("PG160", "16.0", "x64"),
("PG170", "17.0", "x64"),
("PG180", "18.0", "x64"),
)
for PGVER, PGVERDIR, CPU in combinations:
for toolSetName in ("v143",):
buildDir = "%s_%s_%s" % (PGVER, CPU, toolSetName)
makeDirs(buildDir)
batFilePath = "%s/build.cmd" % (buildDir,)
dict = {
"generatorName": "Visual Studio 17 2022",
"toolSetName": toolSetName,
"PGVER": PGVER,
"CPU": CPU,
"CMAKE_GENERATOR_INSTANCE": "H:/Program Files/Microsoft Visual Studio/2022/Professional",
"arch": "x64" if CPU == "x64" else "Win32",
}
writeTextFile(batFilePath, template % dict)
buildAll.append("call %s" % (batFilePath,))
packDir = "pack/pg_bigm-postgresql-%s-%s" % (PGVERDIR, CPU)
releaseDir = ((CPU == "x64") and "%s/Release" or "%s/Release") % (buildDir,)
packer.append(
{
"task": "copy",
"param": {
"from": "%s/pg_bigm.dll" % (releaseDir,),
"to": "%s/lib/" % (packDir,),
},
}
)
packer.append(
{
"task": "copy",
"param": {
"from": "pg_bigm.control",
"to": "%s/share/extension/" % (packDir,),
},
}
)
for simpleCopy in [
"pg_bigm--1.0--1.1.sql",
"pg_bigm--1.1--1.2.sql",
"pg_bigm--1.2.sql",
]:
packer.append(
{
"task": "copy",
"param": {
"from": simpleCopy,
"to": "%s/share/extension/%s" % (packDir, simpleCopy),
},
}
)
writeTextFile("buildAll.cmd", "\n".join(buildAll) + "\n")
packer.append(
{
"task": "7z",
"param": {
"rawFrom": "*",
"to": datetime.now().strftime("packs/%Y%m%d.7z"),
"wd": "pack",
},
}
)
writeTextFile("packer.json", json.dumps(packer, indent=2))