Compare commits
555 Commits
appveyor-c
...
master
| Author | SHA1 | Date |
|---|---|---|
|
|
46a7659136 | 3 months ago |
|
|
13f82984cc | 4 months ago |
|
|
67cad39cb8 | 4 months ago |
|
|
ca5328a1b8 | 4 months ago |
|
|
f8a3130d73 | 4 months ago |
|
|
483ef745e4 | 4 months ago |
|
|
031ead4d99 | 4 months ago |
|
|
17023550a6 | 4 months ago |
|
|
8d58df3ab1 | 4 months ago |
|
|
1cc3ea8555 | 4 months ago |
|
|
65f7f24dd4 | 4 months ago |
|
|
e5d3a6e5b0 | 4 months ago |
|
|
c1a0c534ca | 4 months ago |
|
|
0fd2ceac52 | 4 months ago |
|
|
946e9da65c | 4 months ago |
|
|
d631ed9781 | 4 months ago |
|
|
9fcc660494 | 4 months ago |
|
|
ad3dda094e | 4 months ago |
|
|
3b5df0d8ae | 4 months ago |
|
|
8893c1c057 | 4 months ago |
|
|
a4e35fdfb4 | 4 months ago |
|
|
96d6019c5b | 6 months ago |
|
|
e7a382c577 | 7 months ago |
|
|
7e60232ea9 | 8 months ago |
|
|
72919da715 | 8 months ago |
|
|
27a5c99a1c | 8 months ago |
|
|
439945ce1f | 12 months ago |
|
|
efb296029e | 12 months ago |
|
|
45811bb52e | 1 year ago |
|
|
6dc0946ce4 | 1 year ago |
|
|
55b899d151 | 1 year ago |
|
|
f0505b4bec | 1 year ago |
|
|
9b150d60f8 | 1 year ago |
|
|
6649b6c3f3 | 1 year ago |
|
|
a2bc076ef0 | 1 year ago |
|
|
4ae645c54b | 1 year ago |
|
|
4a0891ad25 | 1 year ago |
|
|
9daa41724a | 1 year ago |
|
|
78af75ad5a | 1 year ago |
|
|
851219059f | 1 year ago |
|
|
4731ecd063 | 1 year ago |
|
|
960910e8cb | 1 year ago |
|
|
1794cd6027 | 1 year ago |
|
|
7f581c6114 | 1 year ago |
|
|
86fcf4d85f | 1 year ago |
|
|
bcf0117f97 | 1 year ago |
|
|
fcb49770eb | 1 year ago |
|
|
d011297c13 | 1 year ago |
|
|
ee2f65e792 | 1 year ago |
|
|
c8824470c9 | 1 year ago |
|
|
20700b7e3d | 1 year ago |
|
|
81a2683672 | 1 year ago |
|
|
a7e6ae9493 | 1 year ago |
|
|
2bcc7b94d3 | 1 year ago |
|
|
3d49fdf91f | 1 year ago |
|
|
585b4b7cf7 | 1 year ago |
|
|
8ebe5e074f | 1 year ago |
|
|
37ddbf7598 | 1 year ago |
|
|
92d06e9e6b | 2 years ago |
|
|
bed89fdd61 | 2 years ago |
|
|
d5ffa81fe2 | 2 years ago |
|
|
c45eb57d34 | 2 years ago |
|
|
1c80a7a6f2 | 2 years ago |
|
|
a5af8ba355 | 2 years ago |
|
|
9b683b1441 | 2 years ago |
|
|
2ec062c48f | 2 years ago |
|
|
9937209f49 | 2 years ago |
|
|
fbd8786777 | 2 years ago |
|
|
5f4da68f53 | 2 years ago |
|
|
3d8066afec | 2 years ago |
|
|
b0d714344a | 2 years ago |
|
|
1f5a8494d4 | 2 years ago |
|
|
bce2c33a48 | 2 years ago |
|
|
e9c412c46e | 2 years ago |
|
|
11b46bb5ca | 2 years ago |
|
|
6bb1ff775a | 2 years ago |
|
|
d14bb02cd1 | 2 years ago |
|
|
57fc62f121 | 2 years ago |
|
|
23e5f80725 | 2 years ago |
|
|
a49d4e1748 | 2 years ago |
|
|
2202693dc1 | 2 years ago |
|
|
ecfd7302dc | 2 years ago |
|
|
3b545dc181 | 2 years ago |
|
|
2be5398209 | 2 years ago |
|
|
40827a621f | 2 years ago |
|
|
49d489382b | 2 years ago |
|
|
41f488c7b2 | 2 years ago |
|
|
55102734ca | 2 years ago |
|
|
7e9acb06f2 | 2 years ago |
|
|
3218db2e2e | 2 years ago |
|
|
b0df197b57 | 2 years ago |
|
|
335bbfc191 | 2 years ago |
|
|
ded83398ea | 2 years ago |
|
|
58e16bfb3f | 2 years ago |
|
|
45af353340 | 2 years ago |
|
|
a775640b02 | 2 years ago |
|
|
16cd0ebead | 2 years ago |
|
|
40150b7955 | 2 years ago |
|
|
c5eb940ccf | 2 years ago |
|
|
c46d21249b | 2 years ago |
|
|
806a0e46a0 | 2 years ago |
|
|
40f9048adf | 2 years ago |
|
|
c2284590e2 | 2 years ago |
|
|
dcbfb28c05 | 2 years ago |
|
|
d38210add7 | 2 years ago |
|
|
eb32900b4b | 2 years ago |
|
|
af00836cf3 | 2 years ago |
|
|
cade85c94f | 2 years ago |
|
|
c968b91a41 | 2 years ago |
|
|
37b58362a1 | 2 years ago |
|
|
3f7371013d | 2 years ago |
|
|
63cea4187e | 2 years ago |
|
|
6381b86fac | 2 years ago |
|
|
78897dddf7 | 2 years ago |
|
|
49ac964c49 | 2 years ago |
|
|
67d78789cd | 2 years ago |
|
|
d719871b33 | 2 years ago |
|
|
1f830e6bad | 2 years ago |
|
|
51b65af126 | 2 years ago |
|
|
e5e7824b96 | 2 years ago |
|
|
b4d437bb3f | 2 years ago |
|
|
37b0229680 | 2 years ago |
|
|
3d9d210f5f | 2 years ago |
|
|
d679bfdb2d | 2 years ago |
|
|
61d18ec10e | 2 years ago |
|
|
6a1f1b772a | 2 years ago |
|
|
21b643e87f | 2 years ago |
|
|
7f161b3cf4 | 2 years ago |
|
|
8b0dc8ca67 | 2 years ago |
|
|
7a35f405b4 | 2 years ago |
|
|
daa78626fe | 2 years ago |
|
|
6330b6cc19 | 2 years ago |
|
|
1303032829 | 3 years ago |
|
|
619b8a51bf | 3 years ago |
|
|
f561337caa | 3 years ago |
|
|
08ff96da0b | 3 years ago |
|
|
6212e36fda | 3 years ago |
|
|
11060aa30f | 3 years ago |
|
|
25849d3e27 | 3 years ago |
|
|
eee7bf002b | 3 years ago |
|
|
a9174def9b | 3 years ago |
|
|
8ca1c30187 | 3 years ago |
|
|
1e0559bc0b | 3 years ago |
|
|
ecb6351497 | 3 years ago |
|
|
561b8ca901 | 3 years ago |
|
|
f26cfcde2e | 3 years ago |
|
|
26749e56dc | 3 years ago |
|
|
ff32ae2824 | 3 years ago |
|
|
93f9eb814b | 3 years ago |
|
|
a81071eae4 | 3 years ago |
|
|
74767f4db4 | 3 years ago |
|
|
cec30658ed | 3 years ago |
|
|
2b09a43f99 | 3 years ago |
|
|
46d6777315 | 3 years ago |
|
|
9950b9fca4 | 3 years ago |
|
|
305fdf81ee | 3 years ago |
|
|
0a2488d474 | 3 years ago |
|
|
12230c93b8 | 3 years ago |
|
|
85e8fae9b8 | 3 years ago |
|
|
c9515bbd1d | 3 years ago |
|
|
f9473638fc | 3 years ago |
|
|
f9d1fdecf3 | 3 years ago |
|
|
6d473cf2aa | 3 years ago |
|
|
7c78ee34a0 | 3 years ago |
|
|
6d8ab441e8 | 3 years ago |
|
|
5747d58049 | 3 years ago |
|
|
f7c026fbd3 | 3 years ago |
|
|
d1a7a7c6c8 | 3 years ago |
|
|
0858c844e8 | 3 years ago |
|
|
229ec2cb18 | 3 years ago |
|
|
cfaa484147 | 3 years ago |
|
|
738c3f8d38 | 3 years ago |
|
|
05fad9ccdd | 3 years ago |
|
|
8d9d7d3230 | 3 years ago |
|
|
561ba51805 | 3 years ago |
|
|
3b799fcad9 | 3 years ago |
|
|
f83c2cb1aa | 3 years ago |
|
|
b3517b0411 | 3 years ago |
|
|
4be2d4d9c0 | 3 years ago |
|
|
d8b98c2057 | 3 years ago |
|
|
8dec36ff3d | 3 years ago |
|
|
2373d2dc9e | 3 years ago |
|
|
104c337f10 | 3 years ago |
|
|
d6fec89dc5 | 3 years ago |
|
|
b5557a94cd | 3 years ago |
|
|
b78d809d10 | 3 years ago |
|
|
949820b01a | 3 years ago |
|
|
ee284aa4aa | 3 years ago |
|
|
8ee4ed882c | 3 years ago |
|
|
007fe23731 | 3 years ago |
|
|
0091fc97d4 | 3 years ago |
|
|
94d26a25e5 | 3 years ago |
|
|
fc716799b8 | 3 years ago |
|
|
4fe21deaaf | 3 years ago |
|
|
16cb94a338 | 3 years ago |
|
|
69f859a579 | 3 years ago |
|
|
b70001f6c0 | 3 years ago |
|
|
ba1c92d7f0 | 3 years ago |
|
|
6298ca29fd | 3 years ago |
|
|
8b30876304 | 3 years ago |
|
|
1726086a80 | 3 years ago |
|
|
6a2fe6e677 | 3 years ago |
|
|
57ebae97c5 | 3 years ago |
|
|
557277e995 | 3 years ago |
|
|
bc6b67e2f9 | 3 years ago |
|
|
f30c1c503f | 3 years ago |
|
|
13c5ad1ea6 | 3 years ago |
|
|
0eabbebbae | 3 years ago |
|
|
54828bebca | 3 years ago |
|
|
c1f970139b | 3 years ago |
|
|
bb77c2f25f | 3 years ago |
|
|
8aa953c5f0 | 3 years ago |
|
|
938b551f07 | 3 years ago |
|
|
38896feb66 | 3 years ago |
|
|
513fbc547d | 3 years ago |
|
|
55d5445ebf | 3 years ago |
|
|
badc94c122 | 3 years ago |
|
|
6b94109f9f | 3 years ago |
|
|
52fe802932 | 3 years ago |
|
|
e2642033b3 | 3 years ago |
|
|
d508fd9c04 | 3 years ago |
|
|
e319f098eb | 3 years ago |
|
|
d29c5554d8 | 3 years ago |
|
|
cdfd79571f | 3 years ago |
|
|
f12aabf788 | 3 years ago |
|
|
2a2fa675b7 | 3 years ago |
|
|
7de13ef7cb | 3 years ago |
|
|
cf44cba1fb | 3 years ago |
|
|
58a163adf7 | 3 years ago |
|
|
1f75e4ea71 | 3 years ago |
|
|
2fb45a91f9 | 3 years ago |
|
|
e78092a18e | 3 years ago |
|
|
45a48f6c0b | 3 years ago |
|
|
7ad200c03a | 3 years ago |
|
|
d660155a0a | 3 years ago |
|
|
aadd07dad6 | 3 years ago |
|
|
157c883be4 | 3 years ago |
|
|
12dbfc56c8 | 3 years ago |
|
|
c83c1fcc4f | 3 years ago |
|
|
52d290a491 | 3 years ago |
|
|
2696ac6ba7 | 3 years ago |
|
|
1752e61f9b | 3 years ago |
|
|
c0b155763e | 3 years ago |
|
|
d51b45e2bb | 3 years ago |
|
|
e59f8445f8 | 3 years ago |
|
|
89fa0d3f93 | 3 years ago |
|
|
d62b44e3cd | 3 years ago |
|
|
c07952fc18 | 3 years ago |
|
|
173a01f1b6 | 3 years ago |
|
|
5820b9da60 | 3 years ago |
|
|
21fb02ff65 | 3 years ago |
|
|
15a06c82c1 | 3 years ago |
|
|
bbd7ccedb1 | 3 years ago |
|
|
744bffada6 | 3 years ago |
|
|
9c1e4c7add | 3 years ago |
|
|
551fd567f9 | 3 years ago |
|
|
165416f73b | 3 years ago |
|
|
526def5f45 | 3 years ago |
|
|
d20727c995 | 3 years ago |
|
|
47f4353f69 | 3 years ago |
|
|
f59d8bb9b6 | 3 years ago |
|
|
8ccd378870 | 3 years ago |
|
|
47226d22f6 | 3 years ago |
|
|
ee56f6f114 | 3 years ago |
|
|
c0c78d83f5 | 3 years ago |
|
|
b811592407 | 3 years ago |
|
|
d95c60942b | 3 years ago |
|
|
d75f31e854 | 3 years ago |
|
|
dddef56c87 | 3 years ago |
|
|
a45fbb84da | 3 years ago |
|
|
b3e24a11b4 | 3 years ago |
|
|
5edd1a49f6 | 3 years ago |
|
|
c78cc3fd13 | 3 years ago |
|
|
28497ec2ca | 3 years ago |
|
|
56dd4b4a36 | 3 years ago |
|
|
d106fc09d7 | 3 years ago |
|
|
211bd5f0a8 | 3 years ago |
|
|
cca2eaf659 | 3 years ago |
|
|
ae5741e4d0 | 3 years ago |
|
|
27983b66ba | 3 years ago |
|
|
a3f88d4db4 | 3 years ago |
|
|
eb334e1d7f | 3 years ago |
|
|
7ee0c7d949 | 3 years ago |
|
|
a1e49aa8f2 | 3 years ago |
|
|
2bc0748c05 | 3 years ago |
|
|
695c40b2d1 | 3 years ago |
|
|
71880c743d | 3 years ago |
|
|
f6d4385a44 | 3 years ago |
|
|
99a22dfcd5 | 4 years ago |
|
|
2e2cea6a68 | 4 years ago |
|
|
6d02603090 | 4 years ago |
|
|
7009d66d18 | 4 years ago |
|
|
9bce5cfea7 | 4 years ago |
|
|
50c7f1294a | 4 years ago |
|
|
585d136777 | 4 years ago |
|
|
0f1b6e11ab | 4 years ago |
|
|
7a47c41eb7 | 4 years ago |
|
|
75be40300b | 4 years ago |
|
|
734072bee3 | 4 years ago |
|
|
b983d29acf | 4 years ago |
|
|
7bd8bd965b | 4 years ago |
|
|
12950365e3 | 4 years ago |
|
|
58cb836bb7 | 4 years ago |
|
|
661f9fa451 | 4 years ago |
|
|
bce7509e87 | 4 years ago |
|
|
c4105cb052 | 4 years ago |
|
|
ddaf12757f | 4 years ago |
|
|
9e8b846418 | 4 years ago |
|
|
c72d7146b5 | 4 years ago |
|
|
41e3da6fb2 | 4 years ago |
|
|
f22d3777d5 | 4 years ago |
|
|
732a0b795a | 4 years ago |
|
|
48b0015782 | 4 years ago |
|
|
83a4ba0390 | 4 years ago |
|
|
1d662bcd48 | 4 years ago |
|
|
3ce8b6d96e | 4 years ago |
|
|
e4457383c6 | 4 years ago |
|
|
7362ff92dc | 4 years ago |
|
|
66bb4451df | 4 years ago |
|
|
403689f3bf | 4 years ago |
|
|
f4b5d915d9 | 4 years ago |
|
|
9b60dd30b0 | 4 years ago |
|
|
c2499fea34 | 4 years ago |
|
|
137211b2b2 | 4 years ago |
|
|
1ce696203e | 4 years ago |
|
|
ecd1e9544f | 4 years ago |
|
|
e6fdfd7d8e | 4 years ago |
|
|
6a161d5044 | 4 years ago |
|
|
020e1966ab | 4 years ago |
|
|
716869599b | 4 years ago |
|
|
04c1f712ed | 4 years ago |
|
|
62a07c38bc | 4 years ago |
|
|
36b6c4465b | 4 years ago |
|
|
704c904d6a | 4 years ago |
|
|
5fd2033103 | 4 years ago |
|
|
737ec6c415 | 4 years ago |
|
|
d476d63bca | 4 years ago |
|
|
c859405c6a | 4 years ago |
|
|
0a32aa0ed7 | 4 years ago |
|
|
09e5e90426 | 4 years ago |
|
|
ddfc5ccc36 | 4 years ago |
|
|
24f2242842 | 4 years ago |
|
|
ca5e16f658 | 4 years ago |
|
|
0510bdf353 | 4 years ago |
|
|
9d916eeae6 | 4 years ago |
|
|
a79bc39f3e | 4 years ago |
|
|
831631e10e | 4 years ago |
|
|
ea4e353231 | 4 years ago |
|
|
c2e2a8e520 | 4 years ago |
|
|
da21863ac7 | 4 years ago |
|
|
fda9e34b9d | 4 years ago |
|
|
a325f3d0c1 | 4 years ago |
|
|
8e8a03e175 | 4 years ago |
|
|
b58b53bfda | 4 years ago |
|
|
d2f5ea43d5 | 4 years ago |
|
|
5ea50ee86e | 4 years ago |
|
|
4fe9d385dc | 4 years ago |
|
|
ca4a35e78c | 4 years ago |
|
|
2295f43873 | 4 years ago |
|
|
ae23365869 | 4 years ago |
|
|
f18acb6af6 | 4 years ago |
|
|
0eade80567 | 4 years ago |
|
|
43d7e10f2d | 4 years ago |
|
|
2b8b67addc | 4 years ago |
|
|
281c18fdeb | 4 years ago |
|
|
e35de34fee | 4 years ago |
|
|
8938a29f67 | 4 years ago |
|
|
9bc5840926 | 4 years ago |
|
|
79009b7d21 | 4 years ago |
|
|
7dc03d59aa | 4 years ago |
|
|
0e84055b49 | 4 years ago |
|
|
6f260b05cd | 4 years ago |
|
|
1dd625a420 | 4 years ago |
|
|
60c48b63f7 | 4 years ago |
|
|
75a0564cc3 | 4 years ago |
|
|
71d2cf0d95 | 4 years ago |
|
|
0120b3f768 | 4 years ago |
|
|
831ab24e49 | 4 years ago |
|
|
fa55f1df54 | 4 years ago |
|
|
a2bbcf54aa | 4 years ago |
|
|
03cbaf5f19 | 4 years ago |
|
|
24921c7409 | 4 years ago |
|
|
32fe5ead80 | 4 years ago |
|
|
5994150a68 | 5 years ago |
|
|
2a528e23bf | 5 years ago |
|
|
6be3566e9b | 5 years ago |
|
|
40ba765fad | 5 years ago |
|
|
dda78038be | 5 years ago |
|
|
c50a2f6851 | 5 years ago |
|
|
4d5a9ed456 | 5 years ago |
|
|
18ea028c8a | 5 years ago |
|
|
8f733ca8db | 5 years ago |
|
|
48b94ffd19 | 5 years ago |
|
|
d66b581e73 | 5 years ago |
|
|
1417d59b6c | 5 years ago |
|
|
9f08717e77 | 5 years ago |
|
|
c7897429af | 5 years ago |
|
|
7ede64e7d4 | 5 years ago |
|
|
5c2cad1461 | 5 years ago |
|
|
dfb44e98ca | 5 years ago |
|
|
31785426d8 | 5 years ago |
|
|
a42018d075 | 5 years ago |
|
|
7f86477c3e | 5 years ago |
|
|
2fec9c1e5e | 5 years ago |
|
|
aadc437b25 | 5 years ago |
|
|
431074a776 | 5 years ago |
|
|
0bf27c07f2 | 5 years ago |
|
|
8e00226da3 | 5 years ago |
|
|
ba4e20006a | 5 years ago |
|
|
98a3dcf59c | 5 years ago |
|
|
805a781f0a | 5 years ago |
|
|
cbb5358efd | 5 years ago |
|
|
a2d16c15f8 | 5 years ago |
|
|
c51928c07e | 5 years ago |
|
|
84f9bb2a9d | 5 years ago |
|
|
ac8491a619 | 5 years ago |
|
|
b63ae43f1e | 5 years ago |
|
|
3a82b18566 | 5 years ago |
|
|
32b4c3dcff | 5 years ago |
|
|
177ea859d8 | 5 years ago |
|
|
e64a27e156 | 5 years ago |
|
|
2b7a1af397 | 5 years ago |
|
|
05e0bb764a | 5 years ago |
|
|
52f2073ff9 | 5 years ago |
|
|
5dad3bb8af | 5 years ago |
|
|
c6699187cb | 5 years ago |
|
|
fa81020de7 | 5 years ago |
|
|
372c5e0065 | 6 years ago |
|
|
15bee01a04 | 6 years ago |
|
|
41b720e44c | 6 years ago |
|
|
4bb19e0b3f | 6 years ago |
|
|
57db13422f | 6 years ago |
|
|
b83e12a8fd | 6 years ago |
|
|
0f98d2f172 | 6 years ago |
|
|
bbb2d0a395 | 6 years ago |
|
|
5594a64c2a | 6 years ago |
|
|
4cb109f592 | 6 years ago |
|
|
615551a390 | 6 years ago |
|
|
be5ffdd916 | 6 years ago |
|
|
fe559e69bd | 6 years ago |
|
|
11075a4adf | 6 years ago |
|
|
799629e410 | 6 years ago |
|
|
ea4c792d26 | 6 years ago |
|
|
66681d4dee | 6 years ago |
|
|
579107365d | 6 years ago |
|
|
dffa0fa7f8 | 6 years ago |
|
|
1d278d1112 | 6 years ago |
|
|
24b18aff93 | 6 years ago |
|
|
661e8243cd | 6 years ago |
|
|
2df41d3afe | 6 years ago |
|
|
9b0e7bcf3e | 6 years ago |
|
|
01d0abb9fc | 6 years ago |
|
|
267f7c36d9 | 6 years ago |
|
|
f5d78009a2 | 6 years ago |
|
|
f2cba9cb57 | 6 years ago |
|
|
e7b5708ca9 | 6 years ago |
|
|
3d519d6c19 | 6 years ago |
|
|
fe7e6eb545 | 6 years ago |
|
|
b1d45fc85a | 6 years ago |
|
|
1a7efcac4c | 6 years ago |
|
|
5950f00f01 | 6 years ago |
|
|
8de3e91ce3 | 6 years ago |
|
|
a611455034 | 6 years ago |
|
|
86bac39471 | 6 years ago |
|
|
e222ba7a32 | 6 years ago |
|
|
a3f6b2cce0 | 6 years ago |
|
|
7aef7bd4c8 | 6 years ago |
|
|
500311fa7c | 6 years ago |
|
|
de204f778b | 6 years ago |
|
|
38d56059e2 | 6 years ago |
|
|
70e7ab94c8 | 6 years ago |
|
|
2045e22463 | 6 years ago |
|
|
d2dc71369c | 6 years ago |
|
|
d3ecefcfac | 6 years ago |
|
|
a470eae5f1 | 6 years ago |
|
|
45eb76446b | 6 years ago |
|
|
b2f92b9d6e | 6 years ago |
|
|
5d7e5c5b1c | 6 years ago |
|
|
15d0714d90 | 6 years ago |
|
|
2cbe09c1f7 | 6 years ago |
|
|
c560b8085a | 6 years ago |
|
|
3a0c478834 | 6 years ago |
|
|
1aefd45f2c | 6 years ago |
|
|
0d9c5687dd | 6 years ago |
|
|
97062bcc04 | 7 years ago |
|
|
9131edff97 | 7 years ago |
|
|
016f5954e3 | 7 years ago |
|
|
3b72f10211 | 7 years ago |
|
|
396e48bf4d | 7 years ago |
|
|
19cb8f41b3 | 7 years ago |
|
|
7f6a1f1529 | 7 years ago |
|
|
875a81803b | 7 years ago |
|
|
7068412b7c | 7 years ago |
|
|
41609aceef | 7 years ago |
|
|
e334cc17b2 | 7 years ago |
|
|
70fe4e8a25 | 7 years ago |
|
|
d67a1d27ed | 7 years ago |
|
|
65d8e47cbe | 7 years ago |
|
|
d2bec5eba7 | 7 years ago |
|
|
8700217943 | 7 years ago |
|
|
106ca8f314 | 7 years ago |
|
|
027492966d | 7 years ago |
|
|
a6dd10ae69 | 7 years ago |
|
|
34ca50dca8 | 7 years ago |
|
|
d5bbd193f3 | 7 years ago |
|
|
6bce9fbeb2 | 7 years ago |
|
|
2cbb083f0a | 7 years ago |
|
|
6ca302befc | 7 years ago |
|
|
59a2773808 | 7 years ago |
|
|
9afe7ebe50 | 7 years ago |
|
|
f20c5beb76 | 7 years ago |
|
|
ee54dc6cdc | 7 years ago |
|
|
7da09f9080 | 7 years ago |
|
|
f8f0f3f1b7 | 7 years ago |
|
|
e07e61c1ef | 7 years ago |
|
|
c21972efb6 | 7 years ago |
|
|
432d424a77 | 7 years ago |
|
|
2eebb45557 | 7 years ago |
|
|
e18fbdbb16 | 7 years ago |
|
|
6dd3e2fd6d | 7 years ago |
|
|
859309b07c | 7 years ago |
|
|
483ffb4453 | 7 years ago |
|
|
843160f58a | 7 years ago |
|
|
3f0aa76c28 | 7 years ago |
|
|
313e74142c | 7 years ago |
|
|
02fc8900b9 | 7 years ago |
|
|
40891858d6 | 7 years ago |
|
|
006987fa45 | 7 years ago |
|
|
563f5222b5 | 7 years ago |
|
|
7f82f76eba | 7 years ago |
|
|
033e0c17bc | 7 years ago |
|
|
3c9643ce74 | 7 years ago |
|
|
1083e2d6aa | 7 years ago |
|
|
fdf5671c4c | 7 years ago |
|
|
79ac50e11a | 7 years ago |
|
|
bbbda61f6e | 7 years ago |
|
|
d818e40698 | 7 years ago |
|
|
d6f1c50c34 | 7 years ago |
|
|
30d7b0796c | 7 years ago |
|
|
9b652f6213 | 7 years ago |
|
|
5947b76df9 | 7 years ago |
|
|
0c9cd88fd3 | 7 years ago |
|
|
9faed0651e | 7 years ago |
|
|
857062e152 | 7 years ago |
|
|
f9851bdb1e | 7 years ago |
|
|
c8e99ca086 | 7 years ago |
|
|
14f7810870 | 7 years ago |
|
|
d50b79d698 | 7 years ago |
|
|
128c2aa0af | 7 years ago |
|
|
3ae0c3fbf2 | 7 years ago |
|
|
e105109981 | 7 years ago |
|
|
73087f3b3f | 7 years ago |
|
|
b84f88e189 | 7 years ago |
|
|
9a7c167e73 | 7 years ago |
|
|
3ceb292c15 | 7 years ago |
179 changed files with 29249 additions and 3046 deletions
@ -0,0 +1,40 @@ |
|||||||
|
.. |
||||||
|
This file is part of Magnum. |
||||||
|
|
||||||
|
Copyright © 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, |
||||||
|
2020, 2021, 2022, 2023, 2024, 2025, 2026 |
||||||
|
Vladimír Vondruš <mosra@centrum.cz> |
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a |
||||||
|
copy of this software and associated documentation files (the "Software"), |
||||||
|
to deal in the Software without restriction, including without limitation |
||||||
|
the rights to use, copy, modify, merge, publish, distribute, sublicense, |
||||||
|
and/or sell copies of the Software, and to permit persons to whom the |
||||||
|
Software is furnished to do so, subject to the following conditions: |
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included |
||||||
|
in all copies or substantial portions of the Software. |
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
||||||
|
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
||||||
|
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
||||||
|
DEALINGS IN THE SOFTWARE. |
||||||
|
.. |
||||||
|
|
||||||
|
.. py:class:: corrade.pluginmanager.AbstractManager |
||||||
|
:data VERSION: Plugin ABI version |
||||||
|
|
||||||
|
.. py:function:: corrade.pluginmanager.AbstractManager.load |
||||||
|
:raise RuntimeError: When loading fails |
||||||
|
:return: :ref:`LoadState.LOADED`, possibly combined with other flags such |
||||||
|
as :ref:`LoadState.STATIC` |
||||||
|
|
||||||
|
.. py:function:: corrade.pluginmanager.AbstractManager.unload |
||||||
|
:raise RuntimeError: When unloading fails |
||||||
|
:return: Either :ref:`LoadState.NOT_LOADED` or :ref:`LoadState.STATIC` |
||||||
|
|
||||||
|
.. py:function:: corrade.pluginmanager.AbstractManager.set_preferred_plugins |
||||||
|
:raise KeyError: If the alias doesn't exist |
||||||
@ -0,0 +1,50 @@ |
|||||||
|
.. |
||||||
|
This file is part of Magnum. |
||||||
|
|
||||||
|
Copyright © 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, |
||||||
|
2020, 2021, 2022, 2023, 2024, 2025, 2026 |
||||||
|
Vladimír Vondruš <mosra@centrum.cz> |
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a |
||||||
|
copy of this software and associated documentation files (the "Software"), |
||||||
|
to deal in the Software without restriction, including without limitation |
||||||
|
the rights to use, copy, modify, merge, publish, distribute, sublicense, |
||||||
|
and/or sell copies of the Software, and to permit persons to whom the |
||||||
|
Software is furnished to do so, subject to the following conditions: |
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included |
||||||
|
in all copies or substantial portions of the Software. |
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
||||||
|
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
||||||
|
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
||||||
|
DEALINGS IN THE SOFTWARE. |
||||||
|
.. |
||||||
|
|
||||||
|
.. roles used for all other docs |
||||||
|
|
||||||
|
.. role:: cpp(code) |
||||||
|
:language: c++ |
||||||
|
.. role:: py(code) |
||||||
|
:language: py |
||||||
|
.. role:: sh(code) |
||||||
|
:language: sh |
||||||
|
|
||||||
|
.. doctest setup |
||||||
|
>>> from corrade import * |
||||||
|
|
||||||
|
.. py:module:: corrade |
||||||
|
:data BUILD_DEPRECATED: Build with deprecated features enabled |
||||||
|
:data BUILD_STATIC: Static library build |
||||||
|
:data BUILD_MULTITHREADED: Multi-threaded build |
||||||
|
:data TARGET_UNIX: Unix target |
||||||
|
:data TARGET_APPLE: Apple target |
||||||
|
:data TARGET_IOS: iOS target |
||||||
|
:data TARGET_IOS_SIMULATOR: iOS simulator target |
||||||
|
:data TARGET_WINDOWS: Windows target |
||||||
|
:data TARGET_WINDOWS_RT: Windows RT target |
||||||
|
:data TARGET_EMSCRIPTEN: Emscripten target |
||||||
|
:data TARGET_ANDROID: Android target |
||||||
@ -0,0 +1,37 @@ |
|||||||
|
.. |
||||||
|
This file is part of Magnum. |
||||||
|
|
||||||
|
Copyright © 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, |
||||||
|
2020, 2021, 2022, 2023, 2024, 2025, 2026 |
||||||
|
Vladimír Vondruš <mosra@centrum.cz> |
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a |
||||||
|
copy of this software and associated documentation files (the "Software"), |
||||||
|
to deal in the Software without restriction, including without limitation |
||||||
|
the rights to use, copy, modify, merge, publish, distribute, sublicense, |
||||||
|
and/or sell copies of the Software, and to permit persons to whom the |
||||||
|
Software is furnished to do so, subject to the following conditions: |
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included |
||||||
|
in all copies or substantial portions of the Software. |
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
||||||
|
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
||||||
|
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
||||||
|
DEALINGS IN THE SOFTWARE. |
||||||
|
.. |
||||||
|
|
||||||
|
.. py:function:: corrade.utility.copy |
||||||
|
:raise AssertionError: If :p:`src` and :p:`dst` sizes, type sizes or types are different |
||||||
|
|
||||||
|
.. py:function:: corrade.utility.ConfigurationGroup.group |
||||||
|
:raise KeyError: If group :p:`name` doesn't exist |
||||||
|
|
||||||
|
.. py:function:: corrade.utility.Configuration.__init__(self, filename: str) |
||||||
|
:raise IOError: If :p:`filename` contains a parse error |
||||||
|
|
||||||
|
.. py:function:: corrade.utility.Configuration.save |
||||||
|
:raise IOError: If the file can't be saved |
||||||
@ -0,0 +1,43 @@ |
|||||||
|
.. |
||||||
|
This file is part of Magnum. |
||||||
|
|
||||||
|
Copyright © 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, |
||||||
|
2020, 2021, 2022, 2023, 2024, 2025, 2026 |
||||||
|
Vladimír Vondruš <mosra@centrum.cz> |
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a |
||||||
|
copy of this software and associated documentation files (the "Software"), |
||||||
|
to deal in the Software without restriction, including without limitation |
||||||
|
the rights to use, copy, modify, merge, publish, distribute, sublicense, |
||||||
|
and/or sell copies of the Software, and to permit persons to whom the |
||||||
|
Software is furnished to do so, subject to the following conditions: |
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included |
||||||
|
in all copies or substantial portions of the Software. |
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
||||||
|
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
||||||
|
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
||||||
|
DEALINGS IN THE SOFTWARE. |
||||||
|
.. |
||||||
|
|
||||||
|
.. py:function:: magnum.materialtools.filter_attributes |
||||||
|
:raise AssertionError: If size of :p:`attributes_to_keep` is different than |
||||||
|
:ref:`trade.MaterialData.attribute_data_offset()` for |
||||||
|
:ref:`trade.MaterialData.layer_count` |
||||||
|
.. py:function:: magnum.materialtools.filter_layers |
||||||
|
:raise AssertionError: If size of :p:`layers_to_keep` is different than |
||||||
|
:ref:`trade.MaterialData.layer_count` |
||||||
|
.. py:function:: magnum.materialtools.filter_attributes_layers |
||||||
|
:raise AssertionError: If size of :p:`attributes_to_keep` is different than |
||||||
|
:ref:`trade.MaterialData.attribute_data_offset()` for |
||||||
|
:ref:`trade.MaterialData.layer_count` |
||||||
|
:raise AssertionError: If size of :p:`layers_to_keep` is different than |
||||||
|
:ref:`trade.MaterialData.layer_count` |
||||||
|
.. py:function:: magnum.materialtools.merge |
||||||
|
:raise RuntimeError: If merge failed due to a conflict |
||||||
|
.. py:function:: magnum.materialtools.phong_to_pbr_metallic_roughness |
||||||
|
:raise RuntimeError: If conversion failed |
||||||
@ -0,0 +1,97 @@ |
|||||||
|
.. |
||||||
|
This file is part of Magnum. |
||||||
|
|
||||||
|
Copyright © 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, |
||||||
|
2020, 2021, 2022, 2023, 2024, 2025, 2026 |
||||||
|
Vladimír Vondruš <mosra@centrum.cz> |
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a |
||||||
|
copy of this software and associated documentation files (the "Software"), |
||||||
|
to deal in the Software without restriction, including without limitation |
||||||
|
the rights to use, copy, modify, merge, publish, distribute, sublicense, |
||||||
|
and/or sell copies of the Software, and to permit persons to whom the |
||||||
|
Software is furnished to do so, subject to the following conditions: |
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included |
||||||
|
in all copies or substantial portions of the Software. |
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
||||||
|
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
||||||
|
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
||||||
|
DEALINGS IN THE SOFTWARE. |
||||||
|
.. |
||||||
|
|
||||||
|
.. py:function:: magnum.meshtools.compress_indices |
||||||
|
:raise AssertionError: If :p:`mesh` is not indexed |
||||||
|
|
||||||
|
.. py:function:: magnum.meshtools.concatenate |
||||||
|
:raise AssertionError: If :p:`meshes` is empty |
||||||
|
:raise AssertionError: If any of the :p:`meshes` is |
||||||
|
:ref:`MeshPrimitive.LINE_STRIP`, :ref:`MeshPrimitive.LINE_LOOP`, |
||||||
|
:ref:`MeshPrimitive.TRIANGLE_STRIP` or |
||||||
|
:ref:`MeshPrimitive.TRIANGLE_FAN` |
||||||
|
:raise AssertionError: If all :p:`meshes` don't have the same |
||||||
|
:ref:`MeshPrimitive` |
||||||
|
|
||||||
|
.. py:function:: magnum.meshtools.duplicate |
||||||
|
:raise AssertionError: If :p:`mesh` is not indexed |
||||||
|
|
||||||
|
.. py:function:: magnum.meshtools.filter_attributes |
||||||
|
:raise AssertionError: If size of :p:`attributes_to_keep` is different than |
||||||
|
:p:`mesh` attribute count |
||||||
|
|
||||||
|
.. py:function:: magnum.meshtools.generate_indices |
||||||
|
:raise AssertionError: If :p:`mesh` is not :ref:`MeshPrimitive.LINE_STRIP`, |
||||||
|
:ref:`MeshPrimitive.LINE_LOOP`, :ref:`MeshPrimitive.TRIANGLE_STRIP` or |
||||||
|
:ref:`MeshPrimitive.TRIANGLE_FAN` |
||||||
|
|
||||||
|
.. py:function:: magnum.meshtools.interleave |
||||||
|
:raise AssertionError: If any attribute in :p:`extra` has the data size |
||||||
|
different from :p:`mesh` vertex count |
||||||
|
|
||||||
|
.. py:function:: magnum.meshtools.transform2d |
||||||
|
:raise KeyError: If :p:`mesh` doesn't have |
||||||
|
:ref:`trade.MeshAttribute.POSITION` of index :p:`id` (and in morph |
||||||
|
target :p:`morph_target_id` if not :py:`-1`) |
||||||
|
:raise AssertionError: If :ref:`trade.MeshAttribute.POSITION` are not 2D |
||||||
|
|
||||||
|
.. py:function:: magnum.meshtools.transform2d_in_place |
||||||
|
:raise AssertionError: If :p:`mesh` vertex data aren't |
||||||
|
:ref:`trade.DataFlags.MUTABLE` |
||||||
|
:raise KeyError: If :p:`mesh` doesn't have |
||||||
|
:ref:`trade.MeshAttribute.POSITION` of index :p:`id` (and in morph |
||||||
|
target :p:`morph_target_id` if not :py:`-1`) |
||||||
|
:raise AssertionError: If :ref:`trade.MeshAttribute.POSITION` are not |
||||||
|
:ref:`VertexFormat.VECTOR2` |
||||||
|
|
||||||
|
.. py:function:: magnum.meshtools.transform3d |
||||||
|
:raise KeyError: If :p:`mesh` doesn't have |
||||||
|
:ref:`trade.MeshAttribute.POSITION` of index :p:`id` (and in morph |
||||||
|
target :p:`morph_target_id` if not :py:`-1`) |
||||||
|
:raise AssertionError: If :ref:`trade.MeshAttribute.POSITION` are not 3D |
||||||
|
|
||||||
|
.. py:function:: magnum.meshtools.transform3d_in_place |
||||||
|
:raise AssertionError: If :p:`mesh` vertex data aren't |
||||||
|
:ref:`trade.DataFlags.MUTABLE` |
||||||
|
:raise KeyError: If :p:`mesh` doesn't have |
||||||
|
:ref:`trade.MeshAttribute.POSITION` of index :p:`id` (and in morph |
||||||
|
target :p:`morph_target_id` if not :py:`-1`) |
||||||
|
:raise AssertionError: If :ref:`trade.MeshAttribute.POSITION` are not |
||||||
|
:ref:`VertexFormat.VECTOR3` |
||||||
|
|
||||||
|
.. py:function:: magnum.meshtools.transform_texture_coordinates2d |
||||||
|
:raise KeyError: If :p:`mesh` doesn't have |
||||||
|
:ref:`trade.MeshAttribute.TEXTURE_COORDINATES` of index :p:`id` (and in |
||||||
|
morph target :p:`morph_target_id` if not :py:`-1`) |
||||||
|
|
||||||
|
.. py:function:: magnum.meshtools.transform_texture_coordinates2d_in_place |
||||||
|
:raise AssertionError: If :p:`mesh` vertex data aren't |
||||||
|
:ref:`trade.DataFlags.MUTABLE` |
||||||
|
:raise KeyError: If :p:`mesh` doesn't have |
||||||
|
:ref:`trade.MeshAttribute.TEXTURE_COORDINATES` of index :p:`id` (and in |
||||||
|
morph target :p:`morph_target_id` if not :py:`-1`) |
||||||
|
:raise AssertionError: If :ref:`trade.MeshAttribute.TEXTURE_COORDINATES` |
||||||
|
are not :ref:`VertexFormat.VECTOR2` |
||||||
@ -0,0 +1,70 @@ |
|||||||
|
.. |
||||||
|
This file is part of Magnum. |
||||||
|
|
||||||
|
Copyright © 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, |
||||||
|
2020, 2021, 2022, 2023, 2024, 2025, 2026 |
||||||
|
Vladimír Vondruš <mosra@centrum.cz> |
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a |
||||||
|
copy of this software and associated documentation files (the "Software"), |
||||||
|
to deal in the Software without restriction, including without limitation |
||||||
|
the rights to use, copy, modify, merge, publish, distribute, sublicense, |
||||||
|
and/or sell copies of the Software, and to permit persons to whom the |
||||||
|
Software is furnished to do so, subject to the following conditions: |
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included |
||||||
|
in all copies or substantial portions of the Software. |
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
||||||
|
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
||||||
|
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
||||||
|
DEALINGS IN THE SOFTWARE. |
||||||
|
.. |
||||||
|
|
||||||
|
.. py:function:: magnum.primitives.capsule2d_wireframe |
||||||
|
:raise AssertionError: If :p:`hemisphere_rings` is less than :py:`1` |
||||||
|
:raise AssertionError: If :p:`cylinder_rings` is less than :py:`1` |
||||||
|
.. py:function:: magnum.primitives.capsule3d_solid |
||||||
|
:raise AssertionError: If :p:`hemisphere_rings` is less than :py:`1` |
||||||
|
:raise AssertionError: If :p:`cylinder_rings` is less than :py:`1` |
||||||
|
:raise AssertionError: If :p:`segments` is less than :py:`3` |
||||||
|
.. py:function:: magnum.primitives.capsule3d_wireframe |
||||||
|
:raise AssertionError: If :p:`hemisphere_rings` is less than :py:`1` |
||||||
|
:raise AssertionError: If :p:`cylinder_rings` is less than :py:`1` |
||||||
|
:raise AssertionError: If :p:`segments` is zero or not a multiple of |
||||||
|
:py:`4` |
||||||
|
|
||||||
|
.. py:function:: magnum.primitives.circle2d_solid |
||||||
|
:raise AssertionError: If :p:`segments` is less than :py:`3` |
||||||
|
.. py:function:: magnum.primitives.circle2d_wireframe |
||||||
|
:raise AssertionError: If :p:`segments` is less than :py:`3` |
||||||
|
.. py:function:: magnum.primitives.circle3d_solid |
||||||
|
:raise AssertionError: If :p:`segments` is less than :py:`3` |
||||||
|
.. py:function:: magnum.primitives.circle3d_wireframe |
||||||
|
:raise AssertionError: If :p:`segments` is less than :py:`3` |
||||||
|
|
||||||
|
.. py:function:: magnum.primitives.cone_solid |
||||||
|
:raise AssertionError: If :p:`rings` is less than :py:`1` |
||||||
|
:raise AssertionError: If :p:`segments` is less than :py:`3` |
||||||
|
.. py:function:: magnum.primitives.cone_wireframe |
||||||
|
:raise AssertionError: If :p:`segments` is zero or not a multiple of |
||||||
|
:py:`4` |
||||||
|
|
||||||
|
.. py:function:: magnum.primitives.cylinder_solid |
||||||
|
:raise AssertionError: If :p:`rings` is less than :py:`1` |
||||||
|
:raise AssertionError: If :p:`segments` is less than :py:`3` |
||||||
|
.. py:function:: magnum.primitives.cylinder_wireframe |
||||||
|
:raise AssertionError: If :p:`rings` is less than :py:`1` |
||||||
|
:raise AssertionError: If :p:`segments` is zero or not a multiple of |
||||||
|
:py:`4` |
||||||
|
|
||||||
|
.. py:function:: magnum.primitives.uv_sphere_solid |
||||||
|
:raise AssertionError: If :p:`rings` is less than :py:`2` |
||||||
|
:raise AssertionError: If :p:`segments` is less than :py:`3` |
||||||
|
.. py:function:: magnum.primitives.uv_sphere_wireframe |
||||||
|
:raise AssertionError: If :p:`rings` is zero or not a multiple of :py:`2` |
||||||
|
:raise AssertionError: If :p:`segments` is zero or not a multiple of |
||||||
|
:py:`4` |
||||||
@ -0,0 +1,75 @@ |
|||||||
|
.. |
||||||
|
This file is part of Magnum. |
||||||
|
|
||||||
|
Copyright © 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, |
||||||
|
2020, 2021, 2022, 2023, 2024, 2025, 2026 |
||||||
|
Vladimír Vondruš <mosra@centrum.cz> |
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a |
||||||
|
copy of this software and associated documentation files (the "Software"), |
||||||
|
to deal in the Software without restriction, including without limitation |
||||||
|
the rights to use, copy, modify, merge, publish, distribute, sublicense, |
||||||
|
and/or sell copies of the Software, and to permit persons to whom the |
||||||
|
Software is furnished to do so, subject to the following conditions: |
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included |
||||||
|
in all copies or substantial portions of the Software. |
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
||||||
|
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
||||||
|
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
||||||
|
DEALINGS IN THE SOFTWARE. |
||||||
|
.. |
||||||
|
|
||||||
|
.. py:function:: magnum.scenetools.filter_fields |
||||||
|
:raise AssertionError: If size of :p:`fields_to_keep` is different than |
||||||
|
:ref:`trade.SceneData.field_count` |
||||||
|
|
||||||
|
.. py:function:: magnum.scenetools.filter_field_entries |
||||||
|
:raise AssertionError: If any field in :p:`entries_to_keep` does not exist |
||||||
|
in :p:`scene` |
||||||
|
:raise AssertionError: If any field in :p:`entries_to_keep` is listed more |
||||||
|
than once |
||||||
|
:raise AssertionError: If size of any array in :p:`entries_to_keep` does |
||||||
|
not match :ref:`trade.SceneData.field_size()` for given field |
||||||
|
|
||||||
|
.. py:function:: magnum.scenetools.filter_objects |
||||||
|
:raise AssertionError: If size of :p:`objects_to_keep` is different than |
||||||
|
:ref:`trade.SceneData.mapping_bound` |
||||||
|
|
||||||
|
.. py:function:: magnum.scenetools.parents_breadth_first |
||||||
|
:raise AssertionError: If :p:`scene` does not have |
||||||
|
:ref:`trade.SceneField.PARENT` |
||||||
|
|
||||||
|
.. py:function:: magnum.scenetools.children_depth_first |
||||||
|
:raise AssertionError: If :p:`scene` does not have |
||||||
|
:ref:`trade.SceneField.PARENT` |
||||||
|
|
||||||
|
.. py:function:: magnum.scenetools.absolute_field_transformations2d(scene: magnum.trade.SceneData, field: magnum.trade.SceneField, global_transformation: magnum.Matrix3) |
||||||
|
:raise KeyError: If :p:`field` does not exist in :p:`scene` |
||||||
|
:raise AssertionError: If :p:`scene` is not 2D |
||||||
|
:raise AssertionError: If :p:`scene` does not have |
||||||
|
:ref:`trade.SceneField.PARENT` |
||||||
|
|
||||||
|
.. py:function:: magnum.scenetools.absolute_field_transformations2d(scene: magnum.trade.SceneData, field_id: int, global_transformation: magnum.Matrix3) |
||||||
|
:raise IndexError: If :p:`field_id` negative or not less than |
||||||
|
:ref:`trade.SceneData.field_count` |
||||||
|
:raise AssertionError: If :p:`scene` is not 2D |
||||||
|
:raise AssertionError: If :p:`scene` does not have |
||||||
|
:ref:`trade.SceneField.PARENT` |
||||||
|
|
||||||
|
.. py:function:: magnum.scenetools.absolute_field_transformations3d(scene: magnum.trade.SceneData, field: magnum.trade.SceneField, global_transformation: magnum.Matrix4) |
||||||
|
:raise KeyError: If :p:`field` does not exist in :p:`scene` |
||||||
|
:raise AssertionError: If :p:`scene` is not 2D |
||||||
|
:raise AssertionError: If :p:`scene` does not have |
||||||
|
:ref:`trade.SceneField.PARENT` |
||||||
|
|
||||||
|
.. py:function:: magnum.scenetools.absolute_field_transformations3d(scene: magnum.trade.SceneData, field_id: int, global_transformation: magnum.Matrix4) |
||||||
|
:raise IndexError: If :p:`field_id` negative or not less than |
||||||
|
:ref:`trade.SceneData.field_count` |
||||||
|
:raise AssertionError: If :p:`scene` is not 2D |
||||||
|
:raise AssertionError: If :p:`scene` does not have |
||||||
|
:ref:`trade.SceneField.PARENT` |
||||||
@ -0,0 +1,169 @@ |
|||||||
|
.. |
||||||
|
This file is part of Magnum. |
||||||
|
|
||||||
|
Copyright © 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, |
||||||
|
2020, 2021, 2022, 2023, 2024, 2025, 2026 |
||||||
|
Vladimír Vondruš <mosra@centrum.cz> |
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a |
||||||
|
copy of this software and associated documentation files (the "Software"), |
||||||
|
to deal in the Software without restriction, including without limitation |
||||||
|
the rights to use, copy, modify, merge, publish, distribute, sublicense, |
||||||
|
and/or sell copies of the Software, and to permit persons to whom the |
||||||
|
Software is furnished to do so, subject to the following conditions: |
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included |
||||||
|
in all copies or substantial portions of the Software. |
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
||||||
|
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
||||||
|
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
||||||
|
DEALINGS IN THE SOFTWARE. |
||||||
|
.. |
||||||
|
|
||||||
|
.. py:class:: magnum.text.FontManager |
||||||
|
:summary: Manager for :ref:`AbstractFont` plugin instances |
||||||
|
|
||||||
|
Each plugin returned by :ref:`instantiate()` or :ref:`load_and_instantiate()` |
||||||
|
references its owning :ref:`FontManager` through |
||||||
|
:ref:`AbstractFont.manager`, ensuring the manager is not deleted before the |
||||||
|
plugin instances are. |
||||||
|
|
||||||
|
.. TODO couldn't the plugin_interface etc. docs be parsed from pybind's docs? |
||||||
|
repeating them for every plugin is annoying |
||||||
|
|
||||||
|
.. py:class:: magnum.text.AbstractFont |
||||||
|
:data plugin_interface: Plugin interface string |
||||||
|
:data plugin_search_paths: Plugin search paths |
||||||
|
:data plugin_suffix: Plugin suffix |
||||||
|
:data plugin_metadata_suffix: Plugin metadata suffix |
||||||
|
|
||||||
|
Similarly to C++, font plugins are loaded through :ref:`FontManager`: |
||||||
|
|
||||||
|
.. |
||||||
|
>>> from magnum import text |
||||||
|
|
||||||
|
.. code:: py |
||||||
|
|
||||||
|
>>> manager = text.FontManager() |
||||||
|
>>> font = manager.load_and_instantiate('StbTrueTypeFont') |
||||||
|
|
||||||
|
Unlike C++, errors in both API usage and file parsing are reported by |
||||||
|
raising an exception. See particular function documentation for detailed |
||||||
|
behavior. |
||||||
|
|
||||||
|
.. py:function:: magnum.text.AbstractFont.open_data |
||||||
|
:raise RuntimeError: If file opening fails |
||||||
|
|
||||||
|
.. py:function:: magnum.text.AbstractFont.open_file |
||||||
|
:raise RuntimeError: If file opening fails |
||||||
|
|
||||||
|
For compatibility with :ref:`os.path`, on Windows this function converts |
||||||
|
all backslashes in :p:`filename` to forward slashes before passing it to |
||||||
|
:dox:`Text::AbstractFont::openFile()`, which expects forward slashes as |
||||||
|
directory separators on all platforms. |
||||||
|
|
||||||
|
.. py:property:: magnum.text.AbstractFont.size |
||||||
|
:raise AssertionError: If no file is opened |
||||||
|
.. py:property:: magnum.text.AbstractFont.ascent |
||||||
|
:raise AssertionError: If no file is opened |
||||||
|
.. py:property:: magnum.text.AbstractFont.descent |
||||||
|
:raise AssertionError: If no file is opened |
||||||
|
.. py:property:: magnum.text.AbstractFont.line_height |
||||||
|
:raise AssertionError: If no file is opened |
||||||
|
.. py:property:: magnum.text.AbstractFont.glyph_count |
||||||
|
:raise AssertionError: If no file is opened |
||||||
|
.. py:function:: magnum.text.AbstractFont.glyph_id |
||||||
|
:raise AssertionError: If no file is opened |
||||||
|
.. py:function:: magnum.text.AbstractFont.glyph_size |
||||||
|
:raise AssertionError: If no file is opened |
||||||
|
:raise IndexError: If :p:`glyph` is negative or not less than |
||||||
|
:ref:`glyph_count` |
||||||
|
.. py:function:: magnum.text.AbstractFont.glyph_advance |
||||||
|
:raise AssertionError: If no file is opened |
||||||
|
:raise IndexError: If :p:`glyph` is negative or not less than |
||||||
|
:ref:`glyph_count` |
||||||
|
.. py:function:: magnum.text.AbstractFont.fill_glyph_cache |
||||||
|
:raise AssertionError: If no file is opened |
||||||
|
.. py:function:: magnum.text.AbstractFont.create_shaper |
||||||
|
:raise AssertionError: If no file is opened |
||||||
|
|
||||||
|
.. TODO remove the copies once the base class methods don't leak to subclasses |
||||||
|
.. py:property:: magnum.text.RendererCore.cursor |
||||||
|
:raise AssertionError: If setting this property while rendering is in |
||||||
|
progress |
||||||
|
.. py:property:: magnum.text.Renderer.cursor |
||||||
|
:raise AssertionError: If setting this property while rendering is in |
||||||
|
progress |
||||||
|
.. py:property:: magnum.text.RendererGL.cursor |
||||||
|
:raise AssertionError: If setting this property while rendering is in |
||||||
|
progress |
||||||
|
|
||||||
|
.. py:property:: magnum.text.RendererCore.alignment |
||||||
|
:raise AssertionError: If setting this property while rendering is in |
||||||
|
progress |
||||||
|
.. py:property:: magnum.text.Renderer.alignment |
||||||
|
:raise AssertionError: If setting this property while rendering is in |
||||||
|
progress |
||||||
|
.. py:property:: magnum.text.RendererGL.alignment |
||||||
|
:raise AssertionError: If setting this property while rendering is in |
||||||
|
progress |
||||||
|
|
||||||
|
.. py:property:: magnum.text.RendererCore.line_advance |
||||||
|
:raise AssertionError: If setting this property while rendering is in |
||||||
|
progress |
||||||
|
.. py:property:: magnum.text.Renderer.line_advance |
||||||
|
:raise AssertionError: If setting this property while rendering is in |
||||||
|
progress |
||||||
|
.. py:property:: magnum.text.RendererGL.line_advance |
||||||
|
:raise AssertionError: If setting this property while rendering is in |
||||||
|
progress |
||||||
|
|
||||||
|
.. py:property:: magnum.text.RendererGL.index_type |
||||||
|
:raise AssertionError: If setting this property while rendering is in |
||||||
|
progress |
||||||
|
|
||||||
|
.. py:function:: magnum.text.RendererCore.add |
||||||
|
:raise AssertionError: If :p:`shaper` font isn't present in |
||||||
|
:ref:`glyph_cache` |
||||||
|
.. py:function:: magnum.text.Renderer.add |
||||||
|
:raise AssertionError: If :p:`shaper` font isn't present in |
||||||
|
:ref:`glyph_cache` |
||||||
|
.. py:function:: magnum.text.RendererGL.add |
||||||
|
:raise AssertionError: If :p:`shaper` font isn't present in |
||||||
|
:ref:`glyph_cache` |
||||||
|
|
||||||
|
.. py:function:: magnum.text.RendererGL.render(self, shaper: magnum.text.AbstractShaper, size: float, text: str, features: list[magnum.text.FeatureRange]) |
||||||
|
:raise AssertionError: If :p:`shaper` font isn't present in |
||||||
|
:ref:`glyph_cache` |
||||||
|
|
||||||
|
.. py:enum:: magnum.text.Feature |
||||||
|
|
||||||
|
The equivalent to C++ :dox:`Text::feature()` is passing the four-character |
||||||
|
code to the constructor: |
||||||
|
|
||||||
|
.. |
||||||
|
>>> from magnum import text |
||||||
|
|
||||||
|
.. code:: pycon |
||||||
|
|
||||||
|
>>> feature = text.Feature('kern') |
||||||
|
>>> feature.name |
||||||
|
'KERNING' |
||||||
|
|
||||||
|
.. py:enum:: magnum.text.Script |
||||||
|
|
||||||
|
The equivalent to C++ :dox:`Text::script()` is passing the four-character |
||||||
|
code to the constructor: |
||||||
|
|
||||||
|
.. |
||||||
|
>>> from magnum import text |
||||||
|
|
||||||
|
.. code:: pycon |
||||||
|
|
||||||
|
>>> script = text.Script('Latn') |
||||||
|
>>> script.name |
||||||
|
'LATIN' |
||||||
Binary file not shown.
@ -0,0 +1,238 @@ |
|||||||
|
.. |
||||||
|
This file is part of Magnum. |
||||||
|
|
||||||
|
Copyright © 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, |
||||||
|
2020, 2021, 2022, 2023, 2024, 2025, 2026 |
||||||
|
Vladimír Vondruš <mosra@centrum.cz> |
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a |
||||||
|
copy of this software and associated documentation files (the "Software"), |
||||||
|
to deal in the Software without restriction, including without limitation |
||||||
|
the rights to use, copy, modify, merge, publish, distribute, sublicense, |
||||||
|
and/or sell copies of the Software, and to permit persons to whom the |
||||||
|
Software is furnished to do so, subject to the following conditions: |
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included |
||||||
|
in all copies or substantial portions of the Software. |
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
||||||
|
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
||||||
|
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
||||||
|
DEALINGS IN THE SOFTWARE. |
||||||
|
.. |
||||||
|
|
||||||
|
Changelog |
||||||
|
######### |
||||||
|
|
||||||
|
:ref-prefix: |
||||||
|
corrade |
||||||
|
magnum |
||||||
|
:some_directive: TODO: why can't the title below "just work" and I have to |
||||||
|
add some bogus content before? |
||||||
|
|
||||||
|
`Changes since 2020.06`_ |
||||||
|
======================== |
||||||
|
|
||||||
|
- Minimal supported CMake version is now 3.5, changed from 3.4, since CMake |
||||||
|
3.27+ warns if a compatibility with CMake below 3.5 is requested. Older |
||||||
|
versions are not supported anymore and all workarounds for them were |
||||||
|
removed. This is a conservative change, as there are no known supported |
||||||
|
distributions which would have anything older than 3.5. |
||||||
|
- Exposed the :ref:`corrade.BUILD_DEPRECATED` and |
||||||
|
:ref:`magnum.BUILD_DEPRECATED` constants, as some features may work |
||||||
|
differently depending on these being enabled or not and it's useful to be |
||||||
|
able to query this |
||||||
|
- Exposed the new :ref:`containers.BitArray`, :ref:`containers.BitArrayView`, |
||||||
|
:ref:`containers.StridedBitArrayView1D` containers, their mutable and |
||||||
|
multi-dimensional counterparts as well as the |
||||||
|
:ref:`containers.StridedArrayView*D.slice_bit() <containers.StridedArrayView1D.slice_bit()>` |
||||||
|
utility |
||||||
|
- Exposed missing :ref:`Vector4` constructor from a :ref:`Vector3` and a |
||||||
|
W component and :ref:`Vector3` from :ref:`Vector2` and a Z component |
||||||
|
- Renamed :py:`Matrix3.from()` / :py:`Matrix4.from()` to :ref:`Matrix3.from_()` |
||||||
|
/ :ref:`Matrix4.from_()` because :py:`from` is a Python keyword and it |
||||||
|
would be silly to have to write :py:`getattr(Matrix4, 'from')` just to use |
||||||
|
these APIs |
||||||
|
- Exposed newly added off-center variants of |
||||||
|
:ref:`Matrix4.orthographic_projection()` and |
||||||
|
:ref:`Matrix3.projection()` |
||||||
|
- Exposed remaining vector/scalar, exponential and other functions in the |
||||||
|
:ref:`math <magnum.math>` library |
||||||
|
- Exposed the :ref:`CompressedPixelFormat` enum, various pixel-format-related |
||||||
|
helper APIs are now properties on :ref:`PixelFormat` and |
||||||
|
:ref:`CompressedPixelFormat` |
||||||
|
- Exposed :ref:`CompressedImage2D`, :ref:`CompressedImageView2D`, |
||||||
|
:ref:`MutableCompressedImageView2D` and their 1D and 3D counterparts |
||||||
|
- Exposed :ref:`Color3.from_xyz()`, :ref:`Color3.from_linear_rgb_int()`, |
||||||
|
:ref:`Color3.to_xyz()`, :ref:`Color3.to_linear_rgb_int()` and equivalent |
||||||
|
APIs on :ref:`Color4` |
||||||
|
- Exposed unsigned :ref:`Range1Dui`, :ref:`Range2Dui` and :ref:`Range3Dui` |
||||||
|
types in addition to the signed variants |
||||||
|
- Exposed new :ref:`Quaternion.rotation()`, :ref:`Quaternion.reflection()`, |
||||||
|
:ref:`Quaternion.reflect_vector()`, :ref:`Quaternion.xyzw` and |
||||||
|
:ref:`Quaternion.wxyz` APIs |
||||||
|
- Exposed :ref:`gl.Context` and its platform-specific subclasses for EGL, WGL |
||||||
|
and GLX |
||||||
|
- Exposed :ref:`gl.Framebuffer.attach_texture()` and missing sRGB, depth |
||||||
|
and stencil :ref:`gl.TextureFormat` values (see :gh:`mosra/magnum-bindings#14`) |
||||||
|
- Exposed :ref:`gl.Renderer.set_blend_function()`, |
||||||
|
:ref:`gl.Renderer.set_blend_equation()` and related enums (see :gh:`mosra/magnum-bindings#9`) |
||||||
|
- Exposed :ref:`gl.Renderer.Feature.CLIP_DISTANCEn <gl.Renderer.Feature.CLIP_DISTANCE0>` |
||||||
|
values that are new since 2020.06 |
||||||
|
- Exposed new instancing, texture transformation, normal-mapping-related and |
||||||
|
lighting features in :ref:`shaders.PhongGL` |
||||||
|
- Exposed new instancing and texture transformation features in |
||||||
|
:ref:`shaders.FlatGL2D` and :ref:`shaders.FlatGL3D` |
||||||
|
- Exposed :ref:`shaders.DistanceFieldVectorGL2D`, |
||||||
|
:ref:`shaders.DistanceFieldVectorGL3D`, :ref:`shaders.VectorGL2D` and |
||||||
|
:ref:`shaders.VectorGL3D` shaders |
||||||
|
- Renamed all helper ``Python.h`` headers to ``PythonBindings.h`` to avoid |
||||||
|
issues with shitty IDE indexers such as Eclipse, confusing these with |
||||||
|
Python's ``<Python.h>`` |
||||||
|
- Minor performance fixes (see :gh:`mosra/magnum-bindings#10`, |
||||||
|
:gh:`mosra/magnum-bindings#15`, |
||||||
|
:gh:`mosra/magnum-bindings#16`, |
||||||
|
:gh:`mosra/magnum-bindings#17`, |
||||||
|
:gh:`mosra/magnum-bindings#19`, |
||||||
|
:gh:`mosra/magnum-bindings#20`) |
||||||
|
Travis banned everyone from using their CI and so all Linux and macOS |
||||||
|
builds were migrated from Travis to Circle CI. See also |
||||||
|
:gh:`mosra/magnum#350` and :gh:`mosra/magnum#523`. |
||||||
|
- It's now possible to use ``<PackageName>_ROOT`` to point to install |
||||||
|
locations of dependencies such as Corrade on CMake 3.12+, in addition to |
||||||
|
putting them all together inside ``CMAKE_PREFIX_PATH``. See also |
||||||
|
:gh:`mosra/magnum#614`. |
||||||
|
- On CMake 3.16 and newer, ``FindMagnumBindings.cmake`` can provide |
||||||
|
additional details if some component is not found |
||||||
|
- The Homebrew package now uses ``std_cmake_args`` instead of hardcoded build |
||||||
|
type and install prefix, which resolves certain build issues (see |
||||||
|
:gh:`mosra/homebrew-magnum#6`) |
||||||
|
- Added a caster for :dox:`Containers::Optional`, allowing it to be used |
||||||
|
directly in function signatures and showing up on the Python side as either |
||||||
|
:py:`None` or the actual value |
||||||
|
- Various documentation fixes (see :gh:`mosra/magnum-bindings#11`) |
||||||
|
- Fixed copypaste errors in bindings for :ref:`Range2D.center_x()` / |
||||||
|
:ref:`Range2D.center_y()`, :ref:`Range3D.z()`, :ref:`Range3D.center_x()` / |
||||||
|
:ref:`Range3D.center_y()` / :ref:`Range3D.center_z()` |
||||||
|
- Fixed a copypaste error in |
||||||
|
:ref:`platform.sdl2.Application.PointerMoveEvent.relative_position` and |
||||||
|
:ref:`platform.glfw.Application.PointerMoveEvent.relative_position` |
||||||
|
- Fixed :ref:`platform.sdl2.Application.Modifier` and |
||||||
|
:ref:`platform.glfw.Application.Modifier` to behave properly |
||||||
|
as flags and not just as an enum |
||||||
|
- Exposed :ref:`meshtools.compress_indices()`, :ref:`meshtools.concatenate()`, |
||||||
|
:ref:`meshtools.copy()`, :ref:`meshtools.duplicate()`, |
||||||
|
:ref:`meshtools.filter_attributes()`, |
||||||
|
:ref:`meshtools.filter_except_attributes()`, |
||||||
|
:ref:`meshtools.filter_only_attributes()`, |
||||||
|
:ref:`meshtools.generate_indices()`, :ref:`meshtools.interleave()`, |
||||||
|
:ref:`meshtools.remove_duplicates()`, |
||||||
|
:ref:`meshtools.remove_duplicates_fuzzy()`, :ref:`meshtools.transform2d()`, |
||||||
|
:ref:`meshtools.transform2d_in_place()`, :ref:`meshtools.transform3d()`, |
||||||
|
:ref:`meshtools.transform3d_in_place()`, |
||||||
|
:ref:`meshtools.transform_texture_coordinates2d()` and |
||||||
|
:ref:`meshtools.transform_texture_coordinates2d_in_place()` |
||||||
|
- Exposed :ref:`platform.sdl2.Application.viewport_event` and |
||||||
|
:ref:`platform.glfw.Application.viewport_event` and a possibility |
||||||
|
to make the window resizable on startup |
||||||
|
- Exposed :ref:`platform.sdl2.Application.exit_event` and |
||||||
|
:ref:`platform.glfw.Application.exit_event` |
||||||
|
- Exposed :ref:`platform.sdl2.Application.dpi_scaling` and |
||||||
|
:ref:`platform.glfw.Application.dpi_scaling` |
||||||
|
- Exposed :ref:`platform.glfw.Application.swap_interval` and |
||||||
|
:ref:`platform.glfw.Application.main_loop_iteration` |
||||||
|
- Exposed :ref:`platform.sdl2.Application.cursor` and |
||||||
|
:ref:`platform.sdl2.Application.warp_cursor`, same for GLFW |
||||||
|
- Exposed :ref:`platform.sdl2.Application.is_key_pressed()` and |
||||||
|
:ref:`platform.glfw.Application.is_key_pressed()` |
||||||
|
- Exposed all :ref:`platform.sdl2.Application.Configuration.WindowFlags` and |
||||||
|
:ref:`platform.glfw.Application.Configuration.WindowFlags` |
||||||
|
- Exposed the new :ref:`primitives.CubeFlags` |
||||||
|
- Exposed the new :ref:`text.AbstractShaper`, :ref:`text.RendererCore`, |
||||||
|
:ref:`text.Renderer`, :ref:`text.RendererGL` classes as well as the new |
||||||
|
:ref:`text.Feature`, :ref:`text.Script` enums and the |
||||||
|
:ref:`text.FeatureRange` helper, plus more :ref:`text.Alignment` options |
||||||
|
- Exposed :ref:`trade.AbstractImporter.features` and |
||||||
|
:ref:`trade.AbstractImporter.flags` and corresponding enums |
||||||
|
- Exposed a basic interface of :ref:`trade.AbstractImageConverter` and |
||||||
|
:ref:`trade.AbstractSceneConverter` |
||||||
|
- Exposed the whole interface of :ref:`trade.MeshData` and |
||||||
|
:ref:`trade.MeshAttributeData` including typed access to index and |
||||||
|
attribute data, together with :ref:`VertexFormat`, :ref:`trade.DataFlags`, |
||||||
|
:ref:`trade.AbstractImporter.mesh_attribute_name()` and |
||||||
|
:ref:`trade.AbstractImporter.mesh_attribute_for_name()` |
||||||
|
- Exposed the whole interface of :ref:`trade.MaterialData` including typed |
||||||
|
access to attribute data, together with |
||||||
|
:ref:`trade.AbstractImporter.material()` and related importer APIs |
||||||
|
- Exposed the whole interface of :ref:`trade.SceneData` and |
||||||
|
:ref:`trade.SceneFieldData` including typed access to mapping and field |
||||||
|
data, together with :ref:`trade.AbstractImporter.scene()` and related |
||||||
|
importer APIs |
||||||
|
- Exposed :ref:`Color3.red()` and other convenience constructors (see |
||||||
|
:gh:`mosra/magnum-bindings#12`) |
||||||
|
- Exposed the :ref:`materialtools`, :ref:`scenetools` and :ref:`text` |
||||||
|
libraries |
||||||
|
- Exposed :ref:`utility.copy()` for convenient, fast and safe copying of |
||||||
|
multi-dimensional strided arrays |
||||||
|
- Exposed the minimal interface of :ref:`utility.ConfigurationGroup` and |
||||||
|
:ref:`utility.Configuration` |
||||||
|
- Exposed :ref:`pluginmanager.AbstractManager.set_preferred_plugins()`, |
||||||
|
:ref:`pluginmanager.AbstractManager.register_external_manager()`, the base |
||||||
|
:ref:`pluginmanager.AbstractPlugin` class and |
||||||
|
:ref:`pluginmanager.PluginMetadata` |
||||||
|
- Fixed issues with an in-source build (see :gh:`mosra/magnum-bindings#13`) |
||||||
|
- All CMake build options are now prefixed with ``MAGNUM_``. For backwards |
||||||
|
compatibility, unless ``MAGNUM_BUILD_DEPRECATED`` is disabled and unless a |
||||||
|
prefixed option is already set during the initial run, the unprefixed |
||||||
|
options are still recognized with a warning. See also :gh:`mosra/corrade#139`. |
||||||
|
- Added a ``MAGNUM_PYTHON_BINDINGS_STATIC_PLUGINS`` CMake option for linking |
||||||
|
static plugins to the Python bindings module. See the |
||||||
|
:ref:`building documentation <std:doc:building>` for more information. |
||||||
|
- Added a ``MAGNUM_BUILD_PYTHON_BINDINGS_RTLD_GLOBAL`` CMake option to make |
||||||
|
the Python bindings module loaded into the global namespace instead of |
||||||
|
isolated in order to attempt to solve problems with duplicated globals when |
||||||
|
static builds of Corrade and Magnum are linked into multiple dynamic |
||||||
|
modules. See the :ref:`building documentation <std:doc:building>` for more |
||||||
|
information. |
||||||
|
|
||||||
|
`2020.06`_ |
||||||
|
========== |
||||||
|
|
||||||
|
Released 2020-06-27, tagged as |
||||||
|
:gh:`v2020.06 <mosra/magnum-bindings/releases/tag/v2020.06>`. |
||||||
|
|
||||||
|
- Exposed :ref:`Matrix4.cofactor()`, :ref:`Matrix4.comatrix()`, |
||||||
|
:ref:`Matrix4.adjugate()` (and equivalents in other matrix sizes), and |
||||||
|
:ref:`Matrix4.normal_matrix()` |
||||||
|
- Exposed :ref:`gl.AbstractFramebuffer.blit()` functions and related enums |
||||||
|
- Exposed more keys in :ref:`platform.sdl2.Application` and |
||||||
|
:ref:`platform.glfw.Application` |
||||||
|
- Exposed :ref:`gl.AbstractTexture.unbind()` |
||||||
|
- Exposed :ref:`trade.AbstractImporter.image2d_level_count()` and related |
||||||
|
APIs for 1D and 3D |
||||||
|
- Exposed :ref:`trade.MeshData` and related APIs, the previous |
||||||
|
``trade.MeshData3D`` APIs are removed |
||||||
|
- Exposed new APIs and tangent support in the :ref:`primitives` library |
||||||
|
- :ref:`platform.sdl2.Application` and :ref:`platform.glfw.Application` now |
||||||
|
provide a clear error instead of "pure virtual method call" in case |
||||||
|
``draw_event()`` is not implemented |
||||||
|
- Library version is now exposed through ``MAGNUMBINDINGS_VERSION_YEAR``, |
||||||
|
``MAGNUMBINDINGS_VERSION_MONTH``, ``MAGNUMBINDINGS_VERSION_COMMIT``, |
||||||
|
``MAGNUMBINDINGS_VERSION_HASH`` and ``MAGNUMBINDINGS_VERSION_STRING`` |
||||||
|
preprocessor defines in a new ``Magnum/versionBindings.h`` header. This |
||||||
|
header is not included by any other header to avoid trigerring a full |
||||||
|
rebuild when Git commit changes. If Git is not found, only the first two |
||||||
|
defines are present. |
||||||
|
|
||||||
|
`2019.10`_ |
||||||
|
========== |
||||||
|
|
||||||
|
Released 2019-10-24, tagged as |
||||||
|
:gh:`v2019.10 <mosra/magnum-bindings/releases/tag/v2019.10>`. |
||||||
|
|
||||||
|
Initial version. See :gh:`mosra/magnum#228`, :gh:`mosra/magnum-bindings#1`, |
||||||
|
:gh:`mosra/magnum-bindings#2` and :gh:`mosra/magnum-bindings#6` for more |
||||||
|
information. |
||||||
@ -0,0 +1,81 @@ |
|||||||
|
.. |
||||||
|
This file is part of Magnum. |
||||||
|
|
||||||
|
Copyright © 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, |
||||||
|
2020, 2021, 2022, 2023, 2024, 2025, 2026 |
||||||
|
Vladimír Vondruš <mosra@centrum.cz> |
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a |
||||||
|
copy of this software and associated documentation files (the "Software"), |
||||||
|
to deal in the Software without restriction, including without limitation |
||||||
|
the rights to use, copy, modify, merge, publish, distribute, sublicense, |
||||||
|
and/or sell copies of the Software, and to permit persons to whom the |
||||||
|
Software is furnished to do so, subject to the following conditions: |
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included |
||||||
|
in all copies or substantial portions of the Software. |
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
||||||
|
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
||||||
|
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
||||||
|
DEALINGS IN THE SOFTWARE. |
||||||
|
.. |
||||||
|
|
||||||
|
Credits |
||||||
|
####### |
||||||
|
|
||||||
|
:ref-prefix: |
||||||
|
corrade |
||||||
|
magnum |
||||||
|
:summary: Third-party dependencies and their corresponding license information; |
||||||
|
people and organizations that contributed to Magnum Python Bindings. |
||||||
|
|
||||||
|
`Third-party components`_ |
||||||
|
========================= |
||||||
|
|
||||||
|
.. TODO: ffs doxygen SORT YOUR SHIT OUT, why can't I link to |
||||||
|
credits-third-party?! |
||||||
|
.. role:: doxygen-you-fool(link) |
||||||
|
:class: m-doc-external |
||||||
|
|
||||||
|
While Magnum Python Bindings themselves don't depend on much, a lot of |
||||||
|
third-party components is used transitively from the Magnum C++ implementation. |
||||||
|
Please see the :ref:`main page <std:doc:index#license>` for license of Magnum |
||||||
|
Python Bindings themselves and the |
||||||
|
:doxygen-you-fool:`Third-party components <https://doc.magnum.graphics/magnum/credits-third-party.html>` |
||||||
|
page of C++ docs for a detailed overview of all used components. The list below |
||||||
|
uses the same color-coding scheme for easier overview: |
||||||
|
|
||||||
|
:ref:`Magnum Python Bindings <std:doc:index>` |
||||||
|
Bindings generated with :gh:`pybind11 <pybind/pybind11>`, released under a |
||||||
|
:label-success:`BSD-style license` |
||||||
|
(`license text <https://github.com/pybind/pybind11/blob/master/LICENSE>`_, |
||||||
|
`choosealicense.com <https://choosealicense.com/licenses/bsd-3-clause/>`_). |
||||||
|
It requires attribution for public use. |
||||||
|
|
||||||
|
`Contributors`_ |
||||||
|
=============== |
||||||
|
|
||||||
|
Listing only people with code contributions or other significant work, because |
||||||
|
otherwise there's too many :) There's also a |
||||||
|
:dox:`similar list for Corrade <corrade-credits-contributors>` and |
||||||
|
:dox:`Magnum <credits-contributors>` themselves. Big thanks to everyone |
||||||
|
involved! |
||||||
|
|
||||||
|
.. class:: m-text-center m-text m-dim |
||||||
|
|
||||||
|
Are the below lists missing your name or something's wrong? |
||||||
|
`Let us know! <https://magnum.graphics/contact/>`_ |
||||||
|
|
||||||
|
- **Aaron Gokaslan** (:gh:`Skylion007`) --- minor performance and |
||||||
|
documentation fixes, expanding :ref:`Color3` / :ref:`Color4` bindings |
||||||
|
- **Cameron Egbert** (:gh:`cegbertOculus`) --- initial Windows port |
||||||
|
- **James Murphy** (:gh:`mCodingLLC`) --- buildsystem fixes, expanding |
||||||
|
:ref:`gl.Framebuffer` bindings |
||||||
|
- **John Laxson** (:gh:`jlaxson`) --- Homebrew package improvements |
||||||
|
- **Stanislaw Halik** (:gh:`sthalik`) --- build fixes |
||||||
|
- **Vladimir Gamalyan** (:gh:`vladimirgamalyan`) --- expanding |
||||||
|
:ref:`gl.Renderer` bindings |
||||||
@ -0,0 +1,80 @@ |
|||||||
|
.. |
||||||
|
This file is part of Magnum. |
||||||
|
|
||||||
|
Copyright © 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, |
||||||
|
2020, 2021, 2022, 2023, 2024, 2025, 2026 |
||||||
|
Vladimír Vondruš <mosra@centrum.cz> |
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a |
||||||
|
copy of this software and associated documentation files (the "Software"), |
||||||
|
to deal in the Software without restriction, including without limitation |
||||||
|
the rights to use, copy, modify, merge, publish, distribute, sublicense, |
||||||
|
and/or sell copies of the Software, and to permit persons to whom the |
||||||
|
Software is furnished to do so, subject to the following conditions: |
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included |
||||||
|
in all copies or substantial portions of the Software. |
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
||||||
|
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
||||||
|
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
||||||
|
DEALINGS IN THE SOFTWARE. |
||||||
|
.. |
||||||
|
|
||||||
|
Developers Guide |
||||||
|
################ |
||||||
|
|
||||||
|
:ref-prefix: |
||||||
|
corrade |
||||||
|
magnum |
||||||
|
:summary: Checklists for developing new things in Magnum Python bindings |
||||||
|
themselves. |
||||||
|
|
||||||
|
.. role:: cmake(code) |
||||||
|
:language: cmake |
||||||
|
.. role:: cpp(code) |
||||||
|
:language: c++ |
||||||
|
.. role:: py(code) |
||||||
|
:language: py |
||||||
|
|
||||||
|
`Checklist for adding / removing bindings for a library`_ |
||||||
|
========================================================= |
||||||
|
|
||||||
|
1. Add a corresponding ``Foo`` Magnum dependency to the :cmake:`find_package()` |
||||||
|
call in ``src/python/magnum/CMakeLists.txt``, create a ``magnum_foo_SRCS`` |
||||||
|
variable with its source file(s). |
||||||
|
2. Add a :cmake:`if(Magnum_Foo_FOUND)` branch to the |
||||||
|
:cmake:`if(NOT MAGNUM_BUILD_STATIC)` condition, adding a new ``magnum_foo`` |
||||||
|
module from ``magnum_foo_SRCS``, linking to ``Magnum::Foo`` and setting |
||||||
|
``OUTPUT_NAME`` to ``foo``. |
||||||
|
3. Add a :cmake:`if(Magnum_Foo_FOUND)` branch to the :cmake:`else()` |
||||||
|
condition, ``APPEND``\ ing ``magnum_foo_SRCS`` to ``magnum_SRCS`` and |
||||||
|
``Magnum::Foo`` to ``magnum_LIBS``. |
||||||
|
4. Add :cpp:`void foo(py::module_& m);` forward declaration to |
||||||
|
``magnum/bootstrap.h``, and :cpp:`#cmakdefeine Magnum_Foo_FOUND` to |
||||||
|
``magnum/staticconfigure.h.cmake``. |
||||||
|
5. Implement ``void foo(py::module_& m)`` in ``src/python/magnum/foo.cpp``, |
||||||
|
add a :cpp:`PYBIND11_MODULE()` calling it. |
||||||
|
6. Add :cpp:`m.def_submodule("foo");` and a call to :cpp:`magnum:foo()` |
||||||
|
wrapped in :cpp:`#ifdef Magnum_Foo_FOUND` to the |
||||||
|
:cpp:`#ifdef MAGNUM_BUILD_STATIC` section of :cpp:`PYBIND11_MODULE()` in |
||||||
|
``magnum/magnum.cpp``. |
||||||
|
7. Add the new module name to the list in ``magnum/__init__.py``. |
||||||
|
8. Add a line with ``magnum_foo`` to the :cmake:`foreach()` in |
||||||
|
``src/python/CMakeLists.txt``, and then a corresponding :py:`'magnum.foo'` |
||||||
|
entry in ``src/python/setup.py.cmake`` |
||||||
|
9. Add a ``magnum/test/test_foo.py`` test file, and potentially also |
||||||
|
``magnum/test/test_foo_gl.py`` where is |
||||||
|
:py:`from . import GLTestCase, setUpModule` to skip the test if GL context |
||||||
|
doesn't exist, and the test cases derive from :py:`GLTestCase` instead of |
||||||
|
:py:`unittest.TestCase`. |
||||||
|
10. Add the new module into the :py:`magnum.__all__` list in |
||||||
|
``doc/python/conf.py``. |
||||||
|
11. Add a ``doc/python/magnum.foo.rst`` documentation file for more detailed |
||||||
|
docs, if needed, and reference it from ``INPUT_DOCS``. |
||||||
|
12. Add a ``doc/python/pages/changelog.rst`` entry. |
||||||
|
|
||||||
|
For Corrade bindings it's similar. |
||||||
Binary file not shown.
@ -1,86 +0,0 @@ |
|||||||
#.rst: |
|
||||||
# Find EGL |
|
||||||
# -------- |
|
||||||
# |
|
||||||
# Finds the EGL library. This module defines: |
|
||||||
# |
|
||||||
# EGL_FOUND - True if EGL library is found |
|
||||||
# EGL::EGL - EGL imported target |
|
||||||
# |
|
||||||
# Additionally these variables are defined for internal usage: |
|
||||||
# |
|
||||||
# EGL_LIBRARY - EGL library |
|
||||||
# EGL_INCLUDE_DIR - Include dir |
|
||||||
# |
|
||||||
|
|
||||||
# |
|
||||||
# This file is part of Magnum. |
|
||||||
# |
|
||||||
# Copyright © 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019 |
|
||||||
# Vladimír Vondruš <mosra@centrum.cz> |
|
||||||
# |
|
||||||
# Permission is hereby granted, free of charge, to any person obtaining a |
|
||||||
# copy of this software and associated documentation files (the "Software"), |
|
||||||
# to deal in the Software without restriction, including without limitation |
|
||||||
# the rights to use, copy, modify, merge, publish, distribute, sublicense, |
|
||||||
# and/or sell copies of the Software, and to permit persons to whom the |
|
||||||
# Software is furnished to do so, subject to the following conditions: |
|
||||||
# |
|
||||||
# The above copyright notice and this permission notice shall be included |
|
||||||
# in all copies or substantial portions of the Software. |
|
||||||
# |
|
||||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
|
||||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
|
||||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
|
||||||
# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
|
||||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
|
||||||
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
|
||||||
# DEALINGS IN THE SOFTWARE. |
|
||||||
# |
|
||||||
|
|
||||||
# Under Emscripten, GL is linked implicitly. With MINIMAL_RUNTIME you need to |
|
||||||
# specify -lGL. Simply set the library name to that. |
|
||||||
if(CORRADE_TARGET_EMSCRIPTEN) |
|
||||||
set(EGL_LIBRARY GL CACHE STRING "Path to a library." FORCE) |
|
||||||
else() |
|
||||||
find_library(EGL_LIBRARY NAMES |
|
||||||
EGL |
|
||||||
|
|
||||||
# ANGLE (CMake doesn't search for lib prefix on Windows) |
|
||||||
libEGL |
|
||||||
|
|
||||||
# On iOS a part of OpenGLES |
|
||||||
OpenGLES) |
|
||||||
endif() |
|
||||||
|
|
||||||
# Include dir |
|
||||||
find_path(EGL_INCLUDE_DIR NAMES |
|
||||||
EGL/egl.h |
|
||||||
|
|
||||||
# iOS |
|
||||||
EAGL.h) |
|
||||||
|
|
||||||
include(FindPackageHandleStandardArgs) |
|
||||||
find_package_handle_standard_args(EGL DEFAULT_MSG |
|
||||||
EGL_LIBRARY |
|
||||||
EGL_INCLUDE_DIR) |
|
||||||
|
|
||||||
if(NOT TARGET EGL::EGL) |
|
||||||
# Work around BUGGY framework support on macOS. Do this also in case of |
|
||||||
# Emscripten, since there we don't have a location either. |
|
||||||
# http://public.kitware.com/pipermail/cmake/2016-April/063179.html |
|
||||||
if((APPLE AND ${EGL_LIBRARY} MATCHES "\\.framework$") OR CORRADE_TARGET_EMSCRIPTEN) |
|
||||||
add_library(EGL::EGL INTERFACE IMPORTED) |
|
||||||
set_property(TARGET EGL::EGL APPEND PROPERTY |
|
||||||
INTERFACE_LINK_LIBRARIES ${EGL_LIBRARY}) |
|
||||||
else() |
|
||||||
add_library(EGL::EGL UNKNOWN IMPORTED) |
|
||||||
set_property(TARGET EGL::EGL PROPERTY |
|
||||||
IMPORTED_LOCATION ${EGL_LIBRARY}) |
|
||||||
endif() |
|
||||||
|
|
||||||
set_target_properties(EGL::EGL PROPERTIES |
|
||||||
INTERFACE_INCLUDE_DIRECTORIES ${EGL_INCLUDE_DIR}) |
|
||||||
endif() |
|
||||||
|
|
||||||
mark_as_advanced(EGL_LIBRARY EGL_INCLUDE_DIR) |
|
||||||
@ -1,94 +0,0 @@ |
|||||||
#.rst: |
|
||||||
# Find GLFW |
|
||||||
# --------- |
|
||||||
# |
|
||||||
# Finds the GLFW library using its cmake config if that exists, otherwise |
|
||||||
# falls back to finding it manually. This module defines: |
|
||||||
# |
|
||||||
# GLFW_FOUND - True if GLFW library is found |
|
||||||
# GLFW::GLFW - GLFW imported target |
|
||||||
# |
|
||||||
# Additionally, in case the config was not found, these variables are defined |
|
||||||
# for internal usage: |
|
||||||
# |
|
||||||
# GLFW_LIBRARY - GLFW library |
|
||||||
# GLFW_INCLUDE_DIR - Root include dir |
|
||||||
# |
|
||||||
|
|
||||||
# |
|
||||||
# This file is part of Magnum. |
|
||||||
# |
|
||||||
# Copyright © 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019 |
|
||||||
# Vladimír Vondruš <mosra@centrum.cz> |
|
||||||
# Copyright © 2016 Jonathan Hale <squareys@googlemail.com> |
|
||||||
# |
|
||||||
# Permission is hereby granted, free of charge, to any person obtaining a |
|
||||||
# copy of this software and associated documentation files (the "Software"), |
|
||||||
# to deal in the Software without restriction, including without limitation |
|
||||||
# the rights to use, copy, modify, merge, publish, distribute, sublicense, |
|
||||||
# and/or sell copies of the Software, and to permit persons to whom the |
|
||||||
# Software is furnished to do so, subject to the following conditions: |
|
||||||
# |
|
||||||
# The above copyright notice and this permission notice shall be included |
|
||||||
# in all copies or substantial portions of the Software. |
|
||||||
# |
|
||||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
|
||||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
|
||||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
|
||||||
# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
|
||||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
|
||||||
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
|
||||||
# DEALINGS IN THE SOFTWARE. |
|
||||||
# |
|
||||||
|
|
||||||
# GLFW installs cmake package config files to shared/ folder which handles |
|
||||||
# dependencies in case GLFW is built statically. Try to find first, quietly, so |
|
||||||
# it doesn't print loud messages when it's not found, since that's okay. |
|
||||||
find_package(glfw3 CONFIG QUIET) |
|
||||||
|
|
||||||
if(TARGET glfw) |
|
||||||
if(NOT TARGET GLFW::GLFW) |
|
||||||
# Aliases of (global) targets are only supported in CMake 3.11, so we |
|
||||||
# work around it by this. This is easier than fetching all possible |
|
||||||
# properties (which are impossible to track of) and then attempting to |
|
||||||
# rebuild them into a new target. |
|
||||||
add_library(GLFW::GLFW INTERFACE IMPORTED) |
|
||||||
set_target_properties(GLFW::GLFW PROPERTIES INTERFACE_LINK_LIBRARIES glfw) |
|
||||||
endif() |
|
||||||
|
|
||||||
# Just to make FPHSA print some meaningful location, nothing else |
|
||||||
get_target_property(_GLFW_INTERFACE_INCLUDE_DIRECTORIES glfw INTERFACE_INCLUDE_DIRECTORIES) |
|
||||||
include(FindPackageHandleStandardArgs) |
|
||||||
find_package_handle_standard_args("GLFW" DEFAULT_MSG |
|
||||||
_GLFW_INTERFACE_INCLUDE_DIRECTORIES) |
|
||||||
return() |
|
||||||
endif() |
|
||||||
|
|
||||||
# In case no config file was found, try manually finding the library. |
|
||||||
find_library(GLFW_LIBRARY NAMES glfw glfw3) |
|
||||||
|
|
||||||
# Include dir |
|
||||||
find_path(GLFW_INCLUDE_DIR |
|
||||||
NAMES GLFW/glfw3.h) |
|
||||||
|
|
||||||
include(FindPackageHandleStandardArgs) |
|
||||||
find_package_handle_standard_args("GLFW" DEFAULT_MSG |
|
||||||
GLFW_LIBRARY |
|
||||||
GLFW_INCLUDE_DIR) |
|
||||||
|
|
||||||
if(NOT TARGET GLFW::GLFW) |
|
||||||
add_library(GLFW::GLFW UNKNOWN IMPORTED) |
|
||||||
|
|
||||||
# Work around BUGGY framework support on macOS |
|
||||||
# https://cmake.org/Bug/view.php?id=14105 |
|
||||||
if(CORRADE_TARGET_APPLE AND ${GLFW_LIBRARY} MATCHES "\\.framework$") |
|
||||||
set_property(TARGET GLFW::GLFW PROPERTY IMPORTED_LOCATION ${GLFW_LIBRARY}/GLFW) |
|
||||||
else() |
|
||||||
set_property(TARGET GLFW::GLFW PROPERTY IMPORTED_LOCATION ${GLFW_LIBRARY}) |
|
||||||
endif() |
|
||||||
|
|
||||||
set_property(TARGET GLFW::GLFW PROPERTY |
|
||||||
INTERFACE_INCLUDE_DIRECTORIES ${GLFW_INCLUDE_DIR}) |
|
||||||
endif() |
|
||||||
|
|
||||||
mark_as_advanced(GLFW_LIBRARY GLFW_INCLUDE_DIR) |
|
||||||
@ -1,78 +0,0 @@ |
|||||||
#.rst: |
|
||||||
# Find OpenGL ES 2 |
|
||||||
# ---------------- |
|
||||||
# |
|
||||||
# Finds the OpenGL ES 2 library. This module defines: |
|
||||||
# |
|
||||||
# OpenGLES2_FOUND - True if OpenGL ES 2 library is found |
|
||||||
# OpenGLES2::OpenGLES2 - OpenGL ES 2 imported target |
|
||||||
# |
|
||||||
# Additionally these variables are defined for internal usage: |
|
||||||
# |
|
||||||
# OPENGLES2_LIBRARY - OpenGL ES 2 library |
|
||||||
# |
|
||||||
# Please note this find module is tailored especially for the needs of Magnum. |
|
||||||
# In particular, it depends on its platform definitions and doesn't look for |
|
||||||
# OpenGL ES includes as Magnum has its own, generated using flextGL. |
|
||||||
# |
|
||||||
|
|
||||||
# |
|
||||||
# This file is part of Magnum. |
|
||||||
# |
|
||||||
# Copyright © 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019 |
|
||||||
# Vladimír Vondruš <mosra@centrum.cz> |
|
||||||
# |
|
||||||
# Permission is hereby granted, free of charge, to any person obtaining a |
|
||||||
# copy of this software and associated documentation files (the "Software"), |
|
||||||
# to deal in the Software without restriction, including without limitation |
|
||||||
# the rights to use, copy, modify, merge, publish, distribute, sublicense, |
|
||||||
# and/or sell copies of the Software, and to permit persons to whom the |
|
||||||
# Software is furnished to do so, subject to the following conditions: |
|
||||||
# |
|
||||||
# The above copyright notice and this permission notice shall be included |
|
||||||
# in all copies or substantial portions of the Software. |
|
||||||
# |
|
||||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
|
||||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
|
||||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
|
||||||
# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
|
||||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
|
||||||
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
|
||||||
# DEALINGS IN THE SOFTWARE. |
|
||||||
# |
|
||||||
|
|
||||||
# Under Emscripten, GL is linked implicitly. With MINIMAL_RUNTIME you need to |
|
||||||
# specify -lGL. Simply set the library name to that. |
|
||||||
if(CORRADE_TARGET_EMSCRIPTEN) |
|
||||||
set(OPENGLES2_LIBRARY GL CACHE STRING "Path to a library." FORCE) |
|
||||||
else() |
|
||||||
find_library(OPENGLES2_LIBRARY NAMES |
|
||||||
GLESv2 |
|
||||||
|
|
||||||
# ANGLE (CMake doesn't search for lib prefix on Windows) |
|
||||||
libGLESv2 |
|
||||||
|
|
||||||
# iOS |
|
||||||
OpenGLES) |
|
||||||
endif() |
|
||||||
|
|
||||||
include(FindPackageHandleStandardArgs) |
|
||||||
find_package_handle_standard_args(OpenGLES2 DEFAULT_MSG |
|
||||||
OPENGLES2_LIBRARY) |
|
||||||
|
|
||||||
if(NOT TARGET OpenGLES2::OpenGLES2) |
|
||||||
# Work around BUGGY framework support on macOS. Do this also in case of |
|
||||||
# Emscripten, since there we don't have a location either. |
|
||||||
# http://public.kitware.com/pipermail/cmake/2016-April/063179.html |
|
||||||
if((CORRADE_TARGET_APPLE AND ${OPENGLES2_LIBRARY} MATCHES "\\.framework$") OR CORRADE_TARGET_EMSCRIPTEN) |
|
||||||
add_library(OpenGLES2::OpenGLES2 INTERFACE IMPORTED) |
|
||||||
set_property(TARGET OpenGLES2::OpenGLES2 APPEND PROPERTY |
|
||||||
INTERFACE_LINK_LIBRARIES ${OPENGLES2_LIBRARY}) |
|
||||||
else() |
|
||||||
add_library(OpenGLES2::OpenGLES2 UNKNOWN IMPORTED) |
|
||||||
set_property(TARGET OpenGLES2::OpenGLES2 PROPERTY |
|
||||||
IMPORTED_LOCATION ${OPENGLES2_LIBRARY}) |
|
||||||
endif() |
|
||||||
endif() |
|
||||||
|
|
||||||
mark_as_advanced(OPENGLES2_LIBRARY) |
|
||||||
@ -1,92 +0,0 @@ |
|||||||
#.rst: |
|
||||||
# Find OpenGL ES 3 |
|
||||||
# ---------------- |
|
||||||
# |
|
||||||
# Finds the OpenGL ES 3 library. This module defines: |
|
||||||
# |
|
||||||
# OpenGLES3_FOUND - True if OpenGL ES 3 library is found |
|
||||||
# OpenGLES3::OpenGLES3 - OpenGL ES 3 imported target |
|
||||||
# |
|
||||||
# Additionally these variables are defined for internal usage: |
|
||||||
# |
|
||||||
# OPENGLES3_LIBRARY - OpenGL ES 3 library |
|
||||||
# |
|
||||||
# Please note this find module is tailored especially for the needs of Magnum. |
|
||||||
# In particular, it depends on its platform definitions and doesn't look for |
|
||||||
# OpenGL ES includes as Magnum has its own, generated using flextGL. |
|
||||||
# |
|
||||||
|
|
||||||
# |
|
||||||
# This file is part of Magnum. |
|
||||||
# |
|
||||||
# Copyright © 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019 |
|
||||||
# Vladimír Vondruš <mosra@centrum.cz> |
|
||||||
# |
|
||||||
# Permission is hereby granted, free of charge, to any person obtaining a |
|
||||||
# copy of this software and associated documentation files (the "Software"), |
|
||||||
# to deal in the Software without restriction, including without limitation |
|
||||||
# the rights to use, copy, modify, merge, publish, distribute, sublicense, |
|
||||||
# and/or sell copies of the Software, and to permit persons to whom the |
|
||||||
# Software is furnished to do so, subject to the following conditions: |
|
||||||
# |
|
||||||
# The above copyright notice and this permission notice shall be included |
|
||||||
# in all copies or substantial portions of the Software. |
|
||||||
# |
|
||||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
|
||||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
|
||||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
|
||||||
# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
|
||||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
|
||||||
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
|
||||||
# DEALINGS IN THE SOFTWARE. |
|
||||||
# |
|
||||||
|
|
||||||
# Under Emscripten, GL is linked implicitly. With MINIMAL_RUNTIME you need to |
|
||||||
# specify -lGL. Simply set the library name to that. |
|
||||||
if(CORRADE_TARGET_EMSCRIPTEN) |
|
||||||
set(OPENGLES3_LIBRARY GL CACHE STRING "Path to a library." FORCE) |
|
||||||
else() |
|
||||||
find_library(OPENGLES3_LIBRARY NAMES |
|
||||||
GLESv3 |
|
||||||
|
|
||||||
# On some platforms (e.g. desktop emulation with Mesa or NVidia) ES3 |
|
||||||
# support is provided in ES2 lib |
|
||||||
GLESv2 |
|
||||||
|
|
||||||
# ANGLE (CMake doesn't search for lib prefix on Windows) |
|
||||||
libGLESv2 |
|
||||||
|
|
||||||
# iOS |
|
||||||
OpenGLES) |
|
||||||
endif() |
|
||||||
|
|
||||||
include(FindPackageHandleStandardArgs) |
|
||||||
find_package_handle_standard_args("OpenGLES3" DEFAULT_MSG |
|
||||||
OPENGLES3_LIBRARY) |
|
||||||
|
|
||||||
if(NOT TARGET OpenGLES3::OpenGLES3) |
|
||||||
# Work around BUGGY framework support on macOS. Do this also in case of |
|
||||||
# Emscripten, since there we don't have a location either. |
|
||||||
# http://public.kitware.com/pipermail/cmake/2016-April/063179.html |
|
||||||
if((CORRADE_TARGET_APPLE AND ${OPENGLES3_LIBRARY} MATCHES "\\.framework$") OR CORRADE_TARGET_EMSCRIPTEN) |
|
||||||
add_library(OpenGLES3::OpenGLES3 INTERFACE IMPORTED) |
|
||||||
set_property(TARGET OpenGLES3::OpenGLES3 APPEND PROPERTY |
|
||||||
INTERFACE_LINK_LIBRARIES ${OPENGLES3_LIBRARY}) |
|
||||||
else() |
|
||||||
add_library(OpenGLES3::OpenGLES3 UNKNOWN IMPORTED) |
|
||||||
set_property(TARGET OpenGLES3::OpenGLES3 PROPERTY |
|
||||||
IMPORTED_LOCATION ${OPENGLES3_LIBRARY}) |
|
||||||
endif() |
|
||||||
|
|
||||||
# Emscripten needs a special flag to use WebGL 2. CMake 3.13 allows to set |
|
||||||
# this via INTERFACE_LINK_OPTIONS, for older versions we modify the global |
|
||||||
# CMAKE_EXE_LINKER_FLAGS inside FindMagnum.cmake. |
|
||||||
if(CORRADE_TARGET_EMSCRIPTEN AND NOT CMAKE_VERSION VERSION_LESS 3.13) |
|
||||||
# I could probably use target_link_options() here, but let's be |
|
||||||
# consistent with the rest |
|
||||||
set_property(TARGET OpenGLES3::OpenGLES3 APPEND PROPERTY |
|
||||||
INTERFACE_LINK_OPTIONS "SHELL:-s USE_WEBGL2=1") |
|
||||||
endif() |
|
||||||
endif() |
|
||||||
|
|
||||||
mark_as_advanced(OPENGLES3_LIBRARY) |
|
||||||
@ -1,173 +0,0 @@ |
|||||||
#.rst: |
|
||||||
# Find SDL2 |
|
||||||
# --------- |
|
||||||
# |
|
||||||
# Finds the SDL2 library. This module defines: |
|
||||||
# |
|
||||||
# SDL2_FOUND - True if SDL2 library is found |
|
||||||
# SDL2::SDL2 - SDL2 imported target |
|
||||||
# |
|
||||||
# Additionally these variables are defined for internal usage: |
|
||||||
# |
|
||||||
# SDL2_LIBRARY_DEBUG - SDL2 debug library, if found |
|
||||||
# SDL2_LIBRARY_RELEASE - SDL2 release library, if found |
|
||||||
# SDL2_INCLUDE_DIR - Root include dir |
|
||||||
# |
|
||||||
|
|
||||||
# |
|
||||||
# This file is part of Magnum. |
|
||||||
# |
|
||||||
# Copyright © 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019 |
|
||||||
# Vladimír Vondruš <mosra@centrum.cz> |
|
||||||
# Copyright © 2018 Jonathan Hale <squareys@googlemail.com> |
|
||||||
# |
|
||||||
# Permission is hereby granted, free of charge, to any person obtaining a |
|
||||||
# copy of this software and associated documentation files (the "Software"), |
|
||||||
# to deal in the Software without restriction, including without limitation |
|
||||||
# the rights to use, copy, modify, merge, publish, distribute, sublicense, |
|
||||||
# and/or sell copies of the Software, and to permit persons to whom the |
|
||||||
# Software is furnished to do so, subject to the following conditions: |
|
||||||
# |
|
||||||
# The above copyright notice and this permission notice shall be included |
|
||||||
# in all copies or substantial portions of the Software. |
|
||||||
# |
|
||||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
|
||||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
|
||||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
|
||||||
# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
|
||||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
|
||||||
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
|
||||||
# DEALINGS IN THE SOFTWARE. |
|
||||||
# |
|
||||||
|
|
||||||
# In Emscripten SDL is linked automatically, thus no need to find the library. |
|
||||||
# Also the includes are in SDL subdirectory, not SDL2. |
|
||||||
if(CORRADE_TARGET_EMSCRIPTEN) |
|
||||||
set(_SDL2_PATH_SUFFIXES SDL) |
|
||||||
else() |
|
||||||
set(_SDL2_PATH_SUFFIXES SDL2) |
|
||||||
if(WIN32) |
|
||||||
# Precompiled libraries for MSVC are in x86/x64 subdirectories |
|
||||||
if(MSVC) |
|
||||||
if(CMAKE_SIZEOF_VOID_P EQUAL 8) |
|
||||||
set(_SDL2_LIBRARY_PATH_SUFFIX lib/x64) |
|
||||||
elseif(CMAKE_SIZEOF_VOID_P EQUAL 4) |
|
||||||
set(_SDL2_LIBRARY_PATH_SUFFIX lib/x86) |
|
||||||
endif() |
|
||||||
|
|
||||||
# Both includes and libraries for MinGW are in some directory deep |
|
||||||
# inside. There's also a CMake config file but it has HARDCODED path |
|
||||||
# to /opt/local/i686-w64-mingw32, which doesn't make ANY SENSE, |
|
||||||
# especially on Windows. |
|
||||||
elseif(MINGW) |
|
||||||
if(CMAKE_SIZEOF_VOID_P EQUAL 8) |
|
||||||
set(_SDL2_LIBRARY_PATH_SUFFIX x86_64-w64-mingw32/lib) |
|
||||||
list(APPEND _SDL2_PATH_SUFFIXES x86_64-w64-mingw32/include/SDL2) |
|
||||||
elseif(CMAKE_SIZEOF_VOID_P EQUAL 4) |
|
||||||
set(_SDL2_LIBRARY_PATH_SUFFIX i686-w64-mingw32/lib) |
|
||||||
list(APPEND _SDL2_PATH_SUFFIXES i686-w64-mingw32/include/SDL2) |
|
||||||
endif() |
|
||||||
endif() |
|
||||||
endif() |
|
||||||
|
|
||||||
find_library(SDL2_LIBRARY_RELEASE |
|
||||||
# Compiling SDL2 from scratch on macOS creates dead libSDL2.so symlink |
|
||||||
# which CMake somehow prefers before the SDL2-2.0.dylib file. Making |
|
||||||
# the dylib first so it is preferred. Not sure how this maps to debug |
|
||||||
# config though :/ |
|
||||||
NAMES SDL2-2.0 SDL2 |
|
||||||
PATH_SUFFIXES ${_SDL2_LIBRARY_PATH_SUFFIX}) |
|
||||||
find_library(SDL2_LIBRARY_DEBUG |
|
||||||
NAMES SDL2d |
|
||||||
PATH_SUFFIXES ${_SDL2_LIBRARY_PATH_SUFFIX}) |
|
||||||
# FPHSA needs one of the _DEBUG/_RELEASE variables to check that the |
|
||||||
# library was found -- using SDL_LIBRARY, which will get populated by |
|
||||||
# select_library_configurations() below. |
|
||||||
set(SDL2_LIBRARY_NEEDED SDL2_LIBRARY) |
|
||||||
endif() |
|
||||||
|
|
||||||
include(SelectLibraryConfigurations) |
|
||||||
select_library_configurations(SDL2) |
|
||||||
|
|
||||||
# Include dir |
|
||||||
find_path(SDL2_INCLUDE_DIR |
|
||||||
# We must search file which is present only in SDL2 and not in SDL1. |
|
||||||
# Apparently when both SDL.h and SDL_scancode.h are specified, CMake is |
|
||||||
# happy enough that it found SDL.h and doesn't bother about the other. |
|
||||||
# |
|
||||||
# On macOS, where the includes are not in SDL2/SDL.h form (which would |
|
||||||
# solve this issue), but rather SDL2.framework/Headers/SDL.h, CMake might |
|
||||||
# find SDL.framework/Headers/SDL.h if SDL1 is installed, which is wrong. |
|
||||||
NAMES SDL_scancode.h |
|
||||||
PATH_SUFFIXES ${_SDL2_PATH_SUFFIXES}) |
|
||||||
|
|
||||||
# iOS dependencies |
|
||||||
if(CORRADE_TARGET_IOS) |
|
||||||
set(_SDL2_FRAMEWORKS |
|
||||||
AudioToolbox |
|
||||||
AVFoundation |
|
||||||
CoreGraphics |
|
||||||
CoreMotion |
|
||||||
Foundation |
|
||||||
GameController |
|
||||||
QuartzCore |
|
||||||
UIKit) |
|
||||||
set(_SDL2_FRAMEWORK_LIBRARIES ) |
|
||||||
foreach(framework ${_SDL2_FRAMEWORKS}) |
|
||||||
find_library(_SDL2_${framework}_LIBRARY ${framework}) |
|
||||||
mark_as_advanced(_SDL2_${framework}_LIBRARY) |
|
||||||
list(APPEND _SDL2_FRAMEWORK_LIBRARIES ${_SDL2_${framework}_LIBRARY}) |
|
||||||
list(APPEND _SDL2_FRAMEWORK_LIBRARY_NAMES _SDL2_${framework}_LIBRARY) |
|
||||||
endforeach() |
|
||||||
endif() |
|
||||||
|
|
||||||
include(FindPackageHandleStandardArgs) |
|
||||||
find_package_handle_standard_args("SDL2" DEFAULT_MSG |
|
||||||
${SDL2_LIBRARY_NEEDED} |
|
||||||
${_SDL2_FRAMEWORK_LIBRARY_NAMES} |
|
||||||
SDL2_INCLUDE_DIR) |
|
||||||
|
|
||||||
if(NOT TARGET SDL2::SDL2) |
|
||||||
if(SDL2_LIBRARY_NEEDED) |
|
||||||
add_library(SDL2::SDL2 UNKNOWN IMPORTED) |
|
||||||
|
|
||||||
# Work around BUGGY framework support on macOS |
|
||||||
# https://cmake.org/Bug/view.php?id=14105 |
|
||||||
if(CORRADE_TARGET_APPLE AND SDL2_LIBRARY_RELEASE MATCHES "\\.framework$") |
|
||||||
set_property(TARGET SDL2::SDL2 APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE) |
|
||||||
set_property(TARGET SDL2::SDL2 PROPERTY IMPORTED_LOCATION_RELEASE ${SDL2_LIBRARY_RELEASE}/SDL2) |
|
||||||
else() |
|
||||||
if(SDL2_LIBRARY_RELEASE) |
|
||||||
set_property(TARGET SDL2::SDL2 APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE) |
|
||||||
set_property(TARGET SDL2::SDL2 PROPERTY IMPORTED_LOCATION_RELEASE ${SDL2_LIBRARY_RELEASE}) |
|
||||||
endif() |
|
||||||
|
|
||||||
if(SDL2_LIBRARY_DEBUG) |
|
||||||
set_property(TARGET SDL2::SDL2 APPEND PROPERTY IMPORTED_CONFIGURATIONS DEBUG) |
|
||||||
set_property(TARGET SDL2::SDL2 PROPERTY IMPORTED_LOCATION_DEBUG ${SDL2_LIBRARY_DEBUG}) |
|
||||||
endif() |
|
||||||
endif() |
|
||||||
|
|
||||||
# Link additional `dl` and `pthread` libraries required by a static |
|
||||||
# build of SDL on Unixy platforms (except Apple, where it is most |
|
||||||
# probably some frameworks instead) |
|
||||||
if(CORRADE_TARGET_UNIX AND NOT CORRADE_TARGET_APPLE AND SDL2_LIBRARY MATCHES "${CMAKE_STATIC_LIBRARY_SUFFIX}$") |
|
||||||
find_package(Threads) |
|
||||||
set_property(TARGET SDL2::SDL2 APPEND PROPERTY |
|
||||||
INTERFACE_LINK_LIBRARIES ${CMAKE_THREAD_LIBS_INIT} ${CMAKE_DL_LIBS}) |
|
||||||
endif() |
|
||||||
|
|
||||||
# Link frameworks on iOS |
|
||||||
if(CORRADE_TARGET_IOS) |
|
||||||
set_property(TARGET SDL2::SDL2 APPEND PROPERTY |
|
||||||
INTERFACE_LINK_LIBRARIES ${_SDL2_FRAMEWORK_LIBRARIES}) |
|
||||||
endif() |
|
||||||
else() |
|
||||||
add_library(SDL2::SDL2 INTERFACE IMPORTED) |
|
||||||
endif() |
|
||||||
|
|
||||||
set_property(TARGET SDL2::SDL2 PROPERTY |
|
||||||
INTERFACE_INCLUDE_DIRECTORIES ${SDL2_INCLUDE_DIR}) |
|
||||||
endif() |
|
||||||
|
|
||||||
mark_as_advanced(SDL2_INCLUDE_DIR) |
|
||||||
@ -1,3 +1,3 @@ |
|||||||
pkg/ |
pkg/ |
||||||
src/ |
src/ |
||||||
*pkg.tar.xz |
*pkg.tar.zst |
||||||
|
|||||||
@ -0,0 +1,41 @@ |
|||||||
|
# Author: mosra <mosra@centrum.cz> |
||||||
|
pkgname=magnum-bindings-git |
||||||
|
pkgver=2020.06.r116.g62a07c3 |
||||||
|
pkgrel=1 |
||||||
|
pkgdesc="Bindings for the Magnum C++11/C++14 graphics engine (Git version)" |
||||||
|
arch=('i686' 'x86_64') |
||||||
|
url="https://magnum.graphics" |
||||||
|
license=('MIT') |
||||||
|
depends=('magnum-git' 'python') |
||||||
|
makedepends=('cmake' 'git' 'ninja' 'pybind11') |
||||||
|
provides=('magnum-bindings') |
||||||
|
conflicts=('magnum-bindings') |
||||||
|
source=("git+https://github.com/mosra/magnum-bindings.git") |
||||||
|
sha1sums=('SKIP') |
||||||
|
|
||||||
|
pkgver() { |
||||||
|
cd "$srcdir/${pkgname%-git}" |
||||||
|
git describe --long | sed -r 's/([^-]*-g)/r\1/;s/-/./g;s/v//g' |
||||||
|
} |
||||||
|
|
||||||
|
build() { |
||||||
|
mkdir -p "$srcdir/build" |
||||||
|
cd "$srcdir/build" |
||||||
|
|
||||||
|
cmake "$srcdir/${pkgname%-git}" \ |
||||||
|
-DCMAKE_BUILD_TYPE=Release \ |
||||||
|
-DCMAKE_INSTALL_PREFIX=/usr \ |
||||||
|
-DMAGNUM_WITH_PYTHON=ON \ |
||||||
|
-G Ninja |
||||||
|
ninja |
||||||
|
} |
||||||
|
|
||||||
|
package() { |
||||||
|
# Helper headers |
||||||
|
cd "$srcdir/build" |
||||||
|
DESTDIR="$pkgdir/" ninja install |
||||||
|
|
||||||
|
# Native and python packages |
||||||
|
cd "$srcdir/build/src/python" |
||||||
|
python setup.py install --root="$pkgdir" --prefix=/usr |
||||||
|
} |
||||||
@ -0,0 +1,499 @@ |
|||||||
|
version: 2.1 |
||||||
|
|
||||||
|
orbs: |
||||||
|
# Version 3.2.4 is the "new" uploader, but it's a 50 MB Node.js *binary* and |
||||||
|
# doesn't work on ARM64 Linux (or ARM Macs, or FreeBSD for that matter) and |
||||||
|
# nobody seems to care. Issues opened since Septembe 2021: |
||||||
|
# https://github.com/codecov/uploader/issues/347 |
||||||
|
# https://github.com/codecov/uploader/issues/523 |
||||||
|
# https://github.com/codecov/uploader/issues/849 |
||||||
|
# The old 1.1.1 still seems to work even though codecov got removed from pip |
||||||
|
# on 2023-04-14. |
||||||
|
codecov: codecov/codecov@1.1.1 |
||||||
|
|
||||||
|
executors: |
||||||
|
ubuntu-18_04: |
||||||
|
docker: |
||||||
|
- image: ubuntu:bionic-20220427 |
||||||
|
# As of November 7, 2025, M4 is the default, and the oldest version there is |
||||||
|
# 14.3.1. |
||||||
|
xcode-14_3: |
||||||
|
macos: |
||||||
|
xcode: 14.3.1 |
||||||
|
arm64: |
||||||
|
machine: |
||||||
|
image: ubuntu-2004:2023.07.1 |
||||||
|
resource_class: arm.medium |
||||||
|
|
||||||
|
commands: |
||||||
|
install-base-linux: |
||||||
|
parameters: |
||||||
|
extra: |
||||||
|
type: string |
||||||
|
default: "" |
||||||
|
sudo: |
||||||
|
type: string |
||||||
|
default: "" |
||||||
|
steps: |
||||||
|
- run: |
||||||
|
name: Update apt and install base packages |
||||||
|
# Git is needed always for cloning Corrade etc |
||||||
|
command: | |
||||||
|
<< parameters.sudo >> apt update |
||||||
|
if [[ "$CMAKE_CXX_FLAGS" == *"--coverage"* ]]; then export LCOV_PACKAGES="lcov curl"; fi |
||||||
|
<< parameters.sudo >> apt install -y git ninja-build $LCOV_PACKAGES << parameters.extra >> |
||||||
|
|
||||||
|
install-base-macos: |
||||||
|
parameters: |
||||||
|
extra: |
||||||
|
type: string |
||||||
|
default: "" |
||||||
|
steps: |
||||||
|
- run: |
||||||
|
name: Install base packages |
||||||
|
# As usual, homebrew takes five minutes to update and then explodes in |
||||||
|
# a spectacular way. How is this acceptable?! |
||||||
|
command: | |
||||||
|
if [[ "$CMAKE_CXX_FLAGS" == *"--coverage"* ]]; then export LCOV_PACKAGES="lcov"; fi |
||||||
|
HOMEBREW_NO_AUTO_UPDATE=1 brew install cmake ninja $LCOV_PACKAGES << parameters.extra >> |
||||||
|
- run: |
||||||
|
name: Uninstall the pyenv crap and install plain python instead |
||||||
|
# Otherwise the numpy installed by homebrew is unreachable by actual |
||||||
|
# user-side python. THIS ALL USED TO WORK BUT NOT ANYMORE. They |
||||||
|
# subsequently added `brew pyenv-sync` in an attempt to fix this trash |
||||||
|
# fire, but that damn thing doesn't work at all either. Fuck it, then. |
||||||
|
# https://github.com/orgs/Homebrew/discussions/4664 |
||||||
|
# https://github.com/Homebrew/brew/issues/17563 |
||||||
|
command: | |
||||||
|
HOMEBREW_NO_AUTO_UPDATE=1 brew remove pyenv |
||||||
|
HOMEBREW_NO_AUTO_UPDATE=1 brew install python |
||||||
|
rm -r ~/.pyenv |
||||||
|
|
||||||
|
install-gcc-4_8: |
||||||
|
steps: |
||||||
|
- run: |
||||||
|
name: Install GCC 4.8 |
||||||
|
# For some reason, CMake needs a working C compiler, so provice CC as |
||||||
|
# well for the case when default gcc isn't installed. |
||||||
|
command: | |
||||||
|
apt install -y g++-4.8 |
||||||
|
echo 'export CC=gcc-4.8' >> $BASH_ENV |
||||||
|
echo 'export CXX=g++-4.8' >> $BASH_ENV |
||||||
|
|
||||||
|
install-cmake: |
||||||
|
parameters: |
||||||
|
version: |
||||||
|
type: string |
||||||
|
sudo: |
||||||
|
type: string |
||||||
|
default: "" |
||||||
|
steps: |
||||||
|
- run: |
||||||
|
name: Install CMake << parameters.version >> |
||||||
|
command: | |
||||||
|
version_short=<< parameters.version >> |
||||||
|
version_short="${version_short%.*}" |
||||||
|
<< parameters.sudo >> apt install -y wget |
||||||
|
mkdir -p $HOME/cmake && cd $HOME/cmake |
||||||
|
wget -nc --no-check-certificate https://cmake.org/files/v$version_short/cmake-<< parameters.version >>-Linux-x86_64.tar.gz |
||||||
|
tar --strip-components=1 -xzf cmake-<< parameters.version >>-Linux-x86_64.tar.gz |
||||||
|
echo 'export PATH=$HOME/cmake/bin:$PATH' >> $BASH_ENV |
||||||
|
source $BASH_ENV |
||||||
|
cmake --version | grep << parameters.version >> |
||||||
|
ctest --version | grep << parameters.version >> |
||||||
|
|
||||||
|
install-python-3_6: |
||||||
|
# Can't use the python3.6 docker image because there I can't install GCC |
||||||
|
# 4.8. Loosely based on https://gist.github.com/monkut/c4c07059444fd06f3f8661e13ccac619 |
||||||
|
# The deadsnakes PPA no longer supports 16.04, so this repo builds against |
||||||
|
# 18.04. |
||||||
|
steps: |
||||||
|
- run: |
||||||
|
name: Install Python 3.6 and numpy |
||||||
|
# The software-properties-common need to be installed in order to have |
||||||
|
# apt-add-repository. Sigh, adding a repository should be a core |
||||||
|
# feature ffs! |
||||||
|
# |
||||||
|
# Also, "Press ENTER to continue." Are we still in the DOS days?! |
||||||
|
# |
||||||
|
# Setting up 3.6 as the default is OF COURSE one command more than |
||||||
|
# would be acceptable, but am I surprised on this distro?! |
||||||
|
command: | |
||||||
|
apt install -y software-properties-common |
||||||
|
echo -e "\n" | add-apt-repository ppa:deadsnakes/ppa |
||||||
|
apt update |
||||||
|
apt install -y python3.6 python3.6-dev python3-pip |
||||||
|
|
||||||
|
update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.6 10 |
||||||
|
|
||||||
|
python3 --version | grep 3.6 |
||||||
|
|
||||||
|
python3 -m pip install pip --upgrade |
||||||
|
python3 -m pip install wheel |
||||||
|
|
||||||
|
pip3 install numpy |
||||||
|
|
||||||
|
install-pybind11: |
||||||
|
parameters: |
||||||
|
version: |
||||||
|
type: string |
||||||
|
default: "2.3.0" |
||||||
|
steps: |
||||||
|
- run: |
||||||
|
name: Install Pybind11 << parameters.version >> |
||||||
|
command: | |
||||||
|
cd $HOME |
||||||
|
wget --no-clobber https://github.com/pybind/pybind11/archive/v<< parameters.version >>.tar.gz |
||||||
|
tar -xzf v<< parameters.version >>.tar.gz |
||||||
|
cd pybind11-<< parameters.version >> |
||||||
|
mkdir -p build && cd build |
||||||
|
cmake .. \ |
||||||
|
-DCMAKE_INSTALL_PREFIX=$HOME/pybind11 \ |
||||||
|
-DPYBIND11_PYTHON_VERSION=3.6 \ |
||||||
|
-DPYBIND11_TEST=OFF \ |
||||||
|
-G Ninja |
||||||
|
ninja install |
||||||
|
|
||||||
|
install-swiftshader-gles: |
||||||
|
parameters: |
||||||
|
build: |
||||||
|
type: string |
||||||
|
steps: |
||||||
|
- run: |
||||||
|
name: Install SwiftShader GLES |
||||||
|
# Zip from https://github.com/mosra/magnum-ci/tree/swiftshader and |
||||||
|
# self-hosted because GH Actions would make it too simple for people if |
||||||
|
# you could just download the artifacts directly, right? RIGHT? |
||||||
|
command: | |
||||||
|
mkdir -p $HOME/swiftshader && cd $HOME/swiftshader |
||||||
|
wget https://ci.magnum.graphics/swiftshader-gles-r5904.14dcbed947-<< parameters.build >>.zip |
||||||
|
unzip swiftshader-gles-r5904.14dcbed947-<< parameters.build >>.zip |
||||||
|
|
||||||
|
install-meshoptimizer: |
||||||
|
steps: |
||||||
|
- run: |
||||||
|
name: Install meshoptimizer |
||||||
|
# few commits after 0.14 with a fix for old Apple Clang |
||||||
|
command: | |
||||||
|
export MESHOPTIMIZER_VERSION=97c52415c6d29f297a76482ddde22f739292446d |
||||||
|
mkdir -p $HOME/meshoptimizer && cd $HOME/meshoptimizer |
||||||
|
wget -nc --no-check-certificate https://github.com/zeux/meshoptimizer/archive/$MESHOPTIMIZER_VERSION.tar.gz |
||||||
|
tar --strip-components=1 -xzf $MESHOPTIMIZER_VERSION.tar.gz |
||||||
|
mkdir build && cd build |
||||||
|
cmake .. -DCMAKE_BUILD_TYPE=Debug \ |
||||||
|
-DCMAKE_POSITION_INDEPENDENT_CODE=ON \ |
||||||
|
-DCMAKE_INSTALL_PREFIX=$HOME/deps \ |
||||||
|
-G Ninja |
||||||
|
ninja install |
||||||
|
|
||||||
|
build: |
||||||
|
parameters: |
||||||
|
script: |
||||||
|
type: string |
||||||
|
steps: |
||||||
|
- run: |
||||||
|
name: Install coverage |
||||||
|
command: pip3 install coverage |
||||||
|
- checkout |
||||||
|
- run: |
||||||
|
name: Build & test |
||||||
|
command: | |
||||||
|
if [ "$BUILD_STATIC" != "ON" ]; then export BUILD_STATIC=OFF; fi |
||||||
|
if [ "$BUILD_DEPRECATED" != "OFF" ]; then export BUILD_DEPRECATED=ON; fi |
||||||
|
./package/ci/<< parameters.script >> |
||||||
|
|
||||||
|
# Official docs say "token not needed for public repos", in reality not using |
||||||
|
# the token is "extremely flakey". What's best is that if the upload fails, |
||||||
|
# the damn thing exits with a success error code, and nobody cares: |
||||||
|
# https://github.com/codecov/codecov-circleci-orb/issues/139 |
||||||
|
upload-codecov: |
||||||
|
parameters: |
||||||
|
file: |
||||||
|
type: string |
||||||
|
steps: |
||||||
|
# Second best thing is that the codecov/upload helper takes a `token` |
||||||
|
# parameter. But the token parameter is an ENVIRONMENT VARIABLE NAME!! So |
||||||
|
# one just *can't* pass the token there. It got changed arbitrarily in |
||||||
|
# https://github.com/codecov/codecov-circleci-orb/pull/93 "because |
||||||
|
# CircleCI docs suggested so", yet all codecov docs suggest just |
||||||
|
# commiting that token directly to the YML files because "it's fine". So |
||||||
|
# if it's fine, why do I have to suffer like this?! |
||||||
|
- run: |
||||||
|
name: Set codecov upload token because everything is a dumpster fire |
||||||
|
# An icing on the cake is that CircleCI commands don't allow setting |
||||||
|
# `environment` for `commands`, only for `jobs`, so I have to do that |
||||||
|
# via bash, and because the environment isn't passsed from a run to |
||||||
|
# run, use the BASH_ENV hack. Mmm. Technology. |
||||||
|
command: | |
||||||
|
echo 'export CODECOV_TOKEN=ade9e2f1-d6d7-45cb-a292-c5bb1ad45be9' >> "$BASH_ENV" |
||||||
|
- codecov/upload: |
||||||
|
file: << parameters.file >> |
||||||
|
|
||||||
|
lcov: |
||||||
|
parameters: |
||||||
|
extra: |
||||||
|
type: string |
||||||
|
default: "" |
||||||
|
steps: |
||||||
|
- run: |
||||||
|
name: Collect code coverage |
||||||
|
# Keep in sync with PKBUILD-coverage, please |
||||||
|
command: | |
||||||
|
lcov << parameters.extra >> --directory . --capture --output-file coverage.info > /dev/null |
||||||
|
lcov << parameters.extra >> --extract coverage.info "*/src/python/*" "*/src/Corrade/*" "*/src/Magnum/*" --output-file coverage.info > /dev/null |
||||||
|
cd src/python && coverage combine |
||||||
|
- upload-codecov: |
||||||
|
file: coverage.info |
||||||
|
|
||||||
|
jobs: |
||||||
|
linux-gl: |
||||||
|
executor: ubuntu-18_04 |
||||||
|
environment: |
||||||
|
CMAKE_CXX_FLAGS: --coverage |
||||||
|
PLATFORM_GL_API: GLX |
||||||
|
# It crashes (OOM, probably) with the default setting |
||||||
|
NINJA_JOBS: -j2 |
||||||
|
steps: |
||||||
|
# libidn11 needed by CMake |
||||||
|
- install-base-linux: |
||||||
|
extra: libidn11 libgl1-mesa-dev libsdl2-dev libglfw3-dev |
||||||
|
- install-gcc-4_8 |
||||||
|
- install-cmake: |
||||||
|
version: "3.5.2" |
||||||
|
- install-python-3_6 |
||||||
|
- install-pybind11 |
||||||
|
- install-meshoptimizer |
||||||
|
- build: |
||||||
|
script: unix-desktop.sh |
||||||
|
- lcov: |
||||||
|
extra: --gcov-tool /usr/bin/gcov-4.8 |
||||||
|
|
||||||
|
linux-arm64: |
||||||
|
executor: arm64 |
||||||
|
environment: |
||||||
|
CMAKE_CXX_FLAGS: --coverage |
||||||
|
PLATFORM_GL_API: GLX |
||||||
|
steps: |
||||||
|
# Not installing the old GCC 4.8 and CMake 3.5 to speed up. These are |
||||||
|
# tested more than enough on other jobs. Machine executors need sudo. |
||||||
|
- install-base-linux: |
||||||
|
extra: gcc cmake libgl1-mesa-dev libsdl2-dev libglfw3-dev libpython3-dev |
||||||
|
sudo: sudo |
||||||
|
# 2.3.0 doesn't work with Python 3.11, this one should |
||||||
|
- install-pybind11: |
||||||
|
version: "2.11.1" |
||||||
|
- run: |
||||||
|
name: Install numpy |
||||||
|
command: pip3 install numpy |
||||||
|
- install-meshoptimizer |
||||||
|
- build: |
||||||
|
script: unix-desktop.sh |
||||||
|
- lcov |
||||||
|
|
||||||
|
linux-gles2: |
||||||
|
executor: ubuntu-18_04 |
||||||
|
environment: |
||||||
|
CMAKE_CXX_FLAGS: --coverage |
||||||
|
PLATFORM_GL_API: EGL |
||||||
|
# STUPID yml interprets unquoted ON as a boolean |
||||||
|
TARGET_GLES2: "ON" |
||||||
|
# It crashes (OOM, probably) with the default setting |
||||||
|
NINJA_JOBS: -j2 |
||||||
|
steps: |
||||||
|
# libidn11 needed by CMake |
||||||
|
- install-base-linux: |
||||||
|
extra: libidn11 libsdl2-dev libglfw3-dev wget unzip |
||||||
|
- install-gcc-4_8 |
||||||
|
- install-cmake: |
||||||
|
version: "3.5.2" |
||||||
|
- install-python-3_6 |
||||||
|
- install-pybind11 |
||||||
|
- install-meshoptimizer |
||||||
|
- install-swiftshader-gles: |
||||||
|
build: ubuntu-18.04 |
||||||
|
- build: |
||||||
|
script: unix-desktop-gles.sh |
||||||
|
- lcov: |
||||||
|
extra: --gcov-tool /usr/bin/gcov-4.8 |
||||||
|
|
||||||
|
linux-gles3: |
||||||
|
executor: ubuntu-18_04 |
||||||
|
environment: |
||||||
|
CMAKE_CXX_FLAGS: --coverage |
||||||
|
PLATFORM_GL_API: EGL |
||||||
|
# STUPID yml interprets unquoted OFF as a boolean |
||||||
|
TARGET_GLES2: "OFF" |
||||||
|
# It crashes (OOM, probably) with the default setting |
||||||
|
NINJA_JOBS: -j2 |
||||||
|
steps: |
||||||
|
# libidn11 needed by CMake |
||||||
|
- install-base-linux: |
||||||
|
extra: libidn11 libsdl2-dev libglfw3-dev wget unzip |
||||||
|
- install-gcc-4_8 |
||||||
|
- install-cmake: |
||||||
|
version: "3.5.2" |
||||||
|
- install-python-3_6 |
||||||
|
- install-pybind11 |
||||||
|
- install-meshoptimizer |
||||||
|
- install-swiftshader-gles: |
||||||
|
build: ubuntu-18.04 |
||||||
|
- build: |
||||||
|
script: unix-desktop-gles.sh |
||||||
|
- lcov: |
||||||
|
extra: --gcov-tool /usr/bin/gcov-4.8 |
||||||
|
|
||||||
|
linux-static: |
||||||
|
executor: ubuntu-18_04 |
||||||
|
environment: |
||||||
|
# STUPID yml interprets unquoted ON as a boolean |
||||||
|
# https://stackoverflow.com/questions/53648244/specifying-the-string-value-yes-in-a-yaml-property |
||||||
|
BUILD_STATIC: "ON" |
||||||
|
CMAKE_CXX_FLAGS: --coverage |
||||||
|
PLATFORM_GL_API: GLX |
||||||
|
# It crashes (OOM, probably) with the default setting |
||||||
|
NINJA_JOBS: -j2 |
||||||
|
steps: |
||||||
|
# libidn11 needed by CMake |
||||||
|
- install-base-linux: |
||||||
|
extra: libidn11 libsdl2-dev libglfw3-dev |
||||||
|
- install-gcc-4_8 |
||||||
|
- install-cmake: |
||||||
|
version: "3.5.2" |
||||||
|
- install-python-3_6 |
||||||
|
- install-pybind11 |
||||||
|
- install-meshoptimizer |
||||||
|
- build: |
||||||
|
script: unix-desktop.sh |
||||||
|
- lcov: |
||||||
|
extra: --gcov-tool /usr/bin/gcov-4.8 |
||||||
|
|
||||||
|
linux-nondeprecated: |
||||||
|
executor: ubuntu-18_04 |
||||||
|
environment: |
||||||
|
# STUPID yml interprets unquoted OFF as a boolean |
||||||
|
BUILD_DEPRECATED: "OFF" |
||||||
|
CMAKE_CXX_FLAGS: --coverage |
||||||
|
PLATFORM_GL_API: GLX |
||||||
|
# It crashes (OOM, probably) with the default setting |
||||||
|
NINJA_JOBS: -j2 |
||||||
|
steps: |
||||||
|
# libidn11 needed by CMake |
||||||
|
- install-base-linux: |
||||||
|
extra: libidn11 libgl1-mesa-dev libsdl2-dev libglfw3-dev |
||||||
|
- install-gcc-4_8 |
||||||
|
- install-cmake: |
||||||
|
version: "3.5.2" |
||||||
|
- install-python-3_6 |
||||||
|
- install-pybind11 |
||||||
|
- install-meshoptimizer |
||||||
|
- build: |
||||||
|
script: unix-desktop.sh |
||||||
|
- lcov: |
||||||
|
extra: --gcov-tool /usr/bin/gcov-4.8 |
||||||
|
|
||||||
|
macos-gl: |
||||||
|
executor: xcode-14_3 |
||||||
|
environment: |
||||||
|
# Make libc++ remove transitive includes, both for faster build times and |
||||||
|
# to detect if we're missing a transitive include. Works with libc++ 16+, |
||||||
|
# which is used by Xcode 15 (i.e., will get used on the next CircleCI |
||||||
|
# executor update). |
||||||
|
CMAKE_CXX_FLAGS: --coverage -D_LIBCPP_REMOVE_TRANSITIVE_INCLUDES |
||||||
|
PLATFORM_GL_API: CGL |
||||||
|
steps: |
||||||
|
- install-base-macos: |
||||||
|
extra: sdl2 glfw wget numpy pybind11 |
||||||
|
- install-meshoptimizer |
||||||
|
- build: |
||||||
|
script: unix-desktop.sh |
||||||
|
# The 14.3 image seems to have the new lcov, which is very picky and throws |
||||||
|
# errors about a ton of little things, 14.0.1 and older didn't |
||||||
|
- lcov: |
||||||
|
extra: --ignore-errors inconsistent |
||||||
|
|
||||||
|
macos-gles3: |
||||||
|
executor: xcode-14_3 |
||||||
|
environment: |
||||||
|
# Make libc++ remove transitive includes, both for faster build times and |
||||||
|
# to detect if we're missing a transitive include. Works with libc++ 16+, |
||||||
|
# which is used by Xcode 15 (i.e., will get used on the next CircleCI |
||||||
|
# executor update). |
||||||
|
CMAKE_CXX_FLAGS: --coverage -D_LIBCPP_REMOVE_TRANSITIVE_INCLUDES |
||||||
|
PLATFORM_GL_API: EGL |
||||||
|
# STUPID yml interprets unquoted OFF as a boolean |
||||||
|
TARGET_GLES2: "OFF" |
||||||
|
steps: |
||||||
|
- install-base-macos: |
||||||
|
extra: sdl2 glfw wget numpy pybind11 |
||||||
|
- install-swiftshader-gles: |
||||||
|
build: macos12-arm64 |
||||||
|
- install-meshoptimizer |
||||||
|
- build: |
||||||
|
script: unix-desktop-gles.sh |
||||||
|
# The 14.3 image seems to have the new lcov, which is very picky and throws |
||||||
|
# errors about a ton of little things, 14.0.1 and older didn't |
||||||
|
- lcov: |
||||||
|
extra: --ignore-errors inconsistent |
||||||
|
|
||||||
|
macos-static: |
||||||
|
executor: xcode-14_3 |
||||||
|
environment: |
||||||
|
# STUPID yml interprets unquoted ON as a boolean |
||||||
|
BUILD_STATIC: "ON" |
||||||
|
# Make libc++ remove transitive includes, both for faster build times and |
||||||
|
# to detect if we're missing a transitive include. Works with libc++ 16+, |
||||||
|
# which is used by Xcode 15 (i.e., will get used on the next CircleCI |
||||||
|
# executor update). |
||||||
|
CMAKE_CXX_FLAGS: --coverage -D_LIBCPP_REMOVE_TRANSITIVE_INCLUDES |
||||||
|
PLATFORM_GL_API: CGL |
||||||
|
steps: |
||||||
|
- install-base-macos: |
||||||
|
extra: sdl2 glfw wget numpy pybind11 |
||||||
|
- install-meshoptimizer |
||||||
|
- build: |
||||||
|
script: unix-desktop.sh |
||||||
|
# The 14.3 image seems to have the new lcov, which is very picky and throws |
||||||
|
# errors about a ton of little things, 14.0.1 and older didn't |
||||||
|
- lcov: |
||||||
|
extra: --ignore-errors inconsistent |
||||||
|
|
||||||
|
workflows: |
||||||
|
version: 2 |
||||||
|
build: |
||||||
|
# While there's no actual execution or data dependency between the jobs, |
||||||
|
# this is done in order to reduce unnecessary credit usage. The GL and |
||||||
|
# non-deprecated Linux builds are taken as the main sanity checks. Only if |
||||||
|
# they pass, the rest of the jobs gets gradually executed, with further |
||||||
|
# dependencies especially for the macOS jobs that take the most credits. |
||||||
|
jobs: |
||||||
|
- linux-gl |
||||||
|
- linux-nondeprecated |
||||||
|
- linux-arm64: |
||||||
|
requires: |
||||||
|
- linux-gl |
||||||
|
- linux-nondeprecated |
||||||
|
- linux-gles2: |
||||||
|
requires: |
||||||
|
- linux-gl |
||||||
|
- linux-nondeprecated |
||||||
|
- linux-gles3: |
||||||
|
requires: |
||||||
|
- linux-gl |
||||||
|
- linux-nondeprecated |
||||||
|
- linux-static: |
||||||
|
requires: |
||||||
|
- linux-gl |
||||||
|
- linux-nondeprecated |
||||||
|
- macos-gl: |
||||||
|
requires: |
||||||
|
- linux-arm64 |
||||||
|
- linux-gl |
||||||
|
- linux-nondeprecated |
||||||
|
- macos-gles3: |
||||||
|
requires: |
||||||
|
- linux-gles3 |
||||||
|
- macos-gl |
||||||
|
- macos-static: |
||||||
|
requires: |
||||||
|
- linux-static |
||||||
|
- macos-gl |
||||||
@ -1,9 +1,9 @@ |
|||||||
fixes: |
fixes: |
||||||
# The src/python/magnum/__init__.py is copied to cmake's build dir together |
# The src/python/magnum/__init__.py is copied to cmake's build dir together |
||||||
# with # setup.py next to the C++ binaries and the test is done from here. |
# with setup.py next to the C++ binaries and the test is done from here. |
||||||
# Python's coverage.py reports an absolute path to it, which means a simple |
# Python's coverage.py reports an absolute path to it, which means a simple |
||||||
# "build/src/python/::src/python/" won't suffice. This is hardcoded to Travis |
# "build/src/python/::src/python/" won't suffice. This is hardcoded to CircleCI |
||||||
# Linux / macOS and AppVeyor build paths so let's hope these won't change. |
# Linux / macOS and AppVeyor build paths so let's hope these won't change. |
||||||
- "/home/travis/build/mosra/magnum-bindings/build/src/python/::src/python/" |
- "/root/project/build/src/python/::src/python/" |
||||||
- "/Users/travis/build/mosra/magnum-bindings/build/src/python/::src/python/" |
- "/Users/distiller/project/build/src/python/::src/python/" |
||||||
- "C:/projects/magnum-bindings/build/src/python/::src/python/" |
- "C:/projects/magnum-bindings/build/src/python/::src/python/" |
||||||
|
|||||||
@ -1,13 +0,0 @@ |
|||||||
set -e |
|
||||||
|
|
||||||
wget --no-clobber https://github.com/pybind/pybind11/archive/v2.3.0.tar.gz && tar -xzf v2.3.0.tar.gz |
|
||||||
|
|
||||||
cd pybind11-2.3.0 |
|
||||||
|
|
||||||
mkdir -p build && cd build |
|
||||||
cmake .. \ |
|
||||||
-DCMAKE_INSTALL_PREFIX=$HOME/pybind11 \ |
|
||||||
-DPYBIND11_PYTHON_VERSION=3.6 \ |
|
||||||
-DPYBIND11_TEST=OFF \ |
|
||||||
-G Ninja |
|
||||||
ninja install |
|
||||||
@ -1,80 +0,0 @@ |
|||||||
#!/bin/bash |
|
||||||
set -ev |
|
||||||
|
|
||||||
# Corrade |
|
||||||
git clone --depth 1 git://github.com/mosra/corrade.git |
|
||||||
cd corrade |
|
||||||
mkdir build && cd build |
|
||||||
cmake .. \ |
|
||||||
-DCMAKE_INSTALL_PREFIX=$HOME/deps \ |
|
||||||
-DCMAKE_INSTALL_RPATH=$HOME/deps/lib \ |
|
||||||
-DCMAKE_BUILD_TYPE=Release \ |
|
||||||
-DBUILD_DEPRECATED=$BUILD_DEPRECATED \ |
|
||||||
-DWITH_INTERCONNECT=OFF \ |
|
||||||
-DWITH_PLUGINMANAGER=ON \ |
|
||||||
-DWITH_TESTSUITE=OFF \ |
|
||||||
-G Ninja |
|
||||||
ninja install |
|
||||||
cd ../.. |
|
||||||
|
|
||||||
# Magnum |
|
||||||
git clone --depth 1 git://github.com/mosra/magnum.git |
|
||||||
cd magnum |
|
||||||
mkdir build && cd build |
|
||||||
cmake .. \ |
|
||||||
-DCMAKE_INSTALL_PREFIX=$HOME/deps \ |
|
||||||
-DCMAKE_INSTALL_RPATH=$HOME/deps/lib \ |
|
||||||
-DCMAKE_BUILD_TYPE=Release \ |
|
||||||
-DEGL_LIBRARY=$HOME/swiftshader/libEGL.so \ |
|
||||||
-DOPENGLES2_LIBRARY=$HOME/swiftshader/libGLESv2.so \ |
|
||||||
-DOPENGLES3_LIBRARY=$HOME/swiftshader/libGLESv2.so \ |
|
||||||
-DCMAKE_INSTALL_RPATH=$HOME/swiftshader \ |
|
||||||
-DTARGET_GLES=ON \ |
|
||||||
-DTARGET_GLES2=$TARGET_GLES2 \ |
|
||||||
-DWITH_AUDIO=OFF \ |
|
||||||
-DWITH_DEBUGTOOLS=OFF \ |
|
||||||
-DWITH_GL=ON \ |
|
||||||
-DWITH_MESHTOOLS=ON \ |
|
||||||
-DWITH_PRIMITIVES=ON \ |
|
||||||
-DWITH_SCENEGRAPH=ON \ |
|
||||||
-DWITH_SHADERS=ON \ |
|
||||||
-DWITH_TEXT=OFF \ |
|
||||||
-DWITH_TEXTURETOOLS=OFF \ |
|
||||||
-DWITH_TRADE=ON \ |
|
||||||
-DWITH_VK=OFF \ |
|
||||||
-DWITH_WINDOWLESSEGLAPPLICATION=ON \ |
|
||||||
-DBUILD_DEPRECATED=OFF \ |
|
||||||
-G Ninja |
|
||||||
ninja install |
|
||||||
cd ../.. |
|
||||||
|
|
||||||
# Build the thing |
|
||||||
mkdir build && cd build |
|
||||||
cmake .. \ |
|
||||||
-DCMAKE_CXX_FLAGS="--coverage" \ |
|
||||||
-DCMAKE_INSTALL_PREFIX=$HOME/deps \ |
|
||||||
-DCMAKE_BUILD_TYPE=Debug \ |
|
||||||
-DCMAKE_PREFIX_PATH=$HOME/pybind11 \ |
|
||||||
-DEGL_LIBRARY=$HOME/swiftshader/libEGL.so \ |
|
||||||
-DOPENGLES2_LIBRARY=$HOME/swiftshader/libGLESv2.so \ |
|
||||||
-DOPENGLES3_LIBRARY=$HOME/swiftshader/libGLESv2.so \ |
|
||||||
-DCMAKE_INSTALL_RPATH=$HOME/swiftshader \ |
|
||||||
-DPYBIND11_PYTHON_VERSION=3.6 \ |
|
||||||
-DWITH_PYTHON=ON \ |
|
||||||
-G Ninja |
|
||||||
ninja |
|
||||||
|
|
||||||
# Verify the setuptools install |
|
||||||
cd src/python |
|
||||||
python3 setup.py install --root="$TRAVIS_BUILD_DIR/install" --prefix=/usr |
|
||||||
|
|
||||||
# Run tests & gather coverage |
|
||||||
cd ../../../src/python/corrade |
|
||||||
coverage run -m unittest -v && cp .coverage ../.coverage.corrade |
|
||||||
|
|
||||||
cd ../magnum |
|
||||||
coverage run -m unittest -v && cp .coverage ../.coverage.magnum |
|
||||||
|
|
||||||
# Test docstring validity |
|
||||||
cd ../../../doc/python |
|
||||||
PYTHONPATH="$TRAVIS_BUILD_DIR/build/src/python" python3 -m doctest -v *.rst |
|
||||||
@ -1,74 +0,0 @@ |
|||||||
#!/bin/bash |
|
||||||
set -ev |
|
||||||
|
|
||||||
# Corrade |
|
||||||
git clone --depth 1 git://github.com/mosra/corrade.git |
|
||||||
cd corrade |
|
||||||
mkdir build && cd build |
|
||||||
cmake .. \ |
|
||||||
-DCMAKE_INSTALL_PREFIX=$HOME/deps \ |
|
||||||
-DCMAKE_INSTALL_RPATH=$HOME/deps/lib \ |
|
||||||
-DCMAKE_BUILD_TYPE=Release \ |
|
||||||
-DBUILD_DEPRECATED=OFF \ |
|
||||||
-DBUILD_STATIC=$BUILD_STATIC \ |
|
||||||
-DWITH_INTERCONNECT=OFF \ |
|
||||||
-DWITH_PLUGINMANAGER=ON \ |
|
||||||
-DWITH_TESTSUITE=OFF \ |
|
||||||
-G Ninja |
|
||||||
ninja install |
|
||||||
cd ../.. |
|
||||||
|
|
||||||
# Magnum |
|
||||||
git clone --depth 1 git://github.com/mosra/magnum.git |
|
||||||
cd magnum |
|
||||||
mkdir build && cd build |
|
||||||
cmake .. \ |
|
||||||
-DCMAKE_INSTALL_PREFIX=$HOME/deps \ |
|
||||||
-DCMAKE_INSTALL_RPATH=$HOME/deps/lib \ |
|
||||||
-DCMAKE_BUILD_TYPE=Release \ |
|
||||||
-DBUILD_DEPRECATED=OFF \ |
|
||||||
-DBUILD_STATIC=$BUILD_STATIC \ |
|
||||||
-DWITH_AUDIO=OFF \ |
|
||||||
-DWITH_DEBUGTOOLS=OFF \ |
|
||||||
-DWITH_GL=ON \ |
|
||||||
-DWITH_MESHTOOLS=ON \ |
|
||||||
-DWITH_PRIMITIVES=ON \ |
|
||||||
-DWITH_SCENEGRAPH=ON \ |
|
||||||
-DWITH_SHADERS=ON \ |
|
||||||
-DWITH_TEXT=OFF \ |
|
||||||
-DWITH_TEXTURETOOLS=OFF \ |
|
||||||
-DWITH_TRADE=ON \ |
|
||||||
-DWITH_VK=OFF \ |
|
||||||
-DWITH_GLFWAPPLICATION=ON \ |
|
||||||
-DWITH_SDL2APPLICATION=ON \ |
|
||||||
-DWITH_WINDOWLESS${PLATFORM_GL_API}APPLICATION=ON \ |
|
||||||
-G Ninja |
|
||||||
ninja install |
|
||||||
cd ../.. |
|
||||||
|
|
||||||
# Build the thing |
|
||||||
mkdir build && cd build |
|
||||||
cmake .. \ |
|
||||||
-DCMAKE_CXX_FLAGS="--coverage" \ |
|
||||||
-DCMAKE_INSTALL_PREFIX=$HOME/deps \ |
|
||||||
-DCMAKE_BUILD_TYPE=Debug \ |
|
||||||
-DCMAKE_PREFIX_PATH=$HOME/pybind11 \ |
|
||||||
-DPYBIND11_PYTHON_VERSION=3.6 \ |
|
||||||
-DWITH_PYTHON=ON \ |
|
||||||
-G Ninja |
|
||||||
ninja |
|
||||||
|
|
||||||
# Verify the setuptools install |
|
||||||
cd src/python |
|
||||||
python3 setup.py install --root="$TRAVIS_BUILD_DIR/install" --prefix=/usr |
|
||||||
|
|
||||||
# Run tests & gather coverage |
|
||||||
cd ../../../src/python/corrade |
|
||||||
coverage run -m unittest -v && cp .coverage ../.coverage.corrade |
|
||||||
|
|
||||||
cd ../magnum |
|
||||||
MAGNUM_SKIP_GL_TESTS=ON coverage run -m unittest -v && cp .coverage ../.coverage.magnum |
|
||||||
|
|
||||||
# Test docstring validity |
|
||||||
cd ../../../doc/python |
|
||||||
PYTHONPATH="$TRAVIS_BUILD_DIR/build/src/python" python3 -m doctest -v *.rst |
|
||||||
@ -1,146 +0,0 @@ |
|||||||
addons: |
|
||||||
apt: |
|
||||||
packages: |
|
||||||
- g++-4.8 |
|
||||||
- libgl1-mesa-dev |
|
||||||
- ninja-build |
|
||||||
- lcov |
|
||||||
- libsdl2-dev |
|
||||||
- libglfw3-dev |
|
||||||
|
|
||||||
matrix: |
|
||||||
include: |
|
||||||
- language: python |
|
||||||
python: 3.6 |
|
||||||
os: linux |
|
||||||
dist: xenial |
|
||||||
compiler: gcc |
|
||||||
env: |
|
||||||
- JOBID=linux-gl |
|
||||||
- TARGET=desktop |
|
||||||
- LCOV_EXTRA_OPTS="--gcov-tool /usr/bin/gcov-4.8" |
|
||||||
- language: python |
|
||||||
python: 3.6 |
|
||||||
os: linux |
|
||||||
dist: xenial |
|
||||||
compiler: gcc |
|
||||||
env: |
|
||||||
- JOBID=linux-gles2 |
|
||||||
- TARGET=desktop-gles |
|
||||||
- TARGET_GLES2=ON |
|
||||||
- CMAKE_CXX_FLAGS="--coverage" |
|
||||||
- LCOV_EXTRA_OPTS="--gcov-tool /usr/bin/gcov-4.8" |
|
||||||
addons: |
|
||||||
apt: |
|
||||||
packages: |
|
||||||
- g++-4.8 |
|
||||||
- ninja-build |
|
||||||
- lcov |
|
||||||
- libsdl2-dev |
|
||||||
- libglfw3-dev |
|
||||||
- language: python |
|
||||||
python: 3.6 |
|
||||||
os: linux |
|
||||||
dist: xenial |
|
||||||
compiler: gcc |
|
||||||
env: |
|
||||||
- JOBID=linux-gles3 |
|
||||||
- TARGET=desktop-gles |
|
||||||
- TARGET_GLES2=OFF |
|
||||||
- CMAKE_CXX_FLAGS="--coverage" |
|
||||||
- LCOV_EXTRA_OPTS="--gcov-tool /usr/bin/gcov-4.8" |
|
||||||
addons: |
|
||||||
apt: |
|
||||||
packages: |
|
||||||
- g++-4.8 |
|
||||||
- ninja-build |
|
||||||
- lcov |
|
||||||
- libsdl2-dev |
|
||||||
- libglfw3-dev |
|
||||||
- language: python |
|
||||||
python: 3.6 |
|
||||||
os: linux |
|
||||||
dist: xenial |
|
||||||
compiler: gcc |
|
||||||
env: |
|
||||||
- JOBID=linux-static |
|
||||||
- TARGET=desktop |
|
||||||
- BUILD_STATIC=ON |
|
||||||
- LCOV_EXTRA_OPTS="--gcov-tool /usr/bin/gcov-4.8" |
|
||||||
- language: cpp |
|
||||||
os: osx |
|
||||||
compiler: clang |
|
||||||
env: |
|
||||||
- JOBID=macos-gl |
|
||||||
- TARGET=desktop |
|
||||||
- language: cpp |
|
||||||
os: osx |
|
||||||
compiler: clang |
|
||||||
env: |
|
||||||
- JOBID=macos-static |
|
||||||
- TARGET=desktop |
|
||||||
- BUILD_STATIC=ON |
|
||||||
|
|
||||||
notifications: |
|
||||||
webhooks: |
|
||||||
urls: |
|
||||||
- https://webhooks.gitter.im/e/00ec7a9066bb0fec98f3 |
|
||||||
on_success: change |
|
||||||
on_failure: always |
|
||||||
on_start: never |
|
||||||
|
|
||||||
cache: |
|
||||||
directories: |
|
||||||
- $HOME/swiftshader |
|
||||||
- $HOME/cmake |
|
||||||
- $HOME/pybind11 |
|
||||||
|
|
||||||
install: |
|
||||||
- if [ "$TRAVIS_OS_NAME" == "linux" ]; then export CXX=g++-4.8; fi |
|
||||||
- if [ "$BUILD_STATIC" != "ON" ]; then export BUILD_STATIC=OFF; fi |
|
||||||
- if [ "$TRAVIS_OS_NAME" == "linux" ] && ( [ "$TARGET" == "desktop" ] || [ "$TARGET" == "desktop-sanitizers" ] ); then export PLATFORM_GL_API=GLX; fi |
|
||||||
- if [ "$TRAVIS_OS_NAME" == "linux" ] && [ "$TARGET" == "desktop-gles" ]; then export PLATFORM_GL_API=EGL; fi |
|
||||||
# Download CMake 3.1.3 to ensure we're still compatible with it (Travis has |
|
||||||
# 3.9 since December 2017). Also, the PATH setting can't be cached, so it's |
|
||||||
# separate (bit me two times already). Android needs CMake 3.7, but |
|
||||||
# https://gitlab.kitware.com/cmake/cmake/issues/17253 is fixed in 3.9.2, so |
|
||||||
# grab that. FindVulkan is since 3.7, in that case just use the system package. |
|
||||||
- if [ "$TRAVIS_OS_NAME" == "linux" ] && [ ! -e "$HOME/cmake/bin" ]; then cd $HOME ; wget -nc --no-check-certificate https://cmake.org/files/v3.1/cmake-3.1.3-Linux-x86_64.tar.gz && mkdir -p cmake && cd cmake && tar --strip-components=1 -xzf ../cmake-3.1.3-Linux-x86_64.tar.gz && cd $TRAVIS_BUILD_DIR ; fi |
|
||||||
- if [ "$TRAVIS_OS_NAME" == "linux" ]; then export PATH=$HOME/cmake/bin:$PATH && cmake --version; fi |
|
||||||
- if [ "$TRAVIS_OS_NAME" == "osx" ]; then HOMEBREW_NO_AUTO_UPDATE=1 brew install ninja; fi |
|
||||||
|
|
||||||
# Code coverage of python bindings |
|
||||||
- if [ "$TRAVIS_OS_NAME" == "linux" ] || [ "$TRAVIS_OS_NAME" == "osx" ]; then pip3 install coverage codecov; fi |
|
||||||
|
|
||||||
# pybind11 (cached). On macOS the version 2.3.0 needs a brew update, the stale |
|
||||||
# Travis image has just 2.2.4. |
|
||||||
- if [ "$TRAVIS_OS_NAME" == "linux" ] && [ ! -e "$HOME/pybind11/bin" ]; then $TRAVIS_BUILD_DIR/package/ci/setup-pybind11.sh; fi |
|
||||||
- if [ "$TRAVIS_OS_NAME" == "osx" ]; then brew install pybind11; fi |
|
||||||
|
|
||||||
# SDL and GLFW on macOS |
|
||||||
- if [ "$TRAVIS_OS_NAME" == "osx" ] && [ "$TARGET" == "desktop" ]; then HOMEBREW_NO_AUTO_UPDATE=1 brew install sdl2 glfw; fi |
|
||||||
|
|
||||||
# numpy on macOS -- probably because we updated Homebrew to install new pybind |
|
||||||
# (and thus python as well, apparently), the preinstalled numpy is no longer |
|
||||||
# visible. |
|
||||||
- if [ "$TRAVIS_OS_NAME" == "osx" ]; then brew upgrade numpy; fi |
|
||||||
|
|
||||||
# SwiftShader on Linux (cached). Taken from Chromium snapshot 587878 |
|
||||||
# (swiftshader-bin Arch package). |
|
||||||
- if [ "$TRAVIS_OS_NAME" == "linux" ] && [ "$TARGET" == "desktop-gles" ] && [ ! -e "$HOME/swiftshader/libEGL.so" ]; then cd $HOME ; wget https://ci.magnum.graphics/swiftshader-chromium-587878.tar.gz && mkdir -p swiftshader && cd swiftshader && tar -xzf ../swiftshader-chromium-587878.tar.gz && cd $TRAVIS_BUILD_DIR ; fi |
|
||||||
|
|
||||||
# lcov on macOS |
|
||||||
- if [ "$TRAVIS_OS_NAME" == "osx" ]; then HOMEBREW_NO_AUTO_UPDATE=1 brew install lcov; fi |
|
||||||
|
|
||||||
script: |
|
||||||
- if [ "$TARGET" == "desktop" ] && ( [ "$TRAVIS_OS_NAME" == "linux" ] || [ "$TRAVIS_OS_NAME" == "osx" ] ); then ./package/ci/travis-desktop.sh; fi |
|
||||||
- if [ "$TARGET" == "desktop-gles" ] && ( [ "$TRAVIS_OS_NAME" == "linux" ] || [ "$TRAVIS_OS_NAME" == "osx" ] ); then ./package/ci/travis-desktop-gles.sh; fi |
|
||||||
# Travis somehow is not able to gather all output, try to force it using this |
|
||||||
- sync |
|
||||||
|
|
||||||
after_success: |
|
||||||
# Keep in sync with package/archlinux/PKGBUILD-coverage, please |
|
||||||
- if [ "$TRAVIS_OS_NAME" == "linux" ] || [ "$TRAVIS_OS_NAME" == "osx" ]; then lcov $LCOV_EXTRA_OPTS --directory . --capture --output-file coverage.info > /dev/null; fi |
|
||||||
- if [ "$TRAVIS_OS_NAME" == "linux" ] || [ "$TRAVIS_OS_NAME" == "osx" ]; then lcov $LCOV_EXTRA_OPTS --extract coverage.info "*/src/python/*" "*/src/Corrade/*" "*/src/Magnum/*" --output-file coverage.info; fi |
|
||||||
|
|
||||||
- if [ "$TRAVIS_OS_NAME" == "linux" ] || [ "$TRAVIS_OS_NAME" == "osx" ]; then cd src/python && coverage combine && codecov -X gcov; fi |
|
||||||
@ -0,0 +1,117 @@ |
|||||||
|
#!/bin/bash |
||||||
|
set -ev |
||||||
|
|
||||||
|
# Corrade |
||||||
|
git clone --depth 1 https://github.com/mosra/corrade.git |
||||||
|
cd corrade |
||||||
|
mkdir build && cd build |
||||||
|
cmake .. \ |
||||||
|
-DCMAKE_INSTALL_PREFIX=$HOME/deps \ |
||||||
|
-DCMAKE_INSTALL_RPATH=$HOME/deps/lib \ |
||||||
|
-DCMAKE_BUILD_TYPE=Release \ |
||||||
|
-DCORRADE_WITH_INTERCONNECT=OFF \ |
||||||
|
-DCORRADE_WITH_PLUGINMANAGER=ON \ |
||||||
|
-DCORRADE_WITH_TESTSUITE=ON \ |
||||||
|
-G Ninja |
||||||
|
ninja install |
||||||
|
cd ../.. |
||||||
|
|
||||||
|
# Magnum |
||||||
|
git clone --depth 1 https://github.com/mosra/magnum.git |
||||||
|
cd magnum |
||||||
|
mkdir build && cd build |
||||||
|
cmake .. \ |
||||||
|
-DCMAKE_INSTALL_PREFIX=$HOME/deps \ |
||||||
|
-DCMAKE_BUILD_TYPE=Release \ |
||||||
|
-DCMAKE_PREFIX_PATH="$HOME/swiftshader;$HOME/pybind11" \ |
||||||
|
-DCMAKE_INSTALL_RPATH="$HOME/deps/lib;$HOME/swiftshader/lib" \ |
||||||
|
-DMAGNUM_TARGET_GLES=ON \ |
||||||
|
-DMAGNUM_TARGET_GLES2=$TARGET_GLES2 \ |
||||||
|
-DMAGNUM_WITH_AUDIO=OFF \ |
||||||
|
-DMAGNUM_WITH_DEBUGTOOLS=OFF \ |
||||||
|
-DMAGNUM_WITH_GL=ON \ |
||||||
|
-DMAGNUM_WITH_MATERIALTOOLS=ON \ |
||||||
|
-DMAGNUM_WITH_MESHTOOLS=ON \ |
||||||
|
-DMAGNUM_WITH_PRIMITIVES=ON \ |
||||||
|
-DMAGNUM_WITH_SCENEGRAPH=ON \ |
||||||
|
-DMAGNUM_WITH_SCENETOOLS=ON \ |
||||||
|
-DMAGNUM_WITH_SHADERS=ON \ |
||||||
|
-DMAGNUM_WITH_SHADERTOOLS=OFF \ |
||||||
|
-DMAGNUM_WITH_TEXT=ON \ |
||||||
|
-DMAGNUM_WITH_TEXTURETOOLS=OFF \ |
||||||
|
-DMAGNUM_WITH_TRADE=ON \ |
||||||
|
-DMAGNUM_WITH_VK=OFF \ |
||||||
|
-DMAGNUM_WITH_WINDOWLESSEGLAPPLICATION=ON \ |
||||||
|
-DMAGNUM_WITH_ANYIMAGEIMPORTER=ON \ |
||||||
|
-DMAGNUM_WITH_ANYSCENECONVERTER=ON \ |
||||||
|
-DMAGNUM_WITH_ANYSCENEIMPORTER=ON \ |
||||||
|
-DMAGNUM_WITH_TGAIMPORTER=ON \ |
||||||
|
-G Ninja |
||||||
|
ninja install |
||||||
|
cd ../.. |
||||||
|
|
||||||
|
# Magnum Plugins |
||||||
|
git clone --depth 1 https://github.com/mosra/magnum-plugins.git |
||||||
|
cd magnum-plugins |
||||||
|
mkdir build && cd build |
||||||
|
cmake .. \ |
||||||
|
-DCMAKE_INSTALL_PREFIX=$HOME/deps \ |
||||||
|
-DCMAKE_BUILD_TYPE=Release \ |
||||||
|
`# StanfordSceneConverter uses MeshTools which rely on GL which looks` \ |
||||||
|
`# for OpenGLES. And the RPATH entry needs to be there as well,` \ |
||||||
|
`# otherwise it won't load.` \ |
||||||
|
-DCMAKE_PREFIX_PATH=$HOME/swiftshader \ |
||||||
|
-DCMAKE_INSTALL_RPATH="$HOME/deps/lib;$HOME/swiftshader/lib" \ |
||||||
|
-DMAGNUM_BUILD_STATIC=$BUILD_STATIC \ |
||||||
|
-DMAGNUM_WITH_BCDECIMAGECONVERTER=ON \ |
||||||
|
-DMAGNUM_WITH_DDSIMPORTER=ON \ |
||||||
|
-DMAGNUM_WITH_ETCDECIMAGECONVERTER=ON \ |
||||||
|
-DMAGNUM_WITH_GLTFIMPORTER=ON \ |
||||||
|
-DMAGNUM_WITH_GLTFSCENECONVERTER=ON \ |
||||||
|
-DMAGNUM_WITH_KTXIMAGECONVERTER=ON \ |
||||||
|
-DMAGNUM_WITH_MESHOPTIMIZERSCENECONVERTER=ON \ |
||||||
|
-DMAGNUM_WITH_PRIMITIVEIMPORTER=ON \ |
||||||
|
-DMAGNUM_WITH_STANFORDSCENECONVERTER=ON \ |
||||||
|
-DMAGNUM_WITH_STBIMAGECONVERTER=ON \ |
||||||
|
-DMAGNUM_WITH_STBIMAGEIMPORTER=ON \ |
||||||
|
-DMAGNUM_WITH_STBRESIZEIMAGECONVERTER=ON \ |
||||||
|
-DMAGNUM_WITH_STBTRUETYPEFONT=ON \ |
||||||
|
-G Ninja |
||||||
|
ninja install |
||||||
|
cd ../.. |
||||||
|
|
||||||
|
# Build the thing |
||||||
|
mkdir build && cd build |
||||||
|
cmake .. \ |
||||||
|
-DCMAKE_CXX_FLAGS="--coverage" \ |
||||||
|
-DCMAKE_INSTALL_PREFIX=$HOME/deps \ |
||||||
|
-DCMAKE_BUILD_TYPE=Debug \ |
||||||
|
-DCMAKE_PREFIX_PATH="$HOME/swiftshader;$HOME/pybind11" \ |
||||||
|
-DCMAKE_INSTALL_RPATH="$HOME/deps/lib;$HOME/swiftshader/lib" \ |
||||||
|
-DPYBIND11_PYTHON_VERSION=3.6 \ |
||||||
|
-DMAGNUM_WITH_PYTHON=ON \ |
||||||
|
-DMAGNUM_BUILD_TESTS=ON \ |
||||||
|
-G Ninja |
||||||
|
ninja $NINJA_JOBS |
||||||
|
|
||||||
|
CORRADE_TEST_COLOR=ON ctest -V |
||||||
|
|
||||||
|
# Verify the setuptools install. Not using $CIRCLE_WORKING_DIRECTORY because |
||||||
|
# it's ~ and that's not correctly expanded always. |
||||||
|
cd src/python |
||||||
|
python3 setup.py install --root="$(pwd)/../../install" --prefix=/usr |
||||||
|
|
||||||
|
# Run tests & gather coverage |
||||||
|
cd ../../../src/python/corrade |
||||||
|
coverage run -m unittest -v |
||||||
|
cp .coverage ../.coverage.corrade |
||||||
|
|
||||||
|
cd ../magnum |
||||||
|
coverage run -m unittest -v |
||||||
|
cp .coverage ../.coverage.magnum |
||||||
|
|
||||||
|
# Test docstring validity |
||||||
|
cd ../../../doc/python |
||||||
|
# I would use $CIRCLE_WORKING_DIRECTORY, but that's ~ and that's not expanded |
||||||
|
# here for some reason |
||||||
|
PYTHONPATH="$(pwd)/../../build/src/python" python3 -m doctest -v *.rst |
||||||
@ -0,0 +1,122 @@ |
|||||||
|
#!/bin/bash |
||||||
|
set -ev |
||||||
|
|
||||||
|
# Corrade |
||||||
|
git clone --depth 1 https://github.com/mosra/corrade.git |
||||||
|
cd corrade |
||||||
|
mkdir build && cd build |
||||||
|
cmake .. \ |
||||||
|
-DCMAKE_INSTALL_PREFIX=$HOME/deps \ |
||||||
|
-DCMAKE_INSTALL_RPATH=$HOME/deps/lib \ |
||||||
|
-DCMAKE_BUILD_TYPE=Release \ |
||||||
|
-DMAGNUM_BUILD_DEPRECATED=$BUILD_DEPRECATED \ |
||||||
|
-DCORRADE_BUILD_STATIC=$BUILD_STATIC \ |
||||||
|
-DCORRADE_WITH_INTERCONNECT=OFF \ |
||||||
|
-DCORRADE_WITH_PLUGINMANAGER=ON \ |
||||||
|
-DCORRADE_WITH_TESTSUITE=ON \ |
||||||
|
-G Ninja |
||||||
|
ninja install |
||||||
|
cd ../.. |
||||||
|
|
||||||
|
# Magnum |
||||||
|
git clone --depth 1 https://github.com/mosra/magnum.git |
||||||
|
cd magnum |
||||||
|
mkdir build && cd build |
||||||
|
cmake .. \ |
||||||
|
-DCMAKE_INSTALL_PREFIX=$HOME/deps \ |
||||||
|
-DCMAKE_INSTALL_RPATH=$HOME/deps/lib \ |
||||||
|
-DCMAKE_BUILD_TYPE=Release \ |
||||||
|
-DMAGNUM_BUILD_DEPRECATED=$BUILD_DEPRECATED \ |
||||||
|
-DMAGNUM_BUILD_STATIC=$BUILD_STATIC \ |
||||||
|
-DMAGNUM_WITH_AUDIO=OFF \ |
||||||
|
-DMAGNUM_WITH_DEBUGTOOLS=OFF \ |
||||||
|
-DMAGNUM_WITH_GL=ON \ |
||||||
|
-DMAGNUM_WITH_MATERIALTOOLS=ON \ |
||||||
|
-DMAGNUM_WITH_MESHTOOLS=ON \ |
||||||
|
-DMAGNUM_WITH_PRIMITIVES=ON \ |
||||||
|
-DMAGNUM_WITH_SCENEGRAPH=ON \ |
||||||
|
-DMAGNUM_WITH_SCENETOOLS=ON \ |
||||||
|
-DMAGNUM_WITH_SHADERS=ON \ |
||||||
|
-DMAGNUM_WITH_SHADERTOOLS=OFF \ |
||||||
|
-DMAGNUM_WITH_TEXT=ON \ |
||||||
|
-DMAGNUM_WITH_TEXTURETOOLS=OFF \ |
||||||
|
-DMAGNUM_WITH_TRADE=ON \ |
||||||
|
-DMAGNUM_WITH_VK=OFF \ |
||||||
|
-DMAGNUM_WITH_GLFWAPPLICATION=ON \ |
||||||
|
-DMAGNUM_WITH_SDL2APPLICATION=ON \ |
||||||
|
-DMAGNUM_WITH_WINDOWLESS${PLATFORM_GL_API}APPLICATION=ON \ |
||||||
|
-DMAGNUM_WITH_ANYIMAGEIMPORTER=ON \ |
||||||
|
-DMAGNUM_WITH_ANYSCENECONVERTER=ON \ |
||||||
|
-DMAGNUM_WITH_ANYSCENEIMPORTER=ON \ |
||||||
|
-DMAGNUM_WITH_TGAIMPORTER=ON \ |
||||||
|
-G Ninja |
||||||
|
|
||||||
|
# In case of a static build there's no way for the test to know the plugin |
||||||
|
# install directory so we have to hardcode it |
||||||
|
if [ "$BUILD_STATIC" == "ON" ]; then |
||||||
|
cmake . -DMAGNUM_PLUGINS_DIR=$HOME/deps/lib/magnum |
||||||
|
fi |
||||||
|
|
||||||
|
ninja install |
||||||
|
cd ../.. |
||||||
|
|
||||||
|
# Magnum Plugins |
||||||
|
git clone --depth 1 https://github.com/mosra/magnum-plugins.git |
||||||
|
cd magnum-plugins |
||||||
|
mkdir build && cd build |
||||||
|
cmake .. \ |
||||||
|
-DCMAKE_INSTALL_PREFIX=$HOME/deps \ |
||||||
|
-DCMAKE_INSTALL_RPATH=$HOME/deps/lib \ |
||||||
|
-DCMAKE_BUILD_TYPE=Release \ |
||||||
|
-DMAGNUM_BUILD_STATIC=$BUILD_STATIC \ |
||||||
|
-DMAGNUM_WITH_BCDECIMAGECONVERTER=ON \ |
||||||
|
-DMAGNUM_WITH_DDSIMPORTER=ON \ |
||||||
|
-DMAGNUM_WITH_ETCDECIMAGECONVERTER=ON \ |
||||||
|
-DMAGNUM_WITH_GLTFIMPORTER=ON \ |
||||||
|
-DMAGNUM_WITH_GLTFSCENECONVERTER=ON \ |
||||||
|
-DMAGNUM_WITH_KTXIMAGECONVERTER=ON \ |
||||||
|
-DMAGNUM_WITH_MESHOPTIMIZERSCENECONVERTER=ON \ |
||||||
|
-DMAGNUM_WITH_PRIMITIVEIMPORTER=ON \ |
||||||
|
-DMAGNUM_WITH_STANFORDSCENECONVERTER=ON \ |
||||||
|
-DMAGNUM_WITH_STBIMAGECONVERTER=ON \ |
||||||
|
-DMAGNUM_WITH_STBIMAGEIMPORTER=ON \ |
||||||
|
-DMAGNUM_WITH_STBRESIZEIMAGECONVERTER=ON \ |
||||||
|
-DMAGNUM_WITH_STBTRUETYPEFONT=ON \ |
||||||
|
-G Ninja |
||||||
|
ninja install |
||||||
|
cd ../.. |
||||||
|
|
||||||
|
# Build the thing |
||||||
|
mkdir build && cd build |
||||||
|
cmake .. \ |
||||||
|
-DCMAKE_CXX_FLAGS="--coverage" \ |
||||||
|
-DCMAKE_INSTALL_PREFIX=$HOME/deps \ |
||||||
|
-DCMAKE_BUILD_TYPE=Debug \ |
||||||
|
-DCMAKE_PREFIX_PATH=$HOME/pybind11 \ |
||||||
|
-DPYBIND11_PYTHON_VERSION=3.6 \ |
||||||
|
-DMAGNUM_WITH_PYTHON=ON \ |
||||||
|
-DMAGNUM_BUILD_TESTS=ON \ |
||||||
|
-G Ninja |
||||||
|
ninja $NINJA_JOBS |
||||||
|
|
||||||
|
CORRADE_TEST_COLOR=ON ctest -V |
||||||
|
|
||||||
|
# Verify the setuptools install. Not using $CIRCLE_WORKING_DIRECTORY because |
||||||
|
# it's ~ and that's not correctly expanded always. |
||||||
|
cd src/python |
||||||
|
python3 setup.py install --root="$(pwd)/../../install" --prefix=/usr |
||||||
|
|
||||||
|
# Run tests & gather coverage |
||||||
|
cd ../../../src/python/corrade |
||||||
|
coverage run -m unittest -v |
||||||
|
cp .coverage ../.coverage.corrade |
||||||
|
|
||||||
|
cd ../magnum |
||||||
|
MAGNUM_SKIP_GL_TESTS=ON coverage run -m unittest -v |
||||||
|
cp .coverage ../.coverage.magnum |
||||||
|
|
||||||
|
# Test docstring validity |
||||||
|
cd ../../../doc/python |
||||||
|
# I would use $CIRCLE_WORKING_DIRECTORY, but that's ~ and that's not expanded |
||||||
|
# here for some reason |
||||||
|
PYTHONPATH="$(pwd)/../../build/src/python" python3 -m doctest -v *.rst |
||||||
@ -0,0 +1,12 @@ |
|||||||
|
This dir is used by `src/*/CMakeLists.txt` to run `git describe --match "v*"`. |
||||||
|
Because, if it would be run in that directory, on Windows the `--match "v*"` |
||||||
|
would get expanded to the `version.h.cmake` file there, causing Git to |
||||||
|
obviously not find any such tag. The reason is probably that on Windows the |
||||||
|
wildcard expansion is done on the application side and not by the shell, thus |
||||||
|
being performed even though CMake docs say `execute_process()` doesn't involve |
||||||
|
a shell. This directory is thus dedicated for that operation, *guaranteed* to |
||||||
|
never contain any file starting with `v` (or `V` for that matter because, |
||||||
|
again, HELLO WINDOWS). |
||||||
|
|
||||||
|
No matter what you do, DON'T put any files starting with `v` or `V` here, or |
||||||
|
hell breaks loose again. |
||||||
@ -0,0 +1,7 @@ |
|||||||
|
#!/bin/bash |
||||||
|
|
||||||
|
set -e |
||||||
|
|
||||||
|
dir=$(dirname "$0") |
||||||
|
cp $dir/../../corrade/modules/FindCorrade.cmake $dir/../modules/ |
||||||
|
cp $dir/../../magnum/modules/FindMagnum.cmake $dir/../modules/ |
||||||
@ -0,0 +1,63 @@ |
|||||||
|
#ifndef Corrade_Containers_OptionalPythonBindings_h |
||||||
|
#define Corrade_Containers_OptionalPythonBindings_h |
||||||
|
/*
|
||||||
|
This file is part of Magnum. |
||||||
|
|
||||||
|
Copyright © 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, |
||||||
|
2020, 2021, 2022, 2023, 2024, 2025, 2026 |
||||||
|
Vladimír Vondruš <mosra@centrum.cz> |
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a |
||||||
|
copy of this software and associated documentation files (the "Software"), |
||||||
|
to deal in the Software without restriction, including without limitation |
||||||
|
the rights to use, copy, modify, merge, publish, distribute, sublicense, |
||||||
|
and/or sell copies of the Software, and to permit persons to whom the |
||||||
|
Software is furnished to do so, subject to the following conditions: |
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included |
||||||
|
in all copies or substantial portions of the Software. |
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
||||||
|
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
||||||
|
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
||||||
|
DEALINGS IN THE SOFTWARE. |
||||||
|
*/ |
||||||
|
|
||||||
|
#include <pybind11/pybind11.h> |
||||||
|
#include <Corrade/Containers/Optional.h> |
||||||
|
|
||||||
|
namespace pybind11 { namespace detail { |
||||||
|
|
||||||
|
/* pybind11/stl.h has optional_caster for this, but that relies on a value_type
|
||||||
|
typedef that Optional doesn't have, so adapting a copy of it, also without |
||||||
|
std::is_lvalue_reference<T>::value, which is not a thing here */ |
||||||
|
template<class T> struct type_caster<Corrade::Containers::Optional<T>> { |
||||||
|
using value_conv = make_caster<T>; |
||||||
|
|
||||||
|
template<class T_> static handle cast(T_&& src, const return_value_policy policy, const handle parent) { |
||||||
|
if(!src) return none{}.release(); |
||||||
|
return value_conv::cast(*std::forward<T_>(src), return_value_policy_override<T>::policy(policy), parent); |
||||||
|
} |
||||||
|
|
||||||
|
bool load(const handle src, bool convert) { |
||||||
|
if(!src) return false; |
||||||
|
|
||||||
|
/* default-constructed value is already empty */ |
||||||
|
if(src.is_none()) return true; |
||||||
|
|
||||||
|
value_conv inner_caster; |
||||||
|
if(!inner_caster.load(src, convert)) return false; |
||||||
|
|
||||||
|
value.emplace(cast_op<T&&>(std::move(inner_caster))); |
||||||
|
return true; |
||||||
|
} |
||||||
|
|
||||||
|
PYBIND11_TYPE_CASTER(Corrade::Containers::Optional<T>, _("Optional[") + value_conv::name + _("]")); |
||||||
|
}; |
||||||
|
|
||||||
|
}} |
||||||
|
|
||||||
|
#endif |
||||||
@ -0,0 +1,203 @@ |
|||||||
|
#ifndef Corrade_Containers_StridedArrayViewPythonBindings_h |
||||||
|
#define Corrade_Containers_StridedArrayViewPythonBindings_h |
||||||
|
/*
|
||||||
|
This file is part of Magnum. |
||||||
|
|
||||||
|
Copyright © 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, |
||||||
|
2020, 2021, 2022, 2023, 2024, 2025, 2026 |
||||||
|
Vladimír Vondruš <mosra@centrum.cz> |
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a |
||||||
|
copy of this software and associated documentation files (the "Software"), |
||||||
|
to deal in the Software without restriction, including without limitation |
||||||
|
the rights to use, copy, modify, merge, publish, distribute, sublicense, |
||||||
|
and/or sell copies of the Software, and to permit persons to whom the |
||||||
|
Software is furnished to do so, subject to the following conditions: |
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included |
||||||
|
in all copies or substantial portions of the Software. |
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
||||||
|
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
||||||
|
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
||||||
|
DEALINGS IN THE SOFTWARE. |
||||||
|
*/ |
||||||
|
|
||||||
|
#include <pybind11/pybind11.h> |
||||||
|
#include <Corrade/Containers/StridedArrayView.h> |
||||||
|
#include <Corrade/Containers/String.h> |
||||||
|
|
||||||
|
namespace Corrade { namespace Containers { |
||||||
|
|
||||||
|
namespace Implementation { |
||||||
|
|
||||||
|
/* For maintainability please keep in the same order as
|
||||||
|
https://docs.python.org/3/library/struct.html#format-characters. Each of
|
||||||
|
these has also a corresponding entry in accessorsForFormat() in |
||||||
|
containers.cpp in the same order. */ |
||||||
|
template<class T> constexpr const char* pythonFormatString() { |
||||||
|
static_assert(sizeof(T) == 0, "format string unknown for this type, supply it explicitly"); |
||||||
|
return {}; |
||||||
|
} |
||||||
|
/* Treating bytes as unsigned 8-bit integers and not as chars for consistency
|
||||||
|
with bytes/bytearray, where you have to use ord(a[0]) to get a character |
||||||
|
value. Same done for PyStridedArrayViewItem and PyStridedArrayViewSetItem |
||||||
|
below. To further emphasize that this is "general data", a null format |
||||||
|
string is returned, which should be treated the same as B: |
||||||
|
https://docs.python.org/3/c-api/buffer.html#c.Py_buffer.format */
|
||||||
|
template<> constexpr const char* pythonFormatString<char>() { return nullptr; } |
||||||
|
template<> constexpr const char* pythonFormatString<std::int8_t>() { return "b"; } |
||||||
|
template<> constexpr const char* pythonFormatString<std::uint8_t>() { return "B"; } |
||||||
|
template<> constexpr const char* pythonFormatString<std::int16_t>() { return "h"; } |
||||||
|
template<> constexpr const char* pythonFormatString<std::uint16_t>() { return "H"; } |
||||||
|
template<> constexpr const char* pythonFormatString<std::int32_t>() { return "i"; } |
||||||
|
template<> constexpr const char* pythonFormatString<std::uint32_t>() { return "I"; } |
||||||
|
/* *not* l / L, that's 4 bytes in Python */ |
||||||
|
template<> constexpr const char* pythonFormatString<std::int64_t>() { return "q"; } |
||||||
|
template<> constexpr const char* pythonFormatString<std::uint64_t>() { return "Q"; } |
||||||
|
/** @todo how to represent std::size_t? conflicts with uint32_t/uint64_t above */ |
||||||
|
template<> constexpr const char* pythonFormatString<float>() { return "f"; } |
||||||
|
template<> constexpr const char* pythonFormatString<double>() { return "d"; } |
||||||
|
|
||||||
|
template<class U> struct PyStridedArrayViewItem { |
||||||
|
static pybind11::object get(const char* item) { |
||||||
|
return pybind11::cast(*reinterpret_cast<const U*>(item)); |
||||||
|
} |
||||||
|
}; |
||||||
|
/* Treating bytes as unsigned 8-bit integers and not as chars for consistency
|
||||||
|
with bytes/bytearray, where you have to use ord(a[0]) to get a character |
||||||
|
value. Same done for pythonFormatString<char>() above and |
||||||
|
PyStridedArrayViewSetItem below. */ |
||||||
|
template<> struct PyStridedArrayViewItem<const char> { |
||||||
|
static pybind11::object get(const char* item) { |
||||||
|
return pybind11::cast(*reinterpret_cast<const std::uint8_t*>(item)); |
||||||
|
} |
||||||
|
}; |
||||||
|
|
||||||
|
template<class T, class U> struct PyStridedArrayViewSetItem; |
||||||
|
template<class U> struct PyStridedArrayViewSetItem<const char, U> { |
||||||
|
/* __setitem__ is not even exposed for immutable views so this is fine */ |
||||||
|
constexpr static std::nullptr_t set = nullptr; |
||||||
|
}; |
||||||
|
template<class U> struct PyStridedArrayViewSetItem<char, U> { |
||||||
|
static void set(char* item, pybind11::handle object) { |
||||||
|
*reinterpret_cast<U*>(item) = pybind11::cast<U>(object); |
||||||
|
} |
||||||
|
}; |
||||||
|
/* Treating bytes as unsigned 8-bit integers and not as chars for consistency
|
||||||
|
with bytes/bytearray, where you have to use a[0] = ord('A') to set a |
||||||
|
character value. Same done for pythonFormatString<char>() and |
||||||
|
PyStridedArrayViewItem above. */ |
||||||
|
template<> struct PyStridedArrayViewSetItem<char, char> { |
||||||
|
static void set(char* item, pybind11::handle object) { |
||||||
|
*reinterpret_cast<std::uint8_t*>(item) = pybind11::cast<std::uint8_t>(object); |
||||||
|
} |
||||||
|
}; |
||||||
|
|
||||||
|
template<unsigned, class> struct PyStridedElement; |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
template<unsigned dimensions, class T> class PyStridedArrayView: public StridedArrayView<dimensions, T> { |
||||||
|
/* the type is dynamic; ArrayView has the same check */ |
||||||
|
static_assert(std::is_same<const T, const char>::value, "only the (const) char StridedArrayView is meant to be exposed"); |
||||||
|
|
||||||
|
public: |
||||||
|
/* Null function pointers should be okay as it shouldn't ever get to
|
||||||
|
them -- IndexError gets fired first. The format string can be null |
||||||
|
as well (which nicely implies "general data"), in which case B |
||||||
|
should be assumed: |
||||||
|
https://docs.python.org/3/c-api/buffer.html#c.Py_buffer.format */
|
||||||
|
/*implicit*/ PyStridedArrayView(): format{}, getitem{}, setitem{} {} |
||||||
|
|
||||||
|
template<class U> explicit PyStridedArrayView(const StridedArrayView<dimensions, U>& view): PyStridedArrayView{view, Implementation::pythonFormatString<typename std::decay<U>::type>(), sizeof(U)} {} |
||||||
|
|
||||||
|
template<class U> explicit PyStridedArrayView(const StridedArrayView<dimensions, U>& view, Containers::StringView format, std::size_t itemsize): PyStridedArrayView<dimensions, T>{ |
||||||
|
arrayCast<T>(view), |
||||||
|
format, |
||||||
|
itemsize, |
||||||
|
Implementation::PyStridedArrayViewItem<const U>::get, |
||||||
|
Implementation::PyStridedArrayViewSetItem<T, U>::set |
||||||
|
} {} |
||||||
|
|
||||||
|
explicit PyStridedArrayView(const StridedArrayView<dimensions, T>& view, Containers::StringView format, std::size_t itemsize, pybind11::object(*getitem)(const char*), void(*setitem)(char*, pybind11::handle)): StridedArrayView<dimensions, T>{view}, format{format}, itemsize{itemsize}, getitem{getitem}, setitem{setitem} {} |
||||||
|
|
||||||
|
/* All APIs that are exposed by bindings and return a StridedArrayView
|
||||||
|
have to return the wrapper now */ |
||||||
|
|
||||||
|
typedef typename std::conditional<dimensions == 1, T&, PyStridedArrayView<dimensions - 1, T>>::type ElementType; |
||||||
|
|
||||||
|
ElementType operator[](std::size_t i) const { |
||||||
|
return Implementation::PyStridedElement<dimensions, T>::wrap(StridedArrayView<dimensions, T>::operator[](i), format, itemsize, getitem, setitem); |
||||||
|
} |
||||||
|
T& operator[](const Containers::Size<dimensions>& i) const { |
||||||
|
return StridedArrayView<dimensions, T>::operator[](i); |
||||||
|
} |
||||||
|
|
||||||
|
PyStridedArrayView<dimensions, T> slice(std::size_t begin, std::size_t end) const { |
||||||
|
return PyStridedArrayView<dimensions, T>{StridedArrayView<dimensions, T>::slice(begin, end), format, itemsize, getitem, setitem}; |
||||||
|
} |
||||||
|
PyStridedArrayView<dimensions, T> slice(const Containers::Size<dimensions>& begin, const Containers::Size<dimensions>& end) const { |
||||||
|
return PyStridedArrayView<dimensions, T>{StridedArrayView<dimensions, T>::slice(begin, end), format, itemsize, getitem, setitem}; |
||||||
|
} |
||||||
|
|
||||||
|
/* slice() with templated dimensions not used */ |
||||||
|
/* slice(&T::member) not used */ |
||||||
|
/* prefix(), suffix(), except() not used */ |
||||||
|
|
||||||
|
PyStridedArrayView<dimensions, T> every(std::size_t skip) const { |
||||||
|
return PyStridedArrayView<dimensions, T>{StridedArrayView<dimensions, T>::every(skip), format, itemsize, getitem, setitem}; |
||||||
|
} |
||||||
|
|
||||||
|
PyStridedArrayView<dimensions, T> every(const Containers::Stride<dimensions>& skip) const { |
||||||
|
return PyStridedArrayView<dimensions, T>{StridedArrayView<dimensions, T>::every(skip), format, itemsize, getitem, setitem}; |
||||||
|
} |
||||||
|
|
||||||
|
template<unsigned dimensionA, unsigned dimensionB> PyStridedArrayView<dimensions, T> transposed() const { |
||||||
|
return PyStridedArrayView<dimensions, T>{StridedArrayView<dimensions, T>::template transposed<dimensionA, dimensionB>(), format, itemsize, getitem, setitem}; |
||||||
|
} |
||||||
|
|
||||||
|
template<unsigned dimension> PyStridedArrayView<dimensions, T> flipped() const { |
||||||
|
return PyStridedArrayView<dimensions, T>{StridedArrayView<dimensions, T>::template flipped<dimension>(), format, itemsize, getitem, setitem}; |
||||||
|
} |
||||||
|
|
||||||
|
template<unsigned dimension> PyStridedArrayView<dimensions, T> broadcasted(std::size_t size) const { |
||||||
|
return PyStridedArrayView<dimensions, T>{StridedArrayView<dimensions, T>::template broadcasted<dimension>(size), format, itemsize, getitem, setitem}; |
||||||
|
} |
||||||
|
|
||||||
|
template<unsigned dimension, unsigned count> PyStridedArrayView<dimensions + count - 1, T> expanded(const Containers::Size<count>& size) const { |
||||||
|
return PyStridedArrayView<dimensions + count - 1, T>{StridedArrayView<dimensions, T>::template expanded<dimension>(size), format, itemsize, getitem, setitem}; |
||||||
|
} |
||||||
|
|
||||||
|
/* has to be public as it's accessed by the bindings directly */ |
||||||
|
/* The assumption is that >99% of format strings should be just a few
|
||||||
|
characters, stored with a SSO. I.e., not even bothering with |
||||||
|
String::nullTerminatedGlobalView() anywhere. */ |
||||||
|
Containers::String format; |
||||||
|
std::size_t itemsize; |
||||||
|
pybind11::object(*getitem)(const char*); |
||||||
|
void(*setitem)(char*, pybind11::handle); |
||||||
|
}; |
||||||
|
|
||||||
|
namespace Implementation { |
||||||
|
|
||||||
|
template<unsigned dimensions, class T> struct PyStridedElement { |
||||||
|
static PyStridedArrayView<dimensions - 1, T> wrap(const StridedArrayView<dimensions - 1, T>& element, Containers::StringView format, std::size_t itemsize, pybind11::object(*getitem)(const char*), void(*setitem)(char*, pybind11::handle)) { |
||||||
|
return PyStridedArrayView<dimensions - 1, T>{element, format, itemsize, getitem, setitem}; |
||||||
|
} |
||||||
|
}; |
||||||
|
|
||||||
|
template<class T> struct PyStridedElement<1, T> { |
||||||
|
static T& wrap(T& element, Containers::StringView, std::size_t, pybind11::object(*)(const char*), void(*)(char*, pybind11::handle)) { |
||||||
|
return element; |
||||||
|
} |
||||||
|
}; |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
}} |
||||||
|
|
||||||
|
#endif |
||||||
@ -0,0 +1,72 @@ |
|||||||
|
#ifndef Corrade_PluginManager_PythonBindings_h |
||||||
|
#define Corrade_PluginManager_PythonBindings_h |
||||||
|
/*
|
||||||
|
This file is part of Magnum. |
||||||
|
|
||||||
|
Copyright © 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, |
||||||
|
2020, 2021, 2022, 2023, 2024, 2025, 2026 |
||||||
|
Vladimír Vondruš <mosra@centrum.cz> |
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a |
||||||
|
copy of this software and associated documentation files (the "Software"), |
||||||
|
to deal in the Software without restriction, including without limitation |
||||||
|
the rights to use, copy, modify, merge, publish, distribute, sublicense, |
||||||
|
and/or sell copies of the Software, and to permit persons to whom the |
||||||
|
Software is furnished to do so, subject to the following conditions: |
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included |
||||||
|
in all copies or substantial portions of the Software. |
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
||||||
|
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
||||||
|
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
||||||
|
DEALINGS IN THE SOFTWARE. |
||||||
|
*/ |
||||||
|
|
||||||
|
#include <memory> /* :( */ |
||||||
|
#include <pybind11/pybind11.h> |
||||||
|
#include <Corrade/Containers/Pointer.h> |
||||||
|
#include <Corrade/Utility/Assert.h> |
||||||
|
|
||||||
|
namespace Corrade { namespace PluginManager { |
||||||
|
|
||||||
|
/* Stores additional stuff needed for proper refcounting of plugin instances.
|
||||||
|
Due to obvious reasons we can't subclass plugins so this is the only |
||||||
|
possible way. */ |
||||||
|
template<class T> struct PyPluginHolder: std::unique_ptr<T> { |
||||||
|
explicit PyPluginHolder(T* object) noexcept: std::unique_ptr<T>{object} { |
||||||
|
/* Plugin instance without an owner can only be without a manager and
|
||||||
|
thus without any metadata */ |
||||||
|
CORRADE_INTERNAL_ASSERT(!object->metadata()); |
||||||
|
} |
||||||
|
|
||||||
|
explicit PyPluginHolder(T* object, pybind11::object manager) noexcept: std::unique_ptr<T>{object}, manager{std::move(manager)} {} |
||||||
|
|
||||||
|
PyPluginHolder(PyPluginHolder<T>&&) noexcept = default; |
||||||
|
PyPluginHolder(const PyPluginHolder<T>&) = delete; |
||||||
|
PyPluginHolder<T>& operator=(PyPluginHolder<T>&&) noexcept = default; |
||||||
|
PyPluginHolder<T>& operator=(const PyPluginHolder<T>&) = delete; |
||||||
|
|
||||||
|
~PyPluginHolder() { |
||||||
|
/* On destruction, first `manager` and then the plugin would be
|
||||||
|
destroyed, which would mean it asserts due to the manager being |
||||||
|
destructed while plugins are still around. To flip the order, we |
||||||
|
need to reset the pointer first */ |
||||||
|
std::unique_ptr<T>::reset(); |
||||||
|
} |
||||||
|
|
||||||
|
pybind11::object manager; |
||||||
|
}; |
||||||
|
|
||||||
|
template<class T> PyPluginHolder<T> pyPluginHolder(Containers::Pointer<T>&& plugin, pybind11::object owner) { |
||||||
|
return PyPluginHolder<T>{plugin.release(), std::move(owner)}; |
||||||
|
} |
||||||
|
|
||||||
|
}} |
||||||
|
|
||||||
|
PYBIND11_DECLARE_HOLDER_TYPE(T, Corrade::PluginManager::PyPluginHolder<T>) |
||||||
|
|
||||||
|
#endif |
||||||
@ -0,0 +1,119 @@ |
|||||||
|
#ifndef Magnum_StridedArrayViewPythonBindings_h |
||||||
|
#define Magnum_StridedArrayViewPythonBindings_h |
||||||
|
/*
|
||||||
|
This file is part of Magnum. |
||||||
|
|
||||||
|
Copyright © 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, |
||||||
|
2020, 2021, 2022, 2023, 2024, 2025, 2026 |
||||||
|
Vladimír Vondruš <mosra@centrum.cz> |
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a |
||||||
|
copy of this software and associated documentation files (the "Software"), |
||||||
|
to deal in the Software without restriction, including without limitation |
||||||
|
the rights to use, copy, modify, merge, publish, distribute, sublicense, |
||||||
|
and/or sell copies of the Software, and to permit persons to whom the |
||||||
|
Software is furnished to do so, subject to the following conditions: |
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included |
||||||
|
in all copies or substantial portions of the Software. |
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
||||||
|
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
||||||
|
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
||||||
|
DEALINGS IN THE SOFTWARE. |
||||||
|
*/ |
||||||
|
|
||||||
|
#include <Magnum/Magnum.h> |
||||||
|
|
||||||
|
#include "Corrade/Containers/StridedArrayViewPythonBindings.h" |
||||||
|
|
||||||
|
namespace Corrade { namespace Containers { namespace Implementation { |
||||||
|
|
||||||
|
/* This expands Containers::Implementation::pythonFormatString() with Magnum
|
||||||
|
types. Using e.g. "3f" instead of "fff" as that makes Numpy understand even |
||||||
|
the slices as arrays in a concrete type (or it at least repr()s them as |
||||||
|
such), with "fff" it gives back an untyped tuple. */ |
||||||
|
|
||||||
|
#define _c(type, string) \ |
||||||
|
template<> constexpr const char* pythonFormatString<Magnum::type>() { return string; } |
||||||
|
_c(Half, "e") |
||||||
|
_c(Vector2, "2f") |
||||||
|
_c(Vector2h, "2e") |
||||||
|
_c(Vector2d, "2d") |
||||||
|
_c(Vector2ub, "2B") |
||||||
|
_c(Vector2b, "2b") |
||||||
|
_c(Vector2us, "2H") |
||||||
|
_c(Vector2s, "2h") |
||||||
|
_c(Vector2ui, "2I") |
||||||
|
_c(Vector2i, "2i") |
||||||
|
_c(Vector3, "3f") |
||||||
|
_c(Vector3h, "3e") |
||||||
|
_c(Vector3d, "3d") |
||||||
|
_c(Vector3ub, "3B") |
||||||
|
_c(Vector3b, "3b") |
||||||
|
_c(Vector3us, "3H") |
||||||
|
_c(Vector3s, "3h") |
||||||
|
_c(Vector3ui, "3I") |
||||||
|
_c(Vector3i, "3i") |
||||||
|
_c(Vector4, "4f") |
||||||
|
_c(Vector4h, "4e") |
||||||
|
_c(Vector4d, "4d") |
||||||
|
_c(Vector4ub, "4B") |
||||||
|
_c(Vector4b, "4b") |
||||||
|
_c(Vector4us, "4H") |
||||||
|
_c(Vector4s, "4h") |
||||||
|
_c(Vector4ui, "4I") |
||||||
|
_c(Vector4i, "4i") |
||||||
|
|
||||||
|
_c(Matrix2x2, "4f") |
||||||
|
_c(Matrix2x2d, "4d") |
||||||
|
_c(Matrix2x3, "6f") |
||||||
|
_c(Matrix2x3d, "6d") |
||||||
|
_c(Matrix2x4, "8f") |
||||||
|
_c(Matrix2x4d, "8d") |
||||||
|
_c(Matrix3x2, "6f") |
||||||
|
_c(Matrix3x2d, "6d") |
||||||
|
_c(Matrix3x3, "9f") |
||||||
|
_c(Matrix3x3d, "9d") |
||||||
|
_c(Matrix3x4, "12f") |
||||||
|
_c(Matrix3x4d, "12d") |
||||||
|
_c(Matrix4x2, "8f") |
||||||
|
_c(Matrix4x2d, "8d") |
||||||
|
_c(Matrix4x3, "12f") |
||||||
|
_c(Matrix4x3d, "12d") |
||||||
|
_c(Matrix4x4, "16f") |
||||||
|
_c(Matrix4x4d, "16d") |
||||||
|
|
||||||
|
_c(Range1D, "2f") |
||||||
|
_c(Range1Dd, "2d") |
||||||
|
_c(Range1Di, "2i") |
||||||
|
_c(Range2D, "4f") |
||||||
|
_c(Range2Dd, "4d") |
||||||
|
_c(Range2Di, "4i") |
||||||
|
_c(Range3D, "6f") |
||||||
|
_c(Range3Dd, "6d") |
||||||
|
_c(Range3Di, "6i") |
||||||
|
|
||||||
|
_c(Complex, "2f") |
||||||
|
_c(Complexd, "2d") |
||||||
|
_c(DualComplex, "4f") |
||||||
|
_c(DualComplexd, "4f") |
||||||
|
_c(Quaternion, "4f") |
||||||
|
_c(Quaterniond, "4d") |
||||||
|
_c(DualQuaternion, "8f") |
||||||
|
_c(DualQuaterniond, "8d") |
||||||
|
|
||||||
|
_c(Deg, "f") |
||||||
|
_c(Degd, "d") |
||||||
|
_c(Rad, "f") |
||||||
|
_c(Radd, "d") |
||||||
|
#undef _c |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
}} |
||||||
|
|
||||||
|
#endif |
||||||
@ -0,0 +1,30 @@ |
|||||||
|
# |
||||||
|
# This file is part of Magnum. |
||||||
|
# |
||||||
|
# Copyright © 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, |
||||||
|
# 2020, 2021, 2022, 2023, 2024, 2025, 2026 |
||||||
|
# Vladimír Vondruš <mosra@centrum.cz> |
||||||
|
# |
||||||
|
# Permission is hereby granted, free of charge, to any person obtaining a |
||||||
|
# copy of this software and associated documentation files (the "Software"), |
||||||
|
# to deal in the Software without restriction, including without limitation |
||||||
|
# the rights to use, copy, modify, merge, publish, distribute, sublicense, |
||||||
|
# and/or sell copies of the Software, and to permit persons to whom the |
||||||
|
# Software is furnished to do so, subject to the following conditions: |
||||||
|
# |
||||||
|
# The above copyright notice and this permission notice shall be included |
||||||
|
# in all copies or substantial portions of the Software. |
||||||
|
# |
||||||
|
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
||||||
|
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
||||||
|
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
||||||
|
# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
||||||
|
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
||||||
|
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
||||||
|
# DEALINGS IN THE SOFTWARE. |
||||||
|
# |
||||||
|
|
||||||
|
# Prefixed with project name to avoid conflicts with VersionTest in Magnum and |
||||||
|
# related repos |
||||||
|
corrade_add_test(MagnumBindingsVersionTest VersionTest.cpp LIBRARIES Magnum::Magnum) |
||||||
|
target_include_directories(MagnumBindingsVersionTest PRIVATE ${PROJECT_BINARY_DIR}/src) |
||||||
@ -0,0 +1,67 @@ |
|||||||
|
/*
|
||||||
|
This file is part of Magnum. |
||||||
|
|
||||||
|
Copyright © 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, |
||||||
|
2020, 2021, 2022, 2023, 2024, 2025, 2026 |
||||||
|
Vladimír Vondruš <mosra@centrum.cz> |
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a |
||||||
|
copy of this software and associated documentation files (the "Software"), |
||||||
|
to deal in the Software without restriction, including without limitation |
||||||
|
the rights to use, copy, modify, merge, publish, distribute, sublicense, |
||||||
|
and/or sell copies of the Software, and to permit persons to whom the |
||||||
|
Software is furnished to do so, subject to the following conditions: |
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included |
||||||
|
in all copies or substantial portions of the Software. |
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
||||||
|
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
||||||
|
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
||||||
|
DEALINGS IN THE SOFTWARE. |
||||||
|
*/ |
||||||
|
|
||||||
|
#include <Corrade/TestSuite/Tester.h> |
||||||
|
#include <Corrade/TestSuite/Compare/Numeric.h> |
||||||
|
|
||||||
|
#include "Magnum/Magnum.h" |
||||||
|
#include "Magnum/versionBindings.h" |
||||||
|
|
||||||
|
namespace Magnum { namespace Test { namespace { |
||||||
|
|
||||||
|
struct VersionTest: TestSuite::Tester { |
||||||
|
explicit VersionTest(); |
||||||
|
|
||||||
|
void test(); |
||||||
|
}; |
||||||
|
|
||||||
|
VersionTest::VersionTest() { |
||||||
|
addTests({&VersionTest::test}); |
||||||
|
} |
||||||
|
|
||||||
|
void VersionTest::test() { |
||||||
|
Debug{} << "MAGNUMBINDINGS_VERSION_YEAR:" << MAGNUMBINDINGS_VERSION_YEAR; |
||||||
|
Debug{} << "MAGNUMBINDINGS_VERSION_MONTH:" << MAGNUMBINDINGS_VERSION_MONTH; |
||||||
|
#ifdef MAGNUMBINDINGS_VERSION_COMMIT |
||||||
|
Debug{} << "MAGNUMBINDINGS_VERSION_COMMIT:" << MAGNUMBINDINGS_VERSION_COMMIT; |
||||||
|
Debug{} << "MAGNUMBINDINGS_VERSION_HASH:" << Debug::hex << MAGNUMBINDINGS_VERSION_HASH; |
||||||
|
Debug{} << "MAGNUMBINDINGS_VERSION_STRING:" << MAGNUMBINDINGS_VERSION_STRING; |
||||||
|
#else |
||||||
|
Debug{} << "No Git version information available."; |
||||||
|
#endif |
||||||
|
|
||||||
|
CORRADE_COMPARE_AS(MAGNUMBINDINGS_VERSION_YEAR, 2019, TestSuite::Compare::GreaterOrEqual); |
||||||
|
CORRADE_COMPARE_AS(MAGNUMBINDINGS_VERSION_YEAR, 2100, TestSuite::Compare::LessOrEqual); |
||||||
|
CORRADE_COMPARE_AS(MAGNUMBINDINGS_VERSION_MONTH, 0, TestSuite::Compare::Greater); |
||||||
|
CORRADE_COMPARE_AS(MAGNUMBINDINGS_VERSION_MONTH, 12, TestSuite::Compare::LessOrEqual); |
||||||
|
#ifdef MAGNUMBINDINGS_VERSION_COMMIT |
||||||
|
CORRADE_COMPARE_AS(MAGNUMBINDINGS_VERSION_COMMIT, 0, TestSuite::Compare::GreaterOrEqual); |
||||||
|
#endif |
||||||
|
} |
||||||
|
|
||||||
|
}}} |
||||||
|
|
||||||
|
CORRADE_TEST_MAIN(Magnum::Test::VersionTest) |
||||||
@ -0,0 +1,30 @@ |
|||||||
|
# |
||||||
|
# This file is part of Magnum. |
||||||
|
# |
||||||
|
# Copyright © 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, |
||||||
|
# 2020, 2021, 2022, 2023, 2024, 2025, 2026 |
||||||
|
# Vladimír Vondruš <mosra@centrum.cz> |
||||||
|
# |
||||||
|
# Permission is hereby granted, free of charge, to any person obtaining a |
||||||
|
# copy of this software and associated documentation files (the "Software"), |
||||||
|
# to deal in the Software without restriction, including without limitation |
||||||
|
# the rights to use, copy, modify, merge, publish, distribute, sublicense, |
||||||
|
# and/or sell copies of the Software, and to permit persons to whom the |
||||||
|
# Software is furnished to do so, subject to the following conditions: |
||||||
|
# |
||||||
|
# The above copyright notice and this permission notice shall be included |
||||||
|
# in all copies or substantial portions of the Software. |
||||||
|
# |
||||||
|
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
||||||
|
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
||||||
|
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
||||||
|
# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
||||||
|
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
||||||
|
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
||||||
|
# DEALINGS IN THE SOFTWARE. |
||||||
|
# |
||||||
|
|
||||||
|
if(MAGNUM_WITH_PYTHON) |
||||||
|
add_custom_target(MagnumTradePython SOURCES PythonBindings.h) |
||||||
|
install(FILES PythonBindings.h DESTINATION ${MAGNUM_INCLUDE_INSTALL_DIR}/Trade) |
||||||
|
endif() |
||||||
@ -0,0 +1,103 @@ |
|||||||
|
#ifndef Magnum_Trade_PythonBindings_h |
||||||
|
#define Magnum_Trade_PythonBindings_h |
||||||
|
/*
|
||||||
|
This file is part of Magnum. |
||||||
|
|
||||||
|
Copyright © 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, |
||||||
|
2020, 2021, 2022, 2023, 2024, 2025, 2026 |
||||||
|
Vladimír Vondruš <mosra@centrum.cz> |
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a |
||||||
|
copy of this software and associated documentation files (the "Software"), |
||||||
|
to deal in the Software without restriction, including without limitation |
||||||
|
the rights to use, copy, modify, merge, publish, distribute, sublicense, |
||||||
|
and/or sell copies of the Software, and to permit persons to whom the |
||||||
|
Software is furnished to do so, subject to the following conditions: |
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included |
||||||
|
in all copies or substantial portions of the Software. |
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
||||||
|
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
||||||
|
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
||||||
|
DEALINGS IN THE SOFTWARE. |
||||||
|
*/ |
||||||
|
|
||||||
|
#include <memory> /* :( */ |
||||||
|
#include <pybind11/pybind11.h> |
||||||
|
|
||||||
|
#include "Magnum/Trade/Data.h" |
||||||
|
#include "Magnum/Trade/MaterialData.h" /* :( */ |
||||||
|
#include "Magnum/Trade/MeshData.h" /* :( */ |
||||||
|
#include "Magnum/Trade/SceneData.h" |
||||||
|
|
||||||
|
namespace Magnum { namespace Trade { |
||||||
|
|
||||||
|
namespace Implementation { |
||||||
|
|
||||||
|
/* For assertions only */ |
||||||
|
template<class T> inline bool pyDataFlagsNeedOwner(const T& data) { |
||||||
|
return !(data.dataFlags() & (DataFlag::Owned|DataFlag::Global)); |
||||||
|
} |
||||||
|
inline bool pyDataFlagsNeedOwner(const MaterialData& data) { |
||||||
|
return |
||||||
|
!(data.attributeDataFlags() & (DataFlag::Owned|DataFlag::Global)) || |
||||||
|
!(data.layerDataFlags() & (DataFlag::Owned|DataFlag::Global)); |
||||||
|
} |
||||||
|
inline bool pyDataFlagsNeedOwner(const MeshData& data) { |
||||||
|
return |
||||||
|
!(data.indexDataFlags() & (DataFlag::Owned|DataFlag::Global)) || |
||||||
|
!(data.vertexDataFlags() & (DataFlag::Owned|DataFlag::Global)); |
||||||
|
} |
||||||
|
inline bool pyDataFlagsNeedOwner(const MeshAttributeData& data) { |
||||||
|
return data.data().data(); |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
/* Stores additional stuff needed for proper refcounting of non-owning FooData.
|
||||||
|
Better than subclassing each FooData class because then we would need to |
||||||
|
wrap it every time it's exposed to Python, making 3rd party bindings |
||||||
|
unnecessarily complex */ |
||||||
|
template<class T> struct PyDataHolder: std::unique_ptr<T> { |
||||||
|
explicit PyDataHolder(T* object): PyDataHolder{object, pybind11::none{}} { |
||||||
|
/* Data without an owner can only be self-owned, global or empty */ |
||||||
|
CORRADE_INTERNAL_ASSERT(!Implementation::pyDataFlagsNeedOwner(*object)); |
||||||
|
} |
||||||
|
|
||||||
|
explicit PyDataHolder(T* object, pybind11::object owner): std::unique_ptr<T>{object}, owner{std::move(owner)} {} |
||||||
|
|
||||||
|
pybind11::object owner; |
||||||
|
}; |
||||||
|
|
||||||
|
template<class T> PyDataHolder<T> pyDataHolder(T&& data, pybind11::object owner) { |
||||||
|
return PyDataHolder<T>{new T{std::move(data)}, std::move(owner)}; |
||||||
|
} |
||||||
|
|
||||||
|
/* Compared to PyDataHolder this stores two owner objects. Has to be a template
|
||||||
|
even though it's only ever used for a single type because |
||||||
|
PYBIND11_DECLARE_HOLDER_TYPE() wants it to be so. */ |
||||||
|
template<class T> struct PySceneFieldDataHolder: std::unique_ptr<SceneFieldData> { |
||||||
|
explicit PySceneFieldDataHolder(SceneFieldData* object): PySceneFieldDataHolder{object, pybind11::none{}, pybind11::none{}} { |
||||||
|
/* Data without owners can only be empty */ |
||||||
|
CORRADE_INTERNAL_ASSERT(!object->mappingData().data() && !object->fieldData().data()); |
||||||
|
} |
||||||
|
|
||||||
|
explicit PySceneFieldDataHolder(SceneFieldData* object, pybind11::object mappingOwner, pybind11::object fieldOwner): std::unique_ptr<T>{object}, mappingOwner{std::move(mappingOwner)}, fieldOwner{std::move(fieldOwner)} {} |
||||||
|
|
||||||
|
pybind11::object mappingOwner, fieldOwner; |
||||||
|
}; |
||||||
|
|
||||||
|
inline PySceneFieldDataHolder<SceneFieldData> pySceneFieldDataHolder(SceneFieldData&& data, pybind11::object mappingOwner, pybind11::object fieldOwner) { |
||||||
|
return PySceneFieldDataHolder<SceneFieldData>{new SceneFieldData{std::move(data)}, std::move(mappingOwner), std::move(fieldOwner)}; |
||||||
|
} |
||||||
|
|
||||||
|
}} |
||||||
|
|
||||||
|
PYBIND11_DECLARE_HOLDER_TYPE(T, Magnum::Trade::PyDataHolder<T>) |
||||||
|
PYBIND11_DECLARE_HOLDER_TYPE(T, Magnum::Trade::PySceneFieldDataHolder<T>) |
||||||
|
|
||||||
|
#endif |
||||||
@ -0,0 +1,39 @@ |
|||||||
|
#ifndef Magnum_versionBindings_h |
||||||
|
#define Magnum_versionBindings_h |
||||||
|
/* |
||||||
|
This file is part of Magnum. |
||||||
|
|
||||||
|
Copyright © 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, |
||||||
|
2020, 2021, 2022, 2023, 2024, 2025, 2026 |
||||||
|
Vladimír Vondruš <mosra@centrum.cz> |
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a |
||||||
|
copy of this software and associated documentation files (the "Software"), |
||||||
|
to deal in the Software without restriction, including without limitation |
||||||
|
the rights to use, copy, modify, merge, publish, distribute, sublicense, |
||||||
|
and/or sell copies of the Software, and to permit persons to whom the |
||||||
|
Software is furnished to do so, subject to the following conditions: |
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included |
||||||
|
in all copies or substantial portions of the Software. |
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
||||||
|
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
||||||
|
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
||||||
|
DEALINGS IN THE SOFTWARE. |
||||||
|
*/ |
||||||
|
|
||||||
|
/* Note: this header is deliberately not included from anywhere except |
||||||
|
VersionTest to avoid triggering a full rebuild every time the Git commit |
||||||
|
hash changes. */ |
||||||
|
|
||||||
|
#define MAGNUMBINDINGS_VERSION_YEAR ${MAGNUMBINDINGS_VERSION_YEAR} |
||||||
|
#define MAGNUMBINDINGS_VERSION_MONTH ${MAGNUMBINDINGS_VERSION_MONTH} |
||||||
|
#cmakedefine MAGNUMBINDINGS_VERSION_COMMIT${MAGNUMBINDINGS_VERSION_COMMIT} |
||||||
|
#cmakedefine MAGNUMBINDINGS_VERSION_HASH 0x${MAGNUMBINDINGS_VERSION_HASH} |
||||||
|
#cmakedefine MAGNUMBINDINGS_VERSION_STRING "${MAGNUMBINDINGS_VERSION_STRING}" |
||||||
|
|
||||||
|
#endif |
||||||
@ -0,0 +1,82 @@ |
|||||||
|
# |
||||||
|
# This file is part of Magnum. |
||||||
|
# |
||||||
|
# Copyright © 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, |
||||||
|
# 2020, 2021, 2022, 2023, 2024, 2025, 2026 |
||||||
|
# Vladimír Vondruš <mosra@centrum.cz> |
||||||
|
# |
||||||
|
# Permission is hereby granted, free of charge, to any person obtaining a |
||||||
|
# copy of this software and associated documentation files (the "Software"), |
||||||
|
# to deal in the Software without restriction, including without limitation |
||||||
|
# the rights to use, copy, modify, merge, publish, distribute, sublicense, |
||||||
|
# and/or sell copies of the Software, and to permit persons to whom the |
||||||
|
# Software is furnished to do so, subject to the following conditions: |
||||||
|
# |
||||||
|
# The above copyright notice and this permission notice shall be included |
||||||
|
# in all copies or substantial portions of the Software. |
||||||
|
# |
||||||
|
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
||||||
|
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
||||||
|
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
||||||
|
# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
||||||
|
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
||||||
|
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
||||||
|
# DEALINGS IN THE SOFTWARE. |
||||||
|
# |
||||||
|
|
||||||
|
"""Root Corrade module""" |
||||||
|
|
||||||
|
# If MAGNUM_BUILD_PYTHON_BINDINGS_RTLD_GLOBAL is enabled in CMake, the lines |
||||||
|
# below are included, otherwise they are commented out. What it does is a |
||||||
|
# futile attempt to make Corrade (and Magnum) built as static libraries work |
||||||
|
# together when built into multiple dynamic Python modules. |
||||||
|
${_MAGNUM_BUILD_PYTHON_BINDINGS_RTLD_GLOBAL}import sys |
||||||
|
${_MAGNUM_BUILD_PYTHON_BINDINGS_RTLD_GLOBAL}import ctypes |
||||||
|
${_MAGNUM_BUILD_PYTHON_BINDINGS_RTLD_GLOBAL}sys.setdlopenflags(sys.getdlopenflags()|ctypes.RTLD_GLOBAL) |
||||||
|
|
||||||
|
# On Windows, if a known directory layout is detected, add paths containing |
||||||
|
# binaries to the DLL search path |
||||||
|
import platform |
||||||
|
if platform.system() == 'Windows': |
||||||
|
import os |
||||||
|
# os.add_dll_directory() is only since Python 3.8, in earlier versions |
||||||
|
# PATH is used and that alone may be sufficient |
||||||
|
if hasattr(os, 'add_dll_directory'): |
||||||
|
# The variable might be empty, or might contain empty parts, so skip |
||||||
|
# all empty items. There's no splitWithoutEmptyParts() like in Corrade, |
||||||
|
# sigh. Using """ to prevent accidental syntax errors if the path |
||||||
|
# itself would contain quotes. |
||||||
|
for directory in """${MAGNUM_PYTHON_BINDINGS_DLL_PATH}""".split(';'): |
||||||
|
if not directory: |
||||||
|
continue |
||||||
|
|
||||||
|
# If the directory is relative, interpret is as relative to parent |
||||||
|
# dir. Also add it only if it exists. |
||||||
|
bin_path = os.path.join(os.path.dirname(os.path.dirname(__file__)), directory) |
||||||
|
if os.path.exists(bin_path): |
||||||
|
os.add_dll_directory(bin_path) |
||||||
|
|
||||||
|
from _corrade import * |
||||||
|
|
||||||
|
import sys |
||||||
|
|
||||||
|
# In case Corrade is built statically, the whole core project is put into |
||||||
|
# _corrade. The following feels extremely hackish, but without that it wouldn't |
||||||
|
# be possible to do `import corrade.containers`, which is weird |
||||||
|
# (`from corrade import containers` works, tho, for whatever reason) |
||||||
|
for i in ['containers', 'pluginmanager', 'utility']: |
||||||
|
if i in globals(): sys.modules['corrade.' + i] = globals()[i] |
||||||
|
|
||||||
|
# Just to not have the variable leak into stubs generated by pybind11-stubgen |
||||||
|
# TODO any way to exclude it? |
||||||
|
del i |
||||||
|
|
||||||
|
# Prevent all submodules being pulled in when saying `from corrade import *` -- |
||||||
|
# this is consistent with behavior in magnum |
||||||
|
__all__ = [ |
||||||
|
# TARGET_*, BUILD_* are omitted as `from corrade import *` would pull them |
||||||
|
# to globals and this would likely cause conflicts (magnum also defines |
||||||
|
# BUILD_*) |
||||||
|
] |
||||||
|
|
||||||
|
# kate: hl python |
||||||
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,190 @@ |
|||||||
|
/*
|
||||||
|
This file is part of Magnum. |
||||||
|
|
||||||
|
Copyright © 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, |
||||||
|
2020, 2021, 2022, 2023, 2024, 2025, 2026 |
||||||
|
Vladimír Vondruš <mosra@centrum.cz> |
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a |
||||||
|
copy of this software and associated documentation files (the "Software"), |
||||||
|
to deal in the Software without restriction, including without limitation |
||||||
|
the rights to use, copy, modify, merge, publish, distribute, sublicense, |
||||||
|
and/or sell copies of the Software, and to permit persons to whom the |
||||||
|
Software is furnished to do so, subject to the following conditions: |
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included |
||||||
|
in all copies or substantial portions of the Software. |
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
||||||
|
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
||||||
|
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
||||||
|
DEALINGS IN THE SOFTWARE. |
||||||
|
*/ |
||||||
|
|
||||||
|
#include "pluginmanager.h" |
||||||
|
|
||||||
|
#include <pybind11/pybind11.h> |
||||||
|
#include <pybind11/stl.h> /* for pluginList() and aliasList() */ |
||||||
|
#include <Corrade/Containers/StringStl.h> /** @todo drop once we have our string casters */ |
||||||
|
#include <Corrade/Containers/StringIterable.h> |
||||||
|
#include <Corrade/PluginManager/AbstractManager.h> |
||||||
|
#include <Corrade/PluginManager/AbstractPlugin.h> |
||||||
|
#include <Corrade/PluginManager/PluginMetadata.h> |
||||||
|
#include <Corrade/Utility/ConfigurationGroup.h> |
||||||
|
|
||||||
|
#include "Corrade/PythonBindings.h" |
||||||
|
|
||||||
|
#include "corrade/bootstrap.h" |
||||||
|
#include "corrade/EnumOperators.h" |
||||||
|
|
||||||
|
namespace corrade { |
||||||
|
|
||||||
|
void pluginmanager(py::module_& m) { |
||||||
|
m.doc() = "Plugin management"; |
||||||
|
|
||||||
|
#ifndef CORRADE_BUILD_STATIC |
||||||
|
/* Need ConfigurationGroup from there. These are a part of the same module
|
||||||
|
in the static build, no need to import (also can't import because there |
||||||
|
it's _corrade.*) */ |
||||||
|
py::module_::import("corrade.utility"); |
||||||
|
#endif |
||||||
|
|
||||||
|
py::enum_<PluginManager::LoadState> loadState{m, "LoadState", "Plugin load state"}; |
||||||
|
loadState |
||||||
|
.value("NOT_FOUND", PluginManager::LoadState::NotFound) |
||||||
|
.value("WRONG_PLUGIN_VERSION", PluginManager::LoadState::WrongPluginVersion) |
||||||
|
.value("WRONG_INTERFACE_VERSION", PluginManager::LoadState::WrongInterfaceVersion) |
||||||
|
.value("WRONG_METADATA_FILE", PluginManager::LoadState::WrongMetadataFile) |
||||||
|
.value("UNRESOLVED_DEPENDENCY", PluginManager::LoadState::UnresolvedDependency) |
||||||
|
.value("STATIC", PluginManager::LoadState::Static) |
||||||
|
.value("LOADED", PluginManager::LoadState::Loaded) |
||||||
|
.value("NOT_LOADED", PluginManager::LoadState::NotLoaded) |
||||||
|
.value("UNLOAD_FAILED", PluginManager::LoadState::UnloadFailed) |
||||||
|
.value("REQUIRED", PluginManager::LoadState::Required) |
||||||
|
.value("USED", PluginManager::LoadState::Used); |
||||||
|
corrade::enumOperators(loadState); |
||||||
|
|
||||||
|
py::class_<PluginManager::PluginMetadata>{m, "PluginMetadata", "Plugin metadata"} |
||||||
|
.def_property_readonly("name", [](PluginManager::PluginMetadata& self) { |
||||||
|
/** @todo drop std::string in favor of our own string caster */ |
||||||
|
return std::string{self.name()}; |
||||||
|
}, "Plugin name") |
||||||
|
.def_property_readonly("depends", [](PluginManager::PluginMetadata& self) { |
||||||
|
/** @todo make a generic caster for arbitrary arrays and strings */ |
||||||
|
std::vector<std::string> out; |
||||||
|
for(Containers::StringView i: self.depends()) |
||||||
|
out.push_back(i); |
||||||
|
return out; |
||||||
|
}, "Plugins on which this plugin depends") |
||||||
|
.def_property_readonly("used_by", [](PluginManager::PluginMetadata& self) { |
||||||
|
/** @todo make a generic caster for arbitrary arrays and strings */ |
||||||
|
std::vector<std::string> out; |
||||||
|
for(Containers::StringView i: self.usedBy()) |
||||||
|
out.push_back(i); |
||||||
|
return out; |
||||||
|
}, "Plugins which depend on this plugin") |
||||||
|
.def_property_readonly("provides", [](PluginManager::PluginMetadata& self) { |
||||||
|
/** @todo make a generic caster for arbitrary arrays and strings */ |
||||||
|
std::vector<std::string> out; |
||||||
|
for(Containers::StringView i: self.provides()) |
||||||
|
out.push_back(i); |
||||||
|
return out; |
||||||
|
}, "Plugins which are provided by this plugin") |
||||||
|
/** @todo data? no plugin uses this at the moment */ |
||||||
|
.def_property_readonly("configuration", static_cast<Utility::ConfigurationGroup&(PluginManager::PluginMetadata::*)()>(&PluginManager::PluginMetadata::configuration), "Initial plugin-specific configuration", py::return_value_policy::reference_internal); |
||||||
|
|
||||||
|
PyNonDestructibleClass<PluginManager::AbstractManager> manager{m, "AbstractManager", "Base for plugin managers"}; |
||||||
|
manager.attr("VERSION") = PluginManager::AbstractManager::Version; |
||||||
|
manager |
||||||
|
.def_property_readonly("plugin_interface", [](PluginManager::AbstractManager& self) { |
||||||
|
/** @todo drop std::string in favor of our own string caster */ |
||||||
|
return std::string{self.pluginInterface()}; |
||||||
|
}, "Plugin interface string") |
||||||
|
.def_property("plugin_directory", |
||||||
|
/** @todo drop std::string in favor of our own string caster */ |
||||||
|
[](PluginManager::AbstractManager& self) { |
||||||
|
return std::string{self.pluginDirectory()}; |
||||||
|
}, [](PluginManager::AbstractManager& self, const std::string& directory) { |
||||||
|
self.setPluginDirectory(directory); |
||||||
|
}, "Plugin directory") |
||||||
|
.def("reload_plugin_directory", &PluginManager::AbstractManager::reloadPluginDirectory, "Reload plugin directory") |
||||||
|
.def("set_preferred_plugins", [](PluginManager::AbstractManager& self, const std::string& alias, const std::vector<std::string>& plugins) { |
||||||
|
if(self.loadState(alias) == PluginManager::LoadState::NotFound) { |
||||||
|
PyErr_SetNone(PyExc_KeyError); |
||||||
|
throw py::error_already_set{}; |
||||||
|
} |
||||||
|
|
||||||
|
/** @todo drop all this once StringIterable can be a view on
|
||||||
|
std::strings */ |
||||||
|
Containers::Array<Containers::StringView> pluginViews{NoInit, plugins.size()}; |
||||||
|
for(std::size_t i = 0; i != plugins.size(); ++i) |
||||||
|
pluginViews[i] = plugins[i]; |
||||||
|
self.setPreferredPlugins(alias, pluginViews); |
||||||
|
}, "Set preferred plugins for given alias", py::arg("alias"), py::arg("plugins")) |
||||||
|
.def_property_readonly("plugin_list", [](PluginManager::AbstractManager& self) { |
||||||
|
/** @todo make a generic caster for arbitrary arrays and strings */ |
||||||
|
std::vector<std::string> out; |
||||||
|
for(Containers::StringView i: self.pluginList()) |
||||||
|
out.push_back(i); |
||||||
|
return out; |
||||||
|
}, "List of all available plugin names") |
||||||
|
.def_property_readonly("alias_list", [](PluginManager::AbstractManager& self) { |
||||||
|
/** @todo make a generic caster for arbitrary arrays and strings */ |
||||||
|
std::vector<std::string> out; |
||||||
|
for(Containers::StringView i: self.aliasList()) |
||||||
|
out.push_back(i); |
||||||
|
return out; |
||||||
|
}, "List of all available alias names") |
||||||
|
.def("metadata", [](PluginManager::AbstractManager& self, const std::string& plugin) { |
||||||
|
return self.metadata(plugin); |
||||||
|
}, "Plugin metadata", py::arg("plugin"), py::return_value_policy::reference_internal) |
||||||
|
/** @todo drop std::string in favor of our own string caster */ |
||||||
|
.def("load_state", [](PluginManager::AbstractManager& self, const std::string& plugin) { |
||||||
|
return self.loadState(plugin); |
||||||
|
}, "Load state of a plugin", py::arg("plugin")) |
||||||
|
.def("load", [](PluginManager::AbstractManager& self, const std::string& plugin) { |
||||||
|
/** @todo log redirection -- but we'd need assertions to not be
|
||||||
|
part of that so when it dies, the user can still see why */ |
||||||
|
const PluginManager::LoadState state = self.load(plugin); |
||||||
|
if(!(state & PluginManager::LoadState::Loaded)) { |
||||||
|
PyErr_Format(PyExc_RuntimeError, "can't load plugin %s", plugin.data()); |
||||||
|
throw py::error_already_set{}; |
||||||
|
} |
||||||
|
|
||||||
|
return state; |
||||||
|
}, "Load a plugin", py::arg("plugin")) |
||||||
|
.def("unload", [](PluginManager::AbstractManager& self, const std::string& plugin) { |
||||||
|
/** @todo log redirection -- but we'd need assertions to not be
|
||||||
|
part of that so when it dies, the user can still see why */ |
||||||
|
const PluginManager::LoadState state = self.unload(plugin); |
||||||
|
if(state != PluginManager::LoadState::NotLoaded && state != PluginManager::LoadState::Static) { |
||||||
|
PyErr_Format(PyExc_RuntimeError, "can't unload plugin %s", plugin.data()); |
||||||
|
throw py::error_already_set{}; |
||||||
|
} |
||||||
|
|
||||||
|
return state; |
||||||
|
}, "Unload a plugin", py::arg("plugin")) |
||||||
|
.def("register_external_manager", &PluginManager::AbstractManager::registerExternalManager, "Register an external manager for resolving inter-manager dependencies", py::arg("manager"), py::keep_alive<1, 2>()); |
||||||
|
|
||||||
|
py::class_<PluginManager::AbstractPlugin, PluginManager::PyPluginHolder<PluginManager::AbstractPlugin>>{m, "AbstractPlugin", "Base class for plugin interfaces"} |
||||||
|
/* Plugin interface string, search paths, suffix, metadata file suffix
|
||||||
|
are meant to be overriden in subclasses */ |
||||||
|
.def_property_readonly("plugin", [](PluginManager::AbstractPlugin& self) { |
||||||
|
/** @todo drop std::string in favor of our own string caster */ |
||||||
|
return std::string{self.plugin()}; |
||||||
|
}, "Plugin identifier string") |
||||||
|
.def_property_readonly("metadata", &PluginManager::AbstractPlugin::metadata, "Plugin metadata", py::return_value_policy::reference_internal) |
||||||
|
.def_property_readonly("configuration", static_cast<Utility::ConfigurationGroup&(PluginManager::AbstractPlugin::*)()>(&PluginManager::AbstractPlugin::configuration), "Plugin-specific configuration", py::return_value_policy::reference_internal); |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
#ifndef CORRADE_BUILD_STATIC |
||||||
|
extern "C" PYBIND11_EXPORT PyObject* PyInit_pluginmanager(); |
||||||
|
PYBIND11_MODULE(pluginmanager, m) { |
||||||
|
corrade::pluginmanager(m); |
||||||
|
} |
||||||
|
#endif |
||||||
@ -0,0 +1,102 @@ |
|||||||
|
#ifndef corrade_pluginmanager_h |
||||||
|
#define corrade_pluginmanager_h |
||||||
|
/*
|
||||||
|
This file is part of Magnum. |
||||||
|
|
||||||
|
Copyright © 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, |
||||||
|
2020, 2021, 2022, 2023, 2024, 2025, 2026 |
||||||
|
Vladimír Vondruš <mosra@centrum.cz> |
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a |
||||||
|
copy of this software and associated documentation files (the "Software"), |
||||||
|
to deal in the Software without restriction, including without limitation |
||||||
|
the rights to use, copy, modify, merge, publish, distribute, sublicense, |
||||||
|
and/or sell copies of the Software, and to permit persons to whom the |
||||||
|
Software is furnished to do so, subject to the following conditions: |
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included |
||||||
|
in all copies or substantial portions of the Software. |
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
||||||
|
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
||||||
|
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
||||||
|
DEALINGS IN THE SOFTWARE. |
||||||
|
*/ |
||||||
|
|
||||||
|
#include <memory> /* :( */ |
||||||
|
#include <pybind11/pybind11.h> |
||||||
|
#include <pybind11/stl.h> /** @todo remove once I can return Array<String> directly */ |
||||||
|
#include <Corrade/Containers/Array.h> |
||||||
|
#include <Corrade/Containers/StringStl.h> /** @todo drop once we have our string casters */ |
||||||
|
#include <Corrade/PluginManager/Manager.h> |
||||||
|
|
||||||
|
#include "Corrade/PythonBindings.h" |
||||||
|
#include "Corrade/PluginManager/PythonBindings.h" |
||||||
|
|
||||||
|
#include "corrade/bootstrap.h" |
||||||
|
|
||||||
|
namespace corrade { |
||||||
|
|
||||||
|
template<class T> void plugin(py::class_<T, PluginManager::PyPluginHolder<T>, PluginManager::AbstractPlugin>& c) { |
||||||
|
c |
||||||
|
.def_property_readonly_static("plugin_interface", [](const py::object&) { |
||||||
|
/** @todo drop std::string in favor of our own string caster */ |
||||||
|
return std::string{T::pluginInterface()}; |
||||||
|
}, "Plugin interface string") |
||||||
|
.def_property_readonly_static("plugin_search_paths", [](const py::object&) { |
||||||
|
/** @todo drop std::string in favor of our own string caster */ |
||||||
|
std::vector<std::string> out; |
||||||
|
for(auto&& i: T::pluginSearchPaths()) |
||||||
|
out.push_back(i); |
||||||
|
return out; |
||||||
|
}, "Plugin search paths") |
||||||
|
.def_property_readonly_static("plugin_suffix", [](const py::object&) { |
||||||
|
/** @todo drop std::string in favor of our own string caster */ |
||||||
|
return std::string{T::pluginSuffix()}; |
||||||
|
}, "Plugin binary suffix") |
||||||
|
.def_property_readonly_static("plugin_metadata_suffix", [](const py::object&) { |
||||||
|
/** @todo drop std::string in favor of our own string caster */ |
||||||
|
return std::string{T::pluginMetadataSuffix()}; |
||||||
|
}, "Plugin metadata file suffix") |
||||||
|
/** @todo plugin interface string, search paths, suffix, metadata file
|
||||||
|
suffix (all are static properties) */ |
||||||
|
.def_property_readonly("manager", [](const T& self) { |
||||||
|
return pyObjectHolderFor<PluginManager::PyPluginHolder>(self).manager; |
||||||
|
}, "Manager owning this plugin instance"); |
||||||
|
} |
||||||
|
|
||||||
|
template<class T> void manager(py::class_<PluginManager::Manager<T>, PluginManager::AbstractManager>& c) { |
||||||
|
c |
||||||
|
.def(py::init<const std::string&>(), py::arg("plugin_directory") = std::string{}, "Constructor") |
||||||
|
.def("instantiate", [](PluginManager::Manager<T>& self, const std::string& plugin) { |
||||||
|
/* This causes a double lookup, but well... better than dying */ |
||||||
|
if(!(self.loadState(plugin) & PluginManager::LoadState::Loaded)) { |
||||||
|
PyErr_Format(PyExc_RuntimeError, "plugin %s is not loaded", plugin.data()); |
||||||
|
throw py::error_already_set{}; |
||||||
|
} |
||||||
|
|
||||||
|
auto loaded = self.instantiate(plugin); |
||||||
|
if(!loaded) { |
||||||
|
PyErr_Format(PyExc_RuntimeError, "can't instantiate plugin %s", plugin.data()); |
||||||
|
throw py::error_already_set{}; |
||||||
|
} |
||||||
|
|
||||||
|
return PluginManager::pyPluginHolder(std::move(loaded), py::cast(self)); |
||||||
|
}, "Instantiate a plugin") |
||||||
|
.def("load_and_instantiate", [](PluginManager::Manager<T>& self, const std::string& plugin) { |
||||||
|
auto loaded = self.loadAndInstantiate(plugin); |
||||||
|
if(!loaded) { |
||||||
|
PyErr_Format(PyExc_RuntimeError, "can't load and instantiate plugin %s", plugin.data()); |
||||||
|
throw py::error_already_set{}; |
||||||
|
} |
||||||
|
|
||||||
|
return PluginManager::pyPluginHolder(std::move(loaded), py::cast(self)); |
||||||
|
}, "Load and instantiate plugin"); |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
#endif |
||||||
@ -0,0 +1,30 @@ |
|||||||
|
/* |
||||||
|
This file is part of Magnum. |
||||||
|
|
||||||
|
Copyright © 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, |
||||||
|
2020, 2021, 2022, 2023, 2024, 2025, 2026 |
||||||
|
Vladimír Vondruš <mosra@centrum.cz> |
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a |
||||||
|
copy of this software and associated documentation files (the "Software"), |
||||||
|
to deal in the Software without restriction, including without limitation |
||||||
|
the rights to use, copy, modify, merge, publish, distribute, sublicense, |
||||||
|
and/or sell copies of the Software, and to permit persons to whom the |
||||||
|
Software is furnished to do so, subject to the following conditions: |
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included |
||||||
|
in all copies or substantial portions of the Software. |
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
||||||
|
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
||||||
|
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
||||||
|
DEALINGS IN THE SOFTWARE. |
||||||
|
*/ |
||||||
|
|
||||||
|
/* Named corrade/staticconfigure.h to avoid it colliding with Corrade/configure.h |
||||||
|
on case-insensitive filesystems */ |
||||||
|
|
||||||
|
#cmakedefine Corrade_PluginManager_FOUND |
||||||
@ -0,0 +1,36 @@ |
|||||||
|
# |
||||||
|
# This file is part of Magnum. |
||||||
|
# |
||||||
|
# Copyright © 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, |
||||||
|
# 2020, 2021, 2022, 2023, 2024, 2025, 2026 |
||||||
|
# Vladimír Vondruš <mosra@centrum.cz> |
||||||
|
# |
||||||
|
# Permission is hereby granted, free of charge, to any person obtaining a |
||||||
|
# copy of this software and associated documentation files (the "Software"), |
||||||
|
# to deal in the Software without restriction, including without limitation |
||||||
|
# the rights to use, copy, modify, merge, publish, distribute, sublicense, |
||||||
|
# and/or sell copies of the Software, and to permit persons to whom the |
||||||
|
# Software is furnished to do so, subject to the following conditions: |
||||||
|
# |
||||||
|
# The above copyright notice and this permission notice shall be included |
||||||
|
# in all copies or substantial portions of the Software. |
||||||
|
# |
||||||
|
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
||||||
|
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
||||||
|
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
||||||
|
# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
||||||
|
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
||||||
|
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
||||||
|
# DEALINGS IN THE SOFTWARE. |
||||||
|
# |
||||||
|
|
||||||
|
# IDE folder in VS, Xcode etc. CMake 3.12+, older versions have only the FOLDER |
||||||
|
# property that would have to be set on each target separately. |
||||||
|
set(CMAKE_FOLDER "Corrade/Python/Test") |
||||||
|
|
||||||
|
foreach(_test optional stridedarrayview) |
||||||
|
pybind11_add_module(test_${_test} ${pybind11_add_module_SYSTEM} test_${_test}.cpp) |
||||||
|
target_include_directories(test_${_test} PRIVATE ${PROJECT_SOURCE_DIR}/src) |
||||||
|
target_link_libraries(test_${_test} PRIVATE Corrade::Containers) |
||||||
|
set_target_properties(test_${_test} PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${output_dir}) |
||||||
|
endforeach() |
||||||
@ -0,0 +1,6 @@ |
|||||||
|
someKey=42 |
||||||
|
[someGroup] |
||||||
|
value=hello |
||||||
|
[someGroup/subgroup] |
||||||
|
anotherValue=another |
||||||
|
[emptyGroup] |
||||||
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,186 @@ |
|||||||
|
# |
||||||
|
# This file is part of Magnum. |
||||||
|
# |
||||||
|
# Copyright © 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, |
||||||
|
# 2020, 2021, 2022, 2023, 2024, 2025, 2026 |
||||||
|
# Vladimír Vondruš <mosra@centrum.cz> |
||||||
|
# |
||||||
|
# Permission is hereby granted, free of charge, to any person obtaining a |
||||||
|
# copy of this software and associated documentation files (the "Software"), |
||||||
|
# to deal in the Software without restriction, including without limitation |
||||||
|
# the rights to use, copy, modify, merge, publish, distribute, sublicense, |
||||||
|
# and/or sell copies of the Software, and to permit persons to whom the |
||||||
|
# Software is furnished to do so, subject to the following conditions: |
||||||
|
# |
||||||
|
# The above copyright notice and this permission notice shall be included |
||||||
|
# in all copies or substantial portions of the Software. |
||||||
|
# |
||||||
|
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
||||||
|
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
||||||
|
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
||||||
|
# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
||||||
|
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
||||||
|
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
||||||
|
# DEALINGS IN THE SOFTWARE. |
||||||
|
# |
||||||
|
|
||||||
|
import unittest |
||||||
|
|
||||||
|
from corrade import containers |
||||||
|
import test_stridedarrayview |
||||||
|
|
||||||
|
try: |
||||||
|
import numpy as np |
||||||
|
except ModuleNotFoundError: |
||||||
|
raise unittest.SkipTest("numpy not installed") |
||||||
|
|
||||||
|
class StridedArrayViewCustomType(unittest.TestCase): |
||||||
|
# This tests exposing statically typed StridedArrayView instances from C++, |
||||||
|
# see StridedArrayViewCustomDynamicType below for types specified |
||||||
|
# dynamically and types inherited from the buffer protocol. The short and |
||||||
|
# mutable_int variants tested in test_containers, as for those memoryview |
||||||
|
# works well... well, for one dimension it does. |
||||||
|
|
||||||
|
def test_mutable_vector3d(self): |
||||||
|
a = test_stridedarrayview.MutableContainer3d() |
||||||
|
self.assertEqual(type(a.view), containers.MutableStridedArrayView2D) |
||||||
|
self.assertEqual(a.view.format, 'ddd') |
||||||
|
self.assertEqual(a.list, [ |
||||||
|
[0.0, 0.0, 0.0], |
||||||
|
[0.0, 0.0, 0.0], |
||||||
|
[0.0, 0.0, 0.0], |
||||||
|
[0.0, 0.0, 0.0], |
||||||
|
[0.0, 0.0, 0.0], |
||||||
|
[0.0, 0.0, 0.0] |
||||||
|
]) |
||||||
|
a.view[0][1] = [-765.6581, 3.5, 1.125] |
||||||
|
a.view[1][2] = [4.666, 0.25, -7.5] |
||||||
|
self.assertEqual(a.list, [ |
||||||
|
[0.0, 0.0, 0.0], |
||||||
|
[-765.6581, 3.5, 1.125], |
||||||
|
[0.0, 0.0, 0.0], |
||||||
|
[0.0, 0.0, 0.0], |
||||||
|
[0.0, 0.0, 0.0], |
||||||
|
[4.666, 0.25, -7.5] |
||||||
|
]) |
||||||
|
|
||||||
|
# memoryview ... doesn't understand the type. HAH |
||||||
|
mav = memoryview(a.view[0]) |
||||||
|
with self.assertRaisesRegex(NotImplementedError, "unsupported format ddd"): |
||||||
|
self.assertEqual(mav[1], [-765.6581, 3.5, 1.125]) |
||||||
|
|
||||||
|
# Test that numpy understands the type and has changes reflected |
||||||
|
av = np.array(a.view, copy=False) |
||||||
|
a.view[1][0] = [-3.33, 1.0, 0.0] |
||||||
|
# Converting to a tuple, otherwise numpy always compares to False |
||||||
|
self.assertEqual(tuple(av[1][0]), (-3.33, 1.0, 0.0)) |
||||||
|
self.assertEqual(tuple(av[1][1]), (0.0, 0.0, 0.0)) |
||||||
|
self.assertEqual(tuple(av[1][2]), (4.666, 0.25, -7.5)) |
||||||
|
|
||||||
|
# And the other way around as well |
||||||
|
av[1][1] = (1.0, 0.125, 1.125) |
||||||
|
self.assertEqual(a.list, [ |
||||||
|
[0.0, 0.0, 0.0], |
||||||
|
[-765.6581, 3.5, 1.125], |
||||||
|
[0.0, 0.0, 0.0], |
||||||
|
[-3.33, 1.0, 0.0], |
||||||
|
[1.0, 0.125, 1.125], |
||||||
|
[4.666, 0.25, -7.5] |
||||||
|
]) |
||||||
|
|
||||||
|
def test_mutable_long_float(self): |
||||||
|
a = test_stridedarrayview.MutableContainerlf() |
||||||
|
self.assertEqual(type(a.view), containers.MutableStridedArrayView2D) |
||||||
|
self.assertEqual(a.view.format, 'Qf') |
||||||
|
self.assertEqual(a.list, [ |
||||||
|
(0, 0.0), |
||||||
|
(0, 0.0), |
||||||
|
(0, 0.0), |
||||||
|
(0, 0.0), |
||||||
|
(0, 0.0), |
||||||
|
(0, 0.0) |
||||||
|
]) |
||||||
|
a.view[0][1] = (7656581356781257, 1.125) |
||||||
|
a.view[1][2] = (4666025, -7.5) |
||||||
|
self.assertEqual(a.list, [ |
||||||
|
(0, 0.0), |
||||||
|
(7656581356781257, 1.125), |
||||||
|
(0, 0.0), |
||||||
|
(0, 0.0), |
||||||
|
(0, 0.0), |
||||||
|
(4666025, -7.5) |
||||||
|
]) |
||||||
|
|
||||||
|
# memoryview ... doesn't understand the type. HAH |
||||||
|
mav = memoryview(a.view[0]) |
||||||
|
with self.assertRaisesRegex(NotImplementedError, "unsupported format Qf"): |
||||||
|
self.assertEqual(mav[1], (7656581356781257, 1.125)) |
||||||
|
|
||||||
|
# Test that numpy understands the type and has changes reflected |
||||||
|
av = np.array(a.view, copy=False) |
||||||
|
a.view[1][0] = (333106832, 0.0) |
||||||
|
# Converting to a tuple, otherwise numpy always compares to False |
||||||
|
self.assertEqual(tuple(av[1][0]), (333106832, 0.0)) |
||||||
|
self.assertEqual(tuple(av[1][1]), (0, 0.0)) |
||||||
|
self.assertEqual(tuple(av[1][2]), (4666025, -7.5)) |
||||||
|
|
||||||
|
# And the other way around as well |
||||||
|
av[1][1] = (1001, 1.125) |
||||||
|
self.assertEqual(a.list, [ |
||||||
|
(0, 0.0), |
||||||
|
(7656581356781257, 1.125), |
||||||
|
(0, 0.0), |
||||||
|
(333106832, 0.0), |
||||||
|
(1001, 1.125), |
||||||
|
(4666025, -7.5) |
||||||
|
]) |
||||||
|
|
||||||
|
class StridedArrayViewCustomDynamicType(unittest.TestCase): |
||||||
|
def test_binding_short_short(self): |
||||||
|
a = test_stridedarrayview.MutableContainerDynamicType('hh') |
||||||
|
self.assertEqual(a.view.size, (2, 3)) |
||||||
|
self.assertEqual(a.view.stride, (12, 4)) |
||||||
|
self.assertEqual(a.view.format, 'hh') |
||||||
|
|
||||||
|
# Test that numpy understands the type and has changes reflected |
||||||
|
av = np.array(a.view, copy=False) |
||||||
|
av[1][0] = (22563, -17665) |
||||||
|
a.view[0][1] = (15, 34) |
||||||
|
a.view[1][1] = (-22, 18) |
||||||
|
# Converting to a tuple, otherwise numpy always compares to False |
||||||
|
self.assertEqual(tuple(av[0][1]), (15, 34)) |
||||||
|
self.assertEqual(tuple(av[1][0]), (22563, -17665)) |
||||||
|
self.assertEqual(tuple(av[1][1]), (-22, 18)) |
||||||
|
|
||||||
|
# And the other way around as well |
||||||
|
self.assertEqual(a.view[0][0], (0, 0)) |
||||||
|
self.assertEqual(a.view[0][1], (15, 34)) |
||||||
|
self.assertEqual(a.view[0][2], (0, 0)) |
||||||
|
self.assertEqual(a.view[1][0], (22563, -17665)) |
||||||
|
self.assertEqual(a.view[1][1], (-22, 18)) |
||||||
|
self.assertEqual(a.view[1][2], (0, 0)) |
||||||
|
|
||||||
|
def test_init_long(self): |
||||||
|
a = np.array([[1, 2, 3], [-4, 5000000000, 6]], np.dtype('q')) |
||||||
|
self.assertEqual(a.dtype, 'int64') |
||||||
|
|
||||||
|
b = containers.MutableStridedArrayView2D(a) |
||||||
|
self.assertEqual(b.size, (2, 3)) |
||||||
|
self.assertEqual(b.stride, (24, 8)) |
||||||
|
self.assertEqual(b.format, 'q') |
||||||
|
b[1, 1] *= 2 |
||||||
|
self.assertEqual(b[0, 2], 3) |
||||||
|
self.assertEqual(b[1, 0], -4) |
||||||
|
self.assertEqual(b[1, 1], 10000000000) |
||||||
|
|
||||||
|
def test_init_double(self): |
||||||
|
a = np.array([[[1.0], [2.0]], [[-4.0], [5.0]]], np.dtype('d')) |
||||||
|
self.assertEqual(a.dtype, 'float64') |
||||||
|
|
||||||
|
b = containers.MutableStridedArrayView3D(a) |
||||||
|
self.assertEqual(b.size, (2, 2, 1)) |
||||||
|
self.assertEqual(b.stride, (16, 8, 8)) |
||||||
|
self.assertEqual(b.format, 'd') |
||||||
|
b[1, 1, 0] *= -2.0 |
||||||
|
self.assertEqual(b[0, 1, 0], 2.0) |
||||||
|
self.assertEqual(b[1, 1, 0], -10.0) |
||||||
@ -0,0 +1,76 @@ |
|||||||
|
/*
|
||||||
|
This file is part of Magnum. |
||||||
|
|
||||||
|
Copyright © 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, |
||||||
|
2020, 2021, 2022, 2023, 2024, 2025, 2026 |
||||||
|
Vladimír Vondruš <mosra@centrum.cz> |
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a |
||||||
|
copy of this software and associated documentation files (the "Software"), |
||||||
|
to deal in the Software without restriction, including without limitation |
||||||
|
the rights to use, copy, modify, merge, publish, distribute, sublicense, |
||||||
|
and/or sell copies of the Software, and to permit persons to whom the |
||||||
|
Software is furnished to do so, subject to the following conditions: |
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included |
||||||
|
in all copies or substantial portions of the Software. |
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
||||||
|
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
||||||
|
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
||||||
|
DEALINGS IN THE SOFTWARE. |
||||||
|
*/ |
||||||
|
|
||||||
|
#include <pybind11/pybind11.h> |
||||||
|
|
||||||
|
#include "../bootstrap.h" /* for module / _module alias */ |
||||||
|
|
||||||
|
#include "Corrade/Containers/OptionalPythonBindings.h" |
||||||
|
|
||||||
|
using namespace Corrade; |
||||||
|
namespace py = pybind11; |
||||||
|
|
||||||
|
namespace { |
||||||
|
|
||||||
|
struct Foo { |
||||||
|
Foo(int a): a{a} {} |
||||||
|
int a; |
||||||
|
}; |
||||||
|
|
||||||
|
Containers::Optional<int> simpleType(bool set) { |
||||||
|
return set ? Containers::optional(5) : Containers::NullOpt; |
||||||
|
} |
||||||
|
|
||||||
|
Containers::Optional<Foo> nestedType(bool set) { |
||||||
|
return set ? Containers::optional(Foo{15}) : Containers::NullOpt; |
||||||
|
} |
||||||
|
|
||||||
|
int acquireSimpleType(Containers::Optional<int> value) { |
||||||
|
return value ? *value : -1; |
||||||
|
} |
||||||
|
|
||||||
|
int acquireNestedType(Containers::Optional<Foo> value) { |
||||||
|
return value ? value->a : -1; |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
/* TODO: remove declaration when https://github.com/pybind/pybind11/pull/1863
|
||||||
|
is released */ |
||||||
|
extern "C" PYBIND11_EXPORT PyObject* PyInit_test_optional(); |
||||||
|
PYBIND11_MODULE(test_optional, m) { |
||||||
|
py::module_::import("corrade.containers"); |
||||||
|
|
||||||
|
py::class_<Foo>{m, "Foo"} |
||||||
|
.def(py::init<int>()) |
||||||
|
.def_readwrite("a", &Foo::a); |
||||||
|
|
||||||
|
m.def("simple_type", simpleType); |
||||||
|
m.def("nested_type", nestedType); |
||||||
|
|
||||||
|
m.def("acquire_simple_type", acquireSimpleType); |
||||||
|
m.def("acquire_nested_type", acquireNestedType); |
||||||
|
} |
||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue