mirror of
https://github.com/visualboyadvance-m/visualboyadvance-m
synced 2025-10-05 23:52:49 +02:00
Compare commits
705 Commits
game-contr
...
b499c2d58c
Author | SHA1 | Date | |
---|---|---|---|
|
b499c2d58c | ||
|
e8aa4467f1 | ||
|
40c798ef99 | ||
|
63894ad3f7 | ||
|
68e7d98b85 | ||
|
ed1b7ff47c | ||
|
ff7d1234ea | ||
|
e889e895f2 | ||
|
eb7c50017d | ||
|
df66c6ff4a | ||
|
e0e639a02e | ||
|
ede668b712 | ||
|
5bd8904746 | ||
|
46326939eb | ||
|
3f005837dd | ||
|
2b3edb266a | ||
|
8e5fc43dd6 | ||
|
362ca53cbe | ||
|
9dc10ff6c4 | ||
|
ab01be3373 | ||
|
6ec0ba0610 | ||
|
9fcc0ad7a8 | ||
|
32622efc1e | ||
|
1dd5ba4567 | ||
|
2070f75934 | ||
|
89146a8597 | ||
|
043956753b | ||
|
e0eb3b3dab | ||
|
e3e14232f7 | ||
|
7565cac230 | ||
|
33c5aeb80e | ||
|
c5510ba28f | ||
|
96c23628ba | ||
|
37fb449fc9 | ||
|
7519c9b818 | ||
|
24b779c09e | ||
|
a17df26e52 | ||
|
b2dd03c6cb | ||
|
967426e2f0 | ||
|
ee2678c13c | ||
|
337e465741 | ||
|
5007977189 | ||
|
99f97138a2 | ||
|
5b867c1483 | ||
|
fe08f4d326 | ||
|
c334e3ffca | ||
|
35f8ba0b8f | ||
|
fca5fae329 | ||
|
56ea6456f5 | ||
|
0510656ca3 | ||
|
b92fcf7e31 | ||
|
22f381a19e | ||
|
e9fc6c8e13 | ||
|
bd20c79013 | ||
|
203be42665 | ||
|
d75072009b | ||
|
0e32b90002 | ||
|
2640716496 | ||
|
b065db66d9 | ||
|
4d837fd739 | ||
|
1ef356c6f0 | ||
|
a8c82bb4a1 | ||
|
1778d605f4 | ||
|
d6d2a83e7e | ||
|
881667a5f8 | ||
|
b332aa693d | ||
|
7f7035a07b | ||
|
3e355509e9 | ||
|
e68681ffda | ||
|
f83aa940d7 | ||
|
a18559678c | ||
|
d927594af2 | ||
|
06507775e8 | ||
|
b08ecd123d | ||
|
d154a6abc8 | ||
|
b134bacc45 | ||
|
9ae1473f36 | ||
|
9cd0c5c04c | ||
|
9e41c5476a | ||
|
e91171459d | ||
|
16f008b448 | ||
|
bad10342bd | ||
|
06b3cb094e | ||
|
82617ea75d | ||
|
0561ef91a4 | ||
|
afc6a1cc3a | ||
|
35df9d7647 | ||
|
031ae2ebf6 | ||
|
6242679e23 | ||
|
537393a0ab | ||
|
616f7abc4e | ||
|
f1414000e6 | ||
|
e2a235768e | ||
|
1d54ee2135 | ||
|
013a9b87ac | ||
|
a06d3ed1b4 | ||
|
b1bad9d53d | ||
|
d2eed85c28 | ||
|
d5a37e06aa | ||
|
cea049161d | ||
|
3eadc6e78f | ||
|
4f3ed0dc8b | ||
|
d38e1d0f89 | ||
|
f870bf252d | ||
|
536ea705ab | ||
|
802162ad97 | ||
|
25895e8636 | ||
|
27e7aa6864 | ||
|
dd7461103b | ||
|
c892c269fa | ||
|
dcf87c0a71 | ||
|
6d1e7e8069 | ||
|
b8868fce37 | ||
|
d92c4e465f | ||
|
bceb138961 | ||
|
83aa80440e | ||
|
4bd54ba128 | ||
|
27acf80b80 | ||
|
ae09ab7189 | ||
|
ce8de563e3 | ||
|
47a8e7e8ed | ||
|
adbaeacf20 | ||
|
8d8ecd8dfa | ||
|
cfbfc9ecb0 | ||
|
4445a20d9c | ||
|
b83a7c8aa2 | ||
|
66aabab61f | ||
|
a5e6b57fd8 | ||
|
b9061ddafd | ||
|
3c291ef3ac | ||
|
e44c83e1d0 | ||
|
8ce4848dd6 | ||
|
34cba3bb2c | ||
|
9b78b26010 | ||
|
94f9df4baa | ||
|
c726989d67 | ||
|
3344e7cf71 | ||
|
3d69bde8cb | ||
|
09984eed2f | ||
|
69809ff556 | ||
|
80dec6a38d | ||
|
ea7b9e5049 | ||
|
18701fc0a4 | ||
|
6b596c7ad7 | ||
|
3c01643112 | ||
|
0895c7a52e | ||
|
1e52787078 | ||
|
fc0e63d554 | ||
|
9b573f4465 | ||
|
51ae605850 | ||
|
ac4b39b6d8 | ||
|
97ca69d050 | ||
|
b1bcaed3a2 | ||
|
2a1b41040d | ||
|
930d0e282c | ||
|
df23826721 | ||
|
de46284747 | ||
|
715f685447 | ||
|
eabf319c9a | ||
|
c98263603d | ||
|
9d46f8e6d1 | ||
|
dab91fc8ca | ||
|
d672d425be | ||
|
53d60b726d | ||
|
b6ce89bff8 | ||
|
8c3d0f0984 | ||
|
3d4c03d0e6 | ||
|
92230e0003 | ||
|
88d58db0e9 | ||
|
4d4c06b26b | ||
|
23a3d0b20f | ||
|
53f5ec7b7d | ||
|
61f93348ca | ||
|
9a78ecbab3 | ||
|
3ffbe7816a | ||
|
2064af05b4 | ||
|
ae8bfb4ab3 | ||
|
1f3a1cb9dc | ||
|
bbaf70c083 | ||
|
b96e0ad35c | ||
|
96324ddb92 | ||
|
dca119905a | ||
|
6a702ad09b | ||
|
796ecee8cf | ||
|
c1d3d19d6b | ||
|
f7a79bfe2e | ||
|
f8c52377a3 | ||
|
357eccc6eb | ||
|
80f595c0b0 | ||
|
1c73f0c7d3 | ||
|
3aff3784cf | ||
|
59fa419820 | ||
|
b0820a28b6 | ||
|
a782c1c5fe | ||
|
16a73fcbcf | ||
|
9ff3b9e3b7 | ||
|
379be68f69 | ||
|
8bfb39b3ad | ||
|
d97c8eabf5 | ||
|
e42e6323e8 | ||
|
d0463ddb5e | ||
|
1da359ba22 | ||
|
15612c2bcc | ||
|
11a941f33d | ||
|
a808cfb6f5 | ||
|
0266b9e4d1 | ||
|
ef01f4c491 | ||
|
d784b60aaa | ||
|
67b17f50ec | ||
|
be6addf034 | ||
|
d9b58d683e | ||
|
604f5412a6 | ||
|
de64dfd9e9 | ||
|
024ae098e6 | ||
|
3d7cce05aa | ||
|
205459f7ae | ||
|
3ac5aa4f27 | ||
|
6fedbdc512 | ||
|
996a827d8e | ||
|
0c91d45627 | ||
|
3cf6ac5a80 | ||
|
c5d1862e4e | ||
|
c63469ac63 | ||
|
3e0541c639 | ||
|
00e48e11e6 | ||
|
07c6e3119e | ||
|
3d8ed512cf | ||
|
e49cce5b9e | ||
|
1dfd7ec121 | ||
|
f1beea9214 | ||
|
865add067d | ||
|
22c620967d | ||
|
8dfc9fa14b | ||
|
20db98897d | ||
|
8a2cec5790 | ||
|
78a1c42162 | ||
|
469c8713b8 | ||
|
ec3e46abc8 | ||
|
f69ce0de0f | ||
|
08027f0f38 | ||
|
e018c1c41a | ||
|
4b6454bac5 | ||
|
e36d436174 | ||
|
d49e6a31e2 | ||
|
08ffe49414 | ||
|
c76edf74c6 | ||
|
fac5d565aa | ||
|
5702bc5102 | ||
|
99f2530d37 | ||
|
adedc507cf | ||
|
5745ed3d8d | ||
|
5f866f8567 | ||
|
7ce5b4940d | ||
|
27dc60f2d1 | ||
|
8002f91c1c | ||
|
cc2bda6991 | ||
|
e8eada5658 | ||
|
1de7b60e5b | ||
|
cdac9d445c | ||
|
2a4697c04f | ||
|
d7c6eb81cd | ||
|
43a6a90a8c | ||
|
54f56fc984 | ||
|
4bde911531 | ||
|
31cfe30468 | ||
|
2f8369c3c7 | ||
|
2c17201cdd | ||
|
6f5c785a35 | ||
|
05d181849a | ||
|
6505ca17df | ||
|
856abf8067 | ||
|
e8d4adaf12 | ||
|
3a9124fecf | ||
|
a3ebf1af41 | ||
|
15619e9e43 | ||
|
50aa85d909 | ||
|
9c36ed6550 | ||
|
9b7dba5931 | ||
|
db8e2279a5 | ||
|
ce7aa3fae3 | ||
|
4ba7796d46 | ||
|
179bec9d2b | ||
|
d3a05166fd | ||
|
e0cdf74b90 | ||
|
0f863e45a3 | ||
|
3e0ba6d5c1 | ||
|
c7abd4e74e | ||
|
65e2706473 | ||
|
9ea2360514 | ||
|
a5676b4b8b | ||
|
4fa72ce721 | ||
|
d91d7fd5e3 | ||
|
d1d2cd7ba7 | ||
|
e36fc38eba | ||
|
83707cf56c | ||
|
00be6c96a2 | ||
|
30d671f2f8 | ||
|
c8205825ac | ||
|
8688e2351b | ||
|
e352eb93b3 | ||
|
5d1c84613c | ||
|
90980741e2 | ||
|
b82e7a3b66 | ||
|
72c4adae79 | ||
|
e8fb9b7622 | ||
|
89fd875b3c | ||
|
bd9a7e45fc | ||
|
309fe49ed1 | ||
|
f091a656ff | ||
|
fa40f41866 | ||
|
47b2785b74 | ||
|
50bb818034 | ||
|
01991889d7 | ||
|
a570d21f35 | ||
|
8f66c79eea | ||
|
647c007193 | ||
|
f0a30d45a1 | ||
|
38c5267adb | ||
|
70d6a1ac39 | ||
|
77f49ac671 | ||
|
e40c1e7140 | ||
|
afef36820c | ||
|
a97a6879d9 | ||
|
8579e192af | ||
|
910ec06e47 | ||
|
e795e9522c | ||
|
e64a8b695a | ||
|
3cd82d1f24 | ||
|
de426adf02 | ||
|
0c8e09a029 | ||
|
4b080c2e4e | ||
|
917ed4014f | ||
|
5d65a5b6e8 | ||
|
e7de32ee18 | ||
|
34218c25bf | ||
|
8a1f4db62f | ||
|
c31499ca10 | ||
|
41895eea36 | ||
|
05f2cb7dea | ||
|
61be54d3d9 | ||
|
48fc076cc2 | ||
|
5e2e2ab4a9 | ||
|
74528ccb30 | ||
|
3f5a89e5c4 | ||
|
2c2ee70109 | ||
|
6ddfdd615f | ||
|
c3ad631f3a | ||
|
21752425da | ||
|
3a68f08bcf | ||
|
90e17d86ad | ||
|
e4b2b5afb8 | ||
|
f8626cf363 | ||
|
d7135b782d | ||
|
f6dacc887d | ||
|
3c048f178c | ||
|
1468caa494 | ||
|
5972e73e37 | ||
|
88302602ca | ||
|
830c8ccd4d | ||
|
c048f0c713 | ||
|
7c1a6a44f7 | ||
|
6b6e1f76cb | ||
|
97894c7899 | ||
|
8a3e3841cf | ||
|
39cad5feb8 | ||
|
8ced18c22f | ||
|
fd2c767319 | ||
|
31ce5d1732 | ||
|
fdc7d05be0 | ||
|
11e0b8b2f6 | ||
|
18e626ae58 | ||
|
532a6d345b | ||
|
19705e0dcf | ||
|
10195bff1a | ||
|
e0102f7242 | ||
|
82fa5cab96 | ||
|
b699d809d9 | ||
|
48ba8fe197 | ||
|
020f20e494 | ||
|
3f436073be | ||
|
ac0dc48263 | ||
|
c065851616 | ||
|
e868bc959b | ||
|
17cb394236 | ||
|
4a424c18a8 | ||
|
befdea4be1 | ||
|
3c5aa7b7bb | ||
|
311b79e03a | ||
|
cbbcea9c28 | ||
|
6cf2400cba | ||
|
4693e6936f | ||
|
5b9a26ba6c | ||
|
c9ca85b839 | ||
|
0037d61ad1 | ||
|
8ac1b297f7 | ||
|
06f0537619 | ||
|
d89fb4846a | ||
|
4839a89f42 | ||
|
caf064e210 | ||
|
a742d7f1dd | ||
|
d5ea803bb8 | ||
|
0d38117e83 | ||
|
39d5761181 | ||
|
d9a392a69a | ||
|
9712c424fd | ||
|
3625a1ad2d | ||
|
6216a7b5d0 | ||
|
e81f4cc6ed | ||
|
7f82fa0089 | ||
|
81dbe6de6e | ||
|
9abe3f46e3 | ||
|
3283bcad22 | ||
|
7f192348de | ||
|
1b466d7e38 | ||
|
7ce3e4db00 | ||
|
73fd7f260f | ||
|
2175bc6edf | ||
|
4f00ba9662 | ||
|
8e4651d819 | ||
|
05707bbd26 | ||
|
12f2d88c73 | ||
|
79d3453544 | ||
|
ef85b71444 | ||
|
a2515b3bbd | ||
|
41bbb49f51 | ||
|
209cb0e96a | ||
|
375e31f6cc | ||
|
34e46945f9 | ||
|
5912be5a32 | ||
|
aa0e95a968 | ||
|
a10c6b93bb | ||
|
f08443f307 | ||
|
5529797f10 | ||
|
bd0a59cc5f | ||
|
d2762a95bf | ||
|
10a4b5dc71 | ||
|
001dd9548d | ||
|
1c436f2dfe | ||
|
8f47df28bf | ||
|
db5c890e0d | ||
|
7dbad8e85c | ||
|
d3da049269 | ||
|
bc0e406aba | ||
|
eb6491ecb7 | ||
|
546ddfbc41 | ||
|
ef46bb7e46 | ||
|
a3b92a3348 | ||
|
2f92dd73b1 | ||
|
07c7bb40a1 | ||
|
ed013bd22c | ||
|
aaf4e7c18c | ||
|
116af5c6a8 | ||
|
1788b366af | ||
|
0820ba587e | ||
|
f975809e3c | ||
|
3a1780145c | ||
|
18c3c3bd51 | ||
|
0aecfb5d1b | ||
|
44b274c9fa | ||
|
491bc1c009 | ||
|
24643675c5 | ||
|
0c6617e920 | ||
|
864cc69061 | ||
|
dae4397dff | ||
|
4cf6cccbaf | ||
|
9e724ea4b8 | ||
|
eb26ec2ef6 | ||
|
6a9eeeaece | ||
|
9f6285842d | ||
|
e5ad7b3403 | ||
|
94752f8314 | ||
|
3c32bad886 | ||
|
8936feaa71 | ||
|
f93a32ab0b | ||
|
3fa850c15d | ||
|
364776b833 | ||
|
2d439f7ba6 | ||
|
11a6068a03 | ||
|
6139428207 | ||
|
5a5579d27f | ||
|
29e85e5d87 | ||
|
e228394656 | ||
|
d5ac2a853b | ||
|
e82ae7bb13 | ||
|
20b82d8ab7 | ||
|
8d26b4f49f | ||
|
3fdc30f7d7 | ||
|
57211ddc77 | ||
|
2de7efd9eb | ||
|
5b4559f4ee | ||
|
6178526cd9 | ||
|
c8a1d8eb2e | ||
|
6e3883937b | ||
|
8dd647914a | ||
|
0dae126a29 | ||
|
5038cd7ba5 | ||
|
ddd8fca044 | ||
|
25c85a83d9 | ||
|
32dd410954 | ||
|
e4f17d33ce | ||
|
2ab707c0ca | ||
|
4dba928765 | ||
|
3d6550d161 | ||
|
3cf12f2594 | ||
|
de1ec01c78 | ||
|
295abb9cd0 | ||
|
8260b62482 | ||
|
d18c6f115f | ||
|
d36f80b5e6 | ||
|
44aa859e6d | ||
|
5a2d3a6f95 | ||
|
d6b939c428 | ||
|
8b8be7d4a8 | ||
|
72364fd1a4 | ||
|
c6da07feb3 | ||
|
94979eff97 | ||
|
e8494b56d1 | ||
|
c85397518b | ||
|
cf2339822d | ||
|
dcb9ccca90 | ||
|
a8ec85d536 | ||
|
611f3a3409 | ||
|
b6da6c490c | ||
|
379dd97301 | ||
|
60b48a3a4a | ||
|
9d20ce9b59 | ||
|
709a322337 | ||
|
cdfd37fc4e | ||
|
4f8d0a8867 | ||
|
b22e9fb709 | ||
|
4e2799b582 | ||
|
7fa90531e6 | ||
|
e1c2ecc584 | ||
|
4c450ab360 | ||
|
d5e1a1f36b | ||
|
821b9176bd | ||
|
9031103c9a | ||
|
557f897ead | ||
|
c8a4f66cf8 | ||
|
ddc93ec6e1 | ||
|
ab38ae8f24 | ||
|
d337688fa7 | ||
|
3eea90afb6 | ||
|
b3952d74a8 | ||
|
be09125d52 | ||
|
f264e7f807 | ||
|
fe0791762a | ||
|
61f427dec1 | ||
|
d619ee2bb1 | ||
|
7128e6dd08 | ||
|
0decffea8d | ||
|
9b60e17746 | ||
|
26207038c9 | ||
|
90867bc802 | ||
|
7f49cd33ad | ||
|
d8342d3d67 | ||
|
12e840a8fa | ||
|
6ca609ac7e | ||
|
2b8f9f71ff | ||
|
e76cef79d2 | ||
|
7f06428df8 | ||
|
e4a9340409 | ||
|
5d7023a5d6 | ||
|
3bd7c918cc | ||
|
67e4944cdb | ||
|
df4ff16e2c | ||
|
d4805065b3 | ||
|
e39b1f2c53 | ||
|
73b65a6553 | ||
|
9e556e6a56 | ||
|
11e73f2c61 | ||
|
e97b0448b7 | ||
|
aa6ed14b2a | ||
|
2ce20c4f59 | ||
|
e4ef4aa625 | ||
|
cf5cb40cb9 | ||
|
c450d14311 | ||
|
41572be3f2 | ||
|
4f8da1c574 | ||
|
32091669d4 | ||
|
abd72a5b2e | ||
|
7e6349b19f | ||
|
0782be749e | ||
|
a7b545ab1a | ||
|
1a564f900c | ||
|
3d4e03f85f | ||
|
fc17209ac7 | ||
|
38877ef209 | ||
|
8691a15be8 | ||
|
961fd0304c | ||
|
e2cf6ecba6 | ||
|
b5a4788747 | ||
|
e63acb9545 | ||
|
7a0826a60c | ||
|
1c7db77192 | ||
|
02f3bd6765 | ||
|
d516683a77 | ||
|
834c7de86c | ||
|
4f1a5dd726 | ||
|
5766b9b9c7 | ||
|
5d8426d317 | ||
|
63ec3528f1 | ||
|
f646c3848c | ||
|
09433875bc | ||
|
05c09ff506 | ||
|
7f78fbb3c5 | ||
|
261e26f488 | ||
|
ed820708af | ||
|
5b8b6a0b47 | ||
|
8809ce26b3 | ||
|
a48625855b | ||
|
55c1477d69 | ||
|
2d7a1ea25b | ||
|
244149c00e | ||
|
c0bcf3bfdf | ||
|
13756bcbf9 | ||
|
fc82e06270 | ||
|
df89beb256 | ||
|
82eda48e8f | ||
|
b47787b317 | ||
|
c9668d9a88 | ||
|
90a56c6937 | ||
|
d377f7abff | ||
|
1fac129746 | ||
|
af7d5f7b89 | ||
|
28f7c2010b | ||
|
486330f23d | ||
|
1ae78a04a8 | ||
|
c776da7120 | ||
|
d543784a3d | ||
|
902c6c8e4b | ||
|
d32be9ddbe | ||
|
b776509287 | ||
|
56eb97c846 | ||
|
9f46c575fd | ||
|
e0402a9b0b | ||
|
3e30f54d5f | ||
|
d73085a88c | ||
|
8eb6a6900f | ||
|
3615137c12 | ||
|
bbd5b76f2a | ||
|
bb3604f333 | ||
|
18a0067ca7 | ||
|
cfdbdc4ec2 | ||
|
32ca2ae42f | ||
|
bad96cf91e | ||
|
62294702e4 | ||
|
72c4f33d63 | ||
|
3fe57f540d | ||
|
1e1a369c8d | ||
|
cc65ef2849 | ||
|
32627f6b85 | ||
|
41952d0625 | ||
|
0c39a5ba7a | ||
|
1b77d6594c | ||
|
8d08223dbc | ||
|
af6028a9dd | ||
|
ff3b5ee042 | ||
|
b52edf52ff | ||
|
6766b9ca54 | ||
|
8eae2e5b90 | ||
|
50d17363ea | ||
|
795f25bb85 | ||
|
647be137f6 | ||
|
8abe3e79da | ||
|
710ffeb1b2 | ||
|
a855ff54f4 | ||
|
dbb5e534e4 | ||
|
753956963c | ||
|
b00e23f5b5 | ||
|
8ef9a66b74 | ||
|
0e503a525e | ||
|
b4b020401c | ||
|
f4835674ed | ||
|
4104a3d179 | ||
|
1e1ec2e330 | ||
|
ff21f8da21 | ||
|
775a571f75 | ||
|
64abd3e8dc | ||
|
56320ec6d1 | ||
|
311b232ee5 | ||
|
0e13cc9346 | ||
|
b455de01c6 | ||
|
c3053d3819 | ||
|
c8106573d8 | ||
|
047ad27777 | ||
|
ecd16a21dc | ||
|
1594fda1b6 | ||
|
de9b3a211b | ||
|
045c98d8fa | ||
|
4ace296b3a | ||
|
011adce23e | ||
|
cc99ec0c14 | ||
|
1d652edf83 | ||
|
db08ca93af | ||
|
3518dc6a05 | ||
|
cc9a03ce48 | ||
|
8576733c0d | ||
|
c6da7e384e | ||
|
98abb8c2e8 | ||
|
0556192238 | ||
|
d9432ebb14 | ||
|
f57cad67c4 | ||
|
ce7cc4e223 | ||
|
3c16671e39 |
1
.github/FUNDING.yml
vendored
Normal file
1
.github/FUNDING.yml
vendored
Normal file
@@ -0,0 +1 @@
|
||||
github: rkitover
|
91
.github/ISSUE_TEMPLATE/bug_report.yml
vendored
91
.github/ISSUE_TEMPLATE/bug_report.yml
vendored
@@ -11,7 +11,7 @@ body:
|
||||
- type: markdown
|
||||
attributes:
|
||||
value: |
|
||||
Please try the nightly build from: https://nightly.vba-m.com and factory resetting the emulator from the Help menu.
|
||||
Please try the nightly build from: https://nightly.visualboyadvance-m.org and factory resetting the emulator from the Help menu.
|
||||
On Linux build master from source or use the edge snap.
|
||||
And last but not least, search for existing reports via the filters bar on the issues page.
|
||||
- type: markdown
|
||||
@@ -20,7 +20,7 @@ body:
|
||||
- type: markdown
|
||||
attributes:
|
||||
value: |
|
||||
Please try to troubleshoot using the information on this page:h ttps://wiki.archlinux.org/index.php/Gamepad **BEFORE** filing an issue.
|
||||
Please try to troubleshoot using the information on this page: https://wiki.archlinux.org/index.php/Gamepad **BEFORE** filing an issue.
|
||||
We use SDL for joystick support, any problems will generally be an issue with SDL and **NOT** the emulator.
|
||||
If relevant, the joystick you are using and the drivers you are using for it:
|
||||
- type: textarea
|
||||
@@ -46,7 +46,7 @@ body:
|
||||
attributes:
|
||||
label: Steps to reproduce the problem
|
||||
description: "How do you trigger this bug? Please walk us through it step by step."
|
||||
value: |
|
||||
placeholder: |
|
||||
1.
|
||||
2.
|
||||
3.
|
||||
@@ -81,29 +81,76 @@ body:
|
||||
Clean, Intro'd or Hacked?:(Attach Patch here)
|
||||
validations:
|
||||
required: false
|
||||
- type: textarea
|
||||
id: Settings
|
||||
- type: markdown
|
||||
attributes:
|
||||
label: What settings are you using?
|
||||
description: "Please list them"
|
||||
value: |
|
||||
Video driver (simple, opengl):
|
||||
Sound driver (directsound, xaudio, openal, SDL):
|
||||
Scale Filter Used?:
|
||||
value: "### Emulator Settings\nList the settings you are using."
|
||||
- type: input
|
||||
id: Video_Driver
|
||||
attributes:
|
||||
label: Video Driver
|
||||
description: "Specify which video driver you're using (e.g., Simple, OpenGL)."
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: SysInfo
|
||||
- type: input
|
||||
id: Sound_Driver
|
||||
attributes:
|
||||
label: Specifications and Build details
|
||||
description: "List your system information, you can obtain this from MSINFO32 and the emulators Titlebar."
|
||||
value: |
|
||||
VBA-M: (include commit version number and whether you are using the 32-bit or 64-bit version)
|
||||
OS: (include version and OS build number using WinVer if on Windows):
|
||||
If using Linux, specify if using xorg or Wayland:
|
||||
CPU:
|
||||
GPU:
|
||||
RAM:
|
||||
label: Sound Driver
|
||||
description: "Specify which sound driver you're using (e.g., DirectSound, XAudio, OpenAL, SDL)."
|
||||
validations:
|
||||
required: true
|
||||
- type: input
|
||||
id: Scale_Filter
|
||||
attributes:
|
||||
label: Scale Filter
|
||||
description: "Specify which scale filter you are using."
|
||||
validations:
|
||||
required: true
|
||||
- type: markdown
|
||||
attributes:
|
||||
value: "### Specifications and Build Details\nList your system information, you can obtain this from MSINFO32 and the emulator's Titlebar."
|
||||
- type: input
|
||||
id: VBA-M
|
||||
attributes:
|
||||
label: VBA-M Version
|
||||
description: "Include commit version number and whether you are using the 32-bit or 64-bit version."
|
||||
validations:
|
||||
required: true
|
||||
- type: input
|
||||
id: OS
|
||||
attributes:
|
||||
label: Operating System
|
||||
description: "Include version and OS build number using WinVer if on Windows."
|
||||
validations:
|
||||
required: true
|
||||
- type: dropdown
|
||||
id: Linux_Display_Server
|
||||
attributes:
|
||||
label: Linux Display Server
|
||||
description: "Specify whether using Xorg or Wayland."
|
||||
options:
|
||||
- Xorg
|
||||
- Wayland
|
||||
validations:
|
||||
required: false
|
||||
- type: input
|
||||
id: CPU
|
||||
attributes:
|
||||
label: CPU Model
|
||||
description: "Provide details of your CPU model."
|
||||
validations:
|
||||
required: true
|
||||
- type: input
|
||||
id: GPU
|
||||
attributes:
|
||||
label: GPU Model
|
||||
description: "Provide details of your GPU model."
|
||||
validations:
|
||||
required: true
|
||||
- type: input
|
||||
id: RAM
|
||||
attributes:
|
||||
label: RAM Size
|
||||
description: "Specify the amount of RAM installed."
|
||||
validations:
|
||||
required: true
|
||||
- type: checkboxes
|
||||
|
2
.github/ISSUE_TEMPLATE/config.yml
vendored
2
.github/ISSUE_TEMPLATE/config.yml
vendored
@@ -1,7 +1,7 @@
|
||||
blank_issues_enabled: false
|
||||
contact_links:
|
||||
- name: VBA-M Forum
|
||||
url: https://board.vba-m.com/
|
||||
url: https://board.visualboyadvance-m.org/
|
||||
about: For general questions and support please join our forum or our
|
||||
- name: VBA-M IRC Channel
|
||||
url: https://web.libera.chat/#vba-m
|
||||
|
2
.github/ISSUE_TEMPLATE/feature.yml
vendored
2
.github/ISSUE_TEMPLATE/feature.yml
vendored
@@ -14,7 +14,7 @@ body:
|
||||
- type: markdown
|
||||
attributes:
|
||||
value: |
|
||||
Please try a nightly build from: https://nightly.vba-m.com to see if your idea has already been implemented.
|
||||
Please try a nightly build from: https://nightly.visualboyadvance-m.org to see if your idea has already been implemented.
|
||||
On Linux build master from source or use the edge snap.
|
||||
And last but not least, search for existing requests via the filters bar on the issues page.
|
||||
- type: textarea
|
||||
|
57
.github/workflows/claude-code-review.yml
vendored
Normal file
57
.github/workflows/claude-code-review.yml
vendored
Normal file
@@ -0,0 +1,57 @@
|
||||
name: Claude Code Review
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
types: [opened, synchronize]
|
||||
# Optional: Only run on specific file changes
|
||||
# paths:
|
||||
# - "src/**/*.ts"
|
||||
# - "src/**/*.tsx"
|
||||
# - "src/**/*.js"
|
||||
# - "src/**/*.jsx"
|
||||
|
||||
jobs:
|
||||
claude-review:
|
||||
# Optional: Filter by PR author
|
||||
# if: |
|
||||
# github.event.pull_request.user.login == 'external-contributor' ||
|
||||
# github.event.pull_request.user.login == 'new-developer' ||
|
||||
# github.event.pull_request.author_association == 'FIRST_TIME_CONTRIBUTOR'
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: read
|
||||
pull-requests: read
|
||||
issues: read
|
||||
id-token: write
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 1
|
||||
|
||||
- name: Run Claude Code Review
|
||||
id: claude-review
|
||||
uses: anthropics/claude-code-action@v1
|
||||
with:
|
||||
claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
|
||||
prompt: |
|
||||
REPO: ${{ github.repository }}
|
||||
PR NUMBER: ${{ github.event.pull_request.number }}
|
||||
|
||||
Please review this pull request and provide feedback on:
|
||||
- Code quality and best practices
|
||||
- Potential bugs or issues
|
||||
- Performance considerations
|
||||
- Security concerns
|
||||
- Test coverage
|
||||
|
||||
Use the repository's CLAUDE.md for guidance on style and conventions. Be constructive and helpful in your feedback.
|
||||
|
||||
Use `gh pr comment` with your Bash tool to leave your review as a comment on the PR.
|
||||
|
||||
# See https://github.com/anthropics/claude-code-action/blob/main/docs/usage.md
|
||||
# or https://docs.claude.com/en/docs/claude-code/sdk#command-line for available options
|
||||
claude_args: '--allowed-tools "Bash(gh issue view:*),Bash(gh search:*),Bash(gh issue list:*),Bash(gh pr comment:*),Bash(gh pr diff:*),Bash(gh pr view:*),Bash(gh pr list:*)"'
|
||||
|
50
.github/workflows/claude.yml
vendored
Normal file
50
.github/workflows/claude.yml
vendored
Normal file
@@ -0,0 +1,50 @@
|
||||
name: Claude Code
|
||||
|
||||
on:
|
||||
issue_comment:
|
||||
types: [created]
|
||||
pull_request_review_comment:
|
||||
types: [created]
|
||||
issues:
|
||||
types: [opened, assigned]
|
||||
pull_request_review:
|
||||
types: [submitted]
|
||||
|
||||
jobs:
|
||||
claude:
|
||||
if: |
|
||||
(github.event_name == 'issue_comment' && contains(github.event.comment.body, '@claude')) ||
|
||||
(github.event_name == 'pull_request_review_comment' && contains(github.event.comment.body, '@claude')) ||
|
||||
(github.event_name == 'pull_request_review' && contains(github.event.review.body, '@claude')) ||
|
||||
(github.event_name == 'issues' && (contains(github.event.issue.body, '@claude') || contains(github.event.issue.title, '@claude')))
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: read
|
||||
pull-requests: read
|
||||
issues: read
|
||||
id-token: write
|
||||
actions: read # Required for Claude to read CI results on PRs
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 1
|
||||
|
||||
- name: Run Claude Code
|
||||
id: claude
|
||||
uses: anthropics/claude-code-action@v1
|
||||
with:
|
||||
claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
|
||||
|
||||
# This is an optional setting that allows Claude to read CI results on PRs
|
||||
additional_permissions: |
|
||||
actions: read
|
||||
|
||||
# Optional: Give a custom prompt to Claude. If this is not specified, Claude will perform the instructions specified in the comment that tagged it.
|
||||
# prompt: 'Update the pull request description to include a summary of changes.'
|
||||
|
||||
# Optional: Add claude_args to customize behavior and configuration
|
||||
# See https://github.com/anthropics/claude-code-action/blob/main/docs/usage.md
|
||||
# or https://docs.claude.com/en/docs/claude-code/sdk#command-line for available options
|
||||
# claude_args: '--model claude-opus-4-1-20250805 --allowed-tools Bash(gh pr:*)'
|
||||
|
34
.github/workflows/devkitpro-build.yml
vendored
Normal file
34
.github/workflows/devkitpro-build.yml
vendored
Normal file
@@ -0,0 +1,34 @@
|
||||
name: Libretro Devkitpro
|
||||
on: [push, pull_request]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
strategy:
|
||||
matrix:
|
||||
# target_name: [ngc, wii, wiiu, switch]
|
||||
target_name: [ngc, wii, wiiu]
|
||||
build_type: [release, debug]
|
||||
include:
|
||||
- libretro_build: 'DEBUG=0'
|
||||
build_type: release
|
||||
- libretro_build: 'DEBUG=1'
|
||||
build_type: debug
|
||||
- devkit_container: 'devkitpro/devkitppc:latest'
|
||||
target_name: ngc
|
||||
- devkit_container: 'devkitpro/devkitppc:latest'
|
||||
target_name: wii
|
||||
- devkit_container: 'devkitpro/devkitppc:latest'
|
||||
target_name: wiiu
|
||||
# - devkit_container: 'devkitpro/devkita64:latest'
|
||||
# target_name: switch
|
||||
runs-on: ubuntu-latest
|
||||
container: ${{ matrix.devkit_container }}
|
||||
steps:
|
||||
- name: Checkout the code
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: recursive
|
||||
|
||||
# Libretro build
|
||||
- name: Build libretro core
|
||||
run: make -C src/libretro ${{ matrix.libretro_build }} platform=${{ matrix.target_name }}
|
52
.github/workflows/macos-build.yml
vendored
52
.github/workflows/macos-build.yml
vendored
@@ -1,27 +1,63 @@
|
||||
name: macOS Latest Build
|
||||
name: macOS Latest
|
||||
on: [push, pull_request]
|
||||
#on: workflow_dispatch
|
||||
|
||||
jobs:
|
||||
build:
|
||||
strategy:
|
||||
matrix:
|
||||
cmake_build: ['-DCMAKE_BUILD_TYPE=Release', '-DCMAKE_BUILD_TYPE=Debug']
|
||||
cmake_options: ['', '-DENABLE_LINK=OFF', '-DENABLE_SDL=ON']
|
||||
build_type: [release, debug]
|
||||
build_options: [default, link_off, translations_only, libretro]
|
||||
include:
|
||||
- cmake_build: '-DCMAKE_BUILD_TYPE=Release'
|
||||
build_type: release
|
||||
- cmake_build: '-DCMAKE_BUILD_TYPE=Debug'
|
||||
build_type: debug
|
||||
- cmake_options: '-DENABLE_LINK=OFF'
|
||||
build_options: link_off
|
||||
- cmake_options: '-DTRANSLATIONS_ONLY=ON'
|
||||
build_options: translations_only
|
||||
- libretro_build: 'DEBUG=0'
|
||||
build_type: release
|
||||
build_options: libretro
|
||||
- libretro_build: 'DEBUG=1'
|
||||
build_type: debug
|
||||
build_options: libretro
|
||||
exclude:
|
||||
# Exclude debug/translations_only build
|
||||
- build_type: debug
|
||||
build_options: translations_only
|
||||
runs-on: macos-latest
|
||||
env:
|
||||
NIXPKGS_ALLOW_UNSUPPORTED_SYSTEM: 1
|
||||
|
||||
steps:
|
||||
- name: Checkout the code
|
||||
uses: actions/checkout@v2
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: recursive
|
||||
- name: Install nix
|
||||
uses: cachix/install-nix-action@v22
|
||||
uses: cachix/install-nix-action@v31
|
||||
with:
|
||||
nix_path: nixpkgs=channel:nixos-unstable
|
||||
- name: Configure
|
||||
|
||||
# Cmake build
|
||||
- if: matrix.build_options != 'libretro'
|
||||
name: Configure CMake
|
||||
run: >-
|
||||
nix-shell --command 'cmake -B build -G Ninja ${{ matrix.cmake_build }} -DENABLE_LTO=OFF ${{ matrix.cmake_options }}'
|
||||
- name: Build
|
||||
- if: matrix.build_options != 'libretro'
|
||||
name: Build
|
||||
run: >-
|
||||
nix-shell --command 'ninja -C build'
|
||||
|
||||
# Libretro build
|
||||
- if: matrix.build_options == 'libretro'
|
||||
name: Build libretro core
|
||||
run: >-
|
||||
nix-shell --command 'make -C src/libretro ${{ matrix.libretro_build }}'
|
||||
|
||||
# Run tests
|
||||
- if: matrix.build_options == 'default'
|
||||
name: Run tests
|
||||
run: >-
|
||||
nix-shell --command 'cd build && ctest -j --output-on-failure'
|
||||
|
47
.github/workflows/msys2-build.yml
vendored
47
.github/workflows/msys2-build.yml
vendored
@@ -1,12 +1,31 @@
|
||||
name: MSYS2 Build
|
||||
name: MSYS2
|
||||
on: [push, pull_request]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
strategy:
|
||||
matrix:
|
||||
cmake_build: ['-DCMAKE_BUILD_TYPE=Release', '-DCMAKE_BUILD_TYPE=Debug']
|
||||
cmake_options: ['', '-DENABLE_LINK=OFF', '-DENABLE_SDL=ON']
|
||||
build_type: [release, debug]
|
||||
build_options: [default, link_off, translations_only, libretro]
|
||||
include:
|
||||
- cmake_build: '-DCMAKE_BUILD_TYPE=Release'
|
||||
build_type: release
|
||||
- cmake_build: '-DCMAKE_BUILD_TYPE=Debug'
|
||||
build_type: debug
|
||||
- cmake_options: '-DENABLE_LINK=OFF'
|
||||
build_options: link_off
|
||||
- cmake_options: '-DTRANSLATIONS_ONLY=ON'
|
||||
build_options: translations_only
|
||||
- libretro_build: 'DEBUG=0'
|
||||
build_type: release
|
||||
build_options: libretro
|
||||
- libretro_build: 'DEBUG=1'
|
||||
build_type: debug
|
||||
build_options: libretro
|
||||
exclude:
|
||||
# Exclude debug/translations_only build
|
||||
- build_type: debug
|
||||
build_options: translations_only
|
||||
runs-on: windows-latest
|
||||
env:
|
||||
MSYSTEM: CLANG64
|
||||
@@ -16,7 +35,7 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: Checkout the code
|
||||
uses: actions/checkout@v2
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: recursive
|
||||
- name: Setup msys2
|
||||
@@ -27,11 +46,19 @@ jobs:
|
||||
- name: Install deps
|
||||
run: >-
|
||||
bash installdeps
|
||||
- name: Configure
|
||||
run: >-
|
||||
cmake -B build -G Ninja -DCMAKE_BUILD_TYPE=Debug ${{ matrix.cmake_build }} ${{ matrix.cmake_options }}
|
||||
- name: Build
|
||||
run: ninja -C build
|
||||
|
||||
- name: Install
|
||||
# CMake build
|
||||
- if: matrix.build_options != 'libretro'
|
||||
name: Configure CMake
|
||||
run: cmake -B build -G Ninja ${{ matrix.cmake_build }} -DENABLE_LTO=OFF ${{ matrix.cmake_options }}
|
||||
- if: matrix.build_options != 'libretro'
|
||||
name: Build
|
||||
run: ninja -C build
|
||||
- if: matrix.build_options != 'libretro'
|
||||
name: Install
|
||||
run: ninja -C build install
|
||||
|
||||
# Libretro build
|
||||
- if: matrix.build_options == 'libretro'
|
||||
name: Build libretro core
|
||||
run: make -C src/libretro ${{ matrix.libretro_build }} CC=clang CXX=clang++
|
||||
|
71
.github/workflows/ubuntu-build.yml
vendored
71
.github/workflows/ubuntu-build.yml
vendored
@@ -1,30 +1,77 @@
|
||||
name: Ubuntu Latest Build
|
||||
name: Ubuntu Latest
|
||||
on: [push, pull_request]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
strategy:
|
||||
matrix:
|
||||
cmake_compiler: ['-DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++', '-DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++']
|
||||
cmake_build: ['-DCMAKE_BUILD_TYPE=Release', '-DCMAKE_BUILD_TYPE=Debug']
|
||||
cmake_options: ['', '-DENABLE_LINK=OFF', '-DENABLE_SDL=ON']
|
||||
build_compiler: [gcc, clang]
|
||||
build_type: [release, debug]
|
||||
# build_options: [default, link_off, translations_only, libretro]
|
||||
build_options: [default, link_off, translations_only]
|
||||
include:
|
||||
- cmake_compiler: '-DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++'
|
||||
build_compiler: gcc
|
||||
- cmake_compiler: '-DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++'
|
||||
build_compiler: clang
|
||||
- cmake_build: '-DCMAKE_BUILD_TYPE=Release'
|
||||
build_type: release
|
||||
- cmake_build: '-DCMAKE_BUILD_TYPE=Debug'
|
||||
build_type: debug
|
||||
- cmake_options: '-DENABLE_LINK=OFF'
|
||||
build_options: link_off
|
||||
- cmake_options: '-DTRANSLATIONS_ONLY=ON'
|
||||
build_options: translations_only
|
||||
# - libretro_build: 'DEBUG=0'
|
||||
# build_type: release
|
||||
# build_options: libretro
|
||||
# - libretro_build: 'DEBUG=1'
|
||||
# build_type: debug
|
||||
# build_options: libretro
|
||||
exclude:
|
||||
# Exclude debug/translations_only build
|
||||
- build_type: debug
|
||||
build_options: translations_only
|
||||
- build_type: release
|
||||
build_options: translations_only
|
||||
build_compiler: clang
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout the code
|
||||
uses: actions/checkout@v2
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: recursive
|
||||
|
||||
- name: Install Dependencies
|
||||
run: >-
|
||||
bash installdeps; if [ "${{ matrix.compiler }}" = clang ]; then sudo apt -y install clang; fi
|
||||
run: |
|
||||
sudo add-apt-repository ppa:hrzhu/sdl3-backport
|
||||
sudo apt update
|
||||
bash installdeps
|
||||
if [ "${{ matrix.build_compiler }}" = clang ]; then
|
||||
sudo apt -y install clang
|
||||
fi
|
||||
|
||||
- name: Configure
|
||||
- name: Install xvfb
|
||||
run: sudo apt -y install xvfb
|
||||
|
||||
# CMake build
|
||||
- if: matrix.build_options != 'libretro'
|
||||
name: Configure CMake
|
||||
run: >-
|
||||
cmake -B build -G Ninja ${{ matrix.cmake_compiler }} ${{ matrix.cmake_build }} ${{ matrix.cmake_options }}
|
||||
|
||||
- name: Build
|
||||
- if: matrix.build_options != 'libretro'
|
||||
name: Build
|
||||
run: ninja -C build
|
||||
|
||||
- name: Install
|
||||
- if: matrix.build_options != 'libretro'
|
||||
name: Install
|
||||
run: sudo ninja -C build install
|
||||
|
||||
# Libretro build
|
||||
# - if: matrix.build_options == 'libretro'
|
||||
# name: Build libretro core
|
||||
# run: make -C src/libretro ${{ matrix.libretro_build }}
|
||||
|
||||
# Run tests
|
||||
- if: matrix.build_options == 'default'
|
||||
name: Run tests
|
||||
run: cd build && xvfb-run ctest -j --output-on-failure
|
||||
|
54
.github/workflows/visual-studio-build.yml
vendored
54
.github/workflows/visual-studio-build.yml
vendored
@@ -1,36 +1,60 @@
|
||||
name: Visual Studio Build
|
||||
name: Visual Studio
|
||||
on: [push, pull_request]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
strategy:
|
||||
matrix:
|
||||
msvc_arch: ['x64', 'x64_x86']
|
||||
msvc_arch: ['x64', 'amd64_x86', 'amd64_arm64']
|
||||
# TODO: Re-add "Visual Studio 17 2022" once it's working.
|
||||
cmake_generator: ['Ninja']
|
||||
# cmake_generator: ['Ninja', '"Visual Studio 17 2022"']
|
||||
cmake_build: ['-DCMAKE_BUILD_TYPE=Release', '-DCMAKE_BUILD_TYPE=Debug']
|
||||
cmake_options: ['', '-DENABLE_LINK=OFF', '-DENABLE_SDL=ON']
|
||||
build_type: [release, debug]
|
||||
build_options: [default, link_off, translations_only]
|
||||
include:
|
||||
- cmake_build: '-DCMAKE_BUILD_TYPE=Release'
|
||||
build_type: release
|
||||
- cmake_build: '-DCMAKE_BUILD_TYPE=Debug'
|
||||
build_type: debug
|
||||
- cmake_options: '-DENABLE_LINK=OFF'
|
||||
build_options: link_off
|
||||
- cmake_options: '-DTRANSLATIONS_ONLY=ON'
|
||||
build_options: translations_only
|
||||
- cmake_vcpkg_triplet: 'x64-windows-static'
|
||||
msvc_arch: x64
|
||||
- cmake_vcpkg_triplet: 'x86-windows-static'
|
||||
msvc_arch: amd64_x86
|
||||
- cmake_vcpkg_triplet: 'arm64-windows-static'
|
||||
msvc_arch: amd64_arm64
|
||||
exclude:
|
||||
# Exclude debug/translations_only build
|
||||
- build_type: debug
|
||||
build_options: translations_only
|
||||
- build_type: release
|
||||
build_options: translations_only
|
||||
msvc_arch: amd64_x86
|
||||
- build_type: release
|
||||
build_options: translations_only
|
||||
msvc_arch: amd64_arm64
|
||||
runs-on: windows-latest
|
||||
steps:
|
||||
- name: Checkout the code
|
||||
uses: actions/checkout@v2
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: recursive
|
||||
|
||||
- name: Prepare Visual Studio environment
|
||||
uses: ilammy/msvc-dev-cmd@v1.12.0
|
||||
uses: ilammy/msvc-dev-cmd@v1.13.0
|
||||
with:
|
||||
arch: ${{ matrix.msvc_arch }}
|
||||
|
||||
- name: Configure (x64)
|
||||
if: matrix.msvc_arch == 'x64'
|
||||
- name: Configure
|
||||
run: >-
|
||||
cmake -B build -G ${{ matrix.cmake_generator }} -DVCPKG_TARGET_TRIPLET=x64-windows-static ${{ matrix.cmake_build }} ${{ matrix.cmake_options }}
|
||||
|
||||
- name: Configure (x86)
|
||||
if: matrix.msvc_arch == 'x64_x86'
|
||||
run: >-
|
||||
cmake -B build -G ${{ matrix.cmake_generator }} -DVCPKG_TARGET_TRIPLET=x86-windows-static ${{ matrix.cmake_build }} ${{ matrix.cmake_options }}
|
||||
cmake -B build -G ${{ matrix.cmake_generator }} -DVCPKG_TARGET_TRIPLET=${{ matrix.cmake_vcpkg_triplet }} ${{ matrix.cmake_build }} ${{ matrix.cmake_options }}
|
||||
|
||||
- name: Build
|
||||
run: cmake --build build
|
||||
|
||||
# Run tests
|
||||
- if: matrix.build_options == 'default' && matrix.msvc_arch != 'amd64_arm64'
|
||||
name: Run tests
|
||||
run: cd build && ctest -j --output-on-failure
|
||||
|
3
.gitignore
vendored
3
.gitignore
vendored
@@ -17,3 +17,6 @@ compile_commands.json
|
||||
|
||||
# mac finder crap
|
||||
*.DS_Store
|
||||
|
||||
# online updates header
|
||||
src/wx/winsparkle-path.h
|
||||
|
@@ -181,7 +181,7 @@ libretro-build-ngc:
|
||||
extends:
|
||||
- .libretro-ngc-static-retroarch-master
|
||||
- .core-defs
|
||||
|
||||
|
||||
# Nintendo Wii
|
||||
libretro-build-wii:
|
||||
extends:
|
||||
|
10
.gitmodules
vendored
10
.gitmodules
vendored
@@ -1,4 +1,6 @@
|
||||
[submodule "dependencies"]
|
||||
path = dependencies
|
||||
url = https://github.com/visualboyadvance-m/dependencies.git
|
||||
branch = master
|
||||
[submodule "win32-deps"]
|
||||
path = win32-deps
|
||||
url = https://github.com/visualboyadvance-m/win32-deps.git
|
||||
[submodule "third_party/googletest"]
|
||||
path = third_party/googletest
|
||||
url = https://github.com/google/googletest.git
|
||||
|
192
CHANGELOG.md
192
CHANGELOG.md
@@ -4,6 +4,198 @@ All notable changes to this project will be documented in this file.
|
||||
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
|
||||
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
|
||||
|
||||
## [2.2.2] - 2025-07-30
|
||||
|
||||
========================
|
||||
* 27acf80b - Make language configurable (requires restart) [andyvand]
|
||||
* ae09ab71 - Embed translations for Windows [andyvand]
|
||||
* 47a8e7e8 - Update wxWidgets for Mac builder to 3.3.1 [andyvand]
|
||||
* 8ce4848d - Fix Wii U VC opcodes [andyvand]
|
||||
* dab91fc8 - Fix bigger than 32MB ROM files [andyvand]
|
||||
|
||||
## [2.2.1] - 2025-07-19
|
||||
=======================
|
||||
* 23a3d0b2 - build: fix include paths for bundled SFML [rkitover]
|
||||
* 53f5ec7b - build: fix building with OpenAL enabled [rkitover]
|
||||
* 3ffbe781 - translations: remove ja_JP, 0% and ja exists [rkitover]
|
||||
* ae8bfb4a - Several fixes for windows [danialhorton]
|
||||
* bbaf70c0 - build: fix slow CMake vcpkg startup time [rkitover]
|
||||
* dca11990 - Fix GBA sound [andyvand]
|
||||
* 357eccc6 - build: fix checking if bin pkg host deps installed [rkitover]
|
||||
* d0463ddb - Initial tar support [andyvand]
|
||||
* a808cfb6 - Update macOS plist [andyvand]
|
||||
* 604f5412 - Add LZIP support [andyvand]
|
||||
* 6fedbdc5 - Add .xz support [andyvand]
|
||||
* 0c91d456 - Add .bz2 file support [andyvand]
|
||||
* 3e0541c6 - Update unrar to V7.1.8 [andyvand]
|
||||
* 00e48e11 - Fix RAR support [andyvand]
|
||||
* 3d8ed512 - Use macOS 10.10 Sparkle [andyvand]
|
||||
|
||||
## [2.2.0] - 2025-07-08
|
||||
========================
|
||||
* 865add06 - Adjust throttle limit 450 -> 1000 [rkitover]
|
||||
* 20db9889 - Add dark mode support [andyvand]
|
||||
* fac5d565 - build: use vcpkg host pkgconf when cross compiling [rkitover]
|
||||
* 5702bc51 - build: fix x64-mingw-static for MSYS2 CLANG64 [rkitover]
|
||||
* 5745ed3d - Use external libwebp and use built pcre2 [andyvand]
|
||||
* 5f866f85 - Revert beeping fix and fix again the previous way [andyvand]
|
||||
* 8002f91c - Fix save dialog [andyvand]
|
||||
* cc2bda69 - build: inst host deps for bins only if not [rkitover]
|
||||
* d7c6eb81 - Fix MinGW FFMpeg [andyvand]
|
||||
* 43a6a90a - Fix FFMPEG for macOS [andyvand]
|
||||
* 54f56fc9 - Fix libx265 build for macOS [andyvand]
|
||||
* 31cfe304 - Fix MinGW compile with title of DX9 window [andyvand]
|
||||
* 2c17201c - Separate window for SDL direct3d9 with background input [andyvand]
|
||||
* 6f5c785a - build: add x264+x265 for ffmpeg for macOS [rkitover]
|
||||
* 05d18184 - build: rm FindFFmpeg for distro ver, fix x264/x265 [rkitover]
|
||||
* 856abf80 - build: add option VCPKG_BINARY_PACKAGES [rkitover]
|
||||
* e8d4adaf - build: always use pwsh vcpkg-list [rkitover]
|
||||
* 50aa85d9 - build: update vcpkg ports list, drop gettext [rkitover]
|
||||
* ce7aa3fa - Fix FAudio crash on Windows debug [andyvand]
|
||||
* 4ba7796d - Fix FAudio crash on MSVC [andyvand]
|
||||
* 83707cf5 - Fix Direct3D9 [andyvand]
|
||||
* b82e7a3b - Update wxvbam.rc [andyvand]
|
||||
* f0a30d45 - build: fix installing host build dep bin pkgs [rkitover]
|
||||
* 70d6a1ac - Make Sparkle framework optional [andyvand]
|
||||
* 77f49ac6 - Clean up WinSparkle code [andyvand]
|
||||
* e40c1e71 - Update macOS Sparkle [andyvand]
|
||||
* 8579e192 - Check for kInputBufSize [andyvand]
|
||||
* e64a8b69 - Update 7z_C to 2409 and update extractor [andyvand]
|
||||
* c31499ca - Fix winsparkle dependency and update win32-deps to latest push [andyvand]
|
||||
* 41895eea - Add option not to update vcpkg builds [andyvand]
|
||||
* 05f2cb7d - Fix auto updates [andyvand]
|
||||
* 61be54d3 - build: avoid using VS vcpkg with elevation [rkitover]
|
||||
* 5e2e2ab4 - Add MinGW WinSparkle support [andyvand]
|
||||
* 2c2ee701 - build: minor improvements to the Mac builder [rkitover]
|
||||
* 3c048f17 - Add alert sound on macOS fix [andyvand]
|
||||
* 830c8ccd - Add x264 and x265 to ffmpeg [andyvand]
|
||||
* 8ced18c2 - build: make OpenAL-Soft optional again [rkitover]
|
||||
* 31ce5d17 - CoreAudio fix [andyvand]
|
||||
* ac0dc482 - Fix SDL3 detection [andyvand]
|
||||
* 5b9a26ba - build: make some minor CMake improvements [rkitover]
|
||||
* 9712c424 - build: make some minor fixes to Mac builder [rkitover]
|
||||
* 12f2d88c - Update versions on macOS build script [andyvand]
|
||||
* 79d34535 - Implement CoreAudio driver [andyvand]
|
||||
* 34e46945 - build: generalize linking openal-soft to libfmt [rkitover]
|
||||
* 5529797f - Set directory path for generic file dialog [andyvand]
|
||||
* bd0a59cc - ci: fix shell syntax for Ubuntu runner [rkitover]
|
||||
* d2762a95 - ci: add libsdl3-dev for Ubuntu runner [rkitover]
|
||||
* 1c436f2d - Add MSVC secure library functions [andyvand]
|
||||
* 8f47df28 - Add entitlements file for sandboxing [andyvand]
|
||||
* db5c890e - Add option for generic file dialogs [andyvand]
|
||||
* 7dbad8e8 - translations: transifex pull [rkitover]
|
||||
* d3da0492 - Update nixpkgs for SDL3 [andyvand]
|
||||
* ef46bb7e - build: in installdeps for SUSE s/libSDL3/SDL3/ [rkitover]
|
||||
* a3b92a33 - build: update installdeps to SDL3 [rkitover]
|
||||
* 2f92dd73 - Add MSVC 2022 libretro support [andyvand]
|
||||
* 07c7bb40 - Fix AVCodec deprecations and fix warnings [andyvand]
|
||||
* ed013bd2 - Fix SFML deprecations and fix SFML warnings [andyvand]
|
||||
* 116af5c6 - build: replace sdl2 vcpkg port with sdl3 [rkitover]
|
||||
* 1788b366 - build: default ENABLE_SDL3=ON in CMake [rkitover]
|
||||
* 0820ba58 - BUILDER: Updated core.sh source packages required to build vba-m [zachbacon]
|
||||
* f975809e - Update to SDL3 APIs, fix bpps, add SDL audio/video, add Metal video, fix Quartz drawing [andyvand]
|
||||
* 18c3c3bd - build: fix link error on MSVC for SFML port [andyvand]
|
||||
* 0aecfb5d - build: make minor improvements to the Mac builder [rkitover]
|
||||
* dae4397d - build: lower bundled SFML C++17 to C++14 [rkitover]
|
||||
* 4cf6cccb - build: bundle SFML 3.x sys/network in third_party [rkitover]
|
||||
* 9e724ea4 - build: support building ARM64 binary for Mac [rkitover]
|
||||
* eb26ec2e - Enable Hide Status Bar in UI Settings for macOS [rkitover]
|
||||
* 6a9eeeae - core.sh Switched to github source for nasm [zachbacon]
|
||||
* 9f628584 - initialize sound_buffer_len_ to silence a warning. [danialhorton]
|
||||
* e5ad7b34 - build: find_package(nanosvg) w/ vcpkg [rkitover]
|
||||
* 94752f83 - [FAudio]Correct the behavior of device_changed check [danialhorton]
|
||||
* 8936feaa - build: add libtiff to Nix derivation [rkitover]
|
||||
* f93a32ab - build: add libtiff to brews on macOS [rkitover]
|
||||
* 3fa850c1 - build: capitalize ARCH_NAME in CMake [rkitover]
|
||||
* 364776b8 - build: s/-Ofast/-O3 -ffast-math/ [rkitover]
|
||||
* 61394282 - translations: remove dup Chinese translations [rkitover]
|
||||
* 29e85e5d - build: update Link SFML usage to SFML 3.x APIs [rkitover]
|
||||
* e2283946 - [Input] Process key down event for some controls [steelskin]
|
||||
* 3fdc30f7 - Mark `wxEVT_KEY_DOWN` as processed in `wxvbamApp` (#1424) [Steelskin]
|
||||
* 2de7efd9 - Reallocate GBA ROM to the new size(#1422) [danialhorton]
|
||||
* e4f17d33 - [Sound] Set volume on game startup (#1410) [Steelskin]
|
||||
* 2ab707c0 - build: update default.nix [rkitover]
|
||||
* 4dba9287 - build: update installdeps for OpenSUSE [rkitover]
|
||||
* 44aa859e - build: add cmake var and cpp macro for XP builds [rkitover]
|
||||
* 5a2d3a6f - build: set arch to pentium3 not -mmx for XP builds [rkitover]
|
||||
* d6b939c4 - Set developer id/component type in metainfo.xml [116445585+PunkPangolin]
|
||||
* c6da07fe - build: link avrt for OpenAL on WIN32 [rkitover]
|
||||
* 94979eff - build: initialize GTest submodule in CMake [rkitover]
|
||||
* dcb9ccca - [gtest] Use googletest as a submodule (#1373) [Steelskin]
|
||||
* a8ec85d5 - [GB] Add support for per-game overrides (#1370) [Steelskin]
|
||||
* 9d20ce9b - [Input] Reset keyboard tracking on focus loss (#1357) [Steelskin]
|
||||
* cdfd37fc - build: rename dependencies submodule -> win32-deps [rkitover]
|
||||
* 4f8d0a88 - build: update harfbuzz for macOS builder [rkitover]
|
||||
* b22e9fb7 - Ignore illegal opcodes used by Wii U VC (#1351) [Steelskin]
|
||||
* 7fa90531 - Disable open menu tracking outside of Windows (#1350) [Steelskin]
|
||||
* e1c2ecc5 - [dialogs] Display all controls in AccelConfig on Mac (#1349) [Steelskin]
|
||||
* 4c450ab3 - build: fix linking FAudio statically on MINGW [rkitover]
|
||||
* d5e1a1f3 - [GB] Properly set OPRI on startup [steelskin]
|
||||
* 821b9176 - build: do not use debug libs for RelWithDebInfo [rkitover]
|
||||
* 9031103c - build: fix linking non-debug pcre for debug wx [rkitover]
|
||||
|
||||
## [2.1.11] - 2024-09-15
|
||||
|
||||
==========================
|
||||
* 3eea90af - build: set BUILD_TESTING=OFF when not git checkout [rkitover]
|
||||
* b3952d74 - build: fix ENABLE_LIRC=ON [rkitover]
|
||||
* f264e7f8 - Fix Help -> Translations URL [rkitover]
|
||||
* 61f427de - Write shortcuts in the proper section (#1335) [Steelskin]
|
||||
* d619ee2b - build: fix installing GoogleTest [rkitover]
|
||||
* 26207038 - Update WinSparkle to 0.8.1 and add ARM64 [rkitover]
|
||||
|
||||
## [2.1.10] - 2024-09-08
|
||||
|
||||
==========================
|
||||
* 7f06428d - Disable dialog position save/restore on wxGTK (#1331) [Steelskin]
|
||||
* e4ef4aa6 - Propagate key events (#1323) [Steelskin]
|
||||
* e2cf6ecb - Add option to mute sound during speedup [rkitover]
|
||||
* d516683a - build: fix for wx using GTK2 [rkitover]
|
||||
* 834c7de8 - build: update macOS builder dists [rkitover]
|
||||
* fc82e062 - build: do not build SDL bin on Windows or macOS [rkitover]
|
||||
* d543784a - [UserInput] Filter key events globally [steelskin]
|
||||
* 902c6c8e - [UserInput] Only process shortcut commands once [steelskin]
|
||||
* b7765092 - [bindings] Set default shortcut for recent file 3 [steelskin]
|
||||
* cc65ef28 - doc: add system requirements to README.md [danialhorton]
|
||||
* 32627f6b - [Dialogs] Save and restore dialog positions [steelskin]
|
||||
* 41952d06 - build: update macOS linker tool to 1.5 [rkitover]
|
||||
* 0c39a5ba - build: override FindGettext to not update po files [rkitover]
|
||||
* 1b77d659 - build: update macOS build to ffmpeg 7.0 [rkitover]
|
||||
* 8d08223d - build: fix compatibility with older ffmpeg [rkitover]
|
||||
* af6028a9 - build: fix build for nix on macOS [rkitover]
|
||||
* b52edf52 - build: fix building on macOS with Homebrew [rkitover]
|
||||
* 6766b9ca - build: fix ffmpeg 7.x compat [rkitover]
|
||||
* 795f25bb - build: fix nix deps for OpenGL [rkitover]
|
||||
* 647be137 - gba: set cpsr=spsr when switching to FIQ mode [40356555+Aikku93]
|
||||
* 8abe3e79 - build: remove -lgcc from static link flags [rkitover]
|
||||
* f4835674 - [Audio] Rework audio devices enumeration [steelskin]
|
||||
* 775a571f - build: fix detecting Visual Studio default vcpkg [rkitover]
|
||||
* 64abd3e8 - [Audio] Remove manual memory allocations [steelskin]
|
||||
* 047ad277 - [Dialogs] Prevent viewers from causing a crash [steelskin]
|
||||
* 045c98d8 - build: only use -Werror=lto-type-mismatch on gcc [rkitover]
|
||||
* 3518dc6a - build: fix LTO on Linux [rkitover]
|
||||
* cc9a03ce - Add toggle: SDL GameController mode for joysticks [rkitover]
|
||||
* 8576733c - [Build] Remove lingering references to OpenAl [steelskin]
|
||||
* 05561922 - build: fix MSYS2 check [rkitover]
|
||||
* d9432ebb - build: fix build on MINGW{64,32}/UCRT64 on MSYS2 [rkitover]
|
||||
* f57cad67 - build: fix static linking on MSYS2 CLANG64 [rkitover]
|
||||
* 23e15734 - build: set wxWidgets_DIR with vcpkg [rkitover]
|
||||
* 98b51910 - [Build] Remove ENABLE_NLS, fix TRANSLATIONS_ONLY [steelskin]
|
||||
* a565cea8 - [Build] Remove the OpenGL check [steelskin]
|
||||
* f96e42fe - build: cmake refactor and improvements [Steelskin]
|
||||
* 07e49025 - Fix most remaining release warnings (#1243) [Steelskin]
|
||||
* 18b97b43 - Fix various build warnings (#1242) [Steelskin]
|
||||
* 13a16eb7 - Fix various warnings in filters and headers (#1241) [Steelskin]
|
||||
* f46da1c5 - build: remove our version of FindSDL2.cmake [rkitover]
|
||||
* 404e9a1a - build: add clang to ./installdeps for MSYS2 [rkitover]
|
||||
* 613bd403 - Make menu more reasonably organized (#1230) [wwrustc]
|
||||
* 215e3c5a - build: use find_program() to find powershell [rkitover]
|
||||
* e5aa685f - build: don't use wx utils as UNIX cmds on Windows [rkitover]
|
||||
* 9e4c8e17 - build: fix gentoo dependency namespaces [68k]
|
||||
* 5f853b99 - Update metainfo.xml to new standards [jhonny.oliveira]
|
||||
* e7d135db - Update links to new domain visualboyadvance-m.org [rkitover]
|
||||
* 60fc096f - build: add libglu-devel for solus in installdeps [rkitover]
|
||||
|
||||
## [2.1.9] - 2024-02-03
|
||||
=======================
|
||||
* 84b0a3e3 - Remove SDL sound driver [rkitover]
|
||||
|
296
CMakeLists.txt
296
CMakeLists.txt
@@ -1,10 +1,28 @@
|
||||
cmake_minimum_required(VERSION 3.19)
|
||||
cmake_policy(VERSION 3.19...3.28.3)
|
||||
|
||||
# Use new link library de-duplication behavior.
|
||||
if(POLICY CMP0156)
|
||||
cmake_policy(SET CMP0156 NEW)
|
||||
endif()
|
||||
if(POLICY CMP0179)
|
||||
cmake_policy(SET CMP0179 NEW)
|
||||
endif()
|
||||
#if(POLICY CMP0181)
|
||||
# cmake_policy(SET CMP0181 NEW)
|
||||
#endif()
|
||||
|
||||
set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake)
|
||||
|
||||
if(WIN32)
|
||||
include(RemoveStrawberryPerlFromPATH)
|
||||
|
||||
find_program(POWERSHELL
|
||||
NAMES powershell.exe pwsh.exe
|
||||
HINTS "/Windows/System32/WindowsPowerShell/v1.0"
|
||||
REQUIRED)
|
||||
else()
|
||||
find_program(POWERSHELL pwsh)
|
||||
endif()
|
||||
|
||||
if(UPDATE_APPCAST)
|
||||
@@ -15,22 +33,18 @@ if(TAG_RELEASE)
|
||||
include(MakeReleaseCommitAndTag)
|
||||
endif()
|
||||
|
||||
set(VCPKG_DEPS pkgconf zlib pthreads "sdl2[samplerate]" gettext wxwidgets)
|
||||
option(VCPKG_BINARY_PACKAGES "Use vcpkg binary packages" TRUE)
|
||||
|
||||
set(VCPKG_DEPS zlib bzip2 "liblzma[tools]" pthreads gettext-libintl wxwidgets nanosvg)
|
||||
|
||||
set(VCPKG_DEPS_OPTIONAL
|
||||
sfml ENABLE_LINK
|
||||
ffmpeg ENABLE_FFMPEG
|
||||
"sdl3[vulkan]" ENABLE_SDL3
|
||||
"sdl2[samplerate]" ENABLE_SDL2
|
||||
openal-soft ENABLE_OPENAL
|
||||
"ffmpeg[x264,x265]" ENABLE_FFMPEG
|
||||
faudio ENABLE_FAUDIO
|
||||
)
|
||||
|
||||
if(WIN32)
|
||||
find_program(POWERSHELL
|
||||
NAMES powershell.exe pwsh.exe
|
||||
HINTS "/Windows/System32/WindowsPowerShell/v1.0"
|
||||
REQUIRED)
|
||||
else()
|
||||
find_program(POWERSHELL pwsh)
|
||||
endif()
|
||||
|
||||
include(Set-Toolchain-vcpkg)
|
||||
|
||||
# Use ccache if available and not already enabled on the command line.
|
||||
@@ -49,11 +63,11 @@ endif()
|
||||
find_package(Git)
|
||||
|
||||
# Make sure we pull in the submodules on windows and mingw.
|
||||
if(GIT_FOUND AND (WIN32 OR MINGW))
|
||||
if(GIT_FOUND AND WIN32)
|
||||
# Win32 deps submodule
|
||||
set(SUBMODULE_MANUAL_UPDATE FALSE)
|
||||
|
||||
if(EXISTS "${CMAKE_SOURCE_DIR}/.git" AND NOT EXISTS "${CMAKE_SOURCE_DIR}/dependencies/mingw-xaudio/include")
|
||||
if(EXISTS "${CMAKE_SOURCE_DIR}/.git" AND NOT EXISTS "${CMAKE_SOURCE_DIR}/win32-deps/mingw-xaudio/include")
|
||||
set(SUBMODULE_MANUAL_UPDATE TRUE)
|
||||
execute_process(
|
||||
COMMAND "${GIT_EXECUTABLE}" submodule update --init --remote --recursive
|
||||
@@ -62,7 +76,7 @@ if(GIT_FOUND AND (WIN32 OR MINGW))
|
||||
)
|
||||
endif()
|
||||
|
||||
if(NOT EXISTS "${CMAKE_SOURCE_DIR}/dependencies/mingw-xaudio/include")
|
||||
if(NOT EXISTS "${CMAKE_SOURCE_DIR}/win32-deps/mingw-xaudio/include")
|
||||
if(NOT (SUBMODULE_MANUAL_UPDATE AND SUBMODULE_UPDATE_STATUS EQUAL 0))
|
||||
message(FATAL_ERROR "Please pull in git submodules, e.g.\nrun: git submodule update --init --remote --recursive")
|
||||
endif()
|
||||
@@ -76,7 +90,62 @@ set(CMAKE_C_STANDARD_REQUIRED True)
|
||||
|
||||
project(VBA-M C CXX)
|
||||
|
||||
find_package(PkgConfig)
|
||||
if(APPLE)
|
||||
include(CheckLanguage)
|
||||
include(MetalShaderSupport)
|
||||
|
||||
execute_process(
|
||||
COMMAND xcrun -f metal
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
OUTPUT_VARIABLE CMAKE_Metal_COMPILER
|
||||
)
|
||||
|
||||
if(NOT CMAKE_Metal_COMPILER)
|
||||
check_language(Metal)
|
||||
endif()
|
||||
|
||||
if(CMAKE_Metal_COMPILER)
|
||||
enable_language(Metal)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
include(CTest)
|
||||
include(FetchContent)
|
||||
include(GNUInstallDirs)
|
||||
include(Architecture)
|
||||
include(Options)
|
||||
include(Toolchain)
|
||||
include(Dependencies)
|
||||
|
||||
# We target Windows XP for 32 bit Windows builds.
|
||||
if(WIN32 AND X86)
|
||||
add_compile_definitions(-DWINVER=0x0501 -D_WIN32_WINNT=0x0501)
|
||||
endif()
|
||||
|
||||
# Disable tests when not in a git checkout.
|
||||
if(NOT EXISTS "${CMAKE_SOURCE_DIR}/.git")
|
||||
set(BUILD_TESTING OFF)
|
||||
endif()
|
||||
|
||||
# Configure gtest
|
||||
if(BUILD_TESTING)
|
||||
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
|
||||
set(INSTALL_GTEST OFF CACHE BOOL "" FORCE)
|
||||
|
||||
if(NOT EXISTS third_party/googletest/CMakeLists.txt)
|
||||
execute_process(
|
||||
COMMAND git submodule update --init --recursive -- third_party/googletest
|
||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
||||
)
|
||||
endif()
|
||||
|
||||
if(EXISTS third_party/googletest/CMakeLists.txt)
|
||||
add_subdirectory(./third_party/googletest)
|
||||
include(GoogleTest)
|
||||
else()
|
||||
set(BUILD_TESTING OFF)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(NOT CMAKE_PREFIX_PATH AND (NOT ("$ENV{CMAKE_PREFIX_PATH}" STREQUAL "")))
|
||||
set(CMAKE_PREFIX_PATH "$ENV{CMAKE_PREFIX_PATH}")
|
||||
@@ -88,39 +157,9 @@ elseif(NOT CMAKE_BUILD_TYPE MATCHES "^(Release|Debug|RelWithDebInfo|MinSizeRel)$
|
||||
message(FATAL_ERROR "Invalid CMAKE_BUILD_TYPE: '${CMAKE_BUILD_TYPE}', must be one of: 'Release', 'Debug', 'RelWithDebInfo' or 'MinSizeRel'")
|
||||
endif()
|
||||
|
||||
# Link debug libs for RelWithDebInfo
|
||||
if(CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo")
|
||||
set(CMAKE_MAP_IMPORTED_CONFIG_RELWITHDEBINFO "Debug")
|
||||
endif()
|
||||
|
||||
include(CTest)
|
||||
if(BUILD_TESTING)
|
||||
enable_testing()
|
||||
endif()
|
||||
|
||||
include(GNUInstallDirs)
|
||||
include(Options)
|
||||
include(Architecture)
|
||||
include(Toolchain)
|
||||
|
||||
#Output all binaries at top level
|
||||
set(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR})
|
||||
|
||||
if(NOT HTTPS)
|
||||
add_compile_definitions(NO_HTTPS)
|
||||
endif()
|
||||
|
||||
if(ENABLE_GBA_LOGGING)
|
||||
add_compile_definitions(GBA_LOGGING )
|
||||
endif()
|
||||
|
||||
if(ENABLE_MMX)
|
||||
add_compile_definitions(MMX)
|
||||
endif()
|
||||
|
||||
# The SDL port can't be built without debugging support
|
||||
if(NOT ENABLE_DEBUGGER AND ENABLE_SDL)
|
||||
message(SEND_ERROR "The SDL port can't be built without debugging support")
|
||||
set(MSYS OFF)
|
||||
if(NOT "$ENV{MSYSTEM_PREFIX}" STREQUAL "")
|
||||
set(MSYS ON)
|
||||
endif()
|
||||
|
||||
if(EXISTS "${CMAKE_SOURCE_DIR}/.git")
|
||||
@@ -179,159 +218,22 @@ if(NOT VBAM_VERSION)
|
||||
changelog_version(VBAM_VERSION VBAM_REVISION VBAM_VERSION_RELEASE)
|
||||
endif()
|
||||
|
||||
# We do not support amd64 asm yet
|
||||
if(X86_64 AND (ENABLE_ASM_CORE OR ENABLE_ASM_SCALERS OR ENABLE_MMX))
|
||||
message(FATAL_ERROR "The options ASM_CORE, ASM_SCALERS and MMX are not supported on X86_64 yet.")
|
||||
endif()
|
||||
|
||||
# Look for some dependencies using CMake scripts
|
||||
find_package(ZLIB REQUIRED)
|
||||
|
||||
set(OpenGL_GL_PREFERENCE GLVND)
|
||||
|
||||
if(CMAKE_SYSTEM_NAME STREQUAL FreeBSD)
|
||||
set(OpenGL_GL_PREFERENCE LEGACY)
|
||||
endif()
|
||||
|
||||
find_package(OpenGL REQUIRED)
|
||||
find_package(SDL2 REQUIRED)
|
||||
|
||||
# Add libsamplerate to SDL2 with vcpkg
|
||||
unset(SDL2_LIBRARY_TEMP)
|
||||
if(CMAKE_TOOLCHAIN_FILE MATCHES "vcpkg")
|
||||
if(WIN32)
|
||||
unset(arch_suffix)
|
||||
unset(path_prefix)
|
||||
if(VCPKG_TARGET_TRIPLET MATCHES -static)
|
||||
set(arch_suffix -static)
|
||||
endif()
|
||||
if(CMAKE_BUILD_TYPE MATCHES "^(Debug|RelWithDebInfo)$")
|
||||
set(path_prefix debug)
|
||||
endif()
|
||||
set(installed_prefix ${_VCPKG_INSTALLED_DIR}/${WINARCH}-windows${arch_suffix}/${path_prefix})
|
||||
|
||||
SET(SDL2_LIBRARY_TEMP ${SDL2_LIBRARY_TEMP} ${installed_prefix}/lib/samplerate.lib)
|
||||
else()
|
||||
SET(SDL2_LIBRARY_TEMP ${SDL2_LIBRARY_TEMP} -lsamplerate)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
set(VBAM_SDL2_LIBS SDL2::SDL2 ${SDL2_LIBRARY_TEMP})
|
||||
|
||||
set(VBAM_GENERATED_DIR ${CMAKE_BINARY_DIR}/generated)
|
||||
|
||||
# Set up "src" and generated directory as a global include directory.
|
||||
include_directories(
|
||||
${CMAKE_SOURCE_DIR}/src
|
||||
${VBAM_GENERATED_DIR}
|
||||
)
|
||||
|
||||
if(ENABLE_FFMPEG)
|
||||
if(NOT FFMPEG_LIBRARIES)
|
||||
message(FATAL_ERROR "ENABLE_FFMPEG was specified, but required versions of ffmpeg libraries cannot be found!")
|
||||
endif()
|
||||
|
||||
if(APPLE)
|
||||
list(APPEND FFMPEG_LDFLAGS "SHELL:-framework CoreText" "SHELL:-framework ApplicationServices")
|
||||
|
||||
if(UPSTREAM_RELEASE)
|
||||
list(APPEND FFMPEG_LDFLAGS -lbz2 -ltiff "SHELL:-framework DiskArbitration" -lfreetype -lfontconfig -llzma -lxml2 -lharfbuzz)
|
||||
endif()
|
||||
elseif(WIN32)
|
||||
set(WIN32_MEDIA_FOUNDATION_LIBS dxva2 evr mf mfplat mfplay mfreadwrite mfuuid amstrmid)
|
||||
list(APPEND FFMPEG_LIBRARIES secur32 bcrypt ${WIN32_MEDIA_FOUNDATION_LIBS})
|
||||
|
||||
if(MSYS AND VBAM_STATIC)
|
||||
foreach(lib tiff jbig lzma)
|
||||
cygpath(lib "$ENV{MSYSTEM_PREFIX}/lib/lib${lib}.a")
|
||||
|
||||
list(APPEND FFMPEG_LIBRARIES "${lib}")
|
||||
endforeach()
|
||||
endif()
|
||||
endif()
|
||||
else()
|
||||
add_compile_definitions(NO_FFMPEG)
|
||||
endif()
|
||||
|
||||
if(NOT ENABLE_ONLINEUPDATES)
|
||||
add_compile_definitions(NO_ONLINEUPDATES)
|
||||
endif()
|
||||
|
||||
# C defines
|
||||
add_compile_definitions(HAVE_NETINET_IN_H HAVE_ARPA_INET_H HAVE_ZLIB_H FINAL_VERSION SDL USE_OPENGL SYSCONF_INSTALL_DIR="${CMAKE_INSTALL_FULL_SYSCONFDIR}")
|
||||
add_compile_definitions(PKGDATADIR="${CMAKE_INSTALL_FULL_DATADIR}/vbam")
|
||||
add_compile_definitions(__STDC_FORMAT_MACROS)
|
||||
|
||||
if(ENABLE_LINK)
|
||||
# IPC linking code needs sem_timedwait which can be either in librt or pthreads
|
||||
if(NOT WIN32)
|
||||
find_library(RT_LIB rt)
|
||||
if(RT_LIB)
|
||||
set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} ${RT_LIB})
|
||||
set(VBAMCORE_LIBS ${VBAMCORE_LIBS} ${RT_LIB})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
include(CheckFunctionExists)
|
||||
check_function_exists(sem_timedwait SEM_TIMEDWAIT)
|
||||
if(SEM_TIMEDWAIT)
|
||||
add_compile_definitions(HAVE_SEM_TIMEDWAIT)
|
||||
endif()
|
||||
else()
|
||||
add_compile_definitions(NO_LINK)
|
||||
endif()
|
||||
|
||||
# The debugger is enabled by default
|
||||
if(ENABLE_DEBUGGER)
|
||||
add_compile_definitions(VBAM_ENABLE_DEBUGGER)
|
||||
endif()
|
||||
|
||||
# The ASM core is disabled by default because we don't know on which platform we are
|
||||
if(NOT ENABLE_ASM_CORE)
|
||||
add_compile_definitions(C_CORE)
|
||||
endif()
|
||||
|
||||
# Enable internationalization
|
||||
set(LOCALEDIR ${CMAKE_INSTALL_PREFIX}/share/locale)
|
||||
add_compile_definitions(LOCALEDIR="${LOCALEDIR}")
|
||||
|
||||
# for now, only GBALink.cpp uses gettext() directly
|
||||
if(APPLE)
|
||||
# use Homebrew gettext if available
|
||||
if(EXISTS "/usr/local/opt/gettext")
|
||||
set(CMAKE_INCLUDE_PATH "${CMAKE_INCLUDE_PATH};/usr/local/opt/gettext/include")
|
||||
set(CMAKE_LIBRARY_PATH "${CMAKE_LIBRARY_PATH};/usr/local/opt/gettext/lib")
|
||||
set(CMAKE_PROGRAM_PATH "${CMAKE_PROGRAM_PATH};/usr/local/opt/gettext/bin")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(ENABLE_LINK OR ENABLE_WX)
|
||||
find_path(LIBINTL_INC libintl.h)
|
||||
find_library(LIBINTL_LIB NAMES libintl intl)
|
||||
find_library(LIBICONV_LIB NAMES libiconv iconv)
|
||||
find_library(LIBCHARSET_LIB NAMES libcharset charset)
|
||||
if(LIBINTL_LIB)
|
||||
list(APPEND CMAKE_REQUIRED_LIBRARIES ${LIBINTL_LIB})
|
||||
list(APPEND NLS_LIBS ${LIBINTL_LIB})
|
||||
endif()
|
||||
if(LIBICONV_LIB)
|
||||
list(APPEND CMAKE_REQUIRED_LIBRARIES ${LIBICONV_LIB})
|
||||
list(APPEND NLS_LIBS ${LIBICONV_LIB})
|
||||
endif()
|
||||
if(LIBCHARSET_LIB)
|
||||
list(APPEND CMAKE_REQUIRED_LIBRARIES ${LIBCHARSET_LIB})
|
||||
list(APPEND NLS_LIBS ${LIBCHARSET_LIB})
|
||||
endif()
|
||||
include(CheckFunctionExists)
|
||||
check_function_exists(gettext GETTEXT_FN)
|
||||
if(NOT (LIBINTL_INC OR GETTEXT_FN))
|
||||
message(FATAL_ERROR "NLS requires libintl/gettext")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(NOT TRANSLATIONS_ONLY)
|
||||
add_subdirectory(third_party/include/nonstd)
|
||||
add_subdirectory(third_party/include/stb)
|
||||
add_subdirectory(third_party/include/ghc)
|
||||
|
||||
if(ENABLE_LINK)
|
||||
include_directories(third_party/sfml/include)
|
||||
add_subdirectory(third_party/sfml/src/SFML/System EXCLUDE_FROM_ALL)
|
||||
add_subdirectory(third_party/sfml/src/SFML/Network EXCLUDE_FROM_ALL)
|
||||
set(SFML_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/third_party/sfml/include)
|
||||
set(SFML_LIBRARIES sfml-system sfml-network)
|
||||
endif()
|
||||
|
||||
add_subdirectory(src/core)
|
||||
add_subdirectory(src/components)
|
||||
add_subdirectory(src/sdl)
|
||||
@@ -345,5 +247,5 @@ set(CPACK_SOURCE_GENERATOR "TGZ")
|
||||
set(CPACK_PACKAGE_VERSION_MAJOR "2")
|
||||
set(CPACK_PACKAGE_VERSION_MINOR "0")
|
||||
set(CPACK_PACKAGE_VERSION_PATCH "0-Git-${COMMITHASH}")
|
||||
list(APPEND CPACK_SOURCE_IGNORE_FILES "${CMAKE_CURRENT_SOURCE_DIR}/dependencies")
|
||||
list(APPEND CPACK_SOURCE_IGNORE_FILES "${CMAKE_CURRENT_SOURCE_DIR}/win32-deps")
|
||||
include(CPack)
|
||||
|
@@ -9,17 +9,15 @@
|
||||
- [Commit Message](#commit-message)
|
||||
- [Collaboration on a Branch](#collaboration-on-a-branch)
|
||||
- [Commits from Maintainers](#commits-from-maintainers)
|
||||
- [Strings, Character Sets and Translations](#strings-character-sets-and-translations)
|
||||
- [Pulling Updated Translations](#pulling-updated-translations)
|
||||
- [Translations Message Catalog](#translations-message-catalog)
|
||||
- [Interaction with non-wxWidgets Code](#interaction-with-non-wxwidgets-code)
|
||||
- [Windows Native Development Environment Setup](#windows-native-development-environment-setup)
|
||||
- [Miscellaneous](#miscellaneous)
|
||||
- [Debug Messages](#debug-messages)
|
||||
- [Release Process](#release-process)
|
||||
- [Environment](#environment)
|
||||
- [Certificates](#certificates)
|
||||
- [Release Commit and Tag](#release-commit-and-tag)
|
||||
- [64-bit Windows Binary](#64-bit-windows-binary)
|
||||
- [32-bit Windows Binary](#32-bit-windows-binary)
|
||||
- [64-bit Mac Binary](#64-bit-mac-binary)
|
||||
- [ARM64 Windows Binary](#arm64-windows-binary)
|
||||
- [macOS Binary](#macos-binary)
|
||||
- [Final steps](#final-steps)
|
||||
|
||||
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
|
||||
@@ -35,6 +33,8 @@ setup guides.
|
||||
|
||||
Follow the following steps to process newly submitted issues:
|
||||
|
||||
- Edit the user's post to remove any links to illegal content such as ROM files.
|
||||
|
||||
- Edit the user's post to remove unused template sections etc.. Rephrase the
|
||||
issue title if it needs to be clarified.
|
||||
|
||||
@@ -50,14 +50,15 @@ Follow the following steps to process newly submitted issues:
|
||||
|
||||
#### Resolving Issues
|
||||
|
||||
- An issue is resolved by closing it in github. A commit that fixes the issue
|
||||
- An issue is resolved by closing it in GitHub. A commit that fixes the issue
|
||||
should have the following line near the end of the body of the commit message:
|
||||
```
|
||||
- Fix #999.
|
||||
Fix #999.
|
||||
```
|
||||
This will automatically close the issue and assign the closing commit in the
|
||||
github metadata when it is merged to master. The issue can be reopened if
|
||||
GitHub metadata when it is merged to master. The issue can be reopened if
|
||||
needed.
|
||||
|
||||
- A commit that is work towards resolving an issue, should have the issue number
|
||||
preceded by a pound sign either at the end of a commit message title, if it is
|
||||
of primary relevance to the issue, or the body otherwise.
|
||||
@@ -70,7 +71,7 @@ Follow these guidelines always:
|
||||
|
||||
https://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html
|
||||
|
||||
the description of your work should be in the **commit message NOT the pull
|
||||
, the description of your work should be in the **commit message NOT the pull
|
||||
request description**.
|
||||
|
||||
The title line must be no more than 50 characters and the description must be
|
||||
@@ -84,28 +85,29 @@ A commit message must always have a title and a description, the description
|
||||
must be independent of the title line, if necessary repeat the information in
|
||||
the title line in the description.
|
||||
|
||||
Make sure the git history in your branch is clean and logical, edit when
|
||||
necessary with `rebase -i`.
|
||||
|
||||
Use one commit per logical change if necessary, most work can be squashed into
|
||||
one commit when you are done. It is not necessary to have separate commits
|
||||
per-file if they are one logical change. We are less strict about this than
|
||||
other projects, fewer is better.
|
||||
The commit message must **ALL** changes, unless it's a minor refactor or
|
||||
white space change or something and is not important.
|
||||
|
||||
The commit title line should be prefixed with an area, unless it involves the
|
||||
wxWidgets GUI app, in which case it should **NOT** have a prefix.
|
||||
|
||||
If the commit is a user-facing functionality change or enhancement, the title
|
||||
line of the commit must be a non-technical description of this change. For
|
||||
example "Mute on speedup" because this will go into the changelog.
|
||||
|
||||
The text after the area prefix should not be capitalized.
|
||||
|
||||
Please use one of these area prefixes otherwise:
|
||||
Please use one of these area prefixes for non-main-GUI-app commits:
|
||||
|
||||
- doc: documentation, README.md etc.
|
||||
- build: cmake, installdeps, preprocessor compatibility defines, etc.
|
||||
- gb-core: the GameBoy emulator core
|
||||
- gba-core: the GameBoy Advance emulator core
|
||||
- libretro: the libretro core glue and build
|
||||
- sdl-app: anything for the SDL app
|
||||
- translations: anything related to translations
|
||||
- doc: documentation, README.md etc..
|
||||
- build: CMake, installdeps, preprocessor compatibility defines, compatibility
|
||||
headers, macOS build system etc..
|
||||
- gb: the GameBoy emulator core or changes related to it.
|
||||
- gba: the GameBoy Advance emulator core or changes related to it.
|
||||
- libretro: the libretro core glue and build.
|
||||
- sdl: anything for the SDL port, but **NOT** SDL functionality in the wxWidgets
|
||||
GUI app.
|
||||
- translations: anything related to translations.
|
||||
|
||||
. Add other areas here if needed.
|
||||
|
||||
@@ -114,21 +116,85 @@ If a commit fixes a regression, use a title line such as:
|
||||
```console
|
||||
Fix regression <PROBLEM> in <SHORT-SHA>
|
||||
```
|
||||
, you can get the short sha from `git log --oneline -100` or similar.
|
||||
, you can get the short SHA from `git log --oneline -100` or similar.
|
||||
|
||||
The commit description for a regression must refer to the breaking change in
|
||||
reference format, which you can get from e.g. `git log --format=reference -20`.
|
||||
|
||||
You can refer to github issues using `#<ISSUE-NUMBER>` freely in the description
|
||||
text.
|
||||
#### Working on Pull Requests
|
||||
|
||||
If a commit fixes an issue, add a line at the end of the description such as:
|
||||
When opening a pull request, push your branch to our repository if you were
|
||||
given access, or a branch in your fork if you have not yet been given access. Do
|
||||
**NOT** use `master`, use a specific branch.
|
||||
|
||||
```console
|
||||
Fix #<ISSUE-NUMBER>.
|
||||
If you are using a fork, set up your workflow like this:
|
||||
|
||||
```bash
|
||||
git clone git@github.com:visualboyadvance-m/visualboyadvance-m
|
||||
git remote add fork git@github.com:<your-GitHub-user>/visualboyadvance-m
|
||||
git fetch --all --prune
|
||||
git checkout -b your-work-branch-name
|
||||
git commit -a --verbose --signoff -S
|
||||
```
|
||||
.
|
||||
|
||||
The `-S` flags tells Git to sign your commit with GnuPG. If you do not have a
|
||||
GnuPG key, you will need to create one and upload it to a keyserver. I recommend
|
||||
removing the password on your private key to not deal with `gpg-agent` and all
|
||||
of this stuff.
|
||||
|
||||
All of this works fine on Windows, just install `GnuPG.GnuPG` from WinGet.
|
||||
|
||||
Your first push will then be:
|
||||
|
||||
```bash
|
||||
git push -u fork HEAD
|
||||
```
|
||||
.
|
||||
|
||||
Subsequent commits will then be:
|
||||
|
||||
```bash
|
||||
git commit -a --verbose --amend --reset-author --signoff -S
|
||||
git push -f
|
||||
```
|
||||
|
||||
. If you are a project member, then the workflow will be roughly:
|
||||
|
||||
```bash
|
||||
git clone git@github.com:visualboyadvance-m/visualboyadvance-m
|
||||
git fetch --all --prune
|
||||
git checkout -b your-work-branch-name
|
||||
git commit -a --verbose --signoff -S
|
||||
```
|
||||
|
||||
. Your first push will be:
|
||||
|
||||
```bash
|
||||
git push -u origin HEAD
|
||||
```
|
||||
|
||||
. And subsequent pushes will be:
|
||||
|
||||
```bash
|
||||
git commit -a --verbose --signoff -S --amend --reset-author
|
||||
git push -f
|
||||
```
|
||||
|
||||
. Please push frequently so that we can track your progress and review it.
|
||||
|
||||
Make sure the git history in your branch is clean and logical, edit when
|
||||
necessary with `rebase -i`. In most cases a single commit with all of the
|
||||
changes will be good. Sometimes you may want to split it up into multiple
|
||||
logical commits for a large work, but a single commit is also fine if the title
|
||||
line encapsulates all of the work for the changelog.
|
||||
|
||||
See the previous section on how to write commit messages.
|
||||
|
||||
If you are using Windows as your development environment, I recommend reading my
|
||||
manual on Windows development environments
|
||||
[here](https://github.com/rkitover/windows-dev-guide).
|
||||
|
||||
#### Collaboration on a Branch
|
||||
|
||||
To update when multiple people are working on a git branch, keep a couple of
|
||||
@@ -138,137 +204,103 @@ things in mind:
|
||||
better to edit the history than to add more commits. Never add commits fixing
|
||||
previous commits, only improving or adding to them.
|
||||
|
||||
- To update when someone else (very rudely you might say) did a `push -f`, `pull
|
||||
--rebase` will **USUALLY** work. Verify the log, and if necessary do this
|
||||
instead:
|
||||
- To update when someone else updated the branch with a `git push -f`:
|
||||
|
||||
```bash
|
||||
git status # should be clean, with your work having been already pushed
|
||||
git fetch --all --prune
|
||||
git reset --hard origin/<branch-name>
|
||||
git reset --hard origin/<work-branch-name>
|
||||
```
|
||||
.
|
||||
|
||||
- While actively working on a branch, keep it rebased on top of master, like
|
||||
this:
|
||||
|
||||
```bash
|
||||
git fetch --all --prune
|
||||
git rebase origin/master
|
||||
git push -f
|
||||
```
|
||||
|
||||
While actively working on a branch, keep it rebased on top of master.
|
||||
. You may sometimes need to fix conflicts, follow the instructions.
|
||||
|
||||
#### Commits from Maintainers
|
||||
#### Commits from Admins
|
||||
|
||||
Maintainers have the power to commit directly to master. This power must be
|
||||
used responsibly, something I fail to do myself often, and will try to improve
|
||||
upon.
|
||||
Maintainers and project members have the power to commit directly to master.
|
||||
This power must be used responsibly.
|
||||
|
||||
Make your most earnest attempt to follow these general guidelines to keep our
|
||||
history clean:
|
||||
Make your best attempt to follow these general guidelines:
|
||||
|
||||
- Things that are a straight fix or improvement that does not require discussion
|
||||
- Things that are a minor fix or improvement that does not require discussion
|
||||
can be committed directly, keeping the following guidelines in mind.
|
||||
|
||||
- Bigger new features, code refactors and changes in architecture should go
|
||||
through the PR process.
|
||||
|
||||
- Push code changes to a branch first, so they can run through the CI.
|
||||
Differences in what different compilers allow is a problem that comes up
|
||||
**VERY** frequently. As well as incompatibilities between different
|
||||
configurations for both the C++ code and any supporting code.
|
||||
- Absolutely **NEVER** `git push -f` on `master`. If you make a mistake, revert
|
||||
or push a fix commit.
|
||||
|
||||
|
||||
### Strings, Character Sets and Translations
|
||||
|
||||
#### Pulling Updated Translations
|
||||
|
||||
Once in a while it is necessary to pull new and updated translations from
|
||||
transifex.
|
||||
|
||||
For this you need the transifex client, available for Windows as well from
|
||||
chocolatey as `transifex-client`.
|
||||
|
||||
To pull translations run:
|
||||
- Push code changes to a branch first, so they can run through the CI. When you
|
||||
open the commit in GitHub there is a little icon in the upper left corner that
|
||||
shows the CI status for this commit. Differences in what different compilers
|
||||
allow is a problem that comes up **VERY** frequently. As well as
|
||||
incompatibilities between different configurations for both the C++ code and
|
||||
any supporting code. Once the CI is clear, you can merge your branch like
|
||||
this:
|
||||
|
||||
```bash
|
||||
tx pull -af
|
||||
```
|
||||
|
||||
then check `git status` and if any message catalogs were updated, commit the
|
||||
result as:
|
||||
|
||||
```bash
|
||||
git commit -a --signoff -S -m'Transifex pull.'
|
||||
git push -f
|
||||
git checkout master
|
||||
git merge --ff-only <your-work-branch-name>
|
||||
git push
|
||||
git branch -D <your-work-branch-name>
|
||||
git push origin ':refs/heads/your-work-branch-nbame'
|
||||
```
|
||||
|
||||
#### Translations Message Catalog
|
||||
. The last line there deletes the branch in our repository.
|
||||
|
||||
Strings that need to be translated by our wonderful translators on transifex
|
||||
(thank you guys very much) need to be enclosed in `_("...")`, for example:
|
||||
### Miscellaneous
|
||||
|
||||
#### Debug Messages
|
||||
|
||||
We have an override for `wxLogDebug()` to make it work even in non-debug builds
|
||||
of wxWidgets and on windows, even in mintty.
|
||||
|
||||
It works like `printf()`, e.g.:
|
||||
|
||||
```cpp
|
||||
wxLogError(_("error: something very wrong"));
|
||||
int foo = 42;
|
||||
wxLogDebug(wxT("the value of foo = %d"), foo);
|
||||
```
|
||||
|
||||
The next time you run cmake after adding a string to be translated, the `.pot`
|
||||
message catalog source will be regenerated, and you will see a loud message
|
||||
telling you to push to transifex.
|
||||
|
||||
Strings in the XRC XML GUI definition files are automatically added to the
|
||||
message catalog as well.
|
||||
|
||||
If you are working on a branch or a PR, don't push to transifex until it has
|
||||
been merged to master.
|
||||
|
||||
Once it is, push it with:
|
||||
|
||||
```bash
|
||||
tx push -s
|
||||
```
|
||||
|
||||
#### Interaction with non-wxWidgets Code
|
||||
|
||||
Use our `UTF8(...)` function to force any `wxString` to UTF-8 for use by other
|
||||
libraries, screen output or OS APIs. For example:
|
||||
From the core etc. the usual:
|
||||
|
||||
```cpp
|
||||
fprintf(STDERR, "Error: %s\n", UTF8(err_msg));
|
||||
fprintf(stderr, "...", ...);
|
||||
```
|
||||
, will work fine.
|
||||
|
||||
There is one exception to this, when using `wxString::Printf()` and such, you
|
||||
can't pass another `wxString` to the `%s` format directly, use something like
|
||||
this:
|
||||
|
||||
```cpp
|
||||
wxString err;
|
||||
err.Printf("Cannot read file: %s", fname.wc_str());
|
||||
```
|
||||
|
||||
this uses the `wchar_t` UTF-16 representation on Windows and does nothing
|
||||
elsewhere.
|
||||
|
||||
For calling Windows APIs with strings, use the wide char `W` variants and the
|
||||
`wc_str()` method as well.
|
||||
|
||||
### Windows Native Development Environment Setup
|
||||
|
||||
This guide has been moved to:
|
||||
|
||||
https://github.com/rkitover/windows-dev-guide
|
||||
You need a debug build for this to work or to even have a console on Windows.
|
||||
Pass `-DCMAKE_BUILD_TYPE=Debug` to CMake.
|
||||
|
||||
### Release Process
|
||||
|
||||
#### Environment
|
||||
#### GnuPG Key
|
||||
|
||||
The variable `VBAM_NO_PAUSE`, if set, will cause cmake to not pause before gpg
|
||||
signing operations, you want to set this if you've disabled your gpg passphrase
|
||||
to not require interaction during release builds.
|
||||
You will need to create a GnuPG key for signing your commits and release tags,
|
||||
and upload it to a keyserver.
|
||||
|
||||
gpg set up with your key is helpful for the release process on all environments
|
||||
where a binary is built, but you can also make the detached signature files
|
||||
yourself at the end of the process.
|
||||
Make sure to install GnuPG on all environments where you will be making commits
|
||||
and tags.
|
||||
|
||||
For codesigning windows binaries, put your certificate into
|
||||
`~/.codesign/windows_comodo.pkcs12`.
|
||||
#### Certificates
|
||||
|
||||
On Mac the 'Developer ID Application' certificate stored in your login keychain
|
||||
is used, `keychain unlock` will prompt you for your login keychain password, to
|
||||
avoid that set the `LOGIN_KEYCHAIN_PASSWORD` environment variable to your
|
||||
password.
|
||||
Make sure you have set up a Windows code signing certificate with the right
|
||||
password and a Mac 'Developer ID Application' certificate.
|
||||
|
||||
Put the Windows certificate into `~/.codesign/windows_comodo.pkcs12` as a PKCS12
|
||||
file that is password protected, and put the password for it into
|
||||
`~/.codesign/windows_comodo.pkcs12.password`.
|
||||
|
||||
#### Release Commit and Tag
|
||||
|
||||
@@ -280,8 +312,10 @@ tag:
|
||||
mkdir build && cd build
|
||||
cmake .. -DTAG_RELEASE=TRUE
|
||||
```
|
||||
, follow the instructions to edit the `CHANGELOG.md` and then push the release:
|
||||
|
||||
then push the release:
|
||||
To reiterate, **make sure you edit the `CHANGELOG.md`** to remove any
|
||||
non-user-facing changes before you make the release commit.
|
||||
|
||||
```bash
|
||||
git push
|
||||
@@ -296,84 +330,126 @@ cmake .. -DTAG_RELEASE=UNDO
|
||||
|
||||
#### 64-bit Windows Binary
|
||||
|
||||
For this you will preferably need the powershell environment setup described
|
||||
earlier, however you can use a regular Visual Studio 64 bit native developer
|
||||
command prompt as well.
|
||||
For this you will preferably need the PowerShell environment setup described
|
||||
[here](https://github.com/rkitover/windows-dev-guide), or by starting the `x64
|
||||
Native Tools Command Prompt` from your Start Menu.
|
||||
|
||||
```powershell
|
||||
mkdir build
|
||||
cd build
|
||||
cmake .. -DVCPKG_TARGET_TRIPLET=x64-windows-static -DCMAKE_BUILD_TYPE=Release -DUPSTREAM_RELEASE=TRUE -G Ninja
|
||||
mkdir build-msvc64
|
||||
cd build-msvc64
|
||||
cmake .. -DCMAKE_BUILD_TYPE=Release -DUPSTREAM_RELEASE=TRUE -G Ninja
|
||||
ninja
|
||||
```
|
||||
|
||||
Collect the following files for the release:
|
||||
|
||||
- `visualboyadvance-m-Win-64bit.zip`
|
||||
- `visualboyadvance-m-Win-64bit.zip.asc`
|
||||
- `visualboyadvance-m-Win-x86_64.zip`
|
||||
- `translations.zip`
|
||||
- `translations.zip.asc`
|
||||
|
||||
Repeat the process for the debug build, with `-DCMAKE_BUILD_TYPE=Debug` and
|
||||
collect this file:
|
||||
|
||||
- `visualboyadvance-m-Win-x86_64-debug.zip`
|
||||
.
|
||||
|
||||
#### 32-bit Windows Binary
|
||||
|
||||
For this the optimal environment is a linux distribution with the mingw
|
||||
toolchain, I use fedora.
|
||||
The 32-bit build is a legacy build for Windows XP compatibility. You will need
|
||||
the MinGW toolchain to build it. The easiest method is to use the MINGW32 MSYS2
|
||||
environment.
|
||||
|
||||
You can set up a shell on a fedora distribution with docker as described here:
|
||||
Make sure the Visual Studio `signtool.exe` is in your path, you can start MSYS2
|
||||
with an inherited `PATH` from a Visual Studio enabled environment or add it to
|
||||
your shell configuration.
|
||||
|
||||
https://gist.github.com/rkitover/6379764c619c10e829e4b2fa0ae243fd
|
||||
|
||||
If using fedora, the cross script will install all necessary dependencies, if
|
||||
not install the base toolchain (mingw gcc, binutils, winpthreads) using the
|
||||
preferred method for your distribution, you can also use mxe for this.
|
||||
|
||||
https://mxe.cc/
|
||||
First install dependencies with:
|
||||
|
||||
```bash
|
||||
sh tools/win/linux-cross-builder -32
|
||||
./installdeps
|
||||
```
|
||||
|
||||
You can also use msys2 on Windows, this is not recommended:
|
||||
. Then build the 32-bit binary as follows:
|
||||
|
||||
```bash
|
||||
sh tools/win/msys2-builder -32
|
||||
mkdir build-mingw32
|
||||
cd build-mingw32
|
||||
cmake .. -DCMAKE_BUILD_TYPE=Release -DUPSTREAM_RELEASE=TRUE -G Ninja
|
||||
ninja
|
||||
```
|
||||
. Collect this file for the release:
|
||||
|
||||
To set up msys2, see this guide:
|
||||
- `visualboyadvance-m-Win-x86_32.zip`
|
||||
|
||||
https://gist.github.com/rkitover/d008324309044fc0cc742bdb16064454
|
||||
. Then repeat the process for the debug build with `-DCMAKE_BUILD_TYPE=Debug`,
|
||||
and collect this file:
|
||||
|
||||
Collect the following files from `~/vbam-build-mingw32/project` if using linux,
|
||||
or `~/vbam-build-msys2-x86_64/project` if using msys2:
|
||||
- `visualboyadvance-m-Win-x86_32-debug.zip`
|
||||
.
|
||||
|
||||
- `visualboyadvance-m-Win-32bit.zip`
|
||||
- `visualboyadvance-m-Win-32bit.zip.asc`
|
||||
#### ARM64 Windows Binary
|
||||
|
||||
#### 64-bit Mac Binary
|
||||
You will need the MSVC ARM64 cross toolchain to build this binary, if you used
|
||||
the install script from [here](https://github.com/rkitover/windows-dev-guide)
|
||||
you will have it installed, otherwise run Visual Studio Installer and install
|
||||
the component.
|
||||
|
||||
To enter the ARM64 cross environment, edit the PowerShell profile described
|
||||
[here](https://github.com/rkitover/windows-dev-guide) or use the `vcvarsall.bat`
|
||||
script with the `amd64_arm64` argument as described
|
||||
[here](https://learn.microsoft.com/en-us/cpp/build/building-on-the-command-line?view=msvc-170).
|
||||
|
||||
From there the process is the same as for the 64-bit build, collect the
|
||||
following files for the release:
|
||||
|
||||
- `visualboyadvance-m-Win-arm64.zip`
|
||||
- 'visualboyadvance-m-Win-arm64-debug.zip'
|
||||
.
|
||||
|
||||
#### macOS Binary
|
||||
|
||||
Install the latest Xcode for your OS.
|
||||
|
||||
You will need bash and (optionally) gpg from homebrew (which you will also need
|
||||
to install):
|
||||
|
||||
```bash
|
||||
brew install bash gnupg
|
||||
```
|
||||
You will need bash from Homebrew/nix/MacPorts/whatever to run the build script.
|
||||
|
||||
You will need a codesigning certificate from Apple, which you will be able to
|
||||
generate once you join their developer program. This is the certificate of the
|
||||
type 'Developer ID Application' stored in your login keychain. `keychain
|
||||
unlock` will prompt you for your login keychain password, to avoid that set the
|
||||
`LOGIN_KEYCHAIN_PASSWORD` environment variable to your password.
|
||||
generate once you join their developer program from XCode. This is the
|
||||
certificate of the type 'Developer ID Application' stored in your login
|
||||
keychain.
|
||||
|
||||
If you are not using a GUI session, you will need to use a method to unlock your
|
||||
login keychain before building so that your codesigning certificate can be used.
|
||||
Adding the certificate and key to the System keychain is also a method that some
|
||||
people use.
|
||||
|
||||
To unlock your keychain on login, you can add something like this to your
|
||||
`~/.zshrc`:
|
||||
|
||||
```bash
|
||||
/usr/local/bin/bash tools/osx/builder -64
|
||||
security unlock-keychain -p "$(cat ~/.login-keychain-password)" login.keychain
|
||||
```
|
||||
, with your login password in that file.
|
||||
|
||||
For notarization to work, you will need to create an app-specific password on
|
||||
https://appleid.apple.com , get your Team ID from your Apple Developer account,
|
||||
and store them with this command:
|
||||
|
||||
```bash
|
||||
xcrun notarytool store-credentials AC_PASSWORD \
|
||||
--apple-id you@domain.com \
|
||||
--team-id <DeveloperTeamID> \
|
||||
--password <secret_app_specific_2FA_password>
|
||||
```
|
||||
. Once all of this is set up, run:
|
||||
|
||||
```bash
|
||||
tools/osx/builder
|
||||
```
|
||||
, this will take a while because it builds all of the dependencies.
|
||||
|
||||
Collect the following files from `~/vbam-build-mac-64bit/project`:
|
||||
|
||||
- `visualboyadvance-m-Mac-64bit.zip`
|
||||
- `visualboyadvance-m-Mac-64bit.zip.asc`
|
||||
- `visualboyadvance-m-Mac-x86_64.zip`
|
||||
- `visualboyadvance-m-Mac-x86_64-debug.zip`
|
||||
.
|
||||
|
||||
#### Final steps
|
||||
|
||||
@@ -381,27 +457,26 @@ Go to the github releases tab, and make a release for the tag you pushed
|
||||
earlier.
|
||||
|
||||
Put any notes to users and distro maintainers into the description as well as
|
||||
the entries from `CHANGELOG.md` generated earlier from git by the release
|
||||
commit script.
|
||||
the generated entries from `CHANGELOG.md` you edited earlier.
|
||||
|
||||
Upload all files collected during the earlier builds, the complete list is:
|
||||
|
||||
|
||||
- `translations.zip`
|
||||
- `translations.zip.asc`
|
||||
- `visualboyadvance-m-Mac-64bit.zip`
|
||||
- `visualboyadvance-m-Mac-64bit.zip.asc`
|
||||
- `visualboyadvance-m-Win-32bit.zip`
|
||||
- `visualboyadvance-m-Win-32bit.zip.asc`
|
||||
- `visualboyadvance-m-Win-64bit.zip`
|
||||
- `visualboyadvance-m-Win-64bit.zip.asc`
|
||||
- `visualboyadvance-m-Win-x86_64.zip`
|
||||
- `visualboyadvance-m-Win-x86_64-debug.zip`
|
||||
- `visualboyadvance-m-Win-x86_32.zip`
|
||||
- `visualboyadvance-m-Win-x86_32-debug.zip`
|
||||
- `visualboyadvance-m-Win-arm64.zip`
|
||||
- 'visualboyadvance-m-Win-arm64-debug.zip'
|
||||
- `visualboyadvance-m-Mac-x86_64.zip`
|
||||
- `visualboyadvance-m-Mac-x86_64-debug.zip`
|
||||
|
||||
Update the winsparkle appcast.xml by running this cmake command:
|
||||
Update the winsparkle `appcast.xml` by running this cmake command:
|
||||
|
||||
```bash
|
||||
cmake .. -DUPDATE_APPCAST=TRUE
|
||||
```
|
||||
|
||||
follow the instructions to push the change to the web data repo.
|
||||
, follow the instructions to push the change to the web data repo.
|
||||
|
||||
Announce the release on reddit r/emulation and the forum.
|
||||
|
176
README.md
176
README.md
@@ -3,6 +3,7 @@
|
||||
|
||||
|
||||
- [Visual Boy Advance - M](#visual-boy-advance---m)
|
||||
- [System Requirements](#system-requirements)
|
||||
- [Building](#building)
|
||||
- [Building a Libretro core](#building-a-libretro-core)
|
||||
- [Visual Studio Support](#visual-studio-support)
|
||||
@@ -18,8 +19,6 @@
|
||||
|
||||
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
|
||||
|
||||
[](https://gitter.im/visualboyadvance-m/Lobby)
|
||||
|
||||
Our bridged Discord server is [Here](https://discord.gg/EpfxEuGMKH).
|
||||
|
||||
We are also on *`#vba-m`* on [Libera IRC](https://libera.chat/) which has a [Web
|
||||
@@ -56,26 +55,41 @@ the `translations.zip` to the same directory as the executable.
|
||||
If you are having issues, try resetting the config file first, go to `Help ->
|
||||
Factory Reset`.
|
||||
|
||||
## System Requirements
|
||||
|
||||
Windows XP, Vista, 7, 8.1 or 10/11, Linux distros or macOS.
|
||||
|
||||
2Ghz x86 (or x86-64) Intel Core 2 or AMD Athlon processor with SSE, Snapdragon 835
|
||||
or newer CPU compatible with Arm for Windows.
|
||||
|
||||
- Just a guideline, lower clock speeds and Celeron processors may be able to run at full
|
||||
speed on lower settings, and Linux based ARM Operating systems have wider CPU support.
|
||||
|
||||
DirectX June 2010 Redist
|
||||
[Full](https://www.microsoft.com/en-au/download/details.aspx?id=8109) /
|
||||
[Websetup](https://www.microsoft.com/en-au/download/details.aspx?id=35) for
|
||||
Xaudio (Remember to uncheck Bing on the websetup.)
|
||||
|
||||
## Building
|
||||
|
||||
The basic formula to build vba-m is:
|
||||
|
||||
```shell
|
||||
```bash
|
||||
cd ~ && mkdir src && cd src
|
||||
git clone https://github.com/visualboyadvance-m/visualboyadvance-m.git
|
||||
cd visualboyadvance-m
|
||||
./installdeps
|
||||
|
||||
# ./installdeps will give you build instructions, which will be similar to:
|
||||
./installdeps # On Linux or macOS
|
||||
|
||||
mkdir build && cd build
|
||||
cmake .. -G Ninja
|
||||
mkdir build
|
||||
cd build
|
||||
cmake .. -DCMAKE_BUILD_TYPE=Release -G Ninja
|
||||
ninja
|
||||
```
|
||||
|
||||
`./installdeps` is supported on MSys2, Linux (Debian/Ubuntu, Fedora, Arch,
|
||||
Solus, OpenSUSE, Gentoo and RHEL/CentOS) and Mac OS X (homebrew, macports or
|
||||
fink.)
|
||||
`./installdeps` is supported on MSYS2, Linux (Debian/Ubuntu, Fedora, Arch,
|
||||
Solus, OpenSUSE, Gentoo and RHEL/CentOS) and Mac OS X (homebrew, MacPorts or
|
||||
Fink.)
|
||||
|
||||
## Building a Libretro core
|
||||
|
||||
@@ -86,7 +100,7 @@ cd src/libretro
|
||||
make -j`nproc`
|
||||
```
|
||||
|
||||
Copy vbam_libretro.so to your RetroArch cores directory.
|
||||
Copy `vbam_libretro.so` to your RetroArch cores directory.
|
||||
|
||||
## Visual Studio Support
|
||||
|
||||
@@ -106,14 +120,16 @@ environment loaded.
|
||||
Using your own user-wide installation of vcpkg is supported, just make sure the
|
||||
environment variable `VCPKG_ROOT` is set.
|
||||
|
||||
To build in the visual studio command prompt, use something like this:
|
||||
To build in the Visual Studio `x64 Native Tools Command Prompt`, use something
|
||||
like this:
|
||||
|
||||
```
|
||||
mkdir build
|
||||
cd build
|
||||
cmake .. -DVCPKG_TARGET_TRIPLET=x64-windows-static -DCMAKE_BUILD_TYPE=Debug -G Ninja
|
||||
cmake .. -DCMAKE_BUILD_TYPE=Release -G Ninja
|
||||
ninja
|
||||
```
|
||||
.
|
||||
|
||||
## Visual Studio Code Support
|
||||
|
||||
@@ -150,8 +166,7 @@ And the following development libraries:
|
||||
- [ffmpeg](https://ffmpeg.org/) (optional, at least version `4.0.4`, for game recording)
|
||||
- [gettext](https://www.gnu.org/software/gettext/) and gettext-tools
|
||||
- [SDL2](https://www.libsdl.org/) (required)
|
||||
- [SFML](https://www.sfml-dev.org/) (optional, for link)
|
||||
- [OpenAL](https://www.openal.org/) or [openal-soft](https://kcat.strangesoft.net/openal.html) (required, a sound interface)
|
||||
- [openal-soft](https://kcat.strangesoft.net/openal.html) (optional, a sound interface)
|
||||
- [wxWidgets](https://wxwidgets.org/) (required for GUI, 2.8 and non-stl builds are no longer supported)
|
||||
|
||||
On Linux and similar, you also need the version of GTK your wxWidgets is linked
|
||||
@@ -171,62 +186,47 @@ This is supported on Fedora, Arch, Solus and MSYS2.
|
||||
may be `win32` which is an alias for `mingw-w64-i686` to target 32 bit Windows,
|
||||
or `mingw-w64-x86_64` for 64 bit Windows targets.
|
||||
|
||||
The target is implicit on MSys2 depending on which MINGW shell you started (the
|
||||
The target is implicit on MSYS2 depending on which MINGW shell you started (the
|
||||
value of `$MSYSTEM`.)
|
||||
|
||||
On Debian/Ubuntu this uses the MXE apt repository and works quite well.
|
||||
|
||||
On Fedora it can build using the Fedora MinGW packages, albeit with wx 2.8, no
|
||||
OpenGL support, and no Link support for lack of SFML.
|
||||
|
||||
On Arch it currently doesn't work at all because the AUR stuff is completely
|
||||
broken, I will at some point redo the arch stuff to use MXE as well.
|
||||
|
||||
## CMake Options
|
||||
|
||||
The CMake code tries to guess reasonable defaults for options, but you can
|
||||
override them, for example:
|
||||
|
||||
```shell
|
||||
cmake .. -DENABLE_LINK=NO -G Ninja
|
||||
cmake .. -DCMAKE_BUILD_TYPE=Release -DENABLE_LINK=NO -G Ninja
|
||||
```
|
||||
|
||||
Of particular interest is making **Release** or **Debug** builds, the default
|
||||
mode is **Release**, to make a **Debug** build use something like:
|
||||
|
||||
```shell
|
||||
cmake .. -DCMAKE_BUILD_TYPE=Debug -G Ninja
|
||||
```
|
||||
|
||||
Here is the complete list:
|
||||
. Here is the complete list:
|
||||
|
||||
| **CMake Option** | **What it Does** | **Defaults** |
|
||||
|-----------------------|----------------------------------------------------------------------|-----------------------|
|
||||
| ENABLE_SDL | Build the SDL port | OFF |
|
||||
| ENABLE_WX | Build the wxWidgets port | ON |
|
||||
| ENABLE_DEBUGGER | Enable the debugger | ON |
|
||||
| ENABLE_ASM_CORE | Enable x86 ASM CPU cores (**BUGGY AND DANGEROUS**) | OFF |
|
||||
| ENABLE_ASM | Enable the following two ASM options | ON for 32 bit builds |
|
||||
| ENABLE_ASM_SCALERS | Enable x86 ASM graphic filters | ON for 32 bit builds |
|
||||
| ENABLE_MMX | Enable MMX | ON for 32 bit builds |
|
||||
| ENABLE_LINK | Enable GBA linking functionality (requires SFML) | AUTO |
|
||||
| ENABLE_LIRC | Enable LIRC support | OFF |
|
||||
| ENABLE_FFMPEG | Enable ffmpeg A/V recording | AUTO |
|
||||
| ENABLE_ONLINEUPDATES | Enable online update checks | ON |
|
||||
| ENABLE_LTO | Compile with Link Time Optimization (gcc and clang only) | ON for release build |
|
||||
| ENABLE_GBA_LOGGING | Enable extended GBA logging | ON |
|
||||
| ENABLE_DIRECT3D | Direct3D rendering for wxWidgets (Windows, **NOT IMPLEMENTED!!!**) | ON |
|
||||
| ENABLE_XAUDIO2 | Enable xaudio2 sound output for wxWidgets (Windows only) | ON |
|
||||
| ENABLE_OPENAL | Enable OpenAL for the wxWidgets port | AUTO |
|
||||
| ENABLE_ASAN | Enable libasan sanitizers (by default address, only in debug mode) | OFF |
|
||||
| UPSTREAM_RELEASE | Do some release tasks, like codesigning, making zip and gpg sigs. | OFF |
|
||||
| BUILD_TESTING | Build the tests and enable ctest support. | ON |
|
||||
| VBAM_STATIC | Try link all libs statically (the following are set to ON if ON) | OFF |
|
||||
| SDL2_STATIC | Try to link static SDL2 libraries | OFF |
|
||||
| SFML_STATIC_LIBRARIES | Try to link static SFML libraries | OFF |
|
||||
| FFMPEG_STATIC | Try to link static ffmpeg libraries | OFF |
|
||||
| OPENAL_STATIC | Try to link static OpenAL libraries | OFF |
|
||||
| TRANSLATIONS_ONLY | Build only the translations.zip and nothing else | OFF |
|
||||
| `ENABLE_SDL` | Build the SDL port | OFF |
|
||||
| `ENABLE_WX` | Build the wxWidgets port | ON |
|
||||
| `ENABLE_DEBUGGER` | Enable the debugger | ON |
|
||||
| `ENABLE_ASM_CORE` | Enable x86 ASM CPU cores (**BUGGY AND DANGEROUS**) | OFF |
|
||||
| `ENABLE_ASM` | Enable the following two ASM options | ON for 32 bit builds |
|
||||
| `ENABLE_ASM_SCALERS` | Enable x86 ASM graphic filters | ON for 32 bit builds |
|
||||
| `ENABLE_MMX` | Enable MMX | ON for 32 bit builds |
|
||||
| `ENABLE_LINK` | Enable GBA linking functionality | AUTO |
|
||||
| `ENABLE_LIRC` | Enable LIRC support | OFF |
|
||||
| `ENABLE_FFMPEG` | Enable ffmpeg A/V recording | AUTO |
|
||||
| `ENABLE_ONLINEUPDATES` | Enable online update checks | ON |
|
||||
| `ENABLE_LTO` | Compile with Link Time Optimization (gcc and clang only) | ON for release build |
|
||||
| `ENABLE_GBA_LOGGING` | Enable extended GBA logging | ON |
|
||||
| `ENABLE_OPENAL` | Enable openal-soft sound output for wxWidgets | ON, not 32 bit Win |
|
||||
| `ENABLE_XAUDIO2` | Enable xaudio2 sound output for wxWidgets (Windows only) | ON |
|
||||
| `ENABLE_FAUDIO` | Enable faudio sound output for wxWidgets, | ON, not 32 bit Win |
|
||||
| `ENABLE_ASAN` | Enable libasan sanitizers (by default address, only in debug mode) | OFF |
|
||||
| `UPSTREAM_RELEASE` | Do some release tasks, like codesigning, making zip and gpg sigs. | OFF |
|
||||
| `BUILD_TESTING` | Build the tests and enable ctest support. | ON |
|
||||
| `VBAM_STATIC` | Try link all libs statically (the following are set to ON if ON) | OFF |
|
||||
| `SDL2_STATIC` | Try to link static SDL2 libraries | OFF |
|
||||
| `FFMPEG_STATIC` | Try to link static ffmpeg libraries | OFF |
|
||||
| `OPENAL_STATIC` | Try to link static OpenAL libraries | OFF |
|
||||
| `TRANSLATIONS_ONLY` | Build only the translations.zip and nothing else | OFF |
|
||||
|
||||
Note for distro packagers, we use the CMake module
|
||||
[GNUInstallDirs](https://cmake.org/cmake/help/v2.8.12/cmake.html#module:GNUInstallDirs)
|
||||
@@ -236,52 +236,6 @@ On Unix to use a different version of wxWidgets, set
|
||||
`wxWidgets_CONFIG_EXECUTABLE` to the path to the `wx-config` script you want to
|
||||
use.
|
||||
|
||||
## MSys2 Notes
|
||||
|
||||
To run the resulting binary, you can simply type:
|
||||
|
||||
```shell
|
||||
./visualboyadvance-m
|
||||
```
|
||||
|
||||
in the shell where you built it.
|
||||
|
||||
If you built with `-DCMAKE_BUILD_TYPE=Debug`, you will get a console app and
|
||||
will see debug messages, even in mintty.
|
||||
|
||||
If you want to start the binary from e.g. a shortcut or Explorer, you will need
|
||||
to put `c:\msys64\mingw32\bin` for 32 bit builds and `c:\msys64\mingw64\bin`
|
||||
for 64 bit builds in your PATH (to edit system PATH, go to Control Panel ->
|
||||
System -> Advanced system settings -> Environment Variables.)
|
||||
|
||||
If you want to package the binary, you will need to include the MinGW DLLs it
|
||||
depends on, they can install to the same directory as the binary.
|
||||
|
||||
Our own builds are static.
|
||||
|
||||
## Debug Messages
|
||||
|
||||
We have an override for `wxLogDebug()` to make it work even in non-debug builds
|
||||
of wx and on windows, even in mintty.
|
||||
|
||||
It works like `printf()`, e.g.:
|
||||
|
||||
```cpp
|
||||
int foo = 42;
|
||||
wxLogDebug(wxT("the value of foo = %d"), foo);
|
||||
```
|
||||
|
||||
From the core etc. the usual:
|
||||
|
||||
```cpp
|
||||
fprintf(stderr, "...", ...);
|
||||
```
|
||||
|
||||
will work fine.
|
||||
|
||||
You need a debug build for this to work or to even have a console on Windows.
|
||||
Pass `-DCMAKE_BUILD_TYPE=Debug` to cmake.
|
||||
|
||||
## Reporting Crash Bugs
|
||||
|
||||
If the emulator crashes and you wish to report the bug, a backtrace made with
|
||||
@@ -300,27 +254,25 @@ do something such as:
|
||||
```shell
|
||||
ulimit -c unlimited
|
||||
```
|
||||
|
||||
in your shell to enable coredump files.
|
||||
, in your shell to enable core files.
|
||||
|
||||
[This
|
||||
post](https://ask.fedoraproject.org/en/question/98776/where-is-core-dump-located/?answer=98779#post-id-98779)
|
||||
explains how to retrieve core dump on Fedora Linux (and possibly other
|
||||
distributions.)
|
||||
explains how to retrieve core dump on some distributions, when they are managed
|
||||
by systemd.
|
||||
|
||||
Once you have the core dump file, open it with `gdb`, for example:
|
||||
Once you have the core file, open it with `gdb`, for example:
|
||||
|
||||
```shell
|
||||
gdb -c core ./visualboyadvance-m
|
||||
```
|
||||
|
||||
In the `gdb` shell, to print the backtrace, type:
|
||||
. In the `gdb` shell, to start the process and print the backtrace, type:
|
||||
|
||||
```
|
||||
run
|
||||
bt
|
||||
```
|
||||
|
||||
This may be a bit of a hassle, but it helps us out immensely.
|
||||
. This may be a bit of a hassle, but it helps us out immensely.
|
||||
|
||||
## Contributing
|
||||
|
||||
|
@@ -1,3 +1,9 @@
|
||||
if(TRANSLATIONS_ONLY)
|
||||
return()
|
||||
endif()
|
||||
|
||||
# TODO: Use compiler CPU not CMake.
|
||||
|
||||
if(NOT CMAKE_SYSTEM_PROCESSOR)
|
||||
if(NOT CMAKE_TOOLCHAIN_FILE AND CMAKE_HOST_SYSTEM_PROCESSOR)
|
||||
set(CMAKE_SYSTEM_PROCESSOR ${CMAKE_HOST_SYSTEM_PROCESSOR})
|
||||
@@ -27,6 +33,15 @@ elseif(VCPKG_TARGET_TRIPLET MATCHES "^[aA][rR][mM]-")
|
||||
set(CMAKE_SYSTEM_PROCESSOR ARM)
|
||||
endif()
|
||||
|
||||
if(APPLE AND
|
||||
(CMAKE_OSX_ARCHITECTURES MATCHES "[xX]86_64") OR
|
||||
(ENV{CFLAGS} MATCHES "[xX]86_64") OR
|
||||
(ENV{CXXFLAGS} MATCHES "[xX]86_64") OR
|
||||
(ENV{LDFLAGS} MATCHES "[xX]86_64"))
|
||||
|
||||
set(CMAKE_SYSTEM_PROCESSOR "x86_64")
|
||||
endif()
|
||||
|
||||
# Turn asm on by default on 32bit x86 and set WINARCH for windows stuff.
|
||||
if(CMAKE_SYSTEM_PROCESSOR MATCHES "[xX]86|i[3-9]86|[aA][mM][dD]64")
|
||||
if(CMAKE_C_SIZEOF_DATA_PTR EQUAL 4) # 32 bit
|
||||
@@ -42,20 +57,14 @@ if(CMAKE_SYSTEM_PROCESSOR MATCHES "[xX]86|i[3-9]86|[aA][mM][dD]64")
|
||||
set(WINARCH x64)
|
||||
set(ARCH_NAME x86_64)
|
||||
endif()
|
||||
|
||||
if(DEFINED VCPKG_TARGET_TRIPLET)
|
||||
string(REGEX MATCH "^x[86][64]" target_arch ${VCPKG_TARGET_TRIPLET})
|
||||
|
||||
if(NOT WINARCH STREQUAL target_arch)
|
||||
message(FATAL_ERROR "Wrong build environment architecture for VCPKG_TARGET_TRIPLET, you specified ${target_arch} but your compiler is for ${WINARCH}")
|
||||
endif()
|
||||
endif()
|
||||
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "[aA][aA][rR][cC][hH]|[aA][rR][mM]")
|
||||
if(CMAKE_C_SIZEOF_DATA_PTR EQUAL 4) # 32 bit
|
||||
set(ARCH_NAME arm32)
|
||||
set(ARM32 ON)
|
||||
set(ARCH_NAME ARM32)
|
||||
set(WINARCH arm)
|
||||
elseif(CMAKE_C_SIZEOF_DATA_PTR EQUAL 8)
|
||||
set(ARCH_NAME arm64)
|
||||
set(ARM64 ON)
|
||||
set(ARCH_NAME ARM64)
|
||||
set(WINARCH arm64)
|
||||
endif()
|
||||
|
||||
@@ -63,3 +72,8 @@ elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "[aA][aA][rR][cC][hH]|[aA][rR][mM]")
|
||||
set(CMAKE_CROSSCOMPILING TRUE)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# We do not support amd64 asm yet
|
||||
if(X86_64 AND (ENABLE_ASM_CORE OR ENABLE_ASM_SCALERS OR ENABLE_MMX))
|
||||
message(FATAL_ERROR "The options ASM_CORE, ASM_SCALERS and MMX are not supported on X86_64 yet.")
|
||||
endif()
|
||||
|
85
cmake/CMakeDetermineMetalCompiler.cmake
Normal file
85
cmake/CMakeDetermineMetalCompiler.cmake
Normal file
@@ -0,0 +1,85 @@
|
||||
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
||||
# file LICENCE.txt or https://cmake.org/licensing for details.
|
||||
|
||||
# CMakeDetermine(LANG)Compiler.cmake -> this should find the compiler for LANG and configure CMake(LANG)Compiler.cmake.in
|
||||
|
||||
include(${CMAKE_ROOT}/Modules/CMakeDetermineCompiler.cmake)
|
||||
|
||||
if(NOT CMAKE_Metal_COMPILER_NAMES)
|
||||
set(CMAKE_Metal_COMPILER_NAMES metal)
|
||||
endif()
|
||||
|
||||
if("${CMAKE_GENERATOR}" STREQUAL "Xcode")
|
||||
set(CMAKE_Metal_COMPILER_XCODE_TYPE sourcecode.metal)
|
||||
|
||||
execute_process(COMMAND xcrun --find metal
|
||||
OUTPUT_VARIABLE _xcrun_out OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
ERROR_VARIABLE _xcrun_err RESULT_VARIABLE _xcrun_result
|
||||
)
|
||||
|
||||
if(_xcrun_result EQUAL 0 AND EXISTS "${_xcrun_out}")
|
||||
set(CMAKE_Metal_COMPILER "${_xcrun_out}")
|
||||
else()
|
||||
_cmake_find_compiler_path(Metal)
|
||||
endif()
|
||||
else()
|
||||
if(CMAKE_Metal_COMPILER)
|
||||
_cmake_find_compiler_path(Metal)
|
||||
else()
|
||||
set(CMAKE_Metal_COMPILER_INIT NOTFOUND)
|
||||
|
||||
if(NOT $ENV{METALC} STREQUAL "")
|
||||
get_filename_component(CMAKE_Metal_COMPILER_INIT $ENV{METALC} PROGRAM PROGRAM_ARGS CMAKE_Metal_FLAGS_ENV_INIT)
|
||||
if(CMAKE_Metal_FLAGS_ENV_INIT)
|
||||
set(CMAKE_Metal_COMPILER_ARG1 "${CMAKE_Metal_FLAGS_ENV_INIT}" CACHE STRING "Arguments to the Metal compiler")
|
||||
endif()
|
||||
if(NOT EXISTS ${CMAKE_Metal_COMPILER_INIT})
|
||||
message(FATAL_ERROR "Could not find compiler set in environment variable METALC\n$ENV{METALC}.\n${CMAKE_Metal_COMPILER_INIT}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(NOT CMAKE_Metal_COMPILER_INIT)
|
||||
set(CMAKE_Metal_COMPILER_LIST metal ${_CMAKE_TOOLCHAIN_PREFIX}metal)
|
||||
endif()
|
||||
|
||||
_cmake_find_compiler(Metal)
|
||||
endif()
|
||||
|
||||
mark_as_advanced(CMAKE_Metal_COMPILER)
|
||||
endif()
|
||||
|
||||
# For Metal we need to explicitly query the version.
|
||||
if(CMAKE_Metal_COMPILER AND NOT CMAKE_Metal_COMPILER_VERSION)
|
||||
execute_process(
|
||||
COMMAND "${CMAKE_Metal_COMPILER}" --version
|
||||
OUTPUT_VARIABLE output ERROR_VARIABLE output
|
||||
RESULT_VARIABLE result
|
||||
TIMEOUT 10
|
||||
)
|
||||
message(CONFIGURE_LOG
|
||||
"Running the Metal compiler: \"${CMAKE_Metal_COMPILER}\" --version\n"
|
||||
"${output}\n"
|
||||
)
|
||||
|
||||
if(output MATCHES [[metal version ([0-9]+\.[0-9]+(\.[0-9]+)?)]])
|
||||
set(CMAKE_Metal_COMPILER_VERSION "${CMAKE_MATCH_1}")
|
||||
if(NOT CMAKE_Metal_COMPILER_ID)
|
||||
set(CMAKE_Metal_COMPILER_ID "Apple")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(NOT _CMAKE_TOOLCHAIN_LOCATION)
|
||||
get_filename_component(_CMAKE_TOOLCHAIN_LOCATION "${CMAKE_Metal_COMPILER}" PATH)
|
||||
endif ()
|
||||
|
||||
set(_CMAKE_PROCESSING_LANGUAGE "Metal")
|
||||
include(CMakeFindBinUtils)
|
||||
unset(_CMAKE_PROCESSING_LANGUAGE)
|
||||
|
||||
configure_file(
|
||||
${CMAKE_CURRENT_LIST_DIR}/CMakeMetalCompiler.cmake.in
|
||||
${CMAKE_PLATFORM_INFO_DIR}/CMakeMetalCompiler.cmake
|
||||
)
|
||||
|
||||
set(CMAKE_Metal_COMPILER_ENV_VAR "METALC")
|
27
cmake/CMakeMetalCompiler.cmake.in
Normal file
27
cmake/CMakeMetalCompiler.cmake.in
Normal file
@@ -0,0 +1,27 @@
|
||||
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
||||
# file LICENCE.txt or https://cmake.org/licensing for details.
|
||||
|
||||
# CMake(LANG)Compiler.cmake.in -> used by CMakeDetermine(LANG)Compiler.cmake
|
||||
# This file is used to store compiler information and is copied down into try
|
||||
# compile directories so that try compiles do not need to re-determine and test
|
||||
# the LANG
|
||||
|
||||
set(CMAKE_Metal_COMPILER "@CMAKE_Metal_COMPILER@")
|
||||
set(CMAKE_Metal_COMPILER_ID "@CMAKE_Metal_COMPILER_ID@")
|
||||
set(CMAKE_Metal_COMPILER_VERSION "@CMAKE_Metal_COMPILER_VERSION@")
|
||||
|
||||
set(CMAKE_Metal_COMPILER_LOADED 1)
|
||||
set(CMAKE_Metal_COMPILER_WORKS "@CMAKE_Metal_COMPILER_WORKS@")
|
||||
|
||||
set(CMAKE_Metal_COMPILER_ENV_VAR "METALC")
|
||||
|
||||
set(CMAKE_Metal_COMPILER_ID_RUN "@CMAKE_Metal_COMPILER_ID_RUN@")
|
||||
set(CMAKE_Metal_SOURCE_FILE_EXTENSIONS metal)
|
||||
set(CMAKE_Metal_OUTPUT_EXTENSION ".air")
|
||||
set(CMAKE_STATIC_LIBRARY_PREFIX_Metal "")
|
||||
set(CMAKE_STATIC_LIBRARY_SUFFIX_Metal ".metal-ar")
|
||||
set(CMAKE_SHARED_LIBRARY_PREFIX_Metal "")
|
||||
set(CMAKE_SHARED_LIBRARY_SUFFIX_Metal ".metallib")
|
||||
set(CMAKE_SHARED_MODULE_PREFIX_Metal "")
|
||||
set(CMAKE_SHARED_MODULE_SUFFIX_Metal ".metallib")
|
||||
set(CMAKE_EXECUTABLE_SUFFIX_Metal ".metallib")
|
85
cmake/CMakeMetalInformation.cmake
Normal file
85
cmake/CMakeMetalInformation.cmake
Normal file
@@ -0,0 +1,85 @@
|
||||
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
||||
# file LICENCE.txt or https://cmake.org/licensing for details.
|
||||
|
||||
# CMake(LANG)Information.cmake -> set up rule variables for LANG :
|
||||
# CMAKE_(LANG)_CREATE_SHARED_LIBRARY
|
||||
# CMAKE_(LANG)_CREATE_SHARED_MODULE
|
||||
# CMAKE_(LANG)_CREATE_STATIC_LIBRARY
|
||||
# CMAKE_(LANG)_COMPILE_OBJECT
|
||||
# CMAKE_(LANG)_LINK_EXECUTABLE
|
||||
|
||||
include(CMakeCommonLanguageInclude)
|
||||
|
||||
set(CMAKE_Metal_FLAGS_INIT "-ffast-math")
|
||||
set(CMAKE_Metal_FLAGS_DEBUG_INIT "-gline-tables-only -frecord-sources")
|
||||
set(CMAKE_Metal_FLAGS_RELWITHDEBINFO_INIT "-gline-tables-only -frecord-sources")
|
||||
|
||||
cmake_initialize_per_config_variable(CMAKE_Metal_FLAGS "Flags used by the Metal compiler")
|
||||
|
||||
set(CMAKE_INCLUDE_FLAG_Metal "-I ")
|
||||
set(CMAKE_Metal_COMPILER_ARG1 "")
|
||||
set(CMAKE_Metal_DEFINE_FLAG -D)
|
||||
set(CMAKE_Metal_FRAMEWORK_SEARCH_FLAG "-F ")
|
||||
set(CMAKE_Metal_LIBRARY_PATH_FLAG "-L ")
|
||||
set(CMAKE_Metal_SYSROOT_FLAG "-isysroot")
|
||||
set(CMAKE_Metal_COMPILE_OPTIONS_TARGET "-target ")
|
||||
set(CMAKE_DEPFILE_FLAGS_Metal "-MMD -MT dependencies -MF <DEP_FILE>")
|
||||
|
||||
if(CMAKE_GENERATOR MATCHES "Makefiles")
|
||||
set(CMAKE_Metal_DEPFILE_FORMAT gcc)
|
||||
set(CMAKE_Metal_DEPENDS_USE_COMPILER TRUE)
|
||||
endif()
|
||||
|
||||
set(CMAKE_Metal_COMPILER_PREDEFINES_COMMAND "${CMAKE_Metal_COMPILER}")
|
||||
if(CMAKE_Metal_COMPILER_TARGET)
|
||||
list(APPEND CMAKE_Metal_COMPILER_PREDEFINES_COMMAND "-target" "${CMAKE_Metal_COMPILER_TARGET}")
|
||||
endif()
|
||||
|
||||
# now define the following rule variables
|
||||
|
||||
# CMAKE_Metal_CREATE_SHARED_LIBRARY
|
||||
# CMAKE_Metal_CREATE_SHARED_MODULE
|
||||
# CMAKE_Metal_COMPILE_OBJECT
|
||||
# CMAKE_Metal_LINK_EXECUTABLE
|
||||
|
||||
# variables supplied by the generator at use time
|
||||
# <TARGET>
|
||||
# <TARGET_BASE> the target without the suffix
|
||||
# <OBJECTS>
|
||||
# <OBJECT>
|
||||
# <LINK_LIBRARIES>
|
||||
# <FLAGS>
|
||||
# <LINK_FLAGS>
|
||||
|
||||
# Metal compiler information
|
||||
# <CMAKE_Metal_COMPILER>
|
||||
# <CMAKE_SHARED_LIBRARY_CREATE_Metal_FLAGS>
|
||||
# <CMAKE_SHARED_MODULE_CREATE_Metal_FLAGS>
|
||||
# <CMAKE_Metal_LINK_FLAGS>
|
||||
|
||||
if(NOT CMAKE_Metal_COMPILE_OBJECT)
|
||||
set(CMAKE_Metal_COMPILE_OBJECT
|
||||
"<CMAKE_Metal_COMPILER> -c <DEFINES> <INCLUDES> <FLAGS> -o <OBJECT> <SOURCE>"
|
||||
)
|
||||
endif()
|
||||
|
||||
if(NOT CMAKE_Metal_CREATE_SHARED_LIBRARY)
|
||||
set(CMAKE_Metal_CREATE_SHARED_LIBRARY
|
||||
"<CMAKE_Metal_COMPILER> <CMAKE_SHARED_LIBRARY_Metal_FLAGS> <LANGUAGE_COMPILE_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_Metal_FLAGS> -o <TARGET> <OBJECTS> <LINK_LIBRARIES>"
|
||||
)
|
||||
endif()
|
||||
|
||||
if(NOT CMAKE_Metal_CREATE_SHARED_MODULE)
|
||||
set(CMAKE_Metal_CREATE_SHARED_MODULE
|
||||
"${CMAKE_Metal_CREATE_SHARED_LIBRARY}"
|
||||
)
|
||||
endif()
|
||||
|
||||
if(NOT CMAKE_Metal_LINK_EXECUTABLE)
|
||||
# Metal shaders don't really have "executables", but we need this for the try_compile to work properly, so we'll just have it output a metallib file
|
||||
set(CMAKE_Metal_LINK_EXECUTABLE
|
||||
"<CMAKE_Metal_COMPILER> <FLAGS> <CMAKE_Metal_LINK_FLAGS> -o <TARGET> <OBJECTS> <LINK_LIBRARIES>"
|
||||
)
|
||||
endif()
|
||||
|
||||
set(CMAKE_Metal_INFORMATION_LOADED 1)
|
78
cmake/CMakeTestMetalCompiler.cmake
Normal file
78
cmake/CMakeTestMetalCompiler.cmake
Normal file
@@ -0,0 +1,78 @@
|
||||
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
||||
# file LICENCE.txt or https://cmake.org/licensing for details.
|
||||
|
||||
# CMakeTest(LANG)Compiler.cmake -> test the compiler and set:
|
||||
# SET(CMAKE_(LANG)_COMPILER_WORKS 1 CACHE INTERNAL "")
|
||||
|
||||
if(CMAKE_Metal_COMPILER_FORCED)
|
||||
# The compiler configuration was forced by the user.
|
||||
# Assume the user has configured all compiler information.
|
||||
set(CMAKE_Metal_COMPILER_WORKS TRUE)
|
||||
return()
|
||||
endif()
|
||||
|
||||
include(CMakeTestCompilerCommon)
|
||||
|
||||
if("${CMAKE_GENERATOR}" STREQUAL "Xcode")
|
||||
if(XCODE_VERSION VERSION_GREATER 7.0)
|
||||
set(CMAKE_Metal_COMPILER_WORKS 1)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# This file is used by EnableLanguage in cmGlobalGenerator to
|
||||
# determine that that selected Metal compiler can actually compile
|
||||
# and link the most basic of programs. If not, a fatal error
|
||||
# is set and cmake stops processing commands and will not generate
|
||||
# any makefiles or projects.
|
||||
if(NOT CMAKE_Metal_COMPILER_WORKS)
|
||||
PrintTestCompilerStatus("Metal")
|
||||
__TestCompiler_setTryCompileTargetType()
|
||||
|
||||
string(CONCAT __TestCompiler_testMetalCompilerSource
|
||||
"#ifndef __METAL_VERSION__\n"
|
||||
"# error \"The CMAKE_Metal_COMPILER is not a Metal compiler\"\n"
|
||||
"#endif\n"
|
||||
"#import <metal_stdlib>\n"
|
||||
"using namespace metal;\n"
|
||||
)
|
||||
|
||||
# Clear result from normal variable.
|
||||
unset(CMAKE_Metal_COMPILER_WORKS)
|
||||
|
||||
# Puts test result in cache variable.
|
||||
try_compile(CMAKE_Metal_COMPILER_WORKS
|
||||
SOURCE_FROM_VAR testMetalCompiler.metal __TestCompiler_testMetalCompilerSource
|
||||
OUTPUT_VARIABLE __CMAKE_Metal_COMPILER_OUTPUT
|
||||
)
|
||||
unset(__TestCompiler_testMetalCompilerSource)
|
||||
|
||||
# Move result from cache to normal variable.
|
||||
set(CMAKE_Metal_COMPILER_WORKS ${CMAKE_Metal_COMPILER_WORKS})
|
||||
unset(CMAKE_Metal_COMPILER_WORKS CACHE)
|
||||
__TestCompiler_restoreTryCompileTargetType()
|
||||
set(METAL_TEST_WAS_RUN 1)
|
||||
endif()
|
||||
|
||||
if(NOT CMAKE_Metal_COMPILER_WORKS)
|
||||
PrintTestCompilerResult(CHECK_FAIL "broken")
|
||||
string(REPLACE "\n" "\n " _output "${__CMAKE_Metal_COMPILER_OUTPUT}")
|
||||
message(FATAL_ERROR "The Metal compiler\n \"${CMAKE_Metal_COMPILER}\"\n"
|
||||
"is not able to compile a simple test program.\nIt fails "
|
||||
"with the following output:\n ${_output}\n\n"
|
||||
"CMake will not be able to correctly generate this project."
|
||||
)
|
||||
else()
|
||||
if(METAL_TEST_WAS_RUN)
|
||||
PrintTestCompilerResult(CHECK_PASS "works")
|
||||
endif()
|
||||
|
||||
# Re-configure to save learned information.
|
||||
configure_file(
|
||||
${CMAKE_CURRENT_LIST_DIR}/CMakeMetalCompiler.cmake.in
|
||||
${CMAKE_PLATFORM_INFO_DIR}/CMakeMetalCompiler.cmake
|
||||
@ONLY
|
||||
)
|
||||
include(${CMAKE_PLATFORM_INFO_DIR}/CMakeMetalCompiler.cmake)
|
||||
endif()
|
||||
|
||||
unset(__CMAKE_Metal_COMPILER_OUTPUT)
|
169
cmake/CheckLanguage.cmake
Normal file
169
cmake/CheckLanguage.cmake
Normal file
@@ -0,0 +1,169 @@
|
||||
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
||||
# file LICENCE.txt or https://cmake.org/licensing for details.
|
||||
|
||||
#[=======================================================================[.rst:
|
||||
CheckLanguage
|
||||
-------------
|
||||
|
||||
Check whether a language can be enabled by the :command:`enable_language`
|
||||
or :command:`project` commands:
|
||||
|
||||
.. command:: check_language
|
||||
|
||||
.. code-block:: cmake
|
||||
|
||||
check_language(<lang>)
|
||||
|
||||
Try enabling language ``<lang>`` in a test project and record results
|
||||
in the cache:
|
||||
|
||||
:variable:`CMAKE_<LANG>_COMPILER`
|
||||
If the language can be enabled, this variable is set to the compiler
|
||||
that was found. If the language cannot be enabled, this variable is
|
||||
set to ``NOTFOUND``.
|
||||
|
||||
If this variable is already set, either explicitly or cached by
|
||||
a previous call, the check is skipped.
|
||||
|
||||
:variable:`CMAKE_<LANG>_HOST_COMPILER`
|
||||
This variable is set when ``<lang>`` is ``CUDA`` or ``HIP``.
|
||||
|
||||
If the check detects an explicit host compiler that is required for
|
||||
compilation, this variable will be set to that compiler.
|
||||
If the check detects that no explicit host compiler is needed,
|
||||
this variable will be cleared.
|
||||
|
||||
If this variable is already set, its value is preserved only if
|
||||
:variable:`CMAKE_<LANG>_COMPILER` is also set.
|
||||
Otherwise, the check runs and overwrites
|
||||
:variable:`CMAKE_<LANG>_HOST_COMPILER` with a new result.
|
||||
Note that :variable:`CMAKE_<LANG>_HOST_COMPILER` documents it should
|
||||
not be set without also setting
|
||||
:variable:`CMAKE_<LANG>_COMPILER` to a NVCC compiler.
|
||||
|
||||
:variable:`CMAKE_<LANG>_PLATFORM <CMAKE_HIP_PLATFORM>`
|
||||
This variable is set to the detected GPU platform when ``<lang>`` is ``HIP``.
|
||||
|
||||
If the variable is already set its value is always preserved. Only compatible values
|
||||
will be considered for :variable:`CMAKE_<LANG>_COMPILER`.
|
||||
|
||||
For example:
|
||||
|
||||
.. code-block:: cmake
|
||||
|
||||
check_language(Fortran)
|
||||
if(CMAKE_Fortran_COMPILER)
|
||||
enable_language(Fortran)
|
||||
else()
|
||||
message(STATUS "No Fortran support")
|
||||
endif()
|
||||
#]=======================================================================]
|
||||
|
||||
# This file has been modified to take into account the CMAKE_MODULES path when trying to build the test project
|
||||
# Ref https://gitlab.kitware.com/cmake/cmake/-/issues/26020
|
||||
# This was merged in to CMake 3.30.0, so we only need this for older versions
|
||||
|
||||
if(${CMAKE_VERSION} VERSION_GREATER_EQUAL 3.30)
|
||||
include(${CMAKE_ROOT}/Modules/CheckLanguage.cmake)
|
||||
else()
|
||||
include_guard(GLOBAL)
|
||||
|
||||
block(SCOPE_FOR POLICIES)
|
||||
cmake_policy(SET CMP0126 NEW)
|
||||
|
||||
macro(check_language lang)
|
||||
if(NOT DEFINED CMAKE_${lang}_COMPILER)
|
||||
set(_desc "Looking for a ${lang} compiler")
|
||||
message(CHECK_START "${_desc}")
|
||||
file(REMOVE_RECURSE ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/Check${lang})
|
||||
|
||||
set(extra_compiler_variables)
|
||||
if("${lang}" MATCHES "^(CUDA|HIP)$" AND NOT CMAKE_GENERATOR MATCHES "Visual Studio")
|
||||
set(extra_compiler_variables "set(CMAKE_${lang}_HOST_COMPILER \\\"\${CMAKE_${lang}_HOST_COMPILER}\\\")")
|
||||
endif()
|
||||
|
||||
if("${lang}" STREQUAL "HIP")
|
||||
list(APPEND extra_compiler_variables "set(CMAKE_${lang}_PLATFORM \\\"\${CMAKE_${lang}_PLATFORM}\\\")")
|
||||
endif()
|
||||
|
||||
list(TRANSFORM extra_compiler_variables PREPEND "\"")
|
||||
list(TRANSFORM extra_compiler_variables APPEND "\\n\"")
|
||||
list(JOIN extra_compiler_variables "\n " extra_compiler_variables)
|
||||
|
||||
set(_cl_content
|
||||
"cmake_minimum_required(VERSION ${CMAKE_VERSION})
|
||||
set(CMAKE_MODULE_PATH \"${CMAKE_MODULE_PATH}\")
|
||||
project(Check${lang} ${lang})
|
||||
file(WRITE \"\${CMAKE_CURRENT_BINARY_DIR}/result.cmake\"
|
||||
\"set(CMAKE_${lang}_COMPILER \\\"\${CMAKE_${lang}_COMPILER}\\\")\\n\"
|
||||
${extra_compiler_variables}
|
||||
)"
|
||||
)
|
||||
|
||||
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/Check${lang}/CMakeLists.txt"
|
||||
"${_cl_content}")
|
||||
if(CMAKE_GENERATOR_INSTANCE)
|
||||
set(_D_CMAKE_GENERATOR_INSTANCE "-DCMAKE_GENERATOR_INSTANCE:INTERNAL=${CMAKE_GENERATOR_INSTANCE}")
|
||||
else()
|
||||
set(_D_CMAKE_GENERATOR_INSTANCE "")
|
||||
endif()
|
||||
if(CMAKE_GENERATOR MATCHES "^(Xcode$|Green Hills MULTI$|Visual Studio)")
|
||||
set(_D_CMAKE_MAKE_PROGRAM "")
|
||||
else()
|
||||
set(_D_CMAKE_MAKE_PROGRAM "-DCMAKE_MAKE_PROGRAM:FILEPATH=${CMAKE_MAKE_PROGRAM}")
|
||||
endif()
|
||||
if(CMAKE_TOOLCHAIN_FILE)
|
||||
set(_D_CMAKE_TOOLCHAIN_FILE "-DCMAKE_TOOLCHAIN_FILE:FILEPATH=${CMAKE_TOOLCHAIN_FILE}")
|
||||
else()
|
||||
set(_D_CMAKE_TOOLCHAIN_FILE "")
|
||||
endif()
|
||||
if(CMAKE_${lang}_PLATFORM)
|
||||
set(_D_CMAKE_LANG_PLATFORM "-DCMAKE_${lang}_PLATFORM:STRING=${CMAKE_${lang}_PLATFORM}")
|
||||
else()
|
||||
set(_D_CMAKE_LANG_PLATFORM "")
|
||||
endif()
|
||||
execute_process(
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/Check${lang}
|
||||
COMMAND ${CMAKE_COMMAND} . -G ${CMAKE_GENERATOR}
|
||||
-A "${CMAKE_GENERATOR_PLATFORM}"
|
||||
-T "${CMAKE_GENERATOR_TOOLSET}"
|
||||
${_D_CMAKE_GENERATOR_INSTANCE}
|
||||
${_D_CMAKE_MAKE_PROGRAM}
|
||||
${_D_CMAKE_TOOLCHAIN_FILE}
|
||||
${_D_CMAKE_LANG_PLATFORM}
|
||||
OUTPUT_VARIABLE _cl_output
|
||||
ERROR_VARIABLE _cl_output
|
||||
RESULT_VARIABLE _cl_result
|
||||
)
|
||||
include(${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/Check${lang}/result.cmake OPTIONAL)
|
||||
if(CMAKE_${lang}_COMPILER AND "${_cl_result}" STREQUAL "0")
|
||||
message(CONFIGURE_LOG
|
||||
"${_desc} passed with the following output:\n"
|
||||
"${_cl_output}\n")
|
||||
set(_CHECK_COMPILER_STATUS CHECK_PASS)
|
||||
else()
|
||||
set(CMAKE_${lang}_COMPILER NOTFOUND)
|
||||
set(_CHECK_COMPILER_STATUS CHECK_FAIL)
|
||||
message(CONFIGURE_LOG
|
||||
"${_desc} failed with the following output:\n"
|
||||
"${_cl_output}\n")
|
||||
endif()
|
||||
message(${_CHECK_COMPILER_STATUS} "${CMAKE_${lang}_COMPILER}")
|
||||
set(CMAKE_${lang}_COMPILER "${CMAKE_${lang}_COMPILER}" CACHE FILEPATH "${lang} compiler")
|
||||
mark_as_advanced(CMAKE_${lang}_COMPILER)
|
||||
|
||||
if(CMAKE_${lang}_HOST_COMPILER)
|
||||
message(STATUS "Looking for a ${lang} host compiler - ${CMAKE_${lang}_HOST_COMPILER}")
|
||||
set(CMAKE_${lang}_HOST_COMPILER "${CMAKE_${lang}_HOST_COMPILER}" CACHE FILEPATH "${lang} host compiler")
|
||||
mark_as_advanced(CMAKE_${lang}_HOST_COMPILER)
|
||||
endif()
|
||||
|
||||
if(CMAKE_${lang}_PLATFORM)
|
||||
set(CMAKE_${lang}_PLATFORM "${CMAKE_${lang}_PLATFORM}" CACHE STRING "${lang} platform")
|
||||
mark_as_advanced(CMAKE_${lang}_PLATFORM)
|
||||
endif()
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
endblock()
|
||||
endif()
|
146
cmake/Dependencies.cmake
Normal file
146
cmake/Dependencies.cmake
Normal file
@@ -0,0 +1,146 @@
|
||||
if(TRANSLATIONS_ONLY)
|
||||
return()
|
||||
endif()
|
||||
|
||||
# Look for some dependencies using CMake scripts
|
||||
find_package(ZLIB REQUIRED)
|
||||
|
||||
set(OpenGL_GL_PREFERENCE GLVND)
|
||||
|
||||
if(CMAKE_SYSTEM_NAME STREQUAL FreeBSD)
|
||||
set(OpenGL_GL_PREFERENCE LEGACY)
|
||||
endif()
|
||||
|
||||
if(NOT DISABLE_OPENGL)
|
||||
find_package(OpenGL)
|
||||
|
||||
if(NOT OpenGL_FOUND)
|
||||
set(CMAKE_C_FLAGS "-DNO_OPENGL -DNO_OGL ${CMAKE_C_FLAGS}")
|
||||
set(CMAKE_CXX_FLAGS "-DNO_OPENGL -DNO_OGL ${CMAKE_CXX_FLAGS}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Add libsamplerate to SDL2 with vcpkg
|
||||
unset(SDL_LIBRARY_TEMP)
|
||||
if((NOT ENABLE_SDL3) AND CMAKE_TOOLCHAIN_FILE MATCHES "vcpkg")
|
||||
if(WIN32)
|
||||
unset(arch_suffix)
|
||||
unset(path_prefix)
|
||||
if(VCPKG_TARGET_TRIPLET MATCHES -static)
|
||||
set(arch_suffix -static)
|
||||
endif()
|
||||
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
|
||||
set(path_prefix debug)
|
||||
endif()
|
||||
|
||||
set(samplerate_lib_name samplerate)
|
||||
set(installed_prefix ${_VCPKG_INSTALLED_DIR}/${WINARCH}-windows${arch_suffix}/${path_prefix})
|
||||
|
||||
if(MINGW)
|
||||
set(installed_prefix ${_VCPKG_INSTALLED_DIR}/${WINARCH}-mingw${arch_suffix}/${path_prefix})
|
||||
set(samplerate_lib_name lib${samplerate_lib_name})
|
||||
endif()
|
||||
|
||||
SET(SDL_LIBRARY_TEMP ${SDL_LIBRARY_TEMP} "${installed_prefix}/lib/${samplerate_lib_name}${CMAKE_STATIC_LIBRARY_SUFFIX}")
|
||||
else()
|
||||
SET(SDL_LIBRARY_TEMP ${SDL_LIBRARY_TEMP} -lsamplerate)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(ENABLE_SDL3)
|
||||
if(UNIX AND NOT APPLE)
|
||||
set(VBAM_SDL_LIBS "${SDL3_LIBRARIES}")
|
||||
else()
|
||||
if(VBAM_STATIC)
|
||||
set(VBAM_SDL_LIBS SDL3::SDL3-static ${SDL_LIBRARY_TEMP})
|
||||
else()
|
||||
set(VBAM_SDL_LIBS SDL3::SDL3 ${SDL_LIBRARY_TEMP})
|
||||
endif()
|
||||
endif()
|
||||
else()
|
||||
if(VBAM_STATIC)
|
||||
set(VBAM_SDL_LIBS SDL2::SDL2-static ${SDL_LIBRARY_TEMP})
|
||||
else()
|
||||
set(VBAM_SDL_LIBS SDL2::SDL2 ${SDL_LIBRARY_TEMP})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(ENABLE_FFMPEG)
|
||||
if(NOT FFMPEG_LIBRARIES)
|
||||
message(FATAL_ERROR "ENABLE_FFMPEG was specified, but required versions of ffmpeg libraries cannot be found!")
|
||||
endif()
|
||||
|
||||
if(APPLE)
|
||||
list(APPEND FFMPEG_LDFLAGS "SHELL:-framework CoreText" "SHELL:-framework ApplicationServices")
|
||||
|
||||
if(UPSTREAM_RELEASE)
|
||||
list(APPEND FFMPEG_LDFLAGS -lbz2 -ltiff "SHELL:-framework DiskArbitration" -lfreetype -lfontconfig -llzma -lxml2 -lharfbuzz -lcrypto -lssl)
|
||||
endif()
|
||||
elseif(WIN32)
|
||||
set(WIN32_MEDIA_FOUNDATION_LIBS dxva2 evr mf mfplat mfplay mfreadwrite mfuuid amstrmid)
|
||||
list(APPEND FFMPEG_LIBRARIES secur32 bcrypt ${WIN32_MEDIA_FOUNDATION_LIBS})
|
||||
|
||||
if(MSYS AND VBAM_STATIC)
|
||||
foreach(lib tiff jbig lzma)
|
||||
cygpath(lib "$ENV{MSYSTEM_PREFIX}/lib/lib${lib}.a")
|
||||
|
||||
list(APPEND FFMPEG_LIBRARIES "${lib}")
|
||||
endforeach()
|
||||
endif()
|
||||
endif()
|
||||
else()
|
||||
add_compile_definitions(NO_FFMPEG)
|
||||
endif()
|
||||
|
||||
if(ENABLE_LINK)
|
||||
# IPC linking code needs sem_timedwait which can be either in librt or pthreads
|
||||
if(NOT WIN32)
|
||||
find_library(RT_LIB rt)
|
||||
if(RT_LIB)
|
||||
set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} ${RT_LIB})
|
||||
set(VBAMCORE_LIBS ${VBAMCORE_LIBS} ${RT_LIB})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
include(CheckFunctionExists)
|
||||
check_function_exists(sem_timedwait SEM_TIMEDWAIT)
|
||||
if(SEM_TIMEDWAIT)
|
||||
add_compile_definitions(HAVE_SEM_TIMEDWAIT)
|
||||
endif()
|
||||
else()
|
||||
add_compile_definitions(NO_LINK)
|
||||
endif()
|
||||
|
||||
# for now, only GBALink.cpp uses gettext() directly
|
||||
if(APPLE)
|
||||
# use Homebrew gettext if available
|
||||
if(EXISTS "/usr/local/opt/gettext")
|
||||
set(CMAKE_INCLUDE_PATH "${CMAKE_INCLUDE_PATH};/usr/local/opt/gettext/include")
|
||||
set(CMAKE_LIBRARY_PATH "${CMAKE_LIBRARY_PATH};/usr/local/opt/gettext/lib")
|
||||
set(CMAKE_PROGRAM_PATH "${CMAKE_PROGRAM_PATH};/usr/local/opt/gettext/bin")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(ENABLE_LINK OR ENABLE_WX)
|
||||
find_path(LIBINTL_INC libintl.h)
|
||||
find_library(LIBINTL_LIB NAMES libintl intl)
|
||||
find_library(LIBICONV_LIB NAMES libiconv iconv)
|
||||
find_library(LIBCHARSET_LIB NAMES libcharset charset)
|
||||
if(LIBINTL_LIB)
|
||||
list(APPEND CMAKE_REQUIRED_LIBRARIES ${LIBINTL_LIB})
|
||||
list(APPEND NLS_LIBS ${LIBINTL_LIB})
|
||||
endif()
|
||||
if(LIBICONV_LIB)
|
||||
list(APPEND CMAKE_REQUIRED_LIBRARIES ${LIBICONV_LIB})
|
||||
list(APPEND NLS_LIBS ${LIBICONV_LIB})
|
||||
endif()
|
||||
if(LIBCHARSET_LIB)
|
||||
list(APPEND CMAKE_REQUIRED_LIBRARIES ${LIBCHARSET_LIB})
|
||||
list(APPEND NLS_LIBS ${LIBCHARSET_LIB})
|
||||
endif()
|
||||
include(CheckFunctionExists)
|
||||
check_function_exists(gettext GETTEXT_FN)
|
||||
if(NOT (LIBINTL_INC OR GETTEXT_FN))
|
||||
message(FATAL_ERROR "NLS requires libintl/gettext")
|
||||
endif()
|
||||
endif()
|
@@ -33,7 +33,7 @@ include(FindPackageHandleStandardArgs)
|
||||
|
||||
# The default components were taken from a survey over other FindFFMPEG.cmake files
|
||||
if (NOT FFmpeg_FIND_COMPONENTS)
|
||||
set(FFmpeg_FIND_COMPONENTS AVCODEC AVFORMAT AVUTIL)
|
||||
set(FFmpeg_FIND_COMPONENTS AVFORMAT AVCODEC AVUTIL SWSCALE SWRESAMPLE X264 X265)
|
||||
endif ()
|
||||
|
||||
#
|
||||
@@ -65,7 +65,7 @@ macro(find_component _component _pkgconfig _library _header)
|
||||
if (PKG_CONFIG_FOUND)
|
||||
pkg_check_modules(PC_${_component} ${_pkgconfig})
|
||||
endif ()
|
||||
endif (NOT WIN32)
|
||||
endif (NOT WIN32)
|
||||
|
||||
find_path(${_component}_INCLUDE_DIRS ${_header}
|
||||
HINTS
|
||||
@@ -97,16 +97,23 @@ endmacro()
|
||||
|
||||
# Check for cached results. If there are skip the costly part.
|
||||
if (NOT FFMPEG_LIBRARIES)
|
||||
set(x265_lib "x265")
|
||||
|
||||
if(CMAKE_TOOLCHAIN_FILE MATCHES "vcpkg" AND FFMPEG_STATIC)
|
||||
set(x265_lib "x265-static")
|
||||
endif()
|
||||
|
||||
# Check for all possible component.
|
||||
find_component(AVCODEC libavcodec avcodec libavcodec/avcodec.h)
|
||||
find_component(AVFORMAT libavformat avformat libavformat/avformat.h)
|
||||
find_component(AVCODEC libavcodec avcodec libavcodec/avcodec.h)
|
||||
find_component(AVDEVICE libavdevice avdevice libavdevice/avdevice.h)
|
||||
find_component(AVUTIL libavutil avutil libavutil/avutil.h)
|
||||
find_component(AVFILTER libavfilter avfilter libavfilter/avfilter.h)
|
||||
find_component(SWSCALE libswscale swscale libswscale/swscale.h)
|
||||
find_component(POSTPROC libpostproc postproc libpostproc/postprocess.h)
|
||||
find_component(SWRESAMPLE libswresample swresample libswresample/swresample.h)
|
||||
find_component(X264 x264 x264 x264.h)
|
||||
find_component(X265 x265 "${x265_lib}" x265.h)
|
||||
|
||||
# Check if the required components were found and add their stuff to the FFMPEG_* vars.
|
||||
foreach (_component ${FFmpeg_FIND_COMPONENTS})
|
||||
|
@@ -1,231 +1,232 @@
|
||||
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
||||
# file Copyright.txt or https://cmake.org/licensing for details.
|
||||
|
||||
#.rst:
|
||||
# FindGettext
|
||||
# -----------
|
||||
#
|
||||
# Find GNU gettext tools
|
||||
#
|
||||
# This module looks for the GNU gettext tools. This module defines the
|
||||
# following values:
|
||||
#
|
||||
# ::
|
||||
#
|
||||
# GETTEXT_MSGMERGE_EXECUTABLE: the full path to the msgmerge tool.
|
||||
# GETTEXT_MSGFMT_EXECUTABLE: the full path to the msgfmt tool.
|
||||
# GETTEXT_FOUND: True if gettext has been found.
|
||||
# GETTEXT_VERSION_STRING: the version of gettext found (since CMake 2.8.8)
|
||||
#
|
||||
#
|
||||
#
|
||||
# Additionally it provides the following macros:
|
||||
#
|
||||
# GETTEXT_CREATE_TRANSLATIONS ( outputFile [ALL] file1 ... fileN )
|
||||
#
|
||||
# ::
|
||||
#
|
||||
# This will create a target "translations" which will convert the
|
||||
# given input po files into the binary output mo file. If the
|
||||
# ALL option is used, the translations will also be created when
|
||||
# building the default target.
|
||||
#
|
||||
# GETTEXT_PROCESS_POT_FILE( <potfile> [ALL] [INSTALL_DESTINATION <destdir>]
|
||||
# LANGUAGES <lang1> <lang2> ... )
|
||||
#
|
||||
# ::
|
||||
#
|
||||
# Process the given pot file to mo files.
|
||||
# If INSTALL_DESTINATION is given then automatically install rules will
|
||||
# be created, the language subdirectory will be taken into account
|
||||
# (by default use share/locale/).
|
||||
# If ALL is specified, the pot file is processed when building the all traget.
|
||||
# It creates a custom target "potfile".
|
||||
#
|
||||
# GETTEXT_PROCESS_PO_FILES( <lang> [ALL] [INSTALL_DESTINATION <dir>]
|
||||
# PO_FILES <po1> <po2> ... )
|
||||
#
|
||||
# ::
|
||||
#
|
||||
# Process the given po files to mo files for the given language.
|
||||
# If INSTALL_DESTINATION is given then automatically install rules will
|
||||
# be created, the language subdirectory will be taken into account
|
||||
# (by default use share/locale/).
|
||||
# If ALL is specified, the po files are processed when building the all traget.
|
||||
# It creates a custom target "pofiles".
|
||||
#
|
||||
# .. note::
|
||||
# If you wish to use the Gettext library (libintl), use :module:`FindIntl`.
|
||||
#[=======================================================================[.rst:
|
||||
FindGettext
|
||||
-----------
|
||||
|
||||
Find GNU gettext tools
|
||||
|
||||
This module looks for the GNU gettext tools. This module defines the
|
||||
following values:
|
||||
|
||||
::
|
||||
|
||||
GETTEXT_MSGMERGE_EXECUTABLE: the full path to the msgmerge tool.
|
||||
GETTEXT_MSGFMT_EXECUTABLE: the full path to the msgfmt tool.
|
||||
GETTEXT_FOUND: True if gettext has been found.
|
||||
GETTEXT_VERSION_STRING: the version of gettext found (since CMake 2.8.8)
|
||||
|
||||
|
||||
|
||||
Additionally it provides the following macros:
|
||||
|
||||
GETTEXT_CREATE_TRANSLATIONS ( outputFile [ALL] file1 ... fileN )
|
||||
|
||||
::
|
||||
|
||||
This will create a target "translations" which will convert the
|
||||
given input po files into the binary output mo file. If the
|
||||
ALL option is used, the translations will also be created when
|
||||
building the default target.
|
||||
|
||||
GETTEXT_PROCESS_POT_FILE( <potfile> [ALL] [INSTALL_DESTINATION <destdir>]
|
||||
LANGUAGES <lang1> <lang2> ... )
|
||||
|
||||
::
|
||||
|
||||
Process the given pot file to mo files.
|
||||
If INSTALL_DESTINATION is given then automatically install rules will
|
||||
be created, the language subdirectory will be taken into account
|
||||
(by default use share/locale/).
|
||||
If ALL is specified, the pot file is processed when building the all target.
|
||||
It creates a custom target "potfile".
|
||||
|
||||
GETTEXT_PROCESS_PO_FILES( <lang> [ALL] [INSTALL_DESTINATION <dir>]
|
||||
PO_FILES <po1> <po2> ... )
|
||||
|
||||
::
|
||||
|
||||
Process the given po files to mo files for the given language.
|
||||
If INSTALL_DESTINATION is given then automatically install rules will
|
||||
be created, the language subdirectory will be taken into account
|
||||
(by default use share/locale/).
|
||||
If ALL is specified, the po files are processed when building the all target.
|
||||
It creates a custom target "pofiles".
|
||||
|
||||
.. versionadded:: 3.2
|
||||
If you wish to use the Gettext library (libintl), use :module:`FindIntl`.
|
||||
#]=======================================================================]
|
||||
|
||||
find_program(GETTEXT_MSGMERGE_EXECUTABLE msgmerge)
|
||||
|
||||
find_program(GETTEXT_MSGFMT_EXECUTABLE msgfmt)
|
||||
|
||||
if(GETTEXT_MSGMERGE_EXECUTABLE)
|
||||
execute_process(COMMAND ${GETTEXT_MSGMERGE_EXECUTABLE} --version
|
||||
execute_process(COMMAND ${GETTEXT_MSGMERGE_EXECUTABLE} --version
|
||||
OUTPUT_VARIABLE gettext_version
|
||||
ERROR_QUIET
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
get_filename_component(msgmerge_name ${GETTEXT_MSGMERGE_EXECUTABLE} NAME)
|
||||
get_filename_component(msgmerge_namewe ${GETTEXT_MSGMERGE_EXECUTABLE} NAME_WE)
|
||||
if (gettext_version MATCHES "^(${msgmerge_name}|${msgmerge_namewe}) \\([^\\)]*\\) ([0-9\\.]+[^ \n]*)")
|
||||
set(GETTEXT_VERSION_STRING "${CMAKE_MATCH_2}")
|
||||
endif()
|
||||
unset(gettext_version)
|
||||
unset(msgmerge_name)
|
||||
unset(msgmerge_namewe)
|
||||
get_filename_component(msgmerge_name ${GETTEXT_MSGMERGE_EXECUTABLE} NAME)
|
||||
get_filename_component(msgmerge_namewe ${GETTEXT_MSGMERGE_EXECUTABLE} NAME_WE)
|
||||
if (gettext_version MATCHES "^(${msgmerge_name}|${msgmerge_namewe}) \\([^\\)]*\\) ([0-9\\.]+[^ \n]*)")
|
||||
set(GETTEXT_VERSION_STRING "${CMAKE_MATCH_2}")
|
||||
endif()
|
||||
unset(gettext_version)
|
||||
unset(msgmerge_name)
|
||||
unset(msgmerge_namewe)
|
||||
endif()
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
|
||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(Gettext
|
||||
REQUIRED_VARS GETTEXT_MSGMERGE_EXECUTABLE GETTEXT_MSGFMT_EXECUTABLE
|
||||
VERSION_VAR GETTEXT_VERSION_STRING)
|
||||
|
||||
function(_GETTEXT_GET_UNIQUE_TARGET_NAME _name _unique_name)
|
||||
set(propertyName "_GETTEXT_UNIQUE_COUNTER_${_name}")
|
||||
get_property(currentCounter GLOBAL PROPERTY "${propertyName}")
|
||||
if(NOT currentCounter)
|
||||
set(currentCounter 1)
|
||||
endif()
|
||||
set(${_unique_name} "${_name}_${currentCounter}" PARENT_SCOPE)
|
||||
math(EXPR currentCounter "${currentCounter} + 1")
|
||||
set_property(GLOBAL PROPERTY ${propertyName} ${currentCounter} )
|
||||
set(propertyName "_GETTEXT_UNIQUE_COUNTER_${_name}")
|
||||
get_property(currentCounter GLOBAL PROPERTY "${propertyName}")
|
||||
if(NOT currentCounter)
|
||||
set(currentCounter 1)
|
||||
endif()
|
||||
set(${_unique_name} "${_name}_${currentCounter}" PARENT_SCOPE)
|
||||
math(EXPR currentCounter "${currentCounter} + 1")
|
||||
set_property(GLOBAL PROPERTY ${propertyName} ${currentCounter} )
|
||||
endfunction()
|
||||
|
||||
macro(GETTEXT_CREATE_TRANSLATIONS _potFile _firstPoFileArg)
|
||||
# make it a real variable, so we can modify it here
|
||||
set(_firstPoFile "${_firstPoFileArg}")
|
||||
# make it a real variable, so we can modify it here
|
||||
set(_firstPoFile "${_firstPoFileArg}")
|
||||
|
||||
set(_gmoFiles)
|
||||
get_filename_component(_potName ${_potFile} NAME)
|
||||
string(REGEX REPLACE "^(.+)(\\.[^.]+)$" "\\1" _potBasename ${_potName})
|
||||
get_filename_component(_absPotFile ${_potFile} ABSOLUTE)
|
||||
set(_gmoFiles)
|
||||
get_filename_component(_potName ${_potFile} NAME)
|
||||
string(REGEX REPLACE "^(.+)(\\.[^.]+)$" "\\1" _potBasename ${_potName})
|
||||
get_filename_component(_absPotFile ${_potFile} ABSOLUTE)
|
||||
|
||||
set(_addToAll)
|
||||
if(${_firstPoFile} STREQUAL "ALL")
|
||||
set(_addToAll "ALL")
|
||||
set(_firstPoFile)
|
||||
endif()
|
||||
set(_addToAll)
|
||||
if(${_firstPoFile} STREQUAL "ALL")
|
||||
set(_addToAll "ALL")
|
||||
set(_firstPoFile)
|
||||
endif()
|
||||
|
||||
foreach (_currentPoFile ${_firstPoFile} ${ARGN})
|
||||
get_filename_component(_absFile ${_currentPoFile} ABSOLUTE)
|
||||
get_filename_component(_abs_PATH ${_absFile} PATH)
|
||||
string(REGEX REPLACE "^.*/([^/]+)(\\.[^.]+)$" "\\1" _lang ${_absFile})
|
||||
set(_gmoFile ${CMAKE_CURRENT_BINARY_DIR}/${_lang}.gmo)
|
||||
foreach (_currentPoFile ${_firstPoFile} ${ARGN})
|
||||
get_filename_component(_absFile ${_currentPoFile} ABSOLUTE)
|
||||
get_filename_component(_abs_PATH ${_absFile} PATH)
|
||||
get_filename_component(_lang ${_absFile} NAME_WE)
|
||||
set(_gmoFile ${CMAKE_CURRENT_BINARY_DIR}/${_lang}.gmo)
|
||||
|
||||
add_custom_command(
|
||||
OUTPUT ${_gmoFile}
|
||||
#COMMAND ${GETTEXT_MSGMERGE_EXECUTABLE} --quiet --update --backup=none -s ${_absFile} ${_absPotFile}
|
||||
COMMAND ${GETTEXT_MSGFMT_EXECUTABLE} -o ${_gmoFile} ${_absFile}
|
||||
DEPENDS ${_absPotFile} ${_absFile}
|
||||
)
|
||||
add_custom_command(
|
||||
OUTPUT ${_gmoFile}
|
||||
# COMMAND ${GETTEXT_MSGMERGE_EXECUTABLE} --quiet --update --backup=none -s ${_absFile} ${_absPotFile}
|
||||
COMMAND ${GETTEXT_MSGFMT_EXECUTABLE} -o ${_gmoFile} ${_absFile}
|
||||
DEPENDS ${_absPotFile} ${_absFile}
|
||||
)
|
||||
|
||||
install(FILES ${_gmoFile} DESTINATION share/locale/${_lang}/LC_MESSAGES RENAME ${_potBasename}.mo)
|
||||
set(_gmoFiles ${_gmoFiles} ${_gmoFile})
|
||||
install(FILES ${_gmoFile} DESTINATION share/locale/${_lang}/LC_MESSAGES RENAME ${_potBasename}.mo)
|
||||
set(_gmoFiles ${_gmoFiles} ${_gmoFile})
|
||||
|
||||
endforeach ()
|
||||
endforeach ()
|
||||
|
||||
if(NOT TARGET translations)
|
||||
add_custom_target(translations)
|
||||
endif()
|
||||
if(NOT TARGET translations)
|
||||
add_custom_target(translations)
|
||||
endif()
|
||||
|
||||
_GETTEXT_GET_UNIQUE_TARGET_NAME(translations uniqueTargetName)
|
||||
|
||||
add_custom_target(${uniqueTargetName} ${_addToAll} DEPENDS ${_gmoFiles})
|
||||
add_custom_target(${uniqueTargetName} ${_addToAll} DEPENDS ${_gmoFiles})
|
||||
|
||||
add_dependencies(translations ${uniqueTargetName})
|
||||
|
||||
add_dependencies(translations ${uniqueTargetName})
|
||||
endmacro()
|
||||
|
||||
|
||||
function(GETTEXT_PROCESS_POT_FILE _potFile)
|
||||
set(_gmoFiles)
|
||||
set(_options ALL)
|
||||
set(_oneValueArgs INSTALL_DESTINATION)
|
||||
set(_multiValueArgs LANGUAGES)
|
||||
set(_gmoFiles)
|
||||
set(_options ALL)
|
||||
set(_oneValueArgs INSTALL_DESTINATION)
|
||||
set(_multiValueArgs LANGUAGES)
|
||||
|
||||
CMAKE_PARSE_ARGUMENTS(_parsedArguments "${_options}" "${_oneValueArgs}" "${_multiValueArgs}" ${ARGN})
|
||||
CMAKE_PARSE_ARGUMENTS(_parsedArguments "${_options}" "${_oneValueArgs}" "${_multiValueArgs}" ${ARGN})
|
||||
|
||||
get_filename_component(_potName ${_potFile} NAME)
|
||||
string(REGEX REPLACE "^(.+)(\\.[^.]+)$" "\\1" _potBasename ${_potName})
|
||||
get_filename_component(_absPotFile ${_potFile} ABSOLUTE)
|
||||
get_filename_component(_potName ${_potFile} NAME)
|
||||
string(REGEX REPLACE "^(.+)(\\.[^.]+)$" "\\1" _potBasename ${_potName})
|
||||
get_filename_component(_absPotFile ${_potFile} ABSOLUTE)
|
||||
|
||||
foreach (_lang ${_parsedArguments_LANGUAGES})
|
||||
set(_poFile "${CMAKE_CURRENT_BINARY_DIR}/${_lang}.po")
|
||||
set(_gmoFile "${CMAKE_CURRENT_BINARY_DIR}/${_lang}.gmo")
|
||||
foreach (_lang ${_parsedArguments_LANGUAGES})
|
||||
set(_poFile "${CMAKE_CURRENT_BINARY_DIR}/${_lang}.po")
|
||||
set(_gmoFile "${CMAKE_CURRENT_BINARY_DIR}/${_lang}.gmo")
|
||||
|
||||
add_custom_command(
|
||||
OUTPUT "${_poFile}"
|
||||
COMMAND ${GETTEXT_MSGMERGE_EXECUTABLE} --quiet --update --backup=none -s ${_poFile} ${_absPotFile}
|
||||
DEPENDS ${_absPotFile}
|
||||
)
|
||||
add_custom_command(
|
||||
OUTPUT "${_poFile}"
|
||||
COMMAND ${GETTEXT_MSGMERGE_EXECUTABLE} --quiet --update --backup=none -s ${_poFile} ${_absPotFile}
|
||||
DEPENDS ${_absPotFile}
|
||||
)
|
||||
|
||||
add_custom_command(
|
||||
OUTPUT "${_gmoFile}"
|
||||
COMMAND ${GETTEXT_MSGFMT_EXECUTABLE} -o ${_gmoFile} ${_poFile}
|
||||
DEPENDS ${_absPotFile} ${_poFile}
|
||||
)
|
||||
add_custom_command(
|
||||
OUTPUT "${_gmoFile}"
|
||||
COMMAND ${GETTEXT_MSGFMT_EXECUTABLE} -o ${_gmoFile} ${_poFile}
|
||||
DEPENDS ${_absPotFile} ${_poFile}
|
||||
)
|
||||
|
||||
if(_parsedArguments_INSTALL_DESTINATION)
|
||||
install(FILES ${_gmoFile} DESTINATION ${_parsedArguments_INSTALL_DESTINATION}/${_lang}/LC_MESSAGES RENAME ${_potBasename}.mo)
|
||||
endif()
|
||||
list(APPEND _gmoFiles ${_gmoFile})
|
||||
endforeach ()
|
||||
if(_parsedArguments_INSTALL_DESTINATION)
|
||||
install(FILES ${_gmoFile} DESTINATION ${_parsedArguments_INSTALL_DESTINATION}/${_lang}/LC_MESSAGES RENAME ${_potBasename}.mo)
|
||||
endif()
|
||||
list(APPEND _gmoFiles ${_gmoFile})
|
||||
endforeach ()
|
||||
|
||||
if(NOT TARGET potfiles)
|
||||
add_custom_target(potfiles)
|
||||
add_custom_target(potfiles)
|
||||
endif()
|
||||
|
||||
_GETTEXT_GET_UNIQUE_TARGET_NAME( potfiles uniqueTargetName)
|
||||
|
||||
if(_parsedArguments_ALL)
|
||||
add_custom_target(${uniqueTargetName} ALL DEPENDS ${_gmoFiles})
|
||||
else()
|
||||
add_custom_target(${uniqueTargetName} DEPENDS ${_gmoFiles})
|
||||
endif()
|
||||
if(_parsedArguments_ALL)
|
||||
add_custom_target(${uniqueTargetName} ALL DEPENDS ${_gmoFiles})
|
||||
else()
|
||||
add_custom_target(${uniqueTargetName} DEPENDS ${_gmoFiles})
|
||||
endif()
|
||||
|
||||
add_dependencies(potfiles ${uniqueTargetName})
|
||||
add_dependencies(potfiles ${uniqueTargetName})
|
||||
|
||||
endfunction()
|
||||
|
||||
|
||||
function(GETTEXT_PROCESS_PO_FILES _lang)
|
||||
set(_options ALL)
|
||||
set(_oneValueArgs INSTALL_DESTINATION)
|
||||
set(_multiValueArgs PO_FILES)
|
||||
set(_gmoFiles)
|
||||
set(_options ALL)
|
||||
set(_oneValueArgs INSTALL_DESTINATION)
|
||||
set(_multiValueArgs PO_FILES)
|
||||
set(_gmoFiles)
|
||||
|
||||
CMAKE_PARSE_ARGUMENTS(_parsedArguments "${_options}" "${_oneValueArgs}" "${_multiValueArgs}" ${ARGN})
|
||||
CMAKE_PARSE_ARGUMENTS(_parsedArguments "${_options}" "${_oneValueArgs}" "${_multiValueArgs}" ${ARGN})
|
||||
|
||||
foreach(_current_PO_FILE ${_parsedArguments_PO_FILES})
|
||||
get_filename_component(_name ${_current_PO_FILE} NAME)
|
||||
string(REGEX REPLACE "^(.+)(\\.[^.]+)$" "\\1" _basename ${_name})
|
||||
set(_gmoFile ${CMAKE_CURRENT_BINARY_DIR}/${_basename}.gmo)
|
||||
add_custom_command(OUTPUT ${_gmoFile}
|
||||
COMMAND ${GETTEXT_MSGFMT_EXECUTABLE} -o ${_gmoFile} ${_current_PO_FILE}
|
||||
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
|
||||
DEPENDS ${_current_PO_FILE}
|
||||
)
|
||||
foreach(_current_PO_FILE ${_parsedArguments_PO_FILES})
|
||||
get_filename_component(_name ${_current_PO_FILE} NAME)
|
||||
string(REGEX REPLACE "^(.+)(\\.[^.]+)$" "\\1" _basename ${_name})
|
||||
set(_gmoFile ${CMAKE_CURRENT_BINARY_DIR}/${_basename}.gmo)
|
||||
add_custom_command(OUTPUT ${_gmoFile}
|
||||
COMMAND ${GETTEXT_MSGFMT_EXECUTABLE} -o ${_gmoFile} ${_current_PO_FILE}
|
||||
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
|
||||
DEPENDS ${_current_PO_FILE}
|
||||
)
|
||||
|
||||
if(_parsedArguments_INSTALL_DESTINATION)
|
||||
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${_basename}.gmo DESTINATION ${_parsedArguments_INSTALL_DESTINATION}/${_lang}/LC_MESSAGES/ RENAME ${_basename}.mo)
|
||||
endif()
|
||||
list(APPEND _gmoFiles ${_gmoFile})
|
||||
endforeach()
|
||||
if(_parsedArguments_INSTALL_DESTINATION)
|
||||
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${_basename}.gmo DESTINATION ${_parsedArguments_INSTALL_DESTINATION}/${_lang}/LC_MESSAGES/ RENAME ${_basename}.mo)
|
||||
endif()
|
||||
list(APPEND _gmoFiles ${_gmoFile})
|
||||
endforeach()
|
||||
|
||||
|
||||
if(NOT TARGET pofiles)
|
||||
add_custom_target(pofiles)
|
||||
add_custom_target(pofiles)
|
||||
endif()
|
||||
|
||||
_GETTEXT_GET_UNIQUE_TARGET_NAME( pofiles uniqueTargetName)
|
||||
|
||||
if(_parsedArguments_ALL)
|
||||
add_custom_target(${uniqueTargetName} ALL DEPENDS ${_gmoFiles})
|
||||
else()
|
||||
add_custom_target(${uniqueTargetName} DEPENDS ${_gmoFiles})
|
||||
endif()
|
||||
if(_parsedArguments_ALL)
|
||||
add_custom_target(${uniqueTargetName} ALL DEPENDS ${_gmoFiles})
|
||||
else()
|
||||
add_custom_target(${uniqueTargetName} DEPENDS ${_gmoFiles})
|
||||
endif()
|
||||
|
||||
add_dependencies(pofiles ${uniqueTargetName})
|
||||
add_dependencies(pofiles ${uniqueTargetName})
|
||||
|
||||
endfunction()
|
||||
|
@@ -1,110 +0,0 @@
|
||||
#.rst:
|
||||
# FindOpenAL
|
||||
# ----------
|
||||
#
|
||||
#
|
||||
#
|
||||
# Locate OpenAL This module defines OPENAL_LIBRARY OPENAL_FOUND, if
|
||||
# false, do not try to link to OpenAL OPENAL_INCLUDE_DIR, where to find
|
||||
# the headers
|
||||
#
|
||||
# $OPENALDIR is an environment variable that would correspond to the
|
||||
# ./configure --prefix=$OPENALDIR used in building OpenAL.
|
||||
#
|
||||
# Created by Eric Wing. This was influenced by the FindSDL.cmake
|
||||
# module.
|
||||
|
||||
#=============================================================================
|
||||
# Copyright 2005-2009 Kitware, Inc.
|
||||
#
|
||||
# Distributed under the OSI-approved BSD License (the "License");
|
||||
# see accompanying file Copyright.txt for details.
|
||||
#
|
||||
# This software is distributed WITHOUT ANY WARRANTY; without even the
|
||||
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
# See the License for more information.
|
||||
#=============================================================================
|
||||
# (To distribute this file outside of CMake, substitute the full
|
||||
# License text for the above reference.)
|
||||
|
||||
# This makes the presumption that you are include al.h like
|
||||
# #include "al.h"
|
||||
# and not
|
||||
# #include <AL/al.h>
|
||||
# The reason for this is that the latter is not entirely portable.
|
||||
# Windows/Creative Labs does not by default put their headers in AL/ and
|
||||
# OS X uses the convention <OpenAL/al.h>.
|
||||
#
|
||||
# For Windows, Creative Labs seems to have added a registry key for their
|
||||
# OpenAL 1.1 installer. I have added that key to the list of search paths,
|
||||
# however, the key looks like it could be a little fragile depending on
|
||||
# if they decide to change the 1.00.0000 number for bug fix releases.
|
||||
# Also, they seem to have laid down groundwork for multiple library platforms
|
||||
# which puts the library in an extra subdirectory. Currently there is only
|
||||
# Win32 and I have hardcoded that here. This may need to be adjusted as
|
||||
# platforms are introduced.
|
||||
# The OpenAL 1.0 installer doesn't seem to have a useful key I can use.
|
||||
# I do not know if the Nvidia OpenAL SDK has a registry key.
|
||||
#
|
||||
# For OS X, remember that OpenAL was added by Apple in 10.4 (Tiger).
|
||||
# To support the framework, I originally wrote special framework detection
|
||||
# code in this module which I have now removed with CMake's introduction
|
||||
# of native support for frameworks.
|
||||
# In addition, OpenAL is open source, and it is possible to compile on Panther.
|
||||
# Furthermore, due to bugs in the initial OpenAL release, and the
|
||||
# transition to OpenAL 1.1, it is common to need to override the built-in
|
||||
# framework.
|
||||
# Per my request, CMake should search for frameworks first in
|
||||
# the following order:
|
||||
# ~/Library/Frameworks/OpenAL.framework/Headers
|
||||
# /Library/Frameworks/OpenAL.framework/Headers
|
||||
# /System/Library/Frameworks/OpenAL.framework/Headers
|
||||
#
|
||||
# On OS X, this will prefer the Framework version (if found) over others.
|
||||
# People will have to manually change the cache values of
|
||||
# OPENAL_LIBRARY to override this selection or set the CMake environment
|
||||
# CMAKE_INCLUDE_PATH to modify the search paths.
|
||||
|
||||
find_path(OPENAL_INCLUDE_DIR al.h
|
||||
HINTS
|
||||
ENV OPENALDIR
|
||||
PATH_SUFFIXES AL OpenAL
|
||||
PATHS
|
||||
~/Library/Frameworks
|
||||
/Library/Frameworks
|
||||
/sw # Fink
|
||||
/opt/local # DarwinPorts
|
||||
/opt/csw # Blastwave
|
||||
/opt
|
||||
[HKEY_LOCAL_MACHINE\\SOFTWARE\\Creative\ Labs\\OpenAL\ 1.1\ Software\ Development\ Kit\\1.00.0000;InstallDir]
|
||||
)
|
||||
|
||||
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||
set(_OpenAL_ARCH_DIR libs/Win64)
|
||||
else()
|
||||
set(_OpenAL_ARCH_DIR libs/Win32)
|
||||
endif()
|
||||
|
||||
find_library(OPENAL_LIBRARY
|
||||
NAMES OpenAL al openal OpenAL32
|
||||
HINTS
|
||||
ENV OPENALDIR
|
||||
PATH_SUFFIXES lib64 lib libs64 libs ${_OpenAL_ARCH_DIR}
|
||||
PATHS
|
||||
~/Library/Frameworks
|
||||
/Library/Frameworks
|
||||
/sw
|
||||
/opt/local
|
||||
/opt/csw
|
||||
/opt
|
||||
[HKEY_LOCAL_MACHINE\\SOFTWARE\\Creative\ Labs\\OpenAL\ 1.1\ Software\ Development\ Kit\\1.00.0000;InstallDir]
|
||||
)
|
||||
|
||||
unset(_OpenAL_ARCH_DIR)
|
||||
|
||||
# handle the QUIETLY and REQUIRED arguments and set OPENAL_FOUND to TRUE if
|
||||
# all listed variables are TRUE
|
||||
include(FindPackageHandleStandardArgs)
|
||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(OpenAL DEFAULT_MSG OPENAL_LIBRARY OPENAL_INCLUDE_DIR)
|
||||
|
||||
mark_as_advanced(OPENAL_LIBRARY OPENAL_INCLUDE_DIR)
|
@@ -1,365 +0,0 @@
|
||||
# This script locates the SFML library
|
||||
# ------------------------------------
|
||||
#
|
||||
# Usage
|
||||
# -----
|
||||
#
|
||||
# When you try to locate the SFML libraries, you must specify which modules you want to use (system, window, graphics, network, audio, main).
|
||||
# If none is given, the SFML_LIBRARIES variable will be empty and you'll end up linking to nothing.
|
||||
# example:
|
||||
# find_package(SFML COMPONENTS graphics window system) # find the graphics, window and system modules
|
||||
#
|
||||
# You can enforce a specific version, either MAJOR.MINOR or only MAJOR.
|
||||
# If nothing is specified, the version won't be checked (i.e. any version will be accepted).
|
||||
# example:
|
||||
# find_package(SFML COMPONENTS ...) # no specific version required
|
||||
# find_package(SFML 2 COMPONENTS ...) # any 2.x version
|
||||
# find_package(SFML 2.4 COMPONENTS ...) # version 2.4 or greater
|
||||
#
|
||||
# By default, the dynamic libraries of SFML will be found. To find the static ones instead,
|
||||
# you must set the SFML_STATIC_LIBRARIES variable to TRUE before calling find_package(SFML ...).
|
||||
# Since you have to link yourself all the SFML dependencies when you link it statically, the following
|
||||
# additional variables are defined: SFML_XXX_DEPENDENCIES and SFML_DEPENDENCIES (see their detailed
|
||||
# description below).
|
||||
# In case of static linking, the SFML_STATIC macro will also be defined by this script.
|
||||
# example:
|
||||
# set(SFML_STATIC_LIBRARIES TRUE)
|
||||
# find_package(SFML 2 COMPONENTS network system)
|
||||
#
|
||||
# On Mac OS X if SFML_STATIC_LIBRARIES is not set to TRUE then by default CMake will search for frameworks unless
|
||||
# CMAKE_FIND_FRAMEWORK is set to "NEVER" for example. Please refer to CMake documentation for more details.
|
||||
# Moreover, keep in mind that SFML frameworks are only available as release libraries unlike dylibs which
|
||||
# are available for both release and debug modes.
|
||||
#
|
||||
# If SFML is not installed in a standard path, you can use the SFML_ROOT CMake (or environment) variable
|
||||
# to tell CMake where SFML is.
|
||||
#
|
||||
# Output
|
||||
# ------
|
||||
#
|
||||
# This script defines the following variables:
|
||||
# - For each specified module XXX (system, window, graphics, network, audio, main):
|
||||
# - SFML_XXX_LIBRARY_DEBUG: the name of the debug library of the xxx module (set to SFML_XXX_LIBRARY_RELEASE is no debug version is found)
|
||||
# - SFML_XXX_LIBRARY_RELEASE: the name of the release library of the xxx module (set to SFML_XXX_LIBRARY_DEBUG is no release version is found)
|
||||
# - SFML_XXX_LIBRARY: the name of the library to link to for the xxx module (includes both debug and optimized names if necessary)
|
||||
# - SFML_XXX_FOUND: true if either the debug or release library of the xxx module is found
|
||||
# - SFML_XXX_DEPENDENCIES: the list of libraries the module depends on, in case of static linking
|
||||
# - SFML_LIBRARIES: the list of all libraries corresponding to the required modules
|
||||
# - SFML_FOUND: true if all the required modules are found
|
||||
# - SFML_INCLUDE_DIR: the path where SFML headers are located (the directory containing the SFML/Config.hpp file)
|
||||
# - SFML_DEPENDENCIES: the list of libraries SFML depends on, in case of static linking
|
||||
#
|
||||
# example:
|
||||
# find_package(SFML 2 COMPONENTS system window graphics audio REQUIRED)
|
||||
# include_directories(${SFML_INCLUDE_DIR})
|
||||
# add_executable(myapp ...)
|
||||
# target_link_libraries(myapp ${SFML_LIBRARIES})
|
||||
|
||||
# define the SFML_STATIC macro if static build was chosen
|
||||
if(SFML_STATIC_LIBRARIES)
|
||||
add_compile_definitions(SFML_STATIC)
|
||||
endif()
|
||||
|
||||
# define the list of search paths for headers and libraries
|
||||
set(FIND_SFML_PATHS
|
||||
${SFML_ROOT}
|
||||
$ENV{SFML_ROOT}
|
||||
~/Library/Frameworks
|
||||
/Library/Frameworks
|
||||
/usr/local
|
||||
/usr
|
||||
/sw
|
||||
/opt/local
|
||||
/opt/csw
|
||||
/opt)
|
||||
|
||||
# find the SFML include directory
|
||||
find_path(SFML_INCLUDE_DIR SFML/Config.hpp
|
||||
PATH_SUFFIXES include
|
||||
PATHS ${FIND_SFML_PATHS})
|
||||
|
||||
# check the version number
|
||||
set(SFML_VERSION_OK TRUE)
|
||||
if(SFML_FIND_VERSION AND SFML_INCLUDE_DIR)
|
||||
# extract the major and minor version numbers from SFML/Config.hpp
|
||||
# we have to handle framework a little bit differently:
|
||||
if("${SFML_INCLUDE_DIR}" MATCHES "SFML.framework")
|
||||
set(SFML_CONFIG_HPP_INPUT "${SFML_INCLUDE_DIR}/Headers/Config.hpp")
|
||||
else()
|
||||
set(SFML_CONFIG_HPP_INPUT "${SFML_INCLUDE_DIR}/SFML/Config.hpp")
|
||||
endif()
|
||||
FILE(READ "${SFML_CONFIG_HPP_INPUT}" SFML_CONFIG_HPP_CONTENTS)
|
||||
STRING(REGEX REPLACE ".*#define *SFML_VERSION_MAJOR *([0-9]+).*" "\\1" SFML_VERSION_MAJOR "${SFML_CONFIG_HPP_CONTENTS}")
|
||||
STRING(REGEX REPLACE ".*#define *SFML_VERSION_MINOR *([0-9]+).*" "\\1" SFML_VERSION_MINOR "${SFML_CONFIG_HPP_CONTENTS}")
|
||||
STRING(REGEX REPLACE ".*#define *SFML_VERSION_PATCH *([0-9]+).*" "\\1" SFML_VERSION_PATCH "${SFML_CONFIG_HPP_CONTENTS}")
|
||||
if (NOT "${SFML_VERSION_PATCH}" MATCHES "^[0-9]+$")
|
||||
set(SFML_VERSION_PATCH 0)
|
||||
endif()
|
||||
math(EXPR SFML_REQUESTED_VERSION "${SFML_FIND_VERSION_MAJOR} * 10000 + ${SFML_FIND_VERSION_MINOR} * 100 + ${SFML_FIND_VERSION_PATCH}")
|
||||
|
||||
# if we could extract them, compare with the requested version number
|
||||
if (SFML_VERSION_MAJOR)
|
||||
# transform version numbers to an integer
|
||||
math(EXPR SFML_VERSION "${SFML_VERSION_MAJOR} * 10000 + ${SFML_VERSION_MINOR} * 100 + ${SFML_VERSION_PATCH}")
|
||||
|
||||
# compare them
|
||||
if(SFML_VERSION LESS SFML_REQUESTED_VERSION)
|
||||
set(SFML_VERSION_OK FALSE)
|
||||
endif()
|
||||
else()
|
||||
# SFML version is < 2.0
|
||||
if (SFML_REQUESTED_VERSION GREATER 10900)
|
||||
set(SFML_VERSION_OK FALSE)
|
||||
set(SFML_VERSION_MAJOR 1)
|
||||
set(SFML_VERSION_MINOR x)
|
||||
set(SFML_VERSION_PATCH x)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# find the requested modules
|
||||
set(SFML_FOUND TRUE) # will be set to false if one of the required modules is not found
|
||||
foreach(FIND_SFML_COMPONENT ${SFML_FIND_COMPONENTS})
|
||||
string(TOLOWER ${FIND_SFML_COMPONENT} FIND_SFML_COMPONENT_LOWER)
|
||||
string(TOUPPER ${FIND_SFML_COMPONENT} FIND_SFML_COMPONENT_UPPER)
|
||||
set(FIND_SFML_COMPONENT_NAME sfml-${FIND_SFML_COMPONENT_LOWER})
|
||||
|
||||
# no suffix for sfml-main, it is always a static library
|
||||
if(FIND_SFML_COMPONENT_LOWER STREQUAL "main")
|
||||
# release library
|
||||
find_library(SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_RELEASE
|
||||
NAMES ${FIND_SFML_COMPONENT_NAME}
|
||||
PATH_SUFFIXES lib64 lib
|
||||
PATHS ${FIND_SFML_PATHS})
|
||||
|
||||
# debug library
|
||||
find_library(SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_DEBUG
|
||||
NAMES ${FIND_SFML_COMPONENT_NAME}-d
|
||||
PATH_SUFFIXES lib64 lib
|
||||
PATHS ${FIND_SFML_PATHS})
|
||||
else()
|
||||
# static release library
|
||||
find_library(SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_STATIC_RELEASE
|
||||
NAMES ${FIND_SFML_COMPONENT_NAME}-s
|
||||
PATH_SUFFIXES lib64 lib
|
||||
PATHS ${FIND_SFML_PATHS})
|
||||
|
||||
# static debug library
|
||||
find_library(SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_STATIC_DEBUG
|
||||
NAMES ${FIND_SFML_COMPONENT_NAME}-s-d
|
||||
PATH_SUFFIXES lib64 lib
|
||||
PATHS ${FIND_SFML_PATHS})
|
||||
|
||||
# dynamic release library
|
||||
find_library(SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_DYNAMIC_RELEASE
|
||||
NAMES ${FIND_SFML_COMPONENT_NAME}
|
||||
PATH_SUFFIXES lib64 lib
|
||||
PATHS ${FIND_SFML_PATHS})
|
||||
|
||||
# dynamic debug library
|
||||
find_library(SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_DYNAMIC_DEBUG
|
||||
NAMES ${FIND_SFML_COMPONENT_NAME}-d
|
||||
PATH_SUFFIXES lib64 lib
|
||||
PATHS ${FIND_SFML_PATHS})
|
||||
|
||||
# choose the entries that fit the requested link type
|
||||
if(SFML_STATIC_LIBRARIES)
|
||||
if(SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_STATIC_RELEASE)
|
||||
set(SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_RELEASE ${SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_STATIC_RELEASE})
|
||||
endif()
|
||||
if(SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_STATIC_DEBUG)
|
||||
set(SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_DEBUG ${SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_STATIC_DEBUG})
|
||||
endif()
|
||||
else()
|
||||
if(SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_DYNAMIC_RELEASE)
|
||||
set(SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_RELEASE ${SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_DYNAMIC_RELEASE})
|
||||
endif()
|
||||
if(SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_DYNAMIC_DEBUG)
|
||||
set(SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_DEBUG ${SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_DYNAMIC_DEBUG})
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if (SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_DEBUG OR SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_RELEASE)
|
||||
# library found
|
||||
set(SFML_${FIND_SFML_COMPONENT_UPPER}_FOUND TRUE)
|
||||
|
||||
# if both are found, set SFML_XXX_LIBRARY to contain both
|
||||
if (SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_DEBUG AND SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_RELEASE)
|
||||
set(SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY debug ${SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_DEBUG}
|
||||
optimized ${SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_RELEASE})
|
||||
endif()
|
||||
|
||||
# if only one debug/release variant is found, set the other to be equal to the found one
|
||||
if (SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_DEBUG AND NOT SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_RELEASE)
|
||||
# debug and not release
|
||||
set(SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_RELEASE ${SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_DEBUG})
|
||||
set(SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY ${SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_DEBUG})
|
||||
endif()
|
||||
if (SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_RELEASE AND NOT SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_DEBUG)
|
||||
# release and not debug
|
||||
set(SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_DEBUG ${SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_RELEASE})
|
||||
set(SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY ${SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_RELEASE})
|
||||
endif()
|
||||
else()
|
||||
# library not found
|
||||
set(SFML_FOUND FALSE)
|
||||
set(SFML_${FIND_SFML_COMPONENT_UPPER}_FOUND FALSE)
|
||||
set(SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY "")
|
||||
set(FIND_SFML_MISSING "${FIND_SFML_MISSING} SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY")
|
||||
endif()
|
||||
|
||||
# mark as advanced
|
||||
MARK_AS_ADVANCED(SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY
|
||||
SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_RELEASE
|
||||
SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_DEBUG
|
||||
SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_STATIC_RELEASE
|
||||
SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_STATIC_DEBUG
|
||||
SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_DYNAMIC_RELEASE
|
||||
SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_DYNAMIC_DEBUG)
|
||||
|
||||
# add to the global list of libraries
|
||||
set(SFML_LIBRARIES ${SFML_LIBRARIES} "${SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY}")
|
||||
endforeach()
|
||||
|
||||
# in case of static linking, we must also define the list of all the dependencies of SFML libraries
|
||||
if(SFML_STATIC_LIBRARIES)
|
||||
|
||||
# detect the OS
|
||||
if(${CMAKE_SYSTEM_NAME} MATCHES "Windows")
|
||||
set(FIND_SFML_OS_WINDOWS 1)
|
||||
elseif(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
|
||||
set(FIND_SFML_OS_LINUX 1)
|
||||
elseif(${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD")
|
||||
set(FIND_SFML_OS_FREEBSD 1)
|
||||
elseif(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
|
||||
set(FIND_SFML_OS_MACOSX 1)
|
||||
endif()
|
||||
|
||||
# start with an empty list
|
||||
set(SFML_DEPENDENCIES)
|
||||
set(FIND_SFML_DEPENDENCIES_NOTFOUND)
|
||||
|
||||
# macro that searches for a 3rd-party library
|
||||
macro(find_sfml_dependency output friendlyname)
|
||||
# No lookup in environment variables (PATH on Windows), as they may contain wrong library versions
|
||||
find_library(${output} NAMES ${ARGN} PATHS ${FIND_SFML_PATHS} PATH_SUFFIXES lib NO_SYSTEM_ENVIRONMENT_PATH)
|
||||
if(${${output}} STREQUAL "${output}-NOTFOUND")
|
||||
unset(output)
|
||||
set(FIND_SFML_DEPENDENCIES_NOTFOUND "${FIND_SFML_DEPENDENCIES_NOTFOUND} ${friendlyname}")
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
# sfml-system
|
||||
list(FIND SFML_FIND_COMPONENTS "system" FIND_SFML_SYSTEM_COMPONENT)
|
||||
if(NOT ${FIND_SFML_SYSTEM_COMPONENT} EQUAL -1)
|
||||
|
||||
# update the list -- these are only system libraries, no need to find them
|
||||
if(FIND_SFML_OS_LINUX OR FIND_SFML_OS_FREEBSD OR FIND_SFML_OS_MACOSX)
|
||||
set(SFML_SYSTEM_DEPENDENCIES "pthread")
|
||||
endif()
|
||||
if(FIND_SFML_OS_LINUX)
|
||||
set(SFML_SYSTEM_DEPENDENCIES ${SFML_SYSTEM_DEPENDENCIES} "rt")
|
||||
endif()
|
||||
if(FIND_SFML_OS_WINDOWS)
|
||||
set(SFML_SYSTEM_DEPENDENCIES "winmm")
|
||||
endif()
|
||||
set(SFML_DEPENDENCIES ${SFML_SYSTEM_DEPENDENCIES} ${SFML_DEPENDENCIES})
|
||||
endif()
|
||||
|
||||
# sfml-network
|
||||
list(FIND SFML_FIND_COMPONENTS "network" FIND_SFML_NETWORK_COMPONENT)
|
||||
if(NOT ${FIND_SFML_NETWORK_COMPONENT} EQUAL -1)
|
||||
|
||||
# update the list -- these are only system libraries, no need to find them
|
||||
if(FIND_SFML_OS_WINDOWS)
|
||||
set(SFML_NETWORK_DEPENDENCIES "ws2_32")
|
||||
endif()
|
||||
set(SFML_DEPENDENCIES ${SFML_NETWORK_DEPENDENCIES} ${SFML_DEPENDENCIES})
|
||||
endif()
|
||||
|
||||
# sfml-window
|
||||
list(FIND SFML_FIND_COMPONENTS "window" FIND_SFML_WINDOW_COMPONENT)
|
||||
if(NOT ${FIND_SFML_WINDOW_COMPONENT} EQUAL -1)
|
||||
|
||||
# find libraries
|
||||
if(FIND_SFML_OS_LINUX OR FIND_SFML_OS_FREEBSD)
|
||||
find_sfml_dependency(X11_LIBRARY "X11" X11)
|
||||
find_sfml_dependency(XRANDR_LIBRARY "Xrandr" Xrandr)
|
||||
endif()
|
||||
|
||||
if(FIND_SFML_OS_LINUX)
|
||||
find_sfml_dependency(UDEV_LIBRARIES "UDev" udev libudev)
|
||||
endif()
|
||||
|
||||
# update the list
|
||||
if(FIND_SFML_OS_WINDOWS)
|
||||
set(SFML_WINDOW_DEPENDENCIES ${SFML_WINDOW_DEPENDENCIES} "opengl32" "winmm" "gdi32")
|
||||
elseif(FIND_SFML_OS_LINUX)
|
||||
set(SFML_WINDOW_DEPENDENCIES ${SFML_WINDOW_DEPENDENCIES} "GL" ${X11_LIBRARY} ${XRANDR_LIBRARY} ${UDEV_LIBRARIES})
|
||||
elseif(FIND_SFML_OS_FREEBSD)
|
||||
set(SFML_WINDOW_DEPENDENCIES ${SFML_WINDOW_DEPENDENCIES} "GL" ${X11_LIBRARY} ${XRANDR_LIBRARY} "usbhid")
|
||||
elseif(FIND_SFML_OS_MACOSX)
|
||||
set(SFML_WINDOW_DEPENDENCIES ${SFML_WINDOW_DEPENDENCIES} "-framework OpenGL -framework Foundation -framework AppKit -framework IOKit -framework Carbon")
|
||||
endif()
|
||||
set(SFML_DEPENDENCIES ${SFML_WINDOW_DEPENDENCIES} ${SFML_DEPENDENCIES})
|
||||
endif()
|
||||
|
||||
# sfml-graphics
|
||||
list(FIND SFML_FIND_COMPONENTS "graphics" FIND_SFML_GRAPHICS_COMPONENT)
|
||||
if(NOT ${FIND_SFML_GRAPHICS_COMPONENT} EQUAL -1)
|
||||
|
||||
# find libraries
|
||||
find_sfml_dependency(FREETYPE_LIBRARY "FreeType" freetype)
|
||||
find_sfml_dependency(JPEG_LIBRARY "libjpeg" jpeg)
|
||||
|
||||
# update the list
|
||||
set(SFML_GRAPHICS_DEPENDENCIES ${FREETYPE_LIBRARY} ${JPEG_LIBRARY})
|
||||
set(SFML_DEPENDENCIES ${SFML_GRAPHICS_DEPENDENCIES} ${SFML_DEPENDENCIES})
|
||||
endif()
|
||||
|
||||
# sfml-audio
|
||||
list(FIND SFML_FIND_COMPONENTS "audio" FIND_SFML_AUDIO_COMPONENT)
|
||||
if(NOT ${FIND_SFML_AUDIO_COMPONENT} EQUAL -1)
|
||||
|
||||
# find libraries
|
||||
find_sfml_dependency(OPENAL_LIBRARY "OpenAL" openal openal32)
|
||||
find_sfml_dependency(OGG_LIBRARY "Ogg" ogg)
|
||||
find_sfml_dependency(VORBIS_LIBRARY "Vorbis" vorbis)
|
||||
find_sfml_dependency(VORBISFILE_LIBRARY "VorbisFile" vorbisfile)
|
||||
find_sfml_dependency(VORBISENC_LIBRARY "VorbisEnc" vorbisenc)
|
||||
find_sfml_dependency(FLAC_LIBRARY "FLAC" FLAC)
|
||||
|
||||
# update the list
|
||||
set(SFML_AUDIO_DEPENDENCIES ${OPENAL_LIBRARY} ${FLAC_LIBRARY} ${VORBISENC_LIBRARY} ${VORBISFILE_LIBRARY} ${VORBIS_LIBRARY} ${OGG_LIBRARY})
|
||||
set(SFML_DEPENDENCIES ${SFML_DEPENDENCIES} ${SFML_AUDIO_DEPENDENCIES})
|
||||
endif()
|
||||
|
||||
endif()
|
||||
|
||||
# handle errors
|
||||
if(NOT SFML_VERSION_OK)
|
||||
# SFML version not ok
|
||||
set(FIND_SFML_ERROR "SFML found but version too low (requested: ${SFML_FIND_VERSION}, found: ${SFML_VERSION_MAJOR}.${SFML_VERSION_MINOR}.${SFML_VERSION_PATCH})")
|
||||
set(SFML_FOUND FALSE)
|
||||
elseif(SFML_STATIC_LIBRARIES AND FIND_SFML_DEPENDENCIES_NOTFOUND)
|
||||
set(FIND_SFML_ERROR "SFML found but some of its dependencies are missing (${FIND_SFML_DEPENDENCIES_NOTFOUND})")
|
||||
set(SFML_FOUND FALSE)
|
||||
elseif(NOT SFML_FOUND)
|
||||
# include directory or library not found
|
||||
set(FIND_SFML_ERROR "Could NOT find SFML (missing: ${FIND_SFML_MISSING})")
|
||||
endif()
|
||||
if (NOT SFML_FOUND)
|
||||
if(SFML_FIND_REQUIRED)
|
||||
# fatal error
|
||||
message(FATAL_ERROR ${FIND_SFML_ERROR})
|
||||
elseif(NOT SFML_FIND_QUIETLY)
|
||||
# error but continue
|
||||
message("${FIND_SFML_ERROR}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# handle success
|
||||
if(SFML_FOUND AND NOT SFML_FIND_QUIETLY)
|
||||
message(STATUS "Found SFML ${SFML_VERSION_MAJOR}.${SFML_VERSION_MINOR}.${SFML_VERSION_PATCH} in ${SFML_INCLUDE_DIR}")
|
||||
endif()
|
@@ -11,8 +11,8 @@
|
||||
# In addition, the following commands are called with the package manager's
|
||||
# paths:
|
||||
#
|
||||
# INCLUDE_DIRECTORIES()
|
||||
# LINK_DIRECTORIES()
|
||||
# include_directories()
|
||||
# link_directories()
|
||||
#
|
||||
# The paths of package managers not currently in $ENV{PATH} are added to
|
||||
# CMAKE_IGNORE_PATH .
|
||||
@@ -41,68 +41,75 @@
|
||||
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
IF(NOT APPLE)
|
||||
RETURN()
|
||||
ENDIF()
|
||||
if(NOT APPLE)
|
||||
return()
|
||||
endif()
|
||||
|
||||
IF(EXISTS /usr/local/bin/brew AND $ENV{PATH} MATCHES "(^|:)/usr/local/bin/?(:|$)")
|
||||
MESSAGE("-- Configuring for Mac Homebrew")
|
||||
if(NOT "$ENV{IN_NIX_SHELL}" STREQUAL "")
|
||||
message(STATUS "Configuring for Nix")
|
||||
|
||||
SET(MAC_HOMEBREW ON)
|
||||
set(NIX ON)
|
||||
|
||||
SET(CMAKE_IGNORE_PATH /opt/local /opt/local/bin /opt/local/include /opt/local/Library/Frameworks /opt/local/lib ${CMAKE_IGNORE_PATH})
|
||||
SET(CMAKE_IGNORE_PATH /sw /sw/bin /sw/include /sw/Library/Frameworks /sw/lib ${CMAKE_IGNORE_PATH})
|
||||
set(CMAKE_IGNORE_PATH /opt/local /opt/local/bin /opt/local/include /opt/local/Library/Frameworks /opt/local/lib ${CMAKE_IGNORE_PATH})
|
||||
set(CMAKE_IGNORE_PATH /sw /sw/bin /sw/include /sw/Library/Frameworks /sw/lib ${CMAKE_IGNORE_PATH})
|
||||
elseif(EXISTS /usr/local/bin/brew AND $ENV{PATH} MATCHES "(^|:)/usr/local/bin/?(:|$)")
|
||||
message(STATUS "Configuring for Mac Homebrew")
|
||||
|
||||
SET(CMAKE_FRAMEWORK_PATH /usr/local/Frameworks ${CMAKE_FRAMEWORK_PATH})
|
||||
set(MAC_HOMEBREW ON)
|
||||
|
||||
SET(CMAKE_INCLUDE_PATH /usr/local/include ${CMAKE_INCLUDE_PATH})
|
||||
INCLUDE_DIRECTORIES("/usr/local/include")
|
||||
set(CMAKE_IGNORE_PATH /opt/local /opt/local/bin /opt/local/include /opt/local/Library/Frameworks /opt/local/lib ${CMAKE_IGNORE_PATH})
|
||||
set(CMAKE_IGNORE_PATH /sw /sw/bin /sw/include /sw/Library/Frameworks /sw/lib ${CMAKE_IGNORE_PATH})
|
||||
|
||||
SET(CMAKE_LIBRARY_PATH /usr/local/lib ${CMAKE_LIBRARY_PATH})
|
||||
LINK_DIRECTORIES("/usr/local/lib")
|
||||
set(CMAKE_FRAMEWORK_PATH /usr/local/Frameworks ${CMAKE_FRAMEWORK_PATH})
|
||||
|
||||
SET(CMAKE_PROGRAM_PATH /usr/local/bin ${CMAKE_PROGRAM_PATH})
|
||||
set(CMAKE_INCLUDE_PATH /usr/local/include ${CMAKE_INCLUDE_PATH})
|
||||
include_directories("/usr/local/include")
|
||||
|
||||
set(CMAKE_LIBRARY_PATH /usr/local/lib ${CMAKE_LIBRARY_PATH})
|
||||
link_directories("/usr/local/lib")
|
||||
|
||||
set(CMAKE_PROGRAM_PATH /usr/local/bin ${CMAKE_PROGRAM_PATH})
|
||||
|
||||
set(ZLIB_ROOT /usr/local/opt/zlib)
|
||||
ELSEIF(EXISTS /opt/local/bin/port AND $ENV{PATH} MATCHES "(^|:)/opt/local/bin/?(:|$)")
|
||||
MESSAGE("-- Configuring for MacPorts")
|
||||
elseif(EXISTS /opt/local/bin/port AND $ENV{PATH} MATCHES "(^|:)/opt/local/bin/?(:|$)")
|
||||
message(STATUS "Configuring for MacPorts")
|
||||
|
||||
SET(MACPORTS ON)
|
||||
set(MACPORTS ON)
|
||||
|
||||
SET(CMAKE_IGNORE_PATH /sw /sw/bin /sw/include /sw/Library/Frameworks /sw/lib ${CMAKE_IGNORE_PATH})
|
||||
set(CMAKE_IGNORE_PATH /sw /sw/bin /sw/include /sw/Library/Frameworks /sw/lib ${CMAKE_IGNORE_PATH})
|
||||
|
||||
SET(CMAKE_FRAMEWORK_PATH /opt/local/Library/Frameworks ${CMAKE_FRAMEWORK_PATH})
|
||||
set(CMAKE_FRAMEWORK_PATH /opt/local/Library/Frameworks ${CMAKE_FRAMEWORK_PATH})
|
||||
|
||||
SET(CMAKE_INCLUDE_PATH /opt/local/include ${CMAKE_INCLUDE_PATH})
|
||||
INCLUDE_DIRECTORIES("/opt/local/include")
|
||||
set(CMAKE_INCLUDE_PATH /opt/local/include ${CMAKE_INCLUDE_PATH})
|
||||
include_directories("/opt/local/include")
|
||||
|
||||
SET(CMAKE_LIBRARY_PATH /opt/local/lib ${CMAKE_LIBRARY_PATH})
|
||||
LINK_DIRECTORIES("/opt/local/lib")
|
||||
set(CMAKE_LIBRARY_PATH /opt/local/lib ${CMAKE_LIBRARY_PATH})
|
||||
link_directories("/opt/local/lib")
|
||||
|
||||
SET(CMAKE_PROGRAM_PATH /opt/local/bin ${CMAKE_PROGRAM_PATH})
|
||||
ELSEIF(EXISTS /sw/bin/fink AND $ENV{PATH} MATCHES "(^|:)/sw/bin/?(:|$)")
|
||||
MESSAGE("-- Configuring for Fink")
|
||||
set(CMAKE_PROGRAM_PATH /opt/local/bin ${CMAKE_PROGRAM_PATH})
|
||||
elseif(EXISTS /sw/bin/fink AND $ENV{PATH} MATCHES "(^|:)/sw/bin/?(:|$)")
|
||||
message(STATUS "Configuring for Fink")
|
||||
|
||||
SET(FINK ON)
|
||||
set(FINK ON)
|
||||
|
||||
SET(CMAKE_IGNORE_PATH /opt/local /opt/local/bin /opt/local/include /opt/local/Library/Frameworks /opt/local/lib ${CMAKE_IGNORE_PATH})
|
||||
set(CMAKE_IGNORE_PATH /opt/local /opt/local/bin /opt/local/include /opt/local/Library/Frameworks /opt/local/lib ${CMAKE_IGNORE_PATH})
|
||||
|
||||
SET(CMAKE_FRAMEWORK_PATH /sw/Library/Frameworks ${CMAKE_FRAMEWORK_PATH})
|
||||
set(CMAKE_FRAMEWORK_PATH /sw/Library/Frameworks ${CMAKE_FRAMEWORK_PATH})
|
||||
|
||||
SET(CMAKE_INCLUDE_PATH /sw/include ${CMAKE_INCLUDE_PATH})
|
||||
INCLUDE_DIRECTORIES("/sw/include")
|
||||
set(CMAKE_INCLUDE_PATH /sw/include ${CMAKE_INCLUDE_PATH})
|
||||
include_directories("/sw/include")
|
||||
|
||||
SET(CMAKE_LIBRARY_PATH /sw/lib ${CMAKE_LIBRARY_PATH})
|
||||
LINK_DIRECTORIES("/sw/lib")
|
||||
set(CMAKE_LIBRARY_PATH /sw/lib ${CMAKE_LIBRARY_PATH})
|
||||
link_directories("/sw/lib")
|
||||
|
||||
SET(CMAKE_PROGRAM_PATH /sw/bin ${CMAKE_PROGRAM_PATH})
|
||||
ELSE()
|
||||
set(CMAKE_PROGRAM_PATH /sw/bin ${CMAKE_PROGRAM_PATH})
|
||||
else()
|
||||
# no package manager found or active, do nothing
|
||||
RETURN()
|
||||
ENDIF()
|
||||
return()
|
||||
endif()
|
||||
|
||||
# only ignore /usr/local if brew is installed and not in the PATH
|
||||
# in other cases, it is the user's personal installations
|
||||
IF(NOT MAC_HOMEBREW AND EXISTS /usr/local/bin/brew)
|
||||
SET(CMAKE_IGNORE_PATH /usr/local /usr/local/bin /usr/local/include /usr/local/Library/Frameworks /usr/local/lib ${CMAKE_IGNORE_PATH})
|
||||
ENDIF()
|
||||
if(NOT MAC_HOMEBREW AND EXISTS /usr/local/bin/brew)
|
||||
set(CMAKE_IGNORE_PATH /usr/local /usr/local/bin /usr/local/include /usr/local/Library/Frameworks /usr/local/lib /usr/local/opt/gettext/bin /usr/local/opt/gettext/lib ${CMAKE_IGNORE_PATH})
|
||||
endif()
|
||||
|
@@ -10,10 +10,6 @@ if(NOT EXISTS "${CMAKE_SOURCE_DIR}/.git")
|
||||
message(FATAL_ERROR "releases can only be done from a git clone")
|
||||
endif()
|
||||
|
||||
if(NOT GIT_FOUND)
|
||||
message(FATAL_ERROR "git is required to make a release")
|
||||
endif()
|
||||
|
||||
find_program(GPG_EXECUTABLE gpg)
|
||||
|
||||
if(NOT GPG_EXECUTABLE)
|
||||
@@ -35,7 +31,7 @@ function(make_release_commit_and_tag)
|
||||
# First make sure we are on master.
|
||||
|
||||
execute_process(
|
||||
COMMAND ${GIT_EXECUTABLE} rev-parse --short --abbrev-ref=strict HEAD
|
||||
COMMAND git rev-parse --short --abbrev-ref=strict HEAD
|
||||
OUTPUT_VARIABLE git_branch
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
||||
@@ -46,7 +42,7 @@ function(make_release_commit_and_tag)
|
||||
endif()
|
||||
|
||||
execute_process(
|
||||
COMMAND ${GIT_EXECUTABLE} status --porcelain=2
|
||||
COMMAND git status --porcelain=2
|
||||
OUTPUT_VARIABLE git_status
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
||||
@@ -59,7 +55,7 @@ function(make_release_commit_and_tag)
|
||||
endif()
|
||||
|
||||
execute_process(
|
||||
COMMAND ${GIT_EXECUTABLE} tag --sort=-v:refname
|
||||
COMMAND git tag --sort=-v:refname
|
||||
OUTPUT_VARIABLE git_tags
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
||||
@@ -80,7 +76,7 @@ function(make_release_commit_and_tag)
|
||||
endif()
|
||||
|
||||
execute_process(
|
||||
COMMAND ${GIT_EXECUTABLE} log ${git_last_tag}.. "--pretty=format:* %h - %s [%aL]"
|
||||
COMMAND git log ${git_last_tag}.. "--pretty=format:* %h - %s [%aL]"
|
||||
OUTPUT_VARIABLE release_log
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
||||
@@ -90,17 +86,17 @@ function(make_release_commit_and_tag)
|
||||
|
||||
if(TAG_RELEASE STREQUAL UNDO)
|
||||
execute_process(
|
||||
COMMAND ${GIT_EXECUTABLE} tag -d ${git_last_tag}
|
||||
COMMAND git tag -d ${git_last_tag}
|
||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
||||
)
|
||||
|
||||
execute_process(
|
||||
COMMAND ${GIT_EXECUTABLE} reset HEAD~1
|
||||
COMMAND git reset HEAD~1
|
||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
||||
)
|
||||
|
||||
execute_process(
|
||||
COMMAND ${GIT_EXECUTABLE} checkout HEAD CHANGELOG.md
|
||||
COMMAND git checkout HEAD CHANGELOG.md
|
||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
||||
)
|
||||
|
||||
@@ -212,45 +208,37 @@ Ignore the following cmake error.
|
||||
)
|
||||
|
||||
execute_process(
|
||||
COMMAND ${GIT_EXECUTABLE} add CHANGELOG.md
|
||||
COMMAND git add CHANGELOG.md
|
||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
||||
)
|
||||
|
||||
# Make the release commit.
|
||||
message(FATAL_ERROR "
|
||||
|
||||
execute_process(
|
||||
COMMAND ${GIT_EXECUTABLE} commit -m "release ${new_tag}" --signoff -S
|
||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
||||
)
|
||||
Release prepared.
|
||||
|
||||
# Make release tag.
|
||||
Edit CHANGELOG.md to remove any non-user-facing commits, and optionally add any
|
||||
release notes.
|
||||
|
||||
execute_process(
|
||||
COMMAND ${GIT_EXECUTABLE} tag -s -m${new_tag} ${new_tag}
|
||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
||||
)
|
||||
Run the following commands to commit the change:
|
||||
|
||||
message(FATAL_ERROR [=[
|
||||
|
||||
Release commit and tag generated.
|
||||
|
||||
**** IF YOU ARE SURE YOU WANT TO RELEASE ****
|
||||
|
||||
Run the following commands to push the release commit and tag:
|
||||
|
||||
git push
|
||||
git push --tags
|
||||
|
||||
**** TO UNDO THE RELEASE ****
|
||||
git commit -a -m'release ${new_tag}' --signoff -S
|
||||
git tag -s -m'${new_tag}' ${new_tag}
|
||||
|
||||
To rollback these changes, run this command:
|
||||
|
||||
cmake .. -DTAG_RELEASE=UNDO
|
||||
|
||||
Ignore the "configuration incomplete" message following, this mode does not
|
||||
==== IF YOU ARE SURE YOU WANT TO RELEASE, THIS **CANNOT** BE REVERSED ====
|
||||
|
||||
Run the following to push the release commit and tag:
|
||||
|
||||
git push
|
||||
git push --tags
|
||||
|
||||
Ignore the 'configuration incomplete' message following, this mode does not
|
||||
build anything.
|
||||
|
||||
]=])
|
||||
")
|
||||
endfunction()
|
||||
|
||||
make_release_commit_and_tag()
|
||||
|
53
cmake/MetalShaderSupport.cmake
Normal file
53
cmake/MetalShaderSupport.cmake
Normal file
@@ -0,0 +1,53 @@
|
||||
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
||||
# file LICENCE.txt or https://cmake.org/licensing for details.
|
||||
|
||||
function(add_metal_shader_library TARGET)
|
||||
cmake_parse_arguments(PARSE_ARGV 1 _amsl
|
||||
""
|
||||
"STANDARD"
|
||||
""
|
||||
)
|
||||
|
||||
add_library(${TARGET} MODULE ${_amsl_UNPARSED_ARGUMENTS})
|
||||
|
||||
set_target_properties(${TARGET} PROPERTIES
|
||||
DEBUG_POSTFIX ""
|
||||
XCODE_PRODUCT_TYPE com.apple.product-type.metal-library
|
||||
XCODE_ATTRIBUTE_MTL_FAST_MATH "YES"
|
||||
XCODE_ATTRIBUTE_MTL_ENABLE_DEBUG_INFO[variant=Debug] "INCLUDE_SOURCE"
|
||||
XCODE_ATTRIBUTE_MTL_ENABLE_DEBUG_INFO[variant=RelWithDebInfo] "INCLUDE_SOURCE"
|
||||
XCODE_ATTRIBUTE_MTL_HEADER_SEARCH_PATHS "$(HEADER_SEARCH_PATHS)"
|
||||
)
|
||||
|
||||
if(_amsl_STANDARD AND _amsl_STANDARD MATCHES "metal([0-9]+)\.([0-9]+)")
|
||||
target_compile_options(${TARGET}
|
||||
PRIVATE "-std=${_amsl_STANDARD}"
|
||||
)
|
||||
|
||||
set_target_properties(${TARGET} PROPERTIES
|
||||
XCODE_ATTRIBUTE_MTL_LANGUAGE_REVISION "Metal${CMAKE_MATCH_1}${CMAKE_MATCH_2}"
|
||||
)
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
function(target_embed_metal_shader_libraries TARGET)
|
||||
cmake_parse_arguments(PARSE_ARGV 1 _temsl
|
||||
""
|
||||
""
|
||||
""
|
||||
)
|
||||
|
||||
if(${CMAKE_VERSION} VERSION_GREATER_EQUAL 3.28 AND ${CMAKE_GENERATOR} STREQUAL "Xcode")
|
||||
set_target_properties(${TARGET} PROPERTIES
|
||||
XCODE_EMBED_RESOURCES "${_temsl_UNPARSED_ARGUMENTS}"
|
||||
)
|
||||
else()
|
||||
foreach(SHADERLIB IN LISTS _temsl_UNPARSED_ARGUMENTS)
|
||||
add_dependencies(${TARGET} ${SHADERLIB})
|
||||
add_custom_command(TARGET ${TARGET} POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E copy "$<TARGET_FILE:${SHADERLIB}>" "$<TARGET_BUNDLE_CONTENT_DIR:${TARGET}>/Resources/$<TARGET_FILE_NAME:${SHADERLIB}>"
|
||||
VERBATIM
|
||||
)
|
||||
endforeach()
|
||||
endif()
|
||||
endfunction()
|
@@ -8,16 +8,17 @@ else()
|
||||
set(BUILD_DEFAULT ON)
|
||||
endif()
|
||||
|
||||
option(ENABLE_SDL "Build the SDL port" ${BUILD_DEFAULT})
|
||||
option(ENABLE_WX "Build the wxWidgets port" ${BUILD_DEFAULT})
|
||||
option(ENABLE_DEBUGGER "Enable the debugger" ON)
|
||||
option(ENABLE_ASAN "Enable -fsanitize=address by default. Requires debug build with GCC/Clang" OFF)
|
||||
set(ENABLE_SDL_DEFAULT ${BUILD_DEFAULT})
|
||||
|
||||
if(WIN32 OR APPLE)
|
||||
set(ENABLE_SDL_DEFAULT OFF)
|
||||
endif()
|
||||
|
||||
# Static linking
|
||||
set(VBAM_STATIC_DEFAULT OFF)
|
||||
if(VCPKG_TARGET_TRIPLET MATCHES -static OR CMAKE_TOOLCHAIN_FILE MATCHES "mxe|-static")
|
||||
set(VBAM_STATIC_DEFAULT ON)
|
||||
elseif(MINGW OR (NOT "$ENV{MSYSTEM_PREFIX}" STREQUAL ""))
|
||||
elseif(MINGW OR MSYS)
|
||||
# Default to static builds on MinGW and all MSYS2 envs.
|
||||
set(VBAM_STATIC_DEFAULT ON)
|
||||
endif()
|
||||
@@ -25,6 +26,7 @@ option(VBAM_STATIC "Try to link all libraries statically" ${VBAM_STATIC_DEFAULT}
|
||||
|
||||
if(VBAM_STATIC)
|
||||
set(SDL2_STATIC ON)
|
||||
set(SDL3_STATIC ON)
|
||||
set(SFML_STATIC_LIBRARIES ON)
|
||||
set(FFMPEG_STATIC ON)
|
||||
set(OPENAL_STATIC ON)
|
||||
@@ -38,6 +40,61 @@ if(VBAM_STATIC)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(CMAKE_TOOLCHAIN_FILE MATCHES "vcpkg")
|
||||
set(PKG_CONFIG_EXECUTABLE "$ENV{VCPKG_ROOT}/installed/x64-windows/tools/pkgconf/pkgconf.exe")
|
||||
endif()
|
||||
|
||||
find_package(PkgConfig)
|
||||
|
||||
if(UNIX AND NOT APPLE)
|
||||
pkg_check_modules(SDL3 sdl3 QUIET)
|
||||
else()
|
||||
find_package(SDL3 QUIET)
|
||||
endif()
|
||||
|
||||
option(ENABLE_SDL3 "Use SDL3" "${SDL3_FOUND}")
|
||||
|
||||
if(NOT TRANSLATIONS_ONLY)
|
||||
if(ENABLE_SDL3)
|
||||
if(NOT UNIX)
|
||||
find_package(SDL3 REQUIRED)
|
||||
endif()
|
||||
else()
|
||||
find_package(SDL2 REQUIRED)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
option(ENABLE_GENERIC_FILE_DIALOGS "Use generic file dialogs" OFF)
|
||||
option(DISABLE_OPENGL "Disable OpenGL" OFF)
|
||||
option(ENABLE_SDL "Build the SDL port" ${ENABLE_SDL_DEFAULT})
|
||||
option(ENABLE_WX "Build the wxWidgets port" ${BUILD_DEFAULT})
|
||||
option(ENABLE_DEBUGGER "Enable the debugger" ON)
|
||||
option(ENABLE_ASAN "Enable -fsanitize=address by default. Requires debug build with GCC/Clang" OFF)
|
||||
option(ENABLE_BZ2 "Enable BZ2 archive support" ON)
|
||||
option(ENABLE_LZMA "Enable LZMA archive support" ON)
|
||||
|
||||
if(ENABLE_SDL3)
|
||||
set(CMAKE_C_FLAGS "-DENABLE_SDL3 ${CMAKE_C_FLAGS}")
|
||||
set(CMAKE_CXX_FLAGS "-DENABLE_SDL3 ${CMAKE_CXX_FLAGS}")
|
||||
|
||||
include(CheckSourceCompiles)
|
||||
check_source_compiles(CXX
|
||||
"#include <SDL3/SDL.h>
|
||||
|
||||
int main() { return SDL_SCALEMODE_PIXELART; }
|
||||
" HAVE_SDL_SCALEMODE_PIXELART)
|
||||
|
||||
if(HAVE_SDL_SCALEMODE_PIXELART)
|
||||
set(CMAKE_C_FLAGS "-DHAVE_SDL3_PIXELART ${CMAKE_C_FLAGS}")
|
||||
set(CMAKE_CXX_FLAGS "-DHAVE_SDL3_PIXELART ${CMAKE_CXX_FLAGS}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(DISABLE_OPENGL)
|
||||
set(CMAKE_C_FLAGS "-DNO_OPENGL -DNO_OGL ${CMAKE_C_FLAGS}")
|
||||
set(CMAKE_CXX_FLAGS "-DNO_OPENGL -DNO_OGL ${CMAKE_CXX_FLAGS}")
|
||||
endif()
|
||||
|
||||
option(ENABLE_ASM "Enable x86 ASM related options" OFF)
|
||||
|
||||
# The ARM ASM core seems to be very buggy, see #98 and #54. Default to it being
|
||||
@@ -54,44 +111,42 @@ cmake_dependent_option(ENABLE_MMX "Enable MMX" ${MMX_DEFAULT} "ENABLE_ASM_SCALER
|
||||
|
||||
option(ENABLE_LIRC "Enable LIRC support" OFF)
|
||||
|
||||
# Link / SFML
|
||||
find_package(SFML 2.4 COMPONENTS network system)
|
||||
if(CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo")
|
||||
if(SFML_STATIC_LIBRARIES AND SFML_NETWORK_LIBRARY_STATIC_DEBUG AND SFML_SYSTEM_LIBRARY_STATIC_DEBUG)
|
||||
set(SFML_LIBRARIES ${SFML_NETWORK_LIBRARY_STATIC_DEBUG} ${SFML_SYSTEM_LIBRARY_STATIC_DEBUG})
|
||||
elseif(SFML_NETWORK_LIBRARY_DYNAMIC_DEBUG AND SFML_SYSTEM_LIBRARY_DYNAMIC_DEBUG)
|
||||
set(SFML_LIBRARIES ${SFML_NETWORK_LIBRARY_DYNAMIC_DEBUG} ${SFML_SYSTEM_LIBRARY_DYNAMIC_DEBUG})
|
||||
endif()
|
||||
# Add support for Homebrew, MacPorts and Fink on macOS
|
||||
option(DISABLE_MACOS_PACKAGE_MANAGERS "Set to TRUE to disable support for macOS Homebrew, MacPorts and Fink." FALSE)
|
||||
if(APPLE AND NOT DISABLE_MACOS_PACKAGE_MANAGERS)
|
||||
include(MacPackageManagers)
|
||||
endif()
|
||||
set(ENABLE_LINK_DEFAULT OFF)
|
||||
if(SFML_FOUND)
|
||||
|
||||
# Link / SFML
|
||||
if(NOT TRANSLATIONS_ONLY)
|
||||
set(ENABLE_LINK_DEFAULT ON)
|
||||
endif()
|
||||
option(ENABLE_LINK "Enable GBA linking functionality" ${ENABLE_LINK_DEFAULT})
|
||||
|
||||
# FFMpeg
|
||||
set(FFMPEG_DEFAULT OFF)
|
||||
set(FFMPEG_COMPONENTS AVCODEC AVFORMAT SWSCALE AVUTIL SWRESAMPLE)
|
||||
set(FFMPEG_COMPONENT_VERSIONS AVCODEC>=58.18.100 AVFORMAT>=58.12.100 SWSCALE>=5.1.100 AVUTIL>=56.14.100 SWRESAMPLE>=3.1.100)
|
||||
set(FFMPEG_COMPONENTS AVFORMAT AVCODEC SWSCALE AVUTIL SWRESAMPLE X264 X265)
|
||||
set(FFMPEG_COMPONENT_VERSIONS AVFORMAT>=58.12.100 AVCODEC>=58.18.100 SWSCALE>=5.1.100 AVUTIL>=56.14.100 SWRESAMPLE>=3.1.100 X264>=0 X265>=0)
|
||||
|
||||
if(NOT DEFINED ENABLE_FFMPEG OR ENABLE_FFMPEG)
|
||||
if(NOT TRANSLATIONS_ONLY AND (NOT DEFINED ENABLE_FFMPEG OR ENABLE_FFMPEG))
|
||||
set(FFMPEG_DEFAULT ON)
|
||||
|
||||
find_package(FFmpeg COMPONENTS ${FFMPEG_COMPONENTS})
|
||||
|
||||
# check versions, but only if pkgconfig is available
|
||||
if(FFMPEG_FOUND AND PKG_CONFIG_FOUND AND NOT CMAKE_TOOLCHAIN_FILE MATCHES vcpkg)
|
||||
if(FFmpeg_FOUND AND PKG_CONFIG_FOUND AND NOT CMAKE_TOOLCHAIN_FILE MATCHES vcpkg)
|
||||
foreach(component ${FFMPEG_COMPONENT_VERSIONS})
|
||||
string(REPLACE ">=" ";" parts ${component})
|
||||
list(GET parts 0 name)
|
||||
list(GET parts 1 version)
|
||||
|
||||
if((NOT DEFINED ${name}_VERSION) OR ${name}_VERSION VERSION_LESS ${version})
|
||||
set(FFMPEG_FOUND OFF)
|
||||
set(FFmpeg_FOUND OFF)
|
||||
endif()
|
||||
endforeach()
|
||||
endif()
|
||||
|
||||
if(NOT FFMPEG_FOUND)
|
||||
if(NOT FFmpeg_FOUND)
|
||||
set(FFMPEG_DEFAULT OFF)
|
||||
endif()
|
||||
endif()
|
||||
@@ -115,12 +170,6 @@ option(ENABLE_LTO "Compile with Link Time Optimization" ${LTO_DEFAULT})
|
||||
|
||||
option(ENABLE_GBA_LOGGING "Enable extended GBA logging" ON)
|
||||
|
||||
# Add support for Homebrew, MacPorts and Fink on macOS
|
||||
option(DISABLE_MACOS_PACKAGE_MANAGERS "Set to TRUE to disable support for macOS Homebrew, MacPorts and Fink." FALSE)
|
||||
if(APPLE AND NOT DISABLE_MACOS_PACKAGE_MANAGERS)
|
||||
include(MacPackageManagers)
|
||||
endif()
|
||||
|
||||
option(UPSTREAM_RELEASE "do some optimizations and release automation tasks" OFF)
|
||||
|
||||
if(WIN32)
|
||||
@@ -128,7 +177,7 @@ if(WIN32)
|
||||
option(ENABLE_DIRECT3D "Enable Direct3D rendering for the wxWidgets port" OFF)
|
||||
|
||||
set(XAUDIO2_DEFAULT ON)
|
||||
if (MSVC AND CMAKE_CXX_COMPILER_ID STREQUAL Clang)
|
||||
if ((MSVC AND CMAKE_CXX_COMPILER_ID STREQUAL Clang) OR (MINGW AND X86))
|
||||
# TODO: We should update the XAudio headers to build with clang-cl. See
|
||||
# https://github.com/visualboyadvance-m/visualboyadvance-m/issues/1021
|
||||
set(XAUDIO2_DEFAULT OFF)
|
||||
@@ -136,6 +185,46 @@ if(WIN32)
|
||||
option(ENABLE_XAUDIO2 "Enable xaudio2 sound output for the wxWidgets port" ${XAUDIO2_DEFAULT})
|
||||
endif()
|
||||
|
||||
option(ENABLE_FAUDIO "Enable FAudio sound output for the wxWidgets port" OFF)
|
||||
find_package(OpenAL QUIET)
|
||||
|
||||
set(OPENAL_DEFAULT ${OpenAL_FOUND})
|
||||
|
||||
if(MINGW AND X86)
|
||||
# OpenAL-Soft uses avrt.dll which is not available on Windows XP.
|
||||
set(OPENAL_DEFAULT OFF)
|
||||
endif()
|
||||
|
||||
option(ENABLE_OPENAL "Enable OpenAL-Soft sound output for the wxWidgets port" ${OPENAL_DEFAULT})
|
||||
|
||||
set(ENABLE_FAUDIO_DEFAULT OFF)
|
||||
|
||||
find_package(FAudio QUIET)
|
||||
|
||||
if(FAudio_FOUND AND NOT (MINGW AND X86))
|
||||
set(ENABLE_FAUDIO_DEFAULT ON)
|
||||
endif()
|
||||
|
||||
option(ENABLE_FAUDIO "Enable FAudio sound output for the wxWidgets port" ${ENABLE_FAUDIO_DEFAULT})
|
||||
|
||||
option(ZIP_SUFFIX [=[suffix for release zip files, e.g. "-somebranch".zip]=] OFF)
|
||||
|
||||
# The SDL port can't be built without debugging support
|
||||
if(NOT ENABLE_DEBUGGER AND ENABLE_SDL)
|
||||
message(FATAL_ERROR "The SDL port can't be built without debugging support")
|
||||
endif()
|
||||
|
||||
if(TRANSLATIONS_ONLY AND (ENABLE_SDL OR ENABLE_WX))
|
||||
message(FATAL_ERROR "The SDL and wxWidgets ports can't be built when TRANSLATIONS_ONLY is enabled")
|
||||
endif()
|
||||
|
||||
option(GPG_SIGNATURES "Create GPG signatures for release files" OFF)
|
||||
|
||||
if(APPLE)
|
||||
set(wx_mac_patched_default OFF)
|
||||
|
||||
if(UPSTREAM_RELEASE)
|
||||
set(wx_mac_patched_default ON)
|
||||
endif()
|
||||
|
||||
option(WX_MAC_PATCHED "A build of wxWidgets that is patched for the alert sound bug is being used" ${wx_mac_patched_default})
|
||||
endif()
|
||||
|
@@ -1,3 +1,7 @@
|
||||
if(TRANSLATIONS_ONLY)
|
||||
return()
|
||||
endif()
|
||||
|
||||
if(NOT DEFINED VCPKG_TARGET_TRIPLET)
|
||||
if(NOT WIN32)
|
||||
return()
|
||||
@@ -6,19 +10,27 @@ if(NOT DEFINED VCPKG_TARGET_TRIPLET)
|
||||
# Check if we are in an MSVC environment.
|
||||
find_program(cl_exe_path NAME cl.exe HINTS ENV PATH)
|
||||
|
||||
if($ENV{CXX} MATCHES "cl.exe$" OR cl_exe_path)
|
||||
if(ENV{CXX} MATCHES "cl.exe$" OR cl_exe_path)
|
||||
# Infer the architecture from the LIB folders.
|
||||
foreach(LIB $ENV{LIB})
|
||||
if(${LIB} MATCHES "x64$")
|
||||
foreach(lib $ENV{LIB})
|
||||
if(lib MATCHES "x64$")
|
||||
set(VBAM_VCPKG_PLATFORM "x64-windows-static")
|
||||
break()
|
||||
endif()
|
||||
if(${LIB} MATCHES "x86$")
|
||||
if(lib MATCHES "x86$")
|
||||
set(VBAM_VCPKG_PLATFORM "x86-windows-static")
|
||||
break()
|
||||
endif()
|
||||
if(${LIB} MATCHES "ARM64$")
|
||||
if(lib MATCHES "ARM64$")
|
||||
set(VBAM_VCPKG_PLATFORM "arm64-windows-static")
|
||||
|
||||
foreach(path $ENV{PATH})
|
||||
if(path MATCHES "[Hh]ost[Xx]64")
|
||||
set(VCPKG_HOST_TRIPLET "x64-windows" CACHE STRING "Vcpkg host triplet" FORCE)
|
||||
set(VCPKG_USE_HOST_TOOLS ON CACHE BOOL "Use vcpkg host tools" FORCE)
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
break()
|
||||
endif()
|
||||
endforeach()
|
||||
@@ -47,9 +59,31 @@ if(NOT DEFINED VCPKG_TARGET_TRIPLET)
|
||||
message(STATUS "Inferred VCPKG_TARGET_TRIPLET=${VCPKG_TARGET_TRIPLET}")
|
||||
endif()
|
||||
|
||||
function(vcpkg_seconds)
|
||||
if(CMAKE_HOST_SYSTEM MATCHES Windows OR ((NOT DEFINED CMAKE_HOST_SYSTEM) AND WIN32))
|
||||
execute_process(
|
||||
COMMAND cmd /c echo %TIME:~0,8%
|
||||
OUTPUT_VARIABLE time
|
||||
)
|
||||
else()
|
||||
execute_process(
|
||||
COMMAND date +%H:%M:%S
|
||||
OUTPUT_VARIABLE time
|
||||
)
|
||||
endif()
|
||||
|
||||
string(SUBSTRING "${time}" 0 2 hours)
|
||||
string(SUBSTRING "${time}" 3 2 minutes)
|
||||
string(SUBSTRING "${time}" 6 2 secs)
|
||||
|
||||
math(EXPR seconds "(${hours} * 60 * 60) + (${minutes} * 60) + ${secs}")
|
||||
|
||||
set(seconds ${seconds} PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
function(vcpkg_check_git_status git_status)
|
||||
# The VS vcpkg component cannot be written to without elevation.
|
||||
if(NOT git_status EQUAL 0 AND NOT VCPKG_ROOT MATCHES "^C:/Program Files/Microsoft Visual Studio/")
|
||||
if(NOT git_status EQUAL 0 AND NOT VCPKG_ROOT MATCHES "Visual Studio")
|
||||
message(FATAL_ERROR "Error updating vcpkg from git, please make sure git for windows is installed correctly, it can be installed from Visual Studio components")
|
||||
endif()
|
||||
endfunction()
|
||||
@@ -116,24 +150,16 @@ function(vcpkg_is_installed vcpkg_exe pkg_name pkg_ver pkg_triplet powershell ou
|
||||
string(REPLACE "-" "." pkg_ver ${pkg_ver})
|
||||
|
||||
if(NOT DEFINED VCPKG_INSTALLED_COUNT)
|
||||
if(VCPKG_ROOT MATCHES "^C:/Program Files/Microsoft Visual Studio/")
|
||||
execute_process(
|
||||
COMMAND ${powershell}
|
||||
-executionpolicy bypass -noprofile
|
||||
-command "import-module '${CMAKE_BINARY_DIR}/vcpkg-binpkg/vcpkg-binpkg.psm1'; vcpkg-list"
|
||||
OUTPUT_VARIABLE vcpkg_list_text
|
||||
)
|
||||
else()
|
||||
execute_process(
|
||||
COMMAND ${vcpkg_exe} list
|
||||
OUTPUT_VARIABLE vcpkg_list_text
|
||||
ERROR_QUIET
|
||||
)
|
||||
endif()
|
||||
execute_process(
|
||||
COMMAND ${powershell}
|
||||
-executionpolicy bypass -noprofile
|
||||
-command "import-module '${CMAKE_BINARY_DIR}/vcpkg-binpkg/vcpkg-binpkg.psm1'; vcpkg-list"
|
||||
OUTPUT_VARIABLE vcpkg_list_text
|
||||
)
|
||||
|
||||
string(REGEX REPLACE "\r?\n" ";" vcpkg_list_raw "${vcpkg_list_text}")
|
||||
|
||||
set(VCPKG_INSTALLED_COUNT 0 PARENT_SCOPE)
|
||||
set(VCPKG_INSTALLED_COUNT 0 CACHE INTERNAL "Number of installed vcpkg packages" FORCE)
|
||||
foreach(pkg ${vcpkg_list_raw})
|
||||
if(NOT pkg MATCHES "^([^:[]+)[^:]*:([^ ]+) +([0-9][^ ]*) +.*\$")
|
||||
continue()
|
||||
@@ -155,8 +181,8 @@ function(vcpkg_is_installed vcpkg_exe pkg_name pkg_ver pkg_triplet powershell ou
|
||||
list(APPEND VCPKG_INSTALLED ${inst_pkg_name} ${inst_pkg_ver} ${inst_pkg_rev} ${inst_pkg_triplet})
|
||||
math(EXPR VCPKG_INSTALLED_COUNT "${VCPKG_INSTALLED_COUNT} + 1")
|
||||
endforeach()
|
||||
set(VCPKG_INSTALLED ${VCPKG_INSTALLED} PARENT_SCOPE)
|
||||
set(VCPKG_INSTALLED_COUNT ${VCPKG_INSTALLED_COUNT} PARENT_SCOPE)
|
||||
set(VCPKG_INSTALLED ${VCPKG_INSTALLED} CACHE INTERNAL "List of installed vcpkg packages" FORCE)
|
||||
set(VCPKG_INSTALLED_COUNT ${VCPKG_INSTALLED_COUNT} CACHE INTERNAL "Number of installed vcpkg packages" FORCE)
|
||||
endif()
|
||||
|
||||
if(NOT VCPKG_INSTALLED_COUNT GREATER 0)
|
||||
@@ -190,48 +216,79 @@ function(vcpkg_is_installed vcpkg_exe pkg_name pkg_ver pkg_triplet powershell ou
|
||||
endforeach()
|
||||
endfunction()
|
||||
|
||||
function(get_triplet_package_list triplet)
|
||||
if(EXISTS "${CMAKE_BINARY_DIR}/binary_package_list_${triplet}.html")
|
||||
return()
|
||||
endif()
|
||||
|
||||
file(
|
||||
DOWNLOAD "https://nightly.visualboyadvance-m.org/vcpkg/${triplet}/" "${CMAKE_BINARY_DIR}/binary_package_list_${triplet}.html"
|
||||
STATUS pkg_list_status
|
||||
)
|
||||
list(GET pkg_list_status 1 pkg_list_error)
|
||||
list(GET pkg_list_status 0 pkg_list_status)
|
||||
|
||||
if(NOT pkg_list_status EQUAL 0)
|
||||
message(STATUS "Failed to download vcpkg binary package list: ${pkg_list_status} - ${pkg_list_error}")
|
||||
return()
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
function(download_package pkg pkgs_dir)
|
||||
string(REGEX REPLACE "^[^_]+_[^_]+_([^.]+)[.]zip\$" "\\1" pkg_triplet ${pkg})
|
||||
|
||||
message(STATUS "Downloading https://nightly.visualboyadvance-m.org/vcpkg/${pkg_triplet}/${pkg} ...")
|
||||
|
||||
file(
|
||||
DOWNLOAD "https://nightly.visualboyadvance-m.org/vcpkg/${pkg_triplet}/${pkg}" "${pkgs_dir}/${pkg}"
|
||||
STATUS pkg_download_status
|
||||
)
|
||||
list(GET pkg_download_status 1 pkg_download_error)
|
||||
list(GET pkg_download_status 0 pkg_download_status)
|
||||
|
||||
if(NOT pkg_download_status EQUAL 0)
|
||||
message(STATUS "Failed to download vcpkg binary package '${pkg}': ${pkg_download_status} - ${pkg_download_error}")
|
||||
return()
|
||||
endif()
|
||||
|
||||
message(STATUS "done.")
|
||||
endfunction()
|
||||
|
||||
function(zip_is_installed vcpkg_exe zip outvar)
|
||||
if(NOT zip MATCHES "([^_]+)_([^_]+)_([^.]+)[.]zip")
|
||||
return()
|
||||
endif()
|
||||
set(pkg_name ${CMAKE_MATCH_1})
|
||||
set(pkg_version ${CMAKE_MATCH_2})
|
||||
set(pkg_triplet ${CMAKE_MATCH_3})
|
||||
|
||||
vcpkg_is_installed(${vcpkg_exe} ${pkg_name} ${pkg_version} ${pkg_triplet} ${POWERSHELL} pkg_installed)
|
||||
|
||||
set(${outvar} ${pkg_installed} PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
function(cleanup_binary_packages)
|
||||
file(REMOVE_RECURSE "${CMAKE_BINARY_DIR}/vcpkg-binary-packages")
|
||||
|
||||
unset(VCPKG_INSTALLED CACHE)
|
||||
unset(VCPKG_INSTALLED_COUNT CACHE)
|
||||
endfunction()
|
||||
|
||||
function(get_binary_packages vcpkg_exe)
|
||||
set(binary_packages_installed FALSE PARENT_SCOPE)
|
||||
|
||||
unset(triplets)
|
||||
unset(host_triplet)
|
||||
# Determine host triplet for vcpkg build dependencies
|
||||
if(WIN32)
|
||||
if($ENV{PROCESSOR_ARCHITECTURE} MATCHES "[Aa][Rr][Mm]64")
|
||||
set(host_triplet "arm64-windows")
|
||||
elseif($ENV{PROCESSOR_ARCHITECTURE} MATCHES "[Aa][Mm][Dd]64|[Xx]64")
|
||||
set(host_triplet "x64-windows")
|
||||
else()
|
||||
set(host_triplet "x86-windows")
|
||||
endif()
|
||||
get_triplet_package_list(${VCPKG_TARGET_TRIPLET})
|
||||
|
||||
if(NOT EXISTS "${CMAKE_BINARY_DIR}/binary_package_list_${VCPKG_TARGET_TRIPLET}.html")
|
||||
message(STATUS "Failed to download binary package list found for triplet '${VCPKG_TARGET_TRIPLET}', aborting.")
|
||||
return()
|
||||
endif()
|
||||
if(DEFINED host_triplet)
|
||||
list(APPEND triplets ${host_triplet})
|
||||
endif()
|
||||
list(APPEND triplets ${VCPKG_TARGET_TRIPLET})
|
||||
|
||||
foreach(triplet ${triplets})
|
||||
file(
|
||||
DOWNLOAD "https://nightly.visualboyadvance-m.org/vcpkg/${triplet}/" "${CMAKE_BINARY_DIR}/binary_package_list_${triplet}.html"
|
||||
STATUS pkg_list_status
|
||||
)
|
||||
list(GET pkg_list_status 1 pkg_list_error)
|
||||
list(GET pkg_list_status 0 pkg_list_status)
|
||||
|
||||
if(NOT pkg_list_status EQUAL 0)
|
||||
message(STATUS "Failed to download vcpkg binary package list: ${pkg_list_status} - ${pkg_list_error}")
|
||||
return()
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
unset(binary_packages)
|
||||
foreach(triplet ${triplets})
|
||||
file(READ "${CMAKE_BINARY_DIR}/binary_package_list_${triplet}.html" raw_html)
|
||||
string(REGEX MATCHALL "<a href=\"[^\"]+[.]zip\"" links ${raw_html})
|
||||
foreach(link ${links})
|
||||
string(REGEX REPLACE "<a href=\"([^\"]+[.]zip)\"" "\\1" pkg ${link})
|
||||
list(APPEND binary_packages ${pkg})
|
||||
endforeach()
|
||||
file(READ "${CMAKE_BINARY_DIR}/binary_package_list_${VCPKG_TARGET_TRIPLET}.html" raw_html)
|
||||
string(REGEX MATCHALL "<a href=\"[^\"]+[.]zip\"" links ${raw_html})
|
||||
foreach(link ${links})
|
||||
string(REGEX REPLACE "<a href=\"([^\"]+[.]zip)\"" "\\1" pkg ${link})
|
||||
list(APPEND binary_packages ${pkg})
|
||||
endforeach()
|
||||
|
||||
set(vcpkg_binpkg_dir ${CMAKE_BINARY_DIR}/vcpkg-binpkg)
|
||||
@@ -244,19 +301,11 @@ function(get_binary_packages vcpkg_exe)
|
||||
|
||||
FetchContent_GetProperties(vcpkg_binpkg)
|
||||
if(NOT vcpkg_binpkg_POPULATED)
|
||||
FetchContent_Populate(vcpkg_binpkg)
|
||||
FetchContent_MakeAvailable(vcpkg_binpkg)
|
||||
endif()
|
||||
|
||||
unset(to_install)
|
||||
foreach(pkg ${binary_packages})
|
||||
if(NOT pkg MATCHES "([^_]+)_([^_]+)_([^.]+)[.]zip")
|
||||
continue()
|
||||
endif()
|
||||
set(pkg_name ${CMAKE_MATCH_1})
|
||||
set(pkg_version ${CMAKE_MATCH_2})
|
||||
set(pkg_triplet ${CMAKE_MATCH_3})
|
||||
|
||||
vcpkg_is_installed(${vcpkg_exe} ${pkg_name} ${pkg_version} ${pkg_triplet} ${POWERSHELL} pkg_installed)
|
||||
zip_is_installed(${vcpkg_exe} ${pkg} pkg_installed)
|
||||
|
||||
if(NOT pkg_installed)
|
||||
list(APPEND to_install ${pkg})
|
||||
@@ -268,26 +317,82 @@ function(get_binary_packages vcpkg_exe)
|
||||
file(MAKE_DIRECTORY ${bin_pkgs_dir})
|
||||
|
||||
foreach(pkg ${to_install})
|
||||
string(REGEX REPLACE "^[^_]+_[^_]+_([^.]+)[.]zip\$" "\\1" pkg_triplet ${pkg})
|
||||
download_package("${pkg}" "${bin_pkgs_dir}")
|
||||
|
||||
message(STATUS "Downloading https://nightly.visualboyadvance-m.org/vcpkg/${pkg_triplet}/${pkg} ...")
|
||||
if(NOT EXISTS "${bin_pkgs_dir}/${pkg}")
|
||||
message(STATUS "Failed to download package '${pkg}', aborting.")
|
||||
return()
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
file(
|
||||
DOWNLOAD "https://nightly.visualboyadvance-m.org/vcpkg/${pkg_triplet}/${pkg}" "${bin_pkgs_dir}/${pkg}"
|
||||
STATUS pkg_download_status
|
||||
unset(installed_host_deps)
|
||||
|
||||
while(TRUE)
|
||||
# -command "import-module ($env:USERPROFILE + '/source/repos/vcpkg-binpkg-prototype/vcpkg-binpkg.psm1'); vcpkg-listmissing ."
|
||||
execute_process(
|
||||
COMMAND ${POWERSHELL}
|
||||
-executionpolicy bypass -noprofile
|
||||
-command "import-module '${CMAKE_BINARY_DIR}/vcpkg-binpkg/vcpkg-binpkg.psm1'; vcpkg-listmissing ."
|
||||
WORKING_DIRECTORY ${bin_pkgs_dir}
|
||||
OUTPUT_VARIABLE host_deps
|
||||
RESULT_VARIABLE host_deps_status
|
||||
)
|
||||
list(GET pkg_download_status 1 pkg_download_error)
|
||||
list(GET pkg_download_status 0 pkg_download_status)
|
||||
|
||||
if(NOT pkg_download_status EQUAL 0)
|
||||
message(STATUS "Failed to download vcpkg binary package '${pkg}': ${pkg_download_status} - ${pkg_download_error}")
|
||||
if(NOT host_deps_status EQUAL 0)
|
||||
message(STATUS "Failed to calculate host dependencies: ${host_deps_status}")
|
||||
return()
|
||||
endif()
|
||||
|
||||
message(STATUS "done.")
|
||||
endforeach()
|
||||
string(REGEX REPLACE "\r?\n" ";" host_deps "${host_deps}")
|
||||
string(REGEX REPLACE " *;+ *$" "" host_deps "${host_deps}")
|
||||
|
||||
list(LENGTH host_deps host_deps_count)
|
||||
list(LENGTH installed_host_deps installed_host_deps_count)
|
||||
|
||||
if(host_deps_count EQUAL installed_host_deps_count)
|
||||
break()
|
||||
endif()
|
||||
|
||||
foreach(host_dep ${host_deps})
|
||||
if(NOT host_dep MATCHES "^([^:]+):([^:]+)\$")
|
||||
continue()
|
||||
endif()
|
||||
set(host_dep_name ${CMAKE_MATCH_1})
|
||||
set(host_dep_triplet ${CMAKE_MATCH_2})
|
||||
|
||||
get_triplet_package_list(${host_dep_triplet})
|
||||
|
||||
file(READ "${CMAKE_BINARY_DIR}/binary_package_list_${host_dep_triplet}.html" raw_html)
|
||||
string(REGEX MATCHALL "<a href=\"${host_dep_name}_[^\"]+[.]zip\"" links ${raw_html})
|
||||
|
||||
list(LENGTH links links_count)
|
||||
|
||||
if(NOT links_count EQUAL 1)
|
||||
message(STATUS "Multiple host dependencies found for '${host_dep_name}' for triplet '${host_dep_triplet}', aborting.")
|
||||
return()
|
||||
endif()
|
||||
|
||||
string(REGEX REPLACE "<a href=\"([^\"]+[.]zip)\"" "\\1" pkg ${links})
|
||||
|
||||
list(FIND installed_host_deps "${pkg}" found_idx)
|
||||
|
||||
if(found_idx EQUAL -1)
|
||||
zip_is_installed(${vcpkg_exe} ${pkg} pkg_installed)
|
||||
|
||||
if(NOT pkg_installed)
|
||||
download_package("${pkg}" "${bin_pkgs_dir}")
|
||||
|
||||
if(NOT EXISTS "${bin_pkgs_dir}/${pkg}")
|
||||
message(STATUS "Failed to download host dependency package '${pkg}', aborting.")
|
||||
return()
|
||||
endif()
|
||||
else()
|
||||
list(APPEND installed_host_deps "${pkg}")
|
||||
endif()
|
||||
endif()
|
||||
endforeach()
|
||||
endwhile()
|
||||
|
||||
# -command "import-module ($env:USERPROFILE + '/source/repos/vcpkg-binpkg-prototype/vcpkg-binpkg.psm1'); vcpkg-instpkg ."
|
||||
execute_process(
|
||||
COMMAND ${POWERSHELL}
|
||||
-executionpolicy bypass -noprofile
|
||||
@@ -298,6 +403,8 @@ function(get_binary_packages vcpkg_exe)
|
||||
file(REMOVE_RECURSE ${bin_pkgs_dir})
|
||||
endif()
|
||||
|
||||
cleanup_binary_packages()
|
||||
|
||||
set(binary_packages_installed TRUE PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
@@ -320,11 +427,12 @@ function(vcpkg_remove_optional_deps vcpkg_exe)
|
||||
endfunction()
|
||||
|
||||
function(vcpkg_set_toolchain)
|
||||
get_filename_component(preferred_root ${CMAKE_SOURCE_DIR}/../vcpkg ABSOLUTE)
|
||||
|
||||
if(NOT DEFINED POWERSHELL)
|
||||
message(FATAL_ERROR "Powershell is required to use vcpkg binaries.")
|
||||
endif()
|
||||
if(NOT DEFINED ENV{VCPKG_ROOT})
|
||||
get_filename_component(preferred_root ${CMAKE_SOURCE_DIR}/../vcpkg ABSOLUTE)
|
||||
|
||||
if(WIN32)
|
||||
if(DEFINED ENV{CI} OR EXISTS /vcpkg)
|
||||
@@ -355,6 +463,22 @@ function(vcpkg_set_toolchain)
|
||||
set(VCPKG_ROOT $ENV{VCPKG_ROOT})
|
||||
endif()
|
||||
|
||||
# Avoid using Visual Studio default vcpkg, because that requires elevaction.
|
||||
if(VCPKG_ROOT MATCHES "Visual Studio")
|
||||
set(mkdir_status 0)
|
||||
if(NOT EXISTS "${preferred_root}")
|
||||
file(
|
||||
MAKE_DIRECTORY "${preferred_root}"
|
||||
RESULT mkdir_status
|
||||
)
|
||||
endif()
|
||||
|
||||
if(mkdir_status EQUAL 0)
|
||||
set(VCPKG_ROOT "${preferred_root}")
|
||||
set(ENV{VCPKG_ROOT} ${VCPKG_ROOT})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
set(VCPKG_ROOT ${VCPKG_ROOT} CACHE FILEPATH "vcpkg installation root path" FORCE)
|
||||
|
||||
if(NOT EXISTS ${VCPKG_ROOT})
|
||||
@@ -439,6 +563,10 @@ function(vcpkg_set_toolchain)
|
||||
|
||||
foreach(pkg ${VCPKG_DEPS})
|
||||
list(APPEND VCPKG_DEPS_QUALIFIED ${pkg}:${VCPKG_TARGET_TRIPLET})
|
||||
|
||||
if(VCPKG_TARGET_TRIPLET STREQUAL "x86-mingw-static")
|
||||
list(APPEND VCPKG_DEPS_QUALIFIED libsamplerate:x86-mingw-static)
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
if(WIN32)
|
||||
@@ -447,13 +575,9 @@ function(vcpkg_set_toolchain)
|
||||
set(vcpkg_exe "${VCPKG_ROOT}/vcpkg")
|
||||
endif()
|
||||
|
||||
# update portfiles
|
||||
execute_process(
|
||||
COMMAND ${vcpkg_exe} update
|
||||
WORKING_DIRECTORY ${VCPKG_ROOT}
|
||||
)
|
||||
|
||||
get_binary_packages(${vcpkg_exe})
|
||||
if (NOT (NO_VCPKG_UPDATES OR (NOT VCPKG_BINARY_PACKAGES)))
|
||||
get_binary_packages(${vcpkg_exe})
|
||||
endif()
|
||||
|
||||
if(NOT binary_packages_installed)
|
||||
# Get number of seconds since midnight (might be wrong if am/pm is in effect on Windows.)
|
||||
@@ -467,7 +591,7 @@ function(vcpkg_set_toolchain)
|
||||
|
||||
# Install core deps.
|
||||
execute_process(
|
||||
COMMAND ${vcpkg_exe} install ${VCPKG_DEPS_QUALIFIED}
|
||||
COMMAND ${vcpkg_exe} --triplet ${VCPKG_TARGET_TRIPLET} install ${pkg}
|
||||
WORKING_DIRECTORY ${VCPKG_ROOT}
|
||||
)
|
||||
|
||||
@@ -509,7 +633,7 @@ function(vcpkg_set_toolchain)
|
||||
set(dep_qualified "${dep}:${VCPKG_TARGET_TRIPLET}")
|
||||
|
||||
execute_process(
|
||||
COMMAND ${vcpkg_exe} install ${dep_qualified}
|
||||
COMMAND --triplet ${VCPKG_TARGET_TRIPLET} ${vcpkg_exe} install ${dep}
|
||||
WORKING_DIRECTORY ${VCPKG_ROOT}
|
||||
)
|
||||
|
||||
@@ -525,14 +649,10 @@ function(vcpkg_set_toolchain)
|
||||
endif()
|
||||
|
||||
if(WIN32 AND NOT CMAKE_GENERATOR MATCHES "Visual Studio" AND NOT DEFINED CMAKE_CXX_COMPILER)
|
||||
if(VCPKG_TARGET_TRIPLET MATCHES "^x[68][46]-windows-")
|
||||
if(VCPKG_TARGET_TRIPLET MATCHES "-windows-")
|
||||
# set toolchain to VS for e.g. Ninja or jom
|
||||
set(CMAKE_C_COMPILER cl CACHE STRING "Microsoft C/C++ Compiler" FORCE)
|
||||
set(CMAKE_CXX_COMPILER cl CACHE STRING "Microsoft C/C++ Compiler" FORCE)
|
||||
elseif(VCPKG_TARGET_TRIPLET MATCHES "^x[68][46]-mingw-")
|
||||
# set toolchain to MinGW for e.g. Ninja or jom
|
||||
set(CMAKE_C_COMPILER gcc CACHE STRING "MinGW GCC C Compiler" FORCE)
|
||||
set(CMAKE_CXX_COMPILER g++ CACHE STRING "MinGW G++ C++ Compiler" FORCE)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
@@ -541,14 +661,4 @@ endfunction()
|
||||
|
||||
vcpkg_set_toolchain()
|
||||
|
||||
# Make vcpkg use debug libs for RelWithDebInfo
|
||||
set(orig_build_type ${CMAKE_BUILD_TYPE})
|
||||
|
||||
if(CMAKE_BUILD_TYPE STREQUAL RelWithDebInfo)
|
||||
set(CMAKE_BUILD_TYPE Debug)
|
||||
endif()
|
||||
|
||||
include(${VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake)
|
||||
|
||||
set(CMAKE_BUILD_TYPE ${orig_build_type})
|
||||
unset(orig_build_type)
|
||||
|
@@ -1,28 +1,40 @@
|
||||
if(X86_32 OR X86_64)
|
||||
add_compile_options(-mfpmath=sse -msse2)
|
||||
add_compile_options(-msse2)
|
||||
endif()
|
||||
|
||||
if(X86_64)
|
||||
# Require and optimize for Core2 level support, tune for generic.
|
||||
add_compile_options(-march=core2 -mtune=generic)
|
||||
elseif(X86_32)
|
||||
# Optimize for pentium-mmx and tune for generic for older builds.
|
||||
add_compile_options(-march=pentium-mmx -mtune=generic)
|
||||
if(UPSTREAM_RELEASE)
|
||||
if(X86_64)
|
||||
# Require and optimize for Core2 level support, tune for generic.
|
||||
if(APPLE)
|
||||
add_compile_options(-march=core2 -mtune=skylake)
|
||||
else()
|
||||
add_compile_options(-march=core2 -mtune=generic)
|
||||
endif()
|
||||
elseif(X86_32)
|
||||
# Optimize for pentiumi3 and tune for generic for Windows XP builds.
|
||||
set(WINXP TRUE)
|
||||
add_compile_options(-march=pentium3 -mtune=generic)
|
||||
add_compile_definitions(-DWINXP)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Common flags.
|
||||
add_compile_options(
|
||||
-pipe
|
||||
-Wno-unused-command-line-argument
|
||||
-Wno-deprecated-copy
|
||||
$<$<COMPILE_LANGUAGE:CXX>:-Wno-deprecated-copy>
|
||||
-Wformat
|
||||
-Wformat-security
|
||||
-feliminate-unused-debug-types
|
||||
-fdiagnostics-color=always
|
||||
)
|
||||
|
||||
if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
|
||||
add_compile_options(-Wno-unused-command-line-argument)
|
||||
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
||||
add_compile_options(-feliminate-unused-debug-types)
|
||||
endif()
|
||||
|
||||
# check if ssp flags are supported.
|
||||
if(CMAKE_BUILD_TYPE STREQUAL Debug)
|
||||
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
|
||||
check_cxx_compiler_flag(-fstack-protector-strong STACK_PROTECTOR_SUPPORTED)
|
||||
|
||||
if(STACK_PROTECTOR_SUPPORTED)
|
||||
@@ -35,17 +47,36 @@ if(CMAKE_BUILD_TYPE STREQUAL Debug)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
#add_compile_options(-std=c++14)
|
||||
|
||||
if(NOT ENABLE_ASM) # inline asm is not allowed with -fPIC
|
||||
add_compile_options(-fPIC)
|
||||
endif()
|
||||
|
||||
if(CMAKE_BUILD_TYPE STREQUAL Debug)
|
||||
add_compile_options(-ggdb3 -Og -fno-omit-frame-pointer -Wall -Wextra)
|
||||
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
|
||||
add_compile_options(-ggdb3 -fno-omit-frame-pointer -Wall -Wextra)
|
||||
else()
|
||||
add_compile_options(-Ofast -fomit-frame-pointer)
|
||||
add_compile_options(-O3 -ffast-math -fomit-frame-pointer)
|
||||
endif()
|
||||
|
||||
# for some reason this is necessary
|
||||
if(CMAKE_SYSTEM_NAME STREQUAL FreeBSD)
|
||||
if(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD")
|
||||
include_directories(/usr/local/include)
|
||||
endif()
|
||||
|
||||
if(VBAM_STATIC)
|
||||
if(APPLE)
|
||||
add_link_options(-static-libstdc++)
|
||||
else()
|
||||
add_link_options(-static-libgcc -static-libstdc++ -Wl,-Bstatic -lstdc++ -lpthread)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# To support LTO, this must always fail.
|
||||
add_compile_options(-Werror=odr -Werror=strict-aliasing)
|
||||
add_link_options( -Werror=odr -Werror=strict-aliasing)
|
||||
|
||||
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
||||
add_compile_options(-Werror=lto-type-mismatch)
|
||||
add_link_options( -Werror=lto-type-mismatch)
|
||||
endif()
|
||||
|
@@ -3,26 +3,8 @@ if (NOT MINGW)
|
||||
endif()
|
||||
|
||||
# this has to run after the toolchain is initialized.
|
||||
include_directories("${CMAKE_SOURCE_DIR}/dependencies/mingw-include")
|
||||
include_directories("${CMAKE_SOURCE_DIR}/dependencies/mingw-xaudio/include")
|
||||
include_directories("${CMAKE_SOURCE_DIR}/win32-deps/mingw-include")
|
||||
include_directories("${CMAKE_SOURCE_DIR}/win32-deps/mingw-xaudio/include")
|
||||
|
||||
# link libgcc/libstdc++ statically on GCC/mingw
|
||||
# and adjust link command when making a static binary
|
||||
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND VBAM_STATIC)
|
||||
# some dists don't have a static libpthread
|
||||
set(CMAKE_CXX_LINK_EXECUTABLE "${CMAKE_CXX_LINK_EXECUTABLE} -static-libgcc -static-libstdc++ -Wl,-Bstatic -lstdc++ -lpthread ")
|
||||
|
||||
if(WIN32)
|
||||
add_custom_command(
|
||||
TARGET visualboyadvance-m PRE_LINK
|
||||
COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_SOURCE_DIR}/msys-link-static.cmake
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
|
||||
)
|
||||
else()
|
||||
add_custom_command(
|
||||
TARGET visualboyadvance-m PRE_LINK
|
||||
COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_SOURCE_DIR}/link-static.cmake
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
# Add Winsock as the last library linked because of broken link precedence.
|
||||
set(CMAKE_CXX_LINK_EXECUTABLE "${CMAKE_CXX_LINK_EXECUTABLE} -lws2_32")
|
||||
|
@@ -10,7 +10,7 @@ if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
include_directories("${CMAKE_SOURCE_DIR}/dependencies/msvc")
|
||||
include_directories("${CMAKE_SOURCE_DIR}/win32-deps/msvc")
|
||||
|
||||
add_compile_definitions(
|
||||
_FORCENAMELESSUNION
|
||||
@@ -68,6 +68,8 @@ if(CMAKE_VERSION VERSION_LESS "3.25")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
add_compile_options($<$<COMPILE_LANGUAGE:CXX>:/std:c++17>)
|
||||
|
||||
set(CMAKE_RC_FLAGS "-c65001 /DWIN32" CACHE STRING "" FORCE)
|
||||
|
||||
# We need to explicitly set all of these to override the CMake defaults.
|
||||
|
@@ -1,13 +1,23 @@
|
||||
if(TRANSLATIONS_ONLY)
|
||||
return()
|
||||
endif()
|
||||
|
||||
# Compiler stuff
|
||||
include(CheckCXXCompilerFlag)
|
||||
|
||||
include(ProcessorCount)
|
||||
ProcessorCount(num_cpus)
|
||||
|
||||
if (ENABLE_LTO)
|
||||
if(ENABLE_LTO)
|
||||
include(CheckIPOSupported)
|
||||
check_ipo_supported(RESULT LTO_SUPPORTED)
|
||||
if (LTO_SUPPORTED)
|
||||
|
||||
# MINGW64 does not support LTO
|
||||
if(WIN32 AND CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
||||
set(LTO_SUPPORTED FALSE)
|
||||
endif()
|
||||
|
||||
if(LTO_SUPPORTED)
|
||||
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION TRUE)
|
||||
else()
|
||||
message(WARNING "LTO is not supported by the compiler, diasabling LTO")
|
||||
@@ -15,6 +25,49 @@ if (ENABLE_LTO)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Output all binaries at top level
|
||||
set(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR})
|
||||
|
||||
if(NOT HTTPS)
|
||||
add_compile_definitions(NO_HTTPS)
|
||||
endif()
|
||||
|
||||
if(ENABLE_GBA_LOGGING)
|
||||
add_compile_definitions(GBA_LOGGING )
|
||||
endif()
|
||||
|
||||
if(ENABLE_MMX)
|
||||
add_compile_definitions(MMX)
|
||||
endif()
|
||||
|
||||
|
||||
if(NOT ENABLE_ONLINEUPDATES)
|
||||
add_compile_definitions(NO_ONLINEUPDATES)
|
||||
endif()
|
||||
|
||||
# The debugger is enabled by default
|
||||
if(ENABLE_DEBUGGER)
|
||||
add_compile_definitions(VBAM_ENABLE_DEBUGGER)
|
||||
endif()
|
||||
|
||||
# The ASM core is disabled by default because we don't know on which platform we are
|
||||
if(NOT ENABLE_ASM_CORE)
|
||||
add_compile_definitions(C_CORE)
|
||||
endif()
|
||||
|
||||
# Set up "src" and generated directory as a global include directory.
|
||||
set(VBAM_GENERATED_DIR ${CMAKE_BINARY_DIR}/generated)
|
||||
include_directories(
|
||||
${CMAKE_SOURCE_DIR}/src
|
||||
${VBAM_GENERATED_DIR}
|
||||
)
|
||||
|
||||
# C defines
|
||||
add_compile_definitions(HAVE_NETINET_IN_H HAVE_ARPA_INET_H HAVE_ZLIB_H FINAL_VERSION SDL USE_OPENGL SYSCONF_INSTALL_DIR="${CMAKE_INSTALL_FULL_SYSCONFDIR}")
|
||||
add_compile_definitions(PKGDATADIR="${CMAKE_INSTALL_FULL_DATADIR}/vbam")
|
||||
add_compile_definitions(__STDC_FORMAT_MACROS)
|
||||
add_compile_definitions(LOCALEDIR="${LOCALEDIR}")
|
||||
|
||||
# Common compiler settings.
|
||||
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
|
||||
add_compile_definitions(DEBUG)
|
||||
|
@@ -16,7 +16,7 @@ Ignore the following cmake error.
|
||||
# Get last tag.
|
||||
|
||||
execute_process(
|
||||
COMMAND ${GIT_EXECUTABLE} tag --sort=-v:refname
|
||||
COMMAND git tag --sort=-v:refname
|
||||
OUTPUT_VARIABLE git_tags
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
||||
@@ -43,7 +43,7 @@ Ignore the following cmake error.
|
||||
# Clone repo.
|
||||
|
||||
execute_process(
|
||||
COMMAND ${GIT_EXECUTABLE} clone git@github.com:visualboyadvance-m/visualboyadvance-m.github.io web-data
|
||||
COMMAND git clone git@github.com:visualboyadvance-m/visualboyadvance-m.github.io web-data
|
||||
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
|
||||
)
|
||||
|
||||
@@ -103,21 +103,21 @@ Ignore the following cmake error.
|
||||
)
|
||||
|
||||
execute_process(
|
||||
COMMAND ${GIT_EXECUTABLE} add appcast.xml
|
||||
COMMAND git add appcast.xml
|
||||
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/web-data
|
||||
)
|
||||
|
||||
# Commit the change.
|
||||
|
||||
execute_process(
|
||||
COMMAND ${GIT_EXECUTABLE} commit -m "release ${new_tag}" --signoff -S
|
||||
COMMAND git commit -m "release ${new_tag}" --signoff -S
|
||||
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/web-data
|
||||
)
|
||||
|
||||
# Make release tag.
|
||||
|
||||
execute_process(
|
||||
COMMAND ${GIT_EXECUTABLE} tag -s -m${new_tag} ${new_tag}
|
||||
COMMAND git tag -s -m${new_tag} ${new_tag}
|
||||
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/web-data
|
||||
)
|
||||
|
||||
|
@@ -37,8 +37,48 @@ function(check_clean_exit var)
|
||||
set(${var} ${exit_status} PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
function(try_wx_util var util conf_suffix major_version minor_version)
|
||||
unset(suffix)
|
||||
if(conf_suffix)
|
||||
set(suffix "-${conf_suffix}")
|
||||
endif()
|
||||
if(major_version)
|
||||
set(suffix "${suffix}-${major_version}")
|
||||
|
||||
if(NOT minor_version EQUAL -1)
|
||||
set(suffix "${suffix}.${minor_version}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# find_program caches the result
|
||||
set(exe NOTFOUND CACHE INTERNAL "" FORCE)
|
||||
find_program(exe NAMES "${util}${suffix}")
|
||||
|
||||
# try infix variant, as on FreeBSD
|
||||
if(NOT EXISTS "${exe}")
|
||||
string(REGEX REPLACE "^-" "" suffix "${suffix}")
|
||||
|
||||
string(REGEX REPLACE "-" "${suffix}-" try "${util}")
|
||||
|
||||
set(exe NOTFOUND CACHE INTERNAL "" FORCE)
|
||||
find_program(exe NAMES "${try}")
|
||||
endif()
|
||||
|
||||
if(EXISTS "${exe}")
|
||||
# check that the utility can be executed cleanly
|
||||
# in case we find e.g. the wrong architecture binary
|
||||
# when cross-compiling
|
||||
check_clean_exit(exit_status "${exe}" --help)
|
||||
|
||||
if(exit_status EQUAL 0)
|
||||
set("${var}" "${exe}" PARENT_SCOPE)
|
||||
return()
|
||||
endif()
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
function(find_wx_util var util)
|
||||
if(WIN32 OR EXISTS /etc/gentoo-release)
|
||||
if((WIN32 AND (NOT CMAKE_TOOLCHAIN_FILE MATCHES "vcpkg")) OR EXISTS /etc/gentoo-release)
|
||||
# On win32, including cross builds we prefer the plain utility
|
||||
# name first from PATH, with the exception of -static for static
|
||||
# builds.
|
||||
@@ -57,48 +97,34 @@ function(find_wx_util var util)
|
||||
set(major_versions ";")
|
||||
endif()
|
||||
|
||||
list(APPEND conf_suffixes gtk4u gtk4 gtk3u gtk3 gtk2u gtk2 "")
|
||||
list(APPEND major_versions 4 3 2 "")
|
||||
list(APPEND conf_suffixes "" gtk3u gtk3 gtk2u gtk2)
|
||||
list(APPEND major_versions "" 3)
|
||||
|
||||
get_target_property(wx_base_lib_prop wx::base LOCATION)
|
||||
string(STRIP "${wx_base_lib_prop}" wx_base_lib)
|
||||
|
||||
if(wx_base_lib MATCHES "wx_baseu?-([0-9]+)\\.([0-9]+)\\.")
|
||||
set(lib_major "${CMAKE_MATCH_1}")
|
||||
set(lib_minor "${CMAKE_MATCH_2}")
|
||||
endif()
|
||||
|
||||
foreach(conf_suffix IN LISTS conf_suffixes)
|
||||
if(lib_major AND lib_minor)
|
||||
try_wx_util(exe "${util}" "${conf_suffix}" "${lib_major}" "${lib_minor}")
|
||||
|
||||
if(exe)
|
||||
set("${var}" "${exe}" PARENT_SCOPE)
|
||||
return()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
foreach(major_version IN LISTS major_versions)
|
||||
foreach(minor_version RANGE 100 -1 -1)
|
||||
unset(suffix)
|
||||
if(conf_suffix)
|
||||
set(suffix "-${conf_suffix}")
|
||||
endif()
|
||||
if(major_version)
|
||||
set(suffix "${suffix}-${major_version}")
|
||||
foreach(minor_version RANGE 30 -1 -1)
|
||||
try_wx_util(exe "${util}" "${conf_suffix}" "${major_version}" "${minor_version}")
|
||||
|
||||
if(NOT minor_version EQUAL -1)
|
||||
set(suffix "${suffix}.${minor_version}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# find_program caches the result
|
||||
set(exe NOTFOUND CACHE INTERNAL "" FORCE)
|
||||
find_program(exe NAMES "${util}${suffix}")
|
||||
|
||||
# try infix variant, as on FreeBSD
|
||||
if(NOT EXISTS ${exe})
|
||||
string(REGEX REPLACE "^-" "" suffix "${suffix}")
|
||||
|
||||
string(REGEX REPLACE "-" "${suffix}-" try ${util})
|
||||
|
||||
set(exe NOTFOUND CACHE INTERNAL "" FORCE)
|
||||
find_program(exe NAMES ${try})
|
||||
endif()
|
||||
|
||||
if(EXISTS ${exe})
|
||||
# check that the utility can be executed cleanly
|
||||
# in case we find e.g. the wrong architecture binary
|
||||
# when cross-compiling
|
||||
check_clean_exit(exit_status ${exe} --help)
|
||||
|
||||
if(exit_status EQUAL 0)
|
||||
set(${var} ${exe} PARENT_SCOPE)
|
||||
return()
|
||||
endif()
|
||||
if(exe)
|
||||
set("${var}" "${exe}" PARENT_SCOPE)
|
||||
return()
|
||||
endif()
|
||||
|
||||
# don't iterate over minor versions for empty major version
|
||||
|
@@ -1,175 +0,0 @@
|
||||
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
||||
# file Copyright.txt or https://cmake.org/licensing for details.
|
||||
|
||||
#[=======================================================================[.rst:
|
||||
doctest
|
||||
-----
|
||||
|
||||
This module defines a function to help use the doctest test framework.
|
||||
|
||||
The :command:`doctest_discover_tests` discovers tests by asking the compiled test
|
||||
executable to enumerate its tests. This does not require CMake to be re-run
|
||||
when tests change. However, it may not work in a cross-compiling environment,
|
||||
and setting test properties is less convenient.
|
||||
|
||||
This command is intended to replace use of :command:`add_test` to register
|
||||
tests, and will create a separate CTest test for each doctest test case. Note
|
||||
that this is in some cases less efficient, as common set-up and tear-down logic
|
||||
cannot be shared by multiple test cases executing in the same instance.
|
||||
However, it provides more fine-grained pass/fail information to CTest, which is
|
||||
usually considered as more beneficial. By default, the CTest test name is the
|
||||
same as the doctest name; see also ``TEST_PREFIX`` and ``TEST_SUFFIX``.
|
||||
|
||||
.. command:: doctest_discover_tests
|
||||
|
||||
Automatically add tests with CTest by querying the compiled test executable
|
||||
for available tests::
|
||||
|
||||
doctest_discover_tests(target
|
||||
[TEST_SPEC arg1...]
|
||||
[EXTRA_ARGS arg1...]
|
||||
[WORKING_DIRECTORY dir]
|
||||
[TEST_PREFIX prefix]
|
||||
[TEST_SUFFIX suffix]
|
||||
[PROPERTIES name1 value1...]
|
||||
[TEST_LIST var]
|
||||
)
|
||||
|
||||
``doctest_discover_tests`` sets up a post-build command on the test executable
|
||||
that generates the list of tests by parsing the output from running the test
|
||||
with the ``--list-test-cases`` argument. This ensures that the full
|
||||
list of tests is obtained. Since test discovery occurs at build time, it is
|
||||
not necessary to re-run CMake when the list of tests changes.
|
||||
However, it requires that :prop_tgt:`CROSSCOMPILING_EMULATOR` is properly set
|
||||
in order to function in a cross-compiling environment.
|
||||
|
||||
Additionally, setting properties on tests is somewhat less convenient, since
|
||||
the tests are not available at CMake time. Additional test properties may be
|
||||
assigned to the set of tests as a whole using the ``PROPERTIES`` option. If
|
||||
more fine-grained test control is needed, custom content may be provided
|
||||
through an external CTest script using the :prop_dir:`TEST_INCLUDE_FILES`
|
||||
directory property. The set of discovered tests is made accessible to such a
|
||||
script via the ``<target>_TESTS`` variable.
|
||||
|
||||
The options are:
|
||||
|
||||
``target``
|
||||
Specifies the doctest executable, which must be a known CMake executable
|
||||
target. CMake will substitute the location of the built executable when
|
||||
running the test.
|
||||
|
||||
``TEST_SPEC arg1...``
|
||||
Specifies test cases, wildcarded test cases, tags and tag expressions to
|
||||
pass to the doctest executable with the ``--list-test-cases`` argument.
|
||||
|
||||
``EXTRA_ARGS arg1...``
|
||||
Any extra arguments to pass on the command line to each test case.
|
||||
|
||||
``WORKING_DIRECTORY dir``
|
||||
Specifies the directory in which to run the discovered test cases. If this
|
||||
option is not provided, the current binary directory is used.
|
||||
|
||||
``TEST_PREFIX prefix``
|
||||
Specifies a ``prefix`` to be prepended to the name of each discovered test
|
||||
case. This can be useful when the same test executable is being used in
|
||||
multiple calls to ``doctest_discover_tests()`` but with different
|
||||
``TEST_SPEC`` or ``EXTRA_ARGS``.
|
||||
|
||||
``TEST_SUFFIX suffix``
|
||||
Similar to ``TEST_PREFIX`` except the ``suffix`` is appended to the name of
|
||||
every discovered test case. Both ``TEST_PREFIX`` and ``TEST_SUFFIX`` may
|
||||
be specified.
|
||||
|
||||
``PROPERTIES name1 value1...``
|
||||
Specifies additional properties to be set on all tests discovered by this
|
||||
invocation of ``doctest_discover_tests``.
|
||||
|
||||
``TEST_LIST var``
|
||||
Make the list of tests available in the variable ``var``, rather than the
|
||||
default ``<target>_TESTS``. This can be useful when the same test
|
||||
executable is being used in multiple calls to ``doctest_discover_tests()``.
|
||||
Note that this variable is only available in CTest.
|
||||
|
||||
#]=======================================================================]
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
function(doctest_discover_tests TARGET)
|
||||
cmake_parse_arguments(
|
||||
""
|
||||
""
|
||||
"TEST_PREFIX;TEST_SUFFIX;WORKING_DIRECTORY;TEST_LIST"
|
||||
"TEST_SPEC;EXTRA_ARGS;PROPERTIES"
|
||||
${ARGN}
|
||||
)
|
||||
|
||||
if(NOT _WORKING_DIRECTORY)
|
||||
set(_WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}")
|
||||
endif()
|
||||
if(NOT _TEST_LIST)
|
||||
set(_TEST_LIST ${TARGET}_TESTS)
|
||||
endif()
|
||||
|
||||
## Generate a unique name based on the extra arguments
|
||||
string(SHA1 args_hash "${_TEST_SPEC} ${_EXTRA_ARGS}")
|
||||
string(SUBSTRING ${args_hash} 0 7 args_hash)
|
||||
|
||||
# Define rule to generate test list for aforementioned test executable
|
||||
set(ctest_include_file "${CMAKE_CURRENT_BINARY_DIR}/${TARGET}_include-${args_hash}.cmake")
|
||||
set(ctest_tests_file "${CMAKE_CURRENT_BINARY_DIR}/${TARGET}_tests-${args_hash}.cmake")
|
||||
get_property(crosscompiling_emulator
|
||||
TARGET ${TARGET}
|
||||
PROPERTY CROSSCOMPILING_EMULATOR
|
||||
)
|
||||
add_custom_command(
|
||||
TARGET ${TARGET} POST_BUILD
|
||||
BYPRODUCTS "${ctest_tests_file}"
|
||||
COMMAND "${CMAKE_COMMAND}"
|
||||
-D "TEST_TARGET=${TARGET}"
|
||||
-D "TEST_EXECUTABLE=$<TARGET_FILE:${TARGET}>"
|
||||
-D "TEST_EXECUTOR=${crosscompiling_emulator}"
|
||||
-D "TEST_WORKING_DIR=${_WORKING_DIRECTORY}"
|
||||
-D "TEST_SPEC=${_TEST_SPEC}"
|
||||
-D "TEST_EXTRA_ARGS=${_EXTRA_ARGS}"
|
||||
-D "TEST_PROPERTIES=${_PROPERTIES}"
|
||||
-D "TEST_PREFIX=${_TEST_PREFIX}"
|
||||
-D "TEST_SUFFIX=${_TEST_SUFFIX}"
|
||||
-D "TEST_LIST=${_TEST_LIST}"
|
||||
-D "CTEST_FILE=${ctest_tests_file}"
|
||||
-P "${_DOCTEST_DISCOVER_TESTS_SCRIPT}"
|
||||
VERBATIM
|
||||
)
|
||||
|
||||
file(WRITE "${ctest_include_file}"
|
||||
"if(EXISTS \"${ctest_tests_file}\")\n"
|
||||
" include(\"${ctest_tests_file}\")\n"
|
||||
"else()\n"
|
||||
" add_test(${TARGET}_NOT_BUILT-${args_hash} ${TARGET}_NOT_BUILT-${args_hash})\n"
|
||||
"endif()\n"
|
||||
)
|
||||
|
||||
if(NOT CMAKE_VERSION VERSION_LESS 3.10)
|
||||
# Add discovered tests to directory TEST_INCLUDE_FILES
|
||||
set_property(DIRECTORY
|
||||
APPEND PROPERTY TEST_INCLUDE_FILES "${ctest_include_file}"
|
||||
)
|
||||
else()
|
||||
# Add discovered tests as directory TEST_INCLUDE_FILE if possible
|
||||
get_property(test_include_file_set DIRECTORY PROPERTY TEST_INCLUDE_FILE SET)
|
||||
if(NOT ${test_include_file_set})
|
||||
set_property(DIRECTORY
|
||||
PROPERTY TEST_INCLUDE_FILE "${ctest_include_file}"
|
||||
)
|
||||
else()
|
||||
message(FATAL_ERROR
|
||||
"Cannot set more than one TEST_INCLUDE_FILE"
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
endfunction()
|
||||
|
||||
###############################################################################
|
||||
|
||||
set(_DOCTEST_DISCOVER_TESTS_SCRIPT
|
||||
${CMAKE_CURRENT_LIST_DIR}/doctestAddTests.cmake
|
||||
)
|
@@ -1,81 +0,0 @@
|
||||
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
||||
# file Copyright.txt or https://cmake.org/licensing for details.
|
||||
|
||||
set(prefix "${TEST_PREFIX}")
|
||||
set(suffix "${TEST_SUFFIX}")
|
||||
set(spec ${TEST_SPEC})
|
||||
set(extra_args ${TEST_EXTRA_ARGS})
|
||||
set(properties ${TEST_PROPERTIES})
|
||||
set(script)
|
||||
set(suite)
|
||||
set(tests)
|
||||
|
||||
function(add_command NAME)
|
||||
set(_args "")
|
||||
foreach(_arg ${ARGN})
|
||||
if(_arg MATCHES "[^-./:a-zA-Z0-9_]")
|
||||
set(_args "${_args} [==[${_arg}]==]") # form a bracket_argument
|
||||
else()
|
||||
set(_args "${_args} ${_arg}")
|
||||
endif()
|
||||
endforeach()
|
||||
set(script "${script}${NAME}(${_args})\n" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
# Run test executable to get list of available tests
|
||||
if(NOT EXISTS "${TEST_EXECUTABLE}")
|
||||
message(FATAL_ERROR
|
||||
"Specified test executable '${TEST_EXECUTABLE}' does not exist"
|
||||
)
|
||||
endif()
|
||||
|
||||
if("${spec}" MATCHES .)
|
||||
set(spec "--test-case=${spec}")
|
||||
endif()
|
||||
|
||||
execute_process(
|
||||
COMMAND ${TEST_EXECUTOR} "${TEST_EXECUTABLE}" ${spec} --list-test-cases
|
||||
OUTPUT_VARIABLE output
|
||||
RESULT_VARIABLE result
|
||||
)
|
||||
if(NOT ${result} EQUAL 0)
|
||||
message(FATAL_ERROR
|
||||
"Error running test executable '${TEST_EXECUTABLE}':\n"
|
||||
" Result: ${result}\n"
|
||||
" Output: ${output}\n"
|
||||
)
|
||||
endif()
|
||||
|
||||
string(REPLACE "\n" ";" output "${output}")
|
||||
|
||||
# Parse output
|
||||
foreach(line ${output})
|
||||
if("${line}" STREQUAL "===============================================================================" OR "${line}" MATCHES [==[^\[doctest\] ]==])
|
||||
continue()
|
||||
endif()
|
||||
set(test ${line})
|
||||
# use escape commas to handle properly test cases with commas inside the name
|
||||
string(REPLACE "," "\\," test_name ${test})
|
||||
# ...and add to script
|
||||
add_command(add_test
|
||||
"${prefix}${test}${suffix}"
|
||||
${TEST_EXECUTOR}
|
||||
"${TEST_EXECUTABLE}"
|
||||
"--test-case=${test_name}"
|
||||
${extra_args}
|
||||
)
|
||||
add_command(set_tests_properties
|
||||
"${prefix}${test}${suffix}"
|
||||
PROPERTIES
|
||||
WORKING_DIRECTORY "${TEST_WORKING_DIR}"
|
||||
${properties}
|
||||
)
|
||||
list(APPEND tests "${prefix}${test}${suffix}")
|
||||
endforeach()
|
||||
|
||||
# Create a list of all discovered tests, which users may use to e.g. set
|
||||
# properties on the tests
|
||||
add_command(set ${TEST_LIST} ${tests})
|
||||
|
||||
# Write CTest script
|
||||
file(WRITE "${CTEST_FILE}" "${script}")
|
@@ -2,7 +2,7 @@ with import <nixpkgs> {};
|
||||
stdenv.mkDerivation {
|
||||
name = "visualboyadvance-m";
|
||||
buildInputs = if stdenv.isDarwin then
|
||||
[ ninja cmake gcc nasm gettext pkg-config zip sfml zlib openal ffmpeg wxGTK32 SDL2 pcre pcre2 darwin.apple_sdk.frameworks.IOKit darwin.apple_sdk.frameworks.Carbon darwin.apple_sdk.frameworks.Cocoa darwin.apple_sdk.frameworks.QuartzCore darwin.apple_sdk.frameworks.AudioToolbox darwin.apple_sdk.frameworks.OpenGL darwin.apple_sdk.frameworks.OpenAL llvmPackages_latest.clang llvmPackages_latest.bintools ]
|
||||
[ ninja cmake nasm faudio gettext libintl libtiff pkg-config zip zlib openal ffmpeg wxGTK32 sdl3 pcre pcre2 llvmPackages_latest.clang llvmPackages_latest.bintools ]
|
||||
else
|
||||
[ ninja cmake gcc nasm gettext pkg-config zip sfml zlib openal ffmpeg wxGTK32 mesa glfw SDL2 gtk3-x11 pcre pcre2 util-linuxMinimal libselinux libsepol libthai libdatrie xorg.libXdmcp xorg.libXtst libxkbcommon epoxy dbus at-spi2-core ];
|
||||
[ ninja cmake gcc clang llvm llvmPackages.libcxx nasm faudio gettext libintl libtiff pkg-config zip zlib openal ffmpeg wxGTK32 libGL libGLU glfw sdl3 gtk3-x11 pcre pcre2 util-linuxMinimal libselinux libsepol libthai libdatrie xorg.libXdmcp xorg.libXtst libxkbcommon libepoxy dbus at-spi2-core ];
|
||||
}
|
||||
|
Submodule dependencies deleted from e8ce758a98
@@ -2,8 +2,6 @@
|
||||
Developer Information File
|
||||
==========================
|
||||
|
||||
|
||||
|
||||
Known preprocessor switches:
|
||||
- SDL: Defined for the SDL version
|
||||
- GBA_LOGGING: Enables logging for the GBA core
|
||||
@@ -13,47 +11,18 @@ Known preprocessor switches:
|
||||
- RGB555: Use 16bit colors with 5bit green instead of 6bit green in hq3x/4x filters (C++ version)
|
||||
- NO_OGL: Exclude OpenGL code
|
||||
- NO_D3D: Exclude Direct3D code
|
||||
- NO_OAL: Exclude OpenAL code
|
||||
- NO_XAUDIO2: Exclude XAudio2 code (the XAudio2 interface is DirectSound's successor)
|
||||
- VBAM_ENABLE_XAUDIO2: Enable XAudio2 code (the XAudio2 interface is DirectSound's successor)
|
||||
- VBAM_ENABLE_FAUDIO: Enable FAudio code (the FAudio interface is an open source multiplatform re-implementation of XAudio2)
|
||||
- NO_LINK: Exclude linking code (joybus, multilink, ...)
|
||||
- WIN64: This macro is only defined for 64 bit builds
|
||||
|
||||
|
||||
|
||||
Download locations:
|
||||
NASM: http://nasm.us/
|
||||
DirectX SDK: http://msdn.microsoft.com/en-us/xna/aa937788.aspx
|
||||
OpenAL SDK: http://connect.creativelabs.com/openal/default.aspx
|
||||
OpenGL files: http://www.opengl.org/registry/
|
||||
zlib: http://zlib.net/
|
||||
libpng: http://libpng.org/pub/png/libpng.html
|
||||
|
||||
You can find pre-built versions of zlib & libpng at:
|
||||
http://spacy51.sp.funpic.de/VBA-M/libs/
|
||||
Just extract them somewhere and point Visual C++ 2008 to the include & lib folders.
|
||||
They are built with the static C runtime (this is what the release builds use).
|
||||
|
||||
|
||||
|
||||
###########################
|
||||
# --- Build Systems --- #
|
||||
###########################
|
||||
|
||||
===Win32/MFC===
|
||||
This is the full-featured Windows build using the MFC GUI.
|
||||
The project files are located in /project/vc2008_mfc (VBA2008.sln) and /project/vs2010_mfc (VBA2010.sln).
|
||||
Anyone distributing builds should be using MSVC 2010 SP1, the unpatched release has a bug where it applies SSE2 updates to mov and other instructions resulting in illegal instruction errors on cpu's only supporting SSE.
|
||||
You also have to install Microsoft's DirectX SDK for Direct3D, DirectInput & XAudio2.
|
||||
If you want to enable OpenAL sound output, install the OpenAL SDK. If you do not want it, add NO_OAL to the VBA-M project's preprocessor definitions.
|
||||
SubWCRev.exe is used to append the svn versioning to the output executable, this as of TortoiseSVN 1.7, is only available by installing TortoiseSVN.
|
||||
All other dependencies for MSVC builds may be found in the ../dependencies directory (above /trunk).
|
||||
Normally, Windows users will want to checkout the root of the repository instead of just the trunk directory. Afterwards, simply opening the .sln of choice, setting preprocessor definitions, and hitting build is all that's required.
|
||||
|
||||
===*nix/GTK===
|
||||
===src/sdl===
|
||||
This is the standard build configuration on non-Windows.
|
||||
Running cmake will inform you of any packages you need to install.
|
||||
|
||||
===*/wxw===
|
||||
The wxWidgets interface is an in-development frontend meant to be more cross-platform friendly than MFC and GTK.
|
||||
===src/wx===
|
||||
The wxWidgets interface is an in-development frontend meant to be more cross-platform friendly than MFC and SDL.
|
||||
Running cmake will inform you of any packages you need to install.
|
||||
NOTE: In addition to what cmake currently checks for, you will also need the wxrc tool and libgdiplus.
|
116
installdeps
116
installdeps
@@ -1,7 +1,6 @@
|
||||
#!/bin/sh
|
||||
|
||||
CMAKE=cmake
|
||||
ENABLE_OPENAL=1
|
||||
ENABLE_FFMPEG=1
|
||||
|
||||
main() {
|
||||
@@ -25,10 +24,6 @@ check_command_line_args() {
|
||||
usage
|
||||
quit 0
|
||||
;;
|
||||
--no-openal)
|
||||
ENABLE_OPENAL=
|
||||
shift
|
||||
;;
|
||||
--no-ffmpeg)
|
||||
ENABLE_FFMPEG=
|
||||
shift
|
||||
@@ -196,7 +191,7 @@ freebsd_installdeps() {
|
||||
|
||||
check sudo pkg update
|
||||
|
||||
pkgs="llvm-devel cmake ccache nasm ffmpeg gettext-tools gettext pkgconf sdl2 sfml wx31-gtk3 iconv zip ninja"
|
||||
pkgs="llvm-devel cmake ccache nasm ffmpeg gettext-tools gettext pkgconf sdl3 wx31-gtk3 iconv zip ninja"
|
||||
|
||||
[ -n "$ENABLE_FFMPEG" ] && pkgs="$pkgs ffmpeg"
|
||||
|
||||
@@ -323,16 +318,8 @@ debian_installdeps() {
|
||||
if [ -z "$target" ]; then
|
||||
sudo apt-get -qq -y update
|
||||
|
||||
sfml_libs=
|
||||
|
||||
for lib in graphics window network; do
|
||||
sfml_libs="$sfml_libs $(apt-cache search "libsfml-$lib" | sed 's/ - .*//' | sort -r | head -1)"
|
||||
done
|
||||
|
||||
glew_lib=$(apt-cache search libglew | grep '^libglew[0-9]' | sed 's/ - .*//' | sort -r | head -1)
|
||||
|
||||
sdl_lib=$(apt-cache search '^libsdl2-2.0' | sed 's/ - .*//' | sort -r | head -1)
|
||||
|
||||
# not present in trusty
|
||||
if [ -n "$ENABLE_FFMPEG" ]; then
|
||||
libswresample_dev=$(apt-cache search libswresample-dev | awk '{print $1}')
|
||||
@@ -355,10 +342,12 @@ debian_installdeps() {
|
||||
;;
|
||||
esac
|
||||
|
||||
pkgs="build-essential g++ nasm cmake ccache gettext zlib1g-dev libgl1-mesa-dev libgettextpo-dev libsdl2-dev $sdl_lib libglu1-mesa-dev libglu1-mesa libgles2-mesa-dev libsfml-dev $sfml_libs $glew_lib $wx_libs libgtk2.0-dev libgtk-3-dev ccache zip ninja-build"
|
||||
sdl_lib=$(apt-cache search libsdl3-dev | grep libsdl3-dev | awk '{ print $1 }')
|
||||
[ -z "$sdl_lib" ] && sdl_lib=libsdl2-dev
|
||||
|
||||
[ -n "$ENABLE_OPENAL" ] && pkgs="$pkgs libopenal-dev"
|
||||
[ -n "$ENABLE_FFMPEG" ] && pkgs="$pkgs libavcodec-dev libavformat-dev libswscale-dev libavutil-dev $libswresample_dev"
|
||||
pkgs="build-essential g++ nasm cmake ccache gettext zlib1g-dev libgl1-mesa-dev libgettextpo-dev $sdl_lib libglu1-mesa-dev libglu1-mesa libgles2-mesa-dev $glew_lib $wx_libs libgtk2.0-dev libgtk-3-dev ccache zip ninja-build libopenal-dev"
|
||||
|
||||
[ -n "$ENABLE_FFMPEG" ] && pkgs="$pkgs libavcodec-dev libavformat-dev libswscale-dev libavutil-dev $libswresample_dev libx264-dev libx265-dev"
|
||||
|
||||
check sudo apt-get -qy install $pkgs
|
||||
else
|
||||
@@ -407,8 +396,7 @@ debian_installdeps() {
|
||||
fi
|
||||
fi
|
||||
|
||||
deps="gcc zlib ffmpeg gettext sdl2 sfml openal wxwidgets"
|
||||
[ -n "$ENABLE_OPENAL" ] && deps="$deps openal"
|
||||
deps="gcc zlib ffmpeg gettext sdl3 openal wxwidgets openal"
|
||||
[ -n "$ENABLE_FFMPEG" ] && deps="$deps ffmpeg"
|
||||
|
||||
set --
|
||||
@@ -505,14 +493,11 @@ fedora_installdeps() {
|
||||
# this is sometimes necessary for rawhide
|
||||
set -- --exclude='glibc32*'
|
||||
fi
|
||||
for pkg in zlib-devel mesa-libGL-devel ffmpeg-devel gettext-devel SDL2-devel SFML-devel openal-soft-devel wxGTK-devel gtk3-devel; do
|
||||
for pkg in zlib-devel mesa-libGL-devel ffmpeg-devel gettext-devel SDL3-devel openal-soft-devel wxGTK-devel gtk3-devel; do
|
||||
case $pkg in
|
||||
*ffmpeg*)
|
||||
[ -z "$ENABLE_FFMPEG" ] && continue
|
||||
;;
|
||||
*openal*)
|
||||
[ -z "$ENABLE_OPENAL" ] && continue
|
||||
;;
|
||||
esac
|
||||
|
||||
pkg_arch=
|
||||
@@ -601,20 +586,12 @@ fedora_installdeps() {
|
||||
;;
|
||||
esac
|
||||
# install static deps
|
||||
for pkg in zlib gettext SDL2 wxWidgets3; do
|
||||
for pkg in zlib gettext SDL3 wxWidgets3 openal-soft; do
|
||||
set -- "$@" "${target}-${pkg}-static"
|
||||
done
|
||||
# install deps that are not available as static
|
||||
if [ -n "$ENABLE_OPENAL" ]; then
|
||||
for pkg in openal-soft; do
|
||||
set -- "$@" "${target}-${pkg}"
|
||||
done
|
||||
fi
|
||||
|
||||
# get the necessary win32 headers
|
||||
git submodule update --init --remote --recursive
|
||||
|
||||
warning='SFML is required for LINK support, Fedora does not currently have a MinGW SFML package, if you want LINK support you will need to install it manually'
|
||||
fi
|
||||
|
||||
[ -z "$rpms_installed" ] && check sudo dnf -y --nogpgcheck --best --allowerasing install "$@"
|
||||
@@ -700,16 +677,11 @@ rhel_installdeps() {
|
||||
set -- --exclude='glibc32*'
|
||||
fi
|
||||
|
||||
warning='RHEL does not currently have SFML packages, LINK support will be disabled'
|
||||
|
||||
for pkg in zlib-devel mesa-libGL-devel ffmpeg-devel gettext-devel SDL2-devel openal-soft-devel wxGTK3-devel gtk3-devel; do
|
||||
for pkg in zlib-devel mesa-libGL-devel ffmpeg-devel gettext-devel SDL3-devel openal-soft-devel wxGTK3-devel gtk3-devel; do
|
||||
case $pkg in
|
||||
*ffmpeg*)
|
||||
[ -z "$ENABLE_FFMPEG" ] && continue
|
||||
;;
|
||||
*openal*)
|
||||
[ -z "$ENABLE_OPENAL" ] && continue
|
||||
;;
|
||||
esac
|
||||
|
||||
if [ -n "$amd64" ]; then
|
||||
@@ -790,20 +762,12 @@ rhel_installdeps() {
|
||||
;;
|
||||
esac
|
||||
# install static deps
|
||||
for pkg in zlib gettext SDL2 wxWidgets; do
|
||||
for pkg in zlib gettext SDL3 wxWidgets openal-soft; do
|
||||
set -- "$@" "${target}-${pkg}-static"
|
||||
done
|
||||
# install deps that are not available as static
|
||||
if [ -n "$ENABLE_OPENAL" ]; then
|
||||
for pkg in openal-soft; do
|
||||
set -- "$@" "${target}-${pkg}"
|
||||
done
|
||||
fi
|
||||
|
||||
# get the necessary win32 headers
|
||||
git submodule update --init --remote --recursive
|
||||
|
||||
warning='SFML is required for LINK support, RHEL/EPEL does not currently have a MinGW SFML package, if you want LINK support you will need to install it manually'
|
||||
fi
|
||||
|
||||
[ -z "$rpms_installed" ] && check sudo yum -y install "$@"
|
||||
@@ -822,15 +786,12 @@ suse_installdeps() {
|
||||
check_cross
|
||||
installing
|
||||
|
||||
tools="make cmake ccache nasm gettext-tools pkg-config ccache zip sfml2-devel ninja"
|
||||
tools="make cmake ccache nasm gettext-tools pkg-config ccache zip ninja"
|
||||
|
||||
libs="gcc gcc-c++ libSDL2-devel wxWidgets-3_0-devel" # ffmpeg-devel
|
||||
|
||||
[ -n "$ENABLE_OPENAL" ] && libs="$libs openal-soft-devel"
|
||||
# ffmpeg requires packman repos
|
||||
libs="gcc gcc-c++ SDL3-devel wxGTK3-3_2-devel openal-soft-devel ffmpeg-7-libavcodec-devel ffmpeg-7-libavdevice-devel ffmpeg-7-libavfilter-devel ffmpeg-7-libavformat-devel ffmpeg-7-libavutil-devel ffmpeg-7-libpostproc-devel ffmpeg-7-libswresample-devel ffmpeg-7-libswscale-devel"
|
||||
|
||||
if [ "$target" = m32 ]; then
|
||||
libs=$(echo "$libs" | sed -E 's/([^ ]) ([^ ])/\1-32bit \2/g; s/$/-32bit/;')
|
||||
error '32 bit cross builds are no longer supported on OpenSUSE'
|
||||
fi
|
||||
|
||||
check sudo zypper in -y $tools $libs
|
||||
@@ -894,9 +855,8 @@ archlinux_installdeps() {
|
||||
|
||||
$pacman -Q gtk3-classic >/dev/null 2>&1 && gtk=gtk3-classic
|
||||
|
||||
libs="zlib mesa gettext sdl2 wxgtk3 $gtk sfml"
|
||||
libs="zlib mesa gettext sdl3 wxgtk3 $gtk openal"
|
||||
|
||||
[ -n "$ENABLE_OPENAL" ] && libs="$libs openal"
|
||||
[ -n "$ENABLE_FFMPEG" ] && libs="$libs ffmpeg"
|
||||
|
||||
if [ -z "$target" -o "$target" = m32 ]; then
|
||||
@@ -911,7 +871,7 @@ archlinux_installdeps() {
|
||||
else
|
||||
# try to build 32 bit binaries
|
||||
|
||||
# lib32-sfml and lib32-ffmpeg are in AUR
|
||||
# lib32-ffmpeg is in AUR
|
||||
archlinux_require_yaourt
|
||||
|
||||
# enable multilib repos if not enabled
|
||||
@@ -991,9 +951,7 @@ EOF
|
||||
fi
|
||||
done
|
||||
|
||||
deps="zlib gettext pkg-config sdl2 wxmsw"
|
||||
|
||||
[ -n "$ENABLE_OPENAL" ] && deps="$deps openal"
|
||||
deps="zlib gettext pkg-config sdl3 wxmsw openal"
|
||||
|
||||
# and the actual deps
|
||||
for p in $deps; do
|
||||
@@ -1007,8 +965,6 @@ EOF
|
||||
|
||||
# get the necessary win32 headers
|
||||
git submodule update --init --remote --recursive
|
||||
|
||||
warning 'SFML is required for LINK support, the SFML package in AUR is currently broken, if you want LINK support you will need to install it manually'
|
||||
fi
|
||||
|
||||
build_instructions
|
||||
@@ -1024,9 +980,7 @@ solus_installdeps() {
|
||||
check sudo eopkg -y install -c system.devel
|
||||
check sudo eopkg -y install git ccache ninja
|
||||
|
||||
set -- sdl2-devel wxwidgets-devel libgtk-2-devel libgtk-3-devel libglu-devel
|
||||
|
||||
[ -n "$ENABLE_OPENAL" ] && set -- "$@" openal-soft-devel
|
||||
set -- sdl3-devel wxwidgets-devel libgtk-2-devel libgtk-3-devel libglu-devel openal-soft-devel
|
||||
|
||||
if [ -n "$amd64" -a "$target" = m32 ]; then
|
||||
info_msg 'Calculating dependencies, this will take a while..'
|
||||
@@ -1073,13 +1027,12 @@ solus_installdeps() {
|
||||
done
|
||||
else
|
||||
# no 32bit versions of these
|
||||
set -- "$@" SFML-devel ffmpeg-devel
|
||||
set -- "$@" ffmpeg-devel
|
||||
fi
|
||||
|
||||
check sudo eopkg -y install "$@"
|
||||
|
||||
if [ -n "$amd64" -a "$target" = m32 ]; then
|
||||
warning 'SFML is required for LINK support, there is no 32 bit SFML package in Solus currently, if you want LINK support you will need to install it manually'
|
||||
warning 'ffmpeg is required for game recording, there is no 32 bit ffmpeg package in Solus currently, you may wish to install it manually'
|
||||
fi
|
||||
|
||||
@@ -1100,16 +1053,14 @@ gentoo_installdeps() {
|
||||
dev-build/cmake \
|
||||
dev-util/ccache \
|
||||
sys-devel/binutils \
|
||||
media-libs/libsdl2 \
|
||||
media-libs/libsfml \
|
||||
media-libs/libsdl3 \
|
||||
media-libs/openal \
|
||||
x11-libs/wxGTK:$wx_slot \
|
||||
sys-libs/zlib \
|
||||
dev-util/pkgconf \
|
||||
dev-lang/nasm \
|
||||
dev-build/ninja"
|
||||
|
||||
[ -n "$ENABLE_OPENAL" ] && ebuilds="$ebuilds media-libs/openal"
|
||||
|
||||
[ -n "$ENABLE_FFMPEG" ] && ebuilds="$ebuilds media-video/ffmpeg"
|
||||
|
||||
check sudo emerge -vna $ebuilds
|
||||
@@ -1120,7 +1071,7 @@ gentoo_installdeps() {
|
||||
alpine_installdeps() {
|
||||
installing
|
||||
|
||||
check sudo apk add cmake ninja g++ ccache nasm gettext-dev zlib-dev mesa-dev sdl2-dev glu-dev sfml-dev wxwidgets-dev gtk+3.0-dev zip
|
||||
check sudo apk add cmake ninja g++ ccache nasm gettext-dev zlib-dev mesa-dev sdl3-dev glu-dev wxwidgets-dev gtk+3.0-dev zip
|
||||
|
||||
build_instructions
|
||||
}
|
||||
@@ -1150,11 +1101,19 @@ windows_installdeps() {
|
||||
*i686*)
|
||||
pkgs="$pkgs nasm"
|
||||
;;
|
||||
*)
|
||||
pkgs="$pkgs FAudio"
|
||||
;;
|
||||
esac
|
||||
|
||||
pkgs="$pkgs SDL2 sfml wxWidgets3.2 zlib binutils cmake crt-git extra-cmake-modules headers-git make pkgconf tools-git windows-default-manifest libmangle-git ninja gdb ccache"
|
||||
pkgs="$pkgs SDL3 wxWidgets3.2 zlib binutils cmake crt-git headers-git make pkgconf tools-git windows-default-manifest libmangle-git ninja gdb ccache openal"
|
||||
|
||||
case "$target" in
|
||||
*x86_64)
|
||||
pkgs="$pkgs extra-cmake-modules"
|
||||
;;
|
||||
esac
|
||||
|
||||
[ -n "$ENABLE_OPENAL" ] && pkgs="$pkgs openal"
|
||||
[ -n "$ENABLE_FFMPEG" ] && pkgs="$pkgs ffmpeg"
|
||||
|
||||
set --
|
||||
@@ -1219,15 +1178,10 @@ brew_installdeps() {
|
||||
|
||||
check brew -v update
|
||||
|
||||
brews="nasm cmake ccache gettext pkg-config sdl2 wxwidgets ccache ninja"
|
||||
brews="nasm cmake ccache gettext libtiff pkg-config sdl3 wxwidgets faudio ccache ninja zlib"
|
||||
|
||||
[ -n "$ENABLE_FFMPEG" ] && brews="$brews ffmpeg"
|
||||
|
||||
# sfml brew currently broken in the travis mac environment
|
||||
# if [ -z "$TRAVIS" ]; then
|
||||
brews="$brews sfml"
|
||||
# fi
|
||||
|
||||
# This is necessary for the GitHub Actions CI:
|
||||
brew -v install python
|
||||
brew link --overwrite python
|
||||
@@ -1250,7 +1204,7 @@ macports_installdeps() {
|
||||
|
||||
check sudo port -v selfupdate
|
||||
|
||||
ports="cmake ccache nasm gettext pkgconfig libsdl2 sfml wxWidgets-3.0 libiconv ninja"
|
||||
ports="cmake ccache nasm gettext pkgconfig libsdl3 wxWidgets-3.0 libiconv ninja"
|
||||
|
||||
[ -n "$ENABLE_FFMPEG" ] && ports="$ports ffmpeg"
|
||||
|
||||
@@ -1266,7 +1220,7 @@ fink_installdeps() {
|
||||
|
||||
check sudo fink -vy selfupdate
|
||||
|
||||
pkgs="cmake ccache nasm libgettext8-dev gettext-tools pkgconfig sdl2 wxwidgets300-osxcocoa libiconv-dev sfml24-dev ccache ninja"
|
||||
pkgs="cmake ccache nasm libgettext8-dev gettext-tools pkgconfig sdl3 wxwidgets300-osxcocoa libiconv-dev ccache ninja"
|
||||
|
||||
[ -n "$ENABLE_FFMPEG" ] && pkgs="$pkgs ffmpeg"
|
||||
|
||||
|
2649
po/wxvbam/bg.po
2649
po/wxvbam/bg.po
File diff suppressed because it is too large
Load Diff
2649
po/wxvbam/br.po
2649
po/wxvbam/br.po
File diff suppressed because it is too large
Load Diff
2649
po/wxvbam/cs.po
2649
po/wxvbam/cs.po
File diff suppressed because it is too large
Load Diff
2684
po/wxvbam/el.po
2684
po/wxvbam/el.po
File diff suppressed because it is too large
Load Diff
@@ -1560,6 +1560,14 @@ msgstr ""
|
||||
msgid "Using interframe blending: %s"
|
||||
msgstr ""
|
||||
|
||||
#: xrc/DisplayConfig.xrc
|
||||
msgid "Bit Depth"
|
||||
msgstr "Bits per pixel"
|
||||
|
||||
#: xrc/DisplayConfig.xrc
|
||||
msgid "Bit Depth:"
|
||||
msgstr "Bits per pixel:"
|
||||
|
||||
#: dialogs/game-boy-config.cpp:142 xrc/GameBoyAdvanceConfig.xrc:122
|
||||
#: xrc/GameBoyConfig.xrc:138 xrc/GameBoyConfig.xrc:159
|
||||
msgid "(None)"
|
||||
|
2819
po/wxvbam/es.po
2819
po/wxvbam/es.po
File diff suppressed because it is too large
Load Diff
2831
po/wxvbam/es_419.po
2831
po/wxvbam/es_419.po
File diff suppressed because it is too large
Load Diff
@@ -1553,6 +1553,14 @@ msgstr "No usable rpi plugins found in %s"
|
||||
msgid "Plugin"
|
||||
msgstr "Plugin"
|
||||
|
||||
#: xrc/DisplayConfig.xrc
|
||||
msgid "Bit Depth"
|
||||
msgstr "Bits per píxel"
|
||||
|
||||
#: xrc/DisplayConfig.xrc
|
||||
msgid "Bit Depth:"
|
||||
msgstr "Bits per píxel:"
|
||||
|
||||
#: dialogs/display-config.cpp:417
|
||||
#, c-format
|
||||
msgid "Using pixel filter: %s"
|
||||
|
@@ -1549,6 +1549,14 @@ msgstr "No usable rpi plugins found in %s"
|
||||
msgid "Plugin"
|
||||
msgstr "Plugin"
|
||||
|
||||
#: xrc/DisplayConfig.xrc
|
||||
msgid "Bit Depth"
|
||||
msgstr "Bits per píxel"
|
||||
|
||||
#: xrc/DisplayConfig.xrc
|
||||
msgid "Bit Depth:"
|
||||
msgstr "Bits per píxel:"
|
||||
|
||||
#: dialogs/display-config.cpp:417
|
||||
#, c-format
|
||||
msgid "Using pixel filter: %s"
|
||||
|
@@ -1549,6 +1549,14 @@ msgstr "No usable rpi plugins found in %s"
|
||||
msgid "Plugin"
|
||||
msgstr "Plugin"
|
||||
|
||||
#: xrc/DisplayConfig.xrc
|
||||
msgid "Bit Depth"
|
||||
msgstr "Bits per píxel"
|
||||
|
||||
#: xrc/DisplayConfig.xrc
|
||||
msgid "Bit Depth:"
|
||||
msgstr "Bits per píxel:"
|
||||
|
||||
#: dialogs/display-config.cpp:417
|
||||
#, c-format
|
||||
msgid "Using pixel filter: %s"
|
||||
|
@@ -1563,6 +1563,14 @@ msgstr "Extension rpi utilisable non trouvée dans %s"
|
||||
msgid "Plugin"
|
||||
msgstr "Extension"
|
||||
|
||||
#: xrc/DisplayConfig.xrc
|
||||
msgid "Bit Depth"
|
||||
msgstr "Bits par pixel"
|
||||
|
||||
#: xrc/DisplayConfig.xrc
|
||||
msgid "Bit Depth:"
|
||||
msgstr "Bits par pixel:"
|
||||
|
||||
#: dialogs/display-config.cpp:417
|
||||
#, c-format
|
||||
msgid "Using pixel filter: %s"
|
||||
|
3338
po/wxvbam/fr_FR.po
3338
po/wxvbam/fr_FR.po
File diff suppressed because it is too large
Load Diff
2649
po/wxvbam/gl.po
2649
po/wxvbam/gl.po
File diff suppressed because it is too large
Load Diff
2649
po/wxvbam/he_IL.po
2649
po/wxvbam/he_IL.po
File diff suppressed because it is too large
Load Diff
@@ -1549,6 +1549,14 @@ msgstr "A %s helyen nincs használható RPI bővítmény"
|
||||
msgid "Plugin"
|
||||
msgstr "Bővítmény"
|
||||
|
||||
#: xrc/DisplayConfig.xrc
|
||||
msgid "Bit Depth"
|
||||
msgstr "Bit per pixel"
|
||||
|
||||
#: xrc/DisplayConfig.xrc
|
||||
msgid "Bit Depth:"
|
||||
msgstr "Bit per pixel:"
|
||||
|
||||
#: dialogs/display-config.cpp:417
|
||||
#, c-format
|
||||
msgid "Using pixel filter: %s"
|
||||
|
2651
po/wxvbam/hu_HU.po
2651
po/wxvbam/hu_HU.po
File diff suppressed because it is too large
Load Diff
3171
po/wxvbam/id.po
3171
po/wxvbam/id.po
File diff suppressed because it is too large
Load Diff
2666
po/wxvbam/it_IT.po
2666
po/wxvbam/it_IT.po
File diff suppressed because it is too large
Load Diff
2666
po/wxvbam/ja.po
2666
po/wxvbam/ja.po
File diff suppressed because it is too large
Load Diff
@@ -1552,6 +1552,14 @@ msgstr "%s에서 사용가능한 rpi 플러그인을 찾을 수 없음"
|
||||
msgid "Plugin"
|
||||
msgstr "플러그인"
|
||||
|
||||
#: xrc/DisplayConfig.xrc
|
||||
msgid "Bit Depth"
|
||||
msgstr "픽셀당 비트"
|
||||
|
||||
#: xrc/DisplayConfig.xrc
|
||||
msgid "Bit Depth:"
|
||||
msgstr "픽셀당 비트:"
|
||||
|
||||
#: dialogs/display-config.cpp:417
|
||||
#, c-format
|
||||
msgid "Using pixel filter: %s"
|
||||
|
3131
po/wxvbam/ko_KR.po
3131
po/wxvbam/ko_KR.po
File diff suppressed because it is too large
Load Diff
2649
po/wxvbam/ms_MY.po
2649
po/wxvbam/ms_MY.po
File diff suppressed because it is too large
Load Diff
2649
po/wxvbam/nb.po
2649
po/wxvbam/nb.po
File diff suppressed because it is too large
Load Diff
2649
po/wxvbam/nl.po
2649
po/wxvbam/nl.po
File diff suppressed because it is too large
Load Diff
@@ -1552,6 +1552,14 @@ msgstr "Nie znaleziono użytecznych wtyczek rpi w %s"
|
||||
msgid "Plugin"
|
||||
msgstr "Wtyczka"
|
||||
|
||||
#: xrc/DisplayConfig.xrc
|
||||
msgid "Bit Depth"
|
||||
msgstr "Bity na piksel"
|
||||
|
||||
#: xrc/DisplayConfig.xrc
|
||||
msgid "Bit Depth:"
|
||||
msgstr "Bity na piksel:"
|
||||
|
||||
#: dialogs/display-config.cpp:417
|
||||
#, c-format
|
||||
msgid "Using pixel filter: %s"
|
||||
|
2657
po/wxvbam/pl_PL.po
2657
po/wxvbam/pl_PL.po
File diff suppressed because it is too large
Load Diff
2654
po/wxvbam/pt_BR.po
2654
po/wxvbam/pt_BR.po
File diff suppressed because it is too large
Load Diff
2249
po/wxvbam/pt_PT.po
2249
po/wxvbam/pt_PT.po
File diff suppressed because it is too large
Load Diff
2666
po/wxvbam/ru_RU.po
2666
po/wxvbam/ru_RU.po
File diff suppressed because it is too large
Load Diff
3056
po/wxvbam/sv.po
3056
po/wxvbam/sv.po
File diff suppressed because it is too large
Load Diff
2658
po/wxvbam/tr.po
2658
po/wxvbam/tr.po
File diff suppressed because it is too large
Load Diff
2699
po/wxvbam/uk.po
2699
po/wxvbam/uk.po
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
2661
po/wxvbam/wxvbam.pot
2661
po/wxvbam/wxvbam.pot
File diff suppressed because it is too large
Load Diff
3802
po/wxvbam/zh-Hans.po
3802
po/wxvbam/zh-Hans.po
File diff suppressed because it is too large
Load Diff
3706
po/wxvbam/zh.po
3706
po/wxvbam/zh.po
File diff suppressed because it is too large
Load Diff
2700
po/wxvbam/zh_CN.po
2700
po/wxvbam/zh_CN.po
File diff suppressed because it is too large
Load Diff
BIN
resource.xrs
Normal file
BIN
resource.xrs
Normal file
Binary file not shown.
@@ -19,8 +19,6 @@ parts:
|
||||
cmake-generator: Ninja
|
||||
stage-packages:
|
||||
- libsdl2-2.0-0
|
||||
- libsfml-network2.5
|
||||
- libsfml-system2.5
|
||||
- libnotify4
|
||||
- libsm6
|
||||
- libopenal1
|
||||
@@ -46,12 +44,10 @@ parts:
|
||||
- zip
|
||||
- libnotify-dev
|
||||
- libsdl2-dev
|
||||
- libsfml-dev
|
||||
- libgtk-3-dev
|
||||
- libopenal-dev
|
||||
- libwxgtk3.0-gtk3-dev
|
||||
cmake-parameters:
|
||||
- -DENABLE_OPENAL=ON
|
||||
- -DENABLE_SDL=OFF
|
||||
- -DCMAKE_INSTALL_PREFIX=/usr
|
||||
|
||||
|
@@ -1,7 +1,7 @@
|
||||
add_subdirectory(audio_sdl)
|
||||
add_subdirectory(av_recording)
|
||||
add_subdirectory(draw_text)
|
||||
add_subdirectory(filters)
|
||||
add_subdirectory(filters_agb)
|
||||
add_subdirectory(filters_cgb)
|
||||
add_subdirectory(filters_interframe)
|
||||
add_subdirectory(user_config)
|
||||
|
@@ -1,14 +0,0 @@
|
||||
add_library(vbam-components-audio-sdl OBJECT)
|
||||
|
||||
target_sources(vbam-components-audio-sdl
|
||||
PRIVATE audio_sdl.cpp
|
||||
PUBLIC audio_sdl.h
|
||||
)
|
||||
|
||||
target_include_directories(vbam-components-audio-sdl
|
||||
PUBLIC ${SDL2_INCLUDE_DIRS}
|
||||
)
|
||||
|
||||
target_link_libraries(vbam-components-audio-sdl
|
||||
PUBLIC vbam-core-base ${VBAM_SDL2_LIBS}
|
||||
)
|
@@ -119,36 +119,54 @@ recording::MediaRet recording::MediaRecorder::setup_audio_stream()
|
||||
// audio codec context
|
||||
aenc = avcodec_alloc_context3(acodec);
|
||||
if (!aenc) return MRET_ERR_BUFSIZE;
|
||||
#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(61, 13, 100)
|
||||
aenc->sample_fmt = acodec->sample_fmts ? acodec->sample_fmts[0] : AV_SAMPLE_FMT_FLTP;
|
||||
#else
|
||||
const enum AVSampleFormat *sample_fmts = NULL;
|
||||
if (acodec) {
|
||||
avcodec_get_supported_config (aenc, acodec, AV_CODEC_CONFIG_SAMPLE_FORMAT, 0,
|
||||
(const void **)&sample_fmts, NULL);
|
||||
aenc->sample_fmt = sample_fmts ? sample_fmts[0] : AV_SAMPLE_FMT_FLTP;
|
||||
}
|
||||
#endif
|
||||
aenc->bit_rate = 128000; // mp3
|
||||
aenc->sample_rate = sampleRate;
|
||||
// this might be useful to check if the codec suports the
|
||||
// sample rate, but it is not strictly needed for now
|
||||
bool isSupported = false;
|
||||
#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(61, 13, 100)
|
||||
if (acodec->supported_samplerates)
|
||||
{
|
||||
for (int i = 0; acodec->supported_samplerates[i]; ++i)
|
||||
{
|
||||
if (acodec->supported_samplerates[i] == sampleRate)
|
||||
#else
|
||||
const int *supported_samplerates = NULL;
|
||||
int num_supported_samplerates = 0;
|
||||
if (acodec) {
|
||||
avcodec_get_supported_config(aenc, acodec, AV_CODEC_CONFIG_SAMPLE_RATE, 0,
|
||||
(const void **) &supported_samplerates, &num_supported_samplerates);
|
||||
for (int i = 0; i < num_supported_samplerates; i++)
|
||||
{
|
||||
if (supported_samplerates[i] == sampleRate)
|
||||
#endif
|
||||
{
|
||||
isSupported = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(61, 13, 100)
|
||||
if (!isSupported && acodec->supported_samplerates) return MRET_ERR_NOCODEC;
|
||||
aenc->channels = av_get_channel_layout_nb_channels(aenc->channel_layout);
|
||||
#else
|
||||
if (!isSupported && num_supported_samplerates) return MRET_ERR_NOCODEC;
|
||||
#endif
|
||||
#if LIBAVCODEC_VERSION_MAJOR >= 60
|
||||
av_channel_layout_from_mask(&(aenc->ch_layout), AV_CH_LAYOUT_STEREO);
|
||||
#else
|
||||
aenc->channel_layout = AV_CH_LAYOUT_STEREO;
|
||||
if (acodec->channel_layouts)
|
||||
{
|
||||
aenc->channel_layout = acodec->channel_layouts[0];
|
||||
for (int i = 0; acodec->channel_layouts[i]; ++i)
|
||||
{
|
||||
if (acodec->channel_layouts[i] == AV_CH_LAYOUT_STEREO)
|
||||
aenc->channel_layout = AV_CH_LAYOUT_STEREO;
|
||||
}
|
||||
}
|
||||
aenc->channels = av_get_channel_layout_nb_channels(aenc->channel_layout);
|
||||
aenc->channels = 2;
|
||||
#endif
|
||||
aenc->time_base = { 1, aenc->sample_rate };
|
||||
ast->time_base = { 1, STREAM_FRAME_RATE };
|
||||
// open and use codec on stream
|
||||
@@ -169,7 +187,11 @@ recording::MediaRet recording::MediaRecorder::setup_audio_stream()
|
||||
audioframeTmp = av_frame_alloc();
|
||||
if (!audioframeTmp) return MRET_ERR_BUFSIZE;
|
||||
audioframeTmp->format = IN_SOUND_FORMAT;
|
||||
audioframeTmp->channel_layout = aenc->channel_layout;
|
||||
#if LIBAVCODEC_VERSION_MAJOR >= 60
|
||||
audioframeTmp->ch_layout = aenc->ch_layout;
|
||||
#else
|
||||
audioframeTmp->channel_layout = AV_CH_LAYOUT_STEREO;
|
||||
#endif
|
||||
audioframeTmp->sample_rate = aenc->sample_rate;
|
||||
audioframeTmp->nb_samples = nb_samples;
|
||||
if (nb_samples)
|
||||
@@ -181,7 +203,11 @@ recording::MediaRet recording::MediaRecorder::setup_audio_stream()
|
||||
audioframe = av_frame_alloc();
|
||||
if (!audioframe) return MRET_ERR_BUFSIZE;
|
||||
audioframe->format = aenc->sample_fmt;
|
||||
audioframe->channel_layout = aenc->channel_layout;
|
||||
#if LIBAVCODEC_VERSION_MAJOR >= 60
|
||||
audioframe->ch_layout = aenc->ch_layout;
|
||||
#else
|
||||
audioframe->channel_layout = AV_CH_LAYOUT_STEREO;
|
||||
#endif
|
||||
audioframe->sample_rate = aenc->sample_rate;
|
||||
audioframe->nb_samples = nb_samples;
|
||||
if (nb_samples)
|
||||
@@ -195,10 +221,15 @@ recording::MediaRet recording::MediaRecorder::setup_audio_stream()
|
||||
{
|
||||
return MRET_ERR_BUFSIZE;
|
||||
}
|
||||
av_opt_set_int (swr, "in_channel_count", aenc->channels, 0);
|
||||
#if LIBAVCODEC_VERSION_MAJOR >= 60
|
||||
av_opt_set_chlayout (swr, "in_chlayout", &(aenc->ch_layout),0);
|
||||
av_opt_set_chlayout (swr, "out_chlayout", &(aenc->ch_layout),0);
|
||||
#else
|
||||
av_opt_set_int (swr, "in_channel_count", 2, 0);
|
||||
av_opt_set_int (swr, "out_channel_count", 2, 0);
|
||||
#endif
|
||||
av_opt_set_int (swr, "in_sample_rate", aenc->sample_rate, 0);
|
||||
av_opt_set_sample_fmt(swr, "in_sample_fmt", IN_SOUND_FORMAT, 0);
|
||||
av_opt_set_int (swr, "out_channel_count", aenc->channels, 0);
|
||||
av_opt_set_int (swr, "out_sample_rate", aenc->sample_rate, 0);
|
||||
av_opt_set_sample_fmt(swr, "out_sample_fmt", aenc->sample_fmt, 0);
|
||||
if (swr_init(swr) < 0)
|
||||
@@ -207,8 +238,8 @@ recording::MediaRet recording::MediaRecorder::setup_audio_stream()
|
||||
return MRET_ERR_BUFSIZE;
|
||||
}
|
||||
// auxiliary buffer for setting up frames for encode
|
||||
audioBufferSize = nb_samples * aenc->channels * sizeof(uint16_t);
|
||||
audioBuffer = (uint16_t *) calloc(nb_samples * aenc->channels, sizeof(uint16_t));
|
||||
audioBufferSize = nb_samples * 2 * sizeof(uint16_t);
|
||||
audioBuffer = (uint16_t *) calloc(nb_samples * 2, sizeof(uint16_t));
|
||||
if (!audioBuffer) return MRET_ERR_BUFSIZE;
|
||||
samplesInAudioBuffer = 0;
|
||||
posInAudioBuffer = 0;
|
||||
@@ -219,6 +250,9 @@ recording::MediaRet recording::MediaRecorder::setup_video_stream_info(int width,
|
||||
{
|
||||
switch (depth)
|
||||
{
|
||||
case 8:
|
||||
pixfmt = AV_PIX_FMT_RGB8;
|
||||
break;
|
||||
case 16:
|
||||
// FIXME: test & make endian-neutral
|
||||
pixfmt = AV_PIX_FMT_RGB565LE;
|
||||
@@ -243,6 +277,9 @@ recording::MediaRet recording::MediaRecorder::setup_video_stream_info(int width,
|
||||
linesize = pixsize * width;
|
||||
switch (pixsize)
|
||||
{
|
||||
case 1:
|
||||
tbord = 1; rbord = 4;
|
||||
break;
|
||||
case 2:
|
||||
// 16-bit: 2 @ right, 1 @ top
|
||||
tbord = 1; rbord = 2;
|
||||
@@ -448,7 +485,9 @@ void recording::MediaRecorder::Stop(bool initSuccess)
|
||||
if (enc)
|
||||
{
|
||||
avcodec_free_context(&enc);
|
||||
#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(61, 13, 100)
|
||||
avcodec_close(enc);
|
||||
#endif
|
||||
enc = NULL;
|
||||
}
|
||||
if (vcodec)
|
||||
@@ -497,7 +536,9 @@ void recording::MediaRecorder::Stop(bool initSuccess)
|
||||
if (aenc)
|
||||
{
|
||||
avcodec_free_context(&aenc);
|
||||
#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(61, 13, 100)
|
||||
avcodec_close(aenc);
|
||||
#endif
|
||||
aenc = NULL;
|
||||
}
|
||||
samplesCount = 0;
|
||||
@@ -565,7 +606,7 @@ recording::MediaRet recording::MediaRecorder::AddFrame(const uint16_t *aud, int
|
||||
{
|
||||
if (!isRecording) return MRET_OK;
|
||||
AVCodecContext *c = aenc;
|
||||
int samples_size = av_samples_get_buffer_size(NULL, c->channels, audioframeTmp->nb_samples, IN_SOUND_FORMAT, 1);
|
||||
int samples_size = av_samples_get_buffer_size(NULL, 2, audioframeTmp->nb_samples, IN_SOUND_FORMAT, 1);
|
||||
|
||||
int realLength = length / sizeof *aud;
|
||||
bool isMissing = false;
|
||||
@@ -606,12 +647,12 @@ recording::MediaRet recording::MediaRecorder::AddFrame(const uint16_t *aud, int
|
||||
pkt->data = NULL;
|
||||
pkt->size = 0;
|
||||
|
||||
if (avcodec_fill_audio_frame(audioframeTmp, c->channels, IN_SOUND_FORMAT, (const uint8_t *)audioBuffer, samples_size, 1) < 0)
|
||||
if (avcodec_fill_audio_frame(audioframeTmp, 2, IN_SOUND_FORMAT, (const uint8_t *)audioBuffer, samples_size, 1) < 0)
|
||||
{
|
||||
return MRET_ERR_RECORDING;
|
||||
}
|
||||
|
||||
int dst_nb_samples = av_rescale_rnd(swr_get_delay(swr, c->sample_rate) + audioframeTmp->nb_samples, c->sample_rate, c->sample_rate, AV_ROUND_UP);
|
||||
int64_t dst_nb_samples = av_rescale_rnd(swr_get_delay(swr, c->sample_rate) + audioframeTmp->nb_samples, c->sample_rate, c->sample_rate, AV_ROUND_UP);
|
||||
av_assert0(dst_nb_samples == audioframeTmp->nb_samples);
|
||||
|
||||
if (swr_convert(swr, audioframe->data, audioframe->nb_samples, (const uint8_t **)audioframeTmp->data, audioframeTmp->nb_samples) < 0)
|
||||
|
@@ -105,7 +105,7 @@ class MediaRecorder
|
||||
const AVCodec *acodec;
|
||||
AVStream *ast;
|
||||
AVCodecContext *aenc;
|
||||
int samplesCount; // for audio frame pts generation
|
||||
int64_t samplesCount; // for audio frame pts generation
|
||||
AVFrame *audioframe;
|
||||
AVFrame *audioframeTmp;
|
||||
// audio buffer
|
||||
|
@@ -58,7 +58,7 @@ void drawText(uint8_t* screen, int pitch, int x, int y,
|
||||
char c = *string++;
|
||||
uint8_t* scr = screen;
|
||||
|
||||
uint16_t mask = ~RGB_LOW_BITS_MASK;
|
||||
uint16_t mask = (uint16_t)(~RGB_LOW_BITS_MASK);
|
||||
int h, w;
|
||||
uint16_t* s = (uint16_t*)scr;
|
||||
for (h = 0; h < 8; h++) {
|
||||
|
@@ -1,5 +1,13 @@
|
||||
add_library(vbam-components-filters OBJECT)
|
||||
|
||||
unset(extra_src)
|
||||
if(WINXP)
|
||||
list(APPEND extra_src
|
||||
${CMAKE_SOURCE_DIR}/third_party/quake3-sqrt/quake3-sqrt.h
|
||||
)
|
||||
target_include_directories(vbam-components-filters PRIVATE ${CMAKE_SOURCE_DIR}/third_party/quake3-sqrt)
|
||||
endif()
|
||||
|
||||
target_sources(vbam-components-filters
|
||||
PRIVATE
|
||||
internal/2xSaI.cpp
|
||||
@@ -17,6 +25,7 @@ target_sources(vbam-components-filters
|
||||
internal/xBRZ/xbrz_config.h
|
||||
internal/xBRZ/xbrz_tools.h
|
||||
internal/xbrzfilter.cpp
|
||||
${extra_src}
|
||||
|
||||
PUBLIC
|
||||
filters.h
|
||||
|
@@ -45,11 +45,11 @@ void lq2x(uint8_t* src, uint32_t spitch, uint8_t*, uint8_t* dst, uint32_t dstp,
|
||||
// in any case, they are worthless, since all renderers do "simple" or
|
||||
// better by default
|
||||
void Simple2x32(uint8_t* src, uint32_t spitch, uint8_t*, uint8_t* dst, uint32_t dstp, int w, int h);
|
||||
void Simple2x(uint8_t* src, uint32_t spitch, uint8_t*, uint8_t* dst, uint32_t dstp, int w, int h);
|
||||
void Simple2x16(uint8_t* src, uint32_t spitch, uint8_t*, uint8_t* dst, uint32_t dstp, int w, int h);
|
||||
void Simple3x32(uint8_t* src, uint32_t spitch, uint8_t*, uint8_t* dst, uint32_t dstp, int w, int h);
|
||||
void Simple3x(uint8_t* src, uint32_t spitch, uint8_t*, uint8_t* dst, uint32_t dstp, int w, int h);
|
||||
void Simple3x16(uint8_t* src, uint32_t spitch, uint8_t*, uint8_t* dst, uint32_t dstp, int w, int h);
|
||||
void Simple4x32(uint8_t* src, uint32_t spitch, uint8_t*, uint8_t* dst, uint32_t dstp, int w, int h);
|
||||
void Simple4x(uint8_t* src, uint32_t spitch, uint8_t*, uint8_t* dst, uint32_t dstp, int w, int h);
|
||||
void Simple4x16(uint8_t* src, uint32_t spitch, uint8_t*, uint8_t* dst, uint32_t dstp, int w, int h);
|
||||
// note: 16-bit input for asm version only!
|
||||
void hq3x32(uint8_t* src, uint32_t spitch, uint8_t*, uint8_t* dst, uint32_t dstp, int w, int h);
|
||||
// this takes 32-bit input
|
||||
|
@@ -26,10 +26,6 @@ extern "C"
|
||||
bool cpu_mmx = 1;
|
||||
#endif
|
||||
}
|
||||
static uint32_t colorMask = 0xF7DEF7DE;
|
||||
static uint32_t lowPixelMask = 0x08210821;
|
||||
static uint32_t qcolorMask = 0xE79CE79C;
|
||||
static uint32_t qlowpixelMask = 0x18631863;
|
||||
static uint32_t redblueMask = 0xF81F;
|
||||
static uint32_t greenMask = 0x7E0;
|
||||
|
||||
@@ -41,20 +37,12 @@ int Init_2xSaI(uint32_t BitFormat)
|
||||
{
|
||||
if(systemColorDepth == 16) {
|
||||
if (BitFormat == 565) {
|
||||
colorMask = 0xF7DEF7DE;
|
||||
lowPixelMask = 0x08210821;
|
||||
qcolorMask = 0xE79CE79C;
|
||||
qlowpixelMask = 0x18631863;
|
||||
redblueMask = 0xF81F;
|
||||
greenMask = 0x7E0;
|
||||
qRGB_COLOR_MASK[0] = qRGB_COLOR_MASK[1] = 0xF7DEF7DE;
|
||||
hq2x_init(16);
|
||||
RGB_LOW_BITS_MASK = 0x0821;
|
||||
} else if (BitFormat == 555) {
|
||||
colorMask = 0x7BDE7BDE;
|
||||
lowPixelMask = 0x04210421;
|
||||
qcolorMask = 0x739C739C;
|
||||
qlowpixelMask = 0x0C630C63;
|
||||
redblueMask = 0x7C1F;
|
||||
greenMask = 0x3E0;
|
||||
qRGB_COLOR_MASK[0] = qRGB_COLOR_MASK[1] = 0x7BDE7BDE;
|
||||
@@ -64,10 +52,6 @@ int Init_2xSaI(uint32_t BitFormat)
|
||||
return 0;
|
||||
}
|
||||
} else if(systemColorDepth == 32) {
|
||||
colorMask = 0xfefefe;
|
||||
lowPixelMask = 0x010101;
|
||||
qcolorMask = 0xfcfcfc;
|
||||
qlowpixelMask = 0x030303;
|
||||
qRGB_COLOR_MASK[0] = qRGB_COLOR_MASK[1] = 0xfefefe;
|
||||
hq2x_init(32);
|
||||
RGB_LOW_BITS_MASK = 0x010101;
|
||||
@@ -146,25 +130,24 @@ static inline int GetResult (uint32_t A, uint32_t B, uint32_t C, uint32_t D)
|
||||
return r;
|
||||
}
|
||||
|
||||
static inline uint32_t INTERPOLATE (uint32_t A, uint32_t B)
|
||||
{
|
||||
if (A != B) {
|
||||
return (((A & colorMask) >> 1) + ((B & colorMask) >> 1) +
|
||||
(A & B & lowPixelMask));
|
||||
} else
|
||||
return A;
|
||||
static inline uint32_t INTERPOLATE(uint32_t A, uint32_t B) {
|
||||
if (A == B) {
|
||||
return A;
|
||||
}
|
||||
return (
|
||||
(((((A >> 16) & 0xFF) & 0xFE) >> 1) + ((((B >> 16) & 0xFF) & 0xFE) >> 1) + (((A >> 16) & 0xFF) & ((B >> 16) & 0xFF) & 0x01)) << 16) |
|
||||
((((((A >> 8) & 0xFF) & 0xFE) >> 1) + ((((B >> 8) & 0xFF) & 0xFE) >> 1) + (((A >> 8) & 0xFF) & ((B >> 8) & 0xFF) & 0x01)) << 8) |
|
||||
(((((A & 0xFF) & 0xFE) >> 1) + (((B & 0xFF) & 0xFE) >> 1) + ((A & 0xFF) & (B & 0xFF) & 0x01)));
|
||||
}
|
||||
|
||||
static inline uint32_t Q_INTERPOLATE (uint32_t A, uint32_t B, uint32_t C, uint32_t D)
|
||||
{
|
||||
uint32_t x = ((A & qcolorMask) >> 2) +
|
||||
((B & qcolorMask) >> 2) +
|
||||
((C & qcolorMask) >> 2) + ((D & qcolorMask) >> 2);
|
||||
uint32_t y = (A & qlowpixelMask) +
|
||||
(B & qlowpixelMask) + (C & qlowpixelMask) + (D & qlowpixelMask);
|
||||
|
||||
y = (y >> 2) & qlowpixelMask;
|
||||
return x + y;
|
||||
static inline uint32_t Q_INTERPOLATE(uint32_t A, uint32_t B, uint32_t C, uint32_t D) {
|
||||
return (
|
||||
(((((A >> 16) & 0xFC) >> 2) + (((B >> 16) & 0xFC) >> 2) + (((C >> 16) & 0xFC) >> 2) + (((D >> 16) & 0xFC) >> 2) +
|
||||
(((A >> 16) & 0x03) + ((B >> 16) & 0x03) + ((C >> 16) & 0x03) + ((D >> 16) & 0x03))) << 16) |
|
||||
(((((A >> 8) & 0xFC) >> 2) + (((B >> 8) & 0xFC) >> 2) + (((C >> 8) & 0xFC) >> 2) + (((D >> 8) & 0xFC) >> 2) +
|
||||
(((A >> 8) & 0x03) + ((B >> 8) & 0x03) + ((C >> 8) & 0x03) + ((D >> 8) & 0x03))) << 8) |
|
||||
((((A & 0xFC) >> 2) + ((B & 0xFC) >> 2) + ((C & 0xFC) >> 2) + ((D & 0xFC) >> 2) +
|
||||
((A & 0x03) + (B & 0x03) + (C & 0x03) + (D & 0x03)))));
|
||||
}
|
||||
|
||||
static inline int GetResult1_32 (uint32_t A, uint32_t B, uint32_t C, uint32_t D,
|
||||
@@ -620,7 +603,7 @@ void SuperEagle (uint8_t *srcPtr, uint32_t srcPitch, uint8_t *deltaPtr,
|
||||
|
||||
*((uint32_t *) dP) = product1a;
|
||||
*((uint32_t *) (dP + dstPitch)) = product2a;
|
||||
*xP = color5;
|
||||
*xP = (uint16_t)color5;
|
||||
|
||||
bP += inc_bP;
|
||||
xP += inc_bP;
|
||||
@@ -1169,7 +1152,7 @@ void Scale_2xSaI (uint8_t *srcPtr, uint32_t srcPitch, uint8_t * /* deltaPtr */,
|
||||
uint32_t E, F, G, H;
|
||||
uint32_t I, J, K, L;
|
||||
uint32_t x1, x2, a1, f1, f2;
|
||||
uint32_t position, product1;
|
||||
uint32_t position, product1 = 0;
|
||||
|
||||
position = w >> 16;
|
||||
A = bP[position]; // current pixel
|
||||
@@ -1275,4 +1258,3 @@ void Scale_2xSaI (uint8_t *srcPtr, uint32_t srcPitch, uint8_t * /* deltaPtr */,
|
||||
dstPtr += dstPitch;
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -21,6 +21,10 @@
|
||||
#include <cmath> //std::sqrt
|
||||
#include "xbrz_tools.h"
|
||||
|
||||
#ifdef WINXP
|
||||
#include "quake3-sqrt.h"
|
||||
#endif
|
||||
|
||||
// some gcc versions lie about having this C++17 feature
|
||||
#define static_assert(x) static_assert(x, "assertion failed")
|
||||
|
||||
@@ -66,7 +70,9 @@ uint32_t gradientARGB(uint32_t pixFront, uint32_t pixBack) //find intermediate c
|
||||
|
||||
inline double fastSqrt(double n)
|
||||
{
|
||||
#if (defined(__GNUC__) || defined(__clang__)) && (defined(__x86_64__) || defined(__i386__))
|
||||
#ifdef WINXP
|
||||
return quake3_sqrt((float)n);
|
||||
#elif (defined(__GNUC__) || defined(__clang__)) && (defined(__x86_64__) || defined(__i386__))
|
||||
__asm__ ("fsqrt" : "+t" (n));
|
||||
return n;
|
||||
#elif defined(_MSC_VER) && defined(_M_IX86)
|
||||
|
@@ -1,263 +1,353 @@
|
||||
/*
|
||||
* GBA Color Correction Shader Implementation
|
||||
*
|
||||
* Shader modified by Pokefan531.
|
||||
* Color Mangler
|
||||
* Original Author: hunterk
|
||||
* Original License: Public domain
|
||||
*
|
||||
* This code is adapted from the original shader logic.
|
||||
*/
|
||||
|
||||
#include "components/filters_agb/filters_agb.h"
|
||||
#include <cmath>
|
||||
#include <algorithm>
|
||||
|
||||
extern int systemColorDepth;
|
||||
extern int systemRedShift;
|
||||
extern int systemGreenShift;
|
||||
extern int systemBlueShift;
|
||||
|
||||
extern uint8_t systemColorMap8[0x10000];
|
||||
extern uint16_t systemColorMap16[0x10000];
|
||||
extern uint32_t systemColorMap32[0x10000];
|
||||
|
||||
static const unsigned char curve[32] = { 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0e, 0x10, 0x12,
|
||||
0x14, 0x16, 0x18, 0x1c, 0x20, 0x28, 0x30, 0x38,
|
||||
0x40, 0x48, 0x50, 0x58, 0x60, 0x68, 0x70, 0x80,
|
||||
0x88, 0x90, 0xa0, 0xb0, 0xc0, 0xd0, 0xe0, 0xf0 };
|
||||
// --- Global Constants and Variables for GBA Color Correction ---
|
||||
// Define the color profile matrix as a static const float 2D array
|
||||
// This replicates the column-major order of GLSL mat4 for easier translation.
|
||||
// Format: { {col0_row0, col0_row1, col0_row2, col0_row3}, ... }
|
||||
static const float GBA_sRGB[4][4] = {
|
||||
{0.905f, 0.10f, 0.1575f, 0.0f}, // Column 0 (R output contributions from R, G, B, A)
|
||||
{0.195f, 0.65f, 0.1425f, 0.0f}, // Column 1 (G output contributions from R, G, B, A)
|
||||
{-0.10f, 0.25f, 0.70f, 0.0f}, // Column 2 (B output contributions from R, G, B, A)
|
||||
{0.0f, 0.0f, 0.0f, 0.91f} // Column 3 (A/Luminance contribution)
|
||||
};
|
||||
|
||||
// output R G B
|
||||
static const unsigned char influence[3 * 3] = { 16, 4, 4, // red
|
||||
8, 16, 8, // green
|
||||
0, 8, 16 }; // blue
|
||||
static const float GBA_DCI[4][4] = {
|
||||
{0.76f, 0.125f, 0.16f, 0.0f},
|
||||
{0.27f, 0.6375f, 0.18f, 0.0f},
|
||||
{-0.03f, 0.2375f, 0.66f, 0.0f},
|
||||
{0.0f, 0.0f, 0.0f, 0.97f}
|
||||
};
|
||||
|
||||
inline void swap(short& a, short& b)
|
||||
{
|
||||
short temp = a;
|
||||
a = b;
|
||||
b = temp;
|
||||
static const float GBA_Rec2020[4][4] = {
|
||||
{0.61f, 0.155f, 0.16f, 0.0f},
|
||||
{0.345f, 0.615f, 0.1875f, 0.0f},
|
||||
{0.045f, 0.23f, 0.6525f, 0.0f},
|
||||
{0.0f, 0.0f, 0.0f, 1.0f}
|
||||
};
|
||||
|
||||
// Screen darkening factor. Default to 0.0f
|
||||
static float darken_screen = 0.0f;
|
||||
|
||||
// Color mode (0 for sRGB, 1 for DCI, 2 for Rec2020). Default to sRGB (0).
|
||||
static int color_mode = 0;
|
||||
|
||||
// Pointer to the currently selected color profile matrix.
|
||||
static const float (*profile)[4];
|
||||
|
||||
// Global constants from the shader for gamma correction values
|
||||
static const float target_gamma = 2.2f;
|
||||
static const float display_gamma = 2.2f;
|
||||
|
||||
|
||||
// --- Function Implementations ---
|
||||
|
||||
// Forward declaration of a helper function to set the profile based on color_mode
|
||||
static void set_profile_from_mode();
|
||||
|
||||
// This constructor-like function runs once when the program starts.
|
||||
struct GbafilterInitializer {
|
||||
GbafilterInitializer() {
|
||||
set_profile_from_mode();
|
||||
}
|
||||
};
|
||||
static GbafilterInitializer __gbafilter_initializer;
|
||||
|
||||
|
||||
// Helper function to set the 'profile' pointer based on the 'color_mode' variable.
|
||||
static void set_profile_from_mode() {
|
||||
if (color_mode == 0) {
|
||||
profile = GBA_sRGB;
|
||||
}
|
||||
else if (color_mode == 1) {
|
||||
profile = GBA_DCI;
|
||||
}
|
||||
else if (color_mode == 2) {
|
||||
profile = GBA_Rec2020;
|
||||
}
|
||||
else {
|
||||
profile = GBA_sRGB; // Default to sRGB if an invalid mode is set
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Public function to set color mode and darken screen from external calls
|
||||
void gbafilter_set_params(int new_color_mode, float new_darken_screen) {
|
||||
color_mode = new_color_mode;
|
||||
darken_screen = fmaxf(0.0f, fminf(1.0f, new_darken_screen)); // Clamp to 0.0-1.0
|
||||
|
||||
// Call the helper to update 'profile' based on the new 'color_mode'
|
||||
set_profile_from_mode();
|
||||
}
|
||||
|
||||
void gbafilter_update_colors(bool lcd) {
|
||||
switch (systemColorDepth) {
|
||||
case 16: {
|
||||
for (int i = 0; i < 0x10000; i++) {
|
||||
systemColorMap16[i] = ((i & 0x1f) << systemRedShift) |
|
||||
(((i & 0x3e0) >> 5) << systemGreenShift) |
|
||||
(((i & 0x7c00) >> 10) << systemBlueShift);
|
||||
}
|
||||
if (lcd)
|
||||
gbafilter_pal(systemColorMap16, 0x10000);
|
||||
} break;
|
||||
case 24:
|
||||
case 32: {
|
||||
for (int i = 0; i < 0x10000; i++) {
|
||||
systemColorMap32[i] = ((i & 0x1f) << systemRedShift) |
|
||||
(((i & 0x3e0) >> 5) << systemGreenShift) |
|
||||
(((i & 0x7c00) >> 10) << systemBlueShift);
|
||||
}
|
||||
if (lcd)
|
||||
gbafilter_pal32(systemColorMap32, 0x10000);
|
||||
} break;
|
||||
case 8: {
|
||||
for (int i = 0; i < 0x10000; i++) {
|
||||
systemColorMap8[i] = (uint8_t)((((i & 0x1f) << 3) & 0xE0) |
|
||||
((((i & 0x3e0) >> 5) << 0) & 0x1C) |
|
||||
((((i & 0x7c00) >> 10) >> 3) & 0x3));
|
||||
}
|
||||
if (lcd)
|
||||
gbafilter_pal8(systemColorMap8, 0x10000);
|
||||
} break;
|
||||
case 16: {
|
||||
for (int i = 0x0; i < 0x10000; i++) {
|
||||
systemColorMap16[i] = ((i & 0x1f) << systemRedShift) |
|
||||
(((i & 0x3e0) >> 5) << systemGreenShift) |
|
||||
(((i & 0x7c00) >> 10) << systemBlueShift);
|
||||
}
|
||||
if (lcd)
|
||||
gbafilter_pal(systemColorMap16, 0x10000);
|
||||
} break;
|
||||
case 24:
|
||||
case 32: {
|
||||
for (int i = 0; i < 0x10000; i++) {
|
||||
systemColorMap32[i] = ((i & 0x1f) << systemRedShift) |
|
||||
(((i & 0x3e0) >> 5) << systemGreenShift) |
|
||||
(((i & 0x7c00) >> 10) << systemBlueShift);
|
||||
}
|
||||
if (lcd)
|
||||
gbafilter_pal32(systemColorMap32, 0x10000);
|
||||
} break;
|
||||
}
|
||||
}
|
||||
|
||||
void gbafilter_pal8(uint8_t* buf, int count)
|
||||
{
|
||||
// Pre-calculate constants for efficiency within function scope
|
||||
const float target_gamma_exponent = target_gamma + darken_screen;
|
||||
const float display_gamma_reciprocal = 1.0f / display_gamma;
|
||||
const float luminance_factor = profile[3][3]; // profile[3].w from GLSL
|
||||
|
||||
while (count--) {
|
||||
uint8_t pix = *buf;
|
||||
|
||||
uint8_t original_r_val_3bit = (uint8_t)((pix & 0xE0) >> 5);
|
||||
uint8_t original_g_val_3bit = (uint8_t)((pix & 0x1C) >> 2);
|
||||
uint8_t original_b_val_2bit = (uint8_t)(pix & 0x3);
|
||||
|
||||
// Normalize to 0.0-1.0 for calculations
|
||||
float r = (float)original_r_val_3bit / 7.0f;
|
||||
float g = (float)original_g_val_3bit / 7.0f;
|
||||
float b = (float)original_b_val_2bit / 3.0f;
|
||||
|
||||
// 1. Apply initial gamma (including darken_screen as exponent) to convert to linear space.
|
||||
// This step will affect non-"white" values.
|
||||
r = powf(r, target_gamma_exponent);
|
||||
g = powf(g, target_gamma_exponent);
|
||||
b = powf(b, target_gamma_exponent);
|
||||
|
||||
// 2. Apply luminance factor and clamp.
|
||||
r = fmaxf(0.0f, fminf(1.0f, r * luminance_factor));
|
||||
g = fmaxf(0.0f, fminf(1.0f, g * luminance_factor));
|
||||
b = fmaxf(0.0f, fminf(1.0f, b * luminance_factor));
|
||||
|
||||
// 3. Apply color profile matrix (using profile[column][row] access)
|
||||
float transformed_r = profile[0][0] * r + profile[1][0] * g + profile[2][0] * b;
|
||||
float transformed_g = profile[0][1] * r + profile[1][1] * g + profile[2][1] * b;
|
||||
float transformed_b = profile[0][2] * r + profile[1][2] * g + profile[2][2] * b;
|
||||
|
||||
// 4. Apply display gamma to convert back for display.
|
||||
transformed_r = copysignf(powf(fabsf(transformed_r), display_gamma_reciprocal), transformed_r);
|
||||
transformed_g = copysignf(powf(fabsf(transformed_g), display_gamma_reciprocal), transformed_g);
|
||||
transformed_b = copysignf(powf(fabsf(transformed_b), display_gamma_reciprocal), transformed_b);
|
||||
|
||||
// Final clamp: ensure values are within 0.0-1.0 range
|
||||
transformed_r = fmaxf(0.0f, fminf(1.0f, transformed_r));
|
||||
transformed_g = fmaxf(0.0f, fminf(1.0f, transformed_g));
|
||||
transformed_b = fmaxf(0.0f, fminf(1.0f, transformed_b));
|
||||
|
||||
// Convert back to 3-bit or 2-bit (0-7 or 0-3) integer and combine into uint8_t
|
||||
// Apply 5-bit to 5-bit conversion, as this palette is for 16-bit output.
|
||||
uint8_t final_red = (uint8_t)(transformed_r * 7.0f + 0.5f);
|
||||
uint8_t final_green = (uint8_t)(transformed_g * 7.0f + 0.5f);
|
||||
uint8_t final_blue = (uint8_t)(transformed_b * 3.0f + 0.5f);
|
||||
|
||||
// Ensure values are strictly within 0-7 or 0-3 range after rounding
|
||||
if (final_red > 7) final_red = 7;
|
||||
if (final_green > 7) final_green = 7;
|
||||
if (final_blue > 3) final_blue = 3;
|
||||
|
||||
*buf++ = ((final_red & 0x7) << 5) |
|
||||
((final_green & 0x7) << 2) |
|
||||
(final_blue & 0x3);
|
||||
}
|
||||
}
|
||||
|
||||
void gbafilter_pal(uint16_t* buf, int count)
|
||||
{
|
||||
short temp[3 * 3], s;
|
||||
uint16_t pix;
|
||||
uint8_t red, green, blue;
|
||||
// Pre-calculate constants for efficiency within function scope
|
||||
const float target_gamma_exponent = target_gamma + darken_screen;
|
||||
const float display_gamma_reciprocal = 1.0f / display_gamma;
|
||||
const float luminance_factor = profile[3][3]; // profile[3].w from GLSL
|
||||
|
||||
while (count--) {
|
||||
pix = *buf;
|
||||
uint16_t pix = *buf;
|
||||
|
||||
s = curve[(pix >> systemGreenShift) & 0x1f];
|
||||
temp[3] = s * influence[3];
|
||||
temp[4] = s * influence[4];
|
||||
temp[5] = s * influence[5];
|
||||
uint8_t original_r_val_5bit = (uint8_t)((pix >> systemRedShift) & 0x1f);
|
||||
uint8_t original_g_val_5bit = (uint8_t)((pix >> systemGreenShift) & 0x1f);
|
||||
uint8_t original_b_val_5bit = (uint8_t)((pix >> systemBlueShift) & 0x1f);
|
||||
|
||||
s = curve[(pix >> systemRedShift) & 0x1f];
|
||||
temp[0] = s * influence[0];
|
||||
temp[1] = s * influence[1];
|
||||
temp[2] = s * influence[2];
|
||||
// Normalize to 0.0-1.0 for calculations
|
||||
float r = (float)original_r_val_5bit / 31.0f;
|
||||
float g = (float)original_g_val_5bit / 31.0f;
|
||||
float b = (float)original_b_val_5bit / 31.0f;
|
||||
|
||||
s = curve[(pix >> systemBlueShift) & 0x1f];
|
||||
temp[6] = s * influence[6];
|
||||
temp[7] = s * influence[7];
|
||||
temp[8] = s * influence[8];
|
||||
// 1. Apply initial gamma (including darken_screen as exponent) to convert to linear space.
|
||||
// This step will affect non-"white" values.
|
||||
r = powf(r, target_gamma_exponent);
|
||||
g = powf(g, target_gamma_exponent);
|
||||
b = powf(b, target_gamma_exponent);
|
||||
|
||||
if (temp[0] < temp[3])
|
||||
swap(temp[0], temp[3]);
|
||||
if (temp[0] < temp[6])
|
||||
swap(temp[0], temp[6]);
|
||||
if (temp[3] < temp[6])
|
||||
swap(temp[3], temp[6]);
|
||||
temp[3] <<= 1;
|
||||
temp[0] <<= 2;
|
||||
temp[0] += temp[3] + temp[6];
|
||||
// 2. Apply luminance factor and clamp.
|
||||
r = fmaxf(0.0f, fminf(1.0f, r * luminance_factor));
|
||||
g = fmaxf(0.0f, fminf(1.0f, g * luminance_factor));
|
||||
b = fmaxf(0.0f, fminf(1.0f, b * luminance_factor));
|
||||
|
||||
red = ((int(temp[0]) * 160) >> 17) + 4;
|
||||
if (red > 31)
|
||||
red = 31;
|
||||
// 3. Apply color profile matrix (using profile[column][row] access)
|
||||
float transformed_r = profile[0][0] * r + profile[1][0] * g + profile[2][0] * b;
|
||||
float transformed_g = profile[0][1] * r + profile[1][1] * g + profile[2][1] * b;
|
||||
float transformed_b = profile[0][2] * r + profile[1][2] * g + profile[2][2] * b;
|
||||
|
||||
if (temp[2] < temp[5])
|
||||
swap(temp[2], temp[5]);
|
||||
if (temp[2] < temp[8])
|
||||
swap(temp[2], temp[8]);
|
||||
if (temp[5] < temp[8])
|
||||
swap(temp[5], temp[8]);
|
||||
temp[5] <<= 1;
|
||||
temp[2] <<= 2;
|
||||
temp[2] += temp[5] + temp[8];
|
||||
// 4. Apply display gamma to convert back for display.
|
||||
transformed_r = copysignf(powf(fabsf(transformed_r), display_gamma_reciprocal), transformed_r);
|
||||
transformed_g = copysignf(powf(fabsf(transformed_g), display_gamma_reciprocal), transformed_g);
|
||||
transformed_b = copysignf(powf(fabsf(transformed_b), display_gamma_reciprocal), transformed_b);
|
||||
|
||||
blue = ((int(temp[2]) * 160) >> 17) + 4;
|
||||
if (blue > 31)
|
||||
blue = 31;
|
||||
// Final clamp: ensure values are within 0.0-1.0 range
|
||||
transformed_r = fmaxf(0.0f, fminf(1.0f, transformed_r));
|
||||
transformed_g = fmaxf(0.0f, fminf(1.0f, transformed_g));
|
||||
transformed_b = fmaxf(0.0f, fminf(1.0f, transformed_b));
|
||||
|
||||
if (temp[1] < temp[4])
|
||||
swap(temp[1], temp[4]);
|
||||
if (temp[1] < temp[7])
|
||||
swap(temp[1], temp[7]);
|
||||
if (temp[4] < temp[7])
|
||||
swap(temp[4], temp[7]);
|
||||
temp[4] <<= 1;
|
||||
temp[1] <<= 2;
|
||||
temp[1] += temp[4] + temp[7];
|
||||
// Convert back to 5-bit (0-31) integer and combine into uint16_t
|
||||
// Apply 5-bit to 5-bit conversion, as this palette is for 16-bit output.
|
||||
uint8_t final_red = (uint8_t)(transformed_r * 31.0f + 0.5f);
|
||||
uint8_t final_green = (uint8_t)(transformed_g * 31.0f + 0.5f);
|
||||
uint8_t final_blue = (uint8_t)(transformed_b * 31.0f + 0.5f);
|
||||
|
||||
green = ((int(temp[1]) * 160) >> 17) + 4;
|
||||
if (green > 31)
|
||||
green = 31;
|
||||
// Ensure values are strictly within 0-31 range after rounding
|
||||
if (final_red > 31) final_red = 31;
|
||||
if (final_green > 31) final_green = 31;
|
||||
if (final_blue > 31) final_blue = 31;
|
||||
|
||||
pix = red << systemRedShift;
|
||||
pix += green << systemGreenShift;
|
||||
pix += blue << systemBlueShift;
|
||||
|
||||
*buf++ = pix;
|
||||
*buf++ = (final_red << systemRedShift) |
|
||||
(final_green << systemGreenShift) |
|
||||
(final_blue << systemBlueShift);
|
||||
}
|
||||
}
|
||||
|
||||
void gbafilter_pal32(uint32_t* buf, int count)
|
||||
{
|
||||
short temp[3 * 3], s;
|
||||
unsigned pix;
|
||||
uint8_t red, green, blue;
|
||||
// Pre-calculate constants for efficiency within function scope
|
||||
const float target_gamma_exponent = target_gamma + darken_screen;
|
||||
const float display_gamma_reciprocal = 1.0f / display_gamma;
|
||||
const float luminance_factor = profile[3][3]; // profile[3].w from GLSL
|
||||
|
||||
while (count--) {
|
||||
pix = *buf;
|
||||
uint32_t pix = *buf;
|
||||
|
||||
s = curve[(pix >> systemGreenShift) & 0x1f];
|
||||
temp[3] = s * influence[3];
|
||||
temp[4] = s * influence[4];
|
||||
temp[5] = s * influence[5];
|
||||
// Extract original 5-bit R, G, B values from the shifted positions in the 32-bit pixel.
|
||||
// These shifts pull out the 5-bit value from its shifted position (e.g., bits 3-7 for Red).
|
||||
uint8_t original_r_val_5bit = (uint8_t)((pix >> systemRedShift) & 0x1f);
|
||||
uint8_t original_g_val_5bit = (uint8_t)((pix >> systemGreenShift) & 0x1f);
|
||||
uint8_t original_b_val_5bit = (uint8_t)((pix >> systemBlueShift) & 0x1f);
|
||||
|
||||
s = curve[(pix >> systemRedShift) & 0x1f];
|
||||
temp[0] = s * influence[0];
|
||||
temp[1] = s * influence[1];
|
||||
temp[2] = s * influence[2];
|
||||
|
||||
s = curve[(pix >> systemBlueShift) & 0x1f];
|
||||
temp[6] = s * influence[6];
|
||||
temp[7] = s * influence[7];
|
||||
temp[8] = s * influence[8];
|
||||
// Normalize to 0.0-1.0 for calculations
|
||||
float r = (float)original_r_val_5bit / 31.0f;
|
||||
float g = (float)original_g_val_5bit / 31.0f;
|
||||
float b = (float)original_b_val_5bit / 31.0f;
|
||||
|
||||
if (temp[0] < temp[3])
|
||||
swap(temp[0], temp[3]);
|
||||
if (temp[0] < temp[6])
|
||||
swap(temp[0], temp[6]);
|
||||
if (temp[3] < temp[6])
|
||||
swap(temp[3], temp[6]);
|
||||
temp[3] <<= 1;
|
||||
temp[0] <<= 2;
|
||||
temp[0] += temp[3] + temp[6];
|
||||
// 1. Apply initial gamma (including darken_screen as exponent) to convert to linear space.
|
||||
r = powf(r, target_gamma_exponent);
|
||||
g = powf(g, target_gamma_exponent);
|
||||
b = powf(b, target_gamma_exponent);
|
||||
|
||||
//red = ((int(temp[0]) * 160) >> 17) + 4;
|
||||
red = ((int(temp[0]) * 160) >> 14) + 32;
|
||||
// 2. Apply luminance factor and clamp.
|
||||
r = fmaxf(0.0f, fminf(1.0f, r * luminance_factor));
|
||||
g = fmaxf(0.0f, fminf(1.0f, g * luminance_factor));
|
||||
b = fmaxf(0.0f, fminf(1.0f, b * luminance_factor));
|
||||
|
||||
if (temp[2] < temp[5])
|
||||
swap(temp[2], temp[5]);
|
||||
if (temp[2] < temp[8])
|
||||
swap(temp[2], temp[8]);
|
||||
if (temp[5] < temp[8])
|
||||
swap(temp[5], temp[8]);
|
||||
temp[5] <<= 1;
|
||||
temp[2] <<= 2;
|
||||
temp[2] += temp[5] + temp[8];
|
||||
// 3. Apply color profile matrix
|
||||
float transformed_r = profile[0][0] * r + profile[1][0] * g + profile[2][0] * b;
|
||||
float transformed_g = profile[0][1] * r + profile[1][1] * g + profile[2][1] * b;
|
||||
float transformed_b = profile[0][2] * r + profile[1][2] * g + profile[2][2] * b;
|
||||
|
||||
//blue = ((int(temp[2]) * 160) >> 17) + 4;
|
||||
blue = ((int(temp[2]) * 160) >> 14) + 32;
|
||||
// 4. Apply display gamma.
|
||||
transformed_r = copysignf(powf(fabsf(transformed_r), display_gamma_reciprocal), transformed_r);
|
||||
transformed_g = copysignf(powf(fabsf(transformed_g), display_gamma_reciprocal), transformed_g);
|
||||
transformed_b = copysignf(powf(fabsf(transformed_b), display_gamma_reciprocal), transformed_b);
|
||||
|
||||
if (temp[1] < temp[4])
|
||||
swap(temp[1], temp[4]);
|
||||
if (temp[1] < temp[7])
|
||||
swap(temp[1], temp[7]);
|
||||
if (temp[4] < temp[7])
|
||||
swap(temp[4], temp[7]);
|
||||
temp[4] <<= 1;
|
||||
temp[1] <<= 2;
|
||||
temp[1] += temp[4] + temp[7];
|
||||
// Final clamp: ensure values are within 0.0-1.0 range
|
||||
transformed_r = fmaxf(0.0f, fminf(1.0f, transformed_r));
|
||||
transformed_g = fmaxf(0.0f, fminf(1.0f, transformed_g));
|
||||
transformed_b = fmaxf(0.0f, fminf(1.0f, transformed_b));
|
||||
|
||||
//green = ((int(temp[1]) * 160) >> 17) + 4;
|
||||
green = ((int(temp[1]) * 160) >> 14) + 32;
|
||||
|
||||
//pix = red << redshift;
|
||||
//pix += green << greenshift;
|
||||
//pix += blue << blueshift;
|
||||
// Convert the floating-point values to 8-bit integer components (0-255).
|
||||
uint8_t final_red_8bit = (uint8_t)(transformed_r * 255.0f + 0.5f);
|
||||
uint8_t final_green_8bit = (uint8_t)(transformed_g * 255.0f + 0.5f);
|
||||
uint8_t final_blue_8bit = (uint8_t)(transformed_b * 255.0f + 0.5f);
|
||||
|
||||
pix = red << (systemRedShift - 3);
|
||||
pix += green << (systemGreenShift - 3);
|
||||
pix += blue << (systemBlueShift - 3);
|
||||
// Ensure values are strictly within 0-255 range after rounding
|
||||
if (final_red_8bit > 255) final_red_8bit = 255;
|
||||
if (final_green_8bit > 255) final_green_8bit = 255;
|
||||
if (final_blue_8bit > 255) final_blue_8bit = 255;
|
||||
|
||||
*buf++ = pix;
|
||||
}
|
||||
}
|
||||
// --- NEW PACKING LOGIC ---
|
||||
// This is the critical change to correctly map 8-bit color to the 5-bit shifted format,
|
||||
// while allowing FFFFFF.
|
||||
// It uses the top 5 bits of the 8-bit value for the GBA's 5-bit component position,
|
||||
// and the bottom 3 bits to fill the lower, normally zeroed, positions.
|
||||
|
||||
// for palette mode to work with the three spoony filters in 32bpp depth
|
||||
uint32_t final_pix = 0;
|
||||
|
||||
void gbafilter_pad(uint8_t* buf, int count)
|
||||
{
|
||||
union {
|
||||
struct
|
||||
{
|
||||
uint8_t r;
|
||||
uint8_t g;
|
||||
uint8_t b;
|
||||
uint8_t a;
|
||||
} part;
|
||||
unsigned whole;
|
||||
} mask;
|
||||
// Red component
|
||||
// 5 most significant bits (MSBs) for the 'systemRedShift' position
|
||||
final_pix |= ((final_red_8bit >> 3) & 0x1f) << systemRedShift;
|
||||
// 3 least significant bits (LSBs) for the 'base' position (systemRedShift - 3)
|
||||
final_pix |= (final_red_8bit & 0x07) << (systemRedShift - 3);
|
||||
|
||||
mask.whole = 0x1f << systemRedShift;
|
||||
mask.whole += 0x1f << systemGreenShift;
|
||||
mask.whole += 0x1f << systemBlueShift;
|
||||
|
||||
switch (systemColorDepth) {
|
||||
case 24:
|
||||
while (count--) {
|
||||
*buf++ &= mask.part.r;
|
||||
*buf++ &= mask.part.g;
|
||||
*buf++ &= mask.part.b;
|
||||
// Green component
|
||||
// 5 MSBs for the 'systemGreenShift' position
|
||||
final_pix |= ((final_green_8bit >> 3) & 0x1f) << systemGreenShift;
|
||||
// 3 LSBs for the 'base' position (systemGreenShift - 3)
|
||||
final_pix |= (final_green_8bit & 0x07) << (systemGreenShift - 3);
|
||||
|
||||
// Blue component
|
||||
// 5 MSBs for the 'systemBlueShift' position
|
||||
final_pix |= ((final_blue_8bit >> 3) & 0x1f) << systemBlueShift;
|
||||
// 3 LSBs for the 'base' position (systemBlueShift - 3)
|
||||
final_pix |= (final_blue_8bit & 0x07) << (systemBlueShift - 3);
|
||||
|
||||
// Preserve existing alpha if present (assuming it's at bits 24-31 for 32-bit depth)
|
||||
if (systemColorDepth == 32) {
|
||||
final_pix |= (pix & (0xFF << 24));
|
||||
}
|
||||
break;
|
||||
case 32:
|
||||
while (count--) {
|
||||
*((uint32_t*)buf) &= mask.whole;
|
||||
buf += 4;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
void UpdateSystemColorMaps(int lcd)
|
||||
{
|
||||
switch(systemColorDepth) {
|
||||
case 16:
|
||||
{
|
||||
for(int i = 0; i < 0x10000; i++) {
|
||||
systemColorMap16[i] = ((i & 0x1f) << systemRedShift) |
|
||||
(((i & 0x3e0) >> 5) << systemGreenShift) |
|
||||
(((i & 0x7c00) >> 10) << systemBlueShift);
|
||||
}
|
||||
if (lcd == 1) gbafilter_pal(systemColorMap16, 0x10000);
|
||||
*buf++ = final_pix;
|
||||
}
|
||||
break;
|
||||
case 24:
|
||||
case 32:
|
||||
{
|
||||
for(int i = 0; i < 0x10000; i++) {
|
||||
systemColorMap32[i] = ((i & 0x1f) << systemRedShift) |
|
||||
(((i & 0x3e0) >> 5) << systemGreenShift) |
|
||||
(((i & 0x7c00) >> 10) << systemBlueShift);
|
||||
}
|
||||
if (lcd == 1) gbafilter_pal32(systemColorMap32, 0x10000);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
@@ -4,8 +4,9 @@
|
||||
#include <cstdint>
|
||||
|
||||
void gbafilter_update_colors(bool lcd = false);
|
||||
void gbafilter_pal8(uint8_t* buf, int count);
|
||||
void gbafilter_pal(uint16_t* buf, int count);
|
||||
void gbafilter_pal32(uint32_t* buf, int count);
|
||||
void gbafilter_pad(uint8_t* buf, int count);
|
||||
void gbafilter_set_params(int color_mode, float darken_screen);
|
||||
|
||||
#endif // VBAM_COMPONENTS_FILTERS_AGB_FILTERS_AGB_H_
|
||||
|
6
src/components/filters_cgb/CMakeLists.txt
Normal file
6
src/components/filters_cgb/CMakeLists.txt
Normal file
@@ -0,0 +1,6 @@
|
||||
add_library(vbam-components-filters-cgb OBJECT)
|
||||
|
||||
target_sources(vbam-components-filters-cgb
|
||||
PRIVATE filters_cgb.cpp
|
||||
PUBLIC filters_cgb.h
|
||||
)
|
352
src/components/filters_cgb/filters_cgb.cpp
Normal file
352
src/components/filters_cgb/filters_cgb.cpp
Normal file
@@ -0,0 +1,352 @@
|
||||
/*
|
||||
* GBC Color Correction Shader Implementation
|
||||
*
|
||||
* Shader modified by Pokefan531.
|
||||
* Color Mangler
|
||||
* Original Author: hunterk
|
||||
* Original License: Public domain
|
||||
*
|
||||
* This code is adapted from the original shader logic.
|
||||
*/
|
||||
|
||||
#include "components/filters_cgb/filters_cgb.h"
|
||||
#include <cmath>
|
||||
#include <algorithm>
|
||||
|
||||
extern int systemColorDepth;
|
||||
extern int systemRedShift;
|
||||
extern int systemGreenShift;
|
||||
extern int systemBlueShift;
|
||||
|
||||
extern uint8_t systemColorMap8[0x10000];
|
||||
extern uint16_t systemColorMap16[0x10000];
|
||||
extern uint32_t systemColorMap32[0x10000];
|
||||
|
||||
// --- Global Constants and Variables for GBC Color Correction ---
|
||||
// Define the color profile matrix as a static const float 2D array
|
||||
// This replicates the column-major order of GLSL mat4 for easier translation.
|
||||
// Format: { {col0_row0, col0_row1, col0_row2, col0_row3}, ... }
|
||||
static const float GBC_sRGB[4][4] = {
|
||||
{0.905f, 0.10f, 0.1575f, 0.0f}, // Column 0 (R output contributions from R, G, B, A)
|
||||
{0.195f, 0.65f, 0.1425f, 0.0f}, // Column 1 (G output contributions from R, G, B, A)
|
||||
{-0.10f, 0.25f, 0.70f, 0.0f}, // Column 2 (B output contributions from R, G, B, A)
|
||||
{0.0f, 0.0f, 0.0f, 0.91f} // Column 3 (A/Luminance contribution)
|
||||
};
|
||||
|
||||
static const float GBC_DCI[4][4] = {
|
||||
{0.76f, 0.125f, 0.16f, 0.0f},
|
||||
{0.27f, 0.6375f, 0.18f, 0.0f},
|
||||
{-0.03f, 0.2375f, 0.66f, 0.0f},
|
||||
{0.0f, 0.0f, 0.0f, 0.97f}
|
||||
};
|
||||
|
||||
static const float GBC_Rec2020[4][4] = {
|
||||
{0.61f, 0.155f, 0.16f, 0.0f},
|
||||
{0.345f, 0.615f, 0.1875f, 0.0f},
|
||||
{0.045f, 0.23f, 0.6525f, 0.0f},
|
||||
{0.0f, 0.0f, 0.0f, 1.0f}
|
||||
};
|
||||
|
||||
// Screen lightening factor. Default to 0.0f.
|
||||
static float lighten_screen = 0.0f;
|
||||
|
||||
// Color mode (0 for sRGB, 1 for DCI, 2 for Rec2020). Default to sRGB (0).
|
||||
static int color_mode = 0;
|
||||
|
||||
// Pointer to the currently selected color profile matrix.
|
||||
static const float (*profile)[4];
|
||||
|
||||
// Global constants from the shader for gamma correction values
|
||||
static const float target_gamma = 2.2f;
|
||||
static const float display_gamma = 2.2f;
|
||||
|
||||
|
||||
// --- Function Implementations ---
|
||||
|
||||
// Forward declaration of a helper function to set the profile based on color_mode
|
||||
static void set_profile_from_mode();
|
||||
|
||||
// This constructor-like function runs once when the program starts.
|
||||
struct GbcfilterInitializer {
|
||||
GbcfilterInitializer() {
|
||||
set_profile_from_mode();
|
||||
}
|
||||
};
|
||||
static GbcfilterInitializer __gbcfilter_initializer;
|
||||
|
||||
|
||||
// Helper function to set the 'profile' pointer based on the 'color_mode' variable.
|
||||
static void set_profile_from_mode() {
|
||||
if (color_mode == 0) {
|
||||
profile = GBC_sRGB;
|
||||
}
|
||||
else if (color_mode == 1) {
|
||||
profile = GBC_DCI;
|
||||
}
|
||||
else if (color_mode == 2) {
|
||||
profile = GBC_Rec2020;
|
||||
}
|
||||
else {
|
||||
profile = GBC_sRGB; // Default to sRGB if an invalid mode is set
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Public function to set color mode and darken screen from external calls
|
||||
void gbcfilter_set_params(int new_color_mode, float new_lighten_screen) {
|
||||
color_mode = new_color_mode;
|
||||
lighten_screen = fmaxf(0.0f, fminf(1.0f, new_lighten_screen)); // Clamp to 0.0-1.0
|
||||
|
||||
// Call the helper to update 'profile' based on the new 'color_mode'
|
||||
set_profile_from_mode();
|
||||
}
|
||||
|
||||
void gbcfilter_update_colors(bool lcd) {
|
||||
switch (systemColorDepth) {
|
||||
case 8: {
|
||||
for (int i = 0; i < 0x10000; i++) {
|
||||
systemColorMap8[i] = (uint8_t)((((i & 0x1f) << 3) & 0xE0) |
|
||||
((((i & 0x3e0) >> 5) << 0) & 0x1C) |
|
||||
((((i & 0x7c00) >> 10) >> 3) & 0x3));
|
||||
}
|
||||
if (lcd)
|
||||
gbcfilter_pal8(systemColorMap8, 0x10000);
|
||||
} break;
|
||||
case 16: {
|
||||
for (int i = 0x0; i < 0x10000; i++) {
|
||||
systemColorMap16[i] = ((i & 0x1f) << systemRedShift) |
|
||||
(((i & 0x3e0) >> 5) << systemGreenShift) |
|
||||
(((i & 0x7c00) >> 10) << systemBlueShift);
|
||||
}
|
||||
if (lcd)
|
||||
gbcfilter_pal(systemColorMap16, 0x10000);
|
||||
} break;
|
||||
case 24:
|
||||
case 32: {
|
||||
for (int i = 0; i < 0x10000; i++) {
|
||||
systemColorMap32[i] = ((i & 0x1f) << systemRedShift) |
|
||||
(((i & 0x3e0) >> 5) << systemGreenShift) |
|
||||
(((i & 0x7c00) >> 10) << systemBlueShift);
|
||||
}
|
||||
if (lcd)
|
||||
gbcfilter_pal32(systemColorMap32, 0x10000);
|
||||
} break;
|
||||
}
|
||||
}
|
||||
|
||||
void gbcfilter_pal8(uint8_t* buf, int count)
|
||||
{
|
||||
// Pre-calculate constants for efficiency within function scope
|
||||
const float target_gamma_exponent = target_gamma + (lighten_screen * -1.0f);
|
||||
const float display_gamma_reciprocal = 1.0f / display_gamma;
|
||||
const float luminance_factor = profile[3][3]; // profile[3].w from GLSL
|
||||
|
||||
while (count--) {
|
||||
uint8_t pix = *buf;
|
||||
|
||||
uint8_t original_r_val_3bit = (uint8_t)((pix & 0xE0) >> 5);
|
||||
uint8_t original_g_val_3bit = (uint8_t)((pix & 0x1C) >> 2);
|
||||
uint8_t original_b_val_2bit = (uint8_t)(pix & 0x3);
|
||||
|
||||
// Normalize to 0.0-1.0 for calculations
|
||||
float r = (float)original_r_val_3bit / 7.0f;
|
||||
float g = (float)original_g_val_3bit / 7.0f;
|
||||
float b = (float)original_b_val_2bit / 3.0f;
|
||||
|
||||
// 1. Apply initial gamma (including lighten_screen as exponent) to convert to linear space.
|
||||
// This step will affect non-"white" values.
|
||||
r = powf(r, target_gamma_exponent);
|
||||
g = powf(g, target_gamma_exponent);
|
||||
b = powf(b, target_gamma_exponent);
|
||||
|
||||
// 2. Apply luminance factor and clamp.
|
||||
r = fmaxf(0.0f, fminf(1.0f, r * luminance_factor));
|
||||
g = fmaxf(0.0f, fminf(1.0f, g * luminance_factor));
|
||||
b = fmaxf(0.0f, fminf(1.0f, b * luminance_factor));
|
||||
|
||||
// 3. Apply color profile matrix (using profile[column][row] access)
|
||||
float transformed_r = profile[0][0] * r + profile[1][0] * g + profile[2][0] * b;
|
||||
float transformed_g = profile[0][1] * r + profile[1][1] * g + profile[2][1] * b;
|
||||
float transformed_b = profile[0][2] * r + profile[1][2] * g + profile[2][2] * b;
|
||||
|
||||
// 4. Apply display gamma to convert back for display.
|
||||
transformed_r = copysignf(powf(fabsf(transformed_r), display_gamma_reciprocal), transformed_r);
|
||||
transformed_g = copysignf(powf(fabsf(transformed_g), display_gamma_reciprocal), transformed_g);
|
||||
transformed_b = copysignf(powf(fabsf(transformed_b), display_gamma_reciprocal), transformed_b);
|
||||
|
||||
// Final clamp: ensure values are within 0.0-1.0 range
|
||||
transformed_r = fmaxf(0.0f, fminf(1.0f, transformed_r));
|
||||
transformed_g = fmaxf(0.0f, fminf(1.0f, transformed_g));
|
||||
transformed_b = fmaxf(0.0f, fminf(1.0f, transformed_b));
|
||||
|
||||
// Convert back to 3-bit or 2-bit (0-7 or 0-3) integer and combine into uint8_t
|
||||
// Apply 3-bit or 2-bit to 8-bit conversion, as this palette is for 8-bit output.
|
||||
uint8_t final_red = (uint8_t)(transformed_r * 7.0f + 0.5f);
|
||||
uint8_t final_green = (uint8_t)(transformed_g * 7.0f + 0.5f);
|
||||
uint8_t final_blue = (uint8_t)(transformed_b * 3.0f + 0.5f);
|
||||
|
||||
// Ensure values are strictly within 0-7 or 0-3 range after rounding
|
||||
if (final_red > 7) final_red = 7;
|
||||
if (final_green > 7) final_green = 7;
|
||||
if (final_blue > 3) final_blue = 3;
|
||||
|
||||
*buf++ = ((final_red & 0x7) << 5) |
|
||||
((final_green & 0x7) << 2) |
|
||||
(final_blue & 0x3);
|
||||
}
|
||||
}
|
||||
void gbcfilter_pal(uint16_t* buf, int count)
|
||||
{
|
||||
// Pre-calculate constants for efficiency within function scope
|
||||
const float target_gamma_exponent = target_gamma + (lighten_screen * -1.0f);
|
||||
const float display_gamma_reciprocal = 1.0f / display_gamma;
|
||||
const float luminance_factor = profile[3][3]; // profile[3].w from GLSL
|
||||
|
||||
while (count--) {
|
||||
uint16_t pix = *buf;
|
||||
|
||||
uint8_t original_r_val_5bit = (uint8_t)((pix >> systemRedShift) & 0x1f);
|
||||
uint8_t original_g_val_5bit = (uint8_t)((pix >> systemGreenShift) & 0x1f);
|
||||
uint8_t original_b_val_5bit = (uint8_t)((pix >> systemBlueShift) & 0x1f);
|
||||
|
||||
// Normalize to 0.0-1.0 for calculations
|
||||
float r = (float)original_r_val_5bit / 31.0f;
|
||||
float g = (float)original_g_val_5bit / 31.0f;
|
||||
float b = (float)original_b_val_5bit / 31.0f;
|
||||
|
||||
// 1. Apply initial gamma (including lighten_screen as exponent) to convert to linear space.
|
||||
// This step will affect non-"white" values.
|
||||
r = powf(r, target_gamma_exponent);
|
||||
g = powf(g, target_gamma_exponent);
|
||||
b = powf(b, target_gamma_exponent);
|
||||
|
||||
// 2. Apply luminance factor and clamp.
|
||||
r = fmaxf(0.0f, fminf(1.0f, r * luminance_factor));
|
||||
g = fmaxf(0.0f, fminf(1.0f, g * luminance_factor));
|
||||
b = fmaxf(0.0f, fminf(1.0f, b * luminance_factor));
|
||||
|
||||
// 3. Apply color profile matrix (using profile[column][row] access)
|
||||
float transformed_r = profile[0][0] * r + profile[1][0] * g + profile[2][0] * b;
|
||||
float transformed_g = profile[0][1] * r + profile[1][1] * g + profile[2][1] * b;
|
||||
float transformed_b = profile[0][2] * r + profile[1][2] * g + profile[2][2] * b;
|
||||
|
||||
// 4. Apply display gamma to convert back for display.
|
||||
transformed_r = copysignf(powf(fabsf(transformed_r), display_gamma_reciprocal), transformed_r);
|
||||
transformed_g = copysignf(powf(fabsf(transformed_g), display_gamma_reciprocal), transformed_g);
|
||||
transformed_b = copysignf(powf(fabsf(transformed_b), display_gamma_reciprocal), transformed_b);
|
||||
|
||||
// Final clamp: ensure values are within 0.0-1.0 range
|
||||
transformed_r = fmaxf(0.0f, fminf(1.0f, transformed_r));
|
||||
transformed_g = fmaxf(0.0f, fminf(1.0f, transformed_g));
|
||||
transformed_b = fmaxf(0.0f, fminf(1.0f, transformed_b));
|
||||
|
||||
// Convert back to 5-bit (0-31) integer and combine into uint16_t
|
||||
// Apply 5-bit to 5-bit conversion, as this palette is for 16-bit output.
|
||||
uint8_t final_red = (uint8_t)(transformed_r * 31.0f + 0.5f);
|
||||
uint8_t final_green = (uint8_t)(transformed_g * 31.0f + 0.5f);
|
||||
uint8_t final_blue = (uint8_t)(transformed_b * 31.0f + 0.5f);
|
||||
|
||||
// Ensure values are strictly within 0-31 range after rounding
|
||||
if (final_red > 31) final_red = 31;
|
||||
if (final_green > 31) final_green = 31;
|
||||
if (final_blue > 31) final_blue = 31;
|
||||
|
||||
*buf++ = (final_red << systemRedShift) |
|
||||
(final_green << systemGreenShift) |
|
||||
(final_blue << systemBlueShift);
|
||||
}
|
||||
}
|
||||
|
||||
void gbcfilter_pal32(uint32_t* buf, int count)
|
||||
{
|
||||
// Pre-calculate constants for efficiency within function scope
|
||||
const float target_gamma_exponent = target_gamma + (lighten_screen * -1.0f);
|
||||
const float display_gamma_reciprocal = 1.0f / display_gamma;
|
||||
const float luminance_factor = profile[3][3]; // profile[3].w from GLSL
|
||||
|
||||
while (count--) {
|
||||
uint32_t pix = *buf;
|
||||
|
||||
// Extract original 5-bit R, G, B values from the shifted positions in the 32-bit pixel.
|
||||
// These shifts pull out the 5-bit value from its shifted position (e.g., bits 3-7 for Red).
|
||||
uint8_t original_r_val_5bit = (uint8_t)((pix >> systemRedShift) & 0x1f);
|
||||
uint8_t original_g_val_5bit = (uint8_t)((pix >> systemGreenShift) & 0x1f);
|
||||
uint8_t original_b_val_5bit = (uint8_t)((pix >> systemBlueShift) & 0x1f);
|
||||
|
||||
|
||||
// Normalize to 0.0-1.0 for calculations
|
||||
float r = (float)original_r_val_5bit / 31.0f;
|
||||
float g = (float)original_g_val_5bit / 31.0f;
|
||||
float b = (float)original_b_val_5bit / 31.0f;
|
||||
|
||||
// 1. Apply initial gamma (including lighten_screen as exponent) to convert to linear space.
|
||||
r = powf(r, target_gamma_exponent);
|
||||
g = powf(g, target_gamma_exponent);
|
||||
b = powf(b, target_gamma_exponent);
|
||||
|
||||
// 2. Apply luminance factor and clamp.
|
||||
r = fmaxf(0.0f, fminf(1.0f, r * luminance_factor));
|
||||
g = fmaxf(0.0f, fminf(1.0f, g * luminance_factor));
|
||||
b = fmaxf(0.0f, fminf(1.0f, b * luminance_factor));
|
||||
|
||||
// 3. Apply color profile matrix
|
||||
float transformed_r = profile[0][0] * r + profile[1][0] * g + profile[2][0] * b;
|
||||
float transformed_g = profile[0][1] * r + profile[1][1] * g + profile[2][1] * b;
|
||||
float transformed_b = profile[0][2] * r + profile[1][2] * g + profile[2][2] * b;
|
||||
|
||||
// 4. Apply display gamma.
|
||||
transformed_r = copysignf(powf(fabsf(transformed_r), display_gamma_reciprocal), transformed_r);
|
||||
transformed_g = copysignf(powf(fabsf(transformed_g), display_gamma_reciprocal), transformed_g);
|
||||
transformed_b = copysignf(powf(fabsf(transformed_b), display_gamma_reciprocal), transformed_b);
|
||||
|
||||
// Final clamp: ensure values are within 0.0-1.0 range
|
||||
transformed_r = fmaxf(0.0f, fminf(1.0f, transformed_r));
|
||||
transformed_g = fmaxf(0.0f, fminf(1.0f, transformed_g));
|
||||
transformed_b = fmaxf(0.0f, fminf(1.0f, transformed_b));
|
||||
|
||||
|
||||
// Convert the floating-point values to 8-bit integer components (0-255).
|
||||
uint8_t final_red_8bit = (uint8_t)(transformed_r * 255.0f + 0.5f);
|
||||
uint8_t final_green_8bit = (uint8_t)(transformed_g * 255.0f + 0.5f);
|
||||
uint8_t final_blue_8bit = (uint8_t)(transformed_b * 255.0f + 0.5f);
|
||||
|
||||
// Ensure values are strictly within 0-255 range after rounding
|
||||
if (final_red_8bit > 255) final_red_8bit = 255;
|
||||
if (final_green_8bit > 255) final_green_8bit = 255;
|
||||
if (final_blue_8bit > 255) final_blue_8bit = 255;
|
||||
|
||||
// --- NEW PACKING LOGIC ---
|
||||
// This is the critical change to correctly map 8-bit color to the 5-bit shifted format,
|
||||
// while allowing FFFFFF.
|
||||
// It uses the top 5 bits of the 8-bit value for the GBC's 5-bit component position,
|
||||
// and the bottom 3 bits to fill the lower, normally zeroed, positions.
|
||||
|
||||
uint32_t final_pix = 0;
|
||||
|
||||
// Red component
|
||||
// 5 most significant bits (MSBs) for the 'systemRedShift' position
|
||||
final_pix |= ((final_red_8bit >> 3) & 0x1f) << systemRedShift;
|
||||
// 3 least significant bits (LSBs) for the 'base' position (systemRedShift - 3)
|
||||
final_pix |= (final_red_8bit & 0x07) << (systemRedShift - 3);
|
||||
|
||||
|
||||
// Green component
|
||||
// 5 MSBs for the 'systemGreenShift' position
|
||||
final_pix |= ((final_green_8bit >> 3) & 0x1f) << systemGreenShift;
|
||||
// 3 LSBs for the 'base' position (systemGreenShift - 3)
|
||||
final_pix |= (final_green_8bit & 0x07) << (systemGreenShift - 3);
|
||||
|
||||
// Blue component
|
||||
// 5 MSBs for the 'systemBlueShift' position
|
||||
final_pix |= ((final_blue_8bit >> 3) & 0x1f) << systemBlueShift;
|
||||
// 3 LSBs for the 'base' position (systemBlueShift - 3)
|
||||
final_pix |= (final_blue_8bit & 0x07) << (systemBlueShift - 3);
|
||||
|
||||
// Preserve existing alpha if present (assuming it's at bits 24-31 for 32-bit depth)
|
||||
if (systemColorDepth == 32) {
|
||||
final_pix |= (pix & (0xFF << 24));
|
||||
}
|
||||
|
||||
*buf++ = final_pix;
|
||||
}
|
||||
}
|
12
src/components/filters_cgb/filters_cgb.h
Normal file
12
src/components/filters_cgb/filters_cgb.h
Normal file
@@ -0,0 +1,12 @@
|
||||
#ifndef VBAM_COMPONENTS_FILTERS_CGB_FILTERS_CGB_H_
|
||||
#define VBAM_COMPONENTS_FILTERS_CGB_FILTERS_CGB_H_
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
void gbcfilter_update_colors(bool lcd = false);
|
||||
void gbcfilter_pal8(uint8_t* buf, int count);
|
||||
void gbcfilter_pal(uint16_t* buf, int count);
|
||||
void gbcfilter_pal32(uint32_t* buf, int count);
|
||||
void gbcfilter_set_params(int color_mode, float lighten_screen);
|
||||
|
||||
#endif // VBAM_COMPONENTS_FILTERS_CGB_FILTERS_CGB_H_
|
@@ -159,6 +159,51 @@ static void SmartIB_MMX(uint8_t *srcPtr, uint32_t srcPitch, int width, int start
|
||||
}
|
||||
#endif
|
||||
|
||||
void SmartIB8(uint8_t *srcPtr, uint32_t srcPitch, int width, int starty, int height)
|
||||
{
|
||||
(void)width; // unused param
|
||||
if(frm1 == NULL) {
|
||||
InterframeFilterInit();
|
||||
}
|
||||
|
||||
uint16_t colorMask = (uint16_t)(~RGB_LOW_BITS_MASK);
|
||||
|
||||
uint8_t *src0 = (uint8_t *)srcPtr + starty * srcPitch;
|
||||
uint8_t *src1 = (uint8_t *)frm1 + srcPitch * starty;
|
||||
uint8_t *src2 = (uint8_t *)frm2 + srcPitch * starty;
|
||||
uint8_t *src3 = (uint8_t *)frm3 + srcPitch * starty;
|
||||
|
||||
int sPitch = srcPitch;
|
||||
|
||||
int pos = 0;
|
||||
for (int j = 0; j < height; j++)
|
||||
for (int i = 0; i < sPitch; i++) {
|
||||
uint16_t color = src0[pos] == 0xff ? 0x7fff : ((src0[pos] & 0xe0) << 7) | ((src0[pos] & 0x1c) << 5) | ((src0[pos] & 0x3) << 3);
|
||||
uint16_t color2 = src1[pos] == 0xff ? 0x7fff : ((src1[pos] & 0xe0) << 7) | ((src1[pos] & 0x1c) << 5) | ((src1[pos] & 0x3) << 3);
|
||||
uint16_t color_dst = ((color & colorMask) >> 1) + ((color2 & colorMask) >> 1);
|
||||
src0[pos] =
|
||||
(src1[pos] != src2[pos]) &&
|
||||
(src3[pos] != color) &&
|
||||
((color == src2[pos]) || (src1[pos] == src3[pos]))
|
||||
? (uint8_t)(((color_dst >> 7) & 0xe0) | ((color_dst >> 5) & 0x1c) | ((color_dst >> 3) & 0x3)) :
|
||||
(uint8_t)(((color >> 7) & 0xe0) | ((color >> 5) & 0x1c) | ((color >> 3) & 0x3));
|
||||
src3[pos] = (uint8_t)(((color >> 7) & 0xe0) | ((color >> 5) & 0x1c) | ((color >> 3) & 0x3)); /* oldest buffer now holds newest frame */
|
||||
pos++;
|
||||
}
|
||||
|
||||
/* Swap buffers around */
|
||||
uint8_t *temp = frm1;
|
||||
frm1 = frm3;
|
||||
frm3 = frm2;
|
||||
frm2 = temp;
|
||||
|
||||
}
|
||||
|
||||
void SmartIB8(uint8_t *srcPtr, uint32_t srcPitch, int width, int height)
|
||||
{
|
||||
SmartIB8(srcPtr, srcPitch, width, 0, height);
|
||||
}
|
||||
|
||||
void SmartIB(uint8_t *srcPtr, uint32_t srcPitch, int width, int starty, int height)
|
||||
{
|
||||
(void)width; // unused param
|
||||
@@ -172,7 +217,7 @@ void SmartIB(uint8_t *srcPtr, uint32_t srcPitch, int width, int starty, int heig
|
||||
}
|
||||
#endif
|
||||
|
||||
uint16_t colorMask = ~RGB_LOW_BITS_MASK;
|
||||
uint16_t colorMask = (uint16_t)(~RGB_LOW_BITS_MASK);
|
||||
|
||||
uint16_t *src0 = (uint16_t *)srcPtr + starty * srcPitch / 2;
|
||||
uint16_t *src1 = (uint16_t *)frm1 + srcPitch * starty / 2;
|
||||
@@ -207,6 +252,64 @@ void SmartIB(uint8_t *srcPtr, uint32_t srcPitch, int width, int height)
|
||||
SmartIB(srcPtr, srcPitch, width, 0, height);
|
||||
}
|
||||
|
||||
void SmartIB24(uint8_t *srcPtr, uint32_t srcPitch, int width, int starty, int height)
|
||||
{
|
||||
(void)width; // unused param
|
||||
if(frm1 == NULL) {
|
||||
InterframeFilterInit();
|
||||
}
|
||||
|
||||
uint8_t colorMask = 0xfe;
|
||||
|
||||
uint8_t *src0 = (uint8_t *)srcPtr + starty * srcPitch / 3;
|
||||
uint8_t *src1 = (uint8_t *)frm1 + srcPitch * starty / 3;
|
||||
uint8_t *src2 = (uint8_t *)frm2 + srcPitch * starty / 3;
|
||||
uint8_t *src3 = (uint8_t *)frm3 + srcPitch * starty / 3;
|
||||
|
||||
int sPitch = srcPitch / 3;
|
||||
|
||||
int pos = 0;
|
||||
for (int j = 0; j < height; j++)
|
||||
for (int i = 0; i < sPitch; i++) {
|
||||
uint8_t color = src0[pos];
|
||||
uint8_t color2 = src0[pos+1];
|
||||
uint8_t color3 = src0[pos+2];
|
||||
src0[pos] =
|
||||
(src1[pos] != src2[pos]) &&
|
||||
(src3[pos] != color) &&
|
||||
((color == src2[pos]) || (src1[pos] == src3[pos]))
|
||||
? (((color & colorMask) >> 1) + ((src1[pos] & colorMask) >> 1)) :
|
||||
color;
|
||||
src0[pos+1] =
|
||||
(src1[pos+1] != src2[pos+1]) &&
|
||||
(src3[pos+1] != color2) &&
|
||||
((color2 == src2[pos+1]) || (src1[pos+1] == src3[pos+1]))
|
||||
? (((color2 & colorMask) >> 1) + ((src1[pos+1] & colorMask) >> 1)) :
|
||||
color2;
|
||||
src0[pos+2] =
|
||||
(src1[pos+2] != src2[pos+2]) &&
|
||||
(src3[pos+2] != color3) &&
|
||||
((color3 == src2[pos+2]) || (src1[pos+1] == src3[pos+2]))
|
||||
? (((color3 & colorMask) >> 1) + ((src1[pos+2] & colorMask) >> 1)) :
|
||||
color3;
|
||||
src3[pos] = color; /* oldest buffer now holds newest frame */
|
||||
src3[pos+1] = color2; /* oldest buffer now holds newest frame */
|
||||
src3[pos+2] = color3; /* oldest buffer now holds newest frame */
|
||||
pos += 3;
|
||||
}
|
||||
|
||||
/* Swap buffers around */
|
||||
uint8_t *temp = frm1;
|
||||
frm1 = frm3;
|
||||
frm3 = frm2;
|
||||
frm2 = temp;
|
||||
}
|
||||
|
||||
void SmartIB24(uint8_t *srcPtr, uint32_t srcPitch, int width, int height)
|
||||
{
|
||||
SmartIB24(srcPtr, srcPitch, width, 0, height);
|
||||
}
|
||||
|
||||
#ifdef MMX
|
||||
static void SmartIB32_MMX(uint8_t *srcPtr, uint32_t srcPitch, int width, int starty, int height)
|
||||
{
|
||||
@@ -443,6 +546,70 @@ static void MotionBlurIB_MMX(uint8_t *srcPtr, uint32_t srcPitch, int width, int
|
||||
}
|
||||
#endif
|
||||
|
||||
void MotionBlurIB24(uint8_t *srcPtr, uint32_t srcPitch, int width, int starty, int height)
|
||||
{
|
||||
(void)width; // unused param
|
||||
if(frm1 == NULL) {
|
||||
InterframeFilterInit();
|
||||
}
|
||||
|
||||
uint8_t colorMask = 0xfe;
|
||||
|
||||
uint8_t *src0 = (uint8_t *)srcPtr + starty * srcPitch / 3;
|
||||
uint8_t *src1 = (uint8_t *)frm1 + starty * srcPitch / 3;
|
||||
int sPitch = srcPitch / 3;
|
||||
|
||||
int pos = 0;
|
||||
for (int j = 0; j < height; j++)
|
||||
for (int i = 0; i < sPitch; i++) {
|
||||
uint8_t color = src0[pos];
|
||||
uint8_t color2 = src0[pos+1];
|
||||
uint8_t color3 = src0[pos+2];
|
||||
src0[pos] = ((color & colorMask) >> 1) + ((src1[pos] & colorMask) >> 1);
|
||||
src0[pos+1] = ((color2 & colorMask) >> 1) + ((src1[pos+1] & colorMask) >> 1);
|
||||
src0[pos+2] = ((color3 & colorMask) >> 1) + ((src1[pos+2] & colorMask) >> 1);
|
||||
src1[pos] = color;
|
||||
src1[pos+1] = color2;
|
||||
src1[pos+2] = color3;
|
||||
pos += 3;
|
||||
}
|
||||
}
|
||||
|
||||
void MotionBlurIB24(uint8_t *srcPtr, uint32_t srcPitch, int width, int height)
|
||||
{
|
||||
MotionBlurIB24(srcPtr, srcPitch, width, 0, height);
|
||||
}
|
||||
|
||||
void MotionBlurIB8(uint8_t *srcPtr, uint32_t srcPitch, int width, int starty, int height)
|
||||
{
|
||||
(void)width; // unused param
|
||||
if(frm1 == NULL) {
|
||||
InterframeFilterInit();
|
||||
}
|
||||
|
||||
uint16_t colorMask = (uint16_t)(~RGB_LOW_BITS_MASK);
|
||||
|
||||
uint8_t *src0 = (uint8_t *)srcPtr + starty * srcPitch;
|
||||
uint8_t *src1 = (uint8_t *)frm1 + starty * srcPitch;
|
||||
int sPitch = srcPitch;
|
||||
|
||||
int pos = 0;
|
||||
for (int j = 0; j < height; j++)
|
||||
for (int i = 0; i < sPitch; i++) {
|
||||
uint16_t color = src0[pos] == 0xff ? 0x7fff : ((src0[pos] & 0xe0) << 7) | ((src0[pos] & 0x1c) << 5) | ((src0[pos] & 0x3) << 3);
|
||||
uint16_t color2 = src1[pos] == 0xff ? 0x7fff : ((src1[pos] & 0xe0) << 7) | ((src1[pos] & 0x1c) << 5) | ((src1[pos] & 0x3) << 3);
|
||||
uint16_t color_dst = ((color & colorMask) >> 1) + ((color2 & colorMask) >> 1);
|
||||
src0[pos] = (uint8_t)(((color_dst >> 7) & 0xe0) | ((color_dst >> 5) & 0x1c) | ((color_dst >> 3) & 0x3));
|
||||
src1[pos] = (uint8_t)(((color >> 7) & 0xe0) | ((color >> 5) & 0x1c) | ((color >> 3) & 0x3));
|
||||
pos++;
|
||||
}
|
||||
}
|
||||
|
||||
void MotionBlurIB8(uint8_t *srcPtr, uint32_t srcPitch, int width, int height)
|
||||
{
|
||||
MotionBlurIB8(srcPtr, srcPitch, width, 0, height);
|
||||
}
|
||||
|
||||
void MotionBlurIB(uint8_t *srcPtr, uint32_t srcPitch, int width, int starty, int height)
|
||||
{
|
||||
(void)width; // unused param
|
||||
@@ -457,7 +624,7 @@ void MotionBlurIB(uint8_t *srcPtr, uint32_t srcPitch, int width, int starty, int
|
||||
}
|
||||
#endif
|
||||
|
||||
uint16_t colorMask = ~RGB_LOW_BITS_MASK;
|
||||
uint16_t colorMask = (uint16_t)(~RGB_LOW_BITS_MASK);
|
||||
|
||||
uint16_t *src0 = (uint16_t *)srcPtr + starty * srcPitch / 2;
|
||||
uint16_t *src1 = (uint16_t *)frm1 + starty * srcPitch / 2;
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user