Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
98ddf300b2 | ||
|
|
12115e6c59 | ||
|
|
1c7c8af7d0 | ||
|
|
fe3b288e65 | ||
|
|
84a51b3601 | ||
|
|
05611e687e | ||
|
|
78421c1ecc | ||
|
|
da3a1e98fd | ||
|
|
028c2e3c0a | ||
|
|
fa74b75c10 | ||
|
|
51ab96ae0d | ||
|
|
82945d86be | ||
|
|
d71febe142 | ||
|
|
fe4d95add4 | ||
|
|
102f97cb07 | ||
|
|
10e3a01fce | ||
|
|
b37d4565d1 | ||
|
|
921f0045a2 | ||
|
|
c5d91b13a1 | ||
|
|
d73b1762a9 | ||
|
|
f6d3f346d8 | ||
|
|
9788dcf2a6 | ||
|
|
116746de32 | ||
|
|
990f4c3639 | ||
|
|
f26c88f95b | ||
|
|
8307051b6a | ||
|
|
6aa9c192ed | ||
|
|
0995755d56 | ||
|
|
333b86b81c | ||
|
|
4adc14081a | ||
|
|
7c25d80e2b | ||
|
|
159e6213df | ||
|
|
fd118bd1cf | ||
|
|
8ac868da8b | ||
|
|
3b88d2086f | ||
|
|
9b7024becb | ||
|
|
b0f9221dca | ||
|
|
d854219aa9 | ||
|
|
056188d31e | ||
|
|
b466277ae9 | ||
|
|
8c63fe7dcd | ||
|
|
4d8cc8d980 | ||
|
|
9a909d5e9d | ||
|
|
6bc1e3c838 | ||
|
|
a0d2801f64 | ||
|
|
ac076a890d | ||
|
|
f89ea26a1b | ||
|
|
be80be1a24 | ||
|
|
0c0db6e986 | ||
|
|
4fca55f381 | ||
|
|
c8f3497730 | ||
|
|
7686500d1a | ||
|
|
b9cebb4453 | ||
|
|
679eb6fcd9 | ||
|
|
21ae7bea54 | ||
|
|
0f6d38ec1a | ||
|
|
97d28467b8 | ||
|
|
baddbbded1 | ||
|
|
2db0665299 | ||
|
|
82880179d2 | ||
|
|
e688399906 | ||
|
|
462c1aa715 | ||
|
|
c5c2de9507 | ||
|
|
5771519119 | ||
|
|
99b39937c4 | ||
|
|
6890172ba2 | ||
|
|
0f1eac972c | ||
|
|
0d1da2084a | ||
|
|
bd388e91cf | ||
|
|
dc99a85999 | ||
|
|
f73f4a914a | ||
|
|
29a10adaff | ||
|
|
d7bf07d0e6 | ||
|
|
ad7aca815a | ||
|
|
fda4fe0f17 | ||
|
|
6f5ad5b668 | ||
|
|
195dc3e24d | ||
|
|
d35d0152f8 | ||
|
|
5801e9f9e6 | ||
|
|
006e9db355 | ||
|
|
8eae2d40eb | ||
|
|
baf3038cd1 | ||
|
|
52011c5dcf | ||
|
|
39b9138854 | ||
|
|
ae9d550713 | ||
|
|
4f151ba7f3 | ||
|
|
3f5aeef137 | ||
|
|
4dd532a1f4 | ||
|
|
87a9e4a361 | ||
|
|
f1bfca24ab | ||
|
|
55c6b66ff4 | ||
|
|
799bec628e | ||
|
|
f50169703c | ||
|
|
f5b44b800b | ||
|
|
2b7b512d91 | ||
|
|
74a62e770f | ||
|
|
b54c4d94c9 | ||
|
|
f388808dd5 | ||
|
|
12f7d5669e | ||
|
|
56e1306436 | ||
|
|
1d8e8de021 | ||
|
|
0cbda94442 | ||
|
|
19777317de | ||
|
|
79b68d9c8c | ||
|
|
fb01cf5ec0 | ||
|
|
b60279fce4 | ||
|
|
f6c1e219f4 | ||
|
|
2aceec95cc | ||
|
|
4e4f85a5f5 | ||
|
|
219f68c626 | ||
|
|
374a5d4b72 | ||
|
|
54051990cd | ||
|
|
ff76b235c7 | ||
|
|
c565aa23d4 | ||
|
|
7d0e799891 | ||
|
|
d9f12abc00 | ||
|
|
13e04ce769 | ||
|
|
b43c55bd16 | ||
|
|
fa85fcbe8e | ||
|
|
a16b4a6baf | ||
|
|
364b6b4ee2 | ||
|
|
4ca1f79ab9 | ||
|
|
6709a5e275 | ||
|
|
62dd245aed | ||
|
|
86895dcdbd | ||
|
|
6efe6ecbcf | ||
|
|
8621d937c2 | ||
|
|
7e35512c44 | ||
|
|
7ebceffe79 | ||
|
|
c57c062f25 | ||
|
|
5f02a06a27 | ||
|
|
2af8cce2bb | ||
|
|
5f9560441f | ||
|
|
6e6a6175fd | ||
|
|
c0c4c2f4d0 | ||
|
|
a48ae4bc4e | ||
|
|
98be15e700 | ||
|
|
0f52b9f48a | ||
|
|
05e442e141 | ||
|
|
c6388d2a70 | ||
|
|
e5775f675f | ||
|
|
9f301944c2 | ||
|
|
122ba04a96 | ||
|
|
10ce6a2a8f | ||
|
|
3b55bceffc | ||
|
|
c116241190 | ||
|
|
84d6e8c641 | ||
|
|
50ca670e0d | ||
|
|
f75541f5a6 | ||
|
|
e6f2e2a2a8 | ||
|
|
01f26ed978 | ||
|
|
119ca0197e | ||
|
|
9ac8d7c62d | ||
|
|
5cec0988eb | ||
|
|
d0c83bb5fc | ||
|
|
5fbd44a9b0 | ||
|
|
99b7124ed1 | ||
|
|
cc4ebeeb38 | ||
|
|
40f83e952b | ||
|
|
13af2bf64c | ||
|
|
71b46f4f20 | ||
|
|
344809cdde | ||
|
|
136738824c | ||
|
|
a84fb416de | ||
|
|
dd504f3f89 | ||
|
|
c41c111bc9 | ||
|
|
b41712afdc | ||
|
|
dffd78f2c3 | ||
|
|
3e43fdd83e | ||
|
|
02798b5732 | ||
|
|
7c9d874bf5 | ||
|
|
949b394e8b | ||
|
|
fb4c47790a | ||
|
|
564f66ef8f | ||
|
|
366d4a8ccb | ||
|
|
d8d2099421 | ||
|
|
bdaf9c1d51 | ||
|
|
ba73add03b | ||
|
|
a61f1674be | ||
|
|
9de877163d | ||
|
|
7eaec42723 | ||
|
|
ef7b754633 | ||
|
|
0139aef7cf | ||
|
|
6f6ee77f4b | ||
|
|
9a4f748199 | ||
|
|
f2f561a701 | ||
|
|
b0ebab1bd4 | ||
|
|
8d3c3d3348 | ||
|
|
606596f1f1 | ||
|
|
d30c9b9c99 | ||
|
|
62dd78aa8d | ||
|
|
2cf50965dc | ||
|
|
14df08be98 | ||
|
|
352b58f0ae | ||
|
|
2fb93e20f4 | ||
|
|
3827531ead | ||
|
|
d1a01b527a | ||
|
|
d26b3f13fb | ||
|
|
b337acc1f3 | ||
|
|
4c289c0d5d | ||
|
|
c66cf8d7e7 | ||
|
|
dda9c16a80 | ||
|
|
bb75c9a35f | ||
|
|
a9dd4139ee | ||
|
|
5f15f22fcd | ||
|
|
39d38050b1 | ||
|
|
a75b442696 | ||
|
|
f8e0be4212 | ||
|
|
43a173bfe5 | ||
|
|
ec45d1802d | ||
|
|
269a10e090 | ||
|
|
8af33bc12f | ||
|
|
1aa3cfdffc | ||
|
|
b78aa61494 | ||
|
|
016b9bd11e | ||
|
|
4df2c07626 | ||
|
|
8ec79c216f | ||
|
|
ccee7d8da2 | ||
|
|
0fe0277e88 | ||
|
|
fd4bf7c3ae | ||
|
|
926bc4d20f | ||
|
|
13e7b8f057 | ||
|
|
c492e7f63b | ||
|
|
63ddb79c16 | ||
|
|
a0f0b51a7d | ||
|
|
1114fad340 | ||
|
|
62e4015096 | ||
|
|
beead06c09 | ||
|
|
69cd9afc93 | ||
|
|
eb20e24397 | ||
|
|
bc73bf4e9b | ||
|
|
cfdef3de77 | ||
|
|
228201d3e1 | ||
|
|
d79f88cb4b | ||
|
|
37cb81016a | ||
|
|
546d964c3b | ||
|
|
194e19196d | ||
|
|
f75ec63b1e | ||
|
|
b8c7c5f262 | ||
|
|
9278314222 | ||
|
|
0352b63f73 | ||
|
|
18fc3a6206 | ||
|
|
edfd0ba01b | ||
|
|
0ae7f1dc1d | ||
|
|
8075a8544d | ||
|
|
e8cdc58fb0 | ||
|
|
4dd690900c | ||
|
|
e810f0e7a6 | ||
|
|
40de130363 | ||
|
|
07e655794b | ||
|
|
a557407c71 | ||
|
|
fa282dc2d1 | ||
|
|
42f9cd28fd | ||
|
|
a7de70fe15 | ||
|
|
b7eb5fa064 | ||
|
|
70bf649aec | ||
|
|
17f3f0c802 | ||
|
|
97144d9ce8 | ||
|
|
5d1739c736 | ||
|
|
657d0b2c8f | ||
|
|
fe856ea716 | ||
|
|
b171adcc33 | ||
|
|
a77f10ccb5 | ||
|
|
4ae43a98dc | ||
|
|
e819891ffc | ||
|
|
174ddc4281 | ||
|
|
a001088581 | ||
|
|
3cfa175196 | ||
|
|
7c54f6d527 | ||
|
|
c944b18111 | ||
|
|
4843b29eb6 | ||
|
|
ecec7ad81d | ||
|
|
a1aeeb1313 | ||
|
|
295cdc9f0f | ||
|
|
06d1ac96f9 | ||
|
|
8d97de2af8 | ||
|
|
fa11494067 | ||
|
|
3211ee1861 | ||
|
|
cef112292a | ||
|
|
5f8ed1189c | ||
|
|
affb3b60f6 | ||
|
|
543b340820 | ||
|
|
935331c5eb | ||
|
|
7cf75fd2c1 | ||
|
|
b83786ff08 | ||
|
|
2b480a266a | ||
|
|
ce95a2668d | ||
|
|
ee06c9068b | ||
|
|
2035d78b52 | ||
|
|
aea0dee2ef | ||
|
|
9cbd27d307 | ||
|
|
7bebf9ea7a | ||
|
|
40a163b478 | ||
|
|
27e9152fe7 | ||
|
|
442086b36c | ||
|
|
82fc774da6 | ||
|
|
66f095a7d9 | ||
|
|
7476dee430 | ||
|
|
632dbeac1b | ||
|
|
998ddc16dc | ||
|
|
8a9a21f285 | ||
|
|
90ea63597e | ||
|
|
df352726ce | ||
|
|
9449a6599f | ||
|
|
f2a02366be | ||
|
|
f68d029b9f | ||
|
|
6f48a372bf | ||
|
|
853629b6aa | ||
|
|
8fe78cfe60 | ||
|
|
0388f4a12f | ||
|
|
5e72707059 | ||
|
|
79a7111dfa | ||
|
|
90642ca5ae | ||
|
|
f11907cb9d | ||
|
|
54be88f43f | ||
|
|
ec648a3f3f | ||
|
|
ca22a6953d | ||
|
|
fdda7359c1 | ||
|
|
4db3a8c285 | ||
|
|
c4a046f7c4 | ||
|
|
8eb4776ce0 | ||
|
|
0dcb158eab | ||
|
|
685e77285f | ||
|
|
650274859e | ||
|
|
3241e30ea9 | ||
|
|
ea95b66680 | ||
|
|
b053baaf86 | ||
|
|
9d046fe578 | ||
|
|
0c539a0395 | ||
|
|
7ac50ea0db | ||
|
|
e466239372 | ||
|
|
ceb224d5b5 | ||
|
|
5277e71dac | ||
|
|
ba8043ccdb | ||
|
|
cf10cf56f1 | ||
|
|
1212ce9664 | ||
|
|
0a45216aff | ||
|
|
fa61afc565 | ||
|
|
e18b1c12a7 | ||
|
|
eb1cb5346e | ||
|
|
bc693f8244 | ||
|
|
eb91894d69 | ||
|
|
d1832df2ad | ||
|
|
068f42ad92 | ||
|
|
ed8a0febc2 | ||
|
|
a8e0ae9020 | ||
|
|
a706f0f997 | ||
|
|
3948f11cf2 | ||
|
|
306f40246d | ||
|
|
e1435bdc0f | ||
|
|
861e6a4d7b | ||
|
|
e051d93fc1 | ||
|
|
ab8b42d88c | ||
|
|
142598aa44 | ||
|
|
8531c6cbbb | ||
|
|
80bc44df7e | ||
|
|
2182291409 | ||
|
|
dfffb9b80f | ||
|
|
d8f6d0324a | ||
|
|
0820e71165 | ||
|
|
bc4902c4b3 | ||
|
|
40d105d04e | ||
|
|
bed5608428 | ||
|
|
91aaf2a205 | ||
|
|
dcccf402a7 | ||
|
|
cf41e92458 | ||
|
|
d8dd4807a9 | ||
|
|
749a13ccf6 | ||
|
|
690b4b07a1 | ||
|
|
c2aabae647 | ||
|
|
ab8512efcf | ||
|
|
dccdb61ac7 | ||
|
|
5759ffc9de | ||
|
|
0d3c74b69a | ||
|
|
71d9114419 | ||
|
|
b6472f23c3 | ||
|
|
2f91d60a8c | ||
|
|
5db058e750 | ||
|
|
33c1bb2f7b | ||
|
|
2b4dd2c226 | ||
|
|
256cc9af17 | ||
|
|
0ace428b5d | ||
|
|
9795274864 | ||
|
|
fc7ddc31ab | ||
|
|
98c7dc83ce | ||
|
|
981b347657 | ||
|
|
637467b27b | ||
|
|
a7cf15c27c | ||
|
|
7b8f87a428 | ||
|
|
544ddc86fd | ||
|
|
ba294f7468 | ||
|
|
5df71de0b6 | ||
|
|
d7ddb270ac | ||
|
|
17f5b95371 | ||
|
|
a5cae2177c | ||
|
|
0a21754eb3 | ||
|
|
f91a4ca64e | ||
|
|
b85a7a0fd8 | ||
|
|
2907a171ff | ||
|
|
b2f8f492fe | ||
|
|
687ff98a23 | ||
|
|
42f9e40c12 | ||
|
|
bbaf1808ae | ||
|
|
515e4e710c | ||
|
|
f930acc096 | ||
|
|
72c70f8f3d | ||
|
|
3d22937cff | ||
|
|
84bba8b858 | ||
|
|
cf70529670 | ||
|
|
b116cfb258 | ||
|
|
0a3725b628 | ||
|
|
3353d241f0 | ||
|
|
357a60863f | ||
|
|
08248d2897 | ||
|
|
6a6d279d4e | ||
|
|
59d1e24e68 | ||
|
|
288e25ef39 | ||
|
|
5aaa811f04 | ||
|
|
05c22d73f0 | ||
|
|
c57507eb2a | ||
|
|
c7be60c83b | ||
|
|
485cc715e8 | ||
|
|
0872937a11 | ||
|
|
de0df334c0 | ||
|
|
3ff2164b31 | ||
|
|
602ac5fb94 | ||
|
|
39d5d44888 | ||
|
|
78bce3133a | ||
|
|
aa836fcc63 | ||
|
|
cef79c3022 | ||
|
|
696eff58be | ||
|
|
50de3088c7 | ||
|
|
0e17d83856 | ||
|
|
21b72aaab2 | ||
|
|
7bebe2a504 | ||
|
|
c5c6821632 | ||
|
|
f607741abf | ||
|
|
1c367b9338 | ||
|
|
4d5e8db0c7 | ||
|
|
979ca2e7a4 | ||
|
|
6f9914ca14 | ||
|
|
95696c206e | ||
|
|
b12f5a30c0 | ||
|
|
55652f1d98 | ||
|
|
f39a5b0997 | ||
|
|
157a1a7e7b | ||
|
|
968a13c432 | ||
|
|
06ee31fce8 | ||
|
|
d22fbac295 | ||
|
|
c03b2bd41c | ||
|
|
7302a8ab38 | ||
|
|
ffbeab6759 | ||
|
|
60d8417540 | ||
|
|
541f65e180 | ||
|
|
24a5e3844f | ||
|
|
6f3de9da78 | ||
|
|
ffefe2f779 | ||
|
|
675de3d66e | ||
|
|
e4f40da2f2 | ||
|
|
a7c15d14df | ||
|
|
c0435ce1f4 | ||
|
|
561eab15a7 | ||
|
|
53c65285e1 | ||
|
|
943d33711e | ||
|
|
0938d6f4da | ||
|
|
43c3239a4c | ||
|
|
ab640fadfe | ||
|
|
920ec5dd04 | ||
|
|
bf58700777 | ||
|
|
3258da3917 | ||
|
|
cba7f6cd90 | ||
|
|
4167ad7da6 | ||
|
|
481505e796 | ||
|
|
79beea1bc9 | ||
|
|
264722d045 | ||
|
|
bc9516ba98 | ||
|
|
c6ef344ce5 | ||
|
|
4277666e7a | ||
|
|
0df2709eec | ||
|
|
3d4f8f1e96 | ||
|
|
5d0ba73b59 | ||
|
|
896e27bd6e | ||
|
|
033d5e5b2a | ||
|
|
0ed488b5ac | ||
|
|
25c74f1e32 | ||
|
|
b2df8bdb06 | ||
|
|
9999edf0d2 | ||
|
|
fd00536b0d | ||
|
|
918141c701 | ||
|
|
732955ba5f | ||
|
|
5fbc05d675 | ||
|
|
6e75eb24ab | ||
|
|
dbb444eceb | ||
|
|
aa5a700789 | ||
|
|
22b322d57e | ||
|
|
5901c2086e | ||
|
|
0c4efb911f | ||
|
|
7073f5e21d | ||
|
|
1f3c5b17df | ||
|
|
1baa0805d8 | ||
|
|
c27d75f3fa | ||
|
|
86457b6614 | ||
|
|
0ee1183d84 | ||
|
|
43842f962c | ||
|
|
18627d5a8e | ||
|
|
d00f5b18e1 | ||
|
|
a712d631c5 | ||
|
|
7b051c101b | ||
|
|
8cb0a1c56d | ||
|
|
b5f00f5a90 | ||
|
|
813e093e28 | ||
|
|
eb5a34f461 | ||
|
|
3c561a6824 | ||
|
|
e69b1fbc76 | ||
|
|
2301c69e6d | ||
|
|
4d9afc50bb | ||
|
|
32efb3d026 | ||
|
|
d37692aa1e | ||
|
|
16f6b5bf82 | ||
|
|
9208181d63 | ||
|
|
86fb7d34a9 | ||
|
|
5a5e05f5f6 | ||
|
|
fc2e3c1e07 | ||
|
|
7cbaac4a28 | ||
|
|
53cd231363 | ||
|
|
46c81075fc | ||
|
|
37d9a2763c | ||
|
|
d9a36cfb97 | ||
|
|
e4c8422a8a | ||
|
|
73a04e14d0 | ||
|
|
e1fb40ab83 | ||
|
|
8646398a31 | ||
|
|
dd2a46e07e | ||
|
|
5a343665f0 | ||
|
|
71f137b6d6 | ||
|
|
b9abe63d8d | ||
|
|
59398dce43 | ||
|
|
080bbbbc1a | ||
|
|
dff0841d48 | ||
|
|
9a99031190 | ||
|
|
4ab303c820 | ||
|
|
ffdfb216a8 | ||
|
|
2356a7431d | ||
|
|
495ea6e414 | ||
|
|
2b298323a6 | ||
|
|
98a776cf44 | ||
|
|
ad7e168a8c | ||
|
|
2ccad66558 | ||
|
|
c342f95d3e | ||
|
|
e3fa21f04b | ||
|
|
f3b731dd51 | ||
|
|
20f801ba2e | ||
|
|
b0a2baef8d | ||
|
|
e7b9880cbb | ||
|
|
ba24458387 | ||
|
|
c9c2a73cd6 | ||
|
|
c793b273a6 | ||
|
|
055c7eb5b2 | ||
|
|
40ff1b465b | ||
|
|
cc241b036b | ||
|
|
b6267a0e93 | ||
|
|
8f7516154f | ||
|
|
2da0457f56 | ||
|
|
62a03401c1 | ||
|
|
62a736cc67 | ||
|
|
af131132e9 | ||
|
|
b30bd9f527 | ||
|
|
3344175dea | ||
|
|
dfb27be0b4 | ||
|
|
54bd914ff1 | ||
|
|
2f3a221d45 | ||
|
|
850421c5fa | ||
|
|
489137979b | ||
|
|
aa0d0e8bfb | ||
|
|
c2083b90fd | ||
|
|
b7caaa8a3e | ||
|
|
a595fbf590 | ||
|
|
f34ddb1097 | ||
|
|
a7ac6300ab | ||
|
|
fdadaca0df | ||
|
|
5efb97311f | ||
|
|
98aa0d9193 | ||
|
|
2899f1556a | ||
|
|
1d0275f150 | ||
|
|
36d36de6a6 | ||
|
|
f8cdad5e93 | ||
|
|
e18c072673 | ||
|
|
07e9c328af | ||
|
|
0b9a6bb2b5 | ||
|
|
8ff7d51859 | ||
|
|
d9e846aca3 | ||
|
|
52b2b62ad9 | ||
|
|
d67a290cca | ||
|
|
b46d051e1d | ||
|
|
56e3221f9d | ||
|
|
7ce694f8cb | ||
|
|
1c55f603e9 | ||
|
|
488f15defe | ||
|
|
ab34dd4119 | ||
|
|
3cab8dc142 | ||
|
|
77839da3e6 | ||
|
|
4db1dafc99 | ||
|
|
6ca530c966 | ||
|
|
c6ca10036f | ||
|
|
9bc084a2cd | ||
|
|
b056af9f68 | ||
|
|
3e7b37b263 | ||
|
|
a99ae416d8 | ||
|
|
81f3ddcad4 | ||
|
|
22a06c6fa7 | ||
|
|
2b0b2ea2db | ||
|
|
dfdae10719 | ||
|
|
3dd7c37bd3 | ||
|
|
f9257a855b | ||
|
|
130614bda8 | ||
|
|
3697110a37 | ||
|
|
1ce0f10240 | ||
|
|
39b869fd2b | ||
|
|
0ccc8074c0 | ||
|
|
c1e676f44e | ||
|
|
01c306b547 | ||
|
|
b954a90444 | ||
|
|
b05b713926 | ||
|
|
8b5308a9ab | ||
|
|
e28d1e8171 | ||
|
|
cad6fc4c1c | ||
|
|
57356a4cfc | ||
|
|
eb6981287c | ||
|
|
bc44104642 | ||
|
|
c983a5a698 | ||
|
|
a714bd50f7 | ||
|
|
c56f028a1f | ||
|
|
65122bd5c9 | ||
|
|
d376cbc451 | ||
|
|
dda8450465 | ||
|
|
8ed40ff7df | ||
|
|
07d979f758 | ||
|
|
435833499d | ||
|
|
5f4fdd0b52 | ||
|
|
4c5d5810c8 | ||
|
|
c9feaf93fd | ||
|
|
5c654c65cb | ||
|
|
7e03f93823 | ||
|
|
810b6f7155 | ||
|
|
8b3557af9d | ||
|
|
62fd313b3f | ||
|
|
16e881242a | ||
|
|
171d6e3126 | ||
|
|
0477b558bf | ||
|
|
52cb2a1bf8 | ||
|
|
cad7db63d0 | ||
|
|
1fab22d730 | ||
|
|
f4172ea19c | ||
|
|
f046dbf328 | ||
|
|
0606bbe687 | ||
|
|
df57ac4e31 | ||
|
|
e0796651f7 | ||
|
|
189312068d | ||
|
|
0802564789 | ||
|
|
2a3f35af62 | ||
|
|
b0220ecf03 | ||
|
|
c61f3f1fc5 | ||
|
|
78b4afd758 | ||
|
|
88de8fe3fe | ||
|
|
ebfbfa59f0 | ||
|
|
8261440869 | ||
|
|
f3b623c922 | ||
|
|
15795b327f | ||
|
|
488afe1a2f | ||
|
|
506d601379 | ||
|
|
a3b77bceab | ||
|
|
b770656915 | ||
|
|
b5d3c54bc9 | ||
|
|
f8f1bc5be1 | ||
|
|
bfca445dfa | ||
|
|
4355f15780 | ||
|
|
e8dd79ebf1 | ||
|
|
8acda1ba26 | ||
|
|
653166ab5d | ||
|
|
1e3e39ee1a | ||
|
|
aa3a7266ec | ||
|
|
3a0ec2db83 | ||
|
|
064df41294 | ||
|
|
f9d668ca95 | ||
|
|
61fcdff5d0 | ||
|
|
cffda40fb3 | ||
|
|
407e36c4d0 | ||
|
|
3c424cb46a | ||
|
|
27c3b51018 | ||
|
|
f6ef868926 | ||
|
|
0cf3e09127 | ||
|
|
3a094e18c9 | ||
|
|
08e402cd73 | ||
|
|
e7f1390d17 | ||
|
|
c646752092 | ||
|
|
00ffbf0434 | ||
|
|
23bb902bf6 | ||
|
|
863f833b85 | ||
|
|
2fde8fa13b | ||
|
|
eb903dea68 | ||
|
|
32877632fb | ||
|
|
bc8068290e | ||
|
|
81ba092910 | ||
|
|
e40f7403f7 | ||
|
|
77e453e93f | ||
|
|
51605ecabe | ||
|
|
1af78b420a | ||
|
|
3c26b04211 | ||
|
|
2e82ef6cef | ||
|
|
51c3f8052b | ||
|
|
283be11213 | ||
|
|
aaa40c251b | ||
|
|
1994011c7e | ||
|
|
29547c2d96 | ||
|
|
f294e635cf | ||
|
|
0a1fabbf55 | ||
|
|
3f618421ed | ||
|
|
6d75bf6352 | ||
|
|
ff306731f6 | ||
|
|
4de75d599f | ||
|
|
12d47fb2bb | ||
|
|
ec4966a47f | ||
|
|
164a8b316c | ||
|
|
f1f74a19a7 | ||
|
|
400846ffa2 | ||
|
|
93d63d9c31 | ||
|
|
cec7700615 | ||
|
|
0f48167965 | ||
|
|
6b297ce98c | ||
|
|
88f88424a5 | ||
|
|
7d7635f7e1 | ||
|
|
67a8798132 | ||
|
|
7af56f874d | ||
|
|
379d51d2d7 | ||
|
|
f5f7605877 | ||
|
|
c7ee093617 | ||
|
|
7438e0ba6e | ||
|
|
3a3a06f6c5 | ||
|
|
cb13149531 | ||
|
|
3074ac7213 | ||
|
|
67fe3a3a9c | ||
|
|
7eba290299 | ||
|
|
0040a59fb8 | ||
|
|
8aed6ae33b | ||
|
|
ab5a8ddc5e | ||
|
|
0b192b855b | ||
|
|
52ae347952 | ||
|
|
233489de4b | ||
|
|
0f7ea2ea5c | ||
|
|
c741da34d2 | ||
|
|
e5e3cdfd2f | ||
|
|
a43472c05f | ||
|
|
f47f7e3635 | ||
|
|
683f1cd35e | ||
|
|
42b642d827 | ||
|
|
7756abc26f | ||
|
|
326dc9b364 | ||
|
|
10928ea64e | ||
|
|
4a52c78dc5 | ||
|
|
b19d0d4857 | ||
|
|
9e9c70b63c | ||
|
|
e61ca03011 | ||
|
|
673cf5e019 | ||
|
|
244acf7d55 | ||
|
|
3b25e1e2fa | ||
|
|
bf3df6058b | ||
|
|
d34700b6f8 | ||
|
|
43f44fc85b | ||
|
|
93c54e18ea | ||
|
|
c15e5496de | ||
|
|
db7401ae04 | ||
|
|
0ce18f4639 | ||
|
|
3d7e32dd3d | ||
|
|
9f96916716 | ||
|
|
d7ea9b12b4 | ||
|
|
39c58e9921 | ||
|
|
44773d6927 | ||
|
|
7bd5a3e976 | ||
|
|
377ff05fc8 | ||
|
|
6f63e2f9a3 | ||
|
|
40819ab189 | ||
|
|
21065f656f | ||
|
|
3bf778b276 | ||
|
|
8eabc42641 | ||
|
|
7079e41cf7 | ||
|
|
2a940d3492 | ||
|
|
71b4edac9e | ||
|
|
3f9c8c052c | ||
|
|
a34245bab4 | ||
|
|
16175fd4e1 | ||
|
|
62598fdc01 | ||
|
|
74eaa00d11 | ||
|
|
c48c639999 | ||
|
|
ca5fe9ebca | ||
|
|
3814669101 | ||
|
|
e050f65ae7 | ||
|
|
02004553ca | ||
|
|
929c181281 | ||
|
|
24074b261f | ||
|
|
263d95e166 | ||
|
|
37afe79b20 | ||
|
|
9c8585d2af | ||
|
|
839d69ca04 | ||
|
|
4c39d0140b | ||
|
|
83a85bad6d | ||
|
|
743ce65e8d | ||
|
|
7b47e8f1e6 | ||
|
|
6a94470f5a | ||
|
|
57a506219a | ||
|
|
4636bcc964 | ||
|
|
e7d217ad9c | ||
|
|
968a7f915d | ||
|
|
e0981a5884 | ||
|
|
1a9eaff9f8 | ||
|
|
102e96efdd | ||
|
|
0fcadf6ed1 | ||
|
|
5f4bdd7f0d | ||
|
|
99b039de81 | ||
|
|
007857634b | ||
|
|
9d343ed826 | ||
|
|
4163a3fef1 | ||
|
|
06f427cf5c | ||
|
|
fd003224f6 | ||
|
|
a98783681b | ||
|
|
32bf25c31c | ||
|
|
5c3a79d396 | ||
|
|
431be0ba23 | ||
|
|
95f0d972e5 | ||
|
|
d61a8d3b21 | ||
|
|
3831566982 | ||
|
|
aecf03e24a | ||
|
|
e9bbb3f165 | ||
|
|
c2eb239da2 | ||
|
|
0d3ae5240d | ||
|
|
c496ccb189 | ||
|
|
fbe282c331 | ||
|
|
9b06b06c67 | ||
|
|
07566fd1f1 | ||
|
|
aef908c072 | ||
|
|
0ea850b5f4 | ||
|
|
0676c5e399 | ||
|
|
c9972f8935 | ||
|
|
86689dcf9e | ||
|
|
43341b67b0 | ||
|
|
7aa219949f | ||
|
|
652a1f4877 | ||
|
|
8d9fe660b3 | ||
|
|
b7b9316883 | ||
|
|
32361423bf | ||
|
|
1471ac8ace | ||
|
|
e6399eb176 | ||
|
|
71c34c0acb | ||
|
|
1e4968a4f8 | ||
|
|
1782525344 | ||
|
|
ccae111380 | ||
|
|
20f3eab18a | ||
|
|
af0f9188bc | ||
|
|
a2d320d9f8 | ||
|
|
86ad7a1a6e | ||
|
|
1ae5b1b532 | ||
|
|
de54617f0c | ||
|
|
55fef0df33 | ||
|
|
dfb7832267 | ||
|
|
5a90876f5f | ||
|
|
83d5d17256 | ||
|
|
05f70c0c46 | ||
|
|
c53167db54 | ||
|
|
1e7708183a | ||
|
|
984f05bf9a | ||
|
|
1fdddeab2e | ||
|
|
7048eeaac4 | ||
|
|
4a076aa916 | ||
|
|
56ebe22921 | ||
|
|
f768503f55 | ||
|
|
760ed788fd | ||
|
|
e2ea3238f6 | ||
|
|
cb119fbf45 |
@@ -1,13 +0,0 @@
|
||||
codecov:
|
||||
max_report_age: off
|
||||
notify:
|
||||
wait_for_ci: false
|
||||
require_ci_to_pass: false
|
||||
comment:
|
||||
require_base: false
|
||||
require_head: false
|
||||
coverage:
|
||||
status:
|
||||
project:
|
||||
default:
|
||||
threshold: 0.07
|
||||
@@ -0,0 +1 @@
|
||||
*.patch -whitespace
|
||||
@@ -1 +0,0 @@
|
||||
github: nmoinvaz
|
||||
@@ -0,0 +1,214 @@
|
||||
name: Binary dependencies
|
||||
|
||||
on:
|
||||
push:
|
||||
schedule:
|
||||
- cron: '30 2 * * 3'
|
||||
workflow_dispatch:
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: false
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
env:
|
||||
BEXT_ARCHIVE_RETENTION_DAYS: 90
|
||||
|
||||
jobs:
|
||||
# Finalized package metadata retains its install prefix. runner.temp is
|
||||
# stable between producer and consumer jobs on each pinned runner image.
|
||||
linux_release:
|
||||
name: Ubuntu GCC Release Build
|
||||
runs-on: ubuntu-24.04
|
||||
outputs:
|
||||
artifact-id: ${{ steps.upload.outputs.artifact-id }}
|
||||
steps:
|
||||
- name: Setup - CMake
|
||||
uses: lukka/get-cmake@latest
|
||||
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Setup - System
|
||||
env:
|
||||
DEBIAN_FRONTEND: noninteractive
|
||||
run: |
|
||||
sudo apt-get update
|
||||
# Install XCB/OpenGL dev pkgs for Qt - see:
|
||||
# https://wiki.qt.io/Building_Qt_6_from_Git
|
||||
# https://doc.qt.io/qt-6/linux-requirements.html
|
||||
sudo apt-get install libfontconfig1-dev libfreetype6-dev libx11-dev libx11-xcb-dev libxext-dev libxfixes-dev libxi-dev libxrender-dev libxcb1-dev libxcb-cursor-dev libxcb-glx0-dev libxcb-keysyms1-dev libxcb-image0-dev libxcb-shm0-dev libxcb-icccm4-dev libxcb-sync-dev libxcb-xfixes0-dev libxcb-shape0-dev libxcb-randr0-dev libxcb-render-util0-dev libxcb-util-dev libxcb-xinerama0-dev libxcb-xkb-dev libxkbcommon-dev libxkbcommon-x11-dev
|
||||
sudo apt-get install libgl-dev
|
||||
sudo apt-get install libinput-dev
|
||||
sudo apt-get clean
|
||||
|
||||
- name: Configure
|
||||
run: cmake -S . -G Ninja -B build -DENABLE_ALL=ON -DGIT_SHALLOW_CLONE=ON -DCMAKE_BUILD_TYPE=Release -DEXT_BUILD_VERBOSE=ON -DCMAKE_INSTALL_PREFIX="$RUNNER_TEMP/bext_output"
|
||||
|
||||
- name: Build
|
||||
run: cmake --build build --parallel 2 --verbose
|
||||
|
||||
- name: Package dependency tree
|
||||
if: github.ref == 'refs/heads/main'
|
||||
shell: bash
|
||||
env:
|
||||
BEXT_CHANNEL: ubuntu-24.04-${{ runner.arch }}-release
|
||||
working-directory: ${{ runner.temp }}/bext_output
|
||||
run: |
|
||||
test -d install
|
||||
test -d noinstall
|
||||
test -f bext-install-manifest.json
|
||||
cmake -E tar cfz "$RUNNER_TEMP/bext-$BEXT_CHANNEL.tar.gz" --format=gnutar install noinstall bext-install-manifest.json
|
||||
|
||||
- name: Upload dependency tree
|
||||
if: github.ref == 'refs/heads/main'
|
||||
id: upload
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: bext-ubuntu-24.04-${{ runner.arch }}-release-${{ github.sha }}
|
||||
path: ${{ runner.temp }}/bext-ubuntu-24.04-${{ runner.arch }}-release.tar.gz
|
||||
if-no-files-found: error
|
||||
retention-days: ${{ env.BEXT_ARCHIVE_RETENTION_DAYS }}
|
||||
compression-level: 0
|
||||
|
||||
windows_ninja_release:
|
||||
name: MSVC - Ninja Release build
|
||||
runs-on: windows-2025
|
||||
outputs:
|
||||
artifact-id: ${{ steps.upload.outputs.artifact-id }}
|
||||
steps:
|
||||
- name: Setup - CMake
|
||||
uses: lukka/get-cmake@latest
|
||||
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Add github workspace to path
|
||||
shell: pwsh
|
||||
run: Add-Content -Path $env:GITHUB_PATH -Value $env:GITHUB_WORKSPACE
|
||||
|
||||
- name: Add msbuild to PATH
|
||||
uses: microsoft/setup-msbuild@v2
|
||||
|
||||
- name: Add cl.exe to PATH
|
||||
uses: ilammy/msvc-dev-cmd@v1
|
||||
|
||||
- name: Configure
|
||||
shell: pwsh
|
||||
run: |
|
||||
cmake -S . -B build -G Ninja -DCMAKE_C_COMPILER=cl.exe -DCMAKE_CXX_COMPILER=cl.exe -DCMAKE_BUILD_TYPE=Release -DENABLE_ALL=ON -DGIT_SHALLOW_CLONE=ON -DEXT_BUILD_VERBOSE=ON -DCMAKE_INSTALL_PREFIX="$env:RUNNER_TEMP/bext_output"
|
||||
# Ensure generated files are flushed before compilation begins.
|
||||
Write-VolumeCache C
|
||||
Write-VolumeCache D
|
||||
|
||||
- name: Build
|
||||
shell: pwsh
|
||||
run: cmake --build build --parallel 2 --verbose
|
||||
|
||||
- name: Package dependency tree
|
||||
if: github.ref == 'refs/heads/main'
|
||||
shell: bash
|
||||
env:
|
||||
BEXT_CHANNEL: windows-2025-${{ runner.arch }}-release
|
||||
working-directory: ${{ runner.temp }}/bext_output
|
||||
run: |
|
||||
test -d install
|
||||
test -d noinstall
|
||||
test -f bext-install-manifest.json
|
||||
cmake -E tar cfz "$RUNNER_TEMP/bext-$BEXT_CHANNEL.tar.gz" --format=gnutar install noinstall bext-install-manifest.json
|
||||
|
||||
- name: Upload dependency tree
|
||||
if: github.ref == 'refs/heads/main'
|
||||
id: upload
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: bext-windows-2025-${{ runner.arch }}-release-${{ github.sha }}
|
||||
path: ${{ runner.temp }}/bext-windows-2025-${{ runner.arch }}-release.tar.gz
|
||||
if-no-files-found: error
|
||||
retention-days: ${{ env.BEXT_ARCHIVE_RETENTION_DAYS }}
|
||||
compression-level: 0
|
||||
|
||||
macos_release:
|
||||
name: macOS Clang Release Build
|
||||
runs-on: macos-14
|
||||
outputs:
|
||||
artifact-id: ${{ steps.upload.outputs.artifact-id }}
|
||||
steps:
|
||||
- name: Setup - CMake
|
||||
uses: lukka/get-cmake@latest
|
||||
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Install Xquartz
|
||||
run: brew install xquartz --cask
|
||||
|
||||
- name: Configure
|
||||
env:
|
||||
CC: clang
|
||||
CXX: clang++
|
||||
run: cmake -S . -G Ninja -B build -DENABLE_ALL=ON -DGIT_SHALLOW_CLONE=ON -DCMAKE_BUILD_TYPE=Release -DEXT_BUILD_VERBOSE=ON -DCMAKE_INSTALL_PREFIX="$RUNNER_TEMP/bext_output"
|
||||
|
||||
- name: Build
|
||||
run: cmake --build build --parallel 2 --verbose
|
||||
|
||||
- name: Package dependency tree
|
||||
if: github.ref == 'refs/heads/main'
|
||||
shell: bash
|
||||
env:
|
||||
BEXT_CHANNEL: macos-14-${{ runner.arch }}-release
|
||||
working-directory: ${{ runner.temp }}/bext_output
|
||||
run: |
|
||||
test -d install
|
||||
test -d noinstall
|
||||
test -f bext-install-manifest.json
|
||||
cmake -E tar cfz "$RUNNER_TEMP/bext-$BEXT_CHANNEL.tar.gz" --format=gnutar install noinstall bext-install-manifest.json
|
||||
|
||||
- name: Upload dependency tree
|
||||
if: github.ref == 'refs/heads/main'
|
||||
id: upload
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: bext-macos-14-${{ runner.arch }}-release-${{ github.sha }}
|
||||
path: ${{ runner.temp }}/bext-macos-14-${{ runner.arch }}-release.tar.gz
|
||||
if-no-files-found: error
|
||||
retention-days: ${{ env.BEXT_ARCHIVE_RETENTION_DAYS }}
|
||||
compression-level: 0
|
||||
|
||||
publish:
|
||||
name: Publish dependency set
|
||||
if: github.ref == 'refs/heads/main'
|
||||
needs: [linux_release, windows_ninja_release, macos_release]
|
||||
runs-on: ubuntu-24.04
|
||||
permissions:
|
||||
actions: write
|
||||
contents: read
|
||||
steps:
|
||||
- name: Record complete dependency set
|
||||
run: echo "${{ github.sha }}" > "$RUNNER_TEMP/bext-production"
|
||||
|
||||
- name: Upload completion marker
|
||||
id: marker
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: bext-production-${{ github.sha }}
|
||||
path: ${{ runner.temp }}/bext-production
|
||||
if-no-files-found: error
|
||||
retention-days: ${{ env.BEXT_ARCHIVE_RETENTION_DAYS }}
|
||||
|
||||
- name: Remove superseded dependency sets
|
||||
shell: bash
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
CURRENT_ARTIFACT_IDS: ${{ needs.linux_release.outputs.artifact-id }},${{ needs.windows_ninja_release.outputs.artifact-id }},${{ needs.macos_release.outputs.artifact-id }},${{ steps.marker.outputs.artifact-id }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
artifact_pattern='^bext-((ubuntu-24\.04|windows-2025|macos-14)-(X86|X64|ARM|ARM64)-release|production)-'
|
||||
artifact_rows="$(gh api --paginate "repos/$GITHUB_REPOSITORY/actions/artifacts?per_page=100" --jq '.artifacts[] | [.id, .name] | @tsv')"
|
||||
while IFS=$'\t' read -r artifact_id artifact_name; do
|
||||
if [[ "$artifact_name" =~ $artifact_pattern && ",${CURRENT_ARTIFACT_IDS}," != *",${artifact_id},"* ]]; then
|
||||
gh api --method DELETE "repos/$GITHUB_REPOSITORY/actions/artifacts/$artifact_id"
|
||||
fi
|
||||
done <<< "$artifact_rows"
|
||||
@@ -1,310 +0,0 @@
|
||||
name: Build
|
||||
on: [push, pull_request]
|
||||
jobs:
|
||||
ci:
|
||||
name: ${{ matrix.name }}
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- name: Ubuntu 20 GCC
|
||||
os: ubuntu-20.04
|
||||
compiler: gcc
|
||||
cxx-compiler: g++
|
||||
|
||||
- name: Ubuntu GCC ASAN
|
||||
os: ubuntu-latest
|
||||
compiler: gcc
|
||||
cxx-compiler: g++
|
||||
cmake-args: -D MZ_SANITIZER=Address
|
||||
codecov: ubuntu_gcc_asan
|
||||
|
||||
- name: Ubuntu GCC UBSAN
|
||||
os: ubuntu-latest
|
||||
compiler: gcc
|
||||
cxx-compiler: g++
|
||||
cmake-args: -D MZ_SANITIZER=Undefined
|
||||
codecov: ubuntu_gcc_undefined
|
||||
|
||||
- name: Ubuntu GCC MSAN
|
||||
os: ubuntu-latest
|
||||
compiler: gcc
|
||||
cxx-compiler: g++
|
||||
cmake-args: -D MZ_SANITIZER=Memory
|
||||
codecov: ubuntu_gcc_msan
|
||||
|
||||
# No code coverage on release builds
|
||||
- name: Ubuntu 20 Clang
|
||||
os: ubuntu-20.04
|
||||
compiler: clang
|
||||
cxx-compiler: clang++
|
||||
deploy: true
|
||||
deploy-name: linux
|
||||
|
||||
- name: Ubuntu 20 Clang 6.0
|
||||
os: ubuntu-20.04
|
||||
compiler: clang-6.0
|
||||
cxx-compiler: clang++-6.0
|
||||
version: "6.0"
|
||||
packages: llvm-6.0 clang-6.0
|
||||
|
||||
- name: Ubuntu GCC
|
||||
os: ubuntu-latest
|
||||
compiler: gcc
|
||||
cxx-compiler: g++
|
||||
cmake-args: -D MZ_CODE_COVERAGE=ON
|
||||
codecov: ubuntu_gcc
|
||||
|
||||
- name: Ubuntu GCC OSB
|
||||
os: ubuntu-latest
|
||||
compiler: gcc
|
||||
cxx-compiler: g++
|
||||
build-dir: ../build
|
||||
build-src-dir: ../minizip-ng
|
||||
|
||||
- name: Ubuntu Clang
|
||||
os: ubuntu-latest
|
||||
compiler: clang-14
|
||||
cxx-compiler: clang++-14
|
||||
cmake-args: -D MZ_CODE_COVERAGE=ON
|
||||
codecov: ubuntu_clang
|
||||
packages: clang-14 llvm-14
|
||||
gcov-exec: llvm-cov-14 gcov
|
||||
|
||||
- name: Ubuntu Clang No Zlib
|
||||
os: ubuntu-latest
|
||||
compiler: clang-14
|
||||
cxx-compiler: clang++-14
|
||||
cmake-args: -D MZ_CODE_COVERAGE=ON -D MZ_ZLIB=OFF
|
||||
codecov: ubuntu_clang_no_zlib
|
||||
packages: clang-14 llvm-14
|
||||
gcov-exec: llvm-cov-14 gcov
|
||||
|
||||
- name: Ubuntu Clang No Bzip2
|
||||
os: ubuntu-latest
|
||||
compiler: clang-14
|
||||
cxx-compiler: clang++-14
|
||||
cmake-args: -D MZ_CODE_COVERAGE=ON -D MZ_BZIP=OFF
|
||||
codecov: ubuntu_clang_no_bzip2
|
||||
packages: clang-14 llvm-14
|
||||
gcov-exec: llvm-cov-14 gcov
|
||||
|
||||
- name: Ubuntu Clang No LZMA
|
||||
os: ubuntu-latest
|
||||
compiler: clang-14
|
||||
cxx-compiler: clang++-14
|
||||
cmake-args: -D MZ_CODE_COVERAGE=ON -D MZ_LZMA=OFF
|
||||
codecov: ubuntu_clang_no_lzma
|
||||
packages: clang-14 llvm-14
|
||||
gcov-exec: llvm-cov-14 gcov
|
||||
|
||||
- name: Ubuntu Clang No Zstd
|
||||
os: ubuntu-latest
|
||||
compiler: clang-14
|
||||
cxx-compiler: clang++-14
|
||||
cmake-args: -D MZ_CODE_COVERAGE=ON -D MZ_ZSTD=OFF
|
||||
codecov: ubuntu_clang_no_zstd
|
||||
packages: clang-14 llvm-14
|
||||
gcov-exec: llvm-cov-14 gcov
|
||||
|
||||
- name: Ubuntu Clang No Pkcrypt
|
||||
os: ubuntu-latest
|
||||
compiler: clang-14
|
||||
cxx-compiler: clang++-14
|
||||
cmake-args: -D MZ_CODE_COVERAGE=ON -D MZ_PKCRYPT=OFF
|
||||
codecov: ubuntu_clang_no_pkcrypt
|
||||
packages: clang-14 llvm-14
|
||||
gcov-exec: llvm-cov-14 gcov
|
||||
|
||||
- name: Ubuntu Clang No Winzip AES
|
||||
os: ubuntu-latest
|
||||
compiler: clang-14
|
||||
cxx-compiler: clang++-14
|
||||
cmake-args: -D MZ_CODE_COVERAGE=ON -D MZ_WZAES=OFF
|
||||
codecov: ubuntu_clang_no_winzip_aes
|
||||
packages: clang-14 llvm-14
|
||||
gcov-exec: llvm-cov-14 gcov
|
||||
|
||||
- name: Ubuntu Clang No Encryption
|
||||
os: ubuntu-latest
|
||||
compiler: clang-14
|
||||
cxx-compiler: clang++-14
|
||||
cmake-args: -D MZ_CODE_COVERAGE=ON -D MZ_PKCRYPT=OFF -D MZ_WZAES=OFF
|
||||
codecov: ubuntu_clang_no_encryption
|
||||
packages: clang-14 llvm-14
|
||||
gcov-exec: llvm-cov-14 gcov
|
||||
|
||||
- name: Ubuntu Clang Compress Only
|
||||
os: ubuntu-latest
|
||||
compiler: clang-14
|
||||
cxx-compiler: clang++-14
|
||||
cmake-args: -D MZ_CODE_COVERAGE=ON -D MZ_COMPRESS_ONLY=ON
|
||||
codecov: ubuntu_clang_compress_only
|
||||
packages: clang-14 llvm-14
|
||||
gcov-exec: llvm-cov-14 gcov
|
||||
|
||||
- name: Ubuntu Clang Decompress Only
|
||||
os: ubuntu-latest
|
||||
compiler: clang-14
|
||||
cxx-compiler: clang++-14
|
||||
cmake-args: -D MZ_CODE_COVERAGE=ON -D MZ_DECOMPRESS_ONLY=ON
|
||||
codecov: ubuntu_clang_decompress_only
|
||||
packages: clang-14 llvm-14
|
||||
gcov-exec: llvm-cov-14 gcov
|
||||
|
||||
- name: Ubuntu Clang OpenSSL
|
||||
os: ubuntu-latest
|
||||
compiler: clang-14
|
||||
cxx-compiler: clang++-14
|
||||
cmake-args: -D MZ_CODE_COVERAGE=ON -D MZ_OPENSSL=ON
|
||||
codecov: ubuntu_clang_openssl
|
||||
packages: clang-14 llvm-14
|
||||
gcov-exec: llvm-cov-14 gcov
|
||||
|
||||
# No code coverage supported
|
||||
- name: Windows MSVC
|
||||
os: windows-latest
|
||||
compiler: cl
|
||||
# Don't use find_package for 3rd party libraries which are installed incorrectly on GitHub CI instances
|
||||
cmake-args: -D MZ_FORCE_FETCH_LIBS=ON
|
||||
deploy: true
|
||||
deploy-name: windows
|
||||
|
||||
# # No code coverage supported
|
||||
# - name: Windows MSVC XP
|
||||
# os: windows-latest
|
||||
# compiler: cl
|
||||
# # Don't use find_package for 3rd party libraries which are installed incorrectly on GitHub CI instances
|
||||
# cmake-args: -D MZ_FORCE_FETCH_LIBS=ON -D CMAKE_C_FLAGS="-D_WIN32_WINNT=0x501" -D CMAKE_CXX_FLAGS="-D_WIN32_WINNT=0x501"
|
||||
# deploy: true
|
||||
# deploy-name: windowsxp
|
||||
|
||||
- name: Windows GCC Code Coverage
|
||||
os: windows-latest
|
||||
compiler: gcc
|
||||
cxx-compiler: g++
|
||||
# Don't use find_package for 3rd party libraries which are installed incorrectly on GitHub CI instances
|
||||
cmake-args: -D MZ_CODE_COVERAGE=ON -D MZ_FORCE_FETCH_LIBS=ON -G Ninja
|
||||
codecov: windows_gcc
|
||||
|
||||
# No code coverage on release builds
|
||||
- name: macOS Xcode
|
||||
os: macos-latest
|
||||
deploy: true
|
||||
deploy-name: macos
|
||||
|
||||
- name: macOS Xcode Code Coverage
|
||||
os: macOS-latest
|
||||
cmake-args: -D MZ_CODE_COVERAGE=ON
|
||||
codecov: macos_xcode
|
||||
|
||||
- name: macOS Xcode LibCompression
|
||||
os: macOS-latest
|
||||
cmake-args: -D MZ_CODE_COVERAGE=ON -D MZ_LIBCOMP=ON
|
||||
codecov: macos_xcode_libcompression
|
||||
|
||||
- name: macOS Xcode OpenSSL
|
||||
os: macos-latest
|
||||
cmake-args: -D MZ_CODE_COVERAGE=ON -D MZ_OPENSSL=ON -D OPENSSL_ROOT_DIR=/usr/local/opt/openssl -D OPENSSL_INCLUDE_DIRS=/usr/local/opt/openssl/include -D OPENSSL_CRYPTO_LIBRARY=/usr/local/opt/openssl/lib/libcrypto.dylib -D OPENSSL_SSL_LIBRARY=/usr/local/opt/openssl/lib/libssl.dylib
|
||||
codecov: macos_xcode_openssl
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Install packages (macOS)
|
||||
if: runner.os == 'macOS'
|
||||
run: brew install pkgconfig ${{ matrix.packages }}
|
||||
|
||||
- name: Install packages (Ubuntu)
|
||||
if: runner.os == 'Linux' && matrix.packages
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install ${{ matrix.packages }}
|
||||
|
||||
- name: Install packages (Windows)
|
||||
if: runner.os == 'Windows' && matrix.compiler == 'gcc'
|
||||
run: |
|
||||
# strawberryperl installs incompatible libraries so remove it
|
||||
choco uninstall --no-progress strawberryperl
|
||||
choco install ninja --no-progress
|
||||
|
||||
- name: Generate project files
|
||||
shell: bash
|
||||
run: |
|
||||
cmake -S ${{ matrix.build-src-dir || '.' }} -B ${{ matrix.build-dir || '.' }} ${{ matrix.cmake-args }} \
|
||||
-D MZ_BUILD_TESTS=ON \
|
||||
-D MZ_BUILD_UNIT_TESTS=ON \
|
||||
-D CMAKE_BUILD_TYPE=Release
|
||||
env:
|
||||
CC: ${{ matrix.compiler }}
|
||||
CXX: ${{ matrix.cxx-compiler }}
|
||||
CFLAGS: ${{ matrix.cflags }}
|
||||
LDFLAGS: ${{ matrix.ldflags }}
|
||||
|
||||
- name: Compile source code
|
||||
run: cmake --build ${{ matrix.build-dir || '.' }} --config ${{ matrix.build-config || 'Release' }}
|
||||
|
||||
- name: Run test cases
|
||||
run: ctest --output-on-failure -C ${{ matrix.build-config || 'Release' }}
|
||||
working-directory: ${{ matrix.build-dir }}
|
||||
|
||||
- name: Generate coverage report
|
||||
shell: bash
|
||||
if: always() && matrix.codecov
|
||||
run: |
|
||||
python3 -u -m pip install --user gcovr==5.0 --ignore-installed
|
||||
python3 -m gcovr \
|
||||
--exclude-unreachable-branches \
|
||||
--gcov-ignore-parse-errors \
|
||||
--gcov-executable "${{ matrix.gcov-exec || 'gcov' }}" \
|
||||
--root ${{ matrix.build-src-dir || '.' }} \
|
||||
--xml \
|
||||
--output coverage.xml \
|
||||
--verbose
|
||||
|
||||
- name: Upload coverage report
|
||||
uses: codecov/codecov-action@v3
|
||||
if: always() && matrix.codecov && env.CODECOV_TOKEN != ''
|
||||
with:
|
||||
token: ${{ secrets.CODECOV_TOKEN }}
|
||||
flags: ${{ matrix.codecov }}
|
||||
name: ${{ matrix.name }}
|
||||
directory: ${{ matrix.build-src-dir || '.' }}
|
||||
verbose: true
|
||||
fail_ci_if_error: true
|
||||
env:
|
||||
CODECOV_TOKEN: "${{ secrets.CODECOV_TOKEN }}"
|
||||
|
||||
- name: Package release (Ubuntu/macOS)
|
||||
if: (runner.os == 'Linux' || runner.os == 'macOS') && matrix.deploy && startsWith(github.ref, 'refs/tags/')
|
||||
run: ls -R mini*zip | tar -czvf minizip-ng-${{ matrix.deploy-name }}.tar.gz -T -
|
||||
|
||||
- name: Upload release (Ubuntu/macOS)
|
||||
uses: svenstaro/upload-release-action@v1-release
|
||||
if: (runner.os == 'Linux' || runner.os == 'macOS') && matrix.deploy && startsWith(github.ref, 'refs/tags/') && env.GITHUB_TOKEN != ''
|
||||
with:
|
||||
asset_name: minizip-ng-${{ matrix.deploy-name }}.tar.gz
|
||||
file: ${{ matrix.build-dir || '.' }}/minizip-ng-${{ matrix.deploy-name }}.tar.gz
|
||||
tag: ${{ github.ref }}
|
||||
repo_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
overwrite: true
|
||||
env:
|
||||
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
|
||||
|
||||
- name: Package release (Windows)
|
||||
if: runner.os == 'Windows' && matrix.deploy && startsWith(github.ref, 'refs/tags/')
|
||||
run: 7z a -tzip minizip-ng-${{ matrix.deploy-name }}.zip ./Release/mini*zip.exe
|
||||
|
||||
- name: Upload release (Windows)
|
||||
uses: svenstaro/upload-release-action@v1-release
|
||||
if: runner.os == 'Windows' && matrix.deploy && startsWith(github.ref, 'refs/tags/') && env.GITHUB_TOKEN != ''
|
||||
with:
|
||||
asset_name: minizip-ng-${{ matrix.deploy-name }}.zip
|
||||
file: ${{ matrix.build-dir || '.' }}/minizip-ng-${{ matrix.deploy-name }}.zip
|
||||
tag: ${{ github.ref }}
|
||||
repo_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
overwrite: true
|
||||
env:
|
||||
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
|
||||
@@ -0,0 +1,256 @@
|
||||
# This file defines Continuous Integration (CI) tests for bext using the
|
||||
# Github Actions framework. Currently it defines configurations for Windows,
|
||||
# Linux and OSX.
|
||||
#
|
||||
# For more information about available platforms for testing, see:
|
||||
#
|
||||
# https://docs.github.com/en/free-pro-team@latest/actions/reference/specifications-for-github-hosted-runners
|
||||
#
|
||||
# The general rule when building in CI is to go more verbose in output settings
|
||||
# rather than less, since iterative debugging isn't practical.
|
||||
#
|
||||
# We generally want to avoid parallel building - while that will sometimes
|
||||
# catch dependency issues, it also makes the outputs far harder to interpret
|
||||
# when there is a problem. However, the full BRL-CAD dependency stack is quite
|
||||
# a long build, so in this case we are experimenting with it to see if it can
|
||||
# help our build times on the runners.
|
||||
|
||||
name: BRL-CAD
|
||||
|
||||
on: [push]
|
||||
|
||||
jobs:
|
||||
dependency_metadata:
|
||||
name: Dependency metadata and supply-chain checks
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Validate dependency metadata and documentation
|
||||
run: cmake -DBEXT_SOURCE_DIR="$GITHUB_WORKSPACE" -DBEXT_DOC_MODE=CHECK -P CMake/GenerateDependencyDocs.cmake
|
||||
|
||||
- name: Generate SPDX SBOM
|
||||
run: cmake -DBEXT_SOURCE_DIR="$GITHUB_WORKSPACE" -DBEXT_SBOM_OUTPUT="$RUNNER_TEMP/bext.spdx.json" -P CMake/GenerateSbom.cmake
|
||||
|
||||
- name: Upload SPDX SBOM
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: bext-spdx-sbom
|
||||
path: ${{ runner.temp }}/bext.spdx.json
|
||||
|
||||
linux_configure_presets:
|
||||
name: Ubuntu Configure Preset - ${{ matrix.preset }}
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
preset: [auto, bundled, minimal, everything]
|
||||
steps:
|
||||
- name: Setup - CMake
|
||||
uses: lukka/get-cmake@latest
|
||||
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Setup - System
|
||||
env:
|
||||
DEBIAN_FRONTEND: noninteractive
|
||||
run: |
|
||||
sudo apt-get update
|
||||
# Install XCB/OpenGL dev pkgs for Qt - see:
|
||||
# https://wiki.qt.io/Building_Qt_6_from_Git
|
||||
# https://doc.qt.io/qt-6/linux-requirements.html
|
||||
sudo apt-get install flex bison m4 libfontconfig1-dev libfreetype6-dev libx11-dev libx11-xcb-dev libxext-dev libxfixes-dev libxi-dev libxrender-dev libxcb1-dev libxcb-cursor-dev libxcb-glx0-dev libxcb-keysyms1-dev libxcb-image0-dev libxcb-shm0-dev libxcb-icccm4-dev libxcb-sync-dev libxcb-xfixes0-dev libxcb-shape0-dev libxcb-randr0-dev libxcb-render-util0-dev libxcb-util-dev libxcb-xinerama0-dev libxcb-xkb-dev libxkbcommon-dev libxkbcommon-x11-dev
|
||||
sudo apt-get install libgl-dev
|
||||
sudo apt-get install libinput-dev
|
||||
sudo apt-get clean
|
||||
|
||||
- name: Configure
|
||||
run: |
|
||||
export PATH=$GITHUB_WORKSPACE:$PATH
|
||||
cmake --preset ${{ matrix.preset }} -DGIT_SHALLOW_CLONE=ON -DEXT_BUILD_VERBOSE=ON
|
||||
|
||||
windows_ninja_debug:
|
||||
name: MSVC - Ninja Debug build
|
||||
runs-on: windows-latest
|
||||
strategy:
|
||||
fail-fast: true
|
||||
steps:
|
||||
- name: Setup - CMake
|
||||
uses: lukka/get-cmake@latest
|
||||
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Add github workspace to path
|
||||
# https://github.community/t/deprecated-add-path/136621
|
||||
run: echo "$ENV{GITHUB_WORKSPACE}" | Out-File -Append -FilePath $env:GITHUB_PATH -Encoding utf8
|
||||
|
||||
- name: Add msbuild to PATH
|
||||
uses: microsoft/setup-msbuild@v2
|
||||
|
||||
- name: Add cl.exe to PATH
|
||||
uses: ilammy/msvc-dev-cmd@v1
|
||||
|
||||
- name: Configure
|
||||
shell: powershell
|
||||
run: |
|
||||
cmake -S . -B build -G Ninja -DCMAKE_C_COMPILER="cl.exe" -DCMAKE_CXX_COMPILER="cl.exe" -DCMAKE_BUILD_TYPE=Debug -DENABLE_ALL=ON -DGIT_SHALLOW_CLONE=ON -DEXT_BUILD_VERBOSE=ON
|
||||
# We do the following in order to help ensure files are "flushed"
|
||||
# to disk before compilation is attempted
|
||||
# https://superuser.com/a/1553374/1286142
|
||||
powershell Write-VolumeCache C
|
||||
powershell Write-VolumeCache D
|
||||
|
||||
- name: Build
|
||||
shell: powershell
|
||||
run: |
|
||||
cd build; ninja -j2 -v
|
||||
|
||||
# TODO - if the loading isn't too extreme, it would be good to do a BRL-CAD
|
||||
# build against the output of this...
|
||||
# - name: Build - BRL-CAD
|
||||
# run: |
|
||||
# # TODO - figure out how to do this...
|
||||
|
||||
|
||||
windows_std_tools_release:
|
||||
name: MSVC - Standard Tools Release Build
|
||||
runs-on: windows-latest
|
||||
strategy:
|
||||
fail-fast: true
|
||||
steps:
|
||||
- name: Setup - CMake
|
||||
uses: lukka/get-cmake@latest
|
||||
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Add github workspace to path
|
||||
# https://github.community/t/deprecated-add-path/136621
|
||||
run: echo "$ENV{GITHUB_WORKSPACE}" | Out-File -Append -FilePath $env:GITHUB_PATH -Encoding utf8
|
||||
|
||||
- name: Add msbuild to PATH
|
||||
uses: microsoft/setup-msbuild@v2
|
||||
|
||||
- name: Add cl.exe to PATH
|
||||
uses: ilammy/msvc-dev-cmd@v1
|
||||
|
||||
- name: Configure
|
||||
shell: cmd
|
||||
run: |
|
||||
cmake -S . -B build -DENABLE_ALL=ON -DGIT_SHALLOW_CLONE=ON -DCMAKE_BUILD_TYPE=Release -DEXT_BUILD_VERBOSE=ON
|
||||
# We do the following in order to help ensure files are "flushed"
|
||||
# to disk before compilation is attempted
|
||||
# https://superuser.com/a/1553374/1286142
|
||||
powershell Write-VolumeCache C
|
||||
powershell Write-VolumeCache D
|
||||
|
||||
- name: Build
|
||||
shell: cmd
|
||||
run: |
|
||||
cmake --build build --config Release -j2
|
||||
|
||||
windows_std_tools_debug:
|
||||
name: MSVC - Standard Tools Debug Build
|
||||
runs-on: windows-latest
|
||||
strategy:
|
||||
fail-fast: true
|
||||
steps:
|
||||
- name: Setup - CMake
|
||||
uses: lukka/get-cmake@latest
|
||||
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Add github workspace to path
|
||||
# https://github.community/t/deprecated-add-path/136621
|
||||
run: echo "$ENV{GITHUB_WORKSPACE}" | Out-File -Append -FilePath $env:GITHUB_PATH -Encoding utf8
|
||||
|
||||
- name: Add msbuild to PATH
|
||||
uses: microsoft/setup-msbuild@v2
|
||||
|
||||
- name: Add cl.exe to PATH
|
||||
uses: ilammy/msvc-dev-cmd@v1
|
||||
|
||||
- name: Configure
|
||||
shell: cmd
|
||||
run: |
|
||||
cmake -S . -B build -DENABLE_ALL=ON -DGIT_SHALLOW_CLONE=ON -DCMAKE_BUILD_TYPE=Debug -DEXT_BUILD_VERBOSE=ON
|
||||
# We do the following in order to help ensure files are "flushed"
|
||||
# to disk before compilation is attempted
|
||||
# https://superuser.com/a/1553374/1286142
|
||||
powershell Write-VolumeCache C
|
||||
powershell Write-VolumeCache D
|
||||
|
||||
- name: Build
|
||||
shell: cmd
|
||||
run: |
|
||||
cmake --build build --config Debug -j2
|
||||
|
||||
|
||||
linux_debug:
|
||||
name: Ubuntu GCC Debug Build
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
fail-fast: true
|
||||
steps:
|
||||
- name: Setup - CMake
|
||||
uses: lukka/get-cmake@latest
|
||||
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Setup - System
|
||||
env:
|
||||
DEBIAN_FRONTEND: noninteractive
|
||||
run: |
|
||||
sudo apt-get update
|
||||
# Install XCB/OpenGL dev pkgs for Qt - see:
|
||||
# https://wiki.qt.io/Building_Qt_6_from_Git
|
||||
# https://doc.qt.io/qt-6/linux-requirements.html
|
||||
sudo apt-get install libfontconfig1-dev libfreetype6-dev libx11-dev libx11-xcb-dev libxext-dev libxfixes-dev libxi-dev libxrender-dev libxcb1-dev libxcb-cursor-dev libxcb-glx0-dev libxcb-keysyms1-dev libxcb-image0-dev libxcb-shm0-dev libxcb-icccm4-dev libxcb-sync-dev libxcb-xfixes0-dev libxcb-shape0-dev libxcb-randr0-dev libxcb-render-util0-dev libxcb-util-dev libxcb-xinerama0-dev libxcb-xkb-dev libxkbcommon-dev libxkbcommon-x11-dev
|
||||
sudo apt-get install libgl-dev
|
||||
sudo apt-get install libinput-dev
|
||||
sudo apt-get clean
|
||||
|
||||
- name: Configure
|
||||
run: |
|
||||
export PATH=$ENV{GITHUB_WORKSPACE}:$PATH
|
||||
# We're running into disk space issues with the Linux debug build, so turn off GDAL
|
||||
cmake -S . -G Ninja -B build -DENABLE_ALL=ON -DGIT_SHALLOW_CLONE=ON -DCMAKE_BUILD_TYPE=Debug -DUSE_GDAL=OFF -DEXT_BUILD_VERBOSE=ON
|
||||
|
||||
- name: Build
|
||||
run: |
|
||||
export PATH=$ENV{GITHUB_WORKSPACE}:$PATH
|
||||
cd build && ninja -j2 -v
|
||||
|
||||
|
||||
osx_debug:
|
||||
name: macOS Clang Debug Build
|
||||
runs-on: macos-latest
|
||||
strategy:
|
||||
fail-fast: true
|
||||
steps:
|
||||
- name: Setup - CMake
|
||||
uses: lukka/get-cmake@latest
|
||||
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Install Xquartz
|
||||
run: |
|
||||
brew install xquartz --cask
|
||||
|
||||
- name: Configure
|
||||
run: |
|
||||
export PATH=$ENV{GITHUB_WORKSPACE}:$PATH
|
||||
export CC=clang
|
||||
export CXX=clang++
|
||||
cmake -S . -G Ninja -B build -DENABLE_ALL=ON -DGIT_SHALLOW_CLONE=ON -DCMAKE_BUILD_TYPE=Debug -DEXT_BUILD_VERBOSE=ON
|
||||
|
||||
- name: Build
|
||||
run: |
|
||||
export PATH=$ENV{GITHUB_WORKSPACE}:$PATH
|
||||
cd build && ninja -j2 -v
|
||||
@@ -1,30 +0,0 @@
|
||||
name: CodeQL
|
||||
on:
|
||||
push:
|
||||
pull_request:
|
||||
schedule:
|
||||
- cron: '0 1 * * 4'
|
||||
jobs:
|
||||
analyze:
|
||||
name: Analyze
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
# We must fetch at least the immediate parents so that if this is
|
||||
# a pull request then we can checkout the head.
|
||||
fetch-depth: 2
|
||||
|
||||
# Initializes the CodeQL tools for scanning.
|
||||
- name: Initialize CodeQL
|
||||
uses: github/codeql-action/init@v2
|
||||
|
||||
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
|
||||
# If this step fails, then you should remove it and run the build manually (see below)
|
||||
- name: Autobuild
|
||||
uses: github/codeql-action/autobuild@v2
|
||||
|
||||
- name: Perform CodeQL Analysis
|
||||
uses: github/codeql-action/analyze@v2
|
||||
@@ -1,25 +0,0 @@
|
||||
name: OSS-Fuzz
|
||||
on: [pull_request]
|
||||
jobs:
|
||||
Fuzzing:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Build Fuzzers
|
||||
uses: google/oss-fuzz/infra/cifuzz/actions/build_fuzzers@master
|
||||
with:
|
||||
oss-fuzz-project-name: 'minizip'
|
||||
dry-run: true
|
||||
|
||||
- name: Run Fuzzers
|
||||
uses: google/oss-fuzz/infra/cifuzz/actions/run_fuzzers@master
|
||||
with:
|
||||
oss-fuzz-project-name: 'minizip'
|
||||
fuzz-seconds: 600
|
||||
dry-run: true
|
||||
|
||||
- name: Upload Crash
|
||||
uses: actions/upload-artifact@v3
|
||||
if: failure()
|
||||
with:
|
||||
name: artifacts
|
||||
path: ./out/artifacts
|
||||
@@ -0,0 +1,56 @@
|
||||
# The purpose of this particular test definition is to support on-demand
|
||||
# interactive command shells. We sometimes see problems that occur only in the
|
||||
# Github Runner environments, and in order to explore what is happening we need
|
||||
# an interactive prompt (the alternative is hours-per-cycle submit and test
|
||||
# loops, which doesn't scale at all.)
|
||||
#
|
||||
# Unlike the other BRL-CAD tests, this one is started manually from the Github
|
||||
# website. For more information see https://mxschmitt.github.io/action-tmate/
|
||||
#
|
||||
# The "recommended" way to use this action is for the dev to make a fork of
|
||||
# the repository, alter the configure and/or build logic below for their
|
||||
# particular use case (the example below is a libged-only build used to zero
|
||||
# in on a specific libged behavior) before running.
|
||||
|
||||
name: BRL-CAD Linux Interactive Debugging
|
||||
|
||||
on: [workflow_dispatch]
|
||||
|
||||
jobs:
|
||||
|
||||
linux:
|
||||
name: Ubuntu Latest GCC
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
|
||||
- name: Setup - CMake
|
||||
uses: lukka/get-cmake@latest
|
||||
|
||||
- name: Setup - System
|
||||
env:
|
||||
DEBIAN_FRONTEND: noninteractive
|
||||
run: |
|
||||
sudo apt-get update
|
||||
# Install XCB/OpenGL dev pkgs for Qt - see:
|
||||
# https://wiki.qt.io/Building_Qt_6_from_Git
|
||||
# https://doc.qt.io/qt-6/linux-requirements.html
|
||||
sudo apt-get install libfontconfig1-dev libfreetype6-dev libx11-dev libx11-xcb-dev libxext-dev libxfixes-dev libxi-dev libxrender-dev libxcb1-dev libxcb-cursor-dev libxcb-glx0-dev libxcb-keysyms1-dev libxcb-image0-dev libxcb-shm0-dev libxcb-icccm4-dev libxcb-sync-dev libxcb-xfixes0-dev libxcb-shape0-dev libxcb-randr0-dev libxcb-render-util0-dev libxcb-util-dev libxcb-xinerama0-dev libxcb-xkb-dev libxkbcommon-dev libxkbcommon-x11-dev
|
||||
sudo apt-get install libgl-dev
|
||||
sudo apt-get install libinput-dev
|
||||
sudo apt-get clean
|
||||
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Build Directory setup
|
||||
run: |
|
||||
cmake -E make_directory ./build_linux
|
||||
|
||||
- name: Configure
|
||||
run: |
|
||||
export PATH=$ENV{GITHUB_WORKSPACE}:$PATH
|
||||
cmake -S . -G Ninja -B build -DENABLE_ALL=ON -DGIT_SHALLOW_CLONE=ON -DCMAKE_BUILD_TYPE=Debug
|
||||
|
||||
- name: Debugging - tmate session
|
||||
uses: mxschmitt/action-tmate@v3
|
||||
|
||||
+24
-2
@@ -1,3 +1,25 @@
|
||||
build/
|
||||
third_party/
|
||||
# Common build directories used in the source tree
|
||||
/build
|
||||
/.build
|
||||
/*_build
|
||||
/*-build
|
||||
/out
|
||||
|
||||
# Temporary files
|
||||
*~
|
||||
\#*\#
|
||||
.\#*
|
||||
[._]*.s[a-v][a-z]
|
||||
[._]*.sw[a-p]
|
||||
[._]s[a-v][a-z]
|
||||
[._]sw[a-p]
|
||||
|
||||
# OS specific files
|
||||
.DS_Store
|
||||
.DS_Store?
|
||||
|
||||
.vscode
|
||||
CMakeLists.txt.user
|
||||
/.vs
|
||||
/CMakeSettings.json
|
||||
/CMakeUserPresets.json
|
||||
|
||||
+370
@@ -0,0 +1,370 @@
|
||||
[submodule "patch/patch"]
|
||||
path = patch/patch
|
||||
url = https://github.com/BRL-CAD/patch
|
||||
ignore = dirty
|
||||
shallow = true
|
||||
[submodule "astyle/astyle"]
|
||||
path = astyle/astyle
|
||||
url = https://github.com/BRL-CAD/astyle
|
||||
ignore = dirty
|
||||
shallow = true
|
||||
[submodule "lief/LIEF"]
|
||||
path = lief/LIEF
|
||||
url = https://github.com/BRL-CAD/LIEF
|
||||
ignore = dirty
|
||||
shallow = true
|
||||
[submodule "lemon/lemon"]
|
||||
path = lemon/lemon
|
||||
url = https://github.com/BRL-CAD/lemon
|
||||
ignore = dirty
|
||||
shallow = true
|
||||
[submodule "re2c/re2c"]
|
||||
path = re2c/re2c
|
||||
url = https://github.com/BRL-CAD/re2c
|
||||
ignore = dirty
|
||||
shallow = true
|
||||
[submodule "perplex/perplex"]
|
||||
path = perplex/perplex
|
||||
url = https://github.com/BRL-CAD/perplex
|
||||
ignore = dirty
|
||||
shallow = true
|
||||
[submodule "plief/plief"]
|
||||
path = plief/plief
|
||||
url = https://github.com/BRL-CAD/plief
|
||||
ignore = dirty
|
||||
shallow = true
|
||||
[submodule "strclear/strclear"]
|
||||
path = strclear/strclear
|
||||
url = https://github.com/BRL-CAD/strclear
|
||||
ignore = dirty
|
||||
shallow = true
|
||||
[submodule "zlib/zlib"]
|
||||
path = zlib/zlib
|
||||
url = https://github.com/BRL-CAD/zlib
|
||||
ignore = dirty
|
||||
shallow = true
|
||||
[submodule "png/libpng"]
|
||||
path = png/libpng
|
||||
url = https://github.com/BRL-CAD/libpng
|
||||
ignore = dirty
|
||||
shallow = true
|
||||
[submodule "netpbm/netpbm"]
|
||||
path = netpbm/netpbm
|
||||
url = https://github.com/BRL-CAD/netpbm
|
||||
branch = brlcad
|
||||
ignore = dirty
|
||||
shallow = true
|
||||
[submodule "regex/regex"]
|
||||
path = regex/regex
|
||||
url = https://github.com/BRL-CAD/regex
|
||||
ignore = dirty
|
||||
shallow = true
|
||||
[submodule "lmdb/lmdb"]
|
||||
path = lmdb/lmdb
|
||||
url = https://github.com/BRL-CAD/lmdb
|
||||
ignore = dirty
|
||||
shallow = true
|
||||
[submodule "eigen/eigen"]
|
||||
path = eigen/eigen
|
||||
url = https://github.com/BRL-CAD/eigen
|
||||
ignore = dirty
|
||||
shallow = true
|
||||
[submodule "stepcode/stepcode"]
|
||||
path = stepcode/stepcode
|
||||
url = https://github.com/BRL-CAD/stepcode
|
||||
branch = RELEASE
|
||||
ignore = dirty
|
||||
shallow = true
|
||||
[submodule "sqlite3/sqlite3"]
|
||||
path = sqlite3/sqlite3
|
||||
url = https://github.com/BRL-CAD/sqlite3.git
|
||||
ignore = dirty
|
||||
shallow = true
|
||||
[submodule "proj/PROJ"]
|
||||
path = proj/PROJ
|
||||
url = https://github.com/BRL-CAD/PROJ
|
||||
ignore = dirty
|
||||
shallow = true
|
||||
[submodule "gdal/gdal"]
|
||||
path = gdal/gdal
|
||||
url = https://github.com/BRL-CAD/gdal
|
||||
ignore = dirty
|
||||
shallow = true
|
||||
[submodule "assetimport/assimp"]
|
||||
path = assetimport/assimp
|
||||
url = https://github.com/BRL-CAD/assimp
|
||||
branch = RELEASE
|
||||
ignore = dirty
|
||||
shallow = true
|
||||
[submodule "opencv/opencv"]
|
||||
path = opencv/opencv
|
||||
url = https://github.com/BRL-CAD/opencv
|
||||
ignore = dirty
|
||||
shallow = true
|
||||
[submodule "opennurbs/opennurbs"]
|
||||
path = opennurbs/opennurbs
|
||||
url = https://github.com/BRL-CAD/opennurbs
|
||||
ignore = dirty
|
||||
shallow = true
|
||||
[submodule "openvdb/openvdb"]
|
||||
path = openvdb/openvdb
|
||||
url = https://github.com/BRL-CAD/openvdb
|
||||
branch = master
|
||||
ignore = dirty
|
||||
shallow = true
|
||||
[submodule "osmesa/osmesa"]
|
||||
path = osmesa/osmesa
|
||||
url = https://github.com/BRL-CAD/osmesa
|
||||
ignore = dirty
|
||||
shallow = true
|
||||
[submodule "tk/tk"]
|
||||
path = tk/tk
|
||||
url = https://github.com/BRL-CAD/tk
|
||||
branch = RELEASE
|
||||
ignore = dirty
|
||||
shallow = true
|
||||
[submodule "itcl3/itcl"]
|
||||
path = itcl/itcl
|
||||
url = https://github.com/BRL-CAD/itcl
|
||||
branch = RELEASE
|
||||
ignore = dirty
|
||||
shallow = true
|
||||
[submodule "itk3/itk"]
|
||||
path = itk/itk
|
||||
url = https://github.com/BRL-CAD/itk
|
||||
branch = RELEASE
|
||||
ignore = dirty
|
||||
shallow = true
|
||||
[submodule "iwidgets/iwidgets"]
|
||||
path = iwidgets/iwidgets
|
||||
url = https://github.com/BRL-CAD/iwidgets
|
||||
ignore = dirty
|
||||
shallow = true
|
||||
[submodule "tktable/tktable"]
|
||||
path = tktable/tktable
|
||||
url = https://github.com/BRL-CAD/tktable
|
||||
ignore = dirty
|
||||
shallow = true
|
||||
[submodule "tkhtml/tkhtml"]
|
||||
path = tkhtml/tkhtml
|
||||
url = https://github.com/BRL-CAD/tkhtml
|
||||
ignore = dirty
|
||||
shallow = true
|
||||
[submodule "qt/qt"]
|
||||
path = qt/qt
|
||||
url = https://github.com/BRL-CAD/qt
|
||||
ignore = dirty
|
||||
shallow = true
|
||||
[submodule "flexbison/bison"]
|
||||
path = flexbison/bison
|
||||
url = https://github.com/BRL-CAD/bison
|
||||
ignore = dirty
|
||||
shallow = true
|
||||
[submodule "flexbison/flex"]
|
||||
path = flexbison/flex
|
||||
url = https://github.com/BRL-CAD/flex
|
||||
branch = RELEASE
|
||||
ignore = dirty
|
||||
shallow = true
|
||||
[submodule "flexbison/winflexbison"]
|
||||
path = flexbison/winflexbison
|
||||
url = https://github.com/BRL-CAD/winflexbison
|
||||
branch = RELEASE
|
||||
ignore = dirty
|
||||
shallow = true
|
||||
[submodule "minizip-ng/minizip-ng"]
|
||||
path = minizip-ng/minizip-ng
|
||||
url = https://github.com/BRL-CAD/minizip-ng
|
||||
branch = RELEASE
|
||||
ignore = dirty
|
||||
shallow = true
|
||||
[submodule "lz4/lz4"]
|
||||
path = lz4/lz4
|
||||
url = https://github.com/BRL-CAD/lz4
|
||||
branch = RELEASE
|
||||
ignore = dirty
|
||||
shallow = true
|
||||
[submodule "deflate/libdeflate"]
|
||||
path = deflate/libdeflate
|
||||
url = https://github.com/BRL-CAD/libdeflate
|
||||
branch = RELEASE
|
||||
ignore = dirty
|
||||
shallow = true
|
||||
[submodule "fmt/fmt"]
|
||||
path = fmt/fmt
|
||||
url = https://github.com/BRL-CAD/fmt
|
||||
branch = RELEASE
|
||||
ignore = dirty
|
||||
shallow = true
|
||||
[submodule "yaml-cpp/yaml-cpp"]
|
||||
path = yaml-cpp/yaml-cpp
|
||||
url = https://github.com/BRL-CAD/yaml-cpp
|
||||
branch = RELEASE
|
||||
ignore = dirty
|
||||
shallow = true
|
||||
[submodule "pystring/pystring"]
|
||||
path = pystring/pystring
|
||||
url = https://github.com/BRL-CAD/pystring
|
||||
branch = RELEASE
|
||||
ignore = dirty
|
||||
shallow = true
|
||||
[submodule "expat/libexpat"]
|
||||
path = expat/libexpat
|
||||
url = https://github.com/BRL-CAD/libexpat
|
||||
branch = RELEASE
|
||||
ignore = dirty
|
||||
shallow = true
|
||||
[submodule "pugixml/pugixml"]
|
||||
path = pugixml/pugixml
|
||||
url = https://github.com/BRL-CAD/pugixml
|
||||
branch = RELEASE
|
||||
ignore = dirty
|
||||
shallow = true
|
||||
[submodule "xerces-c/xerces-c"]
|
||||
path = xerces-c/xerces-c
|
||||
url = https://github.com/BRL-CAD/xerces-c
|
||||
branch = RELEASE
|
||||
ignore = dirty
|
||||
shallow = true
|
||||
[submodule "icu/icu"]
|
||||
path = icu/icu
|
||||
url = https://github.com/BRL-CAD/icu
|
||||
branch = RELEASE
|
||||
ignore = dirty
|
||||
shallow = true
|
||||
[submodule "jpeg/libjpeg-turbo"]
|
||||
path = jpeg/libjpeg-turbo
|
||||
url = https://github.com/BRL-CAD/libjpeg-turbo
|
||||
ignore = dirty
|
||||
shallow = true
|
||||
[submodule "tiff/libtiff"]
|
||||
path = tiff/libtiff
|
||||
url = https://github.com/BRL-CAD/libtiff
|
||||
ignore = dirty
|
||||
shallow = true
|
||||
[submodule "onetbb/oneTBB"]
|
||||
path = onetbb/oneTBB
|
||||
url = https://github.com/BRL-CAD/oneTBB
|
||||
ignore = dirty
|
||||
shallow = true
|
||||
[submodule "llvm/llvm-project"]
|
||||
path = llvm/llvm-project
|
||||
url = https://github.com/BRL-CAD/llvm-project
|
||||
branch = RELEASE
|
||||
ignore = dirty
|
||||
shallow = true
|
||||
[submodule "zstd/zstd"]
|
||||
path = zstd/zstd
|
||||
url = https://github.com/BRL-CAD/zstd
|
||||
branch = RELEASE
|
||||
ignore = dirty
|
||||
shallow = true
|
||||
[submodule "boost/boost"]
|
||||
path = boost/boost
|
||||
url = https://github.com/BRL-CAD/boost
|
||||
branch = RELEASE
|
||||
ignore = dirty
|
||||
shallow = true
|
||||
[submodule "openexr/openexr"]
|
||||
path = openexr/openexr
|
||||
url = https://github.com/BRL-CAD/openexr
|
||||
branch = RELEASE
|
||||
ignore = dirty
|
||||
shallow = true
|
||||
[submodule "opencolorio/OpenColorIO"]
|
||||
path = opencolorio/OpenColorIO
|
||||
url = https://github.com/BRL-CAD/OpenColorIO
|
||||
branch = RELEASE
|
||||
ignore = dirty
|
||||
shallow = true
|
||||
[submodule "openimageio/oiio"]
|
||||
path = openimageio/oiio
|
||||
url = https://github.com/BRL-CAD/oiio
|
||||
branch = RELEASE
|
||||
ignore = dirty
|
||||
shallow = true
|
||||
[submodule "osl/OpenShadingLanguage"]
|
||||
path = osl/OpenShadingLanguage
|
||||
url = https://github.com/BRL-CAD/OpenShadingLanguage
|
||||
branch = RELEASE
|
||||
ignore = dirty
|
||||
shallow = true
|
||||
[submodule "embree/embree"]
|
||||
path = embree/embree
|
||||
url = https://github.com/BRL-CAD/embree
|
||||
branch = RELEASE
|
||||
ignore = dirty
|
||||
shallow = true
|
||||
[submodule "rkcommon/rkcommon"]
|
||||
path = rkcommon/rkcommon
|
||||
url = https://github.com/BRL-CAD/rkcommon
|
||||
branch = RELEASE
|
||||
ignore = dirty
|
||||
shallow = true
|
||||
[submodule "ispc/ispc"]
|
||||
path = ispc/ispc
|
||||
url = https://github.com/BRL-CAD/ispc
|
||||
branch = RELEASE
|
||||
ignore = dirty
|
||||
shallow = true
|
||||
[submodule "ospray/ospray"]
|
||||
path = ospray/ospray
|
||||
url = https://github.com/BRL-CAD/ospray
|
||||
branch = RELEASE
|
||||
ignore = dirty
|
||||
shallow = true
|
||||
[submodule "ncurses/ncurses"]
|
||||
path = ncurses/ncurses
|
||||
url = https://github.com/BRL-CAD/ncurses
|
||||
ignore = dirty
|
||||
shallow = true
|
||||
[submodule "tcl/tcl"]
|
||||
path = tcl/tcl
|
||||
url = https://github.com/BRL-CAD/tcl.git
|
||||
branch = RELEASE
|
||||
ignore = dirty
|
||||
shallow = true
|
||||
[submodule "manifold/manifold"]
|
||||
path = manifold/manifold
|
||||
url = https://github.com/BRL-CAD/manifold.git
|
||||
ignore = dirty
|
||||
shallow = true
|
||||
[submodule "appleseed/appleseed"]
|
||||
path = appleseed/appleseed
|
||||
url = https://github.com/BRL-CAD/appleseed
|
||||
ignore = dirty
|
||||
shallow = true
|
||||
[submodule "gte/GeometricTools"]
|
||||
path = gte/GeometricTools
|
||||
url = https://github.com/BRL-CAD/GeometricTools
|
||||
ignore = dirty
|
||||
shallow = true
|
||||
[submodule "mmesh/mmesh"]
|
||||
path = mmesh/mmesh
|
||||
url = https://github.com/BRL-CAD/mmesh.git
|
||||
ignore = dirty
|
||||
shallow = true
|
||||
[submodule "clipper2/Clipper2"]
|
||||
path = clipper2/Clipper2
|
||||
url = https://github.com/BRL-CAD/Clipper2.git
|
||||
ignore = dirty
|
||||
shallow = true
|
||||
[submodule "tinygltf/tinygltf"]
|
||||
path = tinygltf/tinygltf
|
||||
url = https://github.com/BRL-CAD/tinygltf.git
|
||||
ignore = dirty
|
||||
shallow = true
|
||||
[submodule "poissonrecon/PoissonRecon"]
|
||||
path = poissonrecon/PoissonRecon
|
||||
url = https://github.com/BRL-CAD/PoissonRecon
|
||||
ignore = dirty
|
||||
shallow = true
|
||||
[submodule "bullet/bullet3"]
|
||||
path = bullet/bullet3
|
||||
url = https://github.com/BRL-CAD/bullet3.git
|
||||
branch = RELEASE
|
||||
ignore = dirty
|
||||
shallow = true
|
||||
[submodule "oidn/oidn"]
|
||||
path = oidn/oidn
|
||||
url = https://github.com/BRL-CAD/oidn
|
||||
@@ -0,0 +1,91 @@
|
||||
set(bext_root "${CMAKE_CURRENT_LIST_DIR}/..")
|
||||
get_filename_component(bext_root "${bext_root}" ABSOLUTE)
|
||||
|
||||
if (NOT DEFINED PROFILE)
|
||||
message(FATAL_ERROR "Set PROFILE to one of: auto, bundled, minimal, everything")
|
||||
endif (NOT DEFINED PROFILE)
|
||||
|
||||
string(TOLOWER "${PROFILE}" profile)
|
||||
set(active_groups)
|
||||
|
||||
if (profile STREQUAL "auto" OR profile STREQUAL "bundled")
|
||||
set(active_groups BRLCAD BRLCAD_EXTRA GDAL QT TCL)
|
||||
elseif (profile STREQUAL "minimal")
|
||||
set(active_groups BRLCAD)
|
||||
elseif (profile STREQUAL "everything")
|
||||
set(active_groups APPLESEED BRLCAD BRLCAD_EXTRA GDAL OSPRAY QT TCL)
|
||||
else ()
|
||||
message(FATAL_ERROR "Unknown PROFILE \"${PROFILE}\". Expected: auto, bundled, minimal, everything")
|
||||
endif ()
|
||||
|
||||
find_program(GIT_EXECUTABLE git)
|
||||
if (NOT GIT_EXECUTABLE)
|
||||
message(FATAL_ERROR "Unable to find git executable required for bootstrap")
|
||||
endif (NOT GIT_EXECUTABLE)
|
||||
|
||||
file(STRINGS "${bext_root}/CMakeLists.txt" project_lines REGEX "add_project\\(")
|
||||
|
||||
set(project_paths)
|
||||
foreach(line ${project_lines})
|
||||
string(STRIP "${line}" stripped_line)
|
||||
if (stripped_line MATCHES "^#")
|
||||
continue()
|
||||
endif (stripped_line MATCHES "^#")
|
||||
|
||||
if (NOT stripped_line MATCHES "^add_project\\(([A-Za-z0-9_+.-]+)")
|
||||
continue()
|
||||
endif (NOT stripped_line MATCHES "^add_project\\(([A-Za-z0-9_+.-]+)")
|
||||
|
||||
set(project_name "${CMAKE_MATCH_1}")
|
||||
set(include_project FALSE)
|
||||
|
||||
if (stripped_line MATCHES "GROUPS \"([^\"]+)\"")
|
||||
set(project_groups "${CMAKE_MATCH_1}")
|
||||
string(REPLACE ";" ";" project_groups "${project_groups}")
|
||||
foreach(group ${project_groups})
|
||||
list(FIND active_groups "${group}" group_index)
|
||||
if (NOT group_index EQUAL -1)
|
||||
set(include_project TRUE)
|
||||
break()
|
||||
endif (NOT group_index EQUAL -1)
|
||||
endforeach(group ${project_groups})
|
||||
else ()
|
||||
set(include_project TRUE)
|
||||
endif ()
|
||||
|
||||
if (include_project)
|
||||
list(APPEND project_paths "${project_name}")
|
||||
endif (include_project)
|
||||
endforeach(line ${project_lines})
|
||||
|
||||
list(REMOVE_DUPLICATES project_paths)
|
||||
list(SORT project_paths)
|
||||
|
||||
string(REPLACE ";" ", " active_groups_str "${active_groups}")
|
||||
string(REPLACE ";" ", " project_paths_str "${project_paths}")
|
||||
|
||||
message(STATUS "bext bootstrap profile: ${profile}")
|
||||
message(STATUS "active USE_* groups: ${active_groups_str}")
|
||||
message(STATUS "project submodules: ${project_paths_str}")
|
||||
|
||||
if (LIST_ONLY)
|
||||
message(STATUS "LIST_ONLY is ON, skipping git submodule update")
|
||||
return()
|
||||
endif (LIST_ONLY)
|
||||
|
||||
set(git_args submodule update --init --recursive --jobs 8)
|
||||
if (GIT_SHALLOW_CLONE)
|
||||
list(APPEND git_args --recommend-shallow)
|
||||
endif (GIT_SHALLOW_CLONE)
|
||||
list(APPEND git_args -- ${project_paths})
|
||||
if (WIN32)
|
||||
list(PREPEND git_args -c core.longpaths=true)
|
||||
endif (WIN32)
|
||||
|
||||
execute_process(
|
||||
COMMAND ${GIT_EXECUTABLE} ${git_args}
|
||||
WORKING_DIRECTORY ${bext_root}
|
||||
COMMAND_ERROR_IS_FATAL ANY
|
||||
)
|
||||
|
||||
message(STATUS "Bootstrap complete for profile ${profile}")
|
||||
@@ -0,0 +1,220 @@
|
||||
# Derive bext dependency metadata from the existing build files. This module
|
||||
# deliberately does not introduce a manifest: CMakeLists.txt, per-project
|
||||
# .deps files, wrapper install settings, .gitmodules, and the Git index remain
|
||||
# the sources of truth.
|
||||
|
||||
function(_bext_inventory_key out value)
|
||||
string(TOUPPER "${value}" key)
|
||||
string(REGEX REPLACE "[^A-Z0-9]" "_" key "${key}")
|
||||
set(${out} "${key}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
function(_bext_inventory_set project field value)
|
||||
_bext_inventory_key(key "${project}")
|
||||
set_property(GLOBAL PROPERTY "BEXT_INVENTORY_${key}_${field}" "${value}")
|
||||
endfunction()
|
||||
|
||||
function(bext_inventory_get out project field)
|
||||
_bext_inventory_key(key "${project}")
|
||||
get_property(value GLOBAL PROPERTY "BEXT_INVENTORY_${key}_${field}")
|
||||
set(${out} "${value}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
function(_bext_inventory_submodule_lookup out_url out_sha source_dir path)
|
||||
get_property(entries GLOBAL PROPERTY BEXT_INVENTORY_SUBMODULES)
|
||||
foreach(entry ${entries})
|
||||
string(REPLACE "|" ";" parts "${entry}")
|
||||
list(GET parts 0 entry_path)
|
||||
if ("${entry_path}" STREQUAL "${path}")
|
||||
list(GET parts 1 entry_url)
|
||||
execute_process(
|
||||
COMMAND git ls-tree HEAD -- "${path}"
|
||||
WORKING_DIRECTORY "${source_dir}"
|
||||
RESULT_VARIABLE tree_result
|
||||
OUTPUT_VARIABLE tree_line
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
)
|
||||
if (NOT tree_result EQUAL 0 OR NOT tree_line MATCHES "^[0-9]+ commit ([0-9a-f]+)")
|
||||
message(FATAL_ERROR "Unable to read pinned commit for submodule ${path}")
|
||||
endif()
|
||||
set(${out_url} "${entry_url}" PARENT_SCOPE)
|
||||
set(${out_sha} "${CMAKE_MATCH_1}" PARENT_SCOPE)
|
||||
return()
|
||||
endif()
|
||||
endforeach()
|
||||
set(${out_url} "" PARENT_SCOPE)
|
||||
set(${out_sha} "" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
function(bext_collect_dependency_inventory source_dir)
|
||||
get_filename_component(source_dir "${source_dir}" ABSOLUTE)
|
||||
if (NOT EXISTS "${source_dir}/CMakeLists.txt" OR NOT EXISTS "${source_dir}/.gitmodules")
|
||||
message(FATAL_ERROR "${source_dir} is not a bext source tree")
|
||||
endif()
|
||||
|
||||
# Read submodule paths and URLs without requiring submodules to be populated.
|
||||
file(STRINGS "${source_dir}/.gitmodules" gitmodule_lines)
|
||||
set(submodules)
|
||||
set(current_path "")
|
||||
foreach(line ${gitmodule_lines})
|
||||
string(STRIP "${line}" line)
|
||||
if (line MATCHES "^path = (.+)$")
|
||||
set(current_path "${CMAKE_MATCH_1}")
|
||||
elseif(line MATCHES "^url = (.+)$" AND current_path)
|
||||
list(APPEND submodules "${current_path}|${CMAKE_MATCH_1}")
|
||||
set(current_path "")
|
||||
endif()
|
||||
endforeach()
|
||||
set_property(GLOBAL PROPERTY BEXT_INVENTORY_SUBMODULES "${submodules}")
|
||||
|
||||
file(STRINGS "${source_dir}/CMakeLists.txt" top_lines)
|
||||
set(projects)
|
||||
foreach(line ${top_lines})
|
||||
string(STRIP "${line}" stripped)
|
||||
if (stripped MATCHES "^#" OR NOT stripped MATCHES "^add_project\\(([^ )]+)")
|
||||
continue()
|
||||
endif()
|
||||
set(project "${CMAKE_MATCH_1}")
|
||||
list(APPEND projects "${project}")
|
||||
if (stripped MATCHES "GROUPS +\"([^\"]+)\"")
|
||||
set(groups "${CMAKE_MATCH_1}")
|
||||
else()
|
||||
set(groups "always considered")
|
||||
endif()
|
||||
_bext_inventory_set("${project}" GROUPS "${groups}")
|
||||
endforeach()
|
||||
list(REMOVE_DUPLICATES projects)
|
||||
|
||||
set(all_providers)
|
||||
foreach(project ${projects})
|
||||
set(wrapper "${source_dir}/${project}/CMakeLists.txt")
|
||||
if (NOT EXISTS "${wrapper}")
|
||||
message(FATAL_ERROR "Project ${project} has no wrapper CMakeLists.txt")
|
||||
endif()
|
||||
file(READ "${wrapper}" wrapper_text)
|
||||
|
||||
if (wrapper_text MATCHES "-DCMAKE_INSTALL_PREFIX=\\$\\{CMAKE_BUNDLE_INSTALL_PREFIX\\}" OR
|
||||
wrapper_text MATCHES "--prefix=\\$\\{CMAKE_BUNDLE_INSTALL_PREFIX\\}")
|
||||
set(output_class install)
|
||||
elseif(wrapper_text MATCHES "-DCMAKE_INSTALL_PREFIX=\\$\\{CMAKE_NOBUNDLE_INSTALL_PREFIX\\}" OR
|
||||
wrapper_text MATCHES "--prefix=\\$\\{CMAKE_NOBUNDLE_INSTALL_PREFIX\\}")
|
||||
set(output_class noinstall)
|
||||
elseif(wrapper_text MATCHES "CMAKE_BUNDLE_INSTALL_PREFIX" AND
|
||||
NOT wrapper_text MATCHES "CMAKE_NOBUNDLE_INSTALL_PREFIX")
|
||||
# Some custom build drivers (currently Tcl) receive the prefix through a
|
||||
# configured helper script rather than directly in ExternalProject_Add.
|
||||
set(output_class install)
|
||||
else()
|
||||
message(FATAL_ERROR "Cannot derive output class for ${project}")
|
||||
endif()
|
||||
_bext_inventory_set("${project}" OUTPUT "${output_class}")
|
||||
|
||||
if (wrapper_text MATCHES "DOC_LICENSE_DIR")
|
||||
set(has_license TRUE)
|
||||
else()
|
||||
set(has_license FALSE)
|
||||
endif()
|
||||
_bext_inventory_set("${project}" HAS_LICENSE "${has_license}")
|
||||
|
||||
set(deps)
|
||||
set(depfile "${source_dir}/${project}/${project}.deps")
|
||||
if (EXISTS "${depfile}")
|
||||
file(STRINGS "${depfile}" dep_lines)
|
||||
foreach(dep ${dep_lines})
|
||||
string(STRIP "${dep}" dep)
|
||||
if (dep AND NOT dep MATCHES "^#")
|
||||
string(TOLOWER "${dep}" dep)
|
||||
string(REPLACE "_" "-" dep "${dep}")
|
||||
list(APPEND deps "${dep}")
|
||||
endif()
|
||||
endforeach()
|
||||
endif()
|
||||
list(REMOVE_DUPLICATES deps)
|
||||
_bext_inventory_set("${project}" DEPS "${deps}")
|
||||
|
||||
set(paths)
|
||||
string(REGEX MATCHALL "git_submodule_init\\([A-Za-z0-9_+./-]+ +" init_calls "${wrapper_text}")
|
||||
foreach(call ${init_calls})
|
||||
string(REGEX REPLACE "git_submodule_init\\(([A-Za-z0-9_+./-]+) +" "\\1" path "${call}")
|
||||
list(APPEND paths "${project}/${path}")
|
||||
endforeach()
|
||||
list(REMOVE_DUPLICATES paths)
|
||||
if (NOT paths)
|
||||
message(FATAL_ERROR "Project ${project} does not declare a source with git_submodule_init")
|
||||
endif()
|
||||
_bext_inventory_set("${project}" SUBMODULE_PATHS "${paths}")
|
||||
|
||||
set(urls)
|
||||
set(shas)
|
||||
foreach(path ${paths})
|
||||
_bext_inventory_submodule_lookup(url sha "${source_dir}" "${path}")
|
||||
if (NOT url)
|
||||
message(FATAL_ERROR "${project} uses ${path}, but it is absent from .gitmodules")
|
||||
endif()
|
||||
list(APPEND urls "${url}")
|
||||
list(APPEND shas "${sha}")
|
||||
endforeach()
|
||||
_bext_inventory_set("${project}" SOURCE_URLS "${urls}")
|
||||
_bext_inventory_set("${project}" SOURCE_SHAS "${shas}")
|
||||
|
||||
string(REGEX MATCHALL "ExternalProject_Add\\([A-Za-z0-9_+-]+_BLD" provider_calls "${wrapper_text}")
|
||||
foreach(call ${provider_calls})
|
||||
string(REGEX REPLACE "ExternalProject_Add\\(([A-Za-z0-9_+-]+)_BLD" "\\1" provider "${call}")
|
||||
string(TOLOWER "${provider}" provider)
|
||||
string(REPLACE "_" "-" provider "${provider}")
|
||||
list(APPEND all_providers "${provider}")
|
||||
endforeach()
|
||||
endforeach()
|
||||
list(REMOVE_DUPLICATES all_providers)
|
||||
|
||||
# Validate dependency references and topological consistency.
|
||||
foreach(project ${projects})
|
||||
bext_inventory_get(deps "${project}" DEPS)
|
||||
foreach(dep ${deps})
|
||||
list(FIND projects "${dep}" project_index)
|
||||
list(FIND all_providers "${dep}" provider_index)
|
||||
if (project_index EQUAL -1 AND provider_index EQUAL -1)
|
||||
message(FATAL_ERROR "${project}.deps references unknown dependency ${dep}")
|
||||
endif()
|
||||
endforeach()
|
||||
endforeach()
|
||||
|
||||
set(resolved)
|
||||
set(remaining ${projects})
|
||||
while(remaining)
|
||||
set(progress FALSE)
|
||||
foreach(project ${remaining})
|
||||
bext_inventory_get(deps "${project}" DEPS)
|
||||
set(ready TRUE)
|
||||
foreach(dep ${deps})
|
||||
list(FIND projects "${dep}" dep_project_index)
|
||||
if (NOT dep_project_index EQUAL -1)
|
||||
list(FIND resolved "${dep}" resolved_index)
|
||||
if (resolved_index EQUAL -1)
|
||||
set(ready FALSE)
|
||||
endif()
|
||||
endif()
|
||||
endforeach()
|
||||
if (ready)
|
||||
list(APPEND resolved "${project}")
|
||||
list(REMOVE_ITEM remaining "${project}")
|
||||
set(progress TRUE)
|
||||
endif()
|
||||
endforeach()
|
||||
if (NOT progress)
|
||||
message(FATAL_ERROR "Dependency cycle detected among: ${remaining}")
|
||||
endif()
|
||||
endwhile()
|
||||
|
||||
# Distributed outputs must install their legal notice alongside the bundle.
|
||||
foreach(project ${projects})
|
||||
bext_inventory_get(output_class "${project}" OUTPUT)
|
||||
bext_inventory_get(has_license "${project}" HAS_LICENSE)
|
||||
if (output_class STREQUAL "install" AND NOT has_license)
|
||||
message(FATAL_ERROR "Bundled project ${project} does not install a license via DOC_LICENSE_DIR")
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
list(SORT projects)
|
||||
set(BEXT_INVENTORY_PROJECTS "${projects}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
@@ -0,0 +1,85 @@
|
||||
# D L L T Y P E C H E C K . C M A K E
|
||||
# BRL-CAD
|
||||
#
|
||||
# Copyright (c) 2024 United States Government as represented by
|
||||
# the U.S. Army Research Laboratory.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
#
|
||||
# 1. Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
#
|
||||
# 2. Redistributions in binary form must reproduce the above
|
||||
# copyright notice, this list of conditions and the following
|
||||
# disclaimer in the documentation and/or other materials provided
|
||||
# with the distribution.
|
||||
#
|
||||
# 3. The name of the author may not be used to endorse or promote
|
||||
# products derived from this software without specific prior written
|
||||
# permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
|
||||
# OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
|
||||
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
|
||||
# GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
# WHETHER IN CONTRACT, STRICT LIABILITY, 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.
|
||||
#
|
||||
###
|
||||
# Utility function to check the type of dlls built by bext.
|
||||
|
||||
include(CMakeParseArguments)
|
||||
|
||||
function(DllTypeCheck btype dlldir)
|
||||
if (NOT EXISTS "${dlldir}")
|
||||
return()
|
||||
endif (NOT EXISTS "${dlldir}")
|
||||
find_program(DUMPBIN_EXEC dumpbin)
|
||||
if (NOT DUMPBIN_EXEC)
|
||||
return()
|
||||
endif (NOT DUMPBIN_EXEC)
|
||||
file(GLOB dll_files RELATIVE "${dlldir}" "${dlldir}/*.dll")
|
||||
set(non_match 0)
|
||||
foreach(dlf ${dll_files})
|
||||
message("Dll Type check: ${dlf}")
|
||||
# dumpbin doesn't like CMake style paths
|
||||
file(TO_NATIVE_PATH "${dlf}" TBFN)
|
||||
# https://stackoverflow.com/a/28304716/2037687
|
||||
execute_process(COMMAND ${DUMPBIN_EXEC} /dependents ${TBFN}
|
||||
OUTPUT_VARIABLE DB_OUT
|
||||
ERROR_VARIABLE DB_OUT)
|
||||
if ("${btype}" STREQUAL "Release")
|
||||
if ("${DB_OUT}" MATCHES ".*MSVCP[0-9]*d.dll.*" OR "${DB_OUT}" MATCHES ".*MSVCP[0-9]*D.dll.*")
|
||||
set(non_match 1)
|
||||
message("Release build specified, but ${dlf} is built as Debug.")
|
||||
endif ("${DB_OUT}" MATCHES ".*MSVCP[0-9]*d.dll.*" OR "${DB_OUT}" MATCHES ".*MSVCP[0-9]*D.dll.*")
|
||||
endif ("${btype}" STREQUAL "Release")
|
||||
if ("${btype}" STREQUAL "Debug")
|
||||
if (NOT "${DB_OUT}" MATCHES ".*MSVCP[0-9]*d.dll.*" AND NOT "${DB_OUT}" MATCHES ".*MSVCP[0-9]*D.dll.*")
|
||||
set(non_match 1)
|
||||
message("Debug build specified, but ${dlf} is built as Release.")
|
||||
endif (NOT "${DB_OUT}" MATCHES ".*MSVCP[0-9]*d.dll.*" AND NOT "${DB_OUT}" MATCHES ".*MSVCP[0-9]*D.dll.*")
|
||||
endif ("${btype}" STREQUAL "Debug")
|
||||
endforeach(dlf ${dll_files})
|
||||
if (non_match)
|
||||
message(FATAL_ERROR "Found non-matching dll files - check build logic.")
|
||||
endif (non_match)
|
||||
endfunction(DllTypeCheck btype)
|
||||
|
||||
if (CMAKE_BUILD_TYPE AND DLL_DIR)
|
||||
DllTypeCheck(${CMAKE_BUILD_TYPE} ${DLL_DIR})
|
||||
endif (CMAKE_BUILD_TYPE AND DLL_DIR)
|
||||
|
||||
# Local Variables:
|
||||
# tab-width: 8
|
||||
# mode: cmake
|
||||
# indent-tabs-mode: t
|
||||
# End:
|
||||
# ex: shiftwidth=2 tabstop=8
|
||||
@@ -0,0 +1,451 @@
|
||||
# Finalize the bundled bext output and publish its file-processing manifest.
|
||||
|
||||
foreach(required_var
|
||||
BEXT_INSTALL_ROOT
|
||||
BEXT_MANIFEST
|
||||
BEXT_SOURCE_ROOT
|
||||
BEXT_BINARY_ROOT
|
||||
BEXT_NOINSTALL_ROOT
|
||||
BEXT_STRCLEAR
|
||||
BEXT_SYSTEM_NAME
|
||||
BIN_DIR
|
||||
LIB_DIR)
|
||||
if (NOT DEFINED ${required_var} OR "${${required_var}}" STREQUAL "")
|
||||
message(FATAL_ERROR "${required_var} is required")
|
||||
endif ()
|
||||
endforeach()
|
||||
|
||||
function(bext_json_escape outvar value)
|
||||
set(escaped "${value}")
|
||||
string(REPLACE "\\" "\\\\" escaped "${escaped}")
|
||||
string(REPLACE "\"" "\\\"" escaped "${escaped}")
|
||||
string(REPLACE "\r" "\\r" escaped "${escaped}")
|
||||
string(REPLACE "\n" "\\n" escaped "${escaped}")
|
||||
set(${outvar} "${escaped}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
function(bext_write_json_array manifest key values)
|
||||
file(APPEND "${manifest}" " \"${key}\": [\n")
|
||||
set(first TRUE)
|
||||
foreach(value ${${values}})
|
||||
bext_json_escape(escaped "${value}")
|
||||
if (first)
|
||||
set(first FALSE)
|
||||
else ()
|
||||
file(APPEND "${manifest}" ",\n")
|
||||
endif ()
|
||||
file(APPEND "${manifest}" " \"${escaped}\"")
|
||||
endforeach()
|
||||
file(APPEND "${manifest}" "\n ]")
|
||||
endfunction()
|
||||
|
||||
function(bext_write_file_list outvar filename values)
|
||||
file(WRITE "${filename}" "")
|
||||
foreach(value ${${values}})
|
||||
file(APPEND "${filename}" "${value}\n")
|
||||
endforeach()
|
||||
set(${outvar} "${filename}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
function(bext_content_fingerprints outvar root label file_list_var)
|
||||
set(records "")
|
||||
foreach(relative IN LISTS ${file_list_var})
|
||||
set(path "${root}/${relative}")
|
||||
if (IS_SYMLINK "${path}")
|
||||
file(READ_SYMLINK "${path}" value)
|
||||
string(APPEND records "L ${label}/${relative} ${value}\n")
|
||||
else ()
|
||||
file(SHA256 "${path}" value)
|
||||
string(APPEND records "F ${label}/${relative} ${value}\n")
|
||||
endif ()
|
||||
endforeach()
|
||||
set(${outvar} "${records}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
function(bext_relative_path outvar path)
|
||||
file(RELATIVE_PATH relative "${BEXT_INSTALL_ROOT}" "${path}")
|
||||
string(REPLACE "\\" "/" relative "${relative}")
|
||||
set(${outvar} "${relative}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
function(bext_is_skipped path outvar)
|
||||
if ("${path}" MATCHES "(^|/)(encodings|include|man|msgs)(/|$)")
|
||||
set(${outvar} TRUE PARENT_SCOPE)
|
||||
else ()
|
||||
set(${outvar} FALSE PARENT_SCOPE)
|
||||
endif ()
|
||||
endfunction()
|
||||
|
||||
function(bext_is_cmake_file path outvar)
|
||||
if ("${path}" MATCHES "(Deps|Modules|Version|Targets|Config)\\.cmake$" OR
|
||||
"${path}" MATCHES "\\.pc$")
|
||||
set(${outvar} TRUE PARENT_SCOPE)
|
||||
else ()
|
||||
set(${outvar} FALSE PARENT_SCOPE)
|
||||
endif ()
|
||||
endfunction()
|
||||
|
||||
function(bext_run_binary_clear files)
|
||||
if (NOT files)
|
||||
return()
|
||||
endif ()
|
||||
|
||||
set(clear_targets
|
||||
"${BEXT_SOURCE_ROOT}"
|
||||
"${BEXT_BINARY_ROOT}"
|
||||
"${BEXT_NOINSTALL_ROOT}"
|
||||
"${BEXT_INSTALL_ROOT}"
|
||||
)
|
||||
set(file_list "${BEXT_BINARY_ROOT}/CMakeFiles/bext-binary-files.txt")
|
||||
bext_write_file_list(file_list "${file_list}" files)
|
||||
|
||||
set(command "${BEXT_STRCLEAR}" -p -b -c --files "${file_list}")
|
||||
list(APPEND command ${clear_targets})
|
||||
execute_process(
|
||||
COMMAND ${command}
|
||||
RESULT_VARIABLE result
|
||||
OUTPUT_VARIABLE output
|
||||
ERROR_VARIABLE error
|
||||
)
|
||||
if (NOT result EQUAL 0)
|
||||
message(FATAL_ERROR "strclear binary cleanup failed: ${error}${output}")
|
||||
endif ()
|
||||
endfunction()
|
||||
|
||||
function(bext_run_rpath_update files)
|
||||
if (NOT files OR NOT BEXT_PLIEF)
|
||||
return()
|
||||
endif ()
|
||||
|
||||
execute_process(
|
||||
COMMAND "${BEXT_PLIEF}" --help
|
||||
RESULT_VARIABLE help_result
|
||||
OUTPUT_VARIABLE help_output
|
||||
ERROR_QUIET
|
||||
)
|
||||
if (NOT help_result EQUAL 0)
|
||||
message(FATAL_ERROR "Unable to query ${BEXT_PLIEF}")
|
||||
endif ()
|
||||
|
||||
set(rpath_args --set-rpath "${BEXT_INSTALL_ROOT}/${LIB_DIR}")
|
||||
if ("${help_output}" MATCHES "--set-rpath-if-needed")
|
||||
list(APPEND rpath_args
|
||||
--set-rpath-if-needed
|
||||
--stale-rpath-prefix "${BEXT_INSTALL_ROOT}"
|
||||
--stale-rpath-prefix "${BEXT_BINARY_ROOT}"
|
||||
)
|
||||
if ("${help_output}" MATCHES "--set-rpath-if-needed-prepend")
|
||||
list(APPEND rpath_args --set-rpath-if-needed-prepend)
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
if ("${help_output}" MATCHES "--files")
|
||||
set(file_list "${BEXT_BINARY_ROOT}/CMakeFiles/bext-rpath-files.txt")
|
||||
bext_write_file_list(file_list "${file_list}" files)
|
||||
execute_process(
|
||||
COMMAND "${BEXT_PLIEF}" ${rpath_args} --files "${file_list}"
|
||||
RESULT_VARIABLE result
|
||||
OUTPUT_VARIABLE output
|
||||
ERROR_VARIABLE error
|
||||
)
|
||||
if (NOT result EQUAL 0)
|
||||
message(FATAL_ERROR "RPATH update failed: ${error}${output}")
|
||||
endif ()
|
||||
else ()
|
||||
foreach(file ${files})
|
||||
execute_process(
|
||||
COMMAND "${BEXT_PLIEF}" ${rpath_args} "${file}"
|
||||
RESULT_VARIABLE result
|
||||
OUTPUT_VARIABLE output
|
||||
ERROR_VARIABLE error
|
||||
)
|
||||
if (NOT result EQUAL 0)
|
||||
message(FATAL_ERROR "RPATH update failed for ${file}: ${error}${output}")
|
||||
endif ()
|
||||
endforeach()
|
||||
endif ()
|
||||
endfunction()
|
||||
|
||||
function(bext_run_text_replace files target replacement)
|
||||
if (NOT files OR "${target}" STREQUAL "")
|
||||
return()
|
||||
endif ()
|
||||
|
||||
set(text_paths)
|
||||
foreach(relative ${files})
|
||||
list(APPEND text_paths "${BEXT_INSTALL_ROOT}/${relative}")
|
||||
endforeach()
|
||||
set(file_list "${BEXT_BINARY_ROOT}/CMakeFiles/bext-text-files.txt")
|
||||
bext_write_file_list(file_list "${file_list}" text_paths)
|
||||
execute_process(
|
||||
COMMAND "${BEXT_STRCLEAR}" -p --files "${file_list}" "${target}" "${replacement}"
|
||||
RESULT_VARIABLE result
|
||||
OUTPUT_VARIABLE output
|
||||
ERROR_VARIABLE error
|
||||
)
|
||||
if (NOT result EQUAL 0)
|
||||
message(FATAL_ERROR "strclear text replacement failed for ${target}: ${error}${output}")
|
||||
endif ()
|
||||
endfunction()
|
||||
|
||||
file(MAKE_DIRECTORY "${BEXT_BINARY_ROOT}/CMakeFiles")
|
||||
file(GLOB_RECURSE installed_files
|
||||
LIST_DIRECTORIES false
|
||||
RELATIVE "${BEXT_INSTALL_ROOT}"
|
||||
"${BEXT_INSTALL_ROOT}/*"
|
||||
)
|
||||
list(SORT installed_files)
|
||||
|
||||
set(classify_files)
|
||||
set(skipped_files)
|
||||
foreach(relative ${installed_files})
|
||||
set(path "${BEXT_INSTALL_ROOT}/${relative}")
|
||||
if (IS_SYMLINK "${path}")
|
||||
list(APPEND skipped_files "${relative}")
|
||||
continue()
|
||||
endif ()
|
||||
bext_is_skipped("${relative}" skipped)
|
||||
if (skipped)
|
||||
list(APPEND skipped_files "${relative}")
|
||||
else ()
|
||||
list(APPEND classify_files "${path}")
|
||||
endif ()
|
||||
endforeach()
|
||||
|
||||
set(text_files)
|
||||
set(binary_probe_files)
|
||||
if (classify_files)
|
||||
execute_process(
|
||||
COMMAND "${BEXT_STRCLEAR}" --help
|
||||
RESULT_VARIABLE strclear_help_result
|
||||
OUTPUT_VARIABLE strclear_help
|
||||
ERROR_QUIET
|
||||
)
|
||||
if (NOT strclear_help_result EQUAL 0)
|
||||
message(FATAL_ERROR "Unable to query ${BEXT_STRCLEAR}")
|
||||
endif ()
|
||||
|
||||
if ("${strclear_help}" MATCHES "--classify" AND "${strclear_help}" MATCHES "--files")
|
||||
set(classify_list "${BEXT_BINARY_ROOT}/CMakeFiles/bext-classify-files.txt")
|
||||
bext_write_file_list(classify_list "${classify_list}" classify_files)
|
||||
execute_process(
|
||||
COMMAND "${BEXT_STRCLEAR}" --classify --files "${classify_list}"
|
||||
RESULT_VARIABLE classify_result
|
||||
OUTPUT_VARIABLE classify_output
|
||||
ERROR_VARIABLE classify_error
|
||||
)
|
||||
if (NOT classify_result EQUAL 0)
|
||||
message(FATAL_ERROR "strclear classification failed: ${classify_error}${classify_output}")
|
||||
endif ()
|
||||
string(REPLACE "\r\n" "\n" classify_output "${classify_output}")
|
||||
string(REPLACE "\n" ";" classify_records "${classify_output}")
|
||||
foreach(record ${classify_records})
|
||||
if ("${record}" STREQUAL "")
|
||||
continue()
|
||||
endif ()
|
||||
string(JSON type ERROR_VARIABLE json_error GET "${record}" type)
|
||||
string(JSON path ERROR_VARIABLE path_error GET "${record}" path)
|
||||
if (NOT "${json_error}" STREQUAL "NOTFOUND" OR NOT "${path_error}" STREQUAL "NOTFOUND")
|
||||
message(FATAL_ERROR "Invalid strclear classification record: ${record}")
|
||||
endif ()
|
||||
bext_relative_path(relative "${path}")
|
||||
if ("${type}" STREQUAL "TEXT")
|
||||
list(APPEND text_files "${relative}")
|
||||
elseif ("${type}" STREQUAL "BINARY")
|
||||
list(APPEND binary_probe_files "${relative}")
|
||||
else ()
|
||||
message(FATAL_ERROR "Unknown strclear classification: ${type}")
|
||||
endif ()
|
||||
endforeach()
|
||||
else ()
|
||||
foreach(path ${classify_files})
|
||||
execute_process(
|
||||
COMMAND "${BEXT_STRCLEAR}" -B "${path}"
|
||||
RESULT_VARIABLE binary_result
|
||||
ERROR_QUIET
|
||||
)
|
||||
bext_relative_path(relative "${path}")
|
||||
if (binary_result EQUAL 0)
|
||||
list(APPEND binary_probe_files "${relative}")
|
||||
elseif (binary_result EQUAL 1)
|
||||
list(APPEND text_files "${relative}")
|
||||
else ()
|
||||
message(FATAL_ERROR "strclear could not classify ${path}")
|
||||
endif ()
|
||||
endforeach()
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
set(rpath_files)
|
||||
set(binary_files)
|
||||
if (binary_probe_files)
|
||||
if (BEXT_PLIEF)
|
||||
execute_process(
|
||||
COMMAND "${BEXT_PLIEF}" --help
|
||||
RESULT_VARIABLE plief_help_result
|
||||
OUTPUT_VARIABLE plief_help
|
||||
ERROR_QUIET
|
||||
)
|
||||
else ()
|
||||
set(plief_help_result 1)
|
||||
endif ()
|
||||
|
||||
if (plief_help_result EQUAL 0 AND "${plief_help}" MATCHES "--classify" AND "${plief_help}" MATCHES "--files")
|
||||
set(plief_list "${BEXT_BINARY_ROOT}/CMakeFiles/bext-plief-files.txt")
|
||||
set(plief_paths)
|
||||
foreach(relative ${binary_probe_files})
|
||||
list(APPEND plief_paths "${BEXT_INSTALL_ROOT}/${relative}")
|
||||
endforeach()
|
||||
bext_write_file_list(plief_list "${plief_list}" plief_paths)
|
||||
execute_process(
|
||||
COMMAND "${BEXT_PLIEF}" --classify --files "${plief_list}"
|
||||
RESULT_VARIABLE plief_result
|
||||
OUTPUT_VARIABLE plief_output
|
||||
ERROR_VARIABLE plief_error
|
||||
)
|
||||
if (NOT plief_result EQUAL 0)
|
||||
message(FATAL_ERROR "plief classification failed: ${plief_error}${plief_output}")
|
||||
endif ()
|
||||
string(REPLACE "\r\n" "\n" plief_output "${plief_output}")
|
||||
string(REPLACE "\n" ";" plief_records "${plief_output}")
|
||||
foreach(record ${plief_records})
|
||||
if ("${record}" STREQUAL "")
|
||||
continue()
|
||||
endif ()
|
||||
string(JSON type ERROR_VARIABLE json_error GET "${record}" type)
|
||||
string(JSON path ERROR_VARIABLE path_error GET "${record}" path)
|
||||
if (NOT "${json_error}" STREQUAL "NOTFOUND" OR NOT "${path_error}" STREQUAL "NOTFOUND")
|
||||
message(FATAL_ERROR "Invalid plief classification record: ${record}")
|
||||
endif ()
|
||||
bext_relative_path(relative "${path}")
|
||||
if ("${type}" STREQUAL "ELF")
|
||||
list(APPEND rpath_files "${relative}")
|
||||
elseif ("${type}" STREQUAL "OTHER")
|
||||
list(APPEND binary_files "${relative}")
|
||||
else ()
|
||||
message(FATAL_ERROR "Unknown plief classification: ${type}")
|
||||
endif ()
|
||||
endforeach()
|
||||
else ()
|
||||
if ("${BEXT_SYSTEM_NAME}" STREQUAL "Darwin")
|
||||
foreach(relative ${binary_probe_files})
|
||||
execute_process(
|
||||
COMMAND otool -l "${BEXT_INSTALL_ROOT}/${relative}"
|
||||
RESULT_VARIABLE otool_result
|
||||
OUTPUT_VARIABLE otool_output
|
||||
ERROR_QUIET
|
||||
)
|
||||
if (otool_result EQUAL 0 AND
|
||||
NOT "${otool_output}" MATCHES "Archive|not an object")
|
||||
list(APPEND rpath_files "${relative}")
|
||||
else ()
|
||||
list(APPEND binary_files "${relative}")
|
||||
endif ()
|
||||
endforeach()
|
||||
else ()
|
||||
list(APPEND binary_files ${binary_probe_files})
|
||||
endif ()
|
||||
endif ()
|
||||
else ()
|
||||
set(plief_help_result 1)
|
||||
endif ()
|
||||
|
||||
list(SORT text_files)
|
||||
list(SORT rpath_files)
|
||||
list(SORT binary_files)
|
||||
set(cmake_files)
|
||||
set(plain_text_files)
|
||||
foreach(relative ${text_files})
|
||||
bext_is_cmake_file("${relative}" is_cmake)
|
||||
if (is_cmake)
|
||||
list(APPEND cmake_files "${relative}")
|
||||
else ()
|
||||
list(APPEND plain_text_files "${relative}")
|
||||
endif ()
|
||||
endforeach()
|
||||
list(SORT cmake_files)
|
||||
list(SORT plain_text_files)
|
||||
|
||||
# Replace paths that only have meaning while bext is being built. Keep the
|
||||
# install prefix intact: downstream projects replace this canonical prefix
|
||||
# with their own staging prefix after copying the finalized tree.
|
||||
set(text_paths ${text_files})
|
||||
foreach(clear_target
|
||||
"${BEXT_SOURCE_ROOT}"
|
||||
"${BEXT_BINARY_ROOT}"
|
||||
"${BEXT_NOINSTALL_ROOT}")
|
||||
bext_run_text_replace("${text_paths}" "${clear_target}" "${BEXT_INSTALL_ROOT}")
|
||||
endforeach()
|
||||
|
||||
# Clear paths before restoring the canonical bext RPATH. Clearing the install
|
||||
# root after the RPATH update would also clear the newly written RPATH.
|
||||
set(all_binary_files ${rpath_files} ${binary_files})
|
||||
set(binary_paths)
|
||||
set(rpath_paths)
|
||||
foreach(relative ${all_binary_files})
|
||||
list(APPEND binary_paths "${BEXT_INSTALL_ROOT}/${relative}")
|
||||
endforeach()
|
||||
foreach(relative ${rpath_files})
|
||||
list(APPEND rpath_paths "${BEXT_INSTALL_ROOT}/${relative}")
|
||||
endforeach()
|
||||
set(binary_cleanup_paths ${binary_paths})
|
||||
if ("${BEXT_SYSTEM_NAME}" STREQUAL "Darwin" AND
|
||||
NOT BEXT_PLIEF)
|
||||
# Without plief, preserve Mach-O RPATH load commands for BRL-CAD's
|
||||
# install_name_tool staging pass.
|
||||
set(binary_cleanup_paths)
|
||||
foreach(relative ${binary_files})
|
||||
list(APPEND binary_cleanup_paths "${BEXT_INSTALL_ROOT}/${relative}")
|
||||
endforeach()
|
||||
endif ()
|
||||
bext_run_binary_clear("${binary_cleanup_paths}")
|
||||
bext_run_rpath_update("${rpath_paths}")
|
||||
|
||||
file(WRITE "${BEXT_MANIFEST}.tmp" "{\n")
|
||||
file(APPEND "${BEXT_MANIFEST}.tmp" " \"schema\": 1,\n")
|
||||
bext_json_escape(platform "${BEXT_SYSTEM_NAME}")
|
||||
file(APPEND "${BEXT_MANIFEST}.tmp" " \"platform\": \"${platform}\",\n")
|
||||
file(APPEND "${BEXT_MANIFEST}.tmp" " \"install_root\": \"install\",\n")
|
||||
file(APPEND "${BEXT_MANIFEST}.tmp" " \"generated_by\": \"bext\",\n")
|
||||
bext_write_json_array("${BEXT_MANIFEST}.tmp" "files" installed_files)
|
||||
file(APPEND "${BEXT_MANIFEST}.tmp" ",\n")
|
||||
bext_write_json_array("${BEXT_MANIFEST}.tmp" "rpath" rpath_files)
|
||||
file(APPEND "${BEXT_MANIFEST}.tmp" ",\n")
|
||||
bext_write_json_array("${BEXT_MANIFEST}.tmp" "binary" binary_files)
|
||||
file(APPEND "${BEXT_MANIFEST}.tmp" ",\n")
|
||||
bext_write_json_array("${BEXT_MANIFEST}.tmp" "cmake" cmake_files)
|
||||
file(APPEND "${BEXT_MANIFEST}.tmp" ",\n")
|
||||
bext_write_json_array("${BEXT_MANIFEST}.tmp" "text" plain_text_files)
|
||||
file(APPEND "${BEXT_MANIFEST}.tmp" "\n}\n")
|
||||
file(COPY_FILE "${BEXT_MANIFEST}.tmp" "${BEXT_MANIFEST}" ONLY_IF_DIFFERENT)
|
||||
file(REMOVE "${BEXT_MANIFEST}.tmp")
|
||||
|
||||
# Existing files are watched by downstream builds. This list also detects
|
||||
# additions and removals without changing its timestamp on a no-op build.
|
||||
file(GLOB_RECURSE noinstall_files
|
||||
LIST_DIRECTORIES false
|
||||
RELATIVE "${BEXT_NOINSTALL_ROOT}"
|
||||
"${BEXT_NOINSTALL_ROOT}/*"
|
||||
)
|
||||
list(REMOVE_ITEM noinstall_files "build-stamp")
|
||||
list(SORT noinstall_files)
|
||||
set(noinstall_inventory "${BEXT_BINARY_ROOT}/CMakeFiles/bext-noinstall-files.txt")
|
||||
bext_write_file_list(noinstall_inventory "${noinstall_inventory}" noinstall_files)
|
||||
file(COPY_FILE "${noinstall_inventory}" "${BEXT_NOINSTALL_ROOT}/build-stamp"
|
||||
ONLY_IF_DIFFERENT)
|
||||
|
||||
# Finalized binaries and config files may be rewritten on every install even
|
||||
# when their resulting bytes are unchanged. Publish one stable dependency for
|
||||
# downstream builds instead of making them watch every output timestamp.
|
||||
bext_content_fingerprints(installed_content "${BEXT_INSTALL_ROOT}" "install"
|
||||
installed_files)
|
||||
bext_content_fingerprints(noinstall_content "${BEXT_NOINSTALL_ROOT}" "noinstall"
|
||||
noinstall_files)
|
||||
file(SHA256 "${BEXT_MANIFEST}" manifest_digest)
|
||||
string(SHA256 content_digest
|
||||
"${installed_content}${noinstall_content}M ${manifest_digest}\n")
|
||||
set(content_stamp "${BEXT_BINARY_ROOT}/bext-content-stamp")
|
||||
file(WRITE "${content_stamp}.tmp" "${content_digest}\n")
|
||||
file(COPY_FILE "${content_stamp}.tmp" "${content_stamp}" ONLY_IF_DIFFERENT)
|
||||
file(REMOVE "${content_stamp}.tmp")
|
||||
message(STATUS "Generated bext install manifest: ${BEXT_MANIFEST}")
|
||||
@@ -0,0 +1,100 @@
|
||||
#
|
||||
# This file is modeled after appleseed.
|
||||
# Visit https://appleseedhq.net/ for additional information and resources.
|
||||
#
|
||||
# This software is released under the MIT license.
|
||||
#
|
||||
# Copyright (c) 2014-2018 Esteban Tovagliari, The appleseedhq Organization
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
# THE SOFTWARE.
|
||||
#
|
||||
|
||||
###
|
||||
# - Find ASSETIMPORT
|
||||
# Find the native ASSETIMPORT includes and library
|
||||
#
|
||||
# ASSETIMPORT_INCLUDE_DIR - where to find include headers
|
||||
# ASSETIMPORT_LIBRARIES - List of libraries when using assetimport.
|
||||
#
|
||||
###
|
||||
# - helpful cmake flags when building
|
||||
#
|
||||
# ASSETIMPORT_ROOT - path to assetimport root if it is built outside of /usr
|
||||
#
|
||||
#=============================================================================
|
||||
set(_ASSETIMPORT_SEARCHES)
|
||||
|
||||
# Search ASSETIMPORT_ROOT first if it is set.
|
||||
if(ASSETIMPORT_ROOT)
|
||||
set(_ASSETIMPORT_SEARCH_ROOT PATHS ${ASSETIMPORT_ROOT} NO_DEFAULT_PATH)
|
||||
list(APPEND _ASSETIMPORT_SEARCHES _ASSETIMPORT_SEARCH_ROOT)
|
||||
endif()
|
||||
|
||||
set(ASSETIMPORT_NAMES assimp assimpd)
|
||||
|
||||
# Try each search configuration.
|
||||
foreach(search ${_ASSETIMPORT_SEARCHES})
|
||||
find_path(ASSETIMPORT_INCLUDE_DIR
|
||||
NAMES assimp/postprocess.h assimp/scene.h assimp/version.h assimp/config.h assimp/cimport.h
|
||||
${${search}} PATH_SUFFIXES include)
|
||||
find_library(ASSETIMPORT_LIBRARY
|
||||
NAMES ${ASSETIMPORT_NAMES}
|
||||
${${search}} PATH_SUFFIXES lib lib64 bin)
|
||||
endforeach()
|
||||
|
||||
if (NOT ASSETIMPORT_LIBRARY OR NOT ASSETIMPORT_INCLUDE_DIR)
|
||||
# Try a more generic search
|
||||
find_path(ASSETIMPORT_INCLUDE_DIR
|
||||
NAMES assimp/postprocess.h assimp/scene.h assimp/version.h assimp/config.h assimp/cimport.h
|
||||
PATH_SUFFIXES include)
|
||||
find_library(ASSETIMPORT_LIBRARY
|
||||
NAMES ${ASSETIMPORT_NAMES}
|
||||
PATH_SUFFIXES lib lib64 bin)
|
||||
endif (NOT ASSETIMPORT_LIBRARY OR NOT ASSETIMPORT_INCLUDE_DIR)
|
||||
|
||||
# Handle the QUIETLY and REQUIRED arguments and set assetimport_FOUND.
|
||||
include (FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args (ASSETIMPORT REQUIRED_VARS
|
||||
ASSETIMPORT_LIBRARY
|
||||
ASSETIMPORT_INCLUDE_DIR
|
||||
)
|
||||
|
||||
# Set the output variables.
|
||||
if (ASSETIMPORT_FOUND)
|
||||
set (ASSETIMPORT_LIBRARY "${ASSETIMPORT_LIBRARY}" CACHE PATH "Asset Import Library")
|
||||
set (ASSETIMPORT_INCLUDE_DIRS ${ASSETIMPORT_INCLUDE_DIR})
|
||||
set (ASSETIMPORT_LIBRARIES ${ASSETIMPORT_LIBRARY})
|
||||
else ()
|
||||
set (ASSETIMPORT_INCLUDE_DIRS)
|
||||
set (ASSETIMPORT_LIBRARIES)
|
||||
endif ()
|
||||
|
||||
mark_as_advanced (
|
||||
ASSETIMPORT_INCLUDE_DIR
|
||||
ASSETIMPORT_LIBRARY
|
||||
)
|
||||
|
||||
|
||||
|
||||
# Local Variables:
|
||||
# tab-width: 8
|
||||
# mode: cmake
|
||||
# indent-tabs-mode: t
|
||||
# End:
|
||||
# ex: shiftwidth=2 tabstop=8
|
||||
@@ -0,0 +1,82 @@
|
||||
# F I N D G T E . C M A K E
|
||||
# BRL-CAD
|
||||
#
|
||||
# Copyright (c) 2024 United States Government as represented by
|
||||
# the U.S. Army Research Laboratory.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
#
|
||||
# 1. Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
#
|
||||
# 2. Redistributions in binary form must reproduce the above
|
||||
# copyright notice, this list of conditions and the following
|
||||
# disclaimer in the documentation and/or other materials provided
|
||||
# with the distribution.
|
||||
#
|
||||
# 3. The name of the author may not be used to endorse or promote
|
||||
# products derived from this software without specific prior written
|
||||
# permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
|
||||
# OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
|
||||
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
|
||||
# GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
# WHETHER IN CONTRACT, STRICT LIABILITY, 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.
|
||||
#
|
||||
###
|
||||
# Find GeometricTools Mathematics headers
|
||||
#
|
||||
# Once done this will define
|
||||
#
|
||||
# GTE_FOUND - system has GTE Mathematics headers
|
||||
# GTE_INCLUDE_DIR - the GTE include directory
|
||||
#
|
||||
# and the following imported target:
|
||||
#
|
||||
# GTE::GTE- Provides include dir for GeometricTools Mathematics headers
|
||||
|
||||
set(_GTE_SEARCHES)
|
||||
|
||||
# Search GTE_ROOT first if it is set.
|
||||
if(GTE_ROOT)
|
||||
set(_GTE_SEARCH_ROOT PATHS ${GTE_ROOT} NO_DEFAULT_PATH)
|
||||
list(APPEND _GTE_SEARCHES _GTE_SEARCH_ROOT)
|
||||
endif()
|
||||
|
||||
# Try each search configuration.
|
||||
foreach(search ${_GTE_SEARCHES})
|
||||
find_path(GTE_INCLUDE_DIR NAMES Mathematics/ConvexHull3.h ${${search}} PATH_SUFFIXES include include/GTE)
|
||||
endforeach()
|
||||
|
||||
mark_as_advanced(GTE_INCLUDE_DIR)
|
||||
|
||||
# handle the QUIETLY and REQUIRED arguments and set ZLIB_FOUND to TRUE if
|
||||
# all listed variables are TRUE
|
||||
include(FindPackageHandleStandardArgs)
|
||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(GTE REQUIRED_VARS GTE_INCLUDE_DIR)
|
||||
|
||||
if(GTE_FOUND)
|
||||
set(GTE_INCLUDE_DIRS ${GTE_INCLUDE_DIR})
|
||||
|
||||
if(NOT TARGET GTE::GTE)
|
||||
add_library(GTE::GTE UNKNOWN IMPORTED)
|
||||
set_target_properties(GTE::GTE PROPERTIES
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${GTE_INCLUDE_DIRS}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Local Variables:
|
||||
# tab-width: 8
|
||||
# mode: cmake
|
||||
# indent-tabs-mode: t
|
||||
# End:
|
||||
# ex: shiftwidth=2 tabstop=8
|
||||
@@ -0,0 +1,268 @@
|
||||
#
|
||||
# - Find lemon executable and provides macros to generate custom build rules
|
||||
# The module defines the following variables
|
||||
#
|
||||
# LEMON_EXECUTABLE - path to the lemon program
|
||||
# LEMON_TEMPLATE - location of the lemon template file
|
||||
|
||||
#=============================================================================
|
||||
# F I N D L E M O N . C M A K E
|
||||
#
|
||||
# Originally based off of FindBISON.cmake from Kitware's CMake distribution
|
||||
#
|
||||
# Copyright (c) 2010-2023 United States Government as represented by
|
||||
# the U.S. Army Research Laboratory.
|
||||
# Copyright 2009 Kitware, Inc.
|
||||
# Copyright 2006 Tristan Carel
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
#
|
||||
# * Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
#
|
||||
# * Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
#
|
||||
# * The names of the authors may not be used to endorse or promote
|
||||
# products derived from this software without specific prior written
|
||||
# permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
# HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 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.
|
||||
#=============================================================================
|
||||
|
||||
set(_LEMON_SEARCHES)
|
||||
|
||||
# Search LEMON_ROOT first if it is set.
|
||||
if(LEMON_ROOT)
|
||||
set(_LEMON_SEARCH_ROOT PATHS ${LEMON_ROOT} NO_DEFAULT_PATH)
|
||||
list(APPEND _LEMON_SEARCHES _LEMON_SEARCH_ROOT)
|
||||
endif()
|
||||
|
||||
# Normal search.
|
||||
set(_LEMON_x86 "(x86)")
|
||||
set(_LEMON_SEARCH_NORMAL
|
||||
PATHS "$ENV{ProgramFiles}/lemon"
|
||||
"$ENV{ProgramFiles${_LEMON_x86}}/lemon")
|
||||
unset(_LEMON_x86)
|
||||
list(APPEND _LEMON_SEARCHES _LEMON_SEARCH_NORMAL)
|
||||
|
||||
set(LEMON_NAMES lemon)
|
||||
|
||||
# Try each search configuration.
|
||||
foreach(search ${_LEMON_SEARCHES})
|
||||
find_program(LEMON_EXECUTABLE lemon ${${search}} PATH_SUFFIXES bin)
|
||||
endforeach()
|
||||
mark_as_advanced(LEMON_EXECUTABLE)
|
||||
|
||||
foreach(search ${_LEMON_SEARCHES})
|
||||
find_file(LEMON_TEMPLATE lempar.c ${${search}} PATH_SUFFIXES ${DATA_DIR} ${DATA_DIR}/lemon)
|
||||
endforeach()
|
||||
mark_as_advanced(LEMON_TEMPLATE)
|
||||
|
||||
if (LEMON_EXECUTABLE AND NOT LEMON_TEMPLATE)
|
||||
# look for the template in share
|
||||
if (DATA_DIR AND EXISTS "${DATA_DIR}/lemon/lempar.c")
|
||||
set (LEMON_TEMPLATE "${DATA_DIR}/lemon/lempar.c")
|
||||
elseif (EXISTS "share/lemon/lempar.c")
|
||||
set (LEMON_TEMPLATE "share/lemon/lempar.c")
|
||||
elseif (EXISTS "/usr/share/lemon/lempar.c")
|
||||
set (LEMON_TEMPLATE "/usr/share/lemon/lempar.c")
|
||||
endif (DATA_DIR AND EXISTS "${DATA_DIR}/lemon/lempar.c")
|
||||
endif (LEMON_EXECUTABLE AND NOT LEMON_TEMPLATE)
|
||||
|
||||
if (LEMON_EXECUTABLE AND NOT LEMON_TEMPLATE)
|
||||
# look for the template in bin dir
|
||||
get_filename_component(lemon_path ${LEMON_EXECUTABLE} DIRECTORY)
|
||||
if (lemon_path)
|
||||
if (EXISTS ${lemon_path}/lempar.c)
|
||||
set (LEMON_TEMPLATE "${lemon_path}/lempar.c")
|
||||
endif (EXISTS ${lemon_path}/lempar.c)
|
||||
if (EXISTS /usr/share/lemon/lempar.c)
|
||||
set (LEMON_TEMPLATE "/usr/share/lemon/lempar.c")
|
||||
endif (EXISTS /usr/share/lemon/lempar.c)
|
||||
endif (lemon_path)
|
||||
endif(LEMON_EXECUTABLE AND NOT LEMON_TEMPLATE)
|
||||
|
||||
if (LEMON_EXECUTABLE AND NOT LEMON_TEMPLATE)
|
||||
# fallback
|
||||
set (LEMON_TEMPLATE "lempar.c")
|
||||
if (NOT EXISTS ${LEMON_TEMPLATE})
|
||||
message(WARNING "Lemon's lempar.c template file could not be found automatically, set LEMON_TEMPLATE")
|
||||
endif (NOT EXISTS ${LEMON_TEMPLATE})
|
||||
endif (LEMON_EXECUTABLE AND NOT LEMON_TEMPLATE)
|
||||
|
||||
mark_as_advanced(LEMON_TEMPLATE)
|
||||
|
||||
# Verify lemon supports %realloc and %free directives (BRL-CAD extensions).
|
||||
# System lemon (from SQLite) does not support these, but stepcode requires them.
|
||||
if(LEMON_EXECUTABLE AND LEMON_TEMPLATE)
|
||||
set(_lemon_test_dir "${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/lemon_test")
|
||||
file(MAKE_DIRECTORY "${_lemon_test_dir}")
|
||||
file(WRITE "${_lemon_test_dir}/test.y"
|
||||
"%token_type {int}\n%realloc realloc\n%free free\n%start_symbol start\nstart ::= .\n")
|
||||
execute_process(
|
||||
COMMAND ${LEMON_EXECUTABLE} -T${LEMON_TEMPLATE} -q test.y
|
||||
WORKING_DIRECTORY "${_lemon_test_dir}"
|
||||
RESULT_VARIABLE _lemon_test_result
|
||||
OUTPUT_QUIET ERROR_QUIET
|
||||
)
|
||||
if(NOT _lemon_test_result EQUAL 0)
|
||||
message(STATUS "Found lemon at ${LEMON_EXECUTABLE} but it lacks %realloc/%free support")
|
||||
set(LEMON_EXECUTABLE "LEMON_EXECUTABLE-NOTFOUND" CACHE FILEPATH "Path to lemon" FORCE)
|
||||
set(LEMON_TEMPLATE "LEMON_TEMPLATE-NOTFOUND" CACHE FILEPATH "Path to lempar.c" FORCE)
|
||||
endif()
|
||||
file(REMOVE_RECURSE "${_lemon_test_dir}")
|
||||
unset(_lemon_test_dir)
|
||||
unset(_lemon_test_result)
|
||||
endif()
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(LEMON DEFAULT_MSG LEMON_EXECUTABLE LEMON_TEMPLATE)
|
||||
|
||||
# Define the macro
|
||||
# LEMON_TARGET(<Name> <LemonInput> <LemonSource> <LemonHeader>
|
||||
# [<ArgString>])
|
||||
# which will create a custom rule to generate a parser. <LemonInput> is
|
||||
# the path to a lemon file. <LemonSource> is the desired name for the
|
||||
# generated source file. <LemonHeader> is the desired name for the
|
||||
# generated header which contains the token list. Anything in the optional
|
||||
# <ArgString> parameter is appended to the lemon command line.
|
||||
#
|
||||
# ====================================================================
|
||||
# Example:
|
||||
#
|
||||
# find_package(LEMON)
|
||||
# LEMON_TARGET(MyParser parser.y parser.c parser.h)
|
||||
# add_executable(Foo main.cpp ${LEMON_MyParser_OUTPUTS})
|
||||
# ====================================================================
|
||||
|
||||
include(CMakeParseArguments)
|
||||
|
||||
if(NOT COMMAND LEMON_TARGET)
|
||||
macro(LEMON_TARGET Name Input)
|
||||
|
||||
get_filename_component(IN_FILE_WE ${Input} NAME_WE)
|
||||
set(LVAR_PREFIX ${Name}_${IN_FILE_WE})
|
||||
|
||||
if(${ARGC} GREATER 3)
|
||||
CMAKE_PARSE_ARGUMENTS(${LVAR_PREFIX} "" "OUT_SRC_FILE;OUT_HDR_FILE;WORKING_DIR;EXTRA_ARGS" "" ${ARGN})
|
||||
endif(${ARGC} GREATER 3)
|
||||
|
||||
if (TARGET perplex_stage)
|
||||
set(DEPS_TARGET perplex_stage)
|
||||
endif (TARGET perplex_stage)
|
||||
|
||||
# Need a working directory
|
||||
if("${${LVAR_PREFIX}_WORKING_DIR}" STREQUAL "")
|
||||
set(${LVAR_PREFIX}_WORKING_DIR "${CMAKE_CURRENT_BINARY_DIR}/${LVAR_PREFIX}")
|
||||
endif("${${LVAR_PREFIX}_WORKING_DIR}" STREQUAL "")
|
||||
file(MAKE_DIRECTORY ${${LVAR_PREFIX}_WORKING_DIR})
|
||||
|
||||
# Output source file
|
||||
if ("${${LVAR_PREFIX}_OUT_SRC_FILE}" STREQUAL "")
|
||||
set(${LVAR_PREFIX}_OUT_SRC_FILE ${${LVAR_PREFIX}_WORKING_DIR}/${IN_FILE_WE}.c)
|
||||
else ("${${LVAR_PREFIX}_OUT_SRC_FILE}" STREQUAL "")
|
||||
get_filename_component(specified_out_dir ${${LVAR_PREFIX}_OUT_SRC_FILE} DIRECTORY)
|
||||
if(NOT "${specified_out_dir}" STREQUAL "")
|
||||
message(FATAL_ERROR "\nFull path specified for OUT_SRC_FILE - should be filename only.\n")
|
||||
endif(NOT "${specified_out_dir}" STREQUAL "")
|
||||
set(${LVAR_PREFIX}_OUT_SRC_FILE ${${LVAR_PREFIX}_WORKING_DIR}/${${LVAR_PREFIX}_OUT_SRC_FILE})
|
||||
endif ("${${LVAR_PREFIX}_OUT_SRC_FILE}" STREQUAL "")
|
||||
|
||||
# Output header file
|
||||
if ("${${LVAR_PREFIX}_OUT_HDR_FILE}" STREQUAL "")
|
||||
set(${LVAR_PREFIX}_OUT_HDR_FILE ${${LVAR_PREFIX}_WORKING_DIR}/${IN_FILE_WE}.h)
|
||||
else ("${${LVAR_PREFIX}_OUT_HDR_FILE}" STREQUAL "")
|
||||
get_filename_component(specified_out_dir ${${LVAR_PREFIX}_OUT_HDR_FILE} DIRECTORY)
|
||||
if(NOT "${specified_out_dir}" STREQUAL "")
|
||||
message(FATAL_ERROR "\nFull path specified for OUT_HDR_FILE - should be filename only.\n")
|
||||
endif(NOT "${specified_out_dir}" STREQUAL "")
|
||||
set(${LVAR_PREFIX}_OUT_HDR_FILE ${${LVAR_PREFIX}_WORKING_DIR}/${${LVAR_PREFIX}_OUT_HDR_FILE})
|
||||
endif ("${${LVAR_PREFIX}_OUT_HDR_FILE}" STREQUAL "")
|
||||
|
||||
# input file
|
||||
get_filename_component(in_full ${Input} ABSOLUTE)
|
||||
if("${in_full}" STREQUAL "${Input}")
|
||||
set(lemon_in_file ${Input})
|
||||
else("${in_full}" STREQUAL "${Input}")
|
||||
set(lemon_in_file "${CMAKE_CURRENT_SOURCE_DIR}/${Input}")
|
||||
endif("${in_full}" STREQUAL "${Input}")
|
||||
|
||||
|
||||
# names of lemon output files will be based on the name of the input file
|
||||
set(LEMON_GEN_SOURCE ${${LVAR_PREFIX}_WORKING_DIR}/${IN_FILE_WE}.c)
|
||||
set(LEMON_GEN_HEADER ${${LVAR_PREFIX}_WORKING_DIR}/${IN_FILE_WE}.h)
|
||||
set(LEMON_GEN_OUT ${${LVAR_PREFIX}_WORKING_DIR}/${IN_FILE_WE}.out)
|
||||
|
||||
# copy input to bin directory and run lemon
|
||||
get_filename_component(INPUT_NAME ${Input} NAME)
|
||||
add_custom_command(
|
||||
OUTPUT ${LEMON_GEN_OUT} ${LEMON_GEN_SOURCE} ${LEMON_GEN_HEADER}
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${lemon_in_file} ${${LVAR_PREFIX}_WORKING_DIR}/${INPUT_NAME}
|
||||
COMMAND ${CMAKE_COMMAND} -E touch ${${LVAR_PREFIX}_WORKING_DIR}/${INPUT_NAME}-tmp_cpy.done
|
||||
COMMAND ${CMAKE_COMMAND} -E remove ${${LVAR_PREFIX}_WORKING_DIR}/${INPUT_NAME}-tmp_cpy.done
|
||||
COMMAND ${LEMON_EXECUTABLE} -T${LEMON_TEMPLATE} ${${LVAR_PREFIX}_WORKING_DIR}/${INPUT_NAME} ${${LVAR_PREFIX}__EXTRA_ARGS}
|
||||
DEPENDS ${Input} ${LEMON_EXECUTABLE_TARGET} ${DEPS_TARGET}
|
||||
WORKING_DIRECTORY ${${LVAR_PREFIX}_WORKING_DIR}
|
||||
COMMENT "[LEMON][${Name}] Building parser with ${LEMON_EXECUTABLE}"
|
||||
)
|
||||
|
||||
# rename generated outputs
|
||||
if(NOT "${${LVAR_PREFIX}_OUT_SRC_FILE}" STREQUAL "${LEMON_GEN_SOURCE}")
|
||||
add_custom_command(
|
||||
OUTPUT ${${LVAR_PREFIX}_OUT_SRC_FILE} ${${LVAR_PREFIX}_OUT_SRC_FILE}-src_cpy.done
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${LEMON_GEN_SOURCE} ${${LVAR_PREFIX}_OUT_SRC_FILE}
|
||||
COMMAND ${CMAKE_COMMAND} -E touch ${${LVAR_PREFIX}_OUT_SRC_FILE}-src_cpy.done
|
||||
DEPENDS ${LemonInput} ${LEMON_EXECUTABLE_TARGET} ${LEMON_GEN_SOURCE} ${DEPS_TARGET}
|
||||
)
|
||||
set(LEMON_${Name}_OUTPUTS ${${LVAR_PREFIX}_OUT_SRC_FILE} ${LEMON_${Name}_OUTPUTS} ${${LVAR_PREFIX}_OUT_SRC_FILE}-src_cpy.done)
|
||||
endif(NOT "${${LVAR_PREFIX}_OUT_SRC_FILE}" STREQUAL "${LEMON_GEN_SOURCE}")
|
||||
if(NOT "${${LVAR_PREFIX}_OUT_HDR_FILE}" STREQUAL "${LEMON_GEN_HEADER}")
|
||||
add_custom_command(
|
||||
OUTPUT ${${LVAR_PREFIX}_OUT_HDR_FILE} ${${LVAR_PREFIX}_OUT_HDR_FILE}-hdr_cpy.done
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${LEMON_GEN_HEADER} ${${LVAR_PREFIX}_OUT_HDR_FILE}
|
||||
COMMAND ${CMAKE_COMMAND} -E touch ${${LVAR_PREFIX}_OUT_HDR_FILE}-hdr_cpy.done
|
||||
DEPENDS ${LemonInput} ${LEMON_EXECUTABLE_TARGET} ${LEMON_GEN_HEADER} ${DEPS_TARGET}
|
||||
)
|
||||
set(LEMON_${Name}_OUTPUTS ${${LVAR_PREFIX}_OUT_HDR_FILE} ${LEMON_${Name}_OUTPUTS} ${${LVAR_PREFIX}_OUT_HDR_FILE}-hdr_cpy.done)
|
||||
endif(NOT "${${LVAR_PREFIX}_OUT_HDR_FILE}" STREQUAL "${LEMON_GEN_HEADER}")
|
||||
|
||||
set(LEMON_${Name}_OUTPUTS ${LEMON_${Name}_OUTPUTS} ${LEMON_GEN_OUT})
|
||||
|
||||
# make sure we clean up generated output and copied input
|
||||
set_property(DIRECTORY APPEND PROPERTY ADDITIONAL_MAKE_CLEAN_FILES "${LEMON_${Name}_OUTPUTS}")
|
||||
set_property(DIRECTORY APPEND PROPERTY ADDITIONAL_MAKE_CLEAN_FILES "${${LVAR_PREFIX}_WORKING_DIR}/${INPUT_NAME}")
|
||||
|
||||
# macro ran successfully
|
||||
set(LEMON_${Name}_DEFINED TRUE)
|
||||
|
||||
set(LEMON_${Name}_SRC ${${LVAR_PREFIX}_OUT_SRC_FILE})
|
||||
set(LEMON_${Name}_HDR ${${LVAR_PREFIX}_OUT_HDR_FILE})
|
||||
set(LEMON_${Name}_INCLUDE_DIR ${${LVAR_PREFIX}_WORKING_DIR})
|
||||
|
||||
endmacro(LEMON_TARGET)
|
||||
endif(NOT COMMAND LEMON_TARGET)
|
||||
|
||||
#============================================================
|
||||
# FindLEMON.cmake ends here
|
||||
|
||||
# Local Variables:
|
||||
# tab-width: 8
|
||||
# mode: cmake
|
||||
# indent-tabs-mode: t
|
||||
# End:
|
||||
# ex: shiftwidth=2 tabstop=8
|
||||
@@ -0,0 +1,80 @@
|
||||
#.rst:
|
||||
# FindLMDB
|
||||
# --------
|
||||
#
|
||||
# Find the native LMDB includes and library.
|
||||
#
|
||||
# IMPORTED Targets
|
||||
# ^^^^^^^^^^^^^^^^
|
||||
#
|
||||
# This module defines :prop_tgt:`IMPORTED` target ``LMDB::LMDB``, if
|
||||
# LMDB has been found.
|
||||
#
|
||||
# Result Variables
|
||||
# ^^^^^^^^^^^^^^^^
|
||||
#
|
||||
# This module defines the following variables:
|
||||
#
|
||||
# ::
|
||||
#
|
||||
# LMDB_INCLUDE_DIRS - where to find lmdb.h, etc.
|
||||
# LMDB_LIBRARIES - List of libraries when using lmdb.
|
||||
# LMDB_FOUND - True if lmdb found.
|
||||
#
|
||||
# Hints
|
||||
# ^^^^^
|
||||
#
|
||||
# A user may set ``LMDB_ROOT`` to a lmdb installation root to tell this
|
||||
# module where to look.
|
||||
|
||||
#=============================================================================
|
||||
# Copyright 2001-2011 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.)
|
||||
|
||||
set(_LMDB_SEARCHES)
|
||||
|
||||
# Search LMDB_ROOT first if it is set.
|
||||
if(LMDB_ROOT)
|
||||
set(_LMDB_SEARCH_ROOT PATHS ${LMDB_ROOT} NO_DEFAULT_PATH)
|
||||
list(APPEND _LMDB_SEARCHES _LMDB_SEARCH_ROOT)
|
||||
endif()
|
||||
|
||||
# Fall back to default system paths
|
||||
set(_LMDB_SEARCH_NORMAL)
|
||||
list(APPEND _LMDB_SEARCHES _LMDB_SEARCH_NORMAL)
|
||||
|
||||
set(LMDB_NAMES lmdb lmdbd)
|
||||
|
||||
# Try each search configuration.
|
||||
foreach(search ${_LMDB_SEARCHES})
|
||||
find_path(LMDB_INCLUDE_DIR NAMES lmdb.h ${${search}} PATH_SUFFIXES include include/lmdb)
|
||||
find_library(LMDB_LIBRARY NAMES ${LMDB_NAMES} ${${search}} PATH_SUFFIXES lib)
|
||||
endforeach()
|
||||
|
||||
mark_as_advanced(LMDB_LIBRARY LMDB_INCLUDE_DIR)
|
||||
|
||||
# handle the QUIETLY and REQUIRED arguments and set LMDB_FOUND to TRUE if
|
||||
# all listed variables are TRUE
|
||||
include(FindPackageHandleStandardArgs)
|
||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(LMDB REQUIRED_VARS LMDB_LIBRARY LMDB_INCLUDE_DIR)
|
||||
|
||||
if(LMDB_FOUND)
|
||||
set(LMDB_INCLUDE_DIRS ${LMDB_INCLUDE_DIR})
|
||||
set(LMDB_LIBRARIES ${LMDB_LIBRARY})
|
||||
|
||||
if(NOT TARGET LMDB::LMDB)
|
||||
add_library(LMDB::LMDB UNKNOWN IMPORTED)
|
||||
set_target_properties(LMDB::LMDB PROPERTIES
|
||||
IMPORTED_LOCATION "${LMDB_LIBRARY}"
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${LMDB_INCLUDE_DIRS}")
|
||||
endif()
|
||||
endif()
|
||||
@@ -0,0 +1,94 @@
|
||||
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
||||
# file Copyright.txt or https://cmake.org/licensing for details.
|
||||
|
||||
#[=======================================================================[.rst:
|
||||
FindMANIFOLD
|
||||
--------
|
||||
|
||||
Find the native MANIFOLD includes and library.
|
||||
|
||||
IMPORTED Targets
|
||||
^^^^^^^^^^^^^^^^
|
||||
|
||||
This module defines :prop_tgt:`IMPORTED` target ``MANIFOLD::MANIFOLD``, if
|
||||
MANIFOLD has been found.
|
||||
|
||||
Result Variables
|
||||
^^^^^^^^^^^^^^^^
|
||||
|
||||
This module defines the following variables:
|
||||
|
||||
::
|
||||
|
||||
MANIFOLD_INCLUDE_DIRS - where to find manifold/manifold.h, etc.
|
||||
MANIFOLD_LIBRARIES - List of libraries when using Manifold.
|
||||
MANIFOLD_FOUND - True if Manifold found.
|
||||
|
||||
Hints
|
||||
^^^^^
|
||||
|
||||
A user may set ``MANIFOLD_ROOT`` to a Manifold installation root to tell this
|
||||
module where to look.
|
||||
#]=======================================================================]
|
||||
|
||||
set(_MANIFOLD_SEARCHES)
|
||||
|
||||
# Search MANIFOLD_ROOT first if it is set.
|
||||
if(MANIFOLD_ROOT)
|
||||
set(_MANIFOLD_SEARCH_ROOT PATHS ${MANIFOLD_ROOT} NO_DEFAULT_PATH)
|
||||
list(APPEND _MANIFOLD_SEARCHES _MANIFOLD_SEARCH_ROOT)
|
||||
endif()
|
||||
|
||||
set(MANIFOLD_NAMES manifold)
|
||||
|
||||
# Try each search configuration.
|
||||
foreach(search ${_MANIFOLD_SEARCHES})
|
||||
find_path(MANIFOLD_INCLUDE_DIR NAMES manifold.h ${${search}} PATH_SUFFIXES include include/manifold)
|
||||
endforeach()
|
||||
|
||||
# Allow MANIFOLD_LIBRARY to be set manually, as the location of the Manifold library
|
||||
if(NOT MANIFOLD_LIBRARY)
|
||||
foreach(search ${_MANIFOLD_SEARCHES})
|
||||
find_library(MANIFOLD_LIBRARY NAMES ${MANIFOLD_NAMES} NAMES_PER_DIR ${${search}} PATH_SUFFIXES lib)
|
||||
endforeach()
|
||||
endif()
|
||||
|
||||
unset(MANIFOLD_NAMES)
|
||||
|
||||
mark_as_advanced(MANIFOLD_INCLUDE_DIR)
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(MANIFOLD REQUIRED_VARS MANIFOLD_LIBRARY MANIFOLD_INCLUDE_DIR)
|
||||
|
||||
if(MANIFOLD_FOUND)
|
||||
set(MANIFOLD_INCLUDE_DIRS ${MANIFOLD_INCLUDE_DIR})
|
||||
|
||||
if(NOT MANIFOLD_LIBRARIES)
|
||||
set(MANIFOLD_LIBRARIES ${MANIFOLD_LIBRARY})
|
||||
endif()
|
||||
|
||||
if(NOT TARGET MANIFOLD::MANIFOLD)
|
||||
add_library(MANIFOLD::MANIFOLD UNKNOWN IMPORTED)
|
||||
set_target_properties(MANIFOLD::MANIFOLD PROPERTIES
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${MANIFOLD_INCLUDE_DIRS}")
|
||||
|
||||
if(MANIFOLD_LIBRARY_RELEASE)
|
||||
set_property(TARGET MANIFOLD::MANIFOLD APPEND PROPERTY
|
||||
IMPORTED_CONFIGURATIONS RELEASE)
|
||||
set_target_properties(MANIFOLD::MANIFOLD PROPERTIES
|
||||
IMPORTED_LOCATION_RELEASE "${MANIFOLD_LIBRARY_RELEASE}")
|
||||
endif()
|
||||
|
||||
if(MANIFOLD_LIBRARY_DEBUG)
|
||||
set_property(TARGET MANIFOLD::MANIFOLD APPEND PROPERTY
|
||||
IMPORTED_CONFIGURATIONS DEBUG)
|
||||
set_target_properties(MANIFOLD::MANIFOLD PROPERTIES
|
||||
IMPORTED_LOCATION_DEBUG "${MANIFOLD_LIBRARY_DEBUG}")
|
||||
endif()
|
||||
|
||||
if(NOT MANIFOLD_LIBRARY_RELEASE AND NOT MANIFOLD_LIBRARY_DEBUG)
|
||||
set_property(TARGET MANIFOLD::MANIFOLD APPEND PROPERTY
|
||||
IMPORTED_LOCATION "${MANIFOLD_LIBRARY}")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
@@ -0,0 +1,94 @@
|
||||
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
||||
# file Copyright.txt or https://cmake.org/licensing for details.
|
||||
|
||||
#[=======================================================================[.rst:
|
||||
FindMMESH
|
||||
--------
|
||||
|
||||
Find the native MMESH includes and library.
|
||||
|
||||
IMPORTED Targets
|
||||
^^^^^^^^^^^^^^^^
|
||||
|
||||
This module defines :prop_tgt:`IMPORTED` target ``MMESH::MMESH``, if
|
||||
MMESH has been found.
|
||||
|
||||
Result Variables
|
||||
^^^^^^^^^^^^^^^^
|
||||
|
||||
This module defines the following variables:
|
||||
|
||||
::
|
||||
|
||||
MMESH_INCLUDE_DIRS - where to find mmesh.h, etc.
|
||||
MMESH_LIBRARIES - List of libraries when using openNURBS.
|
||||
MMESH_FOUND - True if openNURBS found.
|
||||
|
||||
Hints
|
||||
^^^^^
|
||||
|
||||
A user may set ``MMESH_ROOT`` to a openNURBS installation root to tell this
|
||||
module where to look.
|
||||
#]=======================================================================]
|
||||
|
||||
set(_MMESH_SEARCHES)
|
||||
|
||||
# Search MMESH_ROOT first if it is set.
|
||||
if(MMESH_ROOT)
|
||||
set(_MMESH_SEARCH_ROOT PATHS ${MMESH_ROOT} NO_DEFAULT_PATH)
|
||||
list(APPEND _MMESH_SEARCHES _MMESH_SEARCH_ROOT)
|
||||
endif()
|
||||
|
||||
set(MMESH_NAMES mmesh OSMesa)
|
||||
|
||||
# Try each search configuration.
|
||||
foreach(search ${_MMESH_SEARCHES})
|
||||
find_path(MMESH_INCLUDE_DIR NAMES meshdecimation.h ${${search}} PATH_SUFFIXES include/mmesh mmesh)
|
||||
endforeach()
|
||||
|
||||
# Allow MMESH_LIBRARY to be set manually, as the location of the openNURBS library
|
||||
if(NOT MMESH_LIBRARY)
|
||||
foreach(search ${_MMESH_SEARCHES})
|
||||
find_library(MMESH_LIBRARY NAMES ${MMESH_NAMES} NAMES_PER_DIR ${${search}} PATH_SUFFIXES lib)
|
||||
endforeach()
|
||||
endif()
|
||||
|
||||
unset(MMESH_NAMES)
|
||||
|
||||
mark_as_advanced(MMESH_INCLUDE_DIR)
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(MMESH REQUIRED_VARS MMESH_LIBRARY MMESH_INCLUDE_DIR)
|
||||
|
||||
if(MMESH_FOUND)
|
||||
set(MMESH_INCLUDE_DIRS ${MMESH_INCLUDE_DIR})
|
||||
|
||||
if(NOT MMESH_LIBRARIES)
|
||||
set(MMESH_LIBRARIES ${MMESH_LIBRARY})
|
||||
endif()
|
||||
|
||||
if(NOT TARGET MMESH::MMESH)
|
||||
add_library(MMESH::MMESH UNKNOWN IMPORTED)
|
||||
set_target_properties(MMESH::MMESH PROPERTIES
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${MMESH_INCLUDE_DIRS}")
|
||||
|
||||
if(MMESH_LIBRARY_RELEASE)
|
||||
set_property(TARGET MMESH::MMESH APPEND PROPERTY
|
||||
IMPORTED_CONFIGURATIONS RELEASE)
|
||||
set_target_properties(MMESH::MMESH PROPERTIES
|
||||
IMPORTED_LOCATION_RELEASE "${MMESH_LIBRARY_RELEASE}")
|
||||
endif()
|
||||
|
||||
if(MMESH_LIBRARY_DEBUG)
|
||||
set_property(TARGET MMESH::MMESH APPEND PROPERTY
|
||||
IMPORTED_CONFIGURATIONS DEBUG)
|
||||
set_target_properties(MMESH::MMESH PROPERTIES
|
||||
IMPORTED_LOCATION_DEBUG "${MMESH_LIBRARY_DEBUG}")
|
||||
endif()
|
||||
|
||||
if(NOT MMESH_LIBRARY_RELEASE AND NOT MMESH_LIBRARY_DEBUG)
|
||||
set_property(TARGET MMESH::MMESH APPEND PROPERTY
|
||||
IMPORTED_LOCATION "${MMESH_LIBRARY}")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
@@ -0,0 +1,102 @@
|
||||
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
||||
# file Copyright.txt or https://cmake.org/licensing for details.
|
||||
|
||||
#[=======================================================================[.rst:
|
||||
FindNETPBM
|
||||
--------
|
||||
|
||||
Find the native NETPBM includes and library.
|
||||
|
||||
IMPORTED Targets
|
||||
^^^^^^^^^^^^^^^^
|
||||
|
||||
This module defines :prop_tgt:`IMPORTED` target ``NETPBM::NETPBM``, if
|
||||
NETPBM has been found.
|
||||
|
||||
Result Variables
|
||||
^^^^^^^^^^^^^^^^
|
||||
|
||||
This module defines the following variables:
|
||||
|
||||
::
|
||||
|
||||
NETPBM_INCLUDE_DIRS - where to find pam.h, etc.
|
||||
NETPBM_LIBRARIES - List of libraries when using netpbm.
|
||||
NETPBM_FOUND - True if netpbm found.
|
||||
|
||||
Hints
|
||||
^^^^^
|
||||
|
||||
A user may set ``NETPBM_ROOT`` to a netpbm installation root to tell this
|
||||
module where to look.
|
||||
#]=======================================================================]
|
||||
|
||||
set(_NETPBM_SEARCHES)
|
||||
|
||||
# Search NETPBM_ROOT first if it is set.
|
||||
if(NETPBM_ROOT)
|
||||
set(_NETPBM_SEARCH_ROOT PATHS ${NETPBM_ROOT} NO_DEFAULT_PATH)
|
||||
list(APPEND _NETPBM_SEARCHES _NETPBM_SEARCH_ROOT)
|
||||
endif()
|
||||
|
||||
# Normal search.
|
||||
set(_NETPBM_x86 "(x86)")
|
||||
set(_NETPBM_SEARCH_NORMAL
|
||||
PATHS "$ENV{ProgramFiles}/netpbm"
|
||||
"$ENV{ProgramFiles${_NETPBM_x86}}/netpbm")
|
||||
unset(_NETPBM_x86)
|
||||
list(APPEND _NETPBM_SEARCHES _NETPBM_SEARCH_NORMAL)
|
||||
|
||||
set(NETPBM_NAMES netpbm)
|
||||
|
||||
# Try each search configuration.
|
||||
foreach(search ${_NETPBM_SEARCHES})
|
||||
find_path(NETPBM_INCLUDE_DIR NAMES pam.h ${${search}} PATH_SUFFIXES include include/netpbm netpbm)
|
||||
endforeach()
|
||||
|
||||
# Allow NETPBM_LIBRARY to be set manually, as the location of the netpbm library
|
||||
if(NOT NETPBM_LIBRARY)
|
||||
foreach(search ${_NETPBM_SEARCHES})
|
||||
find_library(NETPBM_LIBRARY NAMES ${NETPBM_NAMES} NAMES_PER_DIR ${${search}} PATH_SUFFIXES lib)
|
||||
endforeach()
|
||||
endif()
|
||||
|
||||
unset(NETPBM_NAMES)
|
||||
|
||||
mark_as_advanced(NETPBM_INCLUDE_DIR)
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(NETPBM REQUIRED_VARS NETPBM_LIBRARY NETPBM_INCLUDE_DIR)
|
||||
|
||||
if(NETPBM_FOUND)
|
||||
set(NETPBM_INCLUDE_DIRS ${NETPBM_INCLUDE_DIR})
|
||||
|
||||
if(NOT NETPBM_LIBRARIES)
|
||||
set(NETPBM_LIBRARIES ${NETPBM_LIBRARY})
|
||||
endif()
|
||||
|
||||
if(NOT TARGET NETPBM::NETPBM)
|
||||
add_library(NETPBM::NETPBM UNKNOWN IMPORTED)
|
||||
set_target_properties(NETPBM::NETPBM PROPERTIES
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${NETPBM_INCLUDE_DIRS}")
|
||||
|
||||
if(NETPBM_LIBRARY_RELEASE)
|
||||
set_property(TARGET NETPBM::NETPBM APPEND PROPERTY
|
||||
IMPORTED_CONFIGURATIONS RELEASE)
|
||||
set_target_properties(NETPBM::NETPBM PROPERTIES
|
||||
IMPORTED_LOCATION_RELEASE "${NETPBM_LIBRARY_RELEASE}")
|
||||
endif()
|
||||
|
||||
if(NETPBM_LIBRARY_DEBUG)
|
||||
set_property(TARGET NETPBM::NETPBM APPEND PROPERTY
|
||||
IMPORTED_CONFIGURATIONS DEBUG)
|
||||
set_target_properties(NETPBM::NETPBM PROPERTIES
|
||||
IMPORTED_LOCATION_DEBUG "${NETPBM_LIBRARY_DEBUG}")
|
||||
endif()
|
||||
|
||||
if(NOT NETPBM_LIBRARY_RELEASE AND NOT NETPBM_LIBRARY_DEBUG)
|
||||
set_property(TARGET NETPBM::NETPBM APPEND PROPERTY
|
||||
IMPORTED_LOCATION "${NETPBM_LIBRARY}")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
@@ -0,0 +1,103 @@
|
||||
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
||||
# file Copyright.txt or https://cmake.org/licensing for details.
|
||||
|
||||
#[=======================================================================[.rst:
|
||||
FindOPENNURBS
|
||||
--------
|
||||
|
||||
Find the native OPENNURBS includes and library.
|
||||
|
||||
IMPORTED Targets
|
||||
^^^^^^^^^^^^^^^^
|
||||
|
||||
This module defines :prop_tgt:`IMPORTED` target ``OPENNURBS::OPENNURBS``, if
|
||||
OPENNURBS has been found.
|
||||
|
||||
Result Variables
|
||||
^^^^^^^^^^^^^^^^
|
||||
|
||||
This module defines the following variables:
|
||||
|
||||
::
|
||||
|
||||
OPENNURBS_INCLUDE_DIRS - where to find opennurbs.h, etc.
|
||||
OPENNURBS_LIBRARIES - List of libraries when using openNURBS.
|
||||
OPENNURBS_FOUND - True if openNURBS found.
|
||||
|
||||
Hints
|
||||
^^^^^
|
||||
|
||||
A user may set ``OPENNURBS_ROOT`` to a openNURBS installation root to tell this
|
||||
module where to look.
|
||||
#]=======================================================================]
|
||||
|
||||
set(_OPENNURBS_SEARCHES)
|
||||
|
||||
# Search OPENNURBS_ROOT first if it is set.
|
||||
if(OPENNURBS_ROOT)
|
||||
set(_OPENNURBS_SEARCH_ROOT PATHS ${OPENNURBS_ROOT} NO_DEFAULT_PATH)
|
||||
list(APPEND _OPENNURBS_SEARCHES _OPENNURBS_SEARCH_ROOT)
|
||||
endif()
|
||||
|
||||
# Normal search.
|
||||
set(_OPENNURBS_x86 "(x86)")
|
||||
set(_OPENNURBS_SEARCH_NORMAL
|
||||
PATHS "$ENV{ProgramFiles}/openNURBS"
|
||||
"$ENV{ProgramFiles${_OPENNURBS_x86}}/openNURBS")
|
||||
unset(_OPENNURBS_x86)
|
||||
list(APPEND _OPENNURBS_SEARCHES _OPENNURBS_SEARCH_NORMAL)
|
||||
|
||||
set(OPENNURBS_NAMES openNURBS OpenNURBS)
|
||||
|
||||
# Try each search configuration.
|
||||
foreach(search ${_OPENNURBS_SEARCHES})
|
||||
find_path(OPENNURBS_INCLUDE_DIR NAMES opennurbs.h ${${search}} PATH_SUFFIXES include include/openNURBS openNURBS include/OpenNURBS OpenNURBS)
|
||||
find_path(OPENNURBS_X_INCLUDE_DIR NAMES opennurbs_x.h ${${search}} PATH_SUFFIXES include include/openNURBS openNURBS include/OpenNURBS OpenNURBS)
|
||||
endforeach()
|
||||
|
||||
# Allow OPENNURBS_LIBRARY to be set manually, as the location of the openNURBS library
|
||||
if(NOT OPENNURBS_LIBRARY)
|
||||
foreach(search ${_OPENNURBS_SEARCHES})
|
||||
find_library(OPENNURBS_LIBRARY NAMES ${OPENNURBS_NAMES} NAMES_PER_DIR ${${search}} PATH_SUFFIXES lib)
|
||||
endforeach()
|
||||
endif()
|
||||
|
||||
unset(OPENNURBS_NAMES)
|
||||
|
||||
mark_as_advanced(OPENNURBS_INCLUDE_DIR)
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(OPENNURBS REQUIRED_VARS OPENNURBS_LIBRARY OPENNURBS_INCLUDE_DIR OPENNURBS_X_INCLUDE_DIR)
|
||||
|
||||
if(OPENNURBS_FOUND)
|
||||
set(OPENNURBS_INCLUDE_DIRS ${OPENNURBS_INCLUDE_DIR})
|
||||
|
||||
if(NOT OPENNURBS_LIBRARIES)
|
||||
set(OPENNURBS_LIBRARIES ${OPENNURBS_LIBRARY})
|
||||
endif()
|
||||
|
||||
if(NOT TARGET OPENNURBS::OPENNURBS)
|
||||
add_library(OPENNURBS::OPENNURBS UNKNOWN IMPORTED)
|
||||
set_target_properties(OPENNURBS::OPENNURBS PROPERTIES
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${OPENNURBS_INCLUDE_DIRS}")
|
||||
|
||||
if(OPENNURBS_LIBRARY_RELEASE)
|
||||
set_property(TARGET OPENNURBS::OPENNURBS APPEND PROPERTY
|
||||
IMPORTED_CONFIGURATIONS RELEASE)
|
||||
set_target_properties(OPENNURBS::OPENNURBS PROPERTIES
|
||||
IMPORTED_LOCATION_RELEASE "${OPENNURBS_LIBRARY_RELEASE}")
|
||||
endif()
|
||||
|
||||
if(OPENNURBS_LIBRARY_DEBUG)
|
||||
set_property(TARGET OPENNURBS::OPENNURBS APPEND PROPERTY
|
||||
IMPORTED_CONFIGURATIONS DEBUG)
|
||||
set_target_properties(OPENNURBS::OPENNURBS PROPERTIES
|
||||
IMPORTED_LOCATION_DEBUG "${OPENNURBS_LIBRARY_DEBUG}")
|
||||
endif()
|
||||
|
||||
if(NOT OPENNURBS_LIBRARY_RELEASE AND NOT OPENNURBS_LIBRARY_DEBUG)
|
||||
set_property(TARGET OPENNURBS::OPENNURBS APPEND PROPERTY
|
||||
IMPORTED_LOCATION "${OPENNURBS_LIBRARY}")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
@@ -0,0 +1,94 @@
|
||||
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
||||
# file Copyright.txt or https://cmake.org/licensing for details.
|
||||
|
||||
#[=======================================================================[.rst:
|
||||
FindOSMESA
|
||||
--------
|
||||
|
||||
Find the native OSMESA includes and library.
|
||||
|
||||
IMPORTED Targets
|
||||
^^^^^^^^^^^^^^^^
|
||||
|
||||
This module defines :prop_tgt:`IMPORTED` target ``OSMESA::OSMESA``, if
|
||||
OSMESA has been found.
|
||||
|
||||
Result Variables
|
||||
^^^^^^^^^^^^^^^^
|
||||
|
||||
This module defines the following variables:
|
||||
|
||||
::
|
||||
|
||||
OSMESA_INCLUDE_DIRS - where to find osmesa.h, etc.
|
||||
OSMESA_LIBRARIES - List of libraries when using openNURBS.
|
||||
OSMESA_FOUND - True if openNURBS found.
|
||||
|
||||
Hints
|
||||
^^^^^
|
||||
|
||||
A user may set ``OSMESA_ROOT`` to a openNURBS installation root to tell this
|
||||
module where to look.
|
||||
#]=======================================================================]
|
||||
|
||||
set(_OSMESA_SEARCHES)
|
||||
|
||||
# Search OSMESA_ROOT first if it is set.
|
||||
if(OSMESA_ROOT)
|
||||
set(_OSMESA_SEARCH_ROOT PATHS ${OSMESA_ROOT} NO_DEFAULT_PATH)
|
||||
list(APPEND _OSMESA_SEARCHES _OSMESA_SEARCH_ROOT)
|
||||
endif()
|
||||
|
||||
set(OSMESA_NAMES osmesa OSMesa)
|
||||
|
||||
# Try each search configuration.
|
||||
foreach(search ${_OSMESA_SEARCHES})
|
||||
find_path(OSMESA_INCLUDE_DIR NAMES osmesa.h ${${search}} PATH_SUFFIXES include include/OSMesa OSMesa)
|
||||
endforeach()
|
||||
|
||||
# Allow OSMESA_LIBRARY to be set manually, as the location of the openNURBS library
|
||||
if(NOT OSMESA_LIBRARY)
|
||||
foreach(search ${_OSMESA_SEARCHES})
|
||||
find_library(OSMESA_LIBRARY NAMES ${OSMESA_NAMES} NAMES_PER_DIR ${${search}} PATH_SUFFIXES lib)
|
||||
endforeach()
|
||||
endif()
|
||||
|
||||
unset(OSMESA_NAMES)
|
||||
|
||||
mark_as_advanced(OSMESA_INCLUDE_DIR)
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(OSMESA REQUIRED_VARS OSMESA_LIBRARY OSMESA_INCLUDE_DIR)
|
||||
|
||||
if(OSMESA_FOUND)
|
||||
set(OSMESA_INCLUDE_DIRS ${OSMESA_INCLUDE_DIR})
|
||||
|
||||
if(NOT OSMESA_LIBRARIES)
|
||||
set(OSMESA_LIBRARIES ${OSMESA_LIBRARY})
|
||||
endif()
|
||||
|
||||
if(NOT TARGET OSMESA::OSMESA)
|
||||
add_library(OSMESA::OSMESA UNKNOWN IMPORTED)
|
||||
set_target_properties(OSMESA::OSMESA PROPERTIES
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${OSMESA_INCLUDE_DIRS}")
|
||||
|
||||
if(OSMESA_LIBRARY_RELEASE)
|
||||
set_property(TARGET OSMESA::OSMESA APPEND PROPERTY
|
||||
IMPORTED_CONFIGURATIONS RELEASE)
|
||||
set_target_properties(OSMESA::OSMESA PROPERTIES
|
||||
IMPORTED_LOCATION_RELEASE "${OSMESA_LIBRARY_RELEASE}")
|
||||
endif()
|
||||
|
||||
if(OSMESA_LIBRARY_DEBUG)
|
||||
set_property(TARGET OSMESA::OSMESA APPEND PROPERTY
|
||||
IMPORTED_CONFIGURATIONS DEBUG)
|
||||
set_target_properties(OSMESA::OSMESA PROPERTIES
|
||||
IMPORTED_LOCATION_DEBUG "${OSMESA_LIBRARY_DEBUG}")
|
||||
endif()
|
||||
|
||||
if(NOT OSMESA_LIBRARY_RELEASE AND NOT OSMESA_LIBRARY_DEBUG)
|
||||
set_property(TARGET OSMESA::OSMESA APPEND PROPERTY
|
||||
IMPORTED_LOCATION "${OSMESA_LIBRARY}")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
@@ -0,0 +1,292 @@
|
||||
#
|
||||
# - Find perplex executable and provides macros to generate custom build rules
|
||||
# The module defines the following variables
|
||||
#
|
||||
# PERPLEX_EXECUTABLE - path to the perplex program
|
||||
# PERPLEX_TEMPLATE - location of the perplex template file
|
||||
|
||||
#=============================================================================
|
||||
# F I N D P E R P L E X . C M A K E
|
||||
#
|
||||
# Originally based off of FindBISON.cmake from Kitware's CMake distribution
|
||||
#
|
||||
# Copyright (c) 2010-2023 United States Government as represented by
|
||||
# the U.S. Army Research Laboratory.
|
||||
# Copyright 2009 Kitware, Inc.
|
||||
# Copyright 2006 Tristan Carel
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
#
|
||||
# * Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
#
|
||||
# * Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
#
|
||||
# * The names of the authors may not be used to endorse or promote
|
||||
# products derived from this software without specific prior written
|
||||
# permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
# HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 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.
|
||||
#=============================================================================
|
||||
|
||||
set(_PERPLEX_SEARCHES)
|
||||
|
||||
# Search PERPLEX_ROOT first if it is set.
|
||||
if(PERPLEX_ROOT)
|
||||
set(_PERPLEX_SEARCH_ROOT PATHS ${PERPLEX_ROOT} NO_DEFAULT_PATH)
|
||||
list(APPEND _PERPLEX_SEARCHES _PERPLEX_SEARCH_ROOT)
|
||||
endif()
|
||||
|
||||
# Normal search.
|
||||
set(_PERPLEX_x86 "(x86)")
|
||||
set(_PERPLEX_SEARCH_NORMAL
|
||||
PATHS "$ENV{ProgramFiles}/perplex"
|
||||
"$ENV{ProgramFiles${_PERPLEX_x86}}/perplex")
|
||||
unset(_PERPLEX_x86)
|
||||
list(APPEND _PERPLEX_SEARCHES _PERPLEX_SEARCH_NORMAL)
|
||||
|
||||
set(PERPLEX_NAMES perplex)
|
||||
|
||||
# Try each search configuration.
|
||||
foreach(search ${_PERPLEX_SEARCHES})
|
||||
find_program(PERPLEX_EXECUTABLE perplex ${${search}} PATH_SUFFIXES bin)
|
||||
endforeach()
|
||||
mark_as_advanced(PERPLEX_EXECUTABLE)
|
||||
|
||||
foreach(search ${_PERPLEX_SEARCHES})
|
||||
find_file(PERPLEX_TEMPLATE perplex_template.c ${${search}} PATH_SUFFIXES ${DATA_DIR} ${DATA_DIR}/perplex)
|
||||
endforeach()
|
||||
mark_as_advanced(PERPLEX_TEMPLATE)
|
||||
|
||||
if(PERPLEX_EXECUTABLE AND NOT PERPLEX_TEMPLATE)
|
||||
get_filename_component(perplex_path ${PERPLEX_EXECUTABLE} DIRECTORY)
|
||||
if(perplex_path)
|
||||
set(PERPLEX_TEMPLATE "")
|
||||
if(EXISTS ${perplex_path}/../share/perplex/perplex_template.c)
|
||||
get_filename_component(perplex_template_path "${perplex_path}/../share/perplex/perplex_template.c" ABSOLUTE)
|
||||
set(PERPLEX_TEMPLATE "${perplex_template_path}")
|
||||
endif(EXISTS ${perplex_path}/../share/perplex/perplex_template.c)
|
||||
if(EXISTS ${perplex_path}/../share/perplex_template.c AND NOT PERPLEX_TEMPLATE)
|
||||
get_filename_component(perplex_template_path "${perplex_path}/../share/perplex_template.c" ABSOLUTE)
|
||||
set(PERPLEX_TEMPLATE "${perplex_template_path}")
|
||||
endif(EXISTS ${perplex_path}/../share/perplex_template.c AND NOT PERPLEX_TEMPLATE)
|
||||
endif(perplex_path)
|
||||
if(EXISTS /usr/share/perplex/perplex_template.c AND NOT PERPLEX_TEMPLATE)
|
||||
set(PERPLEX_TEMPLATE "/usr/share/perplex/perplex_template.c")
|
||||
endif(EXISTS /usr/share/perplex/perplex_template.c AND NOT PERPLEX_TEMPLATE)
|
||||
endif(PERPLEX_EXECUTABLE AND NOT PERPLEX_TEMPLATE)
|
||||
include(FindPackageHandleStandardArgs)
|
||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(PERPLEX DEFAULT_MSG PERPLEX_EXECUTABLE PERPLEX_TEMPLATE)
|
||||
mark_as_advanced(PERPLEX_TEMPLATE)
|
||||
|
||||
# Defines two macros - PERPLEX_TARGET, which takes perplex inputs and
|
||||
# runs both perplex and re2c to generate C source code/headers, and
|
||||
# ADD_PERPLEX_LEMON_DEPENDENCY which is used to set up dependencies between
|
||||
# scanner and parser targets when necessary.
|
||||
#
|
||||
# #====================================================================
|
||||
# Example:
|
||||
#
|
||||
# find_package(LEMON)
|
||||
# find_package(RE2C)
|
||||
# find_package(PERPLEX)
|
||||
#
|
||||
# LEMON_TARGET(MyParser parser.y "${CMAKE_CURRENT_BINARY_DIR}/parser.cpp")
|
||||
# PERPLEX_TARGET(MyScanner scanner.re "${CMAKE_CURRENT_BINARY_DIR}/scanner.cpp" "${CMAKE_CURRENT_BINARY_DIR}/scanner_header.hpp")
|
||||
# ADD_PERPLEX_LEMON_DEPENDENCY(MyScanner MyParser)
|
||||
#
|
||||
# include_directories("${CMAKE_CURRENT_BINARY_DIR}")
|
||||
# add_executable(Foo
|
||||
# Foo.cc
|
||||
# ${LEMON_MyParser_OUTPUTS}
|
||||
# ${PERPLEX_MyScanner_OUTPUTS}
|
||||
# )
|
||||
# ====================================================================
|
||||
#
|
||||
#=============================================================================
|
||||
#
|
||||
# Originally based off of FindBISON.cmake from Kitware's CMake distribution
|
||||
#
|
||||
# Copyright (c) 2010-2023 United States Government as represented by
|
||||
# the U.S. Army Research Laboratory.
|
||||
# Copyright 2009 Kitware, Inc.
|
||||
# Copyright 2006 Tristan Carel
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
#
|
||||
# * Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
#
|
||||
# * Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
#
|
||||
# * The names of the authors may not be used to endorse or promote
|
||||
# products derived from this software without specific prior written
|
||||
# permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
# HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 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.
|
||||
#=============================================================================
|
||||
|
||||
#============================================================
|
||||
# PERPLEX_TARGET (public macro)
|
||||
#============================================================
|
||||
|
||||
include(CMakeParseArguments)
|
||||
|
||||
if(NOT COMMAND PERPLEX_TARGET)
|
||||
macro(PERPLEX_TARGET Name Input)
|
||||
get_filename_component(IN_FILE_WE ${Input} NAME_WE)
|
||||
set(PVAR_PREFIX ${Name}_${IN_FILE_WE})
|
||||
|
||||
if (TARGET perplex_stage)
|
||||
set(DEP_TARGET perplex_stage)
|
||||
endif (TARGET perplex_stage)
|
||||
|
||||
if(${ARGC} GREATER 3)
|
||||
CMAKE_PARSE_ARGUMENTS(${PVAR_PREFIX} "" "TEMPLATE;OUT_SRC_FILE;OUT_HDR_FILE;WORKING_DIR" "" ${ARGN})
|
||||
endif(${ARGC} GREATER 3)
|
||||
|
||||
# Need a working directory
|
||||
if("${${PVAR_PREFIX}_WORKING_DIR}" STREQUAL "")
|
||||
set(${PVAR_PREFIX}_WORKING_DIR "${CMAKE_CURRENT_BINARY_DIR}/${PVAR_PREFIX}")
|
||||
endif("${${PVAR_PREFIX}_WORKING_DIR}" STREQUAL "")
|
||||
file(MAKE_DIRECTORY ${${PVAR_PREFIX}_WORKING_DIR})
|
||||
|
||||
# Set up intermediate and final output names
|
||||
|
||||
# Output source file
|
||||
if ("${${PVAR_PREFIX}_OUT_SRC_FILE}" STREQUAL "")
|
||||
set(${PVAR_PREFIX}_OUT_SRC_FILE ${${PVAR_PREFIX}_WORKING_DIR}/${IN_FILE_WE}.c)
|
||||
else ("${${PVAR_PREFIX}_OUT_SRC_FILE}" STREQUAL "")
|
||||
get_filename_component(specified_out_dir ${${PVAR_PREFIX}_OUT_SRC_FILE} DIRECTORY)
|
||||
if(NOT "${specified_out_dir}" STREQUAL "")
|
||||
message(FATAL_ERROR "\nFull path specified for OUT_SRC_FILE - should be filename only.\n")
|
||||
endif(NOT "${specified_out_dir}" STREQUAL "")
|
||||
set(${PVAR_PREFIX}_OUT_SRC_FILE ${${PVAR_PREFIX}_WORKING_DIR}/${${PVAR_PREFIX}_OUT_SRC_FILE})
|
||||
endif ("${${PVAR_PREFIX}_OUT_SRC_FILE}" STREQUAL "")
|
||||
|
||||
# Output header file
|
||||
if ("${${PVAR_PREFIX}_OUT_HDR_FILE}" STREQUAL "")
|
||||
set(${PVAR_PREFIX}_OUT_HDR_FILE ${${PVAR_PREFIX}_WORKING_DIR}/${IN_FILE_WE}.h)
|
||||
else ("${${PVAR_PREFIX}_OUT_HDR_FILE}" STREQUAL "")
|
||||
get_filename_component(specified_out_dir ${${PVAR_PREFIX}_OUT_HDR_FILE} DIRECTORY)
|
||||
if(NOT "${specified_out_dir}" STREQUAL "")
|
||||
message(FATAL_ERROR "\nFull path specified for OUT_HDR_FILE - should be filename only.\n")
|
||||
endif(NOT "${specified_out_dir}" STREQUAL "")
|
||||
set(${PVAR_PREFIX}_OUT_HDR_FILE ${${PVAR_PREFIX}_WORKING_DIR}/${${PVAR_PREFIX}_OUT_HDR_FILE})
|
||||
endif ("${${PVAR_PREFIX}_OUT_HDR_FILE}" STREQUAL "")
|
||||
|
||||
# input file
|
||||
get_filename_component(in_full ${Input} ABSOLUTE)
|
||||
if("${in_full}" STREQUAL "${Input}")
|
||||
set(perplex_in_file ${Input})
|
||||
else("${in_full}" STREQUAL "${Input}")
|
||||
set(perplex_in_file "${CMAKE_CURRENT_SOURCE_DIR}/${Input}")
|
||||
endif("${in_full}" STREQUAL "${Input}")
|
||||
|
||||
# Intermediate file
|
||||
set(re2c_src "${${PVAR_PREFIX}_WORKING_DIR}/${IN_FILE_WE}.re")
|
||||
|
||||
# Make sure we have a template
|
||||
if ("${${PVAR_PREFIX}_TEMPLATE}" STREQUAL "")
|
||||
if(PERPLEX_TEMPLATE)
|
||||
set(${PVAR_PREFIX}_TEMPLATE ${PERPLEX_TEMPLATE})
|
||||
else(PERPLEX_TEMPLATE)
|
||||
message(FATAL_ERROR "\nNo Perplex template file specified - please specify the file using the PERPLEX_TEMPLATE variable:\ncmake .. -DPERPLEX_TEMPLATE=/path/to/template_file.c\n")
|
||||
endif(PERPLEX_TEMPLATE)
|
||||
endif ("${${PVAR_PREFIX}_TEMPLATE}" STREQUAL "")
|
||||
|
||||
get_filename_component(IN_FILE ${Input} NAME)
|
||||
add_custom_command(
|
||||
OUTPUT ${re2c_src} ${${PVAR_PREFIX}_OUT_HDR_FILE} ${${PVAR_PREFIX}_WORKING_DIR}/${IN_FILE}
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${perplex_in_file} ${${PVAR_PREFIX}_WORKING_DIR}/${IN_FILE}
|
||||
COMMAND ${CMAKE_COMMAND} -E touch ${${PVAR_PREFIX}_WORKING_DIR}/${IN_FILE}_cpy.done
|
||||
COMMAND ${CMAKE_COMMAND} -E remove ${${PVAR_PREFIX}_WORKING_DIR}/${IN_FILE}_cpy.done
|
||||
COMMAND ${PERPLEX_EXECUTABLE} -c -o ${re2c_src} -i ${${PVAR_PREFIX}_OUT_HDR_FILE} -t ${${PVAR_PREFIX}_TEMPLATE} ${${PVAR_PREFIX}_WORKING_DIR}/${IN_FILE}
|
||||
DEPENDS ${Input} ${PERPLEX_EXECUTABLE_TARGET} ${RE2C_EXECUTABLE_TARGET} ${DEP_TARGET}
|
||||
WORKING_DIRECTORY ${${PVAR_PREFIX}_WORKING_DIR}
|
||||
COMMENT "[PERPLEX][${Name}] Generating re2c input with ${PERPLEX_EXECUTABLE}"
|
||||
)
|
||||
|
||||
if(NOT DEBUGGING_GENERATED_SOURCES)
|
||||
add_custom_command(
|
||||
OUTPUT ${${PVAR_PREFIX}_OUT_SRC_FILE}
|
||||
COMMAND ${RE2C_EXECUTABLE} --no-debug-info --no-generation-date -c -o ${${PVAR_PREFIX}_OUT_SRC_FILE} ${re2c_src}
|
||||
DEPENDS ${Input} ${re2c_src} ${${PVAR_PREFIX}_OUT_HDR_FILE} ${PERPLEX_EXECUTABLE_TARGET} ${RE2C_EXECUTABLE_TARGET} ${DEP_TARGET}
|
||||
WORKING_DIRECTORY ${${PVAR_PREFIX}_WORKING_DIR}
|
||||
COMMENT "[RE2C][${Name}] Building scanner with ${RE2C_EXECUTABLE}"
|
||||
)
|
||||
else(NOT DEBUGGING_GENERATED_SOURCES)
|
||||
add_custom_command(
|
||||
OUTPUT ${${PVAR_PREFIX}_OUT_SRC_FILE}
|
||||
COMMAND ${RE2C_EXECUTABLE} --no-generation-date -c -o ${${PVAR_PREFIX}_OUT_SRC_FILE} ${re2c_src}
|
||||
DEPENDS ${Input} ${re2c_src} ${${PVAR_PREFIX}_OUT_HDR_FILE} ${PERPLEX_EXECUTABLE_TARGET} ${RE2C_EXECUTABLE_TARGET} ${DEP_TARGET}
|
||||
WORKING_DIRECTORY ${${PVAR_PREFIX}_WORKING_DIR}
|
||||
COMMENT "[RE2C][${Name}] Building scanner with ${RE2C_EXECUTABLE}"
|
||||
)
|
||||
endif(NOT DEBUGGING_GENERATED_SOURCES)
|
||||
|
||||
set(PERPLEX_${Name}_DEFINED TRUE)
|
||||
set(PERPLEX_${Name}_SRC ${${PVAR_PREFIX}_OUT_SRC_FILE})
|
||||
set(PERPLEX_${Name}_HDR ${${PVAR_PREFIX}_OUT_HDR_FILE})
|
||||
set(PERPLEX_${Name}_INCLUDE_DIR ${${PVAR_PREFIX}_WORKING_DIR})
|
||||
endmacro(PERPLEX_TARGET)
|
||||
endif(NOT COMMAND PERPLEX_TARGET)
|
||||
|
||||
#============================================================
|
||||
# ADD_PERPLEX_LEMON_DEPENDENCY (public macro)
|
||||
#============================================================
|
||||
if(NOT COMMAND ADD_PERPLEX_LEMON_DEPENDENCY)
|
||||
macro(ADD_PERPLEX_LEMON_DEPENDENCY PERPLEXTarget LemonTarget)
|
||||
|
||||
if(NOT PERPLEX_${PERPLEXTarget}_SRC)
|
||||
message(SEND_ERROR "PERPLEX target `${PERPLEXTarget}' does not exists.")
|
||||
endif()
|
||||
|
||||
if(NOT LEMON_${LemonTarget}_HDR)
|
||||
message(SEND_ERROR "Lemon target `${LemonTarget}' does not exists.")
|
||||
endif()
|
||||
|
||||
set_source_files_properties(${PERPLEX_${PERPLEXTarget}_SRC}
|
||||
PROPERTIES OBJECT_DEPENDS ${LEMON_${LemonTarget}_HDR})
|
||||
endmacro(ADD_PERPLEX_LEMON_DEPENDENCY)
|
||||
endif(NOT COMMAND ADD_PERPLEX_LEMON_DEPENDENCY)
|
||||
|
||||
#============================================================
|
||||
# FindPERPLEX.cmake ends here
|
||||
|
||||
# Local Variables:
|
||||
# tab-width: 8
|
||||
# mode: cmake
|
||||
# indent-tabs-mode: t
|
||||
# End:
|
||||
# ex: shiftwidth=2 tabstop=8
|
||||
@@ -0,0 +1,199 @@
|
||||
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
||||
# file Copyright.txt or https://cmake.org/licensing for details.
|
||||
|
||||
#[=======================================================================[.rst:
|
||||
FindPNG
|
||||
-------
|
||||
|
||||
Find libpng, the official reference library for the PNG image format.
|
||||
|
||||
Imported targets
|
||||
^^^^^^^^^^^^^^^^
|
||||
|
||||
.. versionadded:: 3.5
|
||||
|
||||
This module defines the following :prop_tgt:`IMPORTED` target:
|
||||
|
||||
``PNG::PNG``
|
||||
The libpng library, if found.
|
||||
|
||||
Result variables
|
||||
^^^^^^^^^^^^^^^^
|
||||
|
||||
This module will set the following variables in your project:
|
||||
|
||||
``PNG_INCLUDE_DIRS``
|
||||
where to find png.h, etc.
|
||||
``PNG_LIBRARIES``
|
||||
the libraries to link against to use PNG.
|
||||
``PNG_DEFINITIONS``
|
||||
You should add_definitions(${PNG_DEFINITIONS}) before compiling code
|
||||
that includes png library files.
|
||||
``PNG_FOUND``
|
||||
If false, do not try to use PNG.
|
||||
``PNG_VERSION_STRING``
|
||||
the version of the PNG library found (since CMake 2.8.8)
|
||||
|
||||
Obsolete variables
|
||||
^^^^^^^^^^^^^^^^^^
|
||||
|
||||
The following variables may also be set, for backwards compatibility:
|
||||
|
||||
``PNG_LIBRARY``
|
||||
where to find the PNG library.
|
||||
``PNG_INCLUDE_DIR``
|
||||
where to find the PNG headers (same as PNG_INCLUDE_DIRS)
|
||||
|
||||
Since PNG depends on the ZLib compression library, none of the above
|
||||
will be defined unless ZLib can be found.
|
||||
#]=======================================================================]
|
||||
|
||||
if(PNG_FIND_QUIETLY)
|
||||
set(_FIND_ZLIB_ARG QUIET)
|
||||
endif()
|
||||
find_package(ZLIB ${_FIND_ZLIB_ARG})
|
||||
|
||||
if(ZLIB_FOUND)
|
||||
set(_PNG_SEARCHES)
|
||||
if(APPLE)
|
||||
set(_PNG_CMAKE_FIND_FRAMEWORK "${CMAKE_FIND_FRAMEWORK}")
|
||||
set(CMAKE_FIND_FRAMEWORK LAST)
|
||||
endif()
|
||||
|
||||
# Search PNG_ROOT first if it is set.
|
||||
if(PNG_ROOT)
|
||||
set(_PNG_SEARCH_ROOT PATHS ${PNG_ROOT} NO_DEFAULT_PATH)
|
||||
list(APPEND _PNG_SEARCHES _PNG_SEARCH_ROOT)
|
||||
endif()
|
||||
|
||||
list(APPEND PNG_NAMES png_brl libpng_brl png libpng)
|
||||
unset(PNG_NAMES_DEBUG)
|
||||
set(_PNG_VERSION_SUFFIXES 17 16 15 14 12)
|
||||
if (PNG_FIND_VERSION MATCHES "^([0-9]+)\\.([0-9]+)(\\..*)?$")
|
||||
set(_PNG_VERSION_SUFFIX_MIN "${CMAKE_MATCH_1}${CMAKE_MATCH_2}")
|
||||
if (PNG_FIND_VERSION_EXACT)
|
||||
set(_PNG_VERSION_SUFFIXES ${_PNG_VERSION_SUFFIX_MIN})
|
||||
else ()
|
||||
string(REGEX REPLACE
|
||||
"${_PNG_VERSION_SUFFIX_MIN}.*" "${_PNG_VERSION_SUFFIX_MIN}"
|
||||
_PNG_VERSION_SUFFIXES "${_PNG_VERSION_SUFFIXES}")
|
||||
endif ()
|
||||
unset(_PNG_VERSION_SUFFIX_MIN)
|
||||
endif ()
|
||||
foreach(v IN LISTS _PNG_VERSION_SUFFIXES)
|
||||
list(APPEND PNG_NAMES png_brl${v} libpng_brl${v} png${v} libpng${v} libpng${v}_static)
|
||||
list(APPEND PNG_NAMES_DEBUG png_brl${v}d libpng_brl${v}d png${v}d libpng${v}d libpng${v}_staticd)
|
||||
endforeach()
|
||||
unset(_PNG_VERSION_SUFFIXES)
|
||||
|
||||
# Try each search configuration.
|
||||
# For compatibility with versions prior to this multi-config search, honor
|
||||
# any PNG_LIBRARY that is already specified and skip the search.
|
||||
if(NOT PNG_LIBRARY)
|
||||
foreach(search ${_PNG_SEARCHES})
|
||||
find_path(PNG_PNG_INCLUDE_DIR png.h ${${search}} PATH_SUFFIXES include include/libpng)
|
||||
find_library(PNG_LIBRARY_RELEASE ${${search}} NAMES ${PNG_NAMES} NAMES_PER_DIR PATH_SUFFIXES lib)
|
||||
find_library(PNG_LIBRARY_DEBUG ${${search}} NAMES ${PNG_NAMES_DEBUG} NAMES_PER_DIR PATH_SUFFIXES lib)
|
||||
include(SelectLibraryConfigurations)
|
||||
select_library_configurations(PNG)
|
||||
mark_as_advanced(PNG_LIBRARY_RELEASE PNG_LIBRARY_DEBUG)
|
||||
endforeach()
|
||||
endif()
|
||||
|
||||
mark_as_advanced(PNG_LIBRARY)
|
||||
mark_as_advanced(PNG_PNG_INCLUDE_DIR)
|
||||
|
||||
# If we still don't have PNG_LIBRARY, try without specifying search paths
|
||||
if(NOT PNG_LIBRARY)
|
||||
find_library(PNG_LIBRARY_RELEASE NAMES ${PNG_NAMES} NAMES_PER_DIR PATH_SUFFIXES lib)
|
||||
find_library(PNG_LIBRARY_DEBUG NAMES ${PNG_NAMES_DEBUG} NAMES_PER_DIR PATH_SUFFIXES lib)
|
||||
include(SelectLibraryConfigurations)
|
||||
select_library_configurations(PNG)
|
||||
mark_as_advanced(PNG_LIBRARY_RELEASE PNG_LIBRARY_DEBUG)
|
||||
endif()
|
||||
if(APPLE)
|
||||
set(CMAKE_FIND_FRAMEWORK "${_PNG_CMAKE_FIND_FRAMEWORK}")
|
||||
unset(_PNG_CMAKE_FIND_FRAMEWORK)
|
||||
endif()
|
||||
unset(PNG_NAMES)
|
||||
unset(PNG_NAMES_DEBUG)
|
||||
|
||||
# Set by select_library_configurations(), but we want the one from
|
||||
# find_package_handle_standard_args() below.
|
||||
unset(PNG_FOUND)
|
||||
|
||||
if (PNG_LIBRARY AND PNG_PNG_INCLUDE_DIR)
|
||||
# png.h includes zlib.h. Sigh.
|
||||
set(PNG_INCLUDE_DIRS ${PNG_PNG_INCLUDE_DIR} ${ZLIB_INCLUDE_DIR} )
|
||||
set(PNG_INCLUDE_DIR ${PNG_INCLUDE_DIRS} ) # for backward compatibility
|
||||
set(PNG_LIBRARIES ${PNG_LIBRARY} ${ZLIB_LIBRARY})
|
||||
if((CMAKE_SYSTEM_NAME STREQUAL "Linux") AND
|
||||
("${PNG_LIBRARY}" MATCHES "\\${CMAKE_STATIC_LIBRARY_SUFFIX}$"))
|
||||
list(APPEND PNG_LIBRARIES m)
|
||||
endif()
|
||||
|
||||
if (CYGWIN)
|
||||
if(BUILD_SHARED_LIBS)
|
||||
# No need to define PNG_USE_DLL here, because it's default for Cygwin.
|
||||
else()
|
||||
set (PNG_DEFINITIONS -DPNG_STATIC)
|
||||
set(_PNG_COMPILE_DEFINITIONS PNG_STATIC)
|
||||
endif()
|
||||
endif ()
|
||||
|
||||
if(NOT TARGET PNG::PNG)
|
||||
add_library(PNG::PNG UNKNOWN IMPORTED)
|
||||
set_target_properties(PNG::PNG PROPERTIES
|
||||
IMPORTED_NO_SYSTEM TRUE
|
||||
INTERFACE_COMPILE_DEFINITIONS "${_PNG_COMPILE_DEFINITIONS}"
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${PNG_INCLUDE_DIRS}"
|
||||
INTERFACE_LINK_LIBRARIES ZLIB::ZLIB)
|
||||
if((CMAKE_SYSTEM_NAME STREQUAL "Linux") AND
|
||||
("${PNG_LIBRARY}" MATCHES "\\${CMAKE_STATIC_LIBRARY_SUFFIX}$"))
|
||||
set_property(TARGET PNG::PNG APPEND PROPERTY
|
||||
INTERFACE_LINK_LIBRARIES m)
|
||||
endif()
|
||||
|
||||
if(EXISTS "${PNG_LIBRARY}")
|
||||
set_target_properties(PNG::PNG PROPERTIES
|
||||
IMPORTED_LINK_INTERFACE_LANGUAGES "C"
|
||||
IMPORTED_LOCATION "${PNG_LIBRARY}")
|
||||
endif()
|
||||
if(EXISTS "${PNG_LIBRARY_RELEASE}")
|
||||
set_property(TARGET PNG::PNG APPEND PROPERTY
|
||||
IMPORTED_CONFIGURATIONS RELEASE)
|
||||
set_target_properties(PNG::PNG PROPERTIES
|
||||
IMPORTED_LINK_INTERFACE_LANGUAGES_RELEASE "C"
|
||||
IMPORTED_LOCATION_RELEASE "${PNG_LIBRARY_RELEASE}")
|
||||
endif()
|
||||
if(EXISTS "${PNG_LIBRARY_DEBUG}")
|
||||
set_property(TARGET PNG::PNG APPEND PROPERTY
|
||||
IMPORTED_CONFIGURATIONS DEBUG)
|
||||
set_target_properties(PNG::PNG PROPERTIES
|
||||
IMPORTED_LINK_INTERFACE_LANGUAGES_DEBUG "C"
|
||||
IMPORTED_LOCATION_DEBUG "${PNG_LIBRARY_DEBUG}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
unset(_PNG_COMPILE_DEFINITIONS)
|
||||
endif ()
|
||||
|
||||
if (PNG_PNG_INCLUDE_DIR AND EXISTS "${PNG_PNG_INCLUDE_DIR}/png.h")
|
||||
file(STRINGS "${PNG_PNG_INCLUDE_DIR}/png.h" png_version_str REGEX "^#define[ \t]+PNG_LIBPNG_VER_STRING[ \t]+\".+\"")
|
||||
|
||||
string(REGEX REPLACE "^#define[ \t]+PNG_LIBPNG_VER_STRING[ \t]+\"([^\"]+)\".*" "\\1" PNG_VERSION_STRING "${png_version_str}")
|
||||
unset(png_version_str)
|
||||
endif ()
|
||||
endif()
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(PNG
|
||||
REQUIRED_VARS PNG_LIBRARY PNG_PNG_INCLUDE_DIR
|
||||
VERSION_VAR PNG_VERSION_STRING)
|
||||
|
||||
# Local Variables:
|
||||
# tab-width: 8
|
||||
# mode: cmake
|
||||
# indent-tabs-mode: t
|
||||
# End:
|
||||
# ex: shiftwidth=2 tabstop=8
|
||||
@@ -0,0 +1,40 @@
|
||||
# Find Adaptive Multigrid Solver headers for Poisson Surface Reconstruction
|
||||
#
|
||||
# Once done this will define
|
||||
#
|
||||
# POISSONRECON_FOUND - system has Adaptive Multigrid Solver headers
|
||||
# POISSONRECON_INCLUDE_DIR - the Adaptive Multigrid Solver include directory
|
||||
#
|
||||
# and the following imported target:
|
||||
#
|
||||
# POISSONRECON::POISSONRECON- Provides include dir for headers
|
||||
|
||||
set(_POISSONRECON_SEARCHES)
|
||||
|
||||
# Search POISSONRECON_ROOT first if it is set.
|
||||
if(POISSONRECON_ROOT)
|
||||
set(_POISSONRECON_SEARCH_ROOT PATHS ${POISSONRECON_ROOT} NO_DEFAULT_PATH)
|
||||
list(APPEND _POISSONRECON_SEARCHES _POISSONRECON_SEARCH_ROOT)
|
||||
endif()
|
||||
|
||||
# Try each search configuration.
|
||||
foreach(search ${_POISSONRECON_SEARCHES})
|
||||
find_path(POISSONRECON_INCLUDE_DIR NAMES SPSR/Reconstructors.h ${${search}} PATH_SUFFIXES include)
|
||||
endforeach()
|
||||
|
||||
mark_as_advanced(POISSONRECON_INCLUDE_DIR)
|
||||
|
||||
# handle the QUIETLY and REQUIRED arguments and set ZLIB_FOUND to TRUE if
|
||||
# all listed variables are TRUE
|
||||
include(FindPackageHandleStandardArgs)
|
||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(POISSONRECON REQUIRED_VARS POISSONRECON_INCLUDE_DIR)
|
||||
|
||||
if(POISSONRECON_FOUND)
|
||||
set(POISSONRECON_INCLUDE_DIRS ${POISSONRECON_INCLUDE_DIR})
|
||||
|
||||
if(NOT TARGET POISSONRECON::POISSONRECON)
|
||||
add_library(POISSONRECON::POISSONRECON UNKNOWN IMPORTED)
|
||||
set_target_properties(POISSONRECON::POISSONRECON PROPERTIES
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${POISSONRECON_INCLUDE_DIRS}")
|
||||
endif()
|
||||
endif()
|
||||
@@ -0,0 +1,80 @@
|
||||
###############################################################################
|
||||
# CMake module to search for PROJ library
|
||||
#
|
||||
# On success, the macro sets the following variables:
|
||||
# PROJ_FOUND = if the library found
|
||||
# PROJ_VERSION = version number of PROJ found
|
||||
# PROJ_LIBRARIES = full path to the library
|
||||
# PROJ_INCLUDE_DIR = where to find the library headers
|
||||
# Also defined, but not for general use are
|
||||
# PROJ_LIBRARY, where to find the PROJ library.
|
||||
#
|
||||
# Copyright (c) 2009 Mateusz Loskot <mateusz@loskot.net>
|
||||
#
|
||||
# Redistribution and use is allowed according to the terms of the BSD license.
|
||||
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
|
||||
#
|
||||
###############################################################################
|
||||
|
||||
set(_PROJ_SEARCHES)
|
||||
|
||||
# Search PROJ_ROOT first if it is set.
|
||||
if(PROJ_ROOT)
|
||||
set(_PROJ_SEARCH_ROOT PATHS ${PROJ_ROOT} NO_DEFAULT_PATH)
|
||||
list(APPEND _PROJ_SEARCHES _PROJ_SEARCH_ROOT)
|
||||
endif()
|
||||
|
||||
# Normal search.
|
||||
set(_PROJ_x86 "(x86)")
|
||||
set(_PROJ_SEARCH_NORMAL
|
||||
PATHS
|
||||
"$ENV{OSGEO4W_HOME}"
|
||||
"C:/OSGeo4W"
|
||||
"$ENV{ProgramFiles}/proj"
|
||||
"$ENV{ProgramFiles${_PROJ_x86}}/proj"
|
||||
)
|
||||
unset(_PROJ_x86)
|
||||
list(APPEND _PROJ_SEARCHES _PROJ_SEARCH_NORMAL)
|
||||
|
||||
# Try each search configuration.
|
||||
foreach(search ${_PROJ_SEARCHES})
|
||||
find_path(PROJ_INCLUDE_DIR NAMES proj.h ${${search}} PATH_SUFFIXES include include/proj proj)
|
||||
endforeach()
|
||||
|
||||
if (PROJ_INCLUDE_DIR)
|
||||
# Extract version from proj.h (ex: 480)
|
||||
file(STRINGS ${PROJ_INCLUDE_DIR}/proj.h PJ_MAJORSTR REGEX "#define[ ]+PROJ_VERSION_MAJOR[ ]+[0-9]+")
|
||||
string(REGEX MATCH "[0-9]+" PJ_MAJOR ${PJ_MAJORSTR})
|
||||
file(STRINGS ${PROJ_INCLUDE_DIR}/proj.h PJ_MINORSTR REGEX "#define[ ]+PROJ_VERSION_MINOR[ ]+[0-9]+")
|
||||
string(REGEX MATCH "[0-9]+" PJ_MINOR ${PJ_MINORSTR})
|
||||
file(STRINGS ${PROJ_INCLUDE_DIR}/proj.h PJ_PATCHSTR REGEX "#define[ ]+PROJ_VERSION_PATCH[ ]+[0-9]+")
|
||||
string(REGEX MATCH "[0-9]+" PJ_PATCH ${PJ_PATCHSTR})
|
||||
set(PROJ_VERSION ${PJ_MAJOR}.${PJ_MINOR}.${PJ_PATCH})
|
||||
endif()
|
||||
|
||||
set(PROJ_NAMES ${PROJ_NAMES} proj proj_i)
|
||||
if(NOT PROJ_LIBRARY)
|
||||
foreach(search ${_PROJ_SEARCHES})
|
||||
find_library(PROJ_LIBRARY NAMES ${PROJ_NAMES} NAMES_PER_DIR ${${search}} PATH_SUFFIXES lib)
|
||||
endforeach()
|
||||
endif()
|
||||
unset(PROJ_NAMES)
|
||||
|
||||
if(PROJ_LIBRARY)
|
||||
set(PROJ_LIBRARIES ${PROJ_LIBRARY})
|
||||
endif()
|
||||
|
||||
# Handle the QUIETLY and REQUIRED arguments and set PROJ_FOUND to TRUE
|
||||
# if all listed variables are TRUE
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(PROJ DEFAULT_MSG
|
||||
PROJ_LIBRARY
|
||||
PROJ_INCLUDE_DIR)
|
||||
|
||||
# Local Variables:
|
||||
# tab-width: 8
|
||||
# mode: cmake
|
||||
# indent-tabs-mode: t
|
||||
# End:
|
||||
# ex: shiftwidth=2 tabstop=8
|
||||
|
||||
@@ -0,0 +1,167 @@
|
||||
# The module defines the following variables:
|
||||
# RE2C_EXECUTABLE - the path to the re2c executable
|
||||
#
|
||||
#=============================================================================
|
||||
|
||||
set(_RE2C_SEARCHES)
|
||||
|
||||
# Search RE2C_ROOT first if it is set.
|
||||
if(RE2C_ROOT)
|
||||
set(_RE2C_SEARCH_ROOT PATHS ${RE2C_ROOT} NO_DEFAULT_PATH)
|
||||
list(APPEND _RE2C_SEARCHES _RE2C_SEARCH_ROOT)
|
||||
endif()
|
||||
|
||||
# Normal search.
|
||||
set(_RE2C_x86 "(x86)")
|
||||
set(_RE2C_SEARCH_NORMAL
|
||||
PATHS "$ENV{ProgramFiles}/re2c"
|
||||
"$ENV{ProgramFiles${_RE2C_x86}}/re2c")
|
||||
unset(_RE2C_x86)
|
||||
list(APPEND _RE2C_SEARCHES _RE2C_SEARCH_NORMAL)
|
||||
|
||||
set(RE2C_NAMES re2c)
|
||||
|
||||
# Try each search configuration.
|
||||
foreach(search ${_RE2C_SEARCHES})
|
||||
find_program(RE2C_EXECUTABLE re2c ${${search}} PATH_SUFFIXES bin)
|
||||
endforeach()
|
||||
|
||||
mark_as_advanced(RE2C_EXECUTABLE)
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(RE2C DEFAULT_MSG RE2C_EXECUTABLE)
|
||||
|
||||
# Provide a macro to generate custom build rules:
|
||||
|
||||
# RE2C_TARGET(Name RE2CInput RE2COutput [COMPILE_FLAGS <string>])
|
||||
# which creates a custom command to generate the <RE2COutput> file from
|
||||
# the <RE2CInput> file. If COMPILE_FLAGS option is specified, the next
|
||||
# parameter is added to the re2c command line. Name is an alias used to
|
||||
# get details of this custom command.
|
||||
|
||||
# This module also defines a macro:
|
||||
# ADD_RE2C_LEMON_DEPENDENCY(RE2CTarget LemonTarget)
|
||||
# which adds the required dependency between a scanner and a parser
|
||||
# where <RE2CTarget> and <LemonTarget> are the first parameters of
|
||||
# respectively RE2C_TARGET and LEMON_TARGET macros.
|
||||
#
|
||||
# ====================================================================
|
||||
# Example:
|
||||
#
|
||||
# find_package(LEMON)
|
||||
# find_package(RE2C)
|
||||
#
|
||||
# LEMON_TARGET(MyParser parser.y "${CMAKE_CURRENT_BINARY_DIR}/parser.cpp")
|
||||
# RE2C_TARGET(MyScanner scanner.re "${CMAKE_CURRENT_BINARY_DIR}/scanner.cpp")
|
||||
# ADD_RE2C_LEMON_DEPENDENCY(MyScanner MyParser)
|
||||
#
|
||||
# include_directories("${CMAKE_CURRENT_BINARY_DIR}")
|
||||
# add_executable(Foo
|
||||
# Foo.cc
|
||||
# ${LEMON_MyParser_OUTPUTS}
|
||||
# ${RE2C_MyScanner_OUTPUTS}
|
||||
# )
|
||||
# ====================================================================
|
||||
#
|
||||
#=============================================================================
|
||||
# Copyright (c) 2010-2023 United States Government as represented by
|
||||
# the U.S. Army Research Laboratory.
|
||||
# Copyright 2009 Kitware, Inc.
|
||||
# Copyright 2006 Tristan Carel
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
#
|
||||
# * Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
#
|
||||
# * Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
#
|
||||
# * The names of the authors may not be used to endorse or promote
|
||||
# products derived from this software without specific prior written
|
||||
# permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
# HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 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.
|
||||
#=============================================================================
|
||||
|
||||
#============================================================
|
||||
# RE2C_TARGET (public macro)
|
||||
#============================================================
|
||||
#
|
||||
# TODO - rework this macro to make use of CMakeParseArguments, see
|
||||
# http://www.cmake.org/pipermail/cmake/2012-July/051309.html
|
||||
if(NOT COMMAND RE2C_TARGET)
|
||||
macro(RE2C_TARGET Name Input Output)
|
||||
set(RE2C_TARGET_usage "RE2C_TARGET(<Name> <Input> <Output> [COMPILE_FLAGS <string>]")
|
||||
if(${ARGC} GREATER 3)
|
||||
if(${ARGC} EQUAL 5)
|
||||
if("${ARGV3}" STREQUAL "COMPILE_FLAGS")
|
||||
set(RE2C_EXECUTABLE_opts "${ARGV4}")
|
||||
SEPARATE_ARGUMENTS(RE2C_EXECUTABLE_opts)
|
||||
else()
|
||||
message(SEND_ERROR ${RE2C_TARGET_usage})
|
||||
endif()
|
||||
else()
|
||||
message(SEND_ERROR ${RE2C_TARGET_usage})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
add_custom_command(OUTPUT ${Output}
|
||||
COMMAND ${RE2C_EXECUTABLE}
|
||||
ARGS ${RE2C_EXECUTABLE_opts} -o${Output} ${Input}
|
||||
DEPENDS ${Input} ${RE2C_EXECUTABLE_TARGET}
|
||||
COMMENT "[RE2C][${Name}] Building scanner with ${RE2C_EXECUTABLE}"
|
||||
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}")
|
||||
|
||||
set(RE2C_${Name}_DEFINED TRUE)
|
||||
set(RE2C_${Name}_OUTPUTS ${Output})
|
||||
set(RE2C_${Name}_INPUT ${Input})
|
||||
set(RE2C_${Name}_COMPILE_FLAGS ${RE2C_EXECUTABLE_opts})
|
||||
set_property(DIRECTORY APPEND PROPERTY ADDITIONAL_MAKE_CLEAN_FILES "${Output}")
|
||||
endmacro(RE2C_TARGET)
|
||||
endif(NOT COMMAND RE2C_TARGET)
|
||||
#============================================================
|
||||
|
||||
#============================================================
|
||||
# ADD_RE2C_LEMON_DEPENDENCY (public macro)
|
||||
#============================================================
|
||||
#
|
||||
if(NOT COMMAND ADD_RE2C_LEMON_DEPENDENCY)
|
||||
macro(ADD_RE2C_LEMON_DEPENDENCY RE2CTarget LemonTarget)
|
||||
|
||||
if(NOT RE2C_${RE2CTarget}_OUTPUTS)
|
||||
message(SEND_ERROR "RE2C target `${RE2CTarget}' does not exists.")
|
||||
endif()
|
||||
|
||||
if(NOT LEMON_${LemonTarget}_HDR)
|
||||
message(SEND_ERROR "Lemon target `${LemonTarget}' does not exists.")
|
||||
endif()
|
||||
|
||||
set_source_files_properties(${RE2C_${RE2CTarget}_OUTPUTS}
|
||||
PROPERTIES OBJECT_DEPENDS ${LEMON_${LemonTarget}_HDR})
|
||||
endmacro(ADD_RE2C_LEMON_DEPENDENCY)
|
||||
endif(NOT COMMAND ADD_RE2C_LEMON_DEPENDENCY)
|
||||
#============================================================
|
||||
|
||||
# RE2C_Util.cmake ends here
|
||||
|
||||
# Local Variables:
|
||||
# tab-width: 8
|
||||
# mode: cmake
|
||||
# indent-tabs-mode: t
|
||||
# End:
|
||||
# ex: shiftwidth=2 tabstop=8
|
||||
@@ -0,0 +1,84 @@
|
||||
#.rst:
|
||||
# FindREGEX
|
||||
# --------
|
||||
#
|
||||
# Find the native REGEX includes and library.
|
||||
#
|
||||
# IMPORTED Targets
|
||||
# ^^^^^^^^^^^^^^^^
|
||||
#
|
||||
# This module defines :prop_tgt:`IMPORTED` target ``REGEX::REGEX``, if
|
||||
# REGEX has been found.
|
||||
#
|
||||
# Result Variables
|
||||
# ^^^^^^^^^^^^^^^^
|
||||
#
|
||||
# This module defines the following variables:
|
||||
#
|
||||
# ::
|
||||
#
|
||||
# REGEX_INCLUDE_DIRS - where to find regex.h, etc.
|
||||
# REGEX_LIBRARIES - List of libraries when using regex.
|
||||
# REGEX_FOUND - True if regex found.
|
||||
#
|
||||
#
|
||||
# Hints
|
||||
# ^^^^^
|
||||
#
|
||||
# A user may set ``REGEX_ROOT`` to a regex installation root to tell this
|
||||
# module where to look.
|
||||
|
||||
#=============================================================================
|
||||
# Copyright 2001-2011 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.)
|
||||
|
||||
set(_REGEX_SEARCHES)
|
||||
|
||||
# Search REGEX_ROOT first if it is set.
|
||||
if(REGEX_ROOT)
|
||||
set(_REGEX_SEARCH_ROOT PATHS ${REGEX_ROOT} NO_DEFAULT_PATH)
|
||||
list(APPEND _REGEX_SEARCHES _REGEX_SEARCH_ROOT)
|
||||
endif()
|
||||
|
||||
# Normal search.
|
||||
set(_REGEX_SEARCH_NORMAL
|
||||
PATHS "[HKEY_LOCAL_MACHINE\\SOFTWARE\\GnuWin32\\Regex;InstallPath]"
|
||||
"$ENV{PROGRAMFILES}/regex"
|
||||
)
|
||||
list(APPEND _REGEX_SEARCHES _REGEX_SEARCH_NORMAL)
|
||||
|
||||
set(REGEX_NAMES regex_brl regex_brld regex regexd regexd1)
|
||||
|
||||
# Try each search configuration.
|
||||
foreach(search ${_REGEX_SEARCHES})
|
||||
find_path(REGEX_INCLUDE_DIR NAMES regex.h ${${search}} PATH_SUFFIXES include)
|
||||
find_library(REGEX_LIBRARY NAMES ${REGEX_NAMES} ${${search}} PATH_SUFFIXES lib)
|
||||
endforeach()
|
||||
|
||||
mark_as_advanced(REGEX_LIBRARY REGEX_INCLUDE_DIR)
|
||||
|
||||
# handle the QUIETLY and REQUIRED arguments and set REGEX_FOUND to TRUE if
|
||||
# all listed variables are TRUE
|
||||
include(FindPackageHandleStandardArgs)
|
||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(REGEX REQUIRED_VARS REGEX_LIBRARY REGEX_INCLUDE_DIR)
|
||||
|
||||
if(REGEX_FOUND)
|
||||
set(REGEX_INCLUDE_DIRS ${REGEX_INCLUDE_DIR})
|
||||
set(REGEX_LIBRARIES ${REGEX_LIBRARY})
|
||||
|
||||
if(NOT TARGET REGEX::REGEX)
|
||||
add_library(REGEX::REGEX UNKNOWN IMPORTED)
|
||||
set_target_properties(REGEX::REGEX PROPERTIES
|
||||
IMPORTED_LOCATION "${REGEX_LIBRARY}"
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${REGEX_INCLUDE_DIRS}")
|
||||
endif()
|
||||
endif()
|
||||
@@ -0,0 +1,85 @@
|
||||
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
||||
# file Copyright.txt or https://cmake.org/licensing for details.
|
||||
|
||||
#[=======================================================================[.rst:
|
||||
FindSQLite3
|
||||
-----------
|
||||
|
||||
.. versionadded:: 3.14
|
||||
|
||||
Find the SQLite libraries, v3
|
||||
|
||||
IMPORTED targets
|
||||
^^^^^^^^^^^^^^^^
|
||||
|
||||
This module defines the following :prop_tgt:`IMPORTED` target:
|
||||
|
||||
``SQLite::SQLite3``
|
||||
|
||||
Result variables
|
||||
^^^^^^^^^^^^^^^^
|
||||
|
||||
This module will set the following variables if found:
|
||||
|
||||
``SQLite3_INCLUDE_DIRS``
|
||||
where to find sqlite3.h, etc.
|
||||
``SQLite3_LIBRARIES``
|
||||
the libraries to link against to use SQLite3.
|
||||
``SQLite3_EXECNAME``
|
||||
the sqlite3 program name.
|
||||
``SQLite3_VERSION``
|
||||
version of the SQLite3 library found
|
||||
``SQLite3_FOUND``
|
||||
TRUE if found
|
||||
|
||||
#]=======================================================================]
|
||||
|
||||
set(_SQLite3_SEARCHES)
|
||||
|
||||
# Search SQLite3_ROOT first if it is set.
|
||||
if(SQLite3_ROOT)
|
||||
set(_SQLite3_SEARCH_ROOT PATHS ${SQLite3_ROOT} NO_DEFAULT_PATH)
|
||||
list(APPEND _SQLite3_SEARCHES _SQLite3_SEARCH_ROOT)
|
||||
endif()
|
||||
|
||||
# Fall back to default system paths
|
||||
set(_SQLite3_SEARCH_NORMAL)
|
||||
list(APPEND _SQLite3_SEARCHES _SQLite3_SEARCH_NORMAL)
|
||||
|
||||
set(SQLite3_NAMES sqlite3 sqlite libsqlite3 libsqlite)
|
||||
|
||||
# Try each search configuration.
|
||||
foreach(search ${_SQLite3_SEARCHES})
|
||||
find_path(SQLite3_INCLUDE_DIR NAMES sqlite3.h ${${search}} PATH_SUFFIXES include)
|
||||
find_library(SQLite3_LIBRARY NAMES ${SQLite3_NAMES} ${${search}} PATH_SUFFIXES lib)
|
||||
find_program(SQLite3_EXECNAME NAMES sqlite3 sqlite ${${search}} PATH_SUFFIXES bin)
|
||||
endforeach()
|
||||
|
||||
mark_as_advanced(SQLite3_LIBRARY SQLite3_INCLUDE_DIR)
|
||||
|
||||
# Extract version information from the header file
|
||||
if(SQLite3_INCLUDE_DIR)
|
||||
file(STRINGS ${SQLite3_INCLUDE_DIR}/sqlite3.h _ver_line
|
||||
REGEX "^#define SQLITE_VERSION *\"[0-9]+\\.[0-9]+\\.[0-9]+\""
|
||||
LIMIT_COUNT 1)
|
||||
string(REGEX MATCH "[0-9]+\\.[0-9]+\\.[0-9]+"
|
||||
SQLite3_VERSION "${_ver_line}")
|
||||
unset(_ver_line)
|
||||
endif()
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(SQLite3
|
||||
REQUIRED_VARS SQLite3_INCLUDE_DIR SQLite3_LIBRARY
|
||||
VERSION_VAR SQLite3_VERSION)
|
||||
|
||||
# Create the imported target
|
||||
if(SQLite3_FOUND)
|
||||
set(SQLite3_INCLUDE_DIRS ${SQLite3_INCLUDE_DIR})
|
||||
set(SQLite3_LIBRARIES ${SQLite3_LIBRARY})
|
||||
if(NOT TARGET SQLite::SQLite3)
|
||||
add_library(SQLite::SQLite3 UNKNOWN IMPORTED)
|
||||
set_target_properties(SQLite::SQLite3 PROPERTIES
|
||||
IMPORTED_LOCATION "${SQLite3_LIBRARY}"
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${SQLite3_INCLUDE_DIR}")
|
||||
endif()
|
||||
endif()
|
||||
@@ -0,0 +1,160 @@
|
||||
# F I N D S T E P C O D E . C M A K E
|
||||
# BRL-CAD
|
||||
#
|
||||
# Copyright (c) 2013-2023 United States Government as represented by
|
||||
# the U.S. Army Research Laboratory.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
#
|
||||
# 1. Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
#
|
||||
# 2. Redistributions in binary form must reproduce the above
|
||||
# copyright notice, this list of conditions and the following
|
||||
# disclaimer in the documentation and/or other materials provided
|
||||
# with the distribution.
|
||||
#
|
||||
# 3. The name of the author may not be used to endorse or promote
|
||||
# products derived from this software without specific prior written
|
||||
# permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
|
||||
# OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
|
||||
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
|
||||
# GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
# WHETHER IN CONTRACT, STRICT LIABILITY, 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.
|
||||
#
|
||||
###
|
||||
# - Find STEPCODE
|
||||
#
|
||||
# The following variables are set:
|
||||
#
|
||||
# STEPCODE_INCLUDE_DIRS - where to find stepcode headers
|
||||
# STEPCODE_LIBRARIES - List of libraries when using stepcode.
|
||||
# STEPCODE_FOUND - True if stepcode found.
|
||||
|
||||
|
||||
# A user may set ``STEPCODE_ROOT`` to a stepcode installation root to tell this
|
||||
# module where to look.
|
||||
# =============================================================================
|
||||
|
||||
# Check that each of the libraries has an expected header,
|
||||
# as well as the toplevel defined headers. (TODO - are the
|
||||
# latter needed beyond the stepcode build itself? Trim this
|
||||
# to the minimum actually needed...)
|
||||
set(STEPCODE_HDRS
|
||||
cldai/sdaiObject.h
|
||||
cleditor/STEPfile.h
|
||||
clstepcore/sdai.h
|
||||
clutils/gennodearray.h
|
||||
exppp/exppp.h
|
||||
express/express.h
|
||||
config.h
|
||||
)
|
||||
|
||||
set(STEPCODE_LIBS
|
||||
express
|
||||
exppp
|
||||
stepcore
|
||||
stepeditor
|
||||
stepdai
|
||||
steputils
|
||||
)
|
||||
|
||||
set(STEPCODE_EXEC
|
||||
exp2cxx
|
||||
exppp
|
||||
)
|
||||
|
||||
# Search STEPCODE_ROOT first if it is set.
|
||||
set(_STEPCODE_SEARCHES)
|
||||
if(STEPCODE_ROOT)
|
||||
set(_STEPCODE_SEARCH_ROOT PATHS ${STEPCODE_ROOT} NO_DEFAULT_PATH)
|
||||
list(APPEND _STEPCODE_SEARCHES _STEPCODE_SEARCH_ROOT)
|
||||
endif()
|
||||
|
||||
# Try each search configuration.
|
||||
foreach(search ${_STEPCODE_SEARCHES})
|
||||
find_path(STEPCODE_DAI_DIR NAMES sdaiObject.h ${${search}} PATH_SUFFIXES include include/stepcode/cldai)
|
||||
find_path(STEPCODE_EDITOR_DIR NAMES STEPfile.h ${${search}} PATH_SUFFIXES include include/stepcode/cleditor)
|
||||
find_path(STEPCODE_STEPCORE_DIR NAMES sdai.h ${${search}} PATH_SUFFIXES include include/stepcode/clstepcore)
|
||||
find_path(STEPCODE_UTILS_DIR NAMES gennodearray.h ${${search}} PATH_SUFFIXES include include/stepcode/clutils)
|
||||
find_path(STEPCODE_EXPPP_DIR NAMES exppp.h ${${search}} PATH_SUFFIXES include include/stepcode/exppp)
|
||||
find_path(STEPCODE_EXPRESS_DIR NAMES express.h ${${search}} PATH_SUFFIXES include include/stepcode/express)
|
||||
find_path(STEPCODE_INCLUDE_DIR NAMES config.h ${${search}} PATH_SUFFIXES include include/stepcode)
|
||||
#TODO - should be an all-or-nothing for the set...
|
||||
endforeach()
|
||||
|
||||
# Allow STEPCODE_LIBRARY to be set manually, as the location of the netpbm library
|
||||
foreach(search ${_STEPCODE_SEARCHES})
|
||||
find_library(STEPCODE_EXPRESS_LIBRARY NAMES express NAMES_PER_DIR ${${search}} PATH_SUFFIXES lib)
|
||||
if (WIN32)
|
||||
find_library(STEPCODE_EXPPP_LIBRARY NAMES libexppp NAMES_PER_DIR ${${search}} PATH_SUFFIXES lib)
|
||||
else (WIN32)
|
||||
find_library(STEPCODE_EXPPP_LIBRARY NAMES exppp NAMES_PER_DIR ${${search}} PATH_SUFFIXES lib)
|
||||
endif (WIN32)
|
||||
find_library(STEPCODE_CORE_LIBRARY NAMES stepcore NAMES_PER_DIR ${${search}} PATH_SUFFIXES lib)
|
||||
find_library(STEPCODE_EDITOR_LIBRARY NAMES stepeditor NAMES_PER_DIR ${${search}} PATH_SUFFIXES lib)
|
||||
find_library(STEPCODE_DAI_LIBRARY NAMES stepdai NAMES_PER_DIR ${${search}} PATH_SUFFIXES lib)
|
||||
find_library(STEPCODE_UTILS_LIBRARY NAMES steputils NAMES_PER_DIR ${${search}} PATH_SUFFIXES lib)
|
||||
#TODO - should be an all-or-nothing for the set...
|
||||
endforeach()
|
||||
|
||||
# Allow STEPCODE_LIBRARY to be set manually, as the location of the netpbm library
|
||||
foreach(search ${_STEPCODE_SEARCHES})
|
||||
find_program(EXP2CXX_EXECUTABLE exp2cxx ${${search}} PATH_SUFFIXES bin)
|
||||
find_program(EXPPP_EXECUTABLE exppp ${${search}} PATH_SUFFIXES bin)
|
||||
#TODO - should be an all-or-nothing for the set...
|
||||
endforeach()
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(STEPCODE DEFAULT_MSG
|
||||
STEPCODE_DAI_DIR
|
||||
STEPCODE_EDITOR_DIR
|
||||
STEPCODE_STEPCORE_DIR
|
||||
STEPCODE_UTILS_DIR
|
||||
STEPCODE_EXPPP_DIR
|
||||
STEPCODE_EXPRESS_DIR
|
||||
STEPCODE_INCLUDE_DIR
|
||||
STEPCODE_EXPRESS_LIBRARY
|
||||
STEPCODE_EXPPP_LIBRARY
|
||||
STEPCODE_CORE_LIBRARY
|
||||
STEPCODE_EDITOR_LIBRARY
|
||||
STEPCODE_DAI_LIBRARY
|
||||
STEPCODE_UTILS_LIBRARY
|
||||
EXP2CXX_EXECUTABLE
|
||||
EXPPP_EXECUTABLE
|
||||
)
|
||||
|
||||
if (STEPCODE_FOUND)
|
||||
set(STEPCODE_INCLUDE_DIRS
|
||||
${STEPCODE_INCLUDE_DIR}
|
||||
${STEPCODE_STEPCORE_DIR}
|
||||
${STEPCODE_EDITOR_DIR}
|
||||
${STEPCODE_UTILS_DIR}
|
||||
${STEPCODE_DAI_DIR}
|
||||
)
|
||||
set(STEPCODE_LIBRARIES
|
||||
${STEPCODE_EXPRESS_LIBRARY}
|
||||
${STEPCODE_EXPPP_LIBRARY}
|
||||
${STEPCODE_CORE_LIBRARY}
|
||||
${STEPCODE_EDITOR_LIBRARY}
|
||||
${STEPCODE_DAI_LIBRARY}
|
||||
${STEPCODE_UTILS_LIBRARY}
|
||||
)
|
||||
endif()
|
||||
|
||||
# Local Variables:
|
||||
# tab-width: 8
|
||||
# mode: cmake
|
||||
# indent-tabs-mode: t
|
||||
# End:
|
||||
# ex: shiftwidth=2 tabstop=8
|
||||
@@ -0,0 +1,554 @@
|
||||
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
||||
# file Copyright.txt or https://cmake.org/licensing for details.
|
||||
|
||||
#[=======================================================================[.rst:
|
||||
FindTCL
|
||||
-------
|
||||
|
||||
This module finds if Tcl is installed and determines where the include
|
||||
files and libraries are. It also determines what the name of the
|
||||
library is. This code sets the following variables:
|
||||
|
||||
::
|
||||
|
||||
TCL_FOUND = Tcl was found
|
||||
TCLSH_FOUND = TRUE if tclsh has been found
|
||||
TCL_LIBRARY = path to Tcl library (tcl tcl80)
|
||||
TCL_INCLUDE_PATH = path to where tcl.h can be found
|
||||
TCL_TCLSH = path to tclsh binary (tcl tcl80)
|
||||
|
||||
|
||||
|
||||
If TCL_ENABLE_TK is set, the following are also set:
|
||||
|
||||
::
|
||||
|
||||
TK_FOUND = Tk was found
|
||||
TCLTK_FOUND = Tcl and Tk were found
|
||||
TK_LIBRARY = path to Tk library (tk tk80 etc)
|
||||
TK_INCLUDE_PATH = path to where tk.h can be found
|
||||
TK_WISH = full path to the wish executable
|
||||
TCL_STUB_LIBRARY = path to Tcl stub library
|
||||
TK_STUB_LIBRARY = path to Tk stub library
|
||||
TTK_STUB_LIBRARY = path to ttk stub library
|
||||
|
||||
#]=======================================================================]
|
||||
|
||||
|
||||
set(_TCL_SEARCHES)
|
||||
|
||||
# Search TCL_ROOT first if it is set.
|
||||
if(TCL_ROOT)
|
||||
set(_TCL_SEARCH_ROOT PATHS ${TCL_ROOT} NO_DEFAULT_PATH)
|
||||
list(APPEND _TCL_SEARCHES _TCL_SEARCH_ROOT)
|
||||
endif()
|
||||
|
||||
if(WIN32)
|
||||
get_filename_component(
|
||||
ActiveTcl_CurrentVersion
|
||||
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\ActiveState\\ActiveTcl;CurrentVersion]"
|
||||
NAME
|
||||
)
|
||||
set(
|
||||
TCLTK_POSSIBLE_BIN_PATHS
|
||||
${TCLTK_POSSIBLE_BIN_PATHS}
|
||||
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\ActiveState\\ActiveTcl\\${ActiveTcl_CurrentVersion}]/bin"
|
||||
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Scriptics\\Tcl\\8.6;Root]/bin"
|
||||
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Scriptics\\Tcl\\8.5;Root]/bin"
|
||||
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Scriptics\\Tcl\\8.4;Root]/bin"
|
||||
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Scriptics\\Tcl\\8.3;Root]/bin"
|
||||
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Scriptics\\Tcl\\8.2;Root]/bin"
|
||||
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Scriptics\\Tcl\\8.0;Root]/bin"
|
||||
)
|
||||
|
||||
get_filename_component(
|
||||
ActiveTcl_CurrentVersion
|
||||
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\ActiveState\\ActiveTcl;CurrentVersion]"
|
||||
NAME
|
||||
)
|
||||
set(
|
||||
TCLTK_POSSIBLE_LIB_PATHS
|
||||
${TCLTK_POSSIBLE_LIB_PATHS}
|
||||
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\ActiveState\\ActiveTcl\\${ActiveTcl_CurrentVersion}]/lib"
|
||||
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Scriptics\\Tcl\\8.6;Root]/lib"
|
||||
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Scriptics\\Tcl\\8.5;Root]/lib"
|
||||
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Scriptics\\Tcl\\8.4;Root]/lib"
|
||||
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Scriptics\\Tcl\\8.3;Root]/lib"
|
||||
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Scriptics\\Tcl\\8.2;Root]/lib"
|
||||
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Scriptics\\Tcl\\8.0;Root]/lib"
|
||||
"$ENV{ProgramFiles}/Tcl/Lib"
|
||||
"C:/Program Files/Tcl/lib"
|
||||
"C:/Tcl/lib"
|
||||
)
|
||||
|
||||
set(
|
||||
TCLTK_POSSIBLE_INCLUDE_PATHS
|
||||
${TCLTK_POSSIBLE_INCLUDE_PATHS}
|
||||
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\ActiveState\\ActiveTcl\\${ActiveTcl_CurrentVersion}]/include"
|
||||
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Scriptics\\Tcl\\8.6;Root]/include"
|
||||
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Scriptics\\Tcl\\8.5;Root]/include"
|
||||
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Scriptics\\Tcl\\8.4;Root]/include"
|
||||
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Scriptics\\Tcl\\8.3;Root]/include"
|
||||
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Scriptics\\Tcl\\8.2;Root]/include"
|
||||
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Scriptics\\Tcl\\8.0;Root]/include"
|
||||
"$ENV{ProgramFiles}/Tcl/include"
|
||||
"C:/Program Files/Tcl/include"
|
||||
"C:/Tcl/include"
|
||||
)
|
||||
endif()
|
||||
|
||||
set(
|
||||
TCL_TCLSH_NAMES
|
||||
tclsh
|
||||
tclsh${TCL_LIBRARY_VERSION}
|
||||
tclsh${TK_LIBRARY_VERSION}
|
||||
tclsh${TK_WISH_VERSION}
|
||||
tclsh87
|
||||
tclsh8.7
|
||||
tclsh86
|
||||
tclsh8.6
|
||||
tclsh85
|
||||
tclsh8.5
|
||||
tclsh84
|
||||
tclsh8.4
|
||||
tclsh83
|
||||
tclsh8.3
|
||||
tclsh82
|
||||
tclsh8.2
|
||||
tclsh80
|
||||
tclsh8.0
|
||||
)
|
||||
if(CYGWIN)
|
||||
set(TCL_TCLSH_NAMES ${TCL_TCLSH_NAMES} cygtclsh83 cygtclsh80)
|
||||
endif(CYGWIN)
|
||||
|
||||
foreach(search ${_TCL_SEARCHES})
|
||||
find_program(TCL_TCLSH NAMES ${TCL_TCLSH_NAMES} ${${search}} PATH_SUFFIXES bin)
|
||||
endforeach()
|
||||
if(NOT TCL_TCLSH)
|
||||
find_program(TCL_TCLSH NAMES ${TCL_TCLSH_NAMES} HINTS ${TCLTK_POSSIBLE_BIN_PATHS})
|
||||
endif(NOT TCL_TCLSH)
|
||||
|
||||
if(TCL_ENABLE_TK)
|
||||
set(
|
||||
TK_WISH_NAMES
|
||||
wish
|
||||
wish${TCL_LIBRARY_VERSION}
|
||||
wish${TK_LIBRARY_VERSION}
|
||||
wish${TCL_TCLSH_VERSION}
|
||||
wish86
|
||||
wish8.6
|
||||
wish85
|
||||
wish8.5
|
||||
wish84
|
||||
wish8.4
|
||||
wish83
|
||||
wish8.3
|
||||
wish82
|
||||
wish8.2
|
||||
wish80
|
||||
wish8.0
|
||||
)
|
||||
|
||||
if(CYGWIN)
|
||||
set(TK_WISH_NAMES ${TK_WISH_NAMES} cygwish80)
|
||||
endif()
|
||||
|
||||
foreach(search ${_TCL_SEARCHES})
|
||||
find_program(TK_WISH NAMES ${TK_WISH_NAMES} ${${search}} PATH_SUFFIXES bin)
|
||||
endforeach()
|
||||
if(NOT TK_WISH)
|
||||
find_program(TK_WISH NAMES ${TK_WISH_NAMES} HINTS ${TCLTK_POSSIBLE_BIN_PATHS})
|
||||
endif(NOT TK_WISH)
|
||||
endif(TCL_ENABLE_TK)
|
||||
|
||||
if(TCLSH_VERSION_STRING)
|
||||
set(TCL_TCLSH_VERSION "${TCLSH_VERSION_STRING}")
|
||||
else()
|
||||
get_filename_component(TCL_TCLSH_PATH "${TCL_TCLSH}" PATH)
|
||||
get_filename_component(TCL_TCLSH_PATH_PARENT "${TCL_TCLSH_PATH}" PATH)
|
||||
string(REGEX REPLACE "^.*tclsh([0-9]\\.*[0-9]).*$" "\\1" TCL_TCLSH_VERSION "${TCL_TCLSH}")
|
||||
endif()
|
||||
|
||||
set(TCLTK_POSSIBLE_LIB_PATHS "${TCL_INCLUDE_PATH_PARENT}/lib" "${TCL_LIBRARY_PATH}" "${TCL_TCLSH_PATH_PARENT}/lib")
|
||||
if(TCL_ENABLE_TK)
|
||||
set(
|
||||
TCLTK_POSSIBLE_LIB_PATHS
|
||||
${TCLTK_POSSIBLE_LIB_PATHS}
|
||||
"${TK_INCLUDE_PATH_PARENT}/lib"
|
||||
"${TK_LIBRARY_PATH}"
|
||||
"${TK_WISH_PATH_PARENT}/lib"
|
||||
)
|
||||
endif(TCL_ENABLE_TK)
|
||||
|
||||
set(
|
||||
TCLTK_POSSIBLE_LIB_PATH_SUFFIXES
|
||||
lib
|
||||
lib/tcl
|
||||
lib/tcl/tcl8.7
|
||||
lib/tcl/tcl8.6
|
||||
lib/tcl/tcl8.5
|
||||
lib/tcl/tcl8.4
|
||||
)
|
||||
if(TCL_ENABLE_TK)
|
||||
set(
|
||||
TCLTK_POSSIBLE_LIB_PATH_SUFFIXES
|
||||
${TCLTK_POSSIBLE_LIB_PATH_SUFFIXES}
|
||||
lib/tcl/tk8.7
|
||||
lib/tcl/tk8.6
|
||||
lib/tcl/tk8.5
|
||||
lib/tcl/tk8.4
|
||||
)
|
||||
endif(TCL_ENABLE_TK)
|
||||
|
||||
set(
|
||||
TCL_POSSIBLE_LIB_NAMES
|
||||
tcl
|
||||
tcl${TCL_LIBRARY_VERSION}
|
||||
tcl${TCL_TCLSH_VERSION}
|
||||
tcl${TK_WISH_VERSION}
|
||||
tcl87
|
||||
tcl8.7
|
||||
tcl87t
|
||||
tcl8.7t
|
||||
tcl86
|
||||
tcl8.6
|
||||
tcl86t
|
||||
tcl8.6t
|
||||
tcl85
|
||||
tcl8.5
|
||||
tcl84
|
||||
tcl8.4
|
||||
tcl83
|
||||
tcl8.3
|
||||
tcl82
|
||||
tcl8.2
|
||||
tcl80
|
||||
tcl8.0
|
||||
)
|
||||
|
||||
if(NOT TCL_LIBRARY)
|
||||
foreach(search ${_TCL_SEARCHES})
|
||||
find_library(
|
||||
TCL_LIBRARY
|
||||
NAMES ${TCL_POSSIBLE_LIB_NAMES}
|
||||
NAMES_PER_DIR
|
||||
${${search}}
|
||||
PATH_SUFFIXES ${TCLTK_POSSIBLE_LIB_PATH_SUFFIXES}
|
||||
)
|
||||
endforeach()
|
||||
endif()
|
||||
if(NOT TCL_LIBRARY)
|
||||
find_library(
|
||||
TCL_LIBRARY
|
||||
NAMES ${TCL_POSSIBLE_LIB_NAMES}
|
||||
PATHS ${TCLTK_POSSIBLE_LIB_PATHS}
|
||||
PATH_SUFFIXES ${TCLTK_POSSIBLE_LIB_PATH_SUFFIXES}
|
||||
)
|
||||
endif(NOT TCL_LIBRARY)
|
||||
|
||||
set(
|
||||
TCLSTUB_POSSIBLE_LIB_NAMES
|
||||
tclstub
|
||||
tclstub${TK_LIBRARY_VERSION}
|
||||
tclstub${TCL_TCLSH_VERSION}
|
||||
tclstub${TK_WISH_VERSION}
|
||||
tclstub87
|
||||
tclstub8.7
|
||||
tclstub86
|
||||
tclstub8.6
|
||||
tclstub85
|
||||
tclstub8.5
|
||||
tclstub84
|
||||
tclstub8.4
|
||||
tclstub83
|
||||
tclstub8.3
|
||||
tclstub82
|
||||
tclstub8.2
|
||||
tclstub80
|
||||
tclstub8.0
|
||||
)
|
||||
if(NOT TCL_STUB_LIBRARY)
|
||||
foreach(search ${_TCL_SEARCHES})
|
||||
find_library(
|
||||
TCL_STUB_LIBRARY
|
||||
NAMES ${TCLSTUB_POSSIBLE_LIB_NAMES}
|
||||
NAMES_PER_DIR
|
||||
${${search}}
|
||||
PATH_SUFFIXES ${TCLTK_POSSIBLE_LIB_PATH_SUFFIXES}
|
||||
)
|
||||
endforeach()
|
||||
endif()
|
||||
if(NOT TCL_STUB_LIBRARY)
|
||||
find_library(TCL_STUB_LIBRARY NAMES ${TCLSTUB_POSSIBLE_LIB_NAMES} PATHS ${TCLTK_POSSIBLE_LIB_PATHS})
|
||||
endif()
|
||||
|
||||
if(TCL_ENABLE_TK)
|
||||
set(
|
||||
TK_POSSIBLE_LIB_NAMES
|
||||
tk
|
||||
tk${TK_LIBRARY_VERSION}
|
||||
tk${TCL_TCLSH_VERSION}
|
||||
tk${TK_WISH_VERSION}
|
||||
tk87
|
||||
tk8.7
|
||||
tk87t
|
||||
tk8.7t
|
||||
tk86
|
||||
tk8.6
|
||||
tk86t
|
||||
tk8.6t
|
||||
tk85
|
||||
tk8.5
|
||||
tk84
|
||||
tk8.4
|
||||
tk83
|
||||
tk8.3
|
||||
tk82
|
||||
tk8.2
|
||||
tk80
|
||||
tk8.0
|
||||
)
|
||||
|
||||
if(NOT TK_LIBRARY)
|
||||
foreach(search ${_TCL_SEARCHES})
|
||||
find_library(
|
||||
TK_LIBRARY
|
||||
NAMES ${TK_POSSIBLE_LIB_NAMES}
|
||||
NAMES_PER_DIR
|
||||
${${search}}
|
||||
PATH_SUFFIXES ${TCLTK_POSSIBLE_LIB_PATH_SUFFIXES}
|
||||
)
|
||||
endforeach()
|
||||
endif()
|
||||
if(NOT TK_LIBRARY)
|
||||
find_library(
|
||||
TK_LIBRARY
|
||||
NAMES ${TK_POSSIBLE_LIB_NAMES}
|
||||
PATHS ${TCLTK_POSSIBLE_LIB_PATHS}
|
||||
PATH_SUFFIXES ${TCLTK_POSSIBLE_LIB_PATH_SUFFIXES}
|
||||
)
|
||||
endif(NOT TK_LIBRARY)
|
||||
|
||||
set(
|
||||
TK_STUB_POSSIBLE_LIB_NAMES
|
||||
tkstub
|
||||
tkstub${TCL_LIBRARY_VERSION}
|
||||
tkstub${TCL_TCLSH_VERSION}
|
||||
tkstub${TK_WISH_VERSION}
|
||||
tkstub87
|
||||
tkstub8.7
|
||||
tkstub86
|
||||
tkstub8.6
|
||||
tkstub85
|
||||
tkstub8.5
|
||||
tkstub84
|
||||
tkstub8.4
|
||||
tkstub83
|
||||
tkstub8.3
|
||||
tkstub82
|
||||
tkstub8.2
|
||||
tkstub80
|
||||
tkstub8.0
|
||||
)
|
||||
|
||||
if(NOT TK_STUB_LIBRARY)
|
||||
foreach(search ${_TCL_SEARCHES})
|
||||
find_library(
|
||||
TK_STUB_LIBRARY
|
||||
NAMES ${TK_STUB_POSSIBLE_LIB_NAMES}
|
||||
NAMES_PER_DIR
|
||||
${${search}}
|
||||
PATH_SUFFIXES ${TCLTK_POSSIBLE_LIB_PATH_SUFFIXES}
|
||||
)
|
||||
endforeach()
|
||||
endif()
|
||||
if(NOT TK_STUB_LIBRARY)
|
||||
find_library(TK_STUB_LIBRARY NAMES ${TK_STUB_POSSIBLE_LIB_NAMES} PATHS ${TCLTK_POSSIBLE_LIB_PATHS})
|
||||
endif()
|
||||
|
||||
set(
|
||||
TTK_STUB_POSSIBLE_LIB_NAMES
|
||||
ttkstub
|
||||
ttkstub${TCL_LIBRARY_VERSION}
|
||||
ttkstub${TCL_TCLSH_VERSION}
|
||||
ttkstub${TK_WISH_VERSION}
|
||||
ttkstub88
|
||||
ttkstub8.8
|
||||
ttkstub87
|
||||
ttkstub8.7
|
||||
ttkstub86
|
||||
ttkstub8.6
|
||||
ttkstub85
|
||||
ttkstub8.5
|
||||
)
|
||||
|
||||
if(NOT TTK_STUB_LIBRARY)
|
||||
foreach(search ${_TCL_SEARCHES})
|
||||
find_library(
|
||||
TTK_STUB_LIBRARY
|
||||
NAMES ${TTK_STUB_POSSIBLE_LIB_NAMES}
|
||||
NAMES_PER_DIR
|
||||
${${search}}
|
||||
PATH_SUFFIXES ${TCLTK_POSSIBLE_LIB_PATH_SUFFIXES}
|
||||
)
|
||||
endforeach()
|
||||
endif()
|
||||
if(NOT TTK_STUB_LIBRARY)
|
||||
find_library(TTK_STUB_LIBRARY NAMES ${TTK_STUB_POSSIBLE_LIB_NAMES} PATHS ${TCLTK_POSSIBLE_LIB_PATHS})
|
||||
endif()
|
||||
endif(TCL_ENABLE_TK)
|
||||
|
||||
set(
|
||||
TCLTK_POSSIBLE_INCLUDE_PATHS
|
||||
"${TCL_LIBRARY_PATH_PARENT}/include"
|
||||
"${TCL_INCLUDE_PATH}"
|
||||
"${TCL_TCLSH_PATH_PARENT}/include"
|
||||
)
|
||||
if(TCL_ENABLE_TK)
|
||||
set(
|
||||
TCLTK_POSSIBLE_INCLUDE_PATHS
|
||||
${TCLTK_POSSIBLE_INCLUDE_PATHS}
|
||||
"${TCL_LIBRARY_PATH_PARENT}/include"
|
||||
"${TCL_INCLUDE_PATH}"
|
||||
"${TCL_TCLSH_PATH_PARENT}/include"
|
||||
)
|
||||
endif(TCL_ENABLE_TK)
|
||||
|
||||
set(
|
||||
TCLTK_POSSIBLE_INCLUDE_PATH_SUFFIXES
|
||||
include
|
||||
include/tcl${TCL_LIBRARY_VERSION}
|
||||
include/tcl8.7
|
||||
include/tcl8.6
|
||||
include/tcl8.5
|
||||
include/tcl8.4
|
||||
include/tcl8.3
|
||||
include/tcl8.2
|
||||
include/tcl8.0
|
||||
)
|
||||
|
||||
if(TCL_ENABLE_TK)
|
||||
set(
|
||||
TCLTK_POSSIBLE_INCLUDE_PATH_SUFFIXES
|
||||
${TCLTK_POSSIBLE_INCLUDE_PATH_SUFFIXES}
|
||||
include/tcl${TK_LIBRARY_VERSION}
|
||||
include/tk8.7
|
||||
include/tk8.6
|
||||
include/tk8.5
|
||||
include/tk8.4
|
||||
)
|
||||
endif(TCL_ENABLE_TK)
|
||||
|
||||
foreach(search ${_TCL_SEARCHES})
|
||||
find_path(TCL_INCLUDE_PATH NAMES tcl.h ${${search}} PATH_SUFFIXES ${TCLTK_POSSIBLE_INCLUDE_PATH_SUFFIXES})
|
||||
endforeach()
|
||||
if(NOT TCL_INCLUDE_PATH)
|
||||
find_path(
|
||||
TCL_INCLUDE_PATH
|
||||
NAMES tcl.h
|
||||
HINTS ${TCLTK_POSSIBLE_INCLUDE_PATHS}
|
||||
PATH_SUFFIXES ${TCLTK_POSSIBLE_INCLUDE_PATH_SUFFIXES}
|
||||
)
|
||||
endif()
|
||||
|
||||
if(TCL_ENABLE_TK)
|
||||
foreach(search ${_TCL_SEARCHES})
|
||||
find_path(TK_INCLUDE_PATH NAMES tk.h ${${search}} PATH_SUFFIXES ${TCLTK_POSSIBLE_INCLUDE_PATH_SUFFIXES})
|
||||
endforeach()
|
||||
if(NOT TK_INCLUDE_PATH)
|
||||
find_path(
|
||||
TK_INCLUDE_PATH
|
||||
NAMES tk.h
|
||||
HINTS ${TCLTK_POSSIBLE_INCLUDE_PATHS}
|
||||
PATH_SUFFIXES ${TCLTK_POSSIBLE_INCLUDE_PATH_SUFFIXES}
|
||||
)
|
||||
endif()
|
||||
|
||||
# IFF we have TCL_TK_SYSTEM_GRAPHICS set and have a system TK_WISH, check that the
|
||||
# windowing system matches the specified type
|
||||
if(NOT "${TCL_TK_SYSTEM_GRAPHICS}" STREQUAL "" AND TK_WISH AND NOT TARGET "${TK_WISH}")
|
||||
set(
|
||||
tkwin_script
|
||||
"
|
||||
set filename \"${CMAKE_BINARY_DIR}/CMakeTmp/TK_WINDOWINGSYSTEM\"
|
||||
set fileId [open $filename \"w\"]
|
||||
set windowingsystem [tk windowingsystem]
|
||||
puts $fileId $windowingsystem
|
||||
close $fileId
|
||||
exit
|
||||
"
|
||||
)
|
||||
set(tkwin_scriptfile "${CMAKE_BINARY_DIR}/CMakeTmp/tk_windowingsystem.tcl")
|
||||
set(WSYS "wm-NOTFOUND")
|
||||
file(WRITE ${tkwin_scriptfile} ${tkwin_script})
|
||||
execute_process(COMMAND ${TK_WISH} ${tkwin_scriptfile} OUTPUT_VARIABLE EXECOUTPUT)
|
||||
if(EXISTS "${CMAKE_BINARY_DIR}/CMakeTmp/TK_WINDOWINGSYSTEM")
|
||||
file(READ "${CMAKE_BINARY_DIR}/CMakeTmp/TK_WINDOWINGSYSTEM" readresultvar)
|
||||
string(REGEX REPLACE "\n" "" WSYS "${readresultvar}")
|
||||
endif(EXISTS "${CMAKE_BINARY_DIR}/CMakeTmp/TK_WINDOWINGSYSTEM")
|
||||
|
||||
# If we have no information about the windowing system or it does not match
|
||||
# a specified system, the find_package detection has failed
|
||||
if(NOT "${WSYS}" STREQUAL "${TCL_TK_SYSTEM_GRAPHICS}")
|
||||
unset(TCL_LIBRARY CACHE)
|
||||
unset(TCL_STUB_LIBRARY CACHE)
|
||||
unset(TK_LIBRARY CACHE)
|
||||
unset(TK_STUB_LIBRARY CACHE)
|
||||
unset(TCL_FOUND CACHE)
|
||||
unset(TK_FOUND CACHE)
|
||||
unset(TCLTK_FOUND CACHE)
|
||||
unset(TCLSH_FOUND CACHE)
|
||||
unset(TCL_LIBRARY CACHE)
|
||||
unset(TCL_INCLUDE_PATH CACHE)
|
||||
unset(TCL_TCLSH CACHE)
|
||||
unset(TK_LIBRARY CACHE)
|
||||
unset(TK_INCLUDE_PATH CACHE)
|
||||
unset(TK_WISH CACHE)
|
||||
unset(TCL_STUB_LIBRARY CACHE)
|
||||
unset(TK_STUB_LIBRARY CACHE)
|
||||
unset(TTK_STUB_LIBRARY CACHE)
|
||||
endif(NOT "${WSYS}" STREQUAL "${TCL_TK_SYSTEM_GRAPHICS}")
|
||||
endif(NOT "${TCL_TK_SYSTEM_GRAPHICS}" STREQUAL "" AND TK_WISH AND NOT TARGET "${TK_WISH}")
|
||||
endif(TCL_ENABLE_TK)
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
|
||||
find_package_handle_standard_args(
|
||||
TCL
|
||||
REQUIRED_VARS TCL_LIBRARY TCL_STUB_LIBRARY TCL_INCLUDE_PATH TCL_TCLSH
|
||||
VERSION_VAR TCLSH_VERSION_STRING
|
||||
)
|
||||
|
||||
if(TCL_ENABLE_TK)
|
||||
set(FPHSA_NAME_MISMATCHED 1)
|
||||
set(TCLTK_FIND_REQUIRED ${TCL_FIND_REQUIRED})
|
||||
set(TCLTK_FIND_QUIETLY ${TCL_FIND_QUIETLY})
|
||||
find_package_handle_standard_args(
|
||||
TCLTK
|
||||
REQUIRED_VARS TCL_LIBRARY TCL_STUB_LIBRARY TCL_INCLUDE_PATH TK_LIBRARY TK_STUB_LIBRARY TK_INCLUDE_PATH
|
||||
)
|
||||
set(TK_FIND_REQUIRED ${TCL_FIND_REQUIRED})
|
||||
set(TK_FIND_QUIETLY ${TCL_FIND_QUIETLY})
|
||||
find_package_handle_standard_args(TK REQUIRED_VARS TK_LIBRARY TK_STUB_LIBRARY TK_INCLUDE_PATH TK_WISH)
|
||||
unset(FPHSA_NAME_MISMATCHED)
|
||||
endif(TCL_ENABLE_TK)
|
||||
|
||||
mark_as_advanced(
|
||||
TCL_INCLUDE_PATH
|
||||
TCL_LIBRARY
|
||||
TCL_STUB_LIBRARY
|
||||
TCL_TCLSH
|
||||
TK_INCLUDE_PATH
|
||||
TK_LIBRARY
|
||||
TK_STUB_LIBRARY
|
||||
TK_WISH
|
||||
TTK_STUB_LIBRARY
|
||||
)
|
||||
|
||||
# Local Variables:
|
||||
# tab-width: 8
|
||||
# mode: cmake
|
||||
# indent-tabs-mode: t
|
||||
# End:
|
||||
# ex: shiftwidth=2 tabstop=8
|
||||
@@ -0,0 +1,522 @@
|
||||
# Distributed under the OSI-approved BSD 3-Clause License.
|
||||
# See CMake's LICENSE.rst or https://cmake.org/licensing for details.
|
||||
#
|
||||
# BRL-CAD local variant:
|
||||
# - Based on the modern CMake FindZLIB module structure.
|
||||
# - Preserves BRL-CAD's custom zlib library names, including z_brl.
|
||||
# - Honors ZLIB_ROOT and ENV{ZLIB_ROOT} as installation-root hints.
|
||||
# - Keeps the traditional ZLIB::ZLIB target.
|
||||
# - Adds optional variant targets when they can be found:
|
||||
# ZLIB::ZLIB_SHARED
|
||||
# ZLIB::ZLIB_STATIC
|
||||
# ZLIB::ZLIBSTATIC (alias-compatible with upstream zlib's config package)
|
||||
#
|
||||
#[=======================================================================[.rst:
|
||||
FindZLIB
|
||||
--------
|
||||
|
||||
Finds the native zlib data compression library.
|
||||
|
||||
Imported Targets
|
||||
^^^^^^^^^^^^^^^^
|
||||
|
||||
This module provides the following imported targets, when found:
|
||||
|
||||
``ZLIB::ZLIB``
|
||||
Compatibility/default target that encapsulates the selected zlib usage
|
||||
requirements. Selection follows ``ZLIB_USE_STATIC_LIBS`` when set.
|
||||
|
||||
``ZLIB::ZLIB_SHARED``
|
||||
Shared zlib target, when a shared zlib library can be identified.
|
||||
|
||||
``ZLIB::ZLIB_STATIC``
|
||||
Static zlib target, when a static zlib library can be identified.
|
||||
|
||||
``ZLIB::ZLIBSTATIC``
|
||||
Alias to ``ZLIB::ZLIB_STATIC`` when the static target is available. This
|
||||
matches the target name used by zlib's own CMake package.
|
||||
|
||||
Result Variables
|
||||
^^^^^^^^^^^^^^^^
|
||||
|
||||
``ZLIB_FOUND``
|
||||
Boolean indicating whether zlib was found.
|
||||
|
||||
``ZLIB_VERSION``
|
||||
The version of zlib found.
|
||||
|
||||
``ZLIB_INCLUDE_DIRS``
|
||||
Include directories containing ``zlib.h`` and other headers needed to use
|
||||
zlib.
|
||||
|
||||
``ZLIB_LIBRARIES``
|
||||
List of libraries needed to link to the default/selected zlib.
|
||||
|
||||
``ZLIB_SHARED_FOUND``
|
||||
Boolean indicating whether a shared zlib library was found.
|
||||
|
||||
``ZLIB_STATIC_FOUND``
|
||||
Boolean indicating whether a static zlib library was found.
|
||||
|
||||
``ZLIB_SHARED_LIBRARIES``
|
||||
Shared zlib library or debug/optimized library list, when found.
|
||||
|
||||
``ZLIB_STATIC_LIBRARIES``
|
||||
Static zlib library or debug/optimized library list, when found.
|
||||
|
||||
Hints
|
||||
^^^^^
|
||||
|
||||
``ZLIB_ROOT``
|
||||
A user may set this variable to a zlib installation root.
|
||||
|
||||
``ENV{ZLIB_ROOT}``
|
||||
Environment-variable form of ``ZLIB_ROOT``.
|
||||
|
||||
``ZLIB_USE_STATIC_LIBS``
|
||||
Set to ``ON`` before calling ``find_package(ZLIB)`` to prefer static
|
||||
libraries for the compatibility/default ``ZLIB::ZLIB`` target.
|
||||
|
||||
``ZLIB_NAMES`` and ``ZLIB_NAMES_DEBUG``
|
||||
Optional project override for the default selected-library search names.
|
||||
|
||||
``ZLIB_SHARED_NAMES`` and ``ZLIB_SHARED_NAMES_DEBUG``
|
||||
Optional project override for shared-library search names.
|
||||
|
||||
``ZLIB_STATIC_NAMES`` and ``ZLIB_STATIC_NAMES_DEBUG``
|
||||
Optional project override for static-library search names.
|
||||
|
||||
The default name lists include BRL-CAD's custom ``z_brl`` name.
|
||||
#]=======================================================================]
|
||||
|
||||
cmake_policy(PUSH)
|
||||
if(POLICY CMP0159)
|
||||
cmake_policy(SET CMP0159 NEW) # file(STRINGS) with REGEX updates CMAKE_MATCH_<n>
|
||||
endif()
|
||||
|
||||
set(_ZLIB_SEARCHES)
|
||||
|
||||
# Search ZLIB_ROOT first if it is set. Support both a CMake variable and
|
||||
# an environment variable for command-line and packaged-build workflows.
|
||||
if(ZLIB_ROOT)
|
||||
set(_ZLIB_SEARCH_ROOT PATHS "${ZLIB_ROOT}" NO_DEFAULT_PATH)
|
||||
list(APPEND _ZLIB_SEARCHES _ZLIB_SEARCH_ROOT)
|
||||
elseif(DEFINED ENV{ZLIB_ROOT} AND NOT "$ENV{ZLIB_ROOT}" STREQUAL "")
|
||||
set(_ZLIB_SEARCH_ROOT PATHS "$ENV{ZLIB_ROOT}" NO_DEFAULT_PATH)
|
||||
list(APPEND _ZLIB_SEARCHES _ZLIB_SEARCH_ROOT)
|
||||
endif()
|
||||
|
||||
# Normal search.
|
||||
set(_ZLIB_x86 "(x86)")
|
||||
set(_ZLIB_SEARCH_NORMAL
|
||||
PATHS
|
||||
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\GnuWin32\\Zlib;InstallPath]"
|
||||
"$ENV{ProgramFiles}/zlib"
|
||||
"$ENV{ProgramFiles${_ZLIB_x86}}/zlib"
|
||||
)
|
||||
unset(_ZLIB_x86)
|
||||
list(APPEND _ZLIB_SEARCHES _ZLIB_SEARCH_NORMAL)
|
||||
|
||||
# BRL-CAD uses z_brl for its bundled zlib. Keep that name first so an
|
||||
# explicitly supplied root or local prefix finds the BRL-CAD build before a
|
||||
# generic system zlib.
|
||||
set(_ZLIB_DEFAULT_SHARED_NAMES
|
||||
z_brl
|
||||
z
|
||||
zlib
|
||||
zdll
|
||||
zlib1
|
||||
zlibstatic
|
||||
zlibwapi
|
||||
zlibvc
|
||||
zlibstat
|
||||
)
|
||||
set(_ZLIB_DEFAULT_SHARED_NAMES_DEBUG
|
||||
z_brld
|
||||
zd
|
||||
zlibd
|
||||
zdlld
|
||||
zlibd1
|
||||
zlib1d
|
||||
zlibstaticd
|
||||
zlibwapid
|
||||
zlibvcd
|
||||
zlibstatd
|
||||
)
|
||||
|
||||
set(_ZLIB_DEFAULT_STATIC_NAMES
|
||||
# On Windows the import library for the shared zlib and the static library
|
||||
# share the .lib suffix, so the static name must come first and be distinct
|
||||
# from the shared import lib (z_brl.lib) or find_library would pick the import
|
||||
# lib and keep the z_brl.dll runtime dependency. BRL-CAD's static zlib is
|
||||
# z_brl-static.lib.
|
||||
z_brl-static
|
||||
z_brl
|
||||
z_brl_static
|
||||
z_brlstatic
|
||||
zs
|
||||
zlibstatic
|
||||
zlibstat
|
||||
zlib
|
||||
z
|
||||
)
|
||||
set(_ZLIB_DEFAULT_STATIC_NAMES_DEBUG
|
||||
z_brld
|
||||
z_brld_static
|
||||
z_brldstatic
|
||||
zsd
|
||||
zlibstaticd
|
||||
zlibstatd
|
||||
zlibd
|
||||
zd
|
||||
)
|
||||
|
||||
if(NOT ZLIB_SHARED_NAMES)
|
||||
set(ZLIB_SHARED_NAMES ${_ZLIB_DEFAULT_SHARED_NAMES})
|
||||
endif()
|
||||
if(NOT ZLIB_SHARED_NAMES_DEBUG)
|
||||
set(ZLIB_SHARED_NAMES_DEBUG ${_ZLIB_DEFAULT_SHARED_NAMES_DEBUG})
|
||||
endif()
|
||||
|
||||
if(NOT ZLIB_STATIC_NAMES)
|
||||
set(ZLIB_STATIC_NAMES ${_ZLIB_DEFAULT_STATIC_NAMES})
|
||||
endif()
|
||||
if(NOT ZLIB_STATIC_NAMES_DEBUG)
|
||||
set(ZLIB_STATIC_NAMES_DEBUG ${_ZLIB_DEFAULT_STATIC_NAMES_DEBUG})
|
||||
endif()
|
||||
|
||||
if(NOT ZLIB_NAMES)
|
||||
if(ZLIB_USE_STATIC_LIBS)
|
||||
set(ZLIB_NAMES ${ZLIB_STATIC_NAMES})
|
||||
else()
|
||||
set(ZLIB_NAMES ${ZLIB_SHARED_NAMES})
|
||||
endif()
|
||||
endif()
|
||||
if(NOT ZLIB_NAMES_DEBUG)
|
||||
if(ZLIB_USE_STATIC_LIBS)
|
||||
set(ZLIB_NAMES_DEBUG ${ZLIB_STATIC_NAMES_DEBUG})
|
||||
else()
|
||||
set(ZLIB_NAMES_DEBUG ${ZLIB_SHARED_NAMES_DEBUG})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
foreach(search ${_ZLIB_SEARCHES})
|
||||
find_path(ZLIB_INCLUDE_DIR
|
||||
NAMES zlib.h
|
||||
${${search}}
|
||||
PATH_SUFFIXES include
|
||||
)
|
||||
endforeach()
|
||||
|
||||
function(_zlib_save_find_library_state)
|
||||
foreach(v CMAKE_FIND_LIBRARY_PREFIXES CMAKE_FIND_LIBRARY_SUFFIXES)
|
||||
if(DEFINED ${v})
|
||||
set(_zlib_ORIG_${v} "${${v}}" PARENT_SCOPE)
|
||||
set(_zlib_HAD_${v} TRUE PARENT_SCOPE)
|
||||
else()
|
||||
set(_zlib_ORIG_${v} PARENT_SCOPE)
|
||||
set(_zlib_HAD_${v} FALSE PARENT_SCOPE)
|
||||
endif()
|
||||
endforeach()
|
||||
endfunction()
|
||||
|
||||
macro(_zlib_restore_find_library_state)
|
||||
foreach(v CMAKE_FIND_LIBRARY_PREFIXES CMAKE_FIND_LIBRARY_SUFFIXES)
|
||||
if(_zlib_HAD_${v})
|
||||
set(${v} "${_zlib_ORIG_${v}}")
|
||||
else()
|
||||
unset(${v})
|
||||
endif()
|
||||
endforeach()
|
||||
endmacro()
|
||||
|
||||
function(_zlib_find_variant prefix libtype)
|
||||
set(options)
|
||||
set(oneValueArgs)
|
||||
set(multiValueArgs NAMES NAMES_DEBUG)
|
||||
cmake_parse_arguments(_ZLIB_FIND "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
|
||||
|
||||
_zlib_save_find_library_state()
|
||||
|
||||
# Support the MinGW/win32 Makefile.gcc build style.
|
||||
if(WIN32)
|
||||
list(APPEND CMAKE_FIND_LIBRARY_PREFIXES "" "lib")
|
||||
list(APPEND CMAKE_FIND_LIBRARY_SUFFIXES ".dll.a")
|
||||
endif()
|
||||
|
||||
if(libtype STREQUAL "STATIC")
|
||||
if(WIN32)
|
||||
set(CMAKE_FIND_LIBRARY_SUFFIXES .lib .a ${CMAKE_FIND_LIBRARY_SUFFIXES})
|
||||
else()
|
||||
set(CMAKE_FIND_LIBRARY_SUFFIXES .a)
|
||||
endif()
|
||||
elseif(libtype STREQUAL "SHARED")
|
||||
if(WIN32)
|
||||
# On Windows, shared zlib is normally discovered through an import
|
||||
# library. Distinguishing a .lib import library from a static .lib is
|
||||
# not reliable by suffix alone, so the name list does most of the work.
|
||||
set(CMAKE_FIND_LIBRARY_SUFFIXES .dll.a .lib ${CMAKE_FIND_LIBRARY_SUFFIXES})
|
||||
elseif(APPLE)
|
||||
set(CMAKE_FIND_LIBRARY_SUFFIXES .dylib .so ${CMAKE_FIND_LIBRARY_SUFFIXES})
|
||||
elseif(UNIX)
|
||||
set(CMAKE_FIND_LIBRARY_SUFFIXES .so ${CMAKE_FIND_LIBRARY_SUFFIXES})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
foreach(search ${_ZLIB_SEARCHES})
|
||||
find_library(${prefix}_LIBRARY_RELEASE
|
||||
NAMES ${_ZLIB_FIND_NAMES}
|
||||
NAMES_PER_DIR
|
||||
${${search}}
|
||||
PATH_SUFFIXES lib lib64
|
||||
)
|
||||
find_library(${prefix}_LIBRARY_DEBUG
|
||||
NAMES ${_ZLIB_FIND_NAMES_DEBUG}
|
||||
NAMES_PER_DIR
|
||||
${${search}}
|
||||
PATH_SUFFIXES lib lib64
|
||||
)
|
||||
endforeach()
|
||||
|
||||
_zlib_restore_find_library_state()
|
||||
|
||||
set(${prefix}_LIBRARY_RELEASE "${${prefix}_LIBRARY_RELEASE}" PARENT_SCOPE)
|
||||
set(${prefix}_LIBRARY_DEBUG "${${prefix}_LIBRARY_DEBUG}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
# Main/default search. Preserve CMake's behavior of allowing ZLIB_LIBRARY to
|
||||
# be set manually as the selected library.
|
||||
if(NOT ZLIB_LIBRARY)
|
||||
_zlib_find_variant(ZLIB UNKNOWN
|
||||
NAMES ${ZLIB_NAMES}
|
||||
NAMES_DEBUG ${ZLIB_NAMES_DEBUG}
|
||||
)
|
||||
|
||||
include(SelectLibraryConfigurations)
|
||||
select_library_configurations(ZLIB)
|
||||
endif()
|
||||
|
||||
# Variant searches. These do not override the selected/default ZLIB_LIBRARY.
|
||||
if(NOT ZLIB_SHARED_LIBRARY)
|
||||
_zlib_find_variant(ZLIB_SHARED SHARED
|
||||
NAMES ${ZLIB_SHARED_NAMES}
|
||||
NAMES_DEBUG ${ZLIB_SHARED_NAMES_DEBUG}
|
||||
)
|
||||
include(SelectLibraryConfigurations)
|
||||
select_library_configurations(ZLIB_SHARED)
|
||||
endif()
|
||||
|
||||
if(NOT ZLIB_STATIC_LIBRARY)
|
||||
_zlib_find_variant(ZLIB_STATIC STATIC
|
||||
NAMES ${ZLIB_STATIC_NAMES}
|
||||
NAMES_DEBUG ${ZLIB_STATIC_NAMES_DEBUG}
|
||||
)
|
||||
include(SelectLibraryConfigurations)
|
||||
select_library_configurations(ZLIB_STATIC)
|
||||
endif()
|
||||
|
||||
unset(ZLIB_NAMES)
|
||||
unset(ZLIB_NAMES_DEBUG)
|
||||
unset(_ZLIB_DEFAULT_SHARED_NAMES)
|
||||
unset(_ZLIB_DEFAULT_SHARED_NAMES_DEBUG)
|
||||
unset(_ZLIB_DEFAULT_STATIC_NAMES)
|
||||
unset(_ZLIB_DEFAULT_STATIC_NAMES_DEBUG)
|
||||
|
||||
mark_as_advanced(
|
||||
ZLIB_INCLUDE_DIR
|
||||
ZLIB_LIBRARY
|
||||
ZLIB_LIBRARY_RELEASE
|
||||
ZLIB_LIBRARY_DEBUG
|
||||
ZLIB_SHARED_LIBRARY
|
||||
ZLIB_SHARED_LIBRARY_RELEASE
|
||||
ZLIB_SHARED_LIBRARY_DEBUG
|
||||
ZLIB_STATIC_LIBRARY
|
||||
ZLIB_STATIC_LIBRARY_RELEASE
|
||||
ZLIB_STATIC_LIBRARY_DEBUG
|
||||
)
|
||||
|
||||
if(ZLIB_INCLUDE_DIR AND EXISTS "${ZLIB_INCLUDE_DIR}/zlib.h")
|
||||
file(STRINGS "${ZLIB_INCLUDE_DIR}/zlib.h" ZLIB_H
|
||||
REGEX "^#define ZLIB_VERSION \"[^\"]*\"$"
|
||||
)
|
||||
|
||||
if(ZLIB_H MATCHES "ZLIB_VERSION \"(([0-9]+)\\.([0-9]+)(\\.([0-9]+)(\\.([0-9]+))?)?)")
|
||||
set(ZLIB_VERSION_STRING "${CMAKE_MATCH_1}")
|
||||
set(ZLIB_VERSION_MAJOR "${CMAKE_MATCH_2}")
|
||||
set(ZLIB_VERSION_MINOR "${CMAKE_MATCH_3}")
|
||||
set(ZLIB_VERSION_PATCH "${CMAKE_MATCH_5}")
|
||||
set(ZLIB_VERSION_TWEAK "${CMAKE_MATCH_7}")
|
||||
else()
|
||||
set(ZLIB_VERSION_STRING "")
|
||||
set(ZLIB_VERSION_MAJOR "")
|
||||
set(ZLIB_VERSION_MINOR "")
|
||||
set(ZLIB_VERSION_PATCH "")
|
||||
set(ZLIB_VERSION_TWEAK "")
|
||||
endif()
|
||||
|
||||
set(ZLIB_MAJOR_VERSION "${ZLIB_VERSION_MAJOR}")
|
||||
set(ZLIB_MINOR_VERSION "${ZLIB_VERSION_MINOR}")
|
||||
set(ZLIB_PATCH_VERSION "${ZLIB_VERSION_PATCH}")
|
||||
set(ZLIB_VERSION "${ZLIB_VERSION_STRING}")
|
||||
endif()
|
||||
|
||||
set(ZLIB_SHARED_FOUND FALSE)
|
||||
if(ZLIB_INCLUDE_DIR AND ZLIB_SHARED_LIBRARY)
|
||||
set(ZLIB_SHARED_FOUND TRUE)
|
||||
set(ZLIB_SHARED_LIBRARIES ${ZLIB_SHARED_LIBRARY})
|
||||
endif()
|
||||
|
||||
set(ZLIB_STATIC_FOUND FALSE)
|
||||
if(ZLIB_INCLUDE_DIR AND ZLIB_STATIC_LIBRARY)
|
||||
set(ZLIB_STATIC_FOUND TRUE)
|
||||
set(ZLIB_STATIC_LIBRARIES ${ZLIB_STATIC_LIBRARY})
|
||||
endif()
|
||||
|
||||
# Component support:
|
||||
# find_package(ZLIB COMPONENTS shared)
|
||||
# find_package(ZLIB COMPONENTS static)
|
||||
#
|
||||
# The compatibility/no-component case keeps the classic single-result behavior.
|
||||
set(_ZLIB_REQUIRED_VARS ZLIB_LIBRARY ZLIB_INCLUDE_DIR)
|
||||
foreach(_zlib_component IN LISTS ZLIB_FIND_COMPONENTS)
|
||||
if(_zlib_component STREQUAL "shared")
|
||||
if(ZLIB_SHARED_FOUND)
|
||||
set(ZLIB_shared_FOUND TRUE)
|
||||
else()
|
||||
set(ZLIB_shared_FOUND FALSE)
|
||||
endif()
|
||||
list(APPEND _ZLIB_REQUIRED_VARS ZLIB_SHARED_LIBRARY)
|
||||
elseif(_zlib_component STREQUAL "static")
|
||||
if(ZLIB_STATIC_FOUND)
|
||||
set(ZLIB_static_FOUND TRUE)
|
||||
else()
|
||||
set(ZLIB_static_FOUND FALSE)
|
||||
endif()
|
||||
list(APPEND _ZLIB_REQUIRED_VARS ZLIB_STATIC_LIBRARY)
|
||||
else()
|
||||
set(ZLIB_${_zlib_component}_FOUND FALSE)
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(ZLIB
|
||||
REQUIRED_VARS ${_ZLIB_REQUIRED_VARS}
|
||||
VERSION_VAR ZLIB_VERSION
|
||||
HANDLE_COMPONENTS
|
||||
)
|
||||
|
||||
if(ZLIB_FOUND)
|
||||
set(ZLIB_INCLUDE_DIRS ${ZLIB_INCLUDE_DIR})
|
||||
|
||||
if(NOT ZLIB_LIBRARIES)
|
||||
set(ZLIB_LIBRARIES ${ZLIB_LIBRARY})
|
||||
endif()
|
||||
|
||||
if(ZLIB_SHARED_FOUND AND NOT TARGET ZLIB::ZLIB_SHARED)
|
||||
add_library(ZLIB::ZLIB_SHARED UNKNOWN IMPORTED)
|
||||
set_target_properties(ZLIB::ZLIB_SHARED PROPERTIES
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${ZLIB_INCLUDE_DIRS}"
|
||||
IMPORTED_NO_SYSTEM TRUE
|
||||
)
|
||||
|
||||
if(ZLIB_SHARED_LIBRARY_RELEASE)
|
||||
set_property(TARGET ZLIB::ZLIB_SHARED APPEND PROPERTY
|
||||
IMPORTED_CONFIGURATIONS RELEASE
|
||||
)
|
||||
set_target_properties(ZLIB::ZLIB_SHARED PROPERTIES
|
||||
IMPORTED_LOCATION_RELEASE "${ZLIB_SHARED_LIBRARY_RELEASE}"
|
||||
)
|
||||
endif()
|
||||
|
||||
if(ZLIB_SHARED_LIBRARY_DEBUG)
|
||||
set_property(TARGET ZLIB::ZLIB_SHARED APPEND PROPERTY
|
||||
IMPORTED_CONFIGURATIONS DEBUG
|
||||
)
|
||||
set_target_properties(ZLIB::ZLIB_SHARED PROPERTIES
|
||||
IMPORTED_LOCATION_DEBUG "${ZLIB_SHARED_LIBRARY_DEBUG}"
|
||||
)
|
||||
endif()
|
||||
|
||||
if(NOT ZLIB_SHARED_LIBRARY_RELEASE AND NOT ZLIB_SHARED_LIBRARY_DEBUG)
|
||||
set_target_properties(ZLIB::ZLIB_SHARED PROPERTIES
|
||||
IMPORTED_LOCATION "${ZLIB_SHARED_LIBRARY}"
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(ZLIB_STATIC_FOUND AND NOT TARGET ZLIB::ZLIB_STATIC)
|
||||
add_library(ZLIB::ZLIB_STATIC STATIC IMPORTED)
|
||||
set_target_properties(ZLIB::ZLIB_STATIC PROPERTIES
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${ZLIB_INCLUDE_DIRS}"
|
||||
IMPORTED_NO_SYSTEM TRUE
|
||||
)
|
||||
|
||||
if(ZLIB_STATIC_LIBRARY_RELEASE)
|
||||
set_property(TARGET ZLIB::ZLIB_STATIC APPEND PROPERTY
|
||||
IMPORTED_CONFIGURATIONS RELEASE
|
||||
)
|
||||
set_target_properties(ZLIB::ZLIB_STATIC PROPERTIES
|
||||
IMPORTED_LOCATION_RELEASE "${ZLIB_STATIC_LIBRARY_RELEASE}"
|
||||
)
|
||||
endif()
|
||||
|
||||
if(ZLIB_STATIC_LIBRARY_DEBUG)
|
||||
set_property(TARGET ZLIB::ZLIB_STATIC APPEND PROPERTY
|
||||
IMPORTED_CONFIGURATIONS DEBUG
|
||||
)
|
||||
set_target_properties(ZLIB::ZLIB_STATIC PROPERTIES
|
||||
IMPORTED_LOCATION_DEBUG "${ZLIB_STATIC_LIBRARY_DEBUG}"
|
||||
)
|
||||
endif()
|
||||
|
||||
if(NOT ZLIB_STATIC_LIBRARY_RELEASE AND NOT ZLIB_STATIC_LIBRARY_DEBUG)
|
||||
set_target_properties(ZLIB::ZLIB_STATIC PROPERTIES
|
||||
IMPORTED_LOCATION "${ZLIB_STATIC_LIBRARY}"
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(TARGET ZLIB::ZLIB_STATIC AND NOT TARGET ZLIB::ZLIBSTATIC)
|
||||
add_library(ZLIB::ZLIBSTATIC ALIAS ZLIB::ZLIB_STATIC)
|
||||
endif()
|
||||
|
||||
if(NOT TARGET ZLIB::ZLIB)
|
||||
add_library(ZLIB::ZLIB UNKNOWN IMPORTED)
|
||||
set_target_properties(ZLIB::ZLIB PROPERTIES
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${ZLIB_INCLUDE_DIRS}"
|
||||
IMPORTED_NO_SYSTEM TRUE
|
||||
)
|
||||
|
||||
if(ZLIB_LIBRARY_RELEASE)
|
||||
set_property(TARGET ZLIB::ZLIB APPEND PROPERTY
|
||||
IMPORTED_CONFIGURATIONS RELEASE
|
||||
)
|
||||
set_target_properties(ZLIB::ZLIB PROPERTIES
|
||||
IMPORTED_LOCATION_RELEASE "${ZLIB_LIBRARY_RELEASE}"
|
||||
)
|
||||
endif()
|
||||
|
||||
if(ZLIB_LIBRARY_DEBUG)
|
||||
set_property(TARGET ZLIB::ZLIB APPEND PROPERTY
|
||||
IMPORTED_CONFIGURATIONS DEBUG
|
||||
)
|
||||
set_target_properties(ZLIB::ZLIB PROPERTIES
|
||||
IMPORTED_LOCATION_DEBUG "${ZLIB_LIBRARY_DEBUG}"
|
||||
)
|
||||
endif()
|
||||
|
||||
if(NOT ZLIB_LIBRARY_RELEASE AND NOT ZLIB_LIBRARY_DEBUG)
|
||||
set_target_properties(ZLIB::ZLIB PROPERTIES
|
||||
IMPORTED_LOCATION "${ZLIB_LIBRARY}"
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
unset(_ZLIB_REQUIRED_VARS)
|
||||
unset(_zlib_component)
|
||||
unset(_ZLIB_SEARCHES)
|
||||
unset(_ZLIB_SEARCH_ROOT)
|
||||
unset(_ZLIB_SEARCH_NORMAL)
|
||||
|
||||
cmake_policy(POP)
|
||||
@@ -0,0 +1,72 @@
|
||||
if (NOT DEFINED BEXT_SOURCE_DIR)
|
||||
message(FATAL_ERROR "BEXT_SOURCE_DIR is required")
|
||||
endif()
|
||||
if (NOT DEFINED BEXT_DOC_MODE)
|
||||
set(BEXT_DOC_MODE CHECK)
|
||||
endif()
|
||||
|
||||
include("${BEXT_SOURCE_DIR}/CMake/BextDependencyInventory.cmake")
|
||||
bext_collect_dependency_inventory("${BEXT_SOURCE_DIR}")
|
||||
|
||||
set(generated "<!-- BEGIN GENERATED PROJECT TABLE -->\n")
|
||||
string(APPEND generated "<!-- Generated by CMake/GenerateDependencyDocs.cmake; do not edit this block. -->\n")
|
||||
string(APPEND generated "| Project | `USE_*` group(s) | Output | Dependencies | Source |\n")
|
||||
string(APPEND generated "| --- | --- | --- | --- | --- |\n")
|
||||
foreach(project ${BEXT_INVENTORY_PROJECTS})
|
||||
bext_inventory_get(groups "${project}" GROUPS)
|
||||
bext_inventory_get(output_class "${project}" OUTPUT)
|
||||
bext_inventory_get(deps "${project}" DEPS)
|
||||
bext_inventory_get(urls "${project}" SOURCE_URLS)
|
||||
if (groups STREQUAL "always considered")
|
||||
set(group_text "always considered")
|
||||
else()
|
||||
set(group_text "")
|
||||
foreach(group ${groups})
|
||||
if (group_text)
|
||||
string(APPEND group_text ", ")
|
||||
endif()
|
||||
string(APPEND group_text "`USE_${group}`")
|
||||
endforeach()
|
||||
endif()
|
||||
if (deps)
|
||||
set(dep_text "")
|
||||
foreach(dep ${deps})
|
||||
if (dep_text)
|
||||
string(APPEND dep_text ", ")
|
||||
endif()
|
||||
string(APPEND dep_text "`${dep}`")
|
||||
endforeach()
|
||||
else()
|
||||
set(dep_text "—")
|
||||
endif()
|
||||
list(GET urls 0 primary_url)
|
||||
string(APPEND generated "| `${project}` | ${group_text} | `${output_class}` | ${dep_text} | [repository](${primary_url}) |\n")
|
||||
endforeach()
|
||||
string(APPEND generated "<!-- END GENERATED PROJECT TABLE -->")
|
||||
|
||||
set(doc "${BEXT_SOURCE_DIR}/DEPENDENCIES.md")
|
||||
file(READ "${doc}" current)
|
||||
set(begin "<!-- BEGIN GENERATED PROJECT TABLE -->")
|
||||
set(end "<!-- END GENERATED PROJECT TABLE -->")
|
||||
string(FIND "${current}" "${begin}" begin_pos)
|
||||
string(FIND "${current}" "${end}" end_pos)
|
||||
if (begin_pos EQUAL -1 OR end_pos EQUAL -1 OR end_pos LESS begin_pos)
|
||||
message(FATAL_ERROR "DEPENDENCIES.md is missing generated table markers")
|
||||
endif()
|
||||
string(LENGTH "${end}" end_len)
|
||||
math(EXPR suffix_pos "${end_pos} + ${end_len}")
|
||||
string(SUBSTRING "${current}" 0 ${begin_pos} prefix)
|
||||
string(SUBSTRING "${current}" ${suffix_pos} -1 suffix)
|
||||
set(expected "${prefix}${generated}${suffix}")
|
||||
|
||||
if (BEXT_DOC_MODE STREQUAL "WRITE")
|
||||
file(WRITE "${doc}" "${expected}")
|
||||
message(STATUS "Updated ${doc}")
|
||||
elseif(BEXT_DOC_MODE STREQUAL "CHECK")
|
||||
if (NOT current STREQUAL expected)
|
||||
message(FATAL_ERROR "DEPENDENCIES.md is stale; run the update_dependency_docs target")
|
||||
endif()
|
||||
message(STATUS "Dependency metadata and DEPENDENCIES.md are valid")
|
||||
else()
|
||||
message(FATAL_ERROR "Unknown BEXT_DOC_MODE ${BEXT_DOC_MODE}; expected CHECK or WRITE")
|
||||
endif()
|
||||
@@ -0,0 +1,541 @@
|
||||
if (NOT DEFINED BEXT_SOURCE_DIR)
|
||||
message(FATAL_ERROR "BEXT_SOURCE_DIR is required")
|
||||
endif ()
|
||||
|
||||
if (NOT DEFINED BEXT_BINARY_DIR)
|
||||
message(FATAL_ERROR "BEXT_BINARY_DIR is required")
|
||||
endif ()
|
||||
|
||||
set(graph_dot "${BEXT_BINARY_DIR}/bext.dot")
|
||||
set(graph_svg "${BEXT_BINARY_DIR}/bext.svg")
|
||||
|
||||
function(_bext_graph_normalize_id out raw_value)
|
||||
string(TOLOWER "${raw_value}" normalized)
|
||||
string(REPLACE "_" "-" normalized "${normalized}")
|
||||
set(${out} "${normalized}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
function(_bext_graph_key out raw_value)
|
||||
string(REGEX REPLACE "[^A-Za-z0-9]" "_" key "${raw_value}")
|
||||
set(${out} "${key}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
function(_bext_graph_set prefix node_id value)
|
||||
_bext_graph_key(prop_key "${node_id}")
|
||||
set_property(GLOBAL PROPERTY "${prefix}_${prop_key}" "${value}")
|
||||
endfunction()
|
||||
|
||||
function(_bext_graph_get out prefix node_id)
|
||||
_bext_graph_key(prop_key "${node_id}")
|
||||
get_property(prop_value GLOBAL PROPERTY "${prefix}_${prop_key}")
|
||||
set(${out} "${prop_value}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
function(_bext_graph_append prefix node_id value)
|
||||
_bext_graph_key(prop_key "${node_id}")
|
||||
get_property(prop_values GLOBAL PROPERTY "${prefix}_${prop_key}")
|
||||
list(APPEND prop_values "${value}")
|
||||
list(REMOVE_DUPLICATES prop_values)
|
||||
set_property(GLOBAL PROPERTY "${prefix}_${prop_key}" "${prop_values}")
|
||||
endfunction()
|
||||
|
||||
function(_bext_graph_get_list out prefix node_id)
|
||||
_bext_graph_key(prop_key "${node_id}")
|
||||
get_property(prop_values GLOBAL PROPERTY "${prefix}_${prop_key}")
|
||||
set(${out} "${prop_values}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
function(_bext_graph_quote out value)
|
||||
string(REPLACE "\"" "\\\"" escaped "${value}")
|
||||
set(${out} "\"${escaped}\"" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
function(_bext_graph_label out value)
|
||||
string(REPLACE "-" " " label_text "${value}")
|
||||
set(${out} "${label_text}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
function(_bext_graph_xml_escape out value)
|
||||
string(REPLACE "&" "&" escaped "${value}")
|
||||
string(REPLACE "<" "<" escaped "${escaped}")
|
||||
string(REPLACE ">" ">" escaped "${escaped}")
|
||||
string(REPLACE "\"" """ escaped "${escaped}")
|
||||
set(${out} "${escaped}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
function(_bext_graph_write_line)
|
||||
cmake_parse_arguments(ARG "" "TEXT" "" ${ARGN})
|
||||
file(APPEND "${graph_dot}" "${ARG_TEXT}\n")
|
||||
endfunction()
|
||||
|
||||
function(_bext_graph_color_by_depth out_fill out_outline out_font out_outline_font depth output_class)
|
||||
set(strong_colors "#2563eb" "#0f766e" "#65a30d" "#d97706" "#dc2626" "#9333ea" "#0891b2" "#4f46e5")
|
||||
set(pale_colors "#dbeafe" "#ccfbf1" "#ecfccb" "#ffedd5" "#fee2e2" "#f3e8ff" "#cffafe" "#e0e7ff")
|
||||
set(strong_fonts "#ffffff" "#ffffff" "#111827" "#111827" "#ffffff" "#ffffff" "#111827" "#ffffff")
|
||||
math(EXPR palette_index "(${depth} - 1) % 8")
|
||||
list(GET strong_colors ${palette_index} strong_fill)
|
||||
list(GET pale_colors ${palette_index} pale_fill)
|
||||
list(GET strong_fonts ${palette_index} strong_font)
|
||||
if ("${output_class}" STREQUAL "noinstall")
|
||||
set(${out_fill} "${pale_fill}" PARENT_SCOPE)
|
||||
set(${out_outline} "${strong_fill}" PARENT_SCOPE)
|
||||
set(${out_font} "${strong_fill}" PARENT_SCOPE)
|
||||
set(${out_outline_font} "${strong_fill}" PARENT_SCOPE)
|
||||
else ()
|
||||
set(${out_fill} "${strong_fill}" PARENT_SCOPE)
|
||||
set(${out_outline} "${strong_fill}" PARENT_SCOPE)
|
||||
set(${out_font} "${strong_font}" PARENT_SCOPE)
|
||||
set(${out_outline_font} "${strong_fill}" PARENT_SCOPE)
|
||||
endif ()
|
||||
endfunction()
|
||||
|
||||
function(_bext_graph_find_submodule_url out project_name submodule_path)
|
||||
set(search_path "${project_name}/${submodule_path}")
|
||||
list(LENGTH submodule_path_entries submodule_count)
|
||||
if (submodule_count GREATER 0)
|
||||
math(EXPR last_index "${submodule_count} - 1")
|
||||
foreach(idx RANGE 0 ${last_index})
|
||||
list(GET submodule_path_entries ${idx} entry)
|
||||
string(REPLACE "|" ";" parts "${entry}")
|
||||
list(GET parts 0 entry_path)
|
||||
list(GET parts 1 entry_url)
|
||||
if ("${entry_path}" STREQUAL "${search_path}")
|
||||
set(${out} "${entry_url}" PARENT_SCOPE)
|
||||
return()
|
||||
endif ()
|
||||
endforeach ()
|
||||
endif ()
|
||||
set(${out} "" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
file(STRINGS "${BEXT_SOURCE_DIR}/.gitmodules" gitmodule_lines)
|
||||
set(current_submodule_path "")
|
||||
foreach(line ${gitmodule_lines})
|
||||
string(STRIP "${line}" stripped_line)
|
||||
if (stripped_line MATCHES "^path = (.+)$")
|
||||
set(current_submodule_path "${CMAKE_MATCH_1}")
|
||||
endif ()
|
||||
if (stripped_line MATCHES "^url = (.+)$")
|
||||
if (current_submodule_path)
|
||||
list(APPEND submodule_path_entries "${current_submodule_path}|${CMAKE_MATCH_1}")
|
||||
set(current_submodule_path "")
|
||||
endif ()
|
||||
endif ()
|
||||
endforeach()
|
||||
|
||||
file(STRINGS "${BEXT_SOURCE_DIR}/CMakeLists.txt" top_level_lines)
|
||||
|
||||
set(project_ids)
|
||||
set(actual_edges)
|
||||
set(all_dep_ids)
|
||||
foreach(line ${top_level_lines})
|
||||
string(STRIP "${line}" stripped_line)
|
||||
if (stripped_line MATCHES "^#")
|
||||
continue()
|
||||
endif ()
|
||||
if (NOT stripped_line MATCHES "^add_project\\(([^ \t\\)]+)")
|
||||
continue()
|
||||
endif ()
|
||||
|
||||
set(project_name "${CMAKE_MATCH_1}")
|
||||
_bext_graph_normalize_id(project_id "${project_name}")
|
||||
list(APPEND project_ids "${project_id}")
|
||||
_bext_graph_set(NODE_LABEL "${project_id}" "${project_name}")
|
||||
_bext_graph_set(NODE_CLASS "${project_id}" "install")
|
||||
|
||||
set(project_cmakelists "${BEXT_SOURCE_DIR}/${project_name}/CMakeLists.txt")
|
||||
file(READ "${project_cmakelists}" project_text)
|
||||
if (project_text MATCHES "CMAKE_INSTALL_PREFIX=\\$\\{CMAKE_NOBUNDLE_INSTALL_PREFIX\\}" OR
|
||||
project_text MATCHES "--prefix=\\$\\{CMAKE_NOBUNDLE_INSTALL_PREFIX\\}")
|
||||
_bext_graph_set(NODE_CLASS "${project_id}" "noinstall")
|
||||
endif ()
|
||||
|
||||
set(depfile "${BEXT_SOURCE_DIR}/${project_name}/${project_name}.deps")
|
||||
if (EXISTS "${depfile}")
|
||||
file(STRINGS "${depfile}" dep_lines)
|
||||
foreach(dep_line ${dep_lines})
|
||||
string(STRIP "${dep_line}" dep_name)
|
||||
if (NOT dep_name)
|
||||
continue()
|
||||
endif ()
|
||||
_bext_graph_normalize_id(dep_id "${dep_name}")
|
||||
list(APPEND actual_edges "${project_id}|${dep_id}")
|
||||
list(APPEND all_dep_ids "${dep_id}")
|
||||
_bext_graph_get(dep_label NODE_LABEL "${dep_id}")
|
||||
if (NOT dep_label)
|
||||
string(TOLOWER "${dep_name}" dep_label_text)
|
||||
_bext_graph_set(NODE_LABEL "${dep_id}" "${dep_label_text}")
|
||||
endif ()
|
||||
endforeach ()
|
||||
endif ()
|
||||
|
||||
file(STRINGS "${project_cmakelists}" project_lines)
|
||||
foreach(project_line ${project_lines})
|
||||
string(STRIP "${project_line}" stripped_project_line)
|
||||
if (stripped_project_line MATCHES "git_submodule_init\\(([A-Za-z0-9_+./-]+)[ \t]")
|
||||
list(APPEND submodule_paths "${CMAKE_MATCH_1}")
|
||||
endif ()
|
||||
if (stripped_project_line MATCHES "ExternalProject_Add\\(([A-Za-z0-9_]+)_BLD")
|
||||
_bext_graph_normalize_id(provider_id "${CMAKE_MATCH_1}")
|
||||
list(APPEND provider_ids "${provider_id}")
|
||||
endif ()
|
||||
endforeach ()
|
||||
list(REMOVE_DUPLICATES submodule_paths)
|
||||
list(REMOVE_DUPLICATES provider_ids)
|
||||
if (submodule_paths)
|
||||
_bext_graph_set(PROJECT_SUBMODULE_PATHS "${project_id}" "${submodule_paths}")
|
||||
endif ()
|
||||
if (provider_ids)
|
||||
_bext_graph_set(PROJECT_PROVIDER_IDS "${project_id}" "${provider_ids}")
|
||||
endif ()
|
||||
unset(submodule_paths)
|
||||
unset(provider_ids)
|
||||
endforeach()
|
||||
|
||||
list(REMOVE_DUPLICATES project_ids)
|
||||
list(SORT project_ids)
|
||||
list(REMOVE_DUPLICATES actual_edges)
|
||||
list(REMOVE_DUPLICATES all_dep_ids)
|
||||
|
||||
set(alias_ids)
|
||||
foreach(dep_id ${all_dep_ids})
|
||||
list(FIND project_ids "${dep_id}" project_idx)
|
||||
if (project_idx EQUAL -1)
|
||||
list(APPEND alias_ids "${dep_id}")
|
||||
endif ()
|
||||
endforeach()
|
||||
list(REMOVE_DUPLICATES alias_ids)
|
||||
list(SORT alias_ids)
|
||||
|
||||
set(provider_edges)
|
||||
foreach(project_id ${project_ids})
|
||||
_bext_graph_get(project_name NODE_LABEL "${project_id}")
|
||||
_bext_graph_get(project_submodule_paths PROJECT_SUBMODULE_PATHS "${project_id}")
|
||||
foreach(submodule_path ${project_submodule_paths})
|
||||
_bext_graph_find_submodule_url(project_url "${project_name}" "${submodule_path}")
|
||||
if (project_url)
|
||||
_bext_graph_set(NODE_URL "${project_id}" "${project_url}")
|
||||
break()
|
||||
endif ()
|
||||
endforeach ()
|
||||
|
||||
_bext_graph_get(provider_ids PROJECT_PROVIDER_IDS "${project_id}")
|
||||
foreach(provider_id ${provider_ids})
|
||||
list(FIND alias_ids "${provider_id}" alias_idx)
|
||||
if (alias_idx EQUAL -1)
|
||||
continue()
|
||||
endif ()
|
||||
list(APPEND provider_edges "${project_id}|${provider_id}")
|
||||
_bext_graph_get(alias_url NODE_URL "${provider_id}")
|
||||
if (NOT alias_url)
|
||||
foreach(submodule_path ${project_submodule_paths})
|
||||
get_filename_component(submodule_name "${submodule_path}" NAME)
|
||||
_bext_graph_normalize_id(submodule_id "${submodule_name}")
|
||||
if ("${submodule_id}" STREQUAL "${provider_id}")
|
||||
_bext_graph_find_submodule_url(alias_url_candidate "${project_name}" "${submodule_path}")
|
||||
if (alias_url_candidate)
|
||||
_bext_graph_set(NODE_URL "${provider_id}" "${alias_url_candidate}")
|
||||
break()
|
||||
endif ()
|
||||
endif ()
|
||||
endforeach ()
|
||||
endif ()
|
||||
_bext_graph_get(alias_class NODE_CLASS "${provider_id}")
|
||||
if (NOT alias_class)
|
||||
_bext_graph_get(project_class NODE_CLASS "${project_id}")
|
||||
_bext_graph_set(NODE_CLASS "${provider_id}" "${project_class}")
|
||||
endif ()
|
||||
endforeach ()
|
||||
endforeach()
|
||||
list(REMOVE_DUPLICATES provider_edges)
|
||||
list(SORT provider_edges)
|
||||
|
||||
set(node_ids ${project_ids} ${alias_ids})
|
||||
list(REMOVE_DUPLICATES node_ids)
|
||||
list(SORT node_ids)
|
||||
|
||||
set(incoming_project_targets)
|
||||
foreach(edge ${actual_edges})
|
||||
string(REPLACE "|" ";" edge_parts "${edge}")
|
||||
list(GET edge_parts 0 edge_src)
|
||||
list(GET edge_parts 1 edge_dst)
|
||||
list(FIND project_ids "${edge_dst}" dst_project_idx)
|
||||
if (NOT dst_project_idx EQUAL -1)
|
||||
list(APPEND incoming_project_targets "${edge_dst}")
|
||||
endif ()
|
||||
endforeach()
|
||||
list(REMOVE_DUPLICATES incoming_project_targets)
|
||||
|
||||
set(entry_project_ids)
|
||||
foreach(project_id ${project_ids})
|
||||
list(FIND incoming_project_targets "${project_id}" incoming_idx)
|
||||
if (incoming_idx EQUAL -1)
|
||||
list(APPEND entry_project_ids "${project_id}")
|
||||
endif ()
|
||||
endforeach()
|
||||
list(SORT entry_project_ids)
|
||||
|
||||
set(active_nodes ${entry_project_ids})
|
||||
foreach(project_id ${entry_project_ids})
|
||||
_bext_graph_set(NODE_DEPTH "${project_id}" "1")
|
||||
endforeach()
|
||||
|
||||
set(changed TRUE)
|
||||
while (changed)
|
||||
set(changed FALSE)
|
||||
foreach(edge ${actual_edges})
|
||||
string(REPLACE "|" ";" edge_parts "${edge}")
|
||||
list(GET edge_parts 0 edge_src)
|
||||
list(GET edge_parts 1 edge_dst)
|
||||
_bext_graph_get(src_depth NODE_DEPTH "${edge_src}")
|
||||
if (NOT src_depth)
|
||||
continue()
|
||||
endif ()
|
||||
math(EXPR candidate_depth "${src_depth} + 1")
|
||||
_bext_graph_get(dst_depth NODE_DEPTH "${edge_dst}")
|
||||
if (NOT dst_depth OR candidate_depth LESS dst_depth)
|
||||
_bext_graph_set(NODE_DEPTH "${edge_dst}" "${candidate_depth}")
|
||||
set(changed TRUE)
|
||||
endif ()
|
||||
endforeach ()
|
||||
endwhile ()
|
||||
|
||||
foreach(node_id ${node_ids})
|
||||
_bext_graph_get(node_depth NODE_DEPTH "${node_id}")
|
||||
if (NOT node_depth)
|
||||
_bext_graph_set(NODE_DEPTH "${node_id}" "1")
|
||||
endif ()
|
||||
endforeach()
|
||||
|
||||
set(max_depth 1)
|
||||
foreach(node_id ${node_ids})
|
||||
_bext_graph_get(node_depth NODE_DEPTH "${node_id}")
|
||||
if (node_depth GREATER max_depth)
|
||||
set(max_depth "${node_depth}")
|
||||
endif ()
|
||||
endforeach()
|
||||
|
||||
file(WRITE "${graph_dot}" "digraph Deps {\n")
|
||||
_bext_graph_write_line(TEXT " graph [rankdir=LR, overlap=false, splines=true];")
|
||||
_bext_graph_write_line(TEXT " node [shape=box, style=bold, fontname=\"Helvetica\", penwidth=2.0, margin=\"0.12,0.06\"];")
|
||||
_bext_graph_write_line(TEXT " edge [color=\"#6b7280\", arrowsize=0.7, penwidth=1.4];")
|
||||
_bext_graph_write_line(TEXT "")
|
||||
|
||||
_bext_graph_write_line(TEXT " \"BRL_CAD\" [label=\"BRL-CAD\", URL=\"https://github.com/BRL-CAD/brlcad\", style=\"filled,bold\", fillcolor=\"#111827\", color=\"#111827\", fontcolor=\"#ffffff\", penwidth=2.4];")
|
||||
_bext_graph_write_line(TEXT "")
|
||||
|
||||
foreach(depth RANGE 1 ${max_depth})
|
||||
set(depth_nodes)
|
||||
foreach(node_id ${node_ids})
|
||||
_bext_graph_get(node_depth NODE_DEPTH "${node_id}")
|
||||
if ("${node_depth}" STREQUAL "${depth}")
|
||||
list(APPEND depth_nodes "${node_id}")
|
||||
endif ()
|
||||
endforeach ()
|
||||
if (depth_nodes)
|
||||
list(SORT depth_nodes)
|
||||
_bext_graph_write_line(TEXT " { rank=same;")
|
||||
foreach(node_id ${depth_nodes})
|
||||
_bext_graph_get(node_label NODE_LABEL "${node_id}")
|
||||
_bext_graph_get(node_class NODE_CLASS "${node_id}")
|
||||
_bext_graph_get(node_url NODE_URL "${node_id}")
|
||||
_bext_graph_color_by_depth(node_fill node_outline node_font node_outline_font "${depth}" "${node_class}")
|
||||
_bext_graph_quote(node_name_q "${node_id}")
|
||||
_bext_graph_quote(node_label_q "${node_label}")
|
||||
if (node_url)
|
||||
_bext_graph_quote(node_url_q "${node_url}")
|
||||
set(url_attr ", URL=${node_url_q}")
|
||||
else ()
|
||||
set(url_attr "")
|
||||
endif ()
|
||||
if ("${node_class}" STREQUAL "noinstall")
|
||||
set(node_style "filled,bold")
|
||||
else ()
|
||||
set(node_style "filled,bold")
|
||||
endif ()
|
||||
_bext_graph_write_line(TEXT " ${node_name_q} [label=${node_label_q}, style=\"${node_style}\", fillcolor=\"${node_fill}\", color=\"${node_outline}\", fontcolor=\"${node_font}\"${url_attr}];")
|
||||
endforeach ()
|
||||
_bext_graph_write_line(TEXT " }")
|
||||
_bext_graph_write_line(TEXT "")
|
||||
endif ()
|
||||
endforeach ()
|
||||
|
||||
foreach(entry_project_id ${entry_project_ids})
|
||||
_bext_graph_quote(entry_q "${entry_project_id}")
|
||||
_bext_graph_write_line(TEXT " \"BRL_CAD\" -> ${entry_q} [color=\"#9ca3af\", penwidth=1.6];")
|
||||
endforeach ()
|
||||
if (entry_project_ids)
|
||||
_bext_graph_write_line(TEXT "")
|
||||
endif ()
|
||||
|
||||
list(SORT actual_edges)
|
||||
foreach(edge ${actual_edges})
|
||||
string(REPLACE "|" ";" edge_parts "${edge}")
|
||||
list(GET edge_parts 0 edge_src)
|
||||
list(GET edge_parts 1 edge_dst)
|
||||
_bext_graph_quote(src_q "${edge_src}")
|
||||
_bext_graph_quote(dst_q "${edge_dst}")
|
||||
_bext_graph_write_line(TEXT " ${src_q} -> ${dst_q};")
|
||||
endforeach ()
|
||||
|
||||
if (provider_edges)
|
||||
_bext_graph_write_line(TEXT "")
|
||||
foreach(edge ${provider_edges})
|
||||
string(REPLACE "|" ";" edge_parts "${edge}")
|
||||
list(GET edge_parts 0 edge_src)
|
||||
list(GET edge_parts 1 edge_dst)
|
||||
_bext_graph_quote(src_q "${edge_src}")
|
||||
_bext_graph_quote(dst_q "${edge_dst}")
|
||||
_bext_graph_write_line(TEXT " ${src_q} -> ${dst_q} [style=dashed, color=\"#9ca3af\", arrowhead=none, constraint=false];")
|
||||
endforeach ()
|
||||
endif ()
|
||||
|
||||
_bext_graph_write_line(TEXT "}")
|
||||
|
||||
set(node_width 190)
|
||||
set(node_height 42)
|
||||
set(column_gap 120)
|
||||
set(row_gap 22)
|
||||
set(graph_margin 40)
|
||||
|
||||
set(max_nodes_per_depth 1)
|
||||
foreach(depth RANGE 1 ${max_depth})
|
||||
set(depth_nodes)
|
||||
foreach(node_id ${node_ids})
|
||||
_bext_graph_get(node_depth NODE_DEPTH "${node_id}")
|
||||
if ("${node_depth}" STREQUAL "${depth}")
|
||||
list(APPEND depth_nodes "${node_id}")
|
||||
endif ()
|
||||
endforeach ()
|
||||
list(LENGTH depth_nodes depth_node_count)
|
||||
if (depth_node_count GREATER max_nodes_per_depth)
|
||||
set(max_nodes_per_depth "${depth_node_count}")
|
||||
endif ()
|
||||
endforeach ()
|
||||
|
||||
math(EXPR graph_width "${graph_margin} * 2 + (${max_depth} + 1) * ${node_width} + ${max_depth} * ${column_gap}")
|
||||
math(EXPR graph_height "${graph_margin} * 2 + ${max_nodes_per_depth} * ${node_height} + (${max_nodes_per_depth} - 1) * ${row_gap}")
|
||||
math(EXPR root_x "${graph_margin}")
|
||||
math(EXPR root_y "(${graph_height} - ${node_height}) / 2")
|
||||
|
||||
foreach(node_id ${node_ids})
|
||||
_bext_graph_get(node_depth NODE_DEPTH "${node_id}")
|
||||
set(depth_nodes)
|
||||
foreach(depth_node_id ${node_ids})
|
||||
_bext_graph_get(depth_node_depth NODE_DEPTH "${depth_node_id}")
|
||||
if ("${depth_node_depth}" STREQUAL "${node_depth}")
|
||||
list(APPEND depth_nodes "${depth_node_id}")
|
||||
endif ()
|
||||
endforeach ()
|
||||
list(SORT depth_nodes)
|
||||
list(FIND depth_nodes "${node_id}" depth_index)
|
||||
math(EXPR node_x "${graph_margin} + ${node_depth} * (${node_width} + ${column_gap})")
|
||||
math(EXPR node_y "${graph_margin} + ${depth_index} * (${node_height} + ${row_gap})")
|
||||
_bext_graph_set(NODE_X "${node_id}" "${node_x}")
|
||||
_bext_graph_set(NODE_Y "${node_id}" "${node_y}")
|
||||
endforeach ()
|
||||
|
||||
file(WRITE "${graph_svg}" "<svg xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" width=\"${graph_width}\" height=\"${graph_height}\" viewBox=\"0 0 ${graph_width} ${graph_height}\">\n")
|
||||
file(APPEND "${graph_svg}" " <defs>\n")
|
||||
file(APPEND "${graph_svg}" " <marker id=\"arrow\" markerWidth=\"10\" markerHeight=\"8\" refX=\"9\" refY=\"4\" orient=\"auto\" markerUnits=\"strokeWidth\">\n")
|
||||
file(APPEND "${graph_svg}" " <path d=\"M0,0 L10,4 L0,8 z\" fill=\"#6b7280\" />\n")
|
||||
file(APPEND "${graph_svg}" " </marker>\n")
|
||||
file(APPEND "${graph_svg}" " </defs>\n")
|
||||
file(APPEND "${graph_svg}" " <rect width=\"100%\" height=\"100%\" fill=\"#ffffff\" />\n")
|
||||
|
||||
foreach(entry_project_id ${entry_project_ids})
|
||||
_bext_graph_get(dst_x NODE_X "${entry_project_id}")
|
||||
_bext_graph_get(dst_y NODE_Y "${entry_project_id}")
|
||||
math(EXPR src_cx "${root_x} + ${node_width}")
|
||||
math(EXPR src_cy "${root_y} + (${node_height} / 2)")
|
||||
set(dst_cx "${dst_x}")
|
||||
math(EXPR dst_cy "${dst_y} + (${node_height} / 2)")
|
||||
math(EXPR control_dx "(${dst_cx} - ${src_cx}) / 2")
|
||||
math(EXPR control1_x "${src_cx} + ${control_dx}")
|
||||
math(EXPR control2_x "${dst_cx} - ${control_dx}")
|
||||
file(APPEND "${graph_svg}" " <path d=\"M ${src_cx} ${src_cy} C ${control1_x} ${src_cy}, ${control2_x} ${dst_cy}, ${dst_cx} ${dst_cy}\" fill=\"none\" stroke=\"#9ca3af\" stroke-width=\"1.6\" marker-end=\"url(#arrow)\" />\n")
|
||||
endforeach ()
|
||||
|
||||
foreach(edge ${actual_edges})
|
||||
string(REPLACE "|" ";" edge_parts "${edge}")
|
||||
list(GET edge_parts 0 edge_src)
|
||||
list(GET edge_parts 1 edge_dst)
|
||||
_bext_graph_get(src_x NODE_X "${edge_src}")
|
||||
_bext_graph_get(src_y NODE_Y "${edge_src}")
|
||||
_bext_graph_get(dst_x NODE_X "${edge_dst}")
|
||||
_bext_graph_get(dst_y NODE_Y "${edge_dst}")
|
||||
math(EXPR src_cx "${src_x} + ${node_width}")
|
||||
math(EXPR src_cy "${src_y} + (${node_height} / 2)")
|
||||
set(dst_cx "${dst_x}")
|
||||
math(EXPR dst_cy "${dst_y} + (${node_height} / 2)")
|
||||
math(EXPR control_dx "(${dst_cx} - ${src_cx}) / 2")
|
||||
math(EXPR control1_x "${src_cx} + ${control_dx}")
|
||||
math(EXPR control2_x "${dst_cx} - ${control_dx}")
|
||||
file(APPEND "${graph_svg}" " <path d=\"M ${src_cx} ${src_cy} C ${control1_x} ${src_cy}, ${control2_x} ${dst_cy}, ${dst_cx} ${dst_cy}\" fill=\"none\" stroke=\"#6b7280\" stroke-width=\"1.4\" marker-end=\"url(#arrow)\" />\n")
|
||||
endforeach ()
|
||||
|
||||
foreach(edge ${provider_edges})
|
||||
string(REPLACE "|" ";" edge_parts "${edge}")
|
||||
list(GET edge_parts 0 edge_src)
|
||||
list(GET edge_parts 1 edge_dst)
|
||||
_bext_graph_get(src_x NODE_X "${edge_src}")
|
||||
_bext_graph_get(src_y NODE_Y "${edge_src}")
|
||||
_bext_graph_get(dst_x NODE_X "${edge_dst}")
|
||||
_bext_graph_get(dst_y NODE_Y "${edge_dst}")
|
||||
math(EXPR src_cx "${src_x} + ${node_width}")
|
||||
math(EXPR src_cy "${src_y} + (${node_height} / 2)")
|
||||
set(dst_cx "${dst_x}")
|
||||
math(EXPR dst_cy "${dst_y} + (${node_height} / 2)")
|
||||
math(EXPR control_dx "(${dst_cx} - ${src_cx}) / 2")
|
||||
math(EXPR control1_x "${src_cx} + ${control_dx}")
|
||||
math(EXPR control2_x "${dst_cx} - ${control_dx}")
|
||||
file(APPEND "${graph_svg}" " <path d=\"M ${src_cx} ${src_cy} C ${control1_x} ${src_cy}, ${control2_x} ${dst_cy}, ${dst_cx} ${dst_cy}\" fill=\"none\" stroke=\"#9ca3af\" stroke-width=\"1.4\" stroke-dasharray=\"6 5\" />\n")
|
||||
endforeach ()
|
||||
|
||||
file(APPEND "${graph_svg}" " <g>\n")
|
||||
file(APPEND "${graph_svg}" " <a xlink:href=\"https://github.com/BRL-CAD/brlcad\">\n")
|
||||
file(APPEND "${graph_svg}" " <rect x=\"${root_x}\" y=\"${root_y}\" width=\"${node_width}\" height=\"${node_height}\" rx=\"8\" fill=\"#111827\" stroke=\"#111827\" stroke-width=\"2.4\" />\n")
|
||||
math(EXPR root_text_x "${root_x} + (${node_width} / 2)")
|
||||
math(EXPR root_text_y "${root_y} + 27")
|
||||
file(APPEND "${graph_svg}" " <text x=\"${root_text_x}\" y=\"${root_text_y}\" text-anchor=\"middle\" font-family=\"Helvetica\" font-size=\"16\" font-weight=\"700\" fill=\"#ffffff\">BRL-CAD</text>\n")
|
||||
file(APPEND "${graph_svg}" " </a>\n")
|
||||
file(APPEND "${graph_svg}" " </g>\n")
|
||||
|
||||
foreach(node_id ${node_ids})
|
||||
_bext_graph_get(node_depth NODE_DEPTH "${node_id}")
|
||||
_bext_graph_get(node_label NODE_LABEL "${node_id}")
|
||||
_bext_graph_get(node_class NODE_CLASS "${node_id}")
|
||||
_bext_graph_get(node_url NODE_URL "${node_id}")
|
||||
_bext_graph_get(node_x NODE_X "${node_id}")
|
||||
_bext_graph_get(node_y NODE_Y "${node_id}")
|
||||
_bext_graph_color_by_depth(node_fill node_outline node_font node_outline_font "${node_depth}" "${node_class}")
|
||||
_bext_graph_xml_escape(node_label_xml "${node_label}")
|
||||
if (node_url)
|
||||
_bext_graph_xml_escape(node_url_xml "${node_url}")
|
||||
file(APPEND "${graph_svg}" " <g>\n")
|
||||
file(APPEND "${graph_svg}" " <a xlink:href=\"${node_url_xml}\">\n")
|
||||
else ()
|
||||
file(APPEND "${graph_svg}" " <g>\n")
|
||||
endif ()
|
||||
file(APPEND "${graph_svg}" " <rect x=\"${node_x}\" y=\"${node_y}\" width=\"${node_width}\" height=\"${node_height}\" rx=\"8\" fill=\"${node_fill}\" stroke=\"${node_outline}\" stroke-width=\"2.0\" />\n")
|
||||
math(EXPR text_x "${node_x} + (${node_width} / 2)")
|
||||
math(EXPR text_y "${node_y} + 27")
|
||||
file(APPEND "${graph_svg}" " <text x=\"${text_x}\" y=\"${text_y}\" text-anchor=\"middle\" font-family=\"Helvetica\" font-size=\"14\" font-weight=\"600\" fill=\"${node_font}\">${node_label_xml}</text>\n")
|
||||
if (node_url)
|
||||
file(APPEND "${graph_svg}" " </a>\n")
|
||||
endif ()
|
||||
file(APPEND "${graph_svg}" " </g>\n")
|
||||
endforeach ()
|
||||
|
||||
file(APPEND "${graph_svg}" "</svg>\n")
|
||||
|
||||
if (DEFINED GRAPHVIZ_DOT_EXECUTABLE AND GRAPHVIZ_DOT_EXECUTABLE)
|
||||
foreach(render_format png pdf)
|
||||
if (DEFINED BEXT_RENDER_${render_format} AND BEXT_RENDER_${render_format})
|
||||
execute_process(
|
||||
COMMAND "${GRAPHVIZ_DOT_EXECUTABLE}" "-T${render_format}" "-o" "${BEXT_BINARY_DIR}/bext.${render_format}" "${graph_dot}"
|
||||
COMMAND_ERROR_IS_FATAL ANY
|
||||
)
|
||||
endif ()
|
||||
endforeach ()
|
||||
endif ()
|
||||
@@ -0,0 +1,115 @@
|
||||
if (NOT DEFINED BEXT_SOURCE_DIR)
|
||||
message(FATAL_ERROR "BEXT_SOURCE_DIR is required")
|
||||
endif()
|
||||
if (NOT DEFINED BEXT_SBOM_OUTPUT)
|
||||
message(FATAL_ERROR "BEXT_SBOM_OUTPUT is required")
|
||||
endif()
|
||||
|
||||
include("${BEXT_SOURCE_DIR}/CMake/BextDependencyInventory.cmake")
|
||||
bext_collect_dependency_inventory("${BEXT_SOURCE_DIR}")
|
||||
|
||||
function(_bext_json_escape out value)
|
||||
string(REPLACE "\\" "\\\\" value "${value}")
|
||||
string(REPLACE "\"" "\\\"" value "${value}")
|
||||
string(REPLACE "\n" "\\n" value "${value}")
|
||||
string(REPLACE "\r" "\\r" value "${value}")
|
||||
string(REPLACE "\t" "\\t" value "${value}")
|
||||
set(${out} "${value}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
function(_bext_spdx_id out project)
|
||||
string(REGEX REPLACE "[^A-Za-z0-9.-]" "-" id "${project}")
|
||||
set(${out} "SPDXRef-Package-${id}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
execute_process(
|
||||
COMMAND git rev-parse HEAD
|
||||
WORKING_DIRECTORY "${BEXT_SOURCE_DIR}"
|
||||
RESULT_VARIABLE git_result
|
||||
OUTPUT_VARIABLE bext_revision
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
)
|
||||
if (NOT git_result EQUAL 0)
|
||||
message(FATAL_ERROR "Unable to determine the bext revision")
|
||||
endif()
|
||||
string(TIMESTAMP created "%Y-%m-%dT%H:%M:%SZ" UTC)
|
||||
|
||||
get_filename_component(sbom_dir "${BEXT_SBOM_OUTPUT}" DIRECTORY)
|
||||
file(MAKE_DIRECTORY "${sbom_dir}")
|
||||
file(WRITE "${BEXT_SBOM_OUTPUT}" "{\n")
|
||||
file(APPEND "${BEXT_SBOM_OUTPUT}" " \"spdxVersion\": \"SPDX-2.3\",\n")
|
||||
file(APPEND "${BEXT_SBOM_OUTPUT}" " \"dataLicense\": \"CC0-1.0\",\n")
|
||||
file(APPEND "${BEXT_SBOM_OUTPUT}" " \"SPDXID\": \"SPDXRef-DOCUMENT\",\n")
|
||||
file(APPEND "${BEXT_SBOM_OUTPUT}" " \"name\": \"bext-dependencies\",\n")
|
||||
file(APPEND "${BEXT_SBOM_OUTPUT}" " \"documentNamespace\": \"https://github.com/BRL-CAD/bext/sbom/${bext_revision}\",\n")
|
||||
file(APPEND "${BEXT_SBOM_OUTPUT}" " \"creationInfo\": {\n")
|
||||
file(APPEND "${BEXT_SBOM_OUTPUT}" " \"created\": \"${created}\",\n")
|
||||
file(APPEND "${BEXT_SBOM_OUTPUT}" " \"creators\": [\"Tool: bext-GenerateSbom.cmake\"]\n")
|
||||
file(APPEND "${BEXT_SBOM_OUTPUT}" " },\n")
|
||||
file(APPEND "${BEXT_SBOM_OUTPUT}" " \"packages\": [\n")
|
||||
|
||||
list(LENGTH BEXT_INVENTORY_PROJECTS project_count)
|
||||
set(project_index 0)
|
||||
foreach(project ${BEXT_INVENTORY_PROJECTS})
|
||||
math(EXPR project_index "${project_index} + 1")
|
||||
bext_inventory_get(groups "${project}" GROUPS)
|
||||
bext_inventory_get(output_class "${project}" OUTPUT)
|
||||
bext_inventory_get(urls "${project}" SOURCE_URLS)
|
||||
bext_inventory_get(shas "${project}" SOURCE_SHAS)
|
||||
list(GET urls 0 primary_url)
|
||||
list(GET shas 0 primary_sha)
|
||||
_bext_spdx_id(spdx_id "${project}")
|
||||
string(REPLACE ";" ", " all_urls "${urls}")
|
||||
string(REPLACE ";" ", " all_shas "${shas}")
|
||||
string(REPLACE ";" ", " group_text "${groups}")
|
||||
_bext_json_escape(comment "groups: ${group_text}; output: ${output_class}; sources: ${all_urls}; pinned commits: ${all_shas}")
|
||||
_bext_json_escape(primary_url "${primary_url}")
|
||||
file(APPEND "${BEXT_SBOM_OUTPUT}" " {\n")
|
||||
file(APPEND "${BEXT_SBOM_OUTPUT}" " \"name\": \"${project}\",\n")
|
||||
file(APPEND "${BEXT_SBOM_OUTPUT}" " \"SPDXID\": \"${spdx_id}\",\n")
|
||||
file(APPEND "${BEXT_SBOM_OUTPUT}" " \"versionInfo\": \"${primary_sha}\",\n")
|
||||
file(APPEND "${BEXT_SBOM_OUTPUT}" " \"downloadLocation\": \"${primary_url}\",\n")
|
||||
file(APPEND "${BEXT_SBOM_OUTPUT}" " \"filesAnalyzed\": false,\n")
|
||||
file(APPEND "${BEXT_SBOM_OUTPUT}" " \"licenseConcluded\": \"NOASSERTION\",\n")
|
||||
file(APPEND "${BEXT_SBOM_OUTPUT}" " \"licenseDeclared\": \"NOASSERTION\",\n")
|
||||
file(APPEND "${BEXT_SBOM_OUTPUT}" " \"copyrightText\": \"NOASSERTION\",\n")
|
||||
file(APPEND "${BEXT_SBOM_OUTPUT}" " \"comment\": \"${comment}\"\n")
|
||||
if (project_index LESS project_count)
|
||||
file(APPEND "${BEXT_SBOM_OUTPUT}" " },\n")
|
||||
else()
|
||||
file(APPEND "${BEXT_SBOM_OUTPUT}" " }\n")
|
||||
endif()
|
||||
endforeach()
|
||||
file(APPEND "${BEXT_SBOM_OUTPUT}" " ],\n")
|
||||
file(APPEND "${BEXT_SBOM_OUTPUT}" " \"relationships\": [\n")
|
||||
|
||||
set(relationships)
|
||||
foreach(project ${BEXT_INVENTORY_PROJECTS})
|
||||
_bext_spdx_id(project_id "${project}")
|
||||
list(APPEND relationships "SPDXRef-DOCUMENT|DESCRIBES|${project_id}")
|
||||
bext_inventory_get(deps "${project}" DEPS)
|
||||
foreach(dep ${deps})
|
||||
list(FIND BEXT_INVENTORY_PROJECTS "${dep}" dep_index)
|
||||
if (NOT dep_index EQUAL -1)
|
||||
_bext_spdx_id(dep_id "${dep}")
|
||||
list(APPEND relationships "${project_id}|DEPENDS_ON|${dep_id}")
|
||||
endif()
|
||||
endforeach()
|
||||
endforeach()
|
||||
list(LENGTH relationships relationship_count)
|
||||
set(relationship_index 0)
|
||||
foreach(relationship ${relationships})
|
||||
math(EXPR relationship_index "${relationship_index} + 1")
|
||||
string(REPLACE "|" ";" parts "${relationship}")
|
||||
list(GET parts 0 source_id)
|
||||
list(GET parts 1 relationship_type)
|
||||
list(GET parts 2 target_id)
|
||||
file(APPEND "${BEXT_SBOM_OUTPUT}" " {\"spdxElementId\": \"${source_id}\", \"relationshipType\": \"${relationship_type}\", \"relatedSpdxElement\": \"${target_id}\"}")
|
||||
if (relationship_index LESS relationship_count)
|
||||
file(APPEND "${BEXT_SBOM_OUTPUT}" ",\n")
|
||||
else()
|
||||
file(APPEND "${BEXT_SBOM_OUTPUT}" "\n")
|
||||
endif()
|
||||
endforeach()
|
||||
file(APPEND "${BEXT_SBOM_OUTPUT}" " ]\n}\n")
|
||||
message(STATUS "Generated SPDX 2.3 SBOM: ${BEXT_SBOM_OUTPUT}")
|
||||
@@ -0,0 +1,163 @@
|
||||
# J A V A C H E C K . C M A K E
|
||||
# BRL-CAD
|
||||
#
|
||||
# Copyright (c) 2024 United States Government as represented by
|
||||
# the U.S. Army Research Laboratory.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
#
|
||||
# 1. Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
#
|
||||
# 2. Redistributions in binary form must reproduce the above
|
||||
# copyright notice, this list of conditions and the following
|
||||
# disclaimer in the documentation and/or other materials provided
|
||||
# with the distribution.
|
||||
#
|
||||
# 3. The name of the author may not be used to endorse or promote
|
||||
# products derived from this software without specific prior written
|
||||
# permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
|
||||
# OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
|
||||
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
|
||||
# GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
# WHETHER IN CONTRACT, STRICT LIABILITY, 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.
|
||||
#
|
||||
###
|
||||
# Utility function to check that dlls can be loaded by the Java
|
||||
# System.loadLibrary mechanism. Parameters (all are mandatory):
|
||||
#
|
||||
# Required parameters:
|
||||
# DLL_DIR = directory holding shared library files to check
|
||||
#
|
||||
# The following can be specified in lieu of relying on find_package
|
||||
# to locate Java:
|
||||
# JCEXEC = path to javac compiler
|
||||
# JAREXEC = path to jar archive creater
|
||||
# JEXEC = path to java executable
|
||||
|
||||
|
||||
function(JavaCheck JC_EXEC JAR_EXEC J_EXEC DLL_SUFFIX dlldir)
|
||||
|
||||
if (NOT EXISTS "${dlldir}")
|
||||
message(FATAL_ERROR "Dll directory ${dlldir} not found\n")
|
||||
endif ()
|
||||
if (NOT EXISTS "${JC_EXEC}")
|
||||
message(FATAL_ERROR "Java compiler executable ${JC_EXEC} not found\n")
|
||||
endif ()
|
||||
if (NOT EXISTS "${JAR_EXEC}")
|
||||
message(FATAL_ERROR "Java archive creation executable ${JAR_EXEC} not found\n")
|
||||
endif ()
|
||||
if (NOT EXISTS "${J_EXEC}")
|
||||
message(FATAL_ERROR "Java executable ${J_EXEC} not found\n")
|
||||
endif ()
|
||||
|
||||
file(WRITE ${dlldir}/LoadLib.java "class LoadLib
|
||||
{
|
||||
public static void main(String []args)
|
||||
{
|
||||
if (args.length < 1) {
|
||||
System.out.println(\"No DLL specified\");
|
||||
System.exit(1);
|
||||
}
|
||||
System.out.println(\"Loading \" + args[0]);
|
||||
System.loadLibrary(args[0]);
|
||||
System.out.println(\"Done\");
|
||||
}
|
||||
}
|
||||
"
|
||||
)
|
||||
|
||||
# Help make sure Java finds the dynamically linked libraries in question
|
||||
if (WIN32)
|
||||
set(ENV{PATH} "${dlldir};$ENV{PATH}")
|
||||
else (WIN32)
|
||||
set(ENV{LD_LIBRARY_PATH} "${dlldir}")
|
||||
endif (WIN32)
|
||||
|
||||
# Compile the file and create the jar archive
|
||||
execute_process(COMMAND ${JC_EXEC} LoadLib.java
|
||||
RESULT_VARIABLE LSTATUS OUTPUT_VARIABLE LOUT ERROR_VARIABLE LOUT
|
||||
WORKING_DIRECTORY ${dlldir}
|
||||
)
|
||||
if (LSTATUS)
|
||||
file(REMOVE ${dlldir}/LoadLib.java)
|
||||
message(FATAL_ERROR "Failed to compile LoadLib.class: ${LOUT}")
|
||||
endif (LSTATUS)
|
||||
execute_process(COMMAND ${JAR_EXEC} -cf LoadLib.jar LoadLib.class
|
||||
RESULT_VARIABLE LSTATUS OUTPUT_VARIABLE LOUT ERROR_VARIABLE LOUT
|
||||
WORKING_DIRECTORY ${dlldir}
|
||||
)
|
||||
if (LSTATUS)
|
||||
file(REMOVE ${dlldir}/LoadLib.java)
|
||||
file(REMOVE ${dlldir}/LoadLib.class)
|
||||
message(FATAL_ERROR "Failed to create JAR file LoadLib.jar: ${LOUT}")
|
||||
endif (LSTATUS)
|
||||
|
||||
file(GLOB dll_files RELATIVE "${dlldir}" "${dlldir}/*${DLL_SUFFIX}")
|
||||
set(load_fail 0)
|
||||
foreach(dlf ${dll_files})
|
||||
string(REGEX REPLACE "^lib" "" dlf "${dlf}")
|
||||
string(REGEX REPLACE "${DLL_SUFFIX}$" "" dlf "${dlf}")
|
||||
message("Dll System.loadLibrary check: ${J_EXEC} -cp LoadLib.jar LoadLib ${dlf}")
|
||||
execute_process(COMMAND ${J_EXEC} -cp LoadLib.jar LoadLib ${dlf}
|
||||
RESULT_VARIABLE LSTATUS OUTPUT_VARIABLE LOUT ERROR_VARIABLE LOUT
|
||||
WORKING_DIRECTORY ${dlldir}
|
||||
)
|
||||
if (LSTATUS)
|
||||
message("System.loadLibrary call with dll file ${dlf} did not succeed: ${LOUT}")
|
||||
set(load_fail 1)
|
||||
endif (LSTATUS)
|
||||
endforeach(dlf ${dll_files})
|
||||
file(REMOVE ${dlldir}/LoadLib.java)
|
||||
file(REMOVE ${dlldir}/LoadLib.class)
|
||||
file(REMOVE ${dlldir}/LoadLib.jar)
|
||||
if (load_fail)
|
||||
message(FATAL_ERROR "Dll files present that failed to load with LoadLibrary.")
|
||||
endif (load_fail)
|
||||
endfunction(JavaCheck)
|
||||
|
||||
if (NOT JCEXEC OR NOT JAREXEC OR NOT JEXEC)
|
||||
find_package(Java REQUIRED)
|
||||
set(JEXEC ${Java_JAVA_EXECUTABLE})
|
||||
set(JCEXEC ${Java_JAVAC_EXECUTABLE})
|
||||
set(JAREXEC ${Java_JAR_EXECUTABLE})
|
||||
endif (NOT JCEXEC OR NOT JAREXEC OR NOT JEXEC)
|
||||
|
||||
# Populate CMAKE_SHARED_LIBRARY_SUFFIX variable. See:
|
||||
# https://discourse.cmake.org/t/cmake-shared-library-suffix-in-script-processing-p-mode/11646
|
||||
if (NOT DLLSUFFIX)
|
||||
set(CMAKE_PLATFORM_INFO_DIR ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY})
|
||||
include(${CMAKE_ROOT}/Modules/CMakeDetermineSystem.cmake)
|
||||
include(${CMAKE_ROOT}/Modules/CMakeSystemSpecificInitialize.cmake)
|
||||
include(${CMAKE_ROOT}/Modules/CMakeSystemSpecificInformation.cmake)
|
||||
file(REMOVE ${CMAKE_PLATFORM_INFO_DIR})
|
||||
set(DLLSUFFIX ${CMAKE_SHARED_LIBRARY_SUFFIX})
|
||||
endif (NOT DLLSUFFIX)
|
||||
|
||||
# Report the active parameters
|
||||
message("Java executable (JEXEC): ${JEXEC}")
|
||||
message("Java compiler executable (JCEXEC): ${JCEXEC}")
|
||||
message("Java archiver executable (JAREXEC): ${JAREXEC}")
|
||||
message("Dll suffix (DLLSUFFIX): ${DLLSUFFIX}")
|
||||
message("Dll directory (DLL_DIR): ${DLL_DIR}")
|
||||
|
||||
if (JCEXEC AND JAREXEC AND JEXEC AND DLLSUFFIX AND DLL_DIR)
|
||||
JavaCheck(${JCEXEC} ${JAREXEC} ${JEXEC} ${DLLSUFFIX} ${DLL_DIR})
|
||||
endif ()
|
||||
|
||||
# Local Variables:
|
||||
# tab-width: 8
|
||||
# mode: cmake
|
||||
# indent-tabs-mode: t
|
||||
# End:
|
||||
# ex: shiftwidth=2 tabstop=8
|
||||
@@ -0,0 +1,75 @@
|
||||
# L O A D L I B R A R Y C H E C K . C M A K E
|
||||
# BRL-CAD
|
||||
#
|
||||
# Copyright (c) 2024 United States Government as represented by
|
||||
# the U.S. Army Research Laboratory.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
#
|
||||
# 1. Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
#
|
||||
# 2. Redistributions in binary form must reproduce the above
|
||||
# copyright notice, this list of conditions and the following
|
||||
# disclaimer in the documentation and/or other materials provided
|
||||
# with the distribution.
|
||||
#
|
||||
# 3. The name of the author may not be used to endorse or promote
|
||||
# products derived from this software without specific prior written
|
||||
# permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
|
||||
# OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
|
||||
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
|
||||
# GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
# WHETHER IN CONTRACT, STRICT LIABILITY, 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.
|
||||
#
|
||||
###
|
||||
# Utility function to check that a dll can be loaded by the LoadLibrary
|
||||
# function on Windows.
|
||||
|
||||
function(LoadLibraryCheck LLTEST_EXEC dlldir)
|
||||
if (NOT EXISTS "${dlldir}")
|
||||
message("Dll directory ${dlldir} not found\n")
|
||||
return()
|
||||
endif (NOT EXISTS "${dlldir}")
|
||||
if (NOT EXISTS "${LLTEST_EXEC}")
|
||||
message("Test executable ${LLTEST_EXEC} not found\n")
|
||||
return()
|
||||
endif (NOT EXISTS "${LLTEST_EXEC}")
|
||||
file(GLOB dll_files RELATIVE "${dlldir}" "${dlldir}/*.dll")
|
||||
set(load_fail 0)
|
||||
foreach(dlf ${dll_files})
|
||||
message("Dll LoadLibrary check: ${LLTEST_EXEC} ${dlf}")
|
||||
execute_process(COMMAND ${LLTEST_EXEC} ${dlf}
|
||||
RESULT_VARIABLE LSTATUS OUTPUT_VARIABLE LOUT ERROR_VARIABLE LOUT
|
||||
WORKING_DIRECTORY ${dlldir}
|
||||
)
|
||||
if (LSTATUS)
|
||||
message("LoadLibrary call with dll file ${dllfile} did not succeed: ${LOUT}")
|
||||
set(load_fail 1)
|
||||
endif (LSTATUS)
|
||||
endforeach(dlf ${dll_files})
|
||||
if (load_fail)
|
||||
message(FATAL_ERROR "Dll files present that failed to load with LoadLibrary.")
|
||||
endif (load_fail)
|
||||
endfunction(LoadLibraryCheck)
|
||||
|
||||
if (LEXEC AND DLL_DIR)
|
||||
LoadLibraryCheck(${LEXEC} ${DLL_DIR})
|
||||
endif (LEXEC AND DLL_DIR)
|
||||
|
||||
# Local Variables:
|
||||
# tab-width: 8
|
||||
# mode: cmake
|
||||
# indent-tabs-mode: t
|
||||
# End:
|
||||
# ex: shiftwidth=2 tabstop=8
|
||||
@@ -0,0 +1,43 @@
|
||||
/* L O A D L I B R A R Y T E S T . C P P
|
||||
*
|
||||
* Published in 2024 by the United States Government.
|
||||
* This work is in the public domain.
|
||||
*
|
||||
*/
|
||||
/** @file LoadLibraryTest.cpp
|
||||
*
|
||||
* File to test if a Dll file can be successfully loaded
|
||||
* by the Windows LoadLibrary call.
|
||||
*/
|
||||
|
||||
#include <windows.h>
|
||||
#include <stdio.h>
|
||||
|
||||
int main(int argc, const char **argv)
|
||||
{
|
||||
if (argc < 2) {
|
||||
printf("lltest <dllfile>\n");
|
||||
return -1;
|
||||
}
|
||||
HINSTANCE linst = LoadLibrary(TEXT(argv[1]));
|
||||
if (linst == NULL) {
|
||||
printf("LoadLibrary of %s failed\n", argv[1]);
|
||||
return 1;
|
||||
}
|
||||
BOOL flr = FreeLibrary(linst);
|
||||
if (!flr) {
|
||||
printf("FreeLibrary failed for %s\n", argv[1]);
|
||||
return 1;
|
||||
}
|
||||
printf("Success\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Local Variables:
|
||||
// tab-width: 8
|
||||
// mode: C++
|
||||
// c-basic-offset: 4
|
||||
// indent-tabs-mode: t
|
||||
// c-file-style: "stroustrup"
|
||||
// End:
|
||||
// ex: shiftwidth=4 tabstop=8
|
||||
@@ -0,0 +1,246 @@
|
||||
cmake_minimum_required(VERSION 3.19)
|
||||
|
||||
if (NOT DEFINED BEXT_PATCH_NATIVE_EXECUTABLE OR NOT BEXT_PATCH_NATIVE_EXECUTABLE)
|
||||
message(FATAL_ERROR "BEXT_PATCH_NATIVE_EXECUTABLE is not defined")
|
||||
endif()
|
||||
|
||||
if (NOT DEFINED BEXT_PATCH_CHECK_OPTION OR NOT BEXT_PATCH_CHECK_OPTION)
|
||||
set(BEXT_PATCH_CHECK_OPTION "--dry-run")
|
||||
endif()
|
||||
|
||||
set(patch_args)
|
||||
set(seen_separator FALSE)
|
||||
set(has_forward_flag FALSE)
|
||||
set(has_reverse_flag FALSE)
|
||||
set(has_noninteractive_flag FALSE)
|
||||
set(has_check_flag FALSE)
|
||||
set(has_input_file FALSE)
|
||||
set(has_reject_file FALSE)
|
||||
set(expect_input_file FALSE)
|
||||
set(expect_reject_file FALSE)
|
||||
set(input_file "")
|
||||
|
||||
math(EXPR last_arg "${CMAKE_ARGC} - 1")
|
||||
foreach(arg_index RANGE 0 ${last_arg})
|
||||
set(arg "${CMAKE_ARGV${arg_index}}")
|
||||
if (seen_separator)
|
||||
# Some platform patch tools accept -p1 while others require -p 1.
|
||||
# Normalize the compact form once here for every wrapped invocation.
|
||||
if (arg MATCHES "^-p([0-9]+)$")
|
||||
list(APPEND patch_args "-p" "${CMAKE_MATCH_1}")
|
||||
else()
|
||||
list(APPEND patch_args "${arg}")
|
||||
endif()
|
||||
if (expect_input_file)
|
||||
set(input_file "${arg}")
|
||||
set(expect_input_file FALSE)
|
||||
elseif (expect_reject_file)
|
||||
set(expect_reject_file FALSE)
|
||||
elseif (arg STREQUAL "-i" OR arg STREQUAL "--input")
|
||||
set(has_input_file TRUE)
|
||||
set(expect_input_file TRUE)
|
||||
elseif (arg MATCHES "^-i(.+)")
|
||||
set(has_input_file TRUE)
|
||||
set(input_file "${CMAKE_MATCH_1}")
|
||||
elseif (arg MATCHES "^--input=(.+)")
|
||||
set(has_input_file TRUE)
|
||||
set(input_file "${CMAKE_MATCH_1}")
|
||||
endif()
|
||||
if (arg STREQUAL "-r" OR arg STREQUAL "--reject-file")
|
||||
set(has_reject_file TRUE)
|
||||
set(expect_reject_file TRUE)
|
||||
elseif (arg MATCHES "^-r(.+)")
|
||||
set(has_reject_file TRUE)
|
||||
elseif (arg MATCHES "^--reject-file=(.+)")
|
||||
set(has_reject_file TRUE)
|
||||
endif()
|
||||
if (arg STREQUAL "-N" OR arg STREQUAL "--forward")
|
||||
set(has_forward_flag TRUE)
|
||||
endif()
|
||||
if (arg STREQUAL "-R" OR arg STREQUAL "--reverse")
|
||||
set(has_reverse_flag TRUE)
|
||||
endif()
|
||||
if (arg STREQUAL "-f" OR arg STREQUAL "--force" OR
|
||||
arg STREQUAL "-t" OR arg STREQUAL "--batch")
|
||||
set(has_noninteractive_flag TRUE)
|
||||
endif()
|
||||
if (arg STREQUAL "-C" OR arg STREQUAL "--dry-run")
|
||||
set(has_check_flag TRUE)
|
||||
endif()
|
||||
endif()
|
||||
if (arg STREQUAL "--")
|
||||
set(seen_separator TRUE)
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
if (NOT seen_separator)
|
||||
message(FATAL_ERROR "Patch wrapper requires '--' before patch arguments")
|
||||
endif()
|
||||
|
||||
if (NOT patch_args)
|
||||
message(FATAL_ERROR "Patch wrapper did not receive any patch arguments")
|
||||
endif()
|
||||
|
||||
if (expect_input_file)
|
||||
message(FATAL_ERROR "Patch input option is missing its file path")
|
||||
endif()
|
||||
if (expect_reject_file)
|
||||
message(FATAL_ERROR "Patch reject option is missing its file path")
|
||||
endif()
|
||||
|
||||
set(reject_path "")
|
||||
set(reject_log_path "")
|
||||
if (input_file AND DEFINED BEXT_PATCH_REJECT_DIR AND
|
||||
BEXT_PATCH_REJECT_DIR)
|
||||
get_filename_component(patch_name "${input_file}" NAME)
|
||||
get_filename_component(patch_context "${CMAKE_CURRENT_BINARY_DIR}" NAME)
|
||||
string(REGEX REPLACE "[^A-Za-z0-9_.-]" "_" patch_context
|
||||
"${patch_context}")
|
||||
set(reject_path
|
||||
"${BEXT_PATCH_REJECT_DIR}/${patch_context}-${patch_name}.rej")
|
||||
set(reject_log_path "${reject_path}.log")
|
||||
endif()
|
||||
|
||||
function(clear_reject_artifacts)
|
||||
if (reject_path)
|
||||
file(REMOVE "${reject_path}" "${reject_log_path}")
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
function(preserve_reject_artifacts)
|
||||
if (NOT reject_path)
|
||||
return()
|
||||
endif()
|
||||
|
||||
# Keep a native reject file when patch emitted one. Applicability checks do
|
||||
# not normally emit rejects, so fall back to preserving the full patch.
|
||||
file(MAKE_DIRECTORY "${BEXT_PATCH_REJECT_DIR}")
|
||||
if (EXISTS "${reject_path}")
|
||||
file(SIZE "${reject_path}" reject_size)
|
||||
else()
|
||||
set(reject_size 0)
|
||||
endif()
|
||||
if (reject_size EQUAL 0)
|
||||
configure_file("${input_file}" "${reject_path}" COPYONLY)
|
||||
endif()
|
||||
file(WRITE "${reject_log_path}"
|
||||
"Patch file: ${input_file}\n"
|
||||
"Working directory: ${CMAKE_CURRENT_BINARY_DIR}\n\n"
|
||||
"${patch_failure_output}")
|
||||
message(STATUS
|
||||
"Saved failed patch and diagnostics to ${reject_path} and "
|
||||
"${reject_log_path}")
|
||||
endfunction()
|
||||
|
||||
clear_reject_artifacts()
|
||||
if (reject_path AND NOT has_reject_file)
|
||||
list(APPEND patch_args "-r" "${reject_path}")
|
||||
endif()
|
||||
|
||||
# Patch commands run during configure/build steps cannot consult a user. The
|
||||
# short -t form is accepted by the bundled and supported Unix patch tools.
|
||||
# Preserve an explicit --force/-f choice if a caller has made one.
|
||||
if (NOT has_noninteractive_flag)
|
||||
list(PREPEND patch_args "-t")
|
||||
endif()
|
||||
|
||||
# Preflight file-based patches so a bad patch cannot leave a source tree half
|
||||
# modified. Stdin cannot be preflighted because it cannot be replayed for the
|
||||
# real invocation.
|
||||
if (has_input_file AND NOT has_check_flag)
|
||||
set(forward_check_args ${patch_args})
|
||||
list(PREPEND forward_check_args "${BEXT_PATCH_CHECK_OPTION}")
|
||||
execute_process(
|
||||
COMMAND "${BEXT_PATCH_NATIVE_EXECUTABLE}" ${forward_check_args}
|
||||
RESULT_VARIABLE forward_check_result
|
||||
OUTPUT_VARIABLE forward_check_stdout
|
||||
ERROR_VARIABLE forward_check_stderr
|
||||
)
|
||||
|
||||
if (NOT forward_check_result EQUAL 0)
|
||||
if (forward_check_result EQUAL 1 AND has_forward_flag AND
|
||||
NOT has_reverse_flag)
|
||||
set(reverse_check_args)
|
||||
foreach(arg IN LISTS patch_args)
|
||||
if (arg STREQUAL "-N" OR arg STREQUAL "--forward")
|
||||
continue()
|
||||
endif()
|
||||
list(APPEND reverse_check_args "${arg}")
|
||||
endforeach()
|
||||
list(PREPEND reverse_check_args "${BEXT_PATCH_CHECK_OPTION}" "-R")
|
||||
|
||||
execute_process(
|
||||
COMMAND "${BEXT_PATCH_NATIVE_EXECUTABLE}" ${reverse_check_args}
|
||||
RESULT_VARIABLE reverse_result
|
||||
OUTPUT_QUIET
|
||||
ERROR_QUIET
|
||||
)
|
||||
|
||||
if (reverse_result EQUAL 0)
|
||||
clear_reject_artifacts()
|
||||
message(STATUS
|
||||
"Patch already applied or reversed; continuing because -N/--forward was requested."
|
||||
)
|
||||
return()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
set(patch_failure_output
|
||||
"${forward_check_stdout}${forward_check_stderr}")
|
||||
preserve_reject_artifacts()
|
||||
if (forward_check_stdout)
|
||||
message("${forward_check_stdout}")
|
||||
endif()
|
||||
if (forward_check_stderr)
|
||||
message("${forward_check_stderr}")
|
||||
endif()
|
||||
message(FATAL_ERROR
|
||||
"Patch preflight failed with exit code ${forward_check_result}"
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
execute_process(
|
||||
COMMAND "${BEXT_PATCH_NATIVE_EXECUTABLE}" ${patch_args}
|
||||
RESULT_VARIABLE patch_result
|
||||
OUTPUT_VARIABLE patch_stdout
|
||||
ERROR_VARIABLE patch_stderr
|
||||
ECHO_OUTPUT_VARIABLE
|
||||
ECHO_ERROR_VARIABLE
|
||||
)
|
||||
|
||||
if (patch_result EQUAL 0)
|
||||
clear_reject_artifacts()
|
||||
return()
|
||||
endif()
|
||||
|
||||
if (patch_result EQUAL 1 AND has_forward_flag AND NOT has_reverse_flag)
|
||||
set(reverse_check_args)
|
||||
foreach(arg IN LISTS patch_args)
|
||||
if (arg STREQUAL "-N" OR arg STREQUAL "--forward")
|
||||
continue()
|
||||
endif()
|
||||
list(APPEND reverse_check_args "${arg}")
|
||||
endforeach()
|
||||
list(PREPEND reverse_check_args "${BEXT_PATCH_CHECK_OPTION}" "-R")
|
||||
|
||||
execute_process(
|
||||
COMMAND "${BEXT_PATCH_NATIVE_EXECUTABLE}" ${reverse_check_args}
|
||||
RESULT_VARIABLE reverse_result
|
||||
OUTPUT_QUIET
|
||||
ERROR_QUIET
|
||||
)
|
||||
|
||||
if (reverse_result EQUAL 0)
|
||||
clear_reject_artifacts()
|
||||
execute_process(
|
||||
COMMAND ${CMAKE_COMMAND} -E echo
|
||||
"Patch already applied or reversed; continuing because -N/--forward was requested."
|
||||
)
|
||||
return()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
set(patch_failure_output "${patch_stdout}${patch_stderr}")
|
||||
preserve_reject_artifacts()
|
||||
message(FATAL_ERROR "Patch command failed with exit code ${patch_result}")
|
||||
@@ -0,0 +1,478 @@
|
||||
# U T I L S . C M A K E
|
||||
# BRL-CAD
|
||||
#
|
||||
# Copyright (c) 2025 United States Government as represented by
|
||||
# the U.S. Army Research Laboratory.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
#
|
||||
# 1. Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
#
|
||||
# 2. Redistributions in binary form must reproduce the above
|
||||
# copyright notice, this list of conditions and the following
|
||||
# disclaimer in the documentation and/or other materials provided
|
||||
# with the distribution.
|
||||
#
|
||||
# 3. The name of the author may not be used to endorse or promote
|
||||
# products derived from this software without specific prior written
|
||||
# permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
|
||||
# OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
|
||||
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
|
||||
# GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
# WHETHER IN CONTRACT, STRICT LIABILITY, 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.
|
||||
#
|
||||
###
|
||||
|
||||
|
||||
###############################################################################
|
||||
# It is common for more complex targets to need to key build settings off of
|
||||
# whether or not their dependencies are being built locally. These macros are
|
||||
# used to cut down on boilerplate code
|
||||
###############################################################################
|
||||
|
||||
macro(TargetVars roots)
|
||||
foreach(root ${${roots}})
|
||||
if (NOT ${root}_ADDED)
|
||||
message(FATAL_ERROR "${root} is listed as a dependency but is not yet added - fix project ordering in top level CMakeLists.txt file")
|
||||
endif (NOT ${root}_ADDED)
|
||||
if (TARGET ${root}_BLD)
|
||||
set(${root}_TARGET 1)
|
||||
# Also set the TARGET var in the parent scope - may need it in other
|
||||
# build logic besides the current directory.
|
||||
set(${root}_TARGET 1 PARENT_SCOPE)
|
||||
endif (TARGET ${root}_BLD)
|
||||
endforeach(root ${${roots}})
|
||||
endmacro(TargetVars root)
|
||||
|
||||
|
||||
###
|
||||
# Loads dependencies from an in-src file named same as containing
|
||||
# directory with .deps suffix. Dependencies are added to the
|
||||
# corresponding ${proot}_DEPENDS variable.
|
||||
###
|
||||
macro(RegisterDeps proot)
|
||||
get_filename_component(dirname ${CMAKE_CURRENT_SOURCE_DIR} NAME)
|
||||
if (NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${dirname}.deps")
|
||||
message(FATAL_ERROR "No ${dirname}.deps file found in ${CMAKE_CURRENT_SOURCE_DIR}/")
|
||||
endif (NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${dirname}.deps")
|
||||
file(STRINGS "${CMAKE_CURRENT_SOURCE_DIR}/${dirname}.deps" DEP_LINES)
|
||||
string(TOLOWER "${proot}" lr)
|
||||
|
||||
# Add each dependency to this directory's _DEPENDS list
|
||||
foreach(dl ${DEP_LINES})
|
||||
set(${proot}_DEPENDS ${${proot}_DEPENDS} ${dl})
|
||||
endforeach(dl ${DEP_LINES})
|
||||
|
||||
# Add all dependencies to the global ALL_DEPENDENCIES list
|
||||
get_property(ALL_DEPS GLOBAL PROPERTY ALL_DEPENDENCIES)
|
||||
set(ALL_DEPS ${ALL_DEPS} ${${proot}_DEPENDS})
|
||||
list(SORT ALL_DEPS)
|
||||
list(REMOVE_DUPLICATES ALL_DEPS)
|
||||
set_property(GLOBAL PROPERTY ALL_DEPENDENCIES ${ALL_DEPS})
|
||||
|
||||
# Set the TARGET variables for CMake generator expression "if" tests
|
||||
TargetVars(${proot}_DEPENDS)
|
||||
|
||||
endmacro(RegisterDeps)
|
||||
|
||||
macro(TargetInstallDeps croot roots)
|
||||
foreach(root ${${roots}})
|
||||
if (TARGET ${root}_BLD)
|
||||
ExternalProject_Add_stepdependencies(${croot}_BLD configure ${root}_BLD-install)
|
||||
endif (TARGET ${root}_BLD)
|
||||
endforeach(root ${${root}})
|
||||
endmacro(TargetInstallDeps root)
|
||||
|
||||
###############################################################################
|
||||
# We're using submodules to avoid automatically having to download a huge
|
||||
# amount of source code if it isn't needed. Define a convenience function
|
||||
# to use in the project to populate the submodule checkouts if needed.
|
||||
###############################################################################
|
||||
function(git_submodule_init path checkfile)
|
||||
string(REGEX REPLACE "[^A-Za-z0-9_+.-]" "_" stamp_name "${path}")
|
||||
set(sha1_stamp "${CMAKE_CURRENT_BINARY_DIR}/build_sha1_${stamp_name}.txt")
|
||||
if (NOT EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${path}/${checkfile})
|
||||
find_program(GIT_EXECUTABLE git)
|
||||
if (NOT GIT_EXECUTABLE)
|
||||
message(FATAL_ERROR "Need to populate Git submodule, but unable to find git executable")
|
||||
endif (NOT GIT_EXECUTABLE)
|
||||
set(git_args submodule update --init --recursive)
|
||||
if (GIT_SHALLOW_CLONE)
|
||||
list(APPEND git_args --recommend-shallow)
|
||||
endif (GIT_SHALLOW_CLONE)
|
||||
if (WIN32)
|
||||
list(PREPEND git_args -c core.longpaths=true)
|
||||
endif (WIN32)
|
||||
execute_process(
|
||||
COMMAND ${GIT_EXECUTABLE} ${git_args} ${path}
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
COMMAND_ERROR_IS_FATAL ANY
|
||||
)
|
||||
if (NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${path}/${checkfile}")
|
||||
message(FATAL_ERROR "Git submodule ${path} is missing ${checkfile} after checkout")
|
||||
endif ()
|
||||
execute_process(
|
||||
COMMAND git log -1 --format=%H
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/${path}
|
||||
OUTPUT_VARIABLE GIT_SHA1
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
)
|
||||
file(WRITE "${sha1_stamp}" ${GIT_SHA1})
|
||||
else (NOT EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${path}/${checkfile})
|
||||
execute_process(
|
||||
COMMAND git log -1 --format=%H
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/${path}
|
||||
OUTPUT_VARIABLE GIT_SHA1
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
)
|
||||
if (EXISTS "${sha1_stamp}" )
|
||||
file(READ "${sha1_stamp}" BUILD_SHA1)
|
||||
if (NOT "${BUILD_SHA1}" MATCHES "${GIT_SHA1}")
|
||||
message("Outdated sha1 stamp found for ${path}: resetting build directory ${CMAKE_CURRENT_BINARY_DIR}")
|
||||
execute_process(
|
||||
COMMAND ${CMAKE_COMMAND} -E rm -rf ${CMAKE_CURRENT_BINARY_DIR}
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/..
|
||||
)
|
||||
file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}")
|
||||
endif (NOT "${BUILD_SHA1}" MATCHES "${GIT_SHA1}")
|
||||
endif()
|
||||
file(WRITE "${sha1_stamp}" ${GIT_SHA1})
|
||||
endif (NOT EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${path}/${checkfile})
|
||||
endfunction(git_submodule_init path)
|
||||
|
||||
###############################################################################
|
||||
# If we're using BRLCAD_COMPONENTS, the check of enabled/disabled is more
|
||||
# nuanced. For bext, the BRLCAD_COMPONENTS list should be the expanded list
|
||||
# from BRL-CAD's parent logic that fully populates the dependencies, not just
|
||||
# the components directly specified by the user to BRL-CAD's configure.
|
||||
###############################################################################
|
||||
function(cad_enable pname components)
|
||||
if (DEFINED BRLCAD_COMPONENTS)
|
||||
|
||||
# To avoid problems passing multiple components in, we support using ':' as
|
||||
# a delimiter in addition to the standard CMake list entry delimiter ';'.
|
||||
# TODO: If this doesn't cut it we'll probably have to pass in a file
|
||||
# containing a list and read that.
|
||||
string(REPLACE ":" ";" BRLCAD_COMPONENTS "${BRLCAD_COMPONENTS}")
|
||||
|
||||
# In case the component list changed, make sure we're
|
||||
# not using a cached result.
|
||||
unset(ENABLE_${pname} CACHE)
|
||||
unset(DISABLE_${pname} CACHE)
|
||||
|
||||
set(acomponents ${components})
|
||||
|
||||
# Look for a component in the list
|
||||
foreach(c ${BRLCAD_COMPONENTS})
|
||||
list(FIND acomponents ${c} LFIND)
|
||||
if (NOT LFIND EQUAL -1)
|
||||
bext_enable_all_default(${pname} ${pname})
|
||||
set(ENABLE_${pname} ${ENABLE_${pname}} PARENT_SCOPE)
|
||||
set(DISABLE_${pname} OFF PARENT_SCOPE)
|
||||
return()
|
||||
endif (NOT LFIND EQUAL -1)
|
||||
endforeach(c ${components})
|
||||
|
||||
# If we're a component build and this component
|
||||
# isn't enabled, it's a definite off
|
||||
set(ENABLE_${pname} OFF)
|
||||
set(DISABLE_${pname} ON)
|
||||
endif (DEFINED BRLCAD_COMPONENTS)
|
||||
|
||||
# Check for ENABLE_ALL
|
||||
bext_enable_all_default(${pname} ${pname})
|
||||
|
||||
# Final decision
|
||||
set(ENABLE_${pname} ${ENABLE_${pname}} PARENT_SCOPE)
|
||||
set(DISABLE_${pname} ${DISABLE_${pname}} PARENT_SCOPE)
|
||||
endfunction(cad_enable pname components)
|
||||
|
||||
###############################################################################
|
||||
# The enable-disable-find logic for many dependencies follows a pattern. Try
|
||||
# to wrap that pattern up so we can more easily adjust it for multiple projects
|
||||
# simultaneously.
|
||||
###############################################################################
|
||||
macro(bext_enable pname)
|
||||
string(TOUPPER "${pname}" upname)
|
||||
#string(TOLOWER "${pname}" lpname)
|
||||
|
||||
bext_enable_all_default(${upname} ${pname})
|
||||
|
||||
if (NOT ENABLE_${upname} AND NOT DISABLE_${upname})
|
||||
|
||||
# This is an optional probe: a "not found" result is the normal, expected
|
||||
# path that simply turns on the local build below, and the configure
|
||||
# summary already reports which packages are built locally vs. found on the
|
||||
# system. Pass QUIET so a missing package does not emit CMake's verbose
|
||||
# "could not find a package configuration file" warning, which is noise
|
||||
# here rather than something the developer needs to act on.
|
||||
find_package(${pname} QUIET)
|
||||
|
||||
if (NOT ${pname}_FOUND AND NOT DEFINED ENABLE_${upname})
|
||||
set(ENABLE_${upname} "ON" CACHE BOOL "Enable ${pname} build")
|
||||
endif (NOT ${pname}_FOUND AND NOT DEFINED ENABLE_${upname})
|
||||
|
||||
endif (NOT ENABLE_${upname} AND NOT DISABLE_${upname})
|
||||
set(ENABLE_${upname} "${ENABLE_${upname}}" CACHE BOOL "Enable ${pname} build")
|
||||
endmacro(bext_enable pname)
|
||||
|
||||
###############################################################################
|
||||
# Configure summary helpers
|
||||
###############################################################################
|
||||
macro(bext_enable_all_default enable_name summary_name)
|
||||
if (ENABLE_ALL AND NOT DEFINED ENABLE_${enable_name})
|
||||
set(ENABLE_${enable_name} ON)
|
||||
endif (ENABLE_ALL AND NOT DEFINED ENABLE_${enable_name})
|
||||
if (ENABLE_ALL AND ENABLE_${enable_name})
|
||||
string(TOUPPER "${summary_name}" bext_enable_all_tracking_name)
|
||||
string(REPLACE "-" "_" bext_enable_all_tracking_name "${bext_enable_all_tracking_name}")
|
||||
set(BEXT_ENABLE_ALL_FORCED_${bext_enable_all_tracking_name} ON CACHE INTERNAL "Project selected for local build while ENABLE_ALL is active")
|
||||
endif (ENABLE_ALL AND ENABLE_${enable_name})
|
||||
endmacro(bext_enable_all_default enable_name summary_name)
|
||||
|
||||
function(_bext_summary_append property_name value)
|
||||
get_property(values GLOBAL PROPERTY ${property_name})
|
||||
list(APPEND values "${value}")
|
||||
list(REMOVE_DUPLICATES values)
|
||||
set_property(GLOBAL PROPERTY ${property_name} "${values}")
|
||||
endfunction(_bext_summary_append property_name value)
|
||||
|
||||
function(_bext_summary_project_uses_local_build out pname upname)
|
||||
set(local_build FALSE)
|
||||
|
||||
if (TARGET ${upname}_BLD)
|
||||
set(local_build TRUE)
|
||||
endif (TARGET ${upname}_BLD)
|
||||
|
||||
if (DEFINED ENABLE_${upname} AND ENABLE_${upname})
|
||||
set(local_build TRUE)
|
||||
endif (DEFINED ENABLE_${upname} AND ENABLE_${upname})
|
||||
|
||||
if ("${pname}" STREQUAL "flexbison")
|
||||
if (TARGET FLEX_BLD OR TARGET BISON_BLD)
|
||||
set(local_build TRUE)
|
||||
endif (TARGET FLEX_BLD OR TARGET BISON_BLD)
|
||||
endif ("${pname}" STREQUAL "flexbison")
|
||||
|
||||
if ("${pname}" STREQUAL "qt")
|
||||
if (TARGET Qt6_BLD OR TARGET Qt6Svg_BLD)
|
||||
set(local_build TRUE)
|
||||
endif (TARGET Qt6_BLD OR TARGET Qt6Svg_BLD)
|
||||
endif ("${pname}" STREQUAL "qt")
|
||||
|
||||
if ("${pname}" STREQUAL "tk")
|
||||
if (TARGET TK_BLD)
|
||||
set(local_build TRUE)
|
||||
endif (TARGET TK_BLD)
|
||||
endif ("${pname}" STREQUAL "tk")
|
||||
|
||||
set(${out} ${local_build} PARENT_SCOPE)
|
||||
endfunction(_bext_summary_project_uses_local_build out pname upname)
|
||||
|
||||
function(_bext_summary_list_to_string out values)
|
||||
set(list_values ${values})
|
||||
if (list_values)
|
||||
list(SORT list_values)
|
||||
string(REPLACE ";" ", " rendered "${list_values}")
|
||||
else (list_values)
|
||||
set(rendered "none")
|
||||
endif (list_values)
|
||||
set(${out} "${rendered}" PARENT_SCOPE)
|
||||
endfunction(_bext_summary_list_to_string out values)
|
||||
|
||||
function(bext_print_configure_summary)
|
||||
set(active_groups)
|
||||
foreach(grp APPLESEED BRLCAD BRLCAD_EXTRA GDAL OSPRAY QT TCL)
|
||||
if (USE_${grp})
|
||||
list(APPEND active_groups ${grp})
|
||||
endif (USE_${grp})
|
||||
endforeach(grp APPLESEED BRLCAD BRLCAD_EXTRA GDAL OSPRAY QT TCL)
|
||||
|
||||
get_property(local_projects GLOBAL PROPERTY BEXT_SUMMARY_LOCAL_PROJECTS)
|
||||
get_property(system_projects GLOBAL PROPERTY BEXT_SUMMARY_SYSTEM_PROJECTS)
|
||||
get_property(skipped_projects GLOBAL PROPERTY BEXT_SUMMARY_SKIPPED_PROJECTS)
|
||||
get_property(forced_projects GLOBAL PROPERTY BEXT_SUMMARY_ENABLE_ALL_PROJECTS)
|
||||
|
||||
_bext_summary_list_to_string(active_groups_str "${active_groups}")
|
||||
_bext_summary_list_to_string(local_projects_str "${local_projects}")
|
||||
_bext_summary_list_to_string(system_projects_str "${system_projects}")
|
||||
_bext_summary_list_to_string(skipped_projects_str "${skipped_projects}")
|
||||
_bext_summary_list_to_string(forced_projects_str "${forced_projects}")
|
||||
|
||||
message(STATUS "")
|
||||
message(STATUS "bext configure summary")
|
||||
message(STATUS " active USE_* groups: ${active_groups_str}")
|
||||
message(STATUS " local builds: ${local_projects_str}")
|
||||
message(STATUS " not built locally: ${system_projects_str}")
|
||||
if (ENABLE_ALL)
|
||||
message(STATUS " ENABLE_ALL local-build set: ${forced_projects_str}")
|
||||
endif (ENABLE_ALL)
|
||||
message(STATUS " skipped because group inactive: ${skipped_projects_str}")
|
||||
message(STATUS " bundled output root: ${CMAKE_BUNDLE_INSTALL_PREFIX}")
|
||||
message(STATUS " noinstall output root: ${CMAKE_NOBUNDLE_INSTALL_PREFIX}")
|
||||
message(STATUS "")
|
||||
endfunction(bext_print_configure_summary)
|
||||
|
||||
###############################################################################
|
||||
# The primary add_project function used to add individual dependency
|
||||
# directories.
|
||||
###############################################################################
|
||||
function(add_project pname)
|
||||
cmake_parse_arguments(A "" "" "GROUPS" ${ARGN})
|
||||
string(TOUPPER "${pname}" UPNAME)
|
||||
string(REPLACE "-" "_" UPNAME "${UPNAME}")
|
||||
if (NOT A_GROUPS)
|
||||
add_subdirectory(${pname})
|
||||
_bext_summary_project_uses_local_build(local_build ${pname} ${UPNAME})
|
||||
if (local_build)
|
||||
_bext_summary_append(BEXT_SUMMARY_LOCAL_PROJECTS ${pname})
|
||||
if (ENABLE_ALL AND BEXT_ENABLE_ALL_FORCED_${UPNAME})
|
||||
_bext_summary_append(BEXT_SUMMARY_ENABLE_ALL_PROJECTS ${pname})
|
||||
endif (ENABLE_ALL AND BEXT_ENABLE_ALL_FORCED_${UPNAME})
|
||||
else (local_build)
|
||||
_bext_summary_append(BEXT_SUMMARY_SYSTEM_PROJECTS ${pname})
|
||||
endif (local_build)
|
||||
set(${UPNAME}_ADDED 1 PARENT_SCOPE)
|
||||
return()
|
||||
endif (NOT A_GROUPS)
|
||||
set(is_added FALSE)
|
||||
foreach(grp ${A_GROUPS})
|
||||
if (USE_${grp})
|
||||
add_subdirectory(${pname})
|
||||
set(is_added TRUE)
|
||||
set(${UPNAME}_ADDED 1 PARENT_SCOPE)
|
||||
break()
|
||||
endif (USE_${grp})
|
||||
endforeach(grp ${A_GROUPS})
|
||||
if (is_added)
|
||||
_bext_summary_project_uses_local_build(local_build ${pname} ${UPNAME})
|
||||
if (local_build)
|
||||
_bext_summary_append(BEXT_SUMMARY_LOCAL_PROJECTS ${pname})
|
||||
if (ENABLE_ALL AND BEXT_ENABLE_ALL_FORCED_${UPNAME})
|
||||
_bext_summary_append(BEXT_SUMMARY_ENABLE_ALL_PROJECTS ${pname})
|
||||
endif (ENABLE_ALL AND BEXT_ENABLE_ALL_FORCED_${UPNAME})
|
||||
else (local_build)
|
||||
_bext_summary_append(BEXT_SUMMARY_SYSTEM_PROJECTS ${pname})
|
||||
endif (local_build)
|
||||
endif (is_added)
|
||||
if (NOT is_added)
|
||||
_bext_summary_append(BEXT_SUMMARY_SKIPPED_PROJECTS ${pname})
|
||||
if (ENABLE_${UPNAME})
|
||||
message("Disabling ${pname}")
|
||||
set(STALE_INSTALL_WARN TRUE PARENT_SCOPE)
|
||||
endif (ENABLE_${UPNAME})
|
||||
execute_process(COMMAND ${CMAKE_COMMAND} -E rm -rf ${CMAKE_BINARY_DIR}/${pname})
|
||||
unset(ENABLE_${UPNAME} CACHE)
|
||||
endif (NOT is_added)
|
||||
endfunction(add_project pname)
|
||||
|
||||
###############################################################################
|
||||
# Make the built-in clean target reset ExternalProject working state without
|
||||
# requiring a top-level CMake reconfigure. We preserve the generated control
|
||||
# files in STAMP_DIR and TMP_DIR, but remove the step marker files and any
|
||||
# generated source/build directories that can be safely recreated by the next
|
||||
# build.
|
||||
###############################################################################
|
||||
function(_bext_collect_subdirs out dir)
|
||||
set(dirs "${dir}")
|
||||
get_property(subdirs DIRECTORY "${dir}" PROPERTY SUBDIRECTORIES)
|
||||
foreach(subdir ${subdirs})
|
||||
_bext_collect_subdirs(child_dirs "${subdir}")
|
||||
list(APPEND dirs ${child_dirs})
|
||||
endforeach()
|
||||
set(${out} "${dirs}" PARENT_SCOPE)
|
||||
endfunction(_bext_collect_subdirs out dir)
|
||||
|
||||
function(_bext_path_is_in_build_tree out path)
|
||||
if (NOT path)
|
||||
set(${out} FALSE PARENT_SCOPE)
|
||||
return()
|
||||
endif()
|
||||
|
||||
file(RELATIVE_PATH rel "${CMAKE_BINARY_DIR}" "${path}")
|
||||
if (IS_ABSOLUTE "${rel}" OR "${rel}" MATCHES "^\\.\\.")
|
||||
set(${out} FALSE PARENT_SCOPE)
|
||||
else()
|
||||
set(${out} TRUE PARENT_SCOPE)
|
||||
endif()
|
||||
endfunction(_bext_path_is_in_build_tree out path)
|
||||
|
||||
function(_bext_register_extproject_clean ep_target)
|
||||
if (NOT TARGET ${ep_target})
|
||||
return()
|
||||
endif()
|
||||
|
||||
ExternalProject_Get_Property(${ep_target} SOURCE_DIR)
|
||||
set(ep_source_dir "${SOURCE_DIR}")
|
||||
ExternalProject_Get_Property(${ep_target} BINARY_DIR)
|
||||
set(ep_build_dir "${BINARY_DIR}")
|
||||
ExternalProject_Get_Property(${ep_target} STAMP_DIR)
|
||||
set(ep_stamp_dir "${STAMP_DIR}")
|
||||
|
||||
_bext_path_is_in_build_tree(ep_source_is_generated "${ep_source_dir}")
|
||||
_bext_path_is_in_build_tree(ep_build_is_generated "${ep_build_dir}")
|
||||
|
||||
set(clean_files
|
||||
"${ep_stamp_dir}/${ep_target}-mkdir"
|
||||
"${ep_stamp_dir}/${ep_target}-configure"
|
||||
"${ep_stamp_dir}/${ep_target}-build"
|
||||
"${ep_stamp_dir}/${ep_target}-install"
|
||||
"${ep_stamp_dir}/${ep_target}-done"
|
||||
)
|
||||
|
||||
# If the source tree is a generated copy in the build directory, remove it
|
||||
# and force the full download/update/patch pipeline to rerun on next build.
|
||||
if (ep_source_is_generated)
|
||||
list(APPEND clean_files
|
||||
"${ep_stamp_dir}/${ep_target}-download"
|
||||
"${ep_stamp_dir}/${ep_target}-update"
|
||||
"${ep_stamp_dir}/${ep_target}-patch"
|
||||
"${ep_source_dir}"
|
||||
)
|
||||
endif()
|
||||
|
||||
# Some wrappers use a separate generated binary directory outside the default
|
||||
# *_BLD-prefix/src tree (Qt is the main case.) If it lives in the build tree
|
||||
# and isn't the same path as SOURCE_DIR, it is safe to remove here.
|
||||
if (ep_build_is_generated AND NOT "${ep_build_dir}" STREQUAL "${ep_source_dir}")
|
||||
list(APPEND clean_files "${ep_build_dir}")
|
||||
endif()
|
||||
|
||||
list(REMOVE_DUPLICATES clean_files)
|
||||
set_property(TARGET ${ep_target} APPEND PROPERTY ADDITIONAL_CLEAN_FILES "${clean_files}")
|
||||
if (TARGET ${ep_target}-install)
|
||||
set_property(TARGET ${ep_target}-install APPEND PROPERTY ADDITIONAL_CLEAN_FILES "${clean_files}")
|
||||
endif()
|
||||
endfunction(_bext_register_extproject_clean ep_target)
|
||||
|
||||
function(register_external_project_clean_targets)
|
||||
_bext_collect_subdirs(all_dirs "${CMAKE_SOURCE_DIR}")
|
||||
list(REMOVE_DUPLICATES all_dirs)
|
||||
foreach(dir ${all_dirs})
|
||||
get_property(dir_targets DIRECTORY "${dir}" PROPERTY BUILDSYSTEM_TARGETS)
|
||||
foreach(dir_target ${dir_targets})
|
||||
if ("${dir_target}" MATCHES "_BLD$")
|
||||
_bext_register_extproject_clean("${dir_target}")
|
||||
endif()
|
||||
endforeach()
|
||||
endforeach()
|
||||
endfunction(register_external_project_clean_targets)
|
||||
|
||||
|
||||
# Local Variables:
|
||||
# tab-width: 8
|
||||
# mode: cmake
|
||||
# indent-tabs-mode: t
|
||||
# End:
|
||||
# ex: shiftwidth=2 tabstop=8
|
||||
+848
-974
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,165 @@
|
||||
{
|
||||
"version": 3,
|
||||
"cmakeMinimumRequired": {
|
||||
"major": 3,
|
||||
"minor": 21,
|
||||
"patch": 0
|
||||
},
|
||||
"configurePresets": [
|
||||
{
|
||||
"name": "layout",
|
||||
"hidden": true,
|
||||
"description": "Output layout for presets whose name already carries the config (e.g. auto/Release, auto/Debug): build/<profile>/<Config>. Release and Debug trees sit side by side so both configs can be kept and consumed at once.",
|
||||
"binaryDir": "${sourceDir}/build/${presetName}"
|
||||
},
|
||||
{
|
||||
"name": "layout-implicit-release",
|
||||
"hidden": true,
|
||||
"description": "Output layout for the unqualified convenience aliases (e.g. --preset=auto): build/<profile>/Release. Resolves to the same tree as <profile>/Release.",
|
||||
"binaryDir": "${sourceDir}/build/${presetName}/Release"
|
||||
},
|
||||
{
|
||||
"name": "type-release",
|
||||
"hidden": true,
|
||||
"description": "Single-config Release build type (matches a BRL-CAD Release build).",
|
||||
"cacheVariables": {
|
||||
"CMAKE_BUILD_TYPE": "Release"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "type-debug",
|
||||
"hidden": true,
|
||||
"description": "Single-config Debug build type (matches a BRL-CAD Debug build).",
|
||||
"cacheVariables": {
|
||||
"CMAKE_BUILD_TYPE": "Debug"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "profile-auto",
|
||||
"hidden": true,
|
||||
"description": "Standard BRL-CAD-oriented profile. Use suitable system packages when found and build local copies only when needed.",
|
||||
"cacheVariables": {
|
||||
"USE_APPLESEED": "OFF",
|
||||
"USE_BRLCAD": "ON",
|
||||
"USE_BRLCAD_EXTRA": "ON",
|
||||
"USE_GDAL": "ON",
|
||||
"USE_OSPRAY": "OFF",
|
||||
"USE_QT": "ON",
|
||||
"USE_TCL": "ON"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "profile-bundled",
|
||||
"hidden": true,
|
||||
"description": "Standard BRL-CAD-oriented profile with bundled/local builds preferred for all active dependency groups.",
|
||||
"cacheVariables": {
|
||||
"ENABLE_ALL": "ON",
|
||||
"USE_APPLESEED": "OFF",
|
||||
"USE_BRLCAD": "ON",
|
||||
"USE_BRLCAD_EXTRA": "ON",
|
||||
"USE_GDAL": "ON",
|
||||
"USE_OSPRAY": "OFF",
|
||||
"USE_QT": "ON",
|
||||
"USE_TCL": "ON"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "profile-minimal",
|
||||
"hidden": true,
|
||||
"description": "Core BRL-CAD profile without extras, GDAL, Qt, Tcl/Tk, Appleseed, or OSPRay.",
|
||||
"cacheVariables": {
|
||||
"USE_APPLESEED": "OFF",
|
||||
"USE_BRLCAD": "ON",
|
||||
"USE_BRLCAD_EXTRA": "OFF",
|
||||
"USE_GDAL": "OFF",
|
||||
"USE_OSPRAY": "OFF",
|
||||
"USE_QT": "OFF",
|
||||
"USE_TCL": "OFF"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "profile-everything",
|
||||
"hidden": true,
|
||||
"description": "Enable all current dependency groups and prefer bundled/local builds for all of them.",
|
||||
"cacheVariables": {
|
||||
"ENABLE_ALL": "ON",
|
||||
"USE_APPLESEED": "ON",
|
||||
"USE_BRLCAD": "ON",
|
||||
"USE_BRLCAD_EXTRA": "ON",
|
||||
"USE_GDAL": "ON",
|
||||
"USE_OSPRAY": "ON",
|
||||
"USE_QT": "ON",
|
||||
"USE_TCL": "ON",
|
||||
"CMAKE_POLICY_VERSION_MINIMUM": "3.5"
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
"name": "auto",
|
||||
"displayName": "Auto (Release)",
|
||||
"description": "Convenience alias for auto/Release.",
|
||||
"inherits": ["layout-implicit-release", "profile-auto", "type-release"]
|
||||
},
|
||||
{
|
||||
"name": "auto/Release",
|
||||
"displayName": "Auto (Release)",
|
||||
"inherits": ["layout", "profile-auto", "type-release"]
|
||||
},
|
||||
{
|
||||
"name": "auto/Debug",
|
||||
"displayName": "Auto (Debug)",
|
||||
"inherits": ["layout", "profile-auto", "type-debug"]
|
||||
},
|
||||
|
||||
{
|
||||
"name": "bundled",
|
||||
"displayName": "Bundled (Release)",
|
||||
"description": "Convenience alias for bundled/Release.",
|
||||
"inherits": ["layout-implicit-release", "profile-bundled", "type-release"]
|
||||
},
|
||||
{
|
||||
"name": "bundled/Release",
|
||||
"displayName": "Bundled (Release)",
|
||||
"inherits": ["layout", "profile-bundled", "type-release"]
|
||||
},
|
||||
{
|
||||
"name": "bundled/Debug",
|
||||
"displayName": "Bundled (Debug)",
|
||||
"inherits": ["layout", "profile-bundled", "type-debug"]
|
||||
},
|
||||
|
||||
{
|
||||
"name": "minimal",
|
||||
"displayName": "Minimal (Release)",
|
||||
"description": "Convenience alias for minimal/Release.",
|
||||
"inherits": ["layout-implicit-release", "profile-minimal", "type-release"]
|
||||
},
|
||||
{
|
||||
"name": "minimal/Release",
|
||||
"displayName": "Minimal (Release)",
|
||||
"inherits": ["layout", "profile-minimal", "type-release"]
|
||||
},
|
||||
{
|
||||
"name": "minimal/Debug",
|
||||
"displayName": "Minimal (Debug)",
|
||||
"inherits": ["layout", "profile-minimal", "type-debug"]
|
||||
},
|
||||
|
||||
{
|
||||
"name": "everything",
|
||||
"displayName": "Everything (Release)",
|
||||
"description": "Convenience alias for everything/Release.",
|
||||
"inherits": ["layout-implicit-release", "profile-everything", "type-release"]
|
||||
},
|
||||
{
|
||||
"name": "everything/Release",
|
||||
"displayName": "Everything (Release)",
|
||||
"inherits": ["layout", "profile-everything", "type-release"]
|
||||
},
|
||||
{
|
||||
"name": "everything/Debug",
|
||||
"displayName": "Everything (Debug)",
|
||||
"inherits": ["layout", "profile-everything", "type-debug"]
|
||||
}
|
||||
]
|
||||
}
|
||||
+172
@@ -0,0 +1,172 @@
|
||||
# bext - Dependency Reference
|
||||
|
||||
This file is a package map for `bext`. It shows which `USE_*` groups can bring
|
||||
each project into scope and whether its outputs land in `install/` or
|
||||
`noinstall/`.
|
||||
|
||||
A package listed here may still use a system installation instead of building a
|
||||
local copy unless `ENABLE_ALL=ON` or `ENABLE_<pkg>=ON` is used.
|
||||
|
||||
For some BRL-CAD-related packages, `BRLCAD_COMPONENTS` can narrow the final
|
||||
selection further.
|
||||
|
||||
# Output types
|
||||
|
||||
* `install` - bundled output intended for downstream use
|
||||
* `noinstall` - build-only tool or compile-time-only asset
|
||||
|
||||
# Projects
|
||||
|
||||
<!-- BEGIN GENERATED PROJECT TABLE -->
|
||||
<!-- Generated by CMake/GenerateDependencyDocs.cmake; do not edit this block. -->
|
||||
| Project | `USE_*` group(s) | Output | Dependencies | Source |
|
||||
| --- | --- | --- | --- | --- |
|
||||
| `appleseed` | `USE_APPLESEED` | `install` | `boost`, `eigen`, `embree`, `jpeg`, `llvm`, `lz4`, `onetbb`, `opencolorio`, `openexr`, `openimageio`, `osl`, `patch`, `png`, `tiff`, `xerces-c`, `zlib` | [repository](https://github.com/BRL-CAD/appleseed) |
|
||||
| `assetimport` | `USE_BRLCAD` | `install` | `patch`, `pugixml`, `zlib` | [repository](https://github.com/BRL-CAD/assimp) |
|
||||
| `astyle` | `USE_BRLCAD` | `noinstall` | `patch` | [repository](https://github.com/BRL-CAD/astyle) |
|
||||
| `boost` | `USE_APPLESEED` | `install` | `icu`, `patch`, `zlib`, `zstd` | [repository](https://github.com/BRL-CAD/boost) |
|
||||
| `bullet` | `USE_BRLCAD_EXTRA` | `install` | `patch` | [repository](https://github.com/BRL-CAD/bullet3.git) |
|
||||
| `clipper2` | `USE_BRLCAD` | `install` | `patch` | [repository](https://github.com/BRL-CAD/Clipper2.git) |
|
||||
| `deflate` | `USE_APPLESEED` | `install` | `patch` | [repository](https://github.com/BRL-CAD/libdeflate) |
|
||||
| `eigen` | `USE_BRLCAD`, `USE_APPLESEED` | `noinstall` | `patch` | [repository](https://github.com/BRL-CAD/eigen) |
|
||||
| `embree` | `USE_APPLESEED`, `USE_OSPRAY` | `install` | `boost`, `onetbb`, `patch`, `zlib` | [repository](https://github.com/BRL-CAD/embree) |
|
||||
| `expat` | `USE_APPLESEED` | `install` | `patch` | [repository](https://github.com/BRL-CAD/libexpat) |
|
||||
| `flexbison` | `USE_APPLESEED`, `USE_OSPRAY` | `noinstall` | — | [repository](https://github.com/BRL-CAD/winflexbison) |
|
||||
| `fmt` | `USE_APPLESEED` | `install` | `patch` | [repository](https://github.com/BRL-CAD/fmt) |
|
||||
| `gdal` | `USE_GDAL` | `install` | `patch`, `png`, `proj`, `sqlite3`, `tiff`, `zlib` | [repository](https://github.com/BRL-CAD/gdal) |
|
||||
| `gte` | `USE_BRLCAD` | `noinstall` | `patch` | [repository](https://github.com/BRL-CAD/GeometricTools) |
|
||||
| `icu` | `USE_APPLESEED` | `install` | `patch` | [repository](https://github.com/BRL-CAD/icu) |
|
||||
| `ispc` | `USE_OSPRAY` | `install` | `bison`, `flex`, `patch`, `llvm`, `ncurses`, `zlib` | [repository](https://github.com/BRL-CAD/ispc) |
|
||||
| `itcl` | `USE_TCL` | `install` | `patch`, `tcl` | [repository](https://github.com/BRL-CAD/itcl) |
|
||||
| `itk` | `USE_TCL` | `install` | `patch`, `tcl`, `tk`, `itcl` | [repository](https://github.com/BRL-CAD/itk) |
|
||||
| `iwidgets` | `USE_TCL` | `install` | `patch`, `itcl`, `itk` | [repository](https://github.com/BRL-CAD/iwidgets) |
|
||||
| `jpeg` | `USE_APPLESEED`, `USE_BRLCAD`, `USE_GDAL` | `install` | `patch` | [repository](https://github.com/BRL-CAD/libjpeg-turbo) |
|
||||
| `lemon` | `USE_BRLCAD` | `noinstall` | `patch` | [repository](https://github.com/BRL-CAD/lemon) |
|
||||
| `lief` | `USE_BRLCAD` | `noinstall` | `patch` | [repository](https://github.com/BRL-CAD/LIEF) |
|
||||
| `llvm` | `USE_APPLESEED`, `USE_OSPRAY` | `install` | `patch`, `zlib` | [repository](https://github.com/BRL-CAD/llvm-project) |
|
||||
| `lmdb` | `USE_BRLCAD` | `install` | `patch` | [repository](https://github.com/BRL-CAD/lmdb) |
|
||||
| `lz4` | `USE_APPLESEED` | `install` | `patch` | [repository](https://github.com/BRL-CAD/lz4) |
|
||||
| `manifold` | `USE_BRLCAD` | `install` | `patch`, `clipper2` | [repository](https://github.com/BRL-CAD/manifold.git) |
|
||||
| `minizip-ng` | `USE_APPLESEED` | `install` | `patch`, `zlib`, `zstd` | [repository](https://github.com/BRL-CAD/minizip-ng) |
|
||||
| `mmesh` | `USE_BRLCAD` | `install` | `patch` | [repository](https://github.com/BRL-CAD/mmesh.git) |
|
||||
| `ncurses` | `USE_OSPRAY` | `install` | `patch` | [repository](https://github.com/BRL-CAD/ncurses) |
|
||||
| `netpbm` | `USE_BRLCAD` | `install` | `patch` | [repository](https://github.com/BRL-CAD/netpbm) |
|
||||
| `oidn` | `USE_OSPRAY` | `install` | `ispc`, `onetbb` | [repository](https://github.com/BRL-CAD/oidn) |
|
||||
| `onetbb` | `USE_APPLESEED`, `USE_OSPRAY`, `USE_BRLCAD` | `install` | `patch` | [repository](https://github.com/BRL-CAD/oneTBB) |
|
||||
| `opencolorio` | `USE_APPLESEED` | `install` | `expat`, `minizip-ng`, `openexr`, `patch`, `pystring`, `yaml-cpp`, `zlib`, `zstd` | [repository](https://github.com/BRL-CAD/OpenColorIO) |
|
||||
| `opencv` | `USE_BRLCAD_EXTRA` | `install` | `patch`, `png`, `zlib` | [repository](https://github.com/BRL-CAD/opencv) |
|
||||
| `openexr` | `USE_APPLESEED` | `install` | `deflate`, `patch` | [repository](https://github.com/BRL-CAD/openexr) |
|
||||
| `openimageio` | `USE_APPLESEED` | `install` | `boost`, `fmt`, `jpeg`, `opencolorio`, `openexr`, `patch`, `png`, `tiff`, `zlib` | [repository](https://github.com/BRL-CAD/oiio) |
|
||||
| `opennurbs` | `USE_BRLCAD` | `install` | `patch`, `zlib` | [repository](https://github.com/BRL-CAD/opennurbs) |
|
||||
| `openvdb` | `USE_BRLCAD_EXTRA` | `install` | `onetbb`, `patch`, `zlib` | [repository](https://github.com/BRL-CAD/openvdb) |
|
||||
| `osl` | `USE_APPLESEED` | `install` | `bison`, `boost`, `flex`, `llvm`, `openexr`, `openimageio`, `patch`, `pugixml`, `zlib` | [repository](https://github.com/BRL-CAD/OpenShadingLanguage) |
|
||||
| `osmesa` | `USE_BRLCAD` | `install` | `patch` | [repository](https://github.com/BRL-CAD/osmesa) |
|
||||
| `ospray` | `USE_OSPRAY` | `install` | `embree`, `ispc`, `oidn`, `onetbb`, `patch`, `rkcommon` | [repository](https://github.com/BRL-CAD/ospray) |
|
||||
| `patch` | always considered | `noinstall` | — | [repository](https://github.com/BRL-CAD/patch) |
|
||||
| `perplex` | `USE_BRLCAD` | `noinstall` | `patch`, `lemon`, `re2c` | [repository](https://github.com/BRL-CAD/perplex) |
|
||||
| `plief` | `USE_BRLCAD` | `noinstall` | `lief`, `patch` | [repository](https://github.com/BRL-CAD/plief) |
|
||||
| `png` | `USE_APPLESEED`, `USE_BRLCAD`, `USE_TCL` | `install` | `patch`, `zlib` | [repository](https://github.com/BRL-CAD/libpng) |
|
||||
| `poissonrecon` | `USE_BRLCAD` | `noinstall` | `patch` | [repository](https://github.com/BRL-CAD/PoissonRecon) |
|
||||
| `proj` | `USE_GDAL` | `install` | `patch`, `sqlite3` | [repository](https://github.com/BRL-CAD/PROJ) |
|
||||
| `pugixml` | `USE_BRLCAD`, `USE_APPLESEED` | `install` | `patch` | [repository](https://github.com/BRL-CAD/pugixml) |
|
||||
| `pystring` | `USE_APPLESEED` | `install` | `patch` | [repository](https://github.com/BRL-CAD/pystring) |
|
||||
| `qt` | `USE_QT` | `install` | `patch`, `zlib` | [repository](https://github.com/BRL-CAD/qt) |
|
||||
| `re2c` | `USE_BRLCAD` | `noinstall` | `patch` | [repository](https://github.com/BRL-CAD/re2c) |
|
||||
| `regex` | `USE_BRLCAD` | `install` | `patch` | [repository](https://github.com/BRL-CAD/regex) |
|
||||
| `rkcommon` | `USE_OSPRAY` | `install` | `onetbb`, `patch` | [repository](https://github.com/BRL-CAD/rkcommon) |
|
||||
| `sqlite3` | `USE_GDAL` | `install` | `patch` | [repository](https://github.com/BRL-CAD/sqlite3.git) |
|
||||
| `stepcode` | `USE_BRLCAD_EXTRA` | `install` | `lemon`, `patch`, `perplex`, `re2c` | [repository](https://github.com/BRL-CAD/stepcode) |
|
||||
| `strclear` | `USE_BRLCAD` | `noinstall` | `patch` | [repository](https://github.com/BRL-CAD/strclear) |
|
||||
| `tcl` | `USE_TCL` | `install` | `patch`, `zlib` | [repository](https://github.com/BRL-CAD/tcl.git) |
|
||||
| `tiff` | `USE_APPLESEED`, `USE_GDAL` | `install` | `jpeg`, `patch`, `zlib` | [repository](https://github.com/BRL-CAD/libtiff) |
|
||||
| `tinygltf` | `USE_BRLCAD` | `install` | `patch` | [repository](https://github.com/BRL-CAD/tinygltf.git) |
|
||||
| `tk` | `USE_TCL` | `install` | `patch`, `tcl` | [repository](https://github.com/BRL-CAD/tk) |
|
||||
| `tkhtml` | `USE_TCL` | `install` | `patch`, `tcl`, `tk` | [repository](https://github.com/BRL-CAD/tkhtml) |
|
||||
| `tktable` | `USE_TCL` | `install` | `patch`, `tcl`, `tk` | [repository](https://github.com/BRL-CAD/tktable) |
|
||||
| `xerces-c` | `USE_APPLESEED` | `install` | `icu`, `patch` | [repository](https://github.com/BRL-CAD/xerces-c) |
|
||||
| `yaml-cpp` | `USE_APPLESEED` | `install` | `patch` | [repository](https://github.com/BRL-CAD/yaml-cpp) |
|
||||
| `zlib` | `USE_APPLESEED`, `USE_BRLCAD`, `USE_OSPRAY`, `USE_TCL` | `install` | `patch` | [repository](https://github.com/BRL-CAD/zlib) |
|
||||
| `zstd` | `USE_APPLESEED`, `USE_OSPRAY` | `install` | `patch` | [repository](https://github.com/BRL-CAD/zstd) |
|
||||
<!-- END GENERATED PROJECT TABLE -->
|
||||
|
||||
# Notes
|
||||
|
||||
* `install/` versus `noinstall/` is about downstream use, not importance.
|
||||
Several `noinstall` entries are essential build helpers.
|
||||
* `ENABLE_ALL=ON` does not add `USE_APPLESEED` or `USE_OSPRAY` by itself.
|
||||
Those groups still need to be enabled explicitly.
|
||||
* A few source trees, such as `patchelf`, are present in the repository but are
|
||||
not currently added by the top-level build.
|
||||
* Run the `update_dependency_docs` target after changing project groups,
|
||||
dependency edges, output locations, or submodule sources. CI runs
|
||||
`check_dependency_metadata` to detect drift, unknown edges, cycles, missing
|
||||
source pins, and missing bundled-output license installation.
|
||||
* The `sbom` target writes an SPDX 2.3 JSON inventory to `bext.spdx.json` in
|
||||
the build directory. `supply_chain_check` validates metadata and produces
|
||||
the SBOM together.
|
||||
|
||||
# Adding a dependency
|
||||
|
||||
For maintainers, the high-level workflow for adding a new dependency to `bext`
|
||||
is:
|
||||
|
||||
1. Decide whether the dependency belongs in `bext` at all.
|
||||
Only add repositories that are expected to support live BRL-CAD or related
|
||||
build features. Exploratory work that may be discarded should stay in a branch
|
||||
until the dependency choice is settled.
|
||||
|
||||
2. Prepare the BRL-CAD-hosted source repository first.
|
||||
`bext` generally points at BRL-CAD-managed copies of upstream sources rather
|
||||
than upstream repositories directly. Before wiring anything into `bext`, make
|
||||
sure the BRL-CAD copy has the intended `RELEASE` content, submodules handled as
|
||||
needed, and license files available for installation.
|
||||
|
||||
3. Choose the `USE_*` group or groups that should bring the dependency into
|
||||
scope.
|
||||
This controls when the dependency is considered at all. If none of the
|
||||
existing groups fit, add a new one only if it represents a real build profile
|
||||
that users can reason about.
|
||||
|
||||
4. Add the new top-level directory and git submodule.
|
||||
The directory should usually contain:
|
||||
* the upstream source as a git submodule
|
||||
* a managing `CMakeLists.txt`
|
||||
* a `<name>.deps` file listing other `bext` projects it depends on
|
||||
* any patch files or helper resources needed by the build
|
||||
|
||||
After `git submodule add`, update `.gitmodules` to include `ignore = dirty` for
|
||||
the new entry, consistent with the existing submodules.
|
||||
|
||||
5. Add the build logic.
|
||||
Follow the patterns used by nearby dependencies:
|
||||
* use `git_submodule_init(...)`
|
||||
* use `RegisterDeps(...)`
|
||||
* decide whether the outputs belong in `install` or `noinstall`
|
||||
* copy license files into `${DOC_LICENSE_DIR}`
|
||||
* use `bext_enable(...)`, `cad_enable(...)`, or custom logic as needed to
|
||||
respect system detection and BRL-CAD component selection
|
||||
|
||||
6. Register the dependency in the top-level build.
|
||||
Add `add_project(...)` to the top-level `CMakeLists.txt` in dependency order so
|
||||
that any prerequisites appear earlier in the file.
|
||||
|
||||
7. Update the docs.
|
||||
At minimum:
|
||||
* add the project to this file
|
||||
* update `INSTALL.md` if the new dependency adds system prerequisites
|
||||
* update `NOTES.md` if the dependency needs special submodule or maintainer
|
||||
handling
|
||||
|
||||
8. Test the intended selection behavior and build flow.
|
||||
Check at least:
|
||||
* the default configure path for the relevant `USE_*` groups
|
||||
* `-DENABLE_ALL=ON`
|
||||
* any new or changed prerequisite detection
|
||||
* downstream use if the outputs are intended for BRL-CAD bundling
|
||||
|
||||
9. Only after the dependency is working, commit the new submodule reference and
|
||||
the `bext` integration together.
|
||||
That keeps the repository history aligned with a working configuration rather
|
||||
than a partial experiment.
|
||||
|
||||
For lower-level git and submodule procedures, see [NOTES.md](NOTES.md).
|
||||
@@ -1,24 +0,0 @@
|
||||
|
||||
## Contents
|
||||
|
||||
| File(s) | Description |
|
||||
|:-------------------|:------------------------------------------------|
|
||||
| minizip.c | Sample application |
|
||||
| mz_compat.\* | Minizip 1.x compatibility layer |
|
||||
| mz.h | Error codes and flags |
|
||||
| mz_os\* | Platform specific file/utility functions |
|
||||
| mz_crypt\* | Configuration specific crypto/hashing functions |
|
||||
| mz_strm.\* | Stream interface |
|
||||
| mz_strm_buf.\* | Buffered stream |
|
||||
| mz_strm_bzip.\* | BZIP2 stream using libbzip2 |
|
||||
| mz_strm_libcomp.\* | Apple compression stream |
|
||||
| mz_strm_lzma.\* | LZMA stream using liblzma |
|
||||
| mz_strm_mem.\* | Memory stream |
|
||||
| mz_strm_split.\* | Disk splitting stream |
|
||||
| mz_strm_pkcrypt.\* | PKWARE traditional encryption stream |
|
||||
| mz_strm_os\* | Platform specific file stream |
|
||||
| mz_strm_wzaes.\* | WinZIP AES stream |
|
||||
| mz_strm_zlib.\* | Deflate stream using zlib |
|
||||
| mz_strm_zstd.\* | ZSTD stream |
|
||||
| mz_zip.\* | Zip format |
|
||||
| mz_zip_rw.\* | Zip reader/writer |
|
||||
+115
@@ -0,0 +1,115 @@
|
||||
# bext - Installation Notes
|
||||
|
||||
This file covers machine setup and source checkout details. For the main build
|
||||
flow and option behavior, see [README.md](README.md).
|
||||
|
||||
# Base requirements
|
||||
|
||||
All builds need:
|
||||
|
||||
* Git
|
||||
* CMake 3.19 or newer
|
||||
* A modern C compiler
|
||||
* A modern C++ compiler
|
||||
|
||||
Additional requirements depend on the enabled stacks:
|
||||
|
||||
* `USE_APPLESEED` and `USE_OSPRAY` will use a system `flex` and
|
||||
`bison` if they are already installed. If they are not and `bext`
|
||||
needs to build them locally on non-Windows platforms, a working
|
||||
Autotools stack is also needed.
|
||||
* `USE_QT`, `USE_APPLESEED`, or `USE_OSPRAY` need Python 3 available
|
||||
to the build.
|
||||
* `USE_OSPRAY` needs `m4`.
|
||||
|
||||
# Source checkout options
|
||||
|
||||
Default clone:
|
||||
|
||||
```sh
|
||||
git clone https://github.com/BRL-CAD/bext
|
||||
```
|
||||
|
||||
This is usually the best starting point. `bext` will populate submodules on
|
||||
demand during configure.
|
||||
|
||||
Recursive clone:
|
||||
|
||||
```sh
|
||||
git clone --recursive https://github.com/BRL-CAD/bext
|
||||
```
|
||||
|
||||
Use this if you want all submodule content fetched up front, or if you expect
|
||||
to configure and build without network access later.
|
||||
|
||||
Shallow clone options:
|
||||
|
||||
* `cmake ../bext -DGIT_SHALLOW_CLONE=ON ...`
|
||||
* `git clone --recursive --depth=1 https://github.com/BRL-CAD/bext`
|
||||
|
||||
Shallow clones are fine for compile-only use, but they are not recommended for
|
||||
development or for submodule update work.
|
||||
|
||||
# Path and directory caveats
|
||||
|
||||
* Avoid symlinked source or build directory paths. `bext` warns about these
|
||||
because they can cause downstream install and rpath problems.
|
||||
* On non-Windows platforms, bundled Tcl/Tk builds do not support spaces in the
|
||||
source or build directory path.
|
||||
|
||||
# Ubuntu Linux
|
||||
|
||||
Base packages:
|
||||
|
||||
```sh
|
||||
sudo apt install git cmake gcc g++
|
||||
```
|
||||
|
||||
For Tcl/Tk builds:
|
||||
|
||||
```sh
|
||||
sudo apt install libfontconfig1-dev libfreetype6-dev xserver-xorg-dev libx11-dev libxi-dev libxext-dev
|
||||
```
|
||||
|
||||
For Qt, Appleseed, and OSPRay:
|
||||
|
||||
```sh
|
||||
sudo apt install libpython3-dev
|
||||
```
|
||||
|
||||
For Qt on X11 systems, install the XCB development packages:
|
||||
|
||||
```sh
|
||||
sudo apt install libx11-xcb-dev libxfixes-dev libxrender-dev libxcb1-dev libxcb-cursor-dev libxcb-glx0-dev libxcb-keysyms1-dev libxcb-image0-dev libxcb-shm0-dev libxcb-icccm4-dev libxcb-sync-dev libxcb-xfixes0-dev libxcb-shape0-dev libxcb-randr0-dev libxcb-render-util0-dev libxcb-util-dev libxcb-xinerama0-dev libxcb-xkb-dev libxkbcommon-dev libxkbcommon-x11-dev
|
||||
```
|
||||
|
||||
For OSPRay:
|
||||
|
||||
```sh
|
||||
sudo apt install m4 gcc-multilib g++-multilib
|
||||
```
|
||||
|
||||
If you want to rely on system `flex` and `bison`:
|
||||
|
||||
```sh
|
||||
sudo apt install flex bison
|
||||
```
|
||||
|
||||
If `bext` may need to build `flex` and `bison` locally:
|
||||
|
||||
```sh
|
||||
sudo apt install autotools-dev autoconf
|
||||
```
|
||||
|
||||
# Windows
|
||||
|
||||
If you enable Qt, Appleseed, or OSPRay, make sure Python 3 is installed and
|
||||
available in the build environment.
|
||||
|
||||
Keep the source and build directories close to the drive root when possible.
|
||||
Some Windows build tools still have path length limits, even though bext enables
|
||||
Git's long path handling when it checks out submodules.
|
||||
|
||||
# macOS
|
||||
|
||||
Assuming XCode is installed, good to go.
|
||||
@@ -1,17 +0,0 @@
|
||||
Condition of use and distribution are the same as zlib:
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgement in the product documentation would be
|
||||
appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be
|
||||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
@@ -0,0 +1,902 @@
|
||||
# bext - Notes
|
||||
|
||||
When using submodules, there are some fairly non-intuitive aspects of managing them that need to be taken into consideration:
|
||||
|
||||
# Checkout out particular versions of bext
|
||||
|
||||
Because bext makes extensive use of git submodules, operations that in the BRL-CAD repository can normally be achieved with basic git commands may need additional options in bext to achieve expected results. A common example is switching a clone of bext to a specific revision. If you have (say) a checkout of main branch but wish to obtain bext's contents from the rel-7-40-2 branch, one might intuitively think a checkout would work. However, doing that checkout, we see:
|
||||
|
||||
```
|
||||
bext (main)$ git checkout rel-7-40-2
|
||||
M assetimport/assimp
|
||||
M astyle/astyle
|
||||
M gdal/gdal
|
||||
M gte/GeometricTools
|
||||
M lief/LIEF
|
||||
M lmdb/lmdb
|
||||
M netpbm/netpbm
|
||||
M opennurbs/opennurbs
|
||||
M png/libpng
|
||||
M proj/PROJ
|
||||
M sqlite3/sqlite3
|
||||
M tiff/libtiff
|
||||
branch 'rel-7-40-2' set up to track 'origin/rel-7-40-2'.
|
||||
Switched to a new branch 'rel-7-40-2'
|
||||
```
|
||||
What are the modification notifications about? What has happened is the populated submodules are still in the state set up by the main branch - the checkout to rel-7-40-2 in the parent git repository did not alter their states, and so according to the rel-7-40-2 branch they are modified compared to what they should be:
|
||||
|
||||
```
|
||||
bext (rel-7-40-2)$ git status
|
||||
On branch rel-7-40-2
|
||||
Your branch is up to date with 'origin/rel-7-40-2'.
|
||||
|
||||
Changes not staged for commit:
|
||||
(use "git add <file>..." to update what will be committed)
|
||||
(use "git restore <file>..." to discard changes in working directory)
|
||||
modified: assetimport/assimp (new commits)
|
||||
modified: astyle/astyle (new commits)
|
||||
modified: gdal/gdal (new commits)
|
||||
modified: gte/GeometricTools (new commits)
|
||||
modified: lief/LIEF (new commits)
|
||||
modified: lmdb/lmdb (new commits)
|
||||
modified: netpbm/netpbm (new commits)
|
||||
modified: opennurbs/opennurbs (new commits)
|
||||
modified: png/libpng (new commits)
|
||||
modified: proj/PROJ (new commits)
|
||||
modified: sqlite3/sqlite3 (new commits)
|
||||
modified: tiff/libtiff (new commits)
|
||||
|
||||
no changes added to commit (use "git add" and/or "git commit -a")
|
||||
```
|
||||
|
||||
Note that not all submodules are listed. In this case, bext was configured to only clone specific libraries needed for a BRL-CAD build, and unpopulated submodules have made the change to the new version without incident. To also put the populated submodules in the expected state, a second command is needed:
|
||||
|
||||
```
|
||||
bext (rel-7-40-2)$ git submodule update --recursive
|
||||
Submodule path 'assetimport/assimp': checked out '3783459a97c67ec9e44fbec8c64aa83ff352dd15'
|
||||
Submodule path 'astyle/astyle': checked out 'c35f91f650455dc7b9fb16c65bb8f9a94f6a1479'
|
||||
Submodule path 'gdal/gdal': checked out '6caa025977ad22a32cba0646cafc30c36ca4f423'
|
||||
Submodule path 'gte/GeometricTools': checked out '2cc6ea322f4fca3b51805768485d3da15409aeec'
|
||||
Submodule path 'lief/LIEF': checked out '2b68ae538316f9ded03f9e3661d63551ab755cb0'
|
||||
Submodule path 'lmdb/lmdb': checked out 'ddd0a773e2f44d38e4e31ec9ed81af81f4e4ccbb'
|
||||
Submodule path 'netpbm/netpbm': checked out '3f1172417c2453de752839243e9a36fba5b16b70'
|
||||
Submodule path 'opennurbs/opennurbs': checked out '6dce0c19e71812a87cc9de189ba5fdbbf7b56e28'
|
||||
Submodule path 'png/libpng': checked out 'ed217e3e601d8e462f7fd1e04bed43ac42212429'
|
||||
Submodule path 'proj/PROJ': checked out '47410920e0426d0eccbdbc27ca9dfc494f68a084'
|
||||
Submodule path 'sqlite3/sqlite3': checked out 'e3012e5fa233146122a08ab41f33f7747d6c821c'
|
||||
Submodule path 'tiff/libtiff': checked out '8b20804fc0ddeaa93667b799b5e1a2a7dc9e3fb2'
|
||||
```
|
||||
|
||||
A second status check will now report a clean tree:
|
||||
|
||||
```
|
||||
bext (rel-7-40-2)$ git status
|
||||
On branch rel-7-40-2
|
||||
Your branch is up to date with 'origin/rel-7-40-2'.
|
||||
```
|
||||
|
||||
|
||||
# Adding a submodule (using Tcl as an example)
|
||||
|
||||
NOTE: When testing out new possible dependencies for BEXT, work should be done in
|
||||
a branch first and then merged into main. Once part of the main history, we can't
|
||||
remove a dependency repository without breaking bext history - thus, we only want to
|
||||
add dependencies we're actually going to use for implementing live features. Exploratory
|
||||
work that might be thrown away is outside of bext's 'main' branch scope.
|
||||
|
||||
```
|
||||
user@linux:~/bext (main) $ cd tcl
|
||||
user@linux:~/bext/tcl (main) $ git submodule add -b RELEASE https://github.com/BRL-CAD/tcl.git
|
||||
```
|
||||
Edit the new .gitmodules entry to add the "ignore = dirty" line, git add the updated .gitmodules file, and commit the addition of the new submodule.
|
||||
|
||||
|
||||
# Finding the currently referenced submodule SHA1
|
||||
|
||||
Git stores a SHA1 to the upstream commit it will target, but this SHA1 isn't readily visible in the working git clone's files. To see it, per https://stackoverflow.com/a/5033973/2037687) use git ls-tree - for example, this prints the current Tcl SHA1:
|
||||
```
|
||||
user@linux:~/bext (main) $ git ls-tree main tcl/tcl
|
||||
160000 commit 338c6692672696a76b6cb4073820426406c6f3f9 tcl/tcl
|
||||
```
|
||||
|
||||
# Updating a submodule to a newer upstream
|
||||
|
||||
```
|
||||
user@linux:~ $ git clone --recurse-submodules git@github.com:BRL-CAD/bext.git
|
||||
user@linux:~ $ cd bext
|
||||
user@linux:~/bext (main) $ git submodule update --remote
|
||||
Submodule path 'assetimport/assimp': checked out '6a08c39e3a91ef385e76515cfad86aca4bfd57ff'
|
||||
Submodule path 'lief/LIEF': checked out '6e4722624adffdbf2e8156d4b8b69aebb8a3c754'
|
||||
Submodule path 'qt/qt': checked out 'c9e69df410c79e6bc7b8be0f2d35abf366879d50'
|
||||
user@linux:~/bext (main) $ git status
|
||||
On branch main
|
||||
Your branch is up to date with 'origin/main'.
|
||||
|
||||
Changes not staged for commit:
|
||||
(use "git add <file>..." to update what will be committed)
|
||||
(use "git restore <file>..." to discard changes in working directory)
|
||||
modified: assetimport/assimp (new commits)
|
||||
modified: lief/LIEF (new commits)
|
||||
modified: qt/qt (new commits)
|
||||
|
||||
no changes added to commit (use "git add" and/or "git commit -a")
|
||||
user@linux:~/bext (main) $ git add assetimport/assimp lief/LIEF qt/qt
|
||||
user@linux:~/bext (main) $ git status
|
||||
On branch main
|
||||
Your branch is up to date with 'origin/main'.
|
||||
|
||||
Changes to be committed:
|
||||
(use "git restore --staged <file>..." to unstage)
|
||||
modified: assetimport/assimp
|
||||
modified: lief/LIEF
|
||||
modified: qt/qt
|
||||
user@linux:~/bext (main) $ git commit -m "Update submodule references for AssetImport, LIEF and Qt"
|
||||
user@linux:~/bext (main) $ git push
|
||||
```
|
||||
|
||||
# Parallelize updates
|
||||
|
||||
git config submodule.fetchJobs 0 # 0 = one job per CPU core
|
||||
git config fetch.parallel 0
|
||||
git config fetch.recurseSubmodules on-demand # only fetch the submodules that changed
|
||||
|
||||
|
||||
# Changing the branch of a submodule
|
||||
|
||||
https://stackoverflow.com/questions/29882960/changing-an-existing-submodules-branch
|
||||
|
||||
# Removing a submodule
|
||||
|
||||
As summarized by https://gist.github.com/myusuf3/7f645819ded92bda6677 (using tcl/tcl as an example):
|
||||
|
||||
* Delete the .gitmodules entry for the submodule being removed
|
||||
* git add .gitmodules
|
||||
* Delete the .git/config entry for the submodule being removed
|
||||
* git rm --cached tcl/tcl
|
||||
* rm -rf .git/modules/tcl/tcl
|
||||
* git commit -m "Removing Tcl submodule"
|
||||
* rm -rf tcl/tcl
|
||||
|
||||
# Updating the BRL-CAD copy of a submodule
|
||||
|
||||
The bext repository does not hold BRL-CAD's copies of the various source repositories used -
|
||||
rather, it points to local repositories in BRL-CAD's project that hold them. This allows,
|
||||
among other things, for a lighter footprint for a working checkout. It also gives us the
|
||||
opportunity to keep the BRL-CAD copy in sync with upstream sources using the git and github
|
||||
tools intended for those use cases.
|
||||
|
||||
To update (for example) BRL-CAD's copy of GDAL to reference the latest release:
|
||||
```
|
||||
user@linux:~ $ git clone git@github.com:BRL-CAD/gdal.git
|
||||
user@linux:~ $ cd gdal
|
||||
user@linux:~/gdal (master) $ git remote add upstream https://github.com/OSGeo/gdal
|
||||
user@linux:~/gdal (master) $ git fetch upstream
|
||||
remote: Enumerating objects: 4536, done.
|
||||
remote: Counting objects: 100% (4132/4132), done.
|
||||
remote: Compressing objects: 100% (986/986), done.
|
||||
remote: Total 4536 (delta 3297), reused 3885 (delta 3141), pack-reused 404
|
||||
Receiving objects: 100% (4536/4536), 6.70 MiB | 25.98 MiB/s, done.
|
||||
Resolving deltas: 100% (3383/3383), completed with 505 local objects.
|
||||
From https://github.com/OSGeo/gdal
|
||||
* [new branch] backport-7740-to-release/3.7 -> upstream/backport-7740-to-release/3.7
|
||||
* [new branch] master -> upstream/master
|
||||
<snip>
|
||||
* [new branch] vendor/1.4-esri -> upstream/vendor/1.4-esri
|
||||
* [new tag] v3.7.3 -> v3.7.3
|
||||
* [new tag] v3.7.3RC1 -> v3.7.3RC1
|
||||
* [new tag] v3.8.0beta1 -> v3.8.0beta1
|
||||
user@linux:~/gdal (master) $ git push --tags
|
||||
Enumerating objects: 10565, done.
|
||||
Counting objects: 100% (5511/5511), done.
|
||||
Delta compression using up to 12 threads
|
||||
Compressing objects: 100% (1354/1354), done.
|
||||
Writing objects: 100% (4057/4057), 2.14 MiB | 10.63 MiB/s, done.
|
||||
Total 4057 (delta 3407), reused 3324 (delta 2699), pack-reused 0
|
||||
remote: Resolving deltas: 100% (3407/3407), completed with 641 local objects.
|
||||
To github.com:BRL-CAD/gdal.git
|
||||
* [new tag] v3.7.3 -> v3.7.3
|
||||
* [new tag] v3.7.3RC1 -> v3.7.3RC1
|
||||
* [new tag] v3.8.0beta1 -> v3.8.0beta1
|
||||
user@linux:~/gdal (master) $ git checkout RELEASE
|
||||
branch 'RELEASE' set up to track 'origin/RELEASE'.
|
||||
Switched to a new branch 'RELEASE'
|
||||
user@linux:~/gdal (RELEASE) $ git merge v3.7.3
|
||||
Updating f74cd41441..6133cf34a7
|
||||
Fast-forward
|
||||
.github/workflows/alpine/Dockerfile.ci | 3 +-
|
||||
.github/workflows/cmake_builds.yml | 11 ++-
|
||||
<snip>
|
||||
create mode 100644 autotest/ogr/data/shp/multipolygon_as_invalid_polygon.shp
|
||||
create mode 100644 autotest/ogr/data/shp/multipolygon_as_invalid_polygon.shx
|
||||
user@linux:~/gdal (RELEASE) $ git status
|
||||
On branch RELEASE
|
||||
Your branch is ahead of 'origin/RELEASE' by 90 commits.
|
||||
(use "git push" to publish your local commits)
|
||||
|
||||
nothing to commit, working tree clean
|
||||
user@linux:~/gdal (RELEASE) $ git diff v3.7.3
|
||||
user@linux:~/gdal (RELEASE) $ git push
|
||||
Total 0 (delta 0), reused 0 (delta 0), pack-reused 0
|
||||
To github.com:BRL-CAD/gdal.git
|
||||
f74cd41441..6133cf34a7 RELEASE -> RELEASE
|
||||
```
|
||||
After this process, the bext repo should be updated with the procedure documented
|
||||
earlier to update its reference to the gdal RELEASE HEAD:
|
||||
```
|
||||
user@linux:~/bext (main) $ git submodule update --remote
|
||||
remote: Enumerating objects: 1619, done.
|
||||
remote: Counting objects: 100% (990/990), done.
|
||||
remote: Compressing objects: 100% (238/238), done.
|
||||
remote: Total 398 (delta 322), reused 229 (delta 158), pack-reused 0
|
||||
Receiving objects: 100% (398/398), 156.17 KiB | 4.34 MiB/s, done.
|
||||
Resolving deltas: 100% (322/322), completed with 127 local objects.
|
||||
From https://github.com/BRL-CAD/gdal
|
||||
+ f74cd4144...6133cf34a RELEASE -> origin/RELEASE (forced update)
|
||||
* [new tag] v3.7.3 -> v3.7.3
|
||||
* [new tag] v3.7.3RC1 -> v3.7.3RC1
|
||||
Submodule path 'gdal/gdal': checked out '6133cf34a78077998406c0c4045bf51f06e3f49d'
|
||||
user@linux:~/bext (main) $ git status
|
||||
On branch main
|
||||
Your branch is up to date with 'origin/main'.
|
||||
|
||||
Changes not staged for commit:
|
||||
(use "git add <file>..." to update what will be committed)
|
||||
(use "git restore <file>..." to discard changes in working directory)
|
||||
modified: gdal/gdal (new commits)
|
||||
|
||||
no changes added to commit (use "git add" and/or "git commit -a")
|
||||
user@linux:~/bext (main) $ git add gdal/gdal
|
||||
user@linux:~/bext (main) $ git status
|
||||
On branch main
|
||||
Your branch is up to date with 'origin/main'.
|
||||
|
||||
Changes to be committed:
|
||||
(use "git restore --staged <file>..." to unstage)
|
||||
modified: gdal/gdal
|
||||
|
||||
user@linux:~/bext (main) $ git commit -m "Update GDAL submodule reference"
|
||||
[main 00ffbf0] Update GDAL submodule reference
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
user@linux:~/bext (main) $ git push
|
||||
Enumerating objects: 5, done.
|
||||
Counting objects: 100% (5/5), done.
|
||||
Delta compression using up to 12 threads
|
||||
Compressing objects: 100% (3/3), done.
|
||||
Writing objects: 100% (3/3), 352 bytes | 352.00 KiB/s, done.
|
||||
Total 3 (delta 2), reused 0 (delta 0), pack-reused 0
|
||||
remote: Resolving deltas: 100% (2/2), completed with 2 local objects.
|
||||
To github.com:BRL-CAD/bext.git
|
||||
23bb902..00ffbf0 main -> main
|
||||
```
|
||||
|
||||
# Preparing a BRL-CAD copy of a dependency for addition as a new submodule
|
||||
|
||||
When adding a new submodule to bext, the first step is to prepare a BRL-CAD
|
||||
fork (preferable) or repository (if forking isn't an option) of the project
|
||||
that is going to be used. We deliberately do not directly reference third
|
||||
party repositories, to make sure our build can't be suddenly broken if one of
|
||||
them disappears or radically changes. Considerations when first forking:
|
||||
|
||||
* The ownership of the project should be the BRL-CAD organization.
|
||||
* Uncheck the "clone only main branch" option - we want the full project
|
||||
history available to us if needed, including the various branches. If
|
||||
the upstream disappears, the BRL-CAD copy may become the only copy.
|
||||
* Once the fork is complete, verify that Github Actions are disabled for the
|
||||
fork - if not, go through and disable them.
|
||||
|
||||
Once we have a BRL-CAD/<dependency> repository, we can start looking at what
|
||||
is needed to make it suitable for referencing by bext. We almost never point
|
||||
bext at the main branch of a project, or indeed any actively developed branch -
|
||||
we want a stable, known target that we update deliberately once we have verified
|
||||
things are working. To this end, we create our own branch in the fork (typically
|
||||
called RELEASE) and use that to do any necessary staging.
|
||||
|
||||
Note that normally (though not always) this doesn't involve modifying the
|
||||
project source code - that is more typically handed by patch files in bext
|
||||
itself to keep updating the parent project forks simpler. What we usually need
|
||||
to do in the upstream RELEASE branch is replace git submodules being used in
|
||||
the parent project with full copies of the populated submodule directories. In
|
||||
other words, we want the RELEASE version of a repository to be a fully
|
||||
self-contained clone without any dependencies on external repositories (the
|
||||
boost repository is probably the most extreme example of this in bext, but
|
||||
there are a number of others where we do the same thing.) When the RELEASE
|
||||
branch is updated for BRL-CAD, it is also necessary to fully update all of the
|
||||
contents of these submodule replacements at the same time. (More on how to do
|
||||
this later.)
|
||||
|
||||
NOTE: when considering a dependency for BRL-CAD usage, be sure to check not
|
||||
only the license of the project itself but also all the licenses of its
|
||||
dependencies. Some projects will have optional features using libraries that
|
||||
aren't license compatible with BRL-CAD, so those should be disabled and those
|
||||
source codes not included in RELEASE. If a project has a hard dependency on an
|
||||
incompatible library, unless that dependency can be replaced or the need for it
|
||||
removed we can't use the parent project. (For example, we sometimes see new
|
||||
academic codes associated with papers where the author relies on CGAL's GPL
|
||||
licensed capabilities - even if the academic code itself is liberally licensed,
|
||||
we would have to update or rewrite it to not require CGAL before we could use
|
||||
it.
|
||||
|
||||
Once submodules and licenses have been handled and the project works in
|
||||
isolation, the next step is to get it building as part of the bext ecosystem.
|
||||
For initial experiments, you'll probably want to simply work with a copy of the
|
||||
dependency rather than immediately integrating it as a submodule. (If it
|
||||
proves too difficult to work with and we have to scrap it, you'll want to avoid
|
||||
the mess of also having to undo its addition as a submodule to bext.) You'll
|
||||
create a new top level directory for the dependency that will hold the
|
||||
dependency file, patch files (if any are needed) and the actual project source
|
||||
directory itself. There are lots of examples to use as starting points, and
|
||||
the patterns should be consistent. The usual pain points of this part of the
|
||||
process are:
|
||||
|
||||
* You need to get the build to support using the *locally* built versions
|
||||
of dependencies, as well as the system versions. If you have a system
|
||||
and a bext copy of a dependency present, you may find it's somewhat
|
||||
challenging to get the build system to focus on the version you want it
|
||||
to use. zlib is particularly difficult, since it is quite common as
|
||||
a system dependency and it frequently "works" in builds without the dev
|
||||
spotting the problem. We also must alter our zlib and png library names
|
||||
to avoid conflicts with system versions, so it is almost always necessary
|
||||
to update build systems to instruct them on how to find and use our
|
||||
copies. Recommended best practice, in addition to testing on multiple
|
||||
platforms for building, is to use a freshly set up Ubuntu virtual machine
|
||||
with only the minimally required system development headers.
|
||||
|
||||
* You may discover that the upstream project is using older versions of
|
||||
dependencies than BRL-CAD - in this situation, you'll want to do the work
|
||||
to update the code to use the newer dependency. We typically won't bundle
|
||||
older versions - it's hard enough to stay current with just one! - and
|
||||
if you discover you need to make changes of that sort it is HIGHLY
|
||||
recommended to push those back to the upstream project so you can
|
||||
minimize your future maintenance overhead.
|
||||
|
||||
* We prohibit dependencies from installing anything into the top level
|
||||
"root" directory - outputs should go into bin, lib, share and other
|
||||
standard subdirectories to conform with the layout of a BRL-CAD install.
|
||||
Occasionally this will require build system alterations - those sorts
|
||||
of tweaks are normally handled as patches, unless a particular situation
|
||||
suggests the upstream might be receptive to changing how their install
|
||||
structure is laid out.
|
||||
|
||||
Once you have everything installing into install/ correctly and
|
||||
using the correct dependencies, congratulations - you're now ready to add
|
||||
the submodule to bext in lieu of a working source copy. This will allow
|
||||
bext to manage when and how the directory is populated based on build
|
||||
settings, as well as providing a convenient(ish) mechanism for updating
|
||||
submodule references as needed (see above).
|
||||
|
||||
As an example, we document below the steps taken for the geogram library from
|
||||
https://github.com/BrunoLevy/geogram (which we're no longer actively bundling,
|
||||
but it still serves as a good illustration.) After creating a full fork of the
|
||||
project via github and verifying actions were not enabled, we clone the new
|
||||
repository recursively to get the source code of all submodules:
|
||||
|
||||
```
|
||||
$ git clone --recursive git@github.com:BRL-CAD/geogram.git
|
||||
```
|
||||
|
||||
Once we have the geogram clone, we enter the directory and create our RELEASE
|
||||
branch (since the upstream doesn't have such a branch, we don't have to worry
|
||||
about a conflict - if that branch name becomes a problem in the future we can
|
||||
adjust.)
|
||||
|
||||
```
|
||||
$ cd geogram
|
||||
geogram (main)$ git branch -c RELEASE
|
||||
geogram (main)$ git checkout RELEASE
|
||||
```
|
||||
|
||||
We can see geogram has a number of submodules:
|
||||
|
||||
```
|
||||
geogram (RELEASE)$ git submodule
|
||||
57a8140c8e9cb71d5f01824aa0e934bf71f34e9d src/lib/geogram/third_party/amgcl (1.4.3-13-g57a8140)
|
||||
b4a91513317119ff71a1186906a052da0e535913 src/lib/geogram/third_party/libMeshb (RELEASE7.5-64-gb4a9151)
|
||||
4296cc91b5c8c26d4e7d7aac0cee2b194ffc5800 src/lib/geogram/third_party/rply (v1.1.4-1-g4296cc9)
|
||||
f8f805f04631323c8a75accc009eb9701f5ca027 src/lib/geogram_gfx/third_party/imgui (v1.89.7-docking-35-gf8f805f0)
|
||||
3eaf1255b29fdf5c2895856c7be7d7185ef2b241 src/lib/third_party/glfw (3.3-781-g3eaf1255)
|
||||
```
|
||||
|
||||
The first order of business is to convert those into committed source trees in
|
||||
this repository. Removing a submodule from git isn't as simple as removing the
|
||||
directory itself - there are a couple specific commands that must be run. Before
|
||||
we do so, however, we want to make local copies of the contents of the submodules
|
||||
we are going to clear so we can re-add them as standard file check-ins (see
|
||||
https://stackoverflow.com/a/16162000):
|
||||
|
||||
```
|
||||
geogram (RELEASE)$ mkdir ~/geogram_submodules
|
||||
geogram (RELEASE)$ mv src/lib/geogram/third_party/amgcl ~/geogram_submodules/
|
||||
geogram (RELEASE)$ mv src/lib/geogram/third_party/libMeshb ~/geogram_submodules/
|
||||
geogram (RELEASE)$ mv src/lib/geogram/third_party/rply ~/geogram_submodules/
|
||||
geogram (RELEASE)$ mv src/lib/geogram_gfx/third_party/imgui ~/geogram_submodules/
|
||||
geogram (RELEASE)$ mv src/lib/third_party/glfw ~/geogram_submodules/
|
||||
geogram (RELEASE)$ mv src/lib/geogram/third_party/amgcl ~/geogram_submodules/
|
||||
geogram (RELEASE)$ mv src/lib/geogram/third_party/libMeshb ~/geogram_submodules/
|
||||
geogram (RELEASE)$ mv src/lib/geogram/third_party/rply ~/geogram_submodules/
|
||||
geogram (RELEASE)$ mv src/lib/geogram_gfx/third_party/imgui ~/geogram_submodules/
|
||||
geogram (RELEASE)$ mv src/lib/third_party/glfw ~/geogram_submodules/
|
||||
geogram (RELEASE)$ git submodule deinit -f src/lib/geogram/third_party/amgcl
|
||||
Submodule 'src/lib/geogram/third_party/amgcl' (https://github.com/ddemidov/amgcl.git) unregistered for path 'src/lib/geogram/third_party/amgcl'
|
||||
geogram (RELEASE)$ git submodule deinit -f src/lib/geogram/third_party/libMeshb
|
||||
Submodule 'src/lib/geogram/third_party/libMeshb' (https://github.com/LoicMarechal/libMeshb.git) unregistered for path 'src/lib/geogram/third_party/libMeshb'
|
||||
geogram (RELEASE)$ git submodule deinit -f src/lib/geogram/third_party/rply
|
||||
Submodule 'src/lib/geogram/third_party/rply' (https://github.com/diegonehab/rply.git) unregistered for path 'src/lib/geogram/third_party/rply'
|
||||
geogram (RELEASE)$ git submodule deinit -f src/lib/geogram_gfx/third_party/imgui
|
||||
Submodule 'src/lib/geogram_gfx/third_party/imgui' (https://github.com/ocornut/imgui.git) unregistered for path 'src/lib/geogram_gfx/third_party/imgui'
|
||||
geogram (RELEASE)$ git submodule deinit -f src/lib/third_party/glfw
|
||||
Submodule 'src/lib/third_party/glfw' (https://github.com/glfw/glfw.git) unregistered for path 'src/lib/third_party/glfw'
|
||||
geogram (RELEASE)$ rm -rf .git/modules/src/lib/geogram/third_party/amgcl
|
||||
geogram (RELEASE)$ rm -rf .git/modules/src/lib/geogram/third_party/libMeshb
|
||||
geogram (RELEASE)$ rm -rf .git/modules/src/lib/geogram/third_party/rply
|
||||
geogram (RELEASE)$ rm -rf .git/modules/src/lib/geogram_gfx/third_party/imgui
|
||||
geogram (RELEASE)$ rm -rf .git/modules/src/lib/third_party/glfw
|
||||
geogram (RELEASE)$ git rm --cached src/lib/geogram/third_party/amgcl
|
||||
rm 'src/lib/geogram/third_party/amgcl'
|
||||
geogram (RELEASE)$ git rm --cached src/lib/geogram/third_party/libMeshb
|
||||
rm 'src/lib/geogram/third_party/libMeshb'
|
||||
geogram (RELEASE)$ git rm --cached src/lib/geogram/third_party/rply
|
||||
rm 'src/lib/geogram/third_party/rply'
|
||||
geogram (RELEASE)$ git rm --cached src/lib/geogram_gfx/third_party/imgui
|
||||
rm 'src/lib/geogram_gfx/third_party/imgui'
|
||||
geogram (RELEASE)$ git rm --cached src/lib/third_party/glfw
|
||||
rm 'src/lib/third_party/glfw'
|
||||
geogram (RELEASE)$ git status
|
||||
On branch RELEASE
|
||||
Your branch is up to date with 'origin/main'.
|
||||
|
||||
Changes to be committed:
|
||||
(use "git restore --staged <file>..." to unstage)
|
||||
deleted: src/lib/geogram/third_party/amgcl
|
||||
deleted: src/lib/geogram/third_party/libMeshb
|
||||
deleted: src/lib/geogram/third_party/rply
|
||||
deleted: src/lib/geogram_gfx/third_party/imgui
|
||||
deleted: src/lib/third_party/glfw
|
||||
geogram (RELEASE)$ git commit -m "Remove git submodules"
|
||||
```
|
||||
|
||||
If we check, we now see that no submodules are reported:
|
||||
|
||||
```
|
||||
geogram (RELEASE)$ git submodule
|
||||
```
|
||||
|
||||
Next we restore the copies of the source code made earlier to the working tree:
|
||||
|
||||
```
|
||||
geogram (RELEASE)$ mv ~/geogram_submodules/amgcl/\* src/lib/geogram/third_party/amgcl/
|
||||
geogram (RELEASE)$ mv ~/geogram_submodules/libMeshb/\* src/lib/geogram/third_party/libMeshb/
|
||||
geogram (RELEASE)$ mv ~/geogram_submodules/rply/\* src/lib/geogram/third_party/rply/
|
||||
geogram (RELEASE)$ mv ~/geogram_submodules/imgui/\* src/lib/geogram_gfx/third_party/imgui/
|
||||
geogram (RELEASE)$ mv ~/geogram_submodules/glfw/\* src/lib/third_party/glfw/
|
||||
geogram (RELEASE)$ git status
|
||||
On branch RELEASE
|
||||
Your branch is ahead of 'origin/main' by 1 commit.
|
||||
(use "git push" to publish your local commits)
|
||||
|
||||
Untracked files:
|
||||
(use "git add <file>..." to include in what will be committed)
|
||||
src/lib/geogram/third_party/amgcl/
|
||||
src/lib/geogram/third_party/libMeshb/
|
||||
src/lib/geogram/third_party/rply/
|
||||
src/lib/geogram_gfx/third_party/imgui/
|
||||
src/lib/third_party/glfw/
|
||||
geogram (RELEASE)$ git add -A
|
||||
geogram (RELEASE)$ git status
|
||||
On branch RELEASE
|
||||
Your branch is ahead of 'origin/main' by 1 commit.
|
||||
(use "git push" to publish your local commits)
|
||||
|
||||
Changes to be committed:
|
||||
(use "git restore --staged <file>..." to unstage)
|
||||
new file: src/lib/geogram/third_party/amgcl/CMakeLists.txt
|
||||
new file: src/lib/geogram/third_party/amgcl/LICENSE.md
|
||||
<snip>
|
||||
geogram (RELEASE)$ git commit -m "Commit files from former git submodules"
|
||||
[RELEASE 27f3c3ccf] Commit files from former git submodules
|
||||
1061 files changed, 393698 insertions(+)
|
||||
create mode 100644 src/lib/geogram/third_party/amgcl/CMakeLists.txt
|
||||
<snip>
|
||||
```
|
||||
|
||||
Once this step is complete, we have a "stand-alone" version of geogram and we push the
|
||||
RELEASE branch back to github:
|
||||
|
||||
```
|
||||
geogram (RELEASE)$ git push origin HEAD
|
||||
Enumerating objects: 1231, done.
|
||||
Counting objects: 100% (1231/1231), done.
|
||||
Delta compression using up to 12 threads
|
||||
Compressing objects: 100% (1195/1195), done.
|
||||
Writing objects: 100% (1223/1223), 7.12 MiB | 8.99 MiB/s, done.
|
||||
Total 1223 (delta 254), reused 23 (delta 1), pack-reused 0
|
||||
remote: Resolving deltas: 100% (254/254), completed with 6 local objects.
|
||||
remote:
|
||||
remote: Create a pull request for 'RELEASE' on GitHub by visiting:
|
||||
remote: https://github.com/BRL-CAD/geogram/pull/new/RELEASE
|
||||
remote:
|
||||
To https://github.com/BRL-CAD/geogram.git
|
||||
* [new branch] HEAD -> RELEASE
|
||||
```
|
||||
|
||||
The RELEASE branch is now visible on the https://github.com/BRL-CAD/geogram project page.
|
||||
|
||||
Looking over the project contents, we see there are a number of third party components
|
||||
we either don't want to or can't use. HLBFGS and triangle.c are for noncommercial use
|
||||
only, and must be removed. Tetgen uses the AGPL and is incompatible with BRL-CAD's
|
||||
licensing, so it too must be removed.
|
||||
|
||||
```
|
||||
geogram (RELEASE)$ git rm -r src/lib/geogram/third_party/HLBFGS
|
||||
geogram (RELEASE)$ git rm -r src/lib/geogram/third_party/triangle
|
||||
geogram (RELEASE)$ git rm -r src/lib/geogram/third_party/tetgen
|
||||
geogram (RELEASE)$ git commit -m "Remove sources for optional third party components with incompatible licenses"
|
||||
[RELEASE 296fdc244] Remove sources for optional third party components with incompatible licenses
|
||||
21 files changed, 94593 deletions(-)
|
||||
delete mode 100644 src/lib/geogram/third_party/HLBFGS/HLBFGS.cpp
|
||||
delete mode 100644 src/lib/geogram/third_party/HLBFGS/HLBFGS.h
|
||||
delete mode 100644 src/lib/geogram/third_party/HLBFGS/HLBFGS_BLAS.cpp
|
||||
delete mode 100644 src/lib/geogram/third_party/HLBFGS/HLBFGS_BLAS.h
|
||||
delete mode 100644 src/lib/geogram/third_party/HLBFGS/ICFS.cpp
|
||||
delete mode 100644 src/lib/geogram/third_party/HLBFGS/ICFS.h
|
||||
delete mode 100644 src/lib/geogram/third_party/HLBFGS/LineSearch.cpp
|
||||
delete mode 100644 src/lib/geogram/third_party/HLBFGS/LineSearch.h
|
||||
delete mode 100644 src/lib/geogram/third_party/HLBFGS/Lite_Sparse_Matrix.cpp
|
||||
delete mode 100644 src/lib/geogram/third_party/HLBFGS/Lite_Sparse_Matrix.h
|
||||
delete mode 100644 src/lib/geogram/third_party/HLBFGS/README.txt
|
||||
delete mode 100644 src/lib/geogram/third_party/HLBFGS/Sparse_Entry.h
|
||||
delete mode 100644 src/lib/geogram/third_party/tetgen/README.txt
|
||||
delete mode 100644 src/lib/geogram/third_party/tetgen/Tetgen1.6/README
|
||||
delete mode 100644 src/lib/geogram/third_party/tetgen/Tetgen1.6/tetgen.cpp
|
||||
delete mode 100644 src/lib/geogram/third_party/tetgen/Tetgen1.6/tetgen.h
|
||||
delete mode 100755 src/lib/geogram/third_party/tetgen/tetgen.cpp
|
||||
delete mode 100755 src/lib/geogram/third_party/tetgen/tetgen.h
|
||||
delete mode 100644 src/lib/geogram/third_party/triangle/README
|
||||
delete mode 100644 src/lib/geogram/third_party/triangle/triangle.c
|
||||
delete mode 100644 src/lib/geogram/third_party/triangle/triangle.h
|
||||
geogram (RELEASE)$ git push origin HEAD
|
||||
```
|
||||
|
||||
Next, we determine how to build the project without the components we either
|
||||
don't want to or cannot use. We will use build system options provided by the
|
||||
upstream build if available - if alterations to the build logic are necessary
|
||||
we will collect those into a patch file and use that . This generally involves
|
||||
turning off any extra features we don't want to simplify the build and
|
||||
dependency requirements as much as possible. In geogram's case, we tell it to
|
||||
turn off graphics and build the library only, as well as disabling all the
|
||||
optional third party components:
|
||||
|
||||
```
|
||||
geogram (RELEASE)$ mkdir build && cd build
|
||||
build (RELEASE)$ cmake .. -DGEOGRAM_LIB_ONLY=ON -DGEOGRAM_WITH_GRAPHICS=OFF -DGEOGRAM_WITH_LUA=OFF -DGEOGRAM_WITH_HLBFGS=OFF -DGEOGRAM_WITH_TETGEN=OFF -DGEOGRAM_WITH_TRIANGLE=OFF -DCMAKE_BUILD_TYPE=Release
|
||||
CMake Deprecation Warning at CMakeLists.txt:5 (cmake_minimum_required):
|
||||
Compatibility with CMake < 3.5 will be removed from a future version of
|
||||
CMake.
|
||||
|
||||
Update the VERSION argument <min> value or use a ...<max> suffix to tell
|
||||
CMake that the project does not need compatibility with older versions.
|
||||
|
||||
|
||||
-- The C compiler identification is GNU 12.2.1
|
||||
-- The CXX compiler identification is GNU 12.2.1
|
||||
-- Detecting C compiler ABI info
|
||||
-- Detecting C compiler ABI info - done
|
||||
-- Check for working C compiler: /usr/bin/cc - skipped
|
||||
-- Detecting C compile features
|
||||
-- Detecting C compile features - done
|
||||
-- Detecting CXX compiler ABI info
|
||||
-- Detecting CXX compiler ABI info - done
|
||||
-- Check for working CXX compiler: /usr/bin/c++ - skipped
|
||||
-- Detecting CXX compile features
|
||||
-- Detecting CXX compile features - done
|
||||
-- Doxygen >= 1.7.0 not found, cannot generate documentation
|
||||
CMake Deprecation Warning at doc/CMakeLists.txt:7 (cmake_minimum_required):
|
||||
Compatibility with CMake < 3.5 will be removed from a future version of
|
||||
CMake.
|
||||
|
||||
Update the VERSION argument <min> value or use a ...<max> suffix to tell
|
||||
CMake that the project does not need compatibility with older versions.
|
||||
|
||||
|
||||
-- Configuring done (0.7s)
|
||||
-- Generating done (0.1s)
|
||||
-- Build files have been written to: /geogram/build
|
||||
build (RELEASE)$ make
|
||||
[ 0%] Building C object src/lib/geogram/third_party/CMakeFiles/geogram_third_party.dir/libMeshb/sources/libmeshb7.c.o
|
||||
[ 0%] Building C object src/lib/geogram/third_party/CMakeFiles/geogram_third_party.dir/rply/rply.c.o
|
||||
[ 0%] Building C object src/lib/geogram/third_party/CMakeFiles/geogram_third_party.dir/zlib/adler32.c.o
|
||||
[ 0%] Building C object src/lib/geogram/third_party/CMakeFiles/geogram_third_party.dir/zlib/compress.c.o
|
||||
[ 1%] Building C object src/lib/geogram/third_party/CMakeFiles/geogram_third_party.dir/zlib/crc32.c.o
|
||||
<snip>
|
||||
```
|
||||
|
||||
One thing we spot when building starts is that there is a local zlib copy in geogram. That's not necessarily
|
||||
a problem if it does not cause a conflict (for example, we allow Qt to use its own zlib since that is much
|
||||
simpler than trying to inject our version into their build and they isoloate their version) but it's something to
|
||||
be aware of as a source of potential issues. If it DOES cause a problem, we may have to alter geogram's build
|
||||
to reference our zlib, if we are building a local copy.
|
||||
|
||||
After the library is complete, we use ldd to check and see if any system
|
||||
libraries were linked that either already are or will need to be supplied by
|
||||
bext are used:
|
||||
|
||||
```
|
||||
geogram/build (RELEASE) $ ldd lib/libgeogram.so
|
||||
linux-vdso.so.1 (0x00007fff0db46000)
|
||||
libstdc++.so.6 => /lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007efc63200000)
|
||||
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007efc63515000)
|
||||
libgomp.so.1 => /lib/x86_64-linux-gnu/libgomp.so.1 (0x00007efc63ef3000)
|
||||
libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007efc63ecf000)
|
||||
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007efc62e00000)
|
||||
/lib64/ld-linux-x86-64.so.2 (0x00007efc63f6a000)
|
||||
```
|
||||
|
||||
At least for Linux, all the linked libraries appear to be system libs and not dependencies we may need
|
||||
to supply ourselves, which is good. If geogram was going to require us to add more dependencies to avoid
|
||||
the requirement to install system packages, we would have to repeat the above process for each of the
|
||||
proposed dependencies as well before we would be ready to move on to bext.
|
||||
|
||||
Since we appear to have what we need, the next step takes place in the bext repository.
|
||||
We create a new top level directory - in this case "geogram" - and add it to the toplevel
|
||||
CMakeLists.txt file.
|
||||
|
||||
```
|
||||
bext (main) $ mkdir geogram
|
||||
bext (main) $ <manually edit CMakeLists.txt to add the following>
|
||||
# Geogram - a programming library with geometric algorithms
|
||||
# https://github.com/BrunoLevy/geogram
|
||||
add_project(geogram GROUPS "BRLCAD_EXTRA")
|
||||
```
|
||||
|
||||
We create a default "geogram.deps" file to list build dependencies for the bext superbuild.
|
||||
By default everything depends on at least PATCH - if geogram ultimately needs other bext
|
||||
components as well, they will be added later
|
||||
|
||||
```
|
||||
bext (main) $ echo -e "PATCH\\n" > geogram/geogram.deps
|
||||
```
|
||||
|
||||
Based on the above compilation, we know we will need to pass some geogram specific arguments
|
||||
to configure. Using one of the other CMakeLists.txt files as a template, we create the following
|
||||
geogram/CMakeLists.txt file:
|
||||
|
||||
```
|
||||
set(ENABLE_GEOGRAM "${ENABLE_GEOGRAM}" CACHE BOOL "Enable Geogram build")
|
||||
|
||||
if (ENABLE_GEOGRAM)
|
||||
|
||||
git_submodule_init(geogram CMakeLists.txt)
|
||||
|
||||
RegisterDeps(GEOGRAM)
|
||||
|
||||
ExternalProject_Add(GEOGRAM_BLD
|
||||
URL "${CMAKE_CURRENT_SOURCE_DIR}/geogram"
|
||||
BUILD_ALWAYS ${EXT_BUILD_ALWAYS} ${LOG_OPTS}
|
||||
#PATCH_COMMAND ${PATCH_EXECUTABLE};-E;-p1;${PATCH_OPTIONS};-i;${CMAKE_CURRENT_SOURCE_DIR}/geogram.patch
|
||||
CMAKE_ARGS
|
||||
${BUILD_TYPE_SPECIFIER}
|
||||
-DBIN_DIR=${BIN_DIR}
|
||||
-DLIB_DIR=${LIB_DIR}
|
||||
-DBUILD_STATIC_LIBS=${BUILD_STATIC_LIBS}
|
||||
-DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
|
||||
-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
|
||||
-DCMAKE_INSTALL_PREFIX=${CMAKE_BUNDLE_INSTALL_PREFIX}
|
||||
-DCMAKE_INSTALL_LIBDIR:PATH=${LIB_DIR}
|
||||
-DCMAKE_INSTALL_RPATH=${CMAKE_BUNDLE_INSTALL_PREFIX}/${LIB_DIR}
|
||||
-DGEOGRAM_LIB_ONLY=ON
|
||||
-DGEOGRAM_WITH_GRAPHICS=OFF
|
||||
-DGEOGRAM_WITH_LUA=OFF
|
||||
-DGEOGRAM_WITH_HLBFGS=OFF
|
||||
-DGEOGRAM_WITH_TETGEN=OFF
|
||||
-DGEOGRAM_WITH_TRIANGLE=OFF
|
||||
LOG_CONFIGURE ${EXT_BUILD_QUIET}
|
||||
LOG_BUILD ${EXT_BUILD_QUIET}
|
||||
LOG_INSTALL ${EXT_BUILD_QUIET}
|
||||
LOG_OUTPUT_ON_FAILURE ${EXT_BUILD_QUIET}
|
||||
STEP_TARGETS install
|
||||
)
|
||||
|
||||
TargetInstallDeps(GEOGRAM GEOGRAM_DEPENDS)
|
||||
|
||||
# Copy the license into position in CMAKE_BUNDLE_INSTALL_PREFIX
|
||||
file(MAKE_DIRECTORY ${CMAKE_BUNDLE_INSTALL_PREFIX}/doc/legal/other)
|
||||
configure_file(
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/geogram/LICENSE
|
||||
${CMAKE_BUNDLE_INSTALL_PREFIX}/doc/legal/other/geogram.txt
|
||||
COPYONLY
|
||||
)
|
||||
|
||||
endif (ENABLE_GEOGRAM)
|
||||
|
||||
# Local Variables:
|
||||
# tab-width: 8
|
||||
# mode: cmake
|
||||
# indent-tabs-mode: t
|
||||
# End:
|
||||
# ex: shiftwidth=2 tabstop=8
|
||||
```
|
||||
|
||||
By default the PATCH\_COMMAND line is commented out - at this stage we don't know if we need to
|
||||
apply any patches or not. We will definitely need to copy at least the LICENSE file. In this
|
||||
case we will probably also want to append some of the other third party licenses used by geogram
|
||||
into it for completeness, so we may end up either scripting that or making our own custom file
|
||||
to store in geogram/. The latter is less ideal as it will have to be manually updated each time
|
||||
we update geogram, but that might be simpler than a complex and fragile scripting solution - it
|
||||
will require investigation.
|
||||
|
||||
The other item of note here is that we need find\_package to locate geogram. By default CMake
|
||||
does not bundle a module for this, and geogram is not one of the projects that uses the newer
|
||||
project-provided CMake information convention for find\_package, so we will have to supply a
|
||||
FindGeogram.cmake file. In this case geogram itself has such a file in geogram/cmake/FindGeogram.cmake
|
||||
so that is our starting point - we add it to the bext collection of CMake find\_package files:
|
||||
|
||||
```
|
||||
bext (main) $ cp ~/geogram/cmake/FindGeogram.cmake CMake/
|
||||
```
|
||||
|
||||
Although it is not immediately necessary for this stage of the setup, there is something we
|
||||
should verify and correct about the FindGeogram.cmake file. The bext setup requires that
|
||||
find\_package respect \*\_ROOT variables to allow us to point search paths to our local copies
|
||||
of libs rather than system versions, and it is common for more obscure cmake files to not
|
||||
be set up to search in this fashion. Accordingly, we alter FindGeogram.cmake
|
||||
to add GEOGRAM\_ROOT to the set of search paths. This will eventually be necessary for the
|
||||
copy added to the main BRL-CAD build, as well as for any new dependencies that need to link
|
||||
against the local copy of geogram in the future.
|
||||
|
||||
For the initial test, we comment out the git\_submodule\_init line and manually position a copy
|
||||
of the geogram source tree in geogram/geogram to simulate a submodule clone. For this test
|
||||
we only are interested in building geogram and its requirements, rather than all of bext,
|
||||
so we run make with the GEOGRAM_BLD target.
|
||||
|
||||
```
|
||||
bext (main) $ cp -r ~/geogram geogram/
|
||||
bext (main) $ mkdir build && cd build
|
||||
build (main) $ cmake .. -DENABLE_ALL=ON -DCMAKE_BUILD_TYPE=Release
|
||||
build (main) $ make GEOGRAM_BLD
|
||||
[ 0%] Creating directories for 'PATCH_BLD'
|
||||
[ 0%] No download step for 'PATCH_BLD'
|
||||
[ 20%] No update step for 'PATCH_BLD'
|
||||
[ 20%] No patch step for 'PATCH_BLD'
|
||||
[ 20%] Performing configure step for 'PATCH_BLD'
|
||||
-- PATCH_BLD configure command succeeded. See also bext/build/patch/PATCH_BLD-prefix/src/PATCH_BLD-stamp/PATCH_BLD-configure-*.log
|
||||
[ 40%] Performing build step for 'PATCH_BLD'
|
||||
-- PATCH_BLD build command succeeded. See also bext/build/patch/PATCH_BLD-prefix/src/PATCH_BLD-stamp/PATCH_BLD-build-*.log
|
||||
[ 40%] Performing install step for 'PATCH_BLD'
|
||||
-- PATCH_BLD install command succeeded. See also bext/build/patch/PATCH_BLD-prefix/src/PATCH_BLD-stamp/PATCH_BLD-install-*.log
|
||||
[ 40%] Built target PATCH_BLD-install
|
||||
[ 60%] Creating directories for 'GEOGRAM_BLD'
|
||||
[ 60%] Performing download step (DIR copy) for 'GEOGRAM_BLD'
|
||||
[ 60%] No update step for 'GEOGRAM_BLD'
|
||||
[ 80%] No patch step for 'GEOGRAM_BLD'
|
||||
[ 80%] Performing configure step for 'GEOGRAM_BLD'
|
||||
-- GEOGRAM_BLD configure command succeeded. See also bext/build/geogram/GEOGRAM_BLD-prefix/src/GEOGRAM_BLD-stamp/GEOGRAM_BLD-configure-*.log
|
||||
[ 80%] Performing build step for 'GEOGRAM_BLD'
|
||||
-- GEOGRAM_BLD build command succeeded. See also bext/build/geogram/GEOGRAM_BLD-prefix/src/GEOGRAM_BLD-stamp/GEOGRAM_BLD-build-*.log
|
||||
[ 80%] Performing install step for 'GEOGRAM_BLD'
|
||||
-- GEOGRAM_BLD install command succeeded. See also bext/build/geogram/GEOGRAM_BLD-prefix/src/GEOGRAM_BLD-stamp/GEOGRAM_BLD-install-*.log
|
||||
[ 80%] Built target GEOGRAM_BLD-install
|
||||
[100%] Completed 'GEOGRAM_BLD'
|
||||
[100%] Built target GEOGRAM_BLD
|
||||
```
|
||||
|
||||
Once we have a successful completion, we inspect the contents of install:
|
||||
|
||||
```
|
||||
bext/build (main) $ ls -R ~/install/
|
||||
```
|
||||
|
||||
One thing to note is that a lot of the third party headers have been installed,
|
||||
including lua (although we disabled it) and zlib. It might be possible to trim
|
||||
the installed set of headers down if the subset of geogram we are interested in
|
||||
doesn't require all of them, but it would also require patching the build logic
|
||||
so it's not a step to take without some motivation. The zlib headers are concerning
|
||||
if there's a risk of them getting incorporated into other builds instead of our
|
||||
bundled zlib, but their location in include/geogram1/geogram/third_party/zlib should
|
||||
help avoid accidental incorporation so for the moment we can wait and see. The
|
||||
total file size for all the geogram headers is about 5M, which isn't enough to
|
||||
justify a cleanup attempt without more pressing functional concerns.
|
||||
|
||||
Once everything looks like it should, we are ready to remove the working geogram
|
||||
copy and add it properly as a submodule per the instructions at the top of this
|
||||
file:
|
||||
|
||||
```
|
||||
bext (main) $ rm -rf geogram/geogram && cd geogram
|
||||
bext/geogram (main) $ git submodule add -b RELEASE https://github.com/BRL-CAD/geogram.git
|
||||
bext/geogram (main) $ cd ..
|
||||
bext (main) $ echo " ignore = dirty" >> .gitmodules
|
||||
```
|
||||
|
||||
Then add all the new and updated files to git for committing, and make the
|
||||
commit - geogram will now be present as a dependency in bext.
|
||||
|
||||
```
|
||||
bext (main) $ git add .gitmodules CMakeLists.txt CMake/ geogram/
|
||||
bext (main) $ git status
|
||||
On branch main
|
||||
Your branch is up to date with 'origin/main'.
|
||||
|
||||
Changes to be committed:
|
||||
(use "git restore --staged <file>..." to unstage)
|
||||
modified: .gitmodules
|
||||
new file: CMake/FindGeogram.cmake
|
||||
modified: CMakeLists.txt
|
||||
new file: geogram/CMakeLists.txt
|
||||
new file: geogram/geogram
|
||||
new file: geogram/geogram.deps
|
||||
bext (main) $ git commit -m "Add geogram geometry library to bext"
|
||||
[main 07d979f] Add geogram geometry library to bext
|
||||
6 files changed, 227 insertions(+)
|
||||
create mode 100644 CMake/FindGeogram.cmake
|
||||
create mode 100644 geogram/CMakeLists.txt
|
||||
create mode 160000 geogram/geogram
|
||||
create mode 100644 geogram/geogram.deps
|
||||
bext (main) $ git push
|
||||
```
|
||||
|
||||
The final "git push" step publishes the new addition to the public github bext
|
||||
repository, and will also kick off a continuous integration test build on
|
||||
Windows, Mac and Linux. Because we tested only on Linux above, it is very
|
||||
common to see build issues on one or both of Windows and Mac - any issues
|
||||
should be immediately fixed, to keep bext building on all three platforms.
|
||||
In the case of severe issues, comment out the add\_project line in the toplevel
|
||||
bext CMakeLists.txt file corresponding to the new addition until the problems
|
||||
can be resolved.
|
||||
|
||||
Having added the dependency successfully to bext, the next step is to set up
|
||||
the main BRL-CAD build to make use of it. The FindGeogram.cmake file needs
|
||||
to be added to BRL-CAD's misc/CMake folder, and the following code needs to be
|
||||
added to misc/CMake/BRLCAD_ExternalDeps.cmake in order for the main BRL-CAD
|
||||
build to be able to find a bundled Geogram:
|
||||
|
||||
```
|
||||
# Geogram - a programming library with geometric algorithms
|
||||
# https://github.com/BrunoLevy/geogram
|
||||
find_package_reset(GEOGRAM RESET_TP)
|
||||
set(GEOGRAM_ROOT "${CMAKE_BINARY_DIR}")
|
||||
find_package(Geogram)
|
||||
```
|
||||
|
||||
Because the Geogram headers will trigger compiler warnings for a BRL-CAD build,
|
||||
we also need to identify "geogram" as a pattern on which to use the SYSTEM
|
||||
keyword when it is used in include_directories calls:
|
||||
|
||||
```
|
||||
set(SYS_INCLUDE_PATTERNS ${SYS_INCLUDE_PATTERNS} geogram)
|
||||
list(REMOVE_DUPLICATES SYS_INCLUDE_PATTERNS)
|
||||
set(SYS_INCLUDE_PATTERNS ${SYS_INCLUDE_PATTERNS} geogram CACHE STRING "Bundled system include dirs" FORCE)
|
||||
```
|
||||
|
||||
We also need to add "Geogram" to the BUNDLED_LABELS list and GEOGRAM_LIBRARY to
|
||||
the BUNDLED_VARS list in misc/CMake/BRLCAD_Summary.cmake - they both need to be
|
||||
in the same relative positions in their respective lists. This will allow the
|
||||
BRL-CAD configure summary to report on the status of the dependency automatically.
|
||||
By convention we keep the labels alphabetized.
|
||||
|
||||
Note that the bext build takes responsibility for making third party
|
||||
dependencies relocatable by leveraging LIEF, but if the upstream project ends
|
||||
up encoding fixed install paths rather than using relative lookups it may
|
||||
happen that a working install copy fails to work when copied into
|
||||
the main BRL-CAD build. If and when that happens, the original sources must be
|
||||
patched to allow for relocatable execution (we have to do this for Tcl, for
|
||||
example.) This should be done via patch file, and if the upstream project will
|
||||
take them push the necessary changes upstream to simplify incorporating new
|
||||
versions down the road.
|
||||
|
||||
Once the dependency is looking stable and useful, it's time to circle back and
|
||||
test the build logic for various configurations - system verisons of
|
||||
dependencies (if any), bundled versions of dependencies (if any), installing a
|
||||
system version of geogram and verifying that the FindGeogram.cmake file
|
||||
successfully detects it and our build logic disables the local build, and
|
||||
checking that the BRL-CAD FindGeogram.cmake and build logic also work in both
|
||||
configurations. Unfortunately, especially given the huge number of projects
|
||||
bext manages when everything is enabled, it's not practical to test all
|
||||
combinations of system and local for all projects. Generally speaking, the
|
||||
most important configurations are ENABLE_ALL=ON, system detection on a
|
||||
"vanilla" Linux box with just the minimal system development headers for X11
|
||||
et. al., and system detection on a Linux box with a lot of system versions of
|
||||
libraries present. (For projects like geogram that have minimal entanglement
|
||||
with other elements of bext it's more practical to check all configurations
|
||||
using the GEOGRAM_BLD build target, but that won't always be possible -
|
||||
build logic for projects like OSPray and Appleseed has the potential to
|
||||
encounter a vast set of possible mixes of system and bundled libs.)
|
||||
|
||||
@@ -1,112 +1,221 @@
|
||||
# minizip-ng
|
||||
# bext - External Dependencies for BRL-CAD
|
||||
|
||||
minizip-ng is a zip manipulation library written in C that is supported on Windows, macOS, and Linux.
|
||||
`bext` builds third-party libraries and helper tools used by
|
||||
[BRL-CAD](https://github.com/BRL-CAD/brlcad). By default it prefers suitable
|
||||
system packages and builds local copies only when they are needed.
|
||||
|
||||
[](https://github.com/zlib-ng/minizip-ng/actions)
|
||||
[](https://bugs.chromium.org/p/oss-fuzz/issues/list?sort=-opened&can=1&q=proj:minizip)
|
||||
[](https://github.com/zlib-ng/minizip-ng/blob/master/LICENSE)
|
||||
[](https://codecov.io/github/zlib-ng/minizip-ng/)
|
||||
# Quick start
|
||||
|
||||
Developed and maintained by Nathan Moinvaziri.
|
||||
Clone the repository, configure with the official `auto` preset, and build:
|
||||
|
||||
## Branches
|
||||
|
||||
| Name | Description |
|
||||
|:--------------------------------------------------------------|:------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
||||
| [master](https://github.com/zlib-ng/minizip-ng/tree/master) | Most recent release. |
|
||||
| [develop](https://github.com/zlib-ng/minizip-ng/tree/develop) | Latest development code. |
|
||||
| [1.2](https://github.com/zlib-ng/minizip-ng/tree/1.2) | Old changes to original minizip that includes WinZip AES encryption, disk splitting, I/O buffering and some additional fixes. Not ABI compatible with original minizip. |
|
||||
| [1.1](https://github.com/zlib-ng/minizip-ng/tree/1.1) | Original minizip as of zlib 1.2.11. |
|
||||
|
||||
## History
|
||||
|
||||
Minizip was originally developed by [Gilles Vollant](https://www.winimage.com/zLibDll/minizip.html) in 1998. It was first included in the zlib distribution as an additional code contribution starting in zlib 1.1.2. Since that time, it has been continually improved upon and contributed to by many people. The original [project](https://github.com/madler/zlib/tree/master/contrib/minizip) can still be found in the zlib distribution that is maintained by Mark Adler.
|
||||
|
||||
The motivation behind this repository has been the need for new features and bug fixes to the original library which had
|
||||
not been maintained for a long period of time. The code has been largely refactored and rewritten in order to help improve maintainability and readability. A compatibility layer has been provided for consumers of the original minizip library.
|
||||
|
||||
## Features
|
||||
|
||||
+ Creating and extracting zip archives.
|
||||
+ Adding and removing entries from zip archives.
|
||||
+ Read and write raw zip entry data.
|
||||
+ Reading and writing zip archives from memory.
|
||||
+ Support for large files with ZIP64 extension.
|
||||
+ Zlib, BZIP2, LZMA, XZ, and ZSTD compression methods.
|
||||
+ Password protection through Traditional PKWARE and [WinZIP AES](https://www.winzip.com/aes_info.htm) encryption.
|
||||
+ Buffered streaming for improved I/O performance.
|
||||
+ NTFS timestamp support for UTC last modified, last accessed, and creation dates.
|
||||
+ Disk split support for splitting zip archives into multiple files.
|
||||
+ Preservation of file attributes across file systems.
|
||||
+ Follow and store symbolic links.
|
||||
+ Unicode filename support through UTF-8 encoding.
|
||||
+ Legacy character encoding support CP437, CP932, CP936, CP950.
|
||||
+ Turn off compilation of compression, decompression, or encryption.
|
||||
+ Windows (Win32 & WinRT), macOS and Linux platform support.
|
||||
+ Streaming interface for easy implementation of additional platforms.
|
||||
+ Support for Apple's compression library ZLIB and XZ implementations.
|
||||
+ Zero out local file header information.
|
||||
+ Zip/unzip of central directory to reduce size.
|
||||
+ Recover the central directory if it is corrupt or missing.
|
||||
+ Example minizip and minigzip command line tools.
|
||||
|
||||
## Build
|
||||
|
||||
To generate project files for your platform:
|
||||
|
||||
1. [Download and install](https://cmake.org/install/) cmake (version 3.11 or later recommended).
|
||||
2. Run cmake in the minizip directory.
|
||||
|
||||
```
|
||||
cmake -S . -B build -D MZ_BUILD_TESTS=ON
|
||||
cmake --build build
|
||||
```sh
|
||||
git clone https://github.com/BRL-CAD/bext
|
||||
cd bext
|
||||
cmake --preset auto
|
||||
cmake --build build/auto --config Release --parallel 8
|
||||
```
|
||||
|
||||
## Build Options
|
||||
Submodules are populated on demand during configure. For checkout and
|
||||
platform setup details, see [INSTALL.md](INSTALL.md).
|
||||
|
||||
| Name | Description | Default Value |
|
||||
|:--------------------|:---------------------------------------------------------------|:-------------:|
|
||||
| MZ_COMPAT | Enables compatibility layer | ON |
|
||||
| MZ_ZLIB | Enables ZLIB compression | ON |
|
||||
| MZ_BZIP2 | Enables BZIP2 compression | ON |
|
||||
| MZ_LZMA | Enables LZMA & XZ compression | ON |
|
||||
| MZ_ZSTD | Enables ZSTD compression | ON |
|
||||
| MZ_LIBCOMP | Enables Apple compression | APPLE |
|
||||
| MZ_FETCH_LIBS | Enables fetching third-party libraries if not found | WIN32 |
|
||||
| MZ_FORCE_FETCH_LIBS | Enables fetching third-party libraries always | OFF |
|
||||
| MZ_PKCRYPT | Enables PKWARE traditional encryption | ON |
|
||||
| MZ_WZAES | Enables WinZIP AES encryption | ON |
|
||||
| MZ_OPENSSL | Enables OpenSSL encryption | UNIX |
|
||||
| MZ_LIBBSD | Builds with libbsd crypto random | UNIX |
|
||||
| MZ_ICONV | Enables iconv encoding conversion | ON |
|
||||
| MZ_COMPRESS_ONLY | Only support compression | OFF |
|
||||
| MZ_DECOMPRESS_ONLY | Only support decompression | OFF |
|
||||
| MZ_FILE32_API | Builds using posix 32-bit file api | OFF |
|
||||
| MZ_BUILD_TESTS | Builds minizip test executable | OFF |
|
||||
| MZ_BUILD_UNIT_TESTS | Builds minizip unit test project | OFF |
|
||||
| MZ_BUILD_FUZZ_TESTS | Builds minizip fuzz executables | OFF |
|
||||
| MZ_CODE_COVERAGE | Build with code coverage flags | OFF |
|
||||
| MZ_SANITIZER | Build with code sanitizer (Memory, Thread, Address, Undefined) | |
|
||||
| MZ_LIB_SUFFIX | Library name suffix for packaging | |
|
||||
The preset workflow relies on CMake's newer preset support. If you are using
|
||||
CMake 3.19 or 3.20, use the raw configure equivalents below.
|
||||
|
||||
## Third-Party Libraries
|
||||
# Optional bootstrap
|
||||
|
||||
Third-party libraries may be required based on the CMake options selected. If the system already has the library
|
||||
installed then it will be used, otherwise CMake will retrieve the source code for the library from its official git repository and compile it in when the `MZ_FETCH_LIBS` option is enabled.
|
||||
If you want to fetch a given profile's source submodules up front
|
||||
instead of letting configure fetch them on demand:
|
||||
|
||||
|Project|License|CMake Option|Comments|
|
||||
|-|-|-|-|
|
||||
[bzip2](https://www.sourceware.org/bzip2/)|[license](https://github.com/zlib-ng/minizip-ng/blob/develop/lib/bzip2/LICENSE)|`MZ_BZIP2`|Written by Julian Seward.|
|
||||
|[liblzma](https://tukaani.org/xz/)|Public domain|`MZ_LZMA`|Written by Igor Pavlov and Lasse Collin.|
|
||||
|[zlib](https://zlib.net/)|zlib|`MZ_ZLIB`|Written by Mark Adler and Jean-loup Gailly. Or alternatively, [zlib-ng](https://github.com/zlib-ng/zlib-ng) by Hans Kristian Rosbach.|
|
||||
|[zstd](https://github.com/facebook/zstd)|[BSD](https://github.com/facebook/zstd/blob/dev/LICENSE)|`MZ_ZSTD`|Written by Facebook.|
|
||||
```sh
|
||||
cmake -DPROFILE=auto -P CMake/BextBootstrap.cmake
|
||||
cmake --preset auto
|
||||
```
|
||||
|
||||
This project uses the zlib [license](LICENSE).
|
||||
Use `LIST_ONLY=ON` to preview the selected submodules without fetching them,
|
||||
and `GIT_SHALLOW_CLONE=ON` to specify shallow clones during bootstrap.
|
||||
|
||||
## Acknowledgments
|
||||
# How manual selection works
|
||||
|
||||
Thanks go out to all the people who have taken the time to contribute code reviews, testing and/or patches. This project would not have been as good without you.
|
||||
Build selection happens in three layers:
|
||||
|
||||
Thanks to [Gilles Vollant](https://www.winimage.com/zLibDll/minizip.html) on which this work is originally based on.
|
||||
1. `USE_*` options decide which dependency families are in scope.
|
||||
2. For in-scope packages, the default behavior is to use a suitable system
|
||||
package if one is found and build a local copy only when needed.
|
||||
3. `ENABLE_<pkg>=ON` or `OFF` overrides one package explicitly.
|
||||
|
||||
The [ZIP format](https://github.com/zlib-ng/minizip-ng/blob/master/doc/zip/appnote.txt) was defined by Phil Katz of PKWARE.
|
||||
Default `USE_*` values:
|
||||
|
||||
* `USE_BRLCAD=ON`
|
||||
* `USE_BRLCAD_EXTRA=ON`
|
||||
* `USE_GDAL=ON`
|
||||
* `USE_QT=ON`
|
||||
* `USE_TCL=ON`
|
||||
* `USE_APPLESEED=OFF`
|
||||
* `USE_OSPRAY=OFF`
|
||||
|
||||
`ENABLE_ALL=ON` changes step 2 by preferring local builds for packages in the
|
||||
active `USE_*` groups. It does not turn on groups whose `USE_*` option is
|
||||
`OFF`.
|
||||
|
||||
When `bext` is driven from a BRL-CAD build, `BRLCAD_COMPONENTS` can further
|
||||
narrow some BRL-CAD-related packages to only those needed by the requested
|
||||
component set.
|
||||
|
||||
## Xmin-backed bundled toolkits
|
||||
|
||||
An installed Xmin SDK can provide the X11 and OpenGL surface for bext's
|
||||
bundled Tk and Qt. Set `BEXT_XMIN_ROOT` to select the standard Xmin profile:
|
||||
|
||||
```sh
|
||||
cmake -S /path/to/bext -B /path/to/bext-build \
|
||||
-DBEXT_XMIN_ROOT=/absolute/path/to/xmin-sdk \
|
||||
-DENABLE_TCL=ON -DENABLE_QT=ON
|
||||
```
|
||||
|
||||
The profile affects only Tk and Qt packages selected for a local build. It
|
||||
does not enable a package excluded by `USE_*`, `BRLCAD_COMPONENTS`, or an
|
||||
explicit `DISABLE_*` setting.
|
||||
|
||||
* Tk is configured with `--with-xmin` and bext's matching Tk patch.
|
||||
* Qt is built with the matching Xmin patch, the qxcb desktop-OpenGL profile,
|
||||
and dependency audits that reject accidental host X11 or OpenGL linkage.
|
||||
|
||||
The patches are maintained next to the dependency build logic as
|
||||
`tk/tk_xmin.patch` and `qt/qt_xmin.patch`. They are tied to the exact Tk
|
||||
and Qt submodule revisions in this repository. Updating either dependency
|
||||
therefore requires updating its patch; a stale patch fails during the patch
|
||||
step rather than silently producing a mixed build.
|
||||
|
||||
The Xmin SDK must include toolkit-client support for Tk. Qt additionally
|
||||
requires the Qt X11 compatibility client and client OpenGL support. Normal
|
||||
system discovery is unchanged when `BEXT_XMIN_ROOT` is empty.
|
||||
|
||||
Qt's installed package metadata retains an explicit dependency on Xmin.
|
||||
Downstream projects must therefore keep the same SDK discoverable with
|
||||
`Xmin_DIR` or `CMAKE_PREFIX_PATH`; configuration fails instead of falling back
|
||||
to host X libraries when that SDK is absent.
|
||||
|
||||
## Advanced toolkit patch controls
|
||||
|
||||
Unix builds may pass additional, semicolon-separated absolute patch paths in
|
||||
`TK_EXTRA_PATCHES`, plus additional Tk `configure` arguments in
|
||||
`TK_CONFIGURE_ARGS`. `QT_EXTRA_PATCHES` provides the corresponding Qt
|
||||
hook. `QT_XMIN_ROOT` remains available for manually supplied Qt Xmin patches.
|
||||
These low-level controls are not needed when `BEXT_XMIN_ROOT` selects the
|
||||
standard profile.
|
||||
|
||||
# Official profiles
|
||||
|
||||
The supported configure entry points are:
|
||||
|
||||
* `auto` - standard BRL-CAD-oriented profile using suitable system packages
|
||||
when found
|
||||
* `bundled` - standard BRL-CAD-oriented profile with bundled/local builds
|
||||
preferred for all active groups
|
||||
* `minimal` - core BRL-CAD profile without extras, GDAL, Qt, Tcl/Tk,
|
||||
Appleseed, or OSPRay
|
||||
* `everything` - all current groups enabled with bundled/local builds
|
||||
preferred throughout
|
||||
|
||||
Use them like this:
|
||||
|
||||
```sh
|
||||
cmake --preset auto
|
||||
cmake --preset bundled
|
||||
cmake --preset minimal
|
||||
cmake --preset everything
|
||||
```
|
||||
|
||||
Build using the preset's build directory:
|
||||
|
||||
```sh
|
||||
cmake --build build/auto --config Release --parallel 8
|
||||
```
|
||||
|
||||
# Raw configure equivalents
|
||||
|
||||
`auto`:
|
||||
|
||||
```sh
|
||||
cmake ../bext -DCMAKE_BUILD_TYPE=Release
|
||||
```
|
||||
|
||||
`bundled`:
|
||||
|
||||
```sh
|
||||
cmake ../bext -DENABLE_ALL=ON -DCMAKE_BUILD_TYPE=Release
|
||||
```
|
||||
|
||||
`minimal`:
|
||||
|
||||
```sh
|
||||
cmake ../bext \
|
||||
-DUSE_BRLCAD_EXTRA=OFF \
|
||||
-DUSE_GDAL=OFF \
|
||||
-DUSE_QT=OFF \
|
||||
-DUSE_TCL=OFF \
|
||||
-DCMAKE_BUILD_TYPE=Release
|
||||
```
|
||||
|
||||
`everything`:
|
||||
|
||||
```sh
|
||||
cmake ../bext \
|
||||
-DENABLE_ALL=ON \
|
||||
-DUSE_APPLESEED=ON \
|
||||
-DUSE_OSPRAY=ON \
|
||||
-DCMAKE_BUILD_TYPE=Release
|
||||
```
|
||||
|
||||
# Build outputs
|
||||
|
||||
By default, `CMAKE_INSTALL_PREFIX` is the build directory. `bext` creates two
|
||||
output trees under that prefix:
|
||||
|
||||
* `install/` - files intended to be bundled with downstream software
|
||||
* `noinstall/` - build-only tools and compile-time-only assets
|
||||
* `bext-install-manifest.json` - relative file classifications and the
|
||||
platform metadata needed by downstream staging builds
|
||||
|
||||
The normal build finalizes bundled binaries after all dependency install steps.
|
||||
It uses `strclear` and, where available, `plief` to remove stale build paths and
|
||||
normalize RPATH-bearing files before writing the manifest. Consumers should
|
||||
continue to treat `install/` as read-only and perform their own staging-specific
|
||||
path and RPATH edits on copied files.
|
||||
|
||||
The normal build also generates a dependency graph in the build directory as
|
||||
`bext.dot`. When Graphviz `dot` is available, the build also emits rendered
|
||||
forms such as `bext.svg`, `bext.png`, and `bext.pdf`.
|
||||
|
||||
When BRL-CAD consumes a `bext` build, `BRLCAD_EXT_DIR` should point at the
|
||||
parent directory containing both `install/` and `noinstall/`.
|
||||
|
||||
# Using the build outputs with BRL-CAD
|
||||
|
||||
If you used the `auto` preset, `BRLCAD_EXT_DIR` should be `../bext/build/auto`.
|
||||
Configure BRL-CAD with:
|
||||
|
||||
```sh
|
||||
git clone https://github.com/BRL-CAD/brlcad
|
||||
mkdir brlcad_build
|
||||
cd brlcad_build
|
||||
cmake ../brlcad -DBRLCAD_EXT_DIR=../bext_build -DCMAKE_BUILD_TYPE=Release
|
||||
cmake --build . --config Release --parallel 8
|
||||
```
|
||||
|
||||
If you built Qt in `bext`, also enable Qt in BRL-CAD:
|
||||
|
||||
```sh
|
||||
cmake ../brlcad \
|
||||
-DBRLCAD_EXT_DIR=../bext_build \
|
||||
-DBRLCAD_ENABLE_QT=ON \
|
||||
-DCMAKE_BUILD_TYPE=Release
|
||||
```
|
||||
|
||||
# More information
|
||||
|
||||
* [INSTALL.md](INSTALL.md) - platform prerequisites, checkout options, and
|
||||
setup caveats
|
||||
* [DEPENDENCIES.md](DEPENDENCIES.md) - package-to-group reference, output
|
||||
classification, and dependency addition workflow
|
||||
* [NOTES.md](NOTES.md) - maintainer notes and submodule procedures
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
A bunch of the patches are still adding FindZLIB.cmake - fix.
|
||||
|
||||
Make sure for all the Find*.cmake files we're adding we reference
|
||||
the copy in the toplevel bext/CMake directory unless there's a reason
|
||||
not to - shouldn't be making per-proejct addfiles/ copies of those
|
||||
since we'd just have to update each one.
|
||||
|
||||
Right now, I don't think we're really handling switching config options
|
||||
properly. If we enable/disable individual components, dependencies using
|
||||
those components need to be reset - their old compiles will no longer be
|
||||
valid if one of their dependencies changes. We need to:
|
||||
|
||||
1. clear the output directories, so the contents reflect the new
|
||||
settings rather than keeping potentially outdated files
|
||||
|
||||
2. remove old build directory contents for those projects that have
|
||||
had a dependency change status, so their compiles end up detecting
|
||||
and linking to the correct versions. We can't depend on third
|
||||
party build systems to reset everything correctly, so we need to
|
||||
start clean.
|
||||
@@ -0,0 +1,108 @@
|
||||
|
||||
bext_enable(APPLESEED)
|
||||
|
||||
if (ENABLE_APPLESEED)
|
||||
|
||||
git_submodule_init(appleseed CMakeLists.txt)
|
||||
|
||||
RegisterDeps(APPLESEED)
|
||||
if (TARGET ZLIB_BLD)
|
||||
set(Z_PREFIX_STR "brl_")
|
||||
endif (TARGET ZLIB_BLD)
|
||||
set(APPLESEED_SIMD_ARGS)
|
||||
if (APPLE AND CMAKE_SYSTEM_PROCESSOR MATCHES "^(arm64|aarch64)")
|
||||
list(APPEND APPLESEED_SIMD_ARGS
|
||||
-DUSE_SSE=OFF
|
||||
-DUSE_SSE42=OFF
|
||||
-DUSE_AVX=OFF
|
||||
-DUSE_AVX2=OFF
|
||||
-DUSE_F16C=OFF
|
||||
)
|
||||
endif ()
|
||||
|
||||
ExternalProject_Add(APPLESEED_BLD
|
||||
URL "${CMAKE_CURRENT_SOURCE_DIR}/appleseed"
|
||||
BUILD_ALWAYS ${EXT_BUILD_ALWAYS} ${LOG_OPTS}
|
||||
PATCH_COMMAND ${PATCH_EXECUTABLE};-E;-p1;${PATCH_OPTIONS};-i;${CMAKE_CURRENT_SOURCE_DIR}/appleseed.patch
|
||||
CMAKE_ARGS
|
||||
-DCMAKE_FIND_PACKAGE_PREFER_CONFIG=ON
|
||||
${BUILD_TYPE_SPECIFIER}
|
||||
${APPLESEED_SIMD_ARGS}
|
||||
$<$<BOOL:${ZLIB_TARGET}>:-DZ_PREFIX=ON>
|
||||
$<$<BOOL:${ZLIB_TARGET}>:-DZ_PREFIX_STR=${Z_PREFIX_STR}>
|
||||
-DBOOST_ROOT=$<$<BOOL:${BOOST_TARGET}>:${CMAKE_BUNDLE_INSTALL_PREFIX}>
|
||||
-DEigen3_ROOT=$<$<BOOL:${EIGEN_BUNDLED}>:${CMAKE_NOBUNDLE_INSTALL_PREFIX}>
|
||||
-DEMBREE_ROOT=$<$<BOOL:${EMBREE_TARGET}>:${CMAKE_BUNDLE_INSTALL_PREFIX}>
|
||||
-DISPC_ROOT=$<$<BOOL:${ISPC_TARGET}>:${CMAKE_BUNDLE_INSTALL_PREFIX}>
|
||||
$<$<BOOL:${ONETBB_TARGET}>:-DTBB_ROOT=${CMAKE_BUNDLE_INSTALL_PREFIX}>
|
||||
-DJPEG_ROOT=$<$<BOOL:${JPEG_TARGET}>:${CMAKE_BUNDLE_INSTALL_PREFIX}>
|
||||
-DPNG_ROOT=$<$<BOOL:${PNG_TARGET}>:${CMAKE_BUNDLE_INSTALL_PREFIX}>
|
||||
-DTIFF_ROOT=$<$<BOOL:${TIFF_TARGET}>:${CMAKE_BUNDLE_INSTALL_PREFIX}>
|
||||
-DLLVM_ROOT=$<$<BOOL:${LLVM_TARGET}>:${CMAKE_BUNDLE_INSTALL_PREFIX}>
|
||||
-DLZ4_ROOT=$<$<BOOL:${LZ4_TARGET}>:${CMAKE_BUNDLE_INSTALL_PREFIX}>
|
||||
-DOPENCOLORIO_ROOT=$<$<BOOL:${OPENCOLORIO_TARGET}>:${CMAKE_BUNDLE_INSTALL_PREFIX}>
|
||||
-DOPENEXR_ROOT=$<$<BOOL:${OPENEXR_TARGET}>:${CMAKE_BUNDLE_INSTALL_PREFIX}>
|
||||
-DOPENIMAGEIO_ROOT=$<$<BOOL:${OPENIMAGEIO_TARGET}>:${CMAKE_BUNDLE_INSTALL_PREFIX}>
|
||||
-DOSL_ROOT=$<$<BOOL:${OSL_TARGET}>:${CMAKE_BUNDLE_INSTALL_PREFIX}>
|
||||
# appleseed locates the OSL tools (oslc shader compiler, oslinfo query tool)
|
||||
# via find_program() calls in its FindOSL.cmake that are malformed -- the
|
||||
# path hint is parsed as an additional program name -- so the tools are only
|
||||
# found if they happen to be on PATH, otherwise OSL_COMPILER / OSL_QUERY_INFO
|
||||
# end up empty. That breaks the .osl->.oso build (command degrades to just
|
||||
# its flags, "'-O2' is not recognized") and the post-build copy of oslinfo
|
||||
# into the sandbox (cmake -E copy with an empty source). Pass both tools
|
||||
# explicitly, as appleseed's own CI does; find_program() honors a pre-set var.
|
||||
-DOSL_COMPILER=$<$<BOOL:${OSL_TARGET}>:${CMAKE_BUNDLE_INSTALL_PREFIX}/${BIN_DIR}/oslc${CMAKE_EXECUTABLE_SUFFIX}>
|
||||
-DOSL_QUERY_INFO=$<$<BOOL:${OSL_TARGET}>:${CMAKE_BUNDLE_INSTALL_PREFIX}/${BIN_DIR}/oslinfo${CMAKE_EXECUTABLE_SUFFIX}>
|
||||
-DXERCES_C_ROOT=$<$<BOOL:${XERCES_C_TARGET}>:${CMAKE_BUNDLE_INSTALL_PREFIX}>
|
||||
-DZLIB_C_ROOT=$<$<BOOL:${ZLIB_TARGET}>:${CMAKE_BUNDLE_INSTALL_PREFIX}>
|
||||
-DWITH_STUDIO=OFF
|
||||
-DWITH_BENCH=OFF
|
||||
-DWITH_TOOLS=OFF
|
||||
-DWITH_PYTHON2_BINDINGS=OFF
|
||||
-DWITH_PYTHON3_BINDINGS=OFF
|
||||
-DINSTALL_TESTS=OFF
|
||||
-DINSTALL_API_EXAMPLES=OFF
|
||||
-DWARNINGS_AS_ERRORS=OFF
|
||||
-DUSE_FIND_PACKAGE_FOR_EMBREE=ON
|
||||
-DUSE_FIND_PACKAGE_FOR_EXR=ON
|
||||
-DUSE_FIND_PACKAGE_FOR_LZ4=ON
|
||||
-DUSE_FIND_PACKAGE_FOR_OCIO=ON
|
||||
-DUSE_FIND_PACKAGE_FOR_OIIO=ON
|
||||
-DUSE_FIND_PACKAGE_FOR_OSL=ON
|
||||
-DUSE_FIND_PACKAGE_FOR_XERCES=ON
|
||||
-DUSE_FIND_PACKAGE_FOR_ZLIB=ON
|
||||
-DBIN_DIR=${BIN_DIR}
|
||||
-DLIB_DIR=${LIB_DIR}
|
||||
-DBUILD_STATIC_LIBS=${BUILD_STATIC_LIBS}
|
||||
-DCMAKE_PREFIX_PATH=${CMAKE_BUNDLE_INSTALL_PREFIX}
|
||||
-DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
|
||||
-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
|
||||
-DCMAKE_INSTALL_PREFIX=${CMAKE_BUNDLE_INSTALL_PREFIX}
|
||||
-DCMAKE_INSTALL_LIBDIR:PATH=${LIB_DIR}
|
||||
-DCMAKE_INSTALL_RPATH=${CMAKE_BUNDLE_INSTALL_PREFIX}/${LIB_DIR}
|
||||
-DOpenEXR_DIR=${CMAKE_BUNDLE_INSTALL_PREFIX}/${LIB_DIR}/cmake/OpenEXR
|
||||
LOG_CONFIGURE ${EXT_BUILD_QUIET}
|
||||
LOG_BUILD ${EXT_BUILD_QUIET}
|
||||
LOG_INSTALL ${EXT_BUILD_QUIET}
|
||||
LOG_OUTPUT_ON_FAILURE ${EXT_BUILD_QUIET}
|
||||
STEP_TARGETS install
|
||||
)
|
||||
|
||||
TargetInstallDeps(APPLESEED APPLESEED_DEPENDS)
|
||||
|
||||
# Copy the license into position in CMAKE_BUNDLE_INSTALL_PREFIX
|
||||
configure_file(
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/appleseed/LICENSE.txt
|
||||
${DOC_LICENSE_DIR}/appleseed.txt
|
||||
COPYONLY
|
||||
)
|
||||
|
||||
endif (ENABLE_APPLESEED)
|
||||
|
||||
# Local Variables:
|
||||
# tab-width: 8
|
||||
# mode: cmake
|
||||
# indent-tabs-mode: t
|
||||
# End:
|
||||
# ex: shiftwidth=2 tabstop=8
|
||||
Submodule
+1
Submodule appleseed/appleseed added at 05e66fd424
@@ -0,0 +1,17 @@
|
||||
BOOST
|
||||
EIGEN
|
||||
EMBREE
|
||||
JPEG
|
||||
LLVM
|
||||
LZ4
|
||||
ONETBB
|
||||
OPENCOLORIO
|
||||
OPENEXR
|
||||
OPENIMAGEIO
|
||||
OSL
|
||||
PATCH
|
||||
PNG
|
||||
TIFF
|
||||
XERCES_C
|
||||
ZLIB
|
||||
|
||||
@@ -0,0 +1,152 @@
|
||||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
index 74ed663..ba8c28e 100644
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -224,9 +224,28 @@ if (USE_STATIC_BOOST)
|
||||
endif ()
|
||||
find_package(Boost 1.70 REQUIRED COMPONENTS atomic chrono date_time filesystem regex system thread wave)
|
||||
add_definitions(-DBOOST_FILESYSTEM_VERSION=3 -DBOOST_FILESYSTEM_NO_DEPRECATED -DBOOST_ALL_DYN_LINK)
|
||||
+if (MSVC)
|
||||
+ # Boost 1.85's auto_link.hpp caps its MSVC toolset tag at vc143 (VS2022), but
|
||||
+ # the bundled Boost is built with the newer (VS2026) toolset and installed as
|
||||
+ # vc145. With BOOST_ALL_DYN_LINK the auto-link #pragma comment(lib, ...)
|
||||
+ # directives would otherwise request boost_*-vc143-mt-x64-1_85.lib, which do
|
||||
+ # not exist (LNK1104). Override the tag to match the bundled libraries.
|
||||
+ add_definitions(-DBOOST_LIB_TOOLSET="vc145")
|
||||
+endif ()
|
||||
include_directories(SYSTEM ${Boost_INCLUDE_DIRS})
|
||||
link_directories(${Boost_LIBRARY_DIRS})
|
||||
find_package(OSL REQUIRED)
|
||||
+# appleseed links OSL via the oslcomp/oslexec/oslquery_LIBRARY_IMP variables,
|
||||
+# which are only populated by appleseed's module-mode FindOSL.cmake. When OSL is
|
||||
+# resolved in CONFIG mode instead (e.g. CMAKE_FIND_PACKAGE_PREFER_CONFIG=ON with
|
||||
+# a bundled OSLConfig.cmake), those variables stay empty and OSL is silently left
|
||||
+# out of the link (unresolved OSL_v1_xx::ShadingSystem/RendererServices/... at
|
||||
+# link time). Fall back to the imported targets provided by OSLConfig.
|
||||
+if (TARGET OSL::oslexec AND NOT oslexec_LIBRARY_IMP)
|
||||
+ set(oslcomp_LIBRARY_IMP OSL::oslcomp)
|
||||
+ set(oslexec_LIBRARY_IMP OSL::oslexec)
|
||||
+ set(oslquery_LIBRARY_IMP OSL::oslquery)
|
||||
+endif ()
|
||||
-find_package(OpenEXR REQUIRED)
|
||||
+find_package(OpenEXR MODULE REQUIRED)
|
||||
find_package(OpenImageIO REQUIRED)
|
||||
|
||||
@@ -275,7 +294,6 @@ endif ()
|
||||
|
||||
include_directories(
|
||||
${IMATH_INCLUDE_DIRS}
|
||||
- ${IMATH_INCLUDE_DIRS}/OpenEXR/
|
||||
${LZ4_INCLUDE_DIR}
|
||||
${OPENCOLORIO_INCLUDE_DIRS}
|
||||
${OPENEXR_INCLUDE_DIRS}
|
||||
@@ -674,3 +692,11 @@ endif ()
|
||||
# indent-tabs-mode: t
|
||||
# End:
|
||||
# ex: shiftwidth=2 tabstop=8
|
||||
+find_package(OpenEXR REQUIRED)
|
||||
+get_target_property(IMATH_INCLUDES Imath::Imath INTERFACE_INCLUDE_DIRECTORIES)
|
||||
+if (APPLE)
|
||||
+foreach (IMATH_INCLUDE_DIR IN LISTS IMATH_INCLUDES)
|
||||
+ string (REGEX REPLACE "/Imath/?$" "" IMATH_INCLUDE_DIR "${IMATH_INCLUDE_DIR}")
|
||||
+ add_compile_options("-Wp,-I${IMATH_INCLUDE_DIR}")
|
||||
+endforeach ()
|
||||
+endif ()
|
||||
diff --git a/cmake/FindOpenEXR.cmake b/cmake/FindOpenEXR.cmake
|
||||
index 00c769d..0f38a0d 100644
|
||||
--- a/cmake/FindOpenEXR.cmake
|
||||
+++ b/cmake/FindOpenEXR.cmake
|
||||
@@ -56,16 +56,22 @@ if (TARGET OpenEXR::OpenEXR AND TARGET Imath::Imath)
|
||||
# Mimic old style variables
|
||||
set (OPENEXR_VERSION ${OpenEXR_VERSION})
|
||||
get_target_property(IMATH_INCLUDES Imath::Imath INTERFACE_INCLUDE_DIRECTORIES)
|
||||
+ set (IMATH_INCLUDE_DIRS ${IMATH_INCLUDES})
|
||||
+ string (REGEX REPLACE "/Imath/?$" "" IMATH_INCLUDE_DIRS "${IMATH_INCLUDE_DIRS}")
|
||||
+ set (IMATH_INCLUDE_DIR ${IMATH_INCLUDES})
|
||||
get_target_property(ILMBASE_INCLUDES Imath::Imath INTERFACE_INCLUDE_DIRECTORIES)
|
||||
- get_target_property(ILMBASE_IMATH_LIBRARY Imath::Imath INTERFACE_LINK_LIBRARIES)
|
||||
- get_target_property(IMATH_LIBRARY Imath::Imath INTERFACE_LINK_LIBRARIES)
|
||||
- get_target_property(OPENEXR_IEX_LIBRARY OpenEXR::Iex INTERFACE_LINK_LIBRARIES)
|
||||
- get_target_property(OPENEXR_ILMTHREAD_LIBRARY OpenEXR::IlmThread INTERFACE_LINK_LIBRARIES)
|
||||
+ set (ILMBASE_IMATH_LIBRARY Imath::Imath)
|
||||
+ set (IMATH_LIBRARY Imath::Imath)
|
||||
+ set (OPENEXR_IEX_LIBRARY OpenEXR::Iex)
|
||||
+ set (OPENEXR_ILMTHREAD_LIBRARY OpenEXR::IlmThread)
|
||||
set (ILMBASE_LIBRARIES ${ILMBASE_IMATH_LIBRARY})
|
||||
set (ILMBASE_FOUND true)
|
||||
|
||||
get_target_property(OPENEXR_INCLUDES OpenEXR::OpenEXR INTERFACE_INCLUDE_DIRECTORIES)
|
||||
- get_target_property(OPENEXR_ILMIMF_LIBRARY OpenEXR::OpenEXR INTERFACE_LINK_LIBRARIES)
|
||||
+ set (OPENEXR_INCLUDE_DIRS ${OPENEXR_INCLUDES})
|
||||
+ string (REGEX REPLACE "/OpenEXR/?$" "" OPENEXR_INCLUDE_DIRS "${OPENEXR_INCLUDE_DIRS}")
|
||||
+ set (OPENEXR_INCLUDE_DIR ${OPENEXR_INCLUDES})
|
||||
+ set (OPENEXR_ILMIMF_LIBRARY OpenEXR::OpenEXR)
|
||||
set (OPENEXR_LIBRARIES ${OPENEXR_ILMIMF_LIBRARY} ${OPENEXR_IEX_LIBRARY} ${OPENEXR_ILMTHREAD_LIBRARY} ${ILMBASE_LIBRARIES})
|
||||
set (OPENEXR_FOUND true)
|
||||
|
||||
diff --git a/src/thirdparty/bcd/bcd/Denoiser.cpp b/src/thirdparty/bcd/bcd/Denoiser.cpp
|
||||
index 109ec87..ef7ed8e 100644
|
||||
--- a/src/thirdparty/bcd/bcd/Denoiser.cpp
|
||||
+++ b/src/thirdparty/bcd/bcd/Denoiser.cpp
|
||||
@@ -125,7 +125,7 @@ bool Denoiser::denoise()
|
||||
i,
|
||||
boost::ref(abortRequested)));
|
||||
|
||||
- denoiseThreads.push_back(move(t));
|
||||
+ denoiseThreads.push_back(std::move(t));
|
||||
|
||||
startPixelIndexIt = endPixelIndexIt;
|
||||
}
|
||||
diff --git a/src/appleseed/main/allocator.cpp b/src/appleseed/main/allocator.cpp
|
||||
--- a/src/appleseed/main/allocator.cpp
|
||||
+++ b/src/appleseed/main/allocator.cpp
|
||||
@@ -58,6 +58,7 @@
|
||||
#include <cassert>
|
||||
#include <cstdint>
|
||||
#include <cstdio>
|
||||
+#include <cstdlib>
|
||||
#include <cstring>
|
||||
#include <ctime>
|
||||
#include <exception>
|
||||
@@ -501,7 +502,14 @@
|
||||
if (size < 1)
|
||||
size = 1;
|
||||
|
||||
- void* ptr = aligned_malloc(size, MemoryAlignment);
|
||||
+ /* BRL-CAD PATCH: use plain malloc (already 16-byte aligned on x64)
|
||||
+ * instead of aligned_malloc. This operator new/delete override only
|
||||
+ * applies inside appleseed.dll, so std::strings/objects allocated by the
|
||||
+ * default CRT allocator in other modules (art.exe, brl-cad DLLs,
|
||||
+ * msvcp140d) and freed here would hit aligned_free() on a non-aligned
|
||||
+ * block and crash (seen in foundation::SearchPaths::do_to_string at
|
||||
+ * render start). malloc/free keep every module on one shared CRT heap. */
|
||||
+ void* ptr = malloc(size);
|
||||
|
||||
if (!ptr)
|
||||
throw std::bad_alloc();
|
||||
@@ -514,7 +522,7 @@
|
||||
if (!ptr)
|
||||
return;
|
||||
|
||||
- aligned_free(ptr);
|
||||
+ free(ptr);
|
||||
}
|
||||
}
|
||||
|
||||
diff --git a/src/appleseed/renderer/device/cpu/cpurenderdevice.cpp b/src/appleseed/renderer/device/cpu/cpurenderdevice.cpp
|
||||
--- a/src/appleseed/renderer/device/cpu/cpurenderdevice.cpp
|
||||
+++ b/src/appleseed/renderer/device/cpu/cpurenderdevice.cpp
|
||||
@@ -86,7 +86,12 @@
|
||||
m_texture_system,
|
||||
m_error_handler);
|
||||
m_shading_system->attribute("lockgeom", 1);
|
||||
- m_shading_system->attribute("colorspace", "Linear");
|
||||
+ /* BRL-CAD PATCH: OSL's working color space must be a name OSL knows (its
|
||||
+ * default is "Rec709", the linear-Rec709 working space). The upstream
|
||||
+ * "Linear" is not a recognized OSL color space, so OSL logged
|
||||
+ * "Unknown color space \"Linear\"" on every color transform and flagged an
|
||||
+ * error (nonzero process exit) even though rendering succeeded. */
|
||||
+ m_shading_system->attribute("colorspace", "Rec709");
|
||||
m_shading_system->attribute("commonspace", "world");
|
||||
m_shading_system->attribute("statistics:level", 1);
|
||||
m_shading_system->attribute(
|
||||
@@ -0,0 +1,72 @@
|
||||
# Decide if we're using assetimport.
|
||||
# Also, assetimport is used directly by a libgcv plugin and (until we update to Manifold 3.0)
|
||||
# is needed by Manifold, which is used by librt
|
||||
cad_enable(ASSETIMPORT "libgcv;librt")
|
||||
|
||||
bext_enable(ASSETIMPORT)
|
||||
|
||||
# Decision made
|
||||
|
||||
if (ENABLE_ASSETIMPORT)
|
||||
|
||||
git_submodule_init(assimp CMakeLists.txt)
|
||||
|
||||
RegisterDeps(ASSETIMPORT)
|
||||
if (TARGET ZLIB_BLD)
|
||||
set(Z_PREFIX_STR "brl_")
|
||||
endif (TARGET ZLIB_BLD)
|
||||
|
||||
ExternalProject_Add(ASSETIMPORT_BLD
|
||||
URL "${CMAKE_CURRENT_SOURCE_DIR}/assimp"
|
||||
BUILD_ALWAYS ${EXT_BUILD_ALWAYS} ${LOG_OPTS}
|
||||
PATCH_COMMAND ${PATCH_EXECUTABLE};-E;-p1;${PATCH_OPTIONS};-i;${CMAKE_CURRENT_SOURCE_DIR}/assetimport_CMake.patch
|
||||
COMMAND ${PATCH_EXECUTABLE};-E;-p1;${PATCH_OPTIONS};-i;${CMAKE_CURRENT_SOURCE_DIR}/assetimport_stb.patch
|
||||
COMMAND ${CMAKE_COMMAND};-E;remove;<SOURCE_DIR>/cmake-modules/FindZLIB.cmake
|
||||
COMMAND ${CMAKE_COMMAND};-E;copy;${PROJECT_SOURCE_DIR}/CMake/FindZLIB.cmake;<SOURCE_DIR>/cmake-modules/FindZLIB.cmake
|
||||
CMAKE_ARGS
|
||||
${BUILD_TYPE_SPECIFIER}
|
||||
$<$<BOOL:${ZLIB_TARGET}>:-DZ_PREFIX=ON>
|
||||
$<$<BOOL:${ZLIB_TARGET}>:-DZ_PREFIX_STR=${Z_PREFIX_STR}>
|
||||
-DZLIB_ROOT=$<$<BOOL:${ZLIB_TARGET}>:${CMAKE_BUNDLE_INSTALL_PREFIX}>
|
||||
-Dpugixml_ROOT=$<$<BOOL:${PUGIXML_TARGET}>:${CMAKE_BUNDLE_INSTALL_PREFIX}>
|
||||
-DBIN_DIR=${BIN_DIR}
|
||||
-DLIB_DIR=${LIB_DIR}
|
||||
-DBUILD_STATIC_LIBS=${BUILD_STATIC_LIBS}
|
||||
-DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
|
||||
-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
|
||||
-DCMAKE_INSTALL_PREFIX=${CMAKE_BUNDLE_INSTALL_PREFIX}
|
||||
-DCMAKE_INSTALL_RPATH=${CMAKE_BUNDLE_INSTALL_PREFIX}/${LIB_DIR}
|
||||
-DCMAKE_INSTALL_LIBDIR:PATH=${LIB_DIR}
|
||||
-DASSIMP_BUILD_USE_CCACHE=OFF
|
||||
-DASSIMP_BUILD_ASSIMP_TOOLS=OFF
|
||||
-DASSIMP_BUILD_TESTS=OFF
|
||||
-DASSIMP_BUILD_MINIZIP=ON
|
||||
-DASSIMP_BUILD_ZLIB=OFF
|
||||
-DASSIMP_INJECT_DEBUG_POSTFIX=OFF
|
||||
-DASSIMP_INSTALL_PDB=OFF
|
||||
DEPENDS ${ASSETIMPORT_DEPS}
|
||||
LOG_CONFIGURE ${EXT_BUILD_QUIET}
|
||||
LOG_BUILD ${EXT_BUILD_QUIET}
|
||||
LOG_INSTALL ${EXT_BUILD_QUIET}
|
||||
LOG_OUTPUT_ON_FAILURE ${EXT_BUILD_QUIET}
|
||||
STEP_TARGETS install
|
||||
)
|
||||
|
||||
TargetInstallDeps(ASSETIMPORT ASSETIMPORT_DEPENDS)
|
||||
|
||||
# Copy the license into position in CMAKE_BUNDLE_INSTALL_PREFIX
|
||||
configure_file(
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/assimp/LICENSE
|
||||
${DOC_LICENSE_DIR}/assetimport.txt
|
||||
COPYONLY
|
||||
)
|
||||
|
||||
endif (ENABLE_ASSETIMPORT)
|
||||
|
||||
# Local Variables:
|
||||
# tab-width: 8
|
||||
# mode: cmake
|
||||
# indent-tabs-mode: t
|
||||
# End:
|
||||
# ex: shiftwidth=2 tabstop=8
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
PATCH
|
||||
PUGIXML
|
||||
ZLIB
|
||||
|
||||
@@ -0,0 +1,98 @@
|
||||
--- assimp/CMakeLists.txt 2025-07-22 16:48:44.626337172 -0400
|
||||
+++ ASSETIMPORT_BLD/CMakeLists.txt 2025-07-22 16:28:32.943270150 -0400
|
||||
@@ -37,6 +37,7 @@
|
||||
SET(CMAKE_POLICY_DEFAULT_CMP0012 NEW)
|
||||
SET(CMAKE_POLICY_DEFAULT_CMP0074 NEW)
|
||||
SET(CMAKE_POLICY_DEFAULT_CMP0092 NEW)
|
||||
+SET(CMAKE_POLICY_DEFAULT_CMP0144 NEW)
|
||||
|
||||
CMAKE_MINIMUM_REQUIRED( VERSION 3.22 )
|
||||
|
||||
--- assimp/cmake-modules/assimp-plain-config.cmake.in 2025-07-22 16:48:43.776340530 -0400
|
||||
+++ ASSETIMPORT_BLD/cmake-modules/assimp-plain-config.cmake.in 2025-07-22 16:28:33.458267904 -0400
|
||||
@@ -1,5 +1,7 @@
|
||||
@PACKAGE_INIT@
|
||||
|
||||
+find_package(ZLIB MODULE REQUIRED)
|
||||
+
|
||||
include("${CMAKE_CURRENT_LIST_DIR}/@TARGETS_EXPORT_NAME@.cmake")
|
||||
|
||||
set(ASSIMP_ROOT_DIR ${PACKAGE_PREFIX_DIR})
|
||||
diff -Naur assimp/code/CMakeLists.txt ASSETIMPORT_BLD/code/CMakeLists.txt
|
||||
--- assimp/code/CMakeLists.txt 2026-02-04 16:56:22.592686074 -0500
|
||||
+++ ASSETIMPORT_BLD/code/CMakeLists.txt 2026-02-04 16:55:19.040925630 -0500
|
||||
@@ -1113,18 +1113,19 @@
|
||||
ENDIF() # IF (ASSIMP_BUILD_USD_IMPORTER)
|
||||
|
||||
# pugixml
|
||||
-IF(ASSIMP_HUNTER_ENABLED)
|
||||
- hunter_add_package(pugixml)
|
||||
- find_package(pugixml CONFIG REQUIRED)
|
||||
-ELSEIF(NOT TARGET pugixml::pugixml)
|
||||
- SET( Pugixml_SRCS
|
||||
- ../contrib/pugixml/src/pugiconfig.hpp
|
||||
- ../contrib/pugixml/src/pugixml.cpp
|
||||
- ../contrib/pugixml/src/pugixml.hpp
|
||||
- )
|
||||
- INCLUDE_DIRECTORIES("../contrib/pugixml/src")
|
||||
- SOURCE_GROUP( Contrib\\Pugixml FILES ${Pugixml_SRCS})
|
||||
-ENDIF()
|
||||
+#IF(ASSIMP_HUNTER_ENABLED)
|
||||
+# hunter_add_package(pugixml)
|
||||
+# find_package(pugixml CONFIG REQUIRED)
|
||||
+#ELSEIF(NOT TARGET pugixml::pugixml)
|
||||
+# SET( Pugixml_SRCS
|
||||
+# ../contrib/pugixml/src/pugiconfig.hpp
|
||||
+# ../contrib/pugixml/src/pugixml.cpp
|
||||
+# ../contrib/pugixml/src/pugixml.hpp
|
||||
+# )
|
||||
+# INCLUDE_DIRECTORIES("../contrib/pugixml/src")
|
||||
+# SOURCE_GROUP( Contrib\\Pugixml FILES ${Pugixml_SRCS})
|
||||
+#ENDIF()
|
||||
+find_package(pugixml REQUIRED)
|
||||
|
||||
# utf8
|
||||
IF(ASSIMP_HUNTER_ENABLED)
|
||||
@@ -1414,6 +1415,10 @@
|
||||
$<INSTALL_INTERFACE:${ASSIMP_INCLUDE_INSTALL_DIR}>
|
||||
)
|
||||
|
||||
+if (TARGET pugixml)
|
||||
+ set(PUGIXML_LIBRARIES pugixml)
|
||||
+endif (TARGET pugixml)
|
||||
+
|
||||
IF(ASSIMP_HUNTER_ENABLED)
|
||||
TARGET_LINK_LIBRARIES(assimp
|
||||
PUBLIC
|
||||
@@ -1435,7 +1440,8 @@
|
||||
target_link_libraries(assimp PRIVATE ${draco_LIBRARIES})
|
||||
endif()
|
||||
ELSE()
|
||||
- TARGET_LINK_LIBRARIES(assimp ${ZLIB_LIBRARIES} ${OPENDDL_PARSER_LIBRARIES})
|
||||
+ find_package(ZLIB MODULE REQUIRED)
|
||||
+ TARGET_LINK_LIBRARIES(assimp ZLIB::ZLIB ${PUGIXML_LIBRARIES} ${OPENDDL_PARSER_LIBRARIES})
|
||||
if (ASSIMP_BUILD_DRACO)
|
||||
target_link_libraries(assimp ${draco_LIBRARIES})
|
||||
endif()
|
||||
@@ -1453,6 +1459,7 @@
|
||||
TARGET_LINK_LIBRARIES(assimp ${C4D_EXTRA_LIBRARIES})
|
||||
ENDIF ()
|
||||
|
||||
+if(0)
|
||||
if( MSVC )
|
||||
# in order to prevent DLL hell, each of the DLLs have to be suffixed with the major version and msvc prefix
|
||||
# CMake 3.12 added a variable for this
|
||||
@@ -1499,11 +1506,12 @@
|
||||
target_compile_definitions(assimp PUBLIC WindowsStore)
|
||||
TARGET_LINK_LIBRARIES(assimp advapi32)
|
||||
endif()
|
||||
+endif(0)
|
||||
|
||||
SET_TARGET_PROPERTIES( assimp PROPERTIES
|
||||
VERSION ${ASSIMP_VERSION}
|
||||
SOVERSION ${ASSIMP_SOVERSION} # use full version
|
||||
- OUTPUT_NAME assimp${LIBRARY_SUFFIX}
|
||||
+ #OUTPUT_NAME assimp${LIBRARY_SUFFIX}
|
||||
)
|
||||
|
||||
if (APPLE)
|
||||
@@ -0,0 +1,12 @@
|
||||
diff -Naur assimp/contrib/stb/stb_image.h ASSETIMPORT_BLD/contrib/stb/stb_image.h
|
||||
--- assimp/contrib/stb/stb_image.h 2026-02-05 14:22:20.343920277 -0500
|
||||
+++ ASSETIMPORT_BLD/contrib/stb/stb_image.h 2026-02-05 14:24:43.112400148 -0500
|
||||
@@ -5079,7 +5079,7 @@
|
||||
{
|
||||
stbi_uc palette[1024], pal_img_n=0;
|
||||
stbi_uc has_trans=0, tc[3]={0};
|
||||
- stbi__uint16 tc16[3];
|
||||
+ stbi__uint16 tc16[3]={0};
|
||||
stbi__uint32 ioff=0, idata_limit=0, i, pal_len=0;
|
||||
int first=1,k,interlace=0, color=0, is_iphone=0;
|
||||
stbi__context *s = z->s;
|
||||
Submodule
+1
Submodule assetimport/assimp added at cfc14a26d2
@@ -0,0 +1,55 @@
|
||||
# Astyle is not bundled with BRL-CAD - it is a source code formatting tool,
|
||||
# optionally used during compilation to validate our style guidelines.
|
||||
bext_enable_all_default(ASTYLE astyle)
|
||||
|
||||
if (NOT ENABLE_ASTYLE)
|
||||
|
||||
find_program(ASTYLE_EXECUTABLE astyle)
|
||||
mark_as_advanced(ASTYLE_EXECUTABLE)
|
||||
|
||||
if (NOT ASTYLE_EXECUTABLE AND NOT DEFINED ENABLE_ASTYLE)
|
||||
set(ENABLE_ASTYLE "ON" CACHE BOOL "Enable astyle build")
|
||||
endif (NOT ASTYLE_EXECUTABLE AND NOT DEFINED ENABLE_ASTYLE)
|
||||
|
||||
endif (NOT ENABLE_ASTYLE)
|
||||
set(ENABLE_ASTYLE "${ENABLE_ASTYLE}" CACHE BOOL "Enable astyle build")
|
||||
|
||||
if (ENABLE_ASTYLE)
|
||||
|
||||
git_submodule_init(astyle CMakeLists.txt)
|
||||
|
||||
RegisterDeps(ASTYLE)
|
||||
|
||||
ExternalProject_Add(ASTYLE_BLD
|
||||
URL "${CMAKE_CURRENT_SOURCE_DIR}/astyle"
|
||||
BUILD_ALWAYS ${EXT_BUILD_ALWAYS} ${LOG_OPTS}
|
||||
PATCH_COMMAND ${PATCH_EXECUTABLE};-E;-p1;${PATCH_OPTIONS};-i;${CMAKE_CURRENT_SOURCE_DIR}/astyle.patch
|
||||
CMAKE_ARGS
|
||||
${BUILD_TYPE_SPECIFIER}
|
||||
-DBIN_DIR=${BIN_DIR}
|
||||
-DLIB_DIR=${LIB_DIR}
|
||||
-DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
|
||||
-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
|
||||
-DCMAKE_INSTALL_PREFIX=${CMAKE_NOBUNDLE_INSTALL_PREFIX}
|
||||
-DCMAKE_INSTALL_LIBDIR:PATH=${LIB_DIR}
|
||||
-DCMAKE_INSTALL_RPATH=${CMAKE_NOBUNDLE_INSTALL_PREFIX}/${LIB_DIR}
|
||||
-DBUILD_SHARED_LIBS=OFF
|
||||
-DBUILD_STATIC_LIBS=OFF
|
||||
-DBUILD_JAVA_LIBS=OFF
|
||||
LOG_CONFIGURE ${EXT_BUILD_QUIET}
|
||||
LOG_BUILD ${EXT_BUILD_QUIET}
|
||||
LOG_INSTALL ${EXT_BUILD_QUIET}
|
||||
LOG_OUTPUT_ON_FAILURE ${EXT_BUILD_QUIET}
|
||||
STEP_TARGETS install
|
||||
)
|
||||
|
||||
TargetInstallDeps(ASTYLE ASTYLE_DEPENDS)
|
||||
|
||||
endif (ENABLE_ASTYLE)
|
||||
|
||||
# Local Variables:
|
||||
# tab-width: 8
|
||||
# mode: cmake
|
||||
# indent-tabs-mode: t
|
||||
# End:
|
||||
# ex: shiftwidth=2 tabstop=8
|
||||
Submodule
+1
Submodule astyle/astyle added at 848edc8206
@@ -0,0 +1,2 @@
|
||||
PATCH
|
||||
|
||||
@@ -0,0 +1,173 @@
|
||||
diff -Naur astyle/CMakeLists.txt ASTYLE_BLD/CMakeLists.txt
|
||||
--- astyle/CMakeLists.txt 2026-09-09 09:23:57.197122193 -0400
|
||||
+++ ASTYLE_BLD/CMakeLists.txt 2026-09-09 09:17:33.423173910 -0400
|
||||
@@ -17,6 +17,8 @@
|
||||
endif()
|
||||
|
||||
set(CMAKE_CXX_STANDARD 17)
|
||||
+set(CMAKE_CXX_EXTENSIONS OFF)
|
||||
+set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
|
||||
# Linux Soname Version
|
||||
set(MAJORVER 3)
|
||||
@@ -72,151 +74,13 @@
|
||||
target_compile_options(astyle PRIVATE /utf-8)
|
||||
endif()
|
||||
|
||||
-# Set build-specific compile options
|
||||
-if(BUILD_SHARED_LIBS OR BUILD_STATIC_LIBS)
|
||||
- if(BUILD_JAVA_LIBS)
|
||||
- find_package(JNI)
|
||||
- if (NOT JNI_FOUND)
|
||||
- set(err_jni "Use '-DJAVA_HOME=<JNI Directory>' to define the Java path")
|
||||
- message(FATAL_ERROR ${err_jni})
|
||||
- endif()
|
||||
- target_compile_options(astyle PRIVATE -DASTYLE_JNI)
|
||||
- target_include_directories(astyle PRIVATE ${JNI_INCLUDE_DIRS})
|
||||
- else()
|
||||
- target_compile_options(astyle PRIVATE -DASTYLE_LIB)
|
||||
- endif()
|
||||
- # Windows DLL exports removed
|
||||
- set_property(TARGET astyle PROPERTY DEFINE_SYMBOL "")
|
||||
- # Linux solib version added
|
||||
- set_property(TARGET astyle PROPERTY VERSION ${SOLIBVER})
|
||||
- set_property(TARGET astyle PROPERTY SOVERSION ${MAJORVER})
|
||||
-endif()
|
||||
-
|
||||
-
|
||||
-# Linker options:
|
||||
-
|
||||
-# Strip release builds
|
||||
-if(CMAKE_BUILD_TYPE STREQUAL "Release" OR CMAKE_BUILD_TYPE STREQUAL "MinSizeRel")
|
||||
- if(NOT BUILD_STATIC_LIBS AND NOT BORLAND AND NOT MSVC)
|
||||
- add_custom_command(TARGET astyle POST_BUILD
|
||||
- COMMAND ${CMAKE_STRIP} $<TARGET_FILE_NAME:astyle>)
|
||||
- endif()
|
||||
-endif()
|
||||
-# Shared library options
|
||||
-if(BUILD_SHARED_LIBS)
|
||||
- set(CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS "") # remove -rdynamic
|
||||
- if(${CMAKE_CXX_COMPILER_ID} STREQUAL "Intel")
|
||||
- # need static linking because cannot find the intel libraries at runtime
|
||||
- set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -static-intel")
|
||||
- elseif(MINGW)
|
||||
- # minGW dlls don't work
|
||||
- # tdm-gcc dlls work with everything except python
|
||||
- set(CMAKE_SHARED_LINKER_FLAGS
|
||||
- "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--add-stdcall-alias -Wl,--dll")
|
||||
- elseif(BORLAND)
|
||||
- # use a development environment to compile Borland dlls
|
||||
- endif()
|
||||
-endif()
|
||||
-
|
||||
-
|
||||
-# Installation options:
|
||||
-
|
||||
-# Define install directories
|
||||
-# To uninstall 'xargs rm < install_manifest.txt'
|
||||
-# Default linux install prefix is /usr/local"
|
||||
-# This may be modified by -DCMAKE_INSTALL_PREFIX=
|
||||
-# Default Win32 install prefix is not used (C:/Program Files (x86))
|
||||
-
|
||||
-option(INSTALL_DOC ON)
|
||||
-
|
||||
-if(BUILD_SHARED_LIBS OR BUILD_STATIC_LIBS)
|
||||
- if(NOT WIN32)
|
||||
- install(TARGETS astyle DESTINATION lib)
|
||||
- endif()
|
||||
-else()
|
||||
- if(SKBUILD)
|
||||
- install(TARGETS astyle DESTINATION "${SKBUILD_SCRIPTS_DIR}")
|
||||
- if(INSTALL_DOC)
|
||||
- install(FILES ${DOCS} DESTINATION "${SKBUILD_DATA_DIR}/share/doc/astyle/html")
|
||||
- install(FILES ${MAN} DESTINATION "${SKBUILD_DATA_DIR}/share/man/man1")
|
||||
- endif()
|
||||
- elseif(WIN32)
|
||||
- set(pf86 "PROGRAMFILES(x86)")
|
||||
- set(prog_files $ENV{${pf86}})
|
||||
- if(NOT ${prog_files})
|
||||
- set(prog_files $ENV{PROGRAMFILES})
|
||||
- endif()
|
||||
- install(TARGETS astyle DESTINATION "${prog_files}/AStyle")
|
||||
- install(FILES ${DOCS} DESTINATION "${prog_files}/AStyle/doc")
|
||||
- elseif(APPLE)
|
||||
- # install to the default /usr/local/bin because of SIP restrictions
|
||||
- install(TARGETS astyle DESTINATION "${CMAKE_INSTALL_PREFIX}/bin")
|
||||
- if(INSTALL_DOC)
|
||||
- install(FILES ${DOCS} DESTINATION "${CMAKE_INSTALL_PREFIX}/share/doc/astyle/html")
|
||||
- endif()
|
||||
- else()
|
||||
- # change default to /usr/bin, the same as package installs
|
||||
- if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
|
||||
- set(CMAKE_INSTALL_PREFIX "/usr")
|
||||
- endif()
|
||||
- install(TARGETS astyle DESTINATION "${CMAKE_INSTALL_PREFIX}/bin")
|
||||
- if(INSTALL_DOC)
|
||||
- install(FILES ${DOCS} DESTINATION "${CMAKE_INSTALL_PREFIX}/share/doc/astyle/html")
|
||||
- install(FILES ${MAN} DESTINATION "${CMAKE_INSTALL_PREFIX}/share/man/man1")
|
||||
- endif()
|
||||
- endif()
|
||||
-endif()
|
||||
-
|
||||
-
|
||||
-# output files:
|
||||
+install(TARGETS astyle
|
||||
+ LIBRARY DESTINATION lib
|
||||
+ ARCHIVE DESTINATION lib
|
||||
+ RUNTIME DESTINATION bin
|
||||
+ )
|
||||
+install(FILES ${DOCS} DESTINATION share/doc/astyle/html)
|
||||
+if (MAN)
|
||||
+ INSTALL(FILES ${MAN} DESTINATION man/man1)
|
||||
+endif (MAN)
|
||||
|
||||
-# Set output file names if different than 'astyle'
|
||||
-if(BUILD_JAVA_LIBS)
|
||||
- if(WIN32)
|
||||
- set_property(TARGET astyle PROPERTY OUTPUT_NAME AStyle32j)
|
||||
- set_property(TARGET astyle PROPERTY PREFIX "")
|
||||
- else()
|
||||
- set_property(TARGET astyle PROPERTY OUTPUT_NAME astylej)
|
||||
- endif()
|
||||
-elseif(BUILD_SHARED_LIBS)
|
||||
- if(WIN32)
|
||||
- set_property(TARGET astyle PROPERTY OUTPUT_NAME AStyle32)
|
||||
- set_property(TARGET astyle PROPERTY PREFIX "")
|
||||
- endif()
|
||||
-elseif(BUILD_STATIC_LIBS)
|
||||
- if(WIN32)
|
||||
- set_property(TARGET astyle PROPERTY OUTPUT_NAME AStyleLib)
|
||||
- set_property(TARGET astyle PROPERTY PREFIX "")
|
||||
- endif()
|
||||
-else()
|
||||
- if(WIN32)
|
||||
- set_property(TARGET astyle PROPERTY OUTPUT_NAME AStyle)
|
||||
- endif()
|
||||
-endif()
|
||||
-
|
||||
-
|
||||
-# print info:
|
||||
-
|
||||
-if(BUILD_JAVA_LIBS)
|
||||
- SET(ASTYLE_BUILD_TYPE "Java Shared Library")
|
||||
-elseif(BUILD_SHARED_LIBS)
|
||||
- SET(ASTYLE_BUILD_TYPE "Shared Library")
|
||||
-elseif(BUILD_STATIC_LIBS)
|
||||
- SET(ASTYLE_BUILD_TYPE "Static Library")
|
||||
-else()
|
||||
- SET(ASTYLE_BUILD_TYPE "Executable")
|
||||
-endif()
|
||||
-
|
||||
-# Display build information
|
||||
-
|
||||
-message( STATUS "---------- General Configuration ----------" )
|
||||
-message( STATUS )
|
||||
-message( STATUS "CMake Generator: ${CMAKE_GENERATOR}" )
|
||||
-message( STATUS "CMake Compiler: ${CMAKE_CXX_COMPILER_ID}" )
|
||||
-message( STATUS "AStyle Build: ${ASTYLE_BUILD_TYPE}" )
|
||||
-message( STATUS "AStyle Configuration: ${CMAKE_BUILD_TYPE}" )
|
||||
-if( BUILD_JAVA_LIBS )
|
||||
- message( STATUS "Java Include Path: ${JAVA_INCLUDE_PATH}" )
|
||||
-endif()
|
||||
-message( STATUS )
|
||||
-message( STATUS "-------------------------------------------" )
|
||||
@@ -0,0 +1,61 @@
|
||||
|
||||
bext_enable(Boost)
|
||||
|
||||
if (ENABLE_BOOST)
|
||||
|
||||
git_submodule_init(boost CMakeLists.txt)
|
||||
|
||||
RegisterDeps(BOOST)
|
||||
|
||||
if (TARGET ZLIB_BLD)
|
||||
set(Z_PREFIX_STR "brl_")
|
||||
endif (TARGET ZLIB_BLD)
|
||||
|
||||
|
||||
ExternalProject_Add(BOOST_BLD
|
||||
URL "${CMAKE_CURRENT_SOURCE_DIR}/boost"
|
||||
BUILD_ALWAYS ${EXT_BUILD_ALWAYS} ${LOG_OPTS}
|
||||
PATCH_COMMAND ${PATCH_EXECUTABLE};-E;-p1;${PATCH_OPTIONS};-i;${CMAKE_CURRENT_SOURCE_DIR}/boost_cmake.patch
|
||||
COMMAND ${CMAKE_COMMAND};-E;copy;${PROJECT_SOURCE_DIR}/CMake/FindZLIB.cmake;<SOURCE_DIR>/libs/iostreams/cmake/FindZLIB.cmake
|
||||
COMMAND ${CMAKE_COMMAND};-E;copy;${PROJECT_SOURCE_DIR}/boost/FindICU.cmake;<SOURCE_DIR>/libs/locale/cmake/FindICU.cmake
|
||||
CMAKE_ARGS
|
||||
${BUILD_TYPE_SPECIFIER}
|
||||
$<$<BOOL:${ZLIB_TARGET}>:-DZ_PREFIX=ON>
|
||||
$<$<BOOL:${ZLIB_TARGET}>:-DZ_PREFIX_STR=${Z_PREFIX_STR}>
|
||||
-DZLIB_ROOT=$<$<BOOL:${ZLIB_TARGET}>:${CMAKE_BUNDLE_INSTALL_PREFIX}>
|
||||
-DICU_ROOT=$<$<BOOL:${ICU_TARGET}>:${CMAKE_BUNDLE_INSTALL_PREFIX}>
|
||||
-DZSTD_ROOT=$<$<BOOL:${ZSTD_TARGET}>:${CMAKE_BUNDLE_INSTALL_PREFIX}>
|
||||
-DBOOST_IOSTREAMS_ENABLE_BZIP2=OFF
|
||||
-DBOOST_IOSTREAMS_ENABLE_LZMA=OFF
|
||||
-DBIN_DIR=${BIN_DIR}
|
||||
-DLIB_DIR=${LIB_DIR}
|
||||
-DBUILD_SHARED_LIBS=ON
|
||||
-DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
|
||||
-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
|
||||
-DCMAKE_INSTALL_PREFIX=${CMAKE_BUNDLE_INSTALL_PREFIX}
|
||||
-DCMAKE_INSTALL_RPATH=${CMAKE_BUNDLE_INSTALL_PREFIX}/${LIB_DIR}
|
||||
-DCMAKE_INSTALL_LIBDIR:PATH=${LIB_DIR}
|
||||
LOG_CONFIGURE ${EXT_BUILD_QUIET}
|
||||
LOG_BUILD ${EXT_BUILD_QUIET}
|
||||
LOG_INSTALL ${EXT_BUILD_QUIET}
|
||||
LOG_OUTPUT_ON_FAILURE ${EXT_BUILD_QUIET}
|
||||
STEP_TARGETS install
|
||||
)
|
||||
|
||||
TargetInstallDeps(BOOST BOOST_DEPENDS)
|
||||
|
||||
# Copy the license into position in CMAKE_BUNDLE_INSTALL_PREFIX
|
||||
configure_file(
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/boost/LICENSE_1_0.txt
|
||||
${DOC_LICENSE_DIR}/boost.txt
|
||||
COPYONLY
|
||||
)
|
||||
|
||||
endif (ENABLE_BOOST)
|
||||
|
||||
# Local Variables:
|
||||
# tab-width: 8
|
||||
# mode: cmake
|
||||
# indent-tabs-mode: t
|
||||
# End:
|
||||
# ex: shiftwidth=2 tabstop=8
|
||||
@@ -0,0 +1,437 @@
|
||||
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
||||
# file Copyright.txt or https://cmake.org/licensing for details.
|
||||
|
||||
#[=======================================================================[.rst:
|
||||
FindICU
|
||||
-------
|
||||
|
||||
.. versionadded:: 3.7
|
||||
|
||||
Find the International Components for Unicode (ICU) libraries and
|
||||
programs.
|
||||
|
||||
This module supports multiple components.
|
||||
Components can include any of: ``data``, ``i18n``, ``io``, ``le``,
|
||||
``lx``, ``test``, ``tu`` and ``uc``.
|
||||
|
||||
Note that on Windows ``data`` is named ``dt`` and ``i18n`` is named
|
||||
``in``; any of the names may be used, and the appropriate
|
||||
platform-specific library name will be automatically selected.
|
||||
|
||||
.. versionadded:: 3.11
|
||||
Added support for static libraries on Windows.
|
||||
|
||||
This module reports information about the ICU installation in
|
||||
several variables. General variables::
|
||||
|
||||
ICU_VERSION - ICU release version
|
||||
ICU_FOUND - true if the main programs and libraries were found
|
||||
ICU_LIBRARIES - component libraries to be linked
|
||||
ICU_INCLUDE_DIRS - the directories containing the ICU headers
|
||||
|
||||
Imported targets::
|
||||
|
||||
ICU::<C>
|
||||
|
||||
Where ``<C>`` is the name of an ICU component, for example
|
||||
``ICU::i18n``; ``<C>`` is lower-case.
|
||||
|
||||
ICU programs are reported in::
|
||||
|
||||
ICU_GENCNVAL_EXECUTABLE - path to gencnval executable
|
||||
ICU_ICUINFO_EXECUTABLE - path to icuinfo executable
|
||||
ICU_GENBRK_EXECUTABLE - path to genbrk executable
|
||||
ICU_ICU-CONFIG_EXECUTABLE - path to icu-config executable
|
||||
ICU_GENRB_EXECUTABLE - path to genrb executable
|
||||
ICU_GENDICT_EXECUTABLE - path to gendict executable
|
||||
ICU_DERB_EXECUTABLE - path to derb executable
|
||||
ICU_PKGDATA_EXECUTABLE - path to pkgdata executable
|
||||
ICU_UCONV_EXECUTABLE - path to uconv executable
|
||||
ICU_GENCFU_EXECUTABLE - path to gencfu executable
|
||||
ICU_MAKECONV_EXECUTABLE - path to makeconv executable
|
||||
ICU_GENNORM2_EXECUTABLE - path to gennorm2 executable
|
||||
ICU_GENCCODE_EXECUTABLE - path to genccode executable
|
||||
ICU_GENSPREP_EXECUTABLE - path to gensprep executable
|
||||
ICU_ICUPKG_EXECUTABLE - path to icupkg executable
|
||||
ICU_GENCMN_EXECUTABLE - path to gencmn executable
|
||||
|
||||
ICU component libraries are reported in::
|
||||
|
||||
ICU_<C>_FOUND - ON if component was found; ``<C>`` is upper-case.
|
||||
ICU_<C>_LIBRARIES - libraries for component; ``<C>`` is upper-case.
|
||||
|
||||
ICU datafiles are reported in::
|
||||
|
||||
ICU_MAKEFILE_INC - Makefile.inc
|
||||
ICU_PKGDATA_INC - pkgdata.inc
|
||||
|
||||
This module reads hints about search results from::
|
||||
|
||||
ICU_ROOT - the root of the ICU installation
|
||||
|
||||
The environment variable ``ICU_ROOT`` may also be used; the
|
||||
ICU_ROOT variable takes precedence.
|
||||
|
||||
The following cache variables may also be set::
|
||||
|
||||
ICU_<P>_EXECUTABLE - the path to executable <P>; ``<P>`` is upper-case.
|
||||
ICU_INCLUDE_DIR - the directory containing the ICU headers
|
||||
ICU_<C>_LIBRARY - the library for component <C>; ``<C>`` is upper-case.
|
||||
|
||||
.. note::
|
||||
|
||||
In most cases none of the above variables will require setting,
|
||||
unless multiple ICU versions are available and a specific version
|
||||
is required.
|
||||
|
||||
Other variables one may set to control this module are::
|
||||
|
||||
ICU_DEBUG - Set to ON to enable debug output from FindICU.
|
||||
#]=======================================================================]
|
||||
|
||||
# Written by Roger Leigh <rleigh@codelibre.net>
|
||||
|
||||
set(icu_programs
|
||||
gencnval
|
||||
icuinfo
|
||||
genbrk
|
||||
icu-config
|
||||
genrb
|
||||
gendict
|
||||
derb
|
||||
pkgdata
|
||||
uconv
|
||||
gencfu
|
||||
makeconv
|
||||
gennorm2
|
||||
genccode
|
||||
gensprep
|
||||
icupkg
|
||||
gencmn)
|
||||
|
||||
set(icu_data
|
||||
Makefile.inc
|
||||
pkgdata.inc)
|
||||
|
||||
# The ICU checks are contained in a function due to the large number
|
||||
# of temporary variables needed.
|
||||
function(_ICU_FIND)
|
||||
# Set up search paths, taking compiler into account. Search ICU_ROOT,
|
||||
# with ICU_ROOT in the environment as a fallback if unset.
|
||||
if(ICU_ROOT)
|
||||
list(APPEND icu_roots "${ICU_ROOT}")
|
||||
else()
|
||||
if(NOT "$ENV{ICU_ROOT}" STREQUAL "")
|
||||
file(TO_CMAKE_PATH "$ENV{ICU_ROOT}" NATIVE_PATH)
|
||||
list(APPEND icu_roots "${NATIVE_PATH}")
|
||||
set(ICU_ROOT "${NATIVE_PATH}"
|
||||
CACHE PATH "Location of the ICU installation" FORCE)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Find include directory
|
||||
list(APPEND icu_include_suffixes "include")
|
||||
find_path(ICU_INCLUDE_DIR
|
||||
NAMES "unicode/utypes.h"
|
||||
HINTS ${icu_roots}
|
||||
PATH_SUFFIXES ${icu_include_suffixes}
|
||||
DOC "ICU include directory")
|
||||
set(ICU_INCLUDE_DIR "${ICU_INCLUDE_DIR}" PARENT_SCOPE)
|
||||
|
||||
# Get version
|
||||
if(ICU_INCLUDE_DIR AND EXISTS "${ICU_INCLUDE_DIR}/unicode/uvernum.h")
|
||||
file(STRINGS "${ICU_INCLUDE_DIR}/unicode/uvernum.h" icu_header_str
|
||||
REGEX "^#define[\t ]+U_ICU_VERSION[\t ]+\".*\".*")
|
||||
|
||||
string(REGEX REPLACE "^#define[\t ]+U_ICU_VERSION[\t ]+\"([^ \\n]*)\".*"
|
||||
"\\1" icu_version_string "${icu_header_str}")
|
||||
set(ICU_VERSION "${icu_version_string}")
|
||||
set(ICU_VERSION "${icu_version_string}" PARENT_SCOPE)
|
||||
unset(icu_header_str)
|
||||
unset(icu_version_string)
|
||||
endif()
|
||||
|
||||
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||
# 64-bit binary directory
|
||||
set(_bin64 "bin64")
|
||||
# 64-bit library directory
|
||||
set(_lib64 "lib64")
|
||||
endif()
|
||||
|
||||
|
||||
# Find all ICU programs
|
||||
list(APPEND icu_binary_suffixes "${_bin64}" "bin" "sbin")
|
||||
foreach(program ${icu_programs})
|
||||
string(TOUPPER "${program}" program_upcase)
|
||||
set(cache_var "ICU_${program_upcase}_EXECUTABLE")
|
||||
set(program_var "ICU_${program_upcase}_EXECUTABLE")
|
||||
find_program("${cache_var}"
|
||||
NAMES "${program}"
|
||||
HINTS ${icu_roots}
|
||||
PATH_SUFFIXES ${icu_binary_suffixes}
|
||||
DOC "ICU ${program} executable"
|
||||
NO_PACKAGE_ROOT_PATH
|
||||
)
|
||||
mark_as_advanced("${cache_var}")
|
||||
set("${program_var}" "${${cache_var}}" PARENT_SCOPE)
|
||||
endforeach()
|
||||
|
||||
# Find all ICU libraries
|
||||
list(APPEND icu_library_suffixes "${_lib64}" "lib")
|
||||
set(ICU_REQUIRED_LIBS_FOUND ON)
|
||||
set(static_prefix )
|
||||
# static icu libraries compiled with MSVC have the prefix 's'
|
||||
if(MSVC)
|
||||
set(static_prefix "s")
|
||||
endif()
|
||||
foreach(component ${ICU_FIND_COMPONENTS})
|
||||
string(TOUPPER "${component}" component_upcase)
|
||||
set(component_cache "ICU_${component_upcase}_LIBRARY")
|
||||
set(component_cache_release "${component_cache}_RELEASE")
|
||||
set(component_cache_debug "${component_cache}_DEBUG")
|
||||
set(component_found "ICU_${component_upcase}_FOUND")
|
||||
set(component_found_compat "${component_upcase}_FOUND")
|
||||
set(component_libnames "icu${component}")
|
||||
set(component_debug_libnames "icu${component}d")
|
||||
|
||||
# Special case deliberate library naming mismatches between Unix
|
||||
# and Windows builds
|
||||
unset(component_libnames)
|
||||
unset(component_debug_libnames)
|
||||
list(APPEND component_libnames "icu${component}")
|
||||
list(APPEND component_debug_libnames "icu${component}d")
|
||||
if(component STREQUAL "data")
|
||||
list(APPEND component_libnames "icudt")
|
||||
# Note there is no debug variant at present
|
||||
list(APPEND component_debug_libnames "icudtd")
|
||||
endif()
|
||||
if(component STREQUAL "dt")
|
||||
list(APPEND component_libnames "icudata")
|
||||
# Note there is no debug variant at present
|
||||
list(APPEND component_debug_libnames "icudatad")
|
||||
endif()
|
||||
if(component STREQUAL "i18n")
|
||||
list(APPEND component_libnames "icuin")
|
||||
list(APPEND component_debug_libnames "icuind")
|
||||
endif()
|
||||
if(component STREQUAL "in")
|
||||
list(APPEND component_libnames "icui18n")
|
||||
list(APPEND component_debug_libnames "icui18nd")
|
||||
endif()
|
||||
|
||||
if(static_prefix)
|
||||
unset(static_component_libnames)
|
||||
unset(static_component_debug_libnames)
|
||||
foreach(component_libname ${component_libnames})
|
||||
list(APPEND static_component_libnames
|
||||
${static_prefix}${component_libname})
|
||||
endforeach()
|
||||
foreach(component_libname ${component_debug_libnames})
|
||||
list(APPEND static_component_debug_libnames
|
||||
${static_prefix}${component_libname})
|
||||
endforeach()
|
||||
list(APPEND component_libnames ${static_component_libnames})
|
||||
list(APPEND component_debug_libnames ${static_component_debug_libnames})
|
||||
endif()
|
||||
find_library("${component_cache_release}"
|
||||
NAMES ${component_libnames}
|
||||
HINTS ${icu_roots}
|
||||
PATH_SUFFIXES ${icu_library_suffixes}
|
||||
DOC "ICU ${component} library (release)"
|
||||
NO_PACKAGE_ROOT_PATH
|
||||
)
|
||||
find_library("${component_cache_debug}"
|
||||
NAMES ${component_debug_libnames}
|
||||
HINTS ${icu_roots}
|
||||
PATH_SUFFIXES ${icu_library_suffixes}
|
||||
DOC "ICU ${component} library (debug)"
|
||||
NO_PACKAGE_ROOT_PATH
|
||||
)
|
||||
include(SelectLibraryConfigurations)
|
||||
select_library_configurations(ICU_${component_upcase})
|
||||
mark_as_advanced("${component_cache_release}" "${component_cache_debug}")
|
||||
if(${component_cache})
|
||||
set("${component_found}" ON)
|
||||
set("${component_found_compat}" ON)
|
||||
list(APPEND ICU_LIBRARY "${${component_cache}}")
|
||||
if (ICU_FIND_REQUIRED_${component})
|
||||
list(APPEND ICU_LIBS_FOUND "${component} (required): ${${component_cache}}")
|
||||
else()
|
||||
list(APPEND ICU_LIBS_FOUND "${component} (optional): ${${component_cache}}")
|
||||
endif()
|
||||
else()
|
||||
if (ICU_FIND_REQUIRED_${component})
|
||||
set(ICU_REQUIRED_LIBS_FOUND OFF)
|
||||
list(APPEND ICU_LIBS_NOTFOUND "${component} (required)")
|
||||
else()
|
||||
list(APPEND ICU_LIBS_NOTFOUND "${component} (optional)")
|
||||
endif()
|
||||
endif()
|
||||
mark_as_advanced("${component_found}")
|
||||
mark_as_advanced("${component_found_compat}")
|
||||
set("${component_cache}" "${${component_cache}}" PARENT_SCOPE)
|
||||
set("${component_found}" "${${component_found}}" PARENT_SCOPE)
|
||||
set("${component_found_compat}" "${${component_found_compat}}" PARENT_SCOPE)
|
||||
endforeach()
|
||||
set(_ICU_REQUIRED_LIBS_FOUND "${ICU_REQUIRED_LIBS_FOUND}" PARENT_SCOPE)
|
||||
set(ICU_LIBRARY "${ICU_LIBRARY}" PARENT_SCOPE)
|
||||
|
||||
# Find all ICU data files
|
||||
if(CMAKE_LIBRARY_ARCHITECTURE)
|
||||
list(APPEND icu_data_suffixes
|
||||
"${_lib64}/${CMAKE_LIBRARY_ARCHITECTURE}/icu/${ICU_VERSION}"
|
||||
"lib/${CMAKE_LIBRARY_ARCHITECTURE}/icu/${ICU_VERSION}"
|
||||
"${_lib64}/${CMAKE_LIBRARY_ARCHITECTURE}/icu"
|
||||
"lib/${CMAKE_LIBRARY_ARCHITECTURE}/icu")
|
||||
endif()
|
||||
list(APPEND icu_data_suffixes
|
||||
"${_lib64}/icu/${ICU_VERSION}"
|
||||
"lib/icu/${ICU_VERSION}"
|
||||
"${_lib64}/icu"
|
||||
"lib/icu")
|
||||
foreach(data ${icu_data})
|
||||
string(TOUPPER "${data}" data_upcase)
|
||||
string(REPLACE "." "_" data_upcase "${data_upcase}")
|
||||
set(cache_var "ICU_${data_upcase}")
|
||||
set(data_var "ICU_${data_upcase}")
|
||||
find_file("${cache_var}"
|
||||
NAMES "${data}"
|
||||
HINTS ${icu_roots}
|
||||
PATH_SUFFIXES ${icu_data_suffixes}
|
||||
DOC "ICU ${data} data file")
|
||||
mark_as_advanced("${cache_var}")
|
||||
set("${data_var}" "${${cache_var}}" PARENT_SCOPE)
|
||||
endforeach()
|
||||
|
||||
if(NOT ICU_FIND_QUIETLY)
|
||||
if(ICU_LIBS_FOUND)
|
||||
message(STATUS "Found the following ICU libraries:")
|
||||
foreach(found ${ICU_LIBS_FOUND})
|
||||
message(STATUS " ${found}")
|
||||
endforeach()
|
||||
endif()
|
||||
if(ICU_LIBS_NOTFOUND)
|
||||
message(STATUS "The following ICU libraries were not found:")
|
||||
foreach(notfound ${ICU_LIBS_NOTFOUND})
|
||||
message(STATUS " ${notfound}")
|
||||
endforeach()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(ICU_DEBUG)
|
||||
message(STATUS "--------FindICU.cmake search debug--------")
|
||||
message(STATUS "ICU binary path search order: ${icu_roots}")
|
||||
message(STATUS "ICU include path search order: ${icu_roots}")
|
||||
message(STATUS "ICU library path search order: ${icu_roots}")
|
||||
message(STATUS "----------------")
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
_ICU_FIND()
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(ICU
|
||||
FOUND_VAR ICU_FOUND
|
||||
REQUIRED_VARS ICU_INCLUDE_DIR
|
||||
ICU_LIBRARY
|
||||
_ICU_REQUIRED_LIBS_FOUND
|
||||
VERSION_VAR ICU_VERSION
|
||||
FAIL_MESSAGE "Failed to find all ICU components")
|
||||
|
||||
unset(_ICU_REQUIRED_LIBS_FOUND)
|
||||
|
||||
if(ICU_FOUND)
|
||||
set(ICU_INCLUDE_DIRS "${ICU_INCLUDE_DIR}")
|
||||
set(ICU_LIBRARIES "${ICU_LIBRARY}")
|
||||
foreach(_ICU_component ${ICU_FIND_COMPONENTS})
|
||||
string(TOUPPER "${_ICU_component}" _ICU_component_upcase)
|
||||
set(_ICU_component_cache "ICU_${_ICU_component_upcase}_LIBRARY")
|
||||
set(_ICU_component_cache_release "ICU_${_ICU_component_upcase}_LIBRARY_RELEASE")
|
||||
set(_ICU_component_cache_debug "ICU_${_ICU_component_upcase}_LIBRARY_DEBUG")
|
||||
set(_ICU_component_lib "ICU_${_ICU_component_upcase}_LIBRARIES")
|
||||
set(_ICU_component_found "ICU_${_ICU_component_upcase}_FOUND")
|
||||
set(_ICU_imported_target "ICU::${_ICU_component}")
|
||||
if(${_ICU_component_found})
|
||||
set("${_ICU_component_lib}" "${${_ICU_component_cache}}")
|
||||
if(NOT TARGET ${_ICU_imported_target})
|
||||
add_library(${_ICU_imported_target} UNKNOWN IMPORTED)
|
||||
if(ICU_INCLUDE_DIR)
|
||||
set_target_properties(${_ICU_imported_target} PROPERTIES
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${ICU_INCLUDE_DIR}")
|
||||
endif()
|
||||
if(EXISTS "${${_ICU_component_cache}}")
|
||||
set_target_properties(${_ICU_imported_target} PROPERTIES
|
||||
IMPORTED_LINK_INTERFACE_LANGUAGES "CXX"
|
||||
IMPORTED_LOCATION "${${_ICU_component_cache}}")
|
||||
endif()
|
||||
if(EXISTS "${${_ICU_component_cache_release}}")
|
||||
set_property(TARGET ${_ICU_imported_target} APPEND PROPERTY
|
||||
IMPORTED_CONFIGURATIONS RELEASE)
|
||||
set_target_properties(${_ICU_imported_target} PROPERTIES
|
||||
IMPORTED_LINK_INTERFACE_LANGUAGES_RELEASE "CXX"
|
||||
IMPORTED_LOCATION_RELEASE "${${_ICU_component_cache_release}}")
|
||||
endif()
|
||||
if(EXISTS "${${_ICU_component_cache_debug}}")
|
||||
set_property(TARGET ${_ICU_imported_target} APPEND PROPERTY
|
||||
IMPORTED_CONFIGURATIONS DEBUG)
|
||||
set_target_properties(${_ICU_imported_target} PROPERTIES
|
||||
IMPORTED_LINK_INTERFACE_LANGUAGES_DEBUG "CXX"
|
||||
IMPORTED_LOCATION_DEBUG "${${_ICU_component_cache_debug}}")
|
||||
endif()
|
||||
if(CMAKE_DL_LIBS AND _ICU_component STREQUAL "uc")
|
||||
set_target_properties(${_ICU_imported_target} PROPERTIES
|
||||
INTERFACE_LINK_LIBRARIES "${CMAKE_DL_LIBS}")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
unset(_ICU_component_upcase)
|
||||
unset(_ICU_component_cache)
|
||||
unset(_ICU_component_lib)
|
||||
unset(_ICU_component_found)
|
||||
unset(_ICU_imported_target)
|
||||
endforeach()
|
||||
endif()
|
||||
|
||||
if(ICU_DEBUG)
|
||||
message(STATUS "--------FindICU.cmake results debug--------")
|
||||
message(STATUS "ICU found: ${ICU_FOUND}")
|
||||
message(STATUS "ICU_VERSION number: ${ICU_VERSION}")
|
||||
message(STATUS "ICU_ROOT directory: ${ICU_ROOT}")
|
||||
message(STATUS "ICU_INCLUDE_DIR directory: ${ICU_INCLUDE_DIR}")
|
||||
message(STATUS "ICU_LIBRARIES: ${ICU_LIBRARIES}")
|
||||
|
||||
foreach(program IN LISTS icu_programs)
|
||||
string(TOUPPER "${program}" program_upcase)
|
||||
set(program_lib "ICU_${program_upcase}_EXECUTABLE")
|
||||
message(STATUS "${program} program: ${program_lib}=${${program_lib}}")
|
||||
unset(program_upcase)
|
||||
unset(program_lib)
|
||||
endforeach()
|
||||
|
||||
foreach(data IN LISTS icu_data)
|
||||
string(TOUPPER "${data}" data_upcase)
|
||||
string(REPLACE "." "_" data_upcase "${data_upcase}")
|
||||
set(data_lib "ICU_${data_upcase}")
|
||||
message(STATUS "${data} data: ${data_lib}=${${data_lib}}")
|
||||
unset(data_upcase)
|
||||
unset(data_lib)
|
||||
endforeach()
|
||||
|
||||
foreach(component IN LISTS ICU_FIND_COMPONENTS)
|
||||
string(TOUPPER "${component}" component_upcase)
|
||||
set(component_lib "ICU_${component_upcase}_LIBRARIES")
|
||||
set(component_found "ICU_${component_upcase}_FOUND")
|
||||
set(component_found_compat "${component_upcase}_FOUND")
|
||||
message(STATUS "${component} library found: ${component_found}=${${component_found}}")
|
||||
message(STATUS "${component} library found (compat name): ${component_found_compat}=${${component_found_compat}}")
|
||||
message(STATUS "${component} library: ${component_lib}=${${component_lib}}")
|
||||
unset(component_upcase)
|
||||
unset(component_lib)
|
||||
unset(component_found)
|
||||
unset(component_found_compat)
|
||||
endforeach()
|
||||
message(STATUS "----------------")
|
||||
endif()
|
||||
|
||||
unset(icu_programs)
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
The upstream boost repository we are using itself uses submodules (a LOT of
|
||||
them). For our fork to reference them, we'd also have to folk all (100+)
|
||||
submodules in the BRL-CAD project. In this case the main point is to have a
|
||||
CMake build of boost someone else is maintaining, so we need to work around the
|
||||
submodule issue.
|
||||
|
||||
In the BRL-CAD fork, the RELEASE branch we made has been modified to remove the
|
||||
submodules and instead check in a set of fully populated clones from the
|
||||
upstream boostorg/boost repository. The procedure was roughly:
|
||||
|
||||
Prepare the upstream repository:
|
||||
|
||||
git clone https://github.com/boostorg/boost.git
|
||||
mv boost boost_upstream
|
||||
cd boost_upstream
|
||||
git co boost-1.83.0
|
||||
git submodule update --init --recursive --depth=1
|
||||
For all the submodules (found by using "find . -name .git", excluding the top level .git folder)
|
||||
rm -rf <path_to_submodule>/.git
|
||||
cd ..
|
||||
|
||||
|
||||
Check out the BRL-CAD fork (referenced the procedure at
|
||||
https://gist.github.com/myusuf3/7f645819ded92bda6677 for part ofof this:)
|
||||
|
||||
git clone https://github.com/boostorg/boost.git
|
||||
cd boost
|
||||
git co boost-1.83.0
|
||||
git switch -c RELEASE
|
||||
git rm .gitmodules
|
||||
For all the submodules (found by using "find . -name .git", excluding the top level .git folder)
|
||||
git rm --cached <path_to_submodule>
|
||||
git commit -m "Remove submodules"
|
||||
cp -r ../boost_upstream/* .
|
||||
git add -A
|
||||
git commit -m "Populate repository with full copies of submodules"
|
||||
|
||||
For the next Boost release bump, in the release branch we'll merge the new tag,
|
||||
prepare another copy of boostorg/boost.git the same way we did above, remove the
|
||||
current files from the working copy of RELEASE (without committing), and copy in
|
||||
the new boostorg/boost contents. This will let us make a fully populated tree of
|
||||
the next release.
|
||||
|
||||
Once the upstream RELEASE branch is ready, we bump the submodule reference in this repository
|
||||
with:
|
||||
|
||||
git submodule update --remote boost (TODO - do we also need the --merge option here?)
|
||||
|
||||
Test the build. If everything works:
|
||||
|
||||
git add boost
|
||||
git commit -m "Update boost dependency to v<new version>"
|
||||
git push
|
||||
|
||||
Submodule
+1
Submodule boost/boost added at 2d59a4b188
@@ -0,0 +1,5 @@
|
||||
ICU
|
||||
PATCH
|
||||
ZLIB
|
||||
ZSTD
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
diff --git a/libs/iostreams/CMakeLists.txt b/libs/iostreams/CMakeLists.txt
|
||||
index 1d8352f5..11f8e584 100644
|
||||
--- a/libs/iostreams/CMakeLists.txt
|
||||
+++ b/libs/iostreams/CMakeLists.txt
|
||||
@@ -6,6 +6,8 @@ cmake_minimum_required(VERSION 3.5...3.16)
|
||||
|
||||
project(boost_iostreams VERSION "${BOOST_SUPERPROJECT_VERSION}" LANGUAGES CXX)
|
||||
|
||||
+list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
|
||||
+
|
||||
add_library(boost_iostreams
|
||||
src/file_descriptor.cpp
|
||||
src/mapped_file.cpp
|
||||
diff --git a/libs/locale/CMakeLists.txt b/libs/locale/CMakeLists.txt
|
||||
index f47ad394..21956d88 100644
|
||||
--- a/libs/locale/CMakeLists.txt
|
||||
+++ b/libs/locale/CMakeLists.txt
|
||||
@@ -6,6 +6,8 @@ cmake_minimum_required(VERSION 3.11...3.20)
|
||||
|
||||
project(boost_locale VERSION "${BOOST_SUPERPROJECT_VERSION}" LANGUAGES CXX)
|
||||
|
||||
+list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
|
||||
+
|
||||
# Using glob here is ok as it is only for headers
|
||||
file(GLOB_RECURSE headers include/*.hpp)
|
||||
|
||||
@@ -0,0 +1,78 @@
|
||||
# Decide if we're using Bullet
|
||||
cad_enable(BULLET "libged")
|
||||
|
||||
bext_enable(Bullet)
|
||||
|
||||
# Decision made, start processing if we are enabled
|
||||
|
||||
if (ENABLE_BULLET)
|
||||
|
||||
git_submodule_init(bullet3 CMakeLists.txt)
|
||||
|
||||
RegisterDeps(BULLET)
|
||||
|
||||
set(BULLET_CMAKE_ARGS
|
||||
${BUILD_TYPE_SPECIFIER}
|
||||
-DBIN_DIR=${BIN_DIR}
|
||||
-DLIB_DIR=${LIB_DIR}
|
||||
-DBUILD_STATIC_LIBS=${BUILD_STATIC_LIBS}
|
||||
-DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
|
||||
-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
|
||||
-DCMAKE_INSTALL_PREFIX=${CMAKE_BUNDLE_INSTALL_PREFIX}
|
||||
-DCMAKE_INSTALL_LIBDIR:PATH=${LIB_DIR}
|
||||
-DCMAKE_INSTALL_RPATH=${CMAKE_BUNDLE_INSTALL_PREFIX}/${LIB_DIR}
|
||||
-DINSTALL_LIBS=ON
|
||||
-DUSE_DOUBLE_PRECISION=ON
|
||||
-DUSE_GRAPHICAL_BENCHMARK=OFF
|
||||
-DBUILD_BULLET3=OFF
|
||||
-DBUILD_EXTRAS=OFF
|
||||
-DENABLE_VHACD=OFF
|
||||
-DBUILD_CPU_DEMOS=OFF
|
||||
-DUSE_GLUT=OFF
|
||||
-DBUILD_ENET=OFF
|
||||
-DBUILD_CLSOCKET=OFF
|
||||
-DBUILD_EGL=OFF
|
||||
-DBUILD_OPENGL3_DEMOS=OFF
|
||||
-DBUILD_BULLET2_DEMOS=OFF
|
||||
-DBUILD_UNIT_TESTS=OFF
|
||||
)
|
||||
|
||||
if(MSVC)
|
||||
list(APPEND BULLET_CMAKE_ARGS
|
||||
-DUSE_MSVC_RUNTIME_LIBRARY_DLL=ON
|
||||
-DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded$<$<CONFIG:Debug>:Debug>DLL
|
||||
)
|
||||
endif()
|
||||
|
||||
ExternalProject_Add(BULLET_BLD
|
||||
URL "${CMAKE_CURRENT_SOURCE_DIR}/bullet3"
|
||||
BUILD_ALWAYS ${EXT_BUILD_ALWAYS} ${LOG_OPTS}
|
||||
PATCH_COMMAND ${PATCH_EXECUTABLE};-E;-p1;${PATCH_OPTIONS};-i;${CMAKE_CURRENT_SOURCE_DIR}/bullet_cmake.patch
|
||||
COMMAND ${PATCH_EXECUTABLE};-E;-p1;${PATCH_OPTIONS};-i;${CMAKE_CURRENT_SOURCE_DIR}/bullet_wdocumentation.patch
|
||||
CMAKE_ARGS ${BULLET_CMAKE_ARGS}
|
||||
-DBUILD_UNIT_TESTS=OFF
|
||||
LOG_CONFIGURE ${EXT_BUILD_QUIET}
|
||||
LOG_BUILD ${EXT_BUILD_QUIET}
|
||||
LOG_INSTALL ${EXT_BUILD_QUIET}
|
||||
LOG_OUTPUT_ON_FAILURE ${EXT_BUILD_QUIET}
|
||||
STEP_TARGETS install
|
||||
)
|
||||
|
||||
TargetInstallDeps(BULLET BULLET_DEPENDS)
|
||||
|
||||
# Copy the license into position in CMAKE_BUNDLE_INSTALL_PREFIX
|
||||
configure_file(
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/bullet3/LICENSE.txt
|
||||
${DOC_LICENSE_DIR}/bullet.txt
|
||||
COPYONLY
|
||||
)
|
||||
|
||||
endif (ENABLE_BULLET)
|
||||
|
||||
# Local Variables:
|
||||
# tab-width: 8
|
||||
# mode: cmake
|
||||
# indent-tabs-mode: t
|
||||
# End:
|
||||
# ex: shiftwidth=2 tabstop=8
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
PATCH
|
||||
|
||||
Submodule
+1
Submodule bullet/bullet3 added at 63c4d67e33
@@ -0,0 +1,12 @@
|
||||
diff -Naur bullet3/CMakeLists.txt BULLET_BLD/CMakeLists.txt
|
||||
--- bullet3/CMakeLists.txt 2026-03-18 12:04:48.152344880 -0400
|
||||
+++ BULLET_BLD/CMakeLists.txt 2026-03-18 09:52:07.100507175 -0400
|
||||
@@ -23,6 +23,8 @@
|
||||
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -D_DEBUG")
|
||||
#MESSAGE("CMAKE_CXX_FLAGS_DEBUG="+${CMAKE_CXX_FLAGS_DEBUG})
|
||||
|
||||
+set(CMAKE_POSITION_INDEPENDENT_CODE ON)
|
||||
+
|
||||
OPTION(USE_DOUBLE_PRECISION "Use double precision" OFF)
|
||||
SET(CLAMP_VELOCITIES "0" CACHE STRING "Clamp rigid bodies' velocity to this value, if larger than zero. Useful to prevent floating point errors or in general runaway velocities in complex scenarios")
|
||||
OPTION(USE_GRAPHICAL_BENCHMARK "Use Graphical Benchmark" ON)
|
||||
@@ -0,0 +1,197 @@
|
||||
diff --git a/src/BulletDynamics/ConstraintSolver/btGeneric6DofConstraint.h b/src/BulletDynamics/ConstraintSolver/btGeneric6DofConstraint.h
|
||||
index 1febc2b..e2b550c 100644
|
||||
--- a/src/BulletDynamics/ConstraintSolver/btGeneric6DofConstraint.h
|
||||
+++ b/src/BulletDynamics/ConstraintSolver/btGeneric6DofConstraint.h
|
||||
@@ -240,7 +240,7 @@ This is accessible through btGeneric6DofConstraint.getLimitMotor method,
|
||||
This brings support for limit parameters and motors. </li>
|
||||
|
||||
<li> Angulars limits have these possible ranges:
|
||||
-<table border=1 >
|
||||
+<table border="1" >
|
||||
<tr>
|
||||
<td><b>AXIS</b></td>
|
||||
<td><b>MIN ANGLE</b></td>
|
||||
diff --git a/src/LinearMath/btMatrix3x3.h b/src/LinearMath/btMatrix3x3.h
|
||||
index 4391a52..d43d51c 100644
|
||||
--- a/src/LinearMath/btMatrix3x3.h
|
||||
+++ b/src/LinearMath/btMatrix3x3.h
|
||||
@@ -708,7 +708,7 @@ public:
|
||||
* @param rot stores the rotation from the coordinate system in which the matrix is diagonal to the original
|
||||
* coordinate system, i.e., old_this = rot * new_this * rot^T.
|
||||
* @param threshold See iteration
|
||||
- * @param iteration The iteration stops when all off-diagonal elements are less than the threshold multiplied
|
||||
+ * @param maxSteps The iteration stops when all off-diagonal elements are less than the threshold multiplied
|
||||
* by the sum of the absolute values of the diagonal, or when maxSteps have been executed.
|
||||
*
|
||||
* Note that this matrix is assumed to be symmetric.
|
||||
@@ -794,8 +794,8 @@ public:
|
||||
/**@brief Calculate the matrix cofactor
|
||||
* @param r1 The first row to use for calculating the cofactor
|
||||
* @param c1 The first column to use for calculating the cofactor
|
||||
- * @param r1 The second row to use for calculating the cofactor
|
||||
- * @param c1 The second column to use for calculating the cofactor
|
||||
+ * @param r2 The second row to use for calculating the cofactor
|
||||
+ * @param c2 The second column to use for calculating the cofactor
|
||||
* See http://en.wikipedia.org/wiki/Cofactor_(linear_algebra) for more details
|
||||
*/
|
||||
btScalar cofac(int r1, int c1, int r2, int c2) const
|
||||
diff --git a/src/LinearMath/btQuadWord.h b/src/LinearMath/btQuadWord.h
|
||||
index 851596b..682a13c 100644
|
||||
--- a/src/LinearMath/btQuadWord.h
|
||||
+++ b/src/LinearMath/btQuadWord.h
|
||||
@@ -142,9 +142,9 @@ public:
|
||||
}
|
||||
|
||||
/**@brief Set x,y,z and zero w
|
||||
- * @param x Value of x
|
||||
- * @param y Value of y
|
||||
- * @param z Value of z
|
||||
+ * @param _x Value of x
|
||||
+ * @param _y Value of y
|
||||
+ * @param _z Value of z
|
||||
*/
|
||||
SIMD_FORCE_INLINE void setValue(const btScalar& _x, const btScalar& _y, const btScalar& _z)
|
||||
{
|
||||
@@ -162,10 +162,10 @@ public:
|
||||
}
|
||||
*/
|
||||
/**@brief Set the values
|
||||
- * @param x Value of x
|
||||
- * @param y Value of y
|
||||
- * @param z Value of z
|
||||
- * @param w Value of w
|
||||
+ * @param _x Value of x
|
||||
+ * @param _y Value of y
|
||||
+ * @param _z Value of z
|
||||
+ * @param _w Value of w
|
||||
*/
|
||||
SIMD_FORCE_INLINE void setValue(const btScalar& _x, const btScalar& _y, const btScalar& _z, const btScalar& _w)
|
||||
{
|
||||
@@ -181,9 +181,9 @@ public:
|
||||
}
|
||||
|
||||
/**@brief Three argument constructor (zeros w)
|
||||
- * @param x Value of x
|
||||
- * @param y Value of y
|
||||
- * @param z Value of z
|
||||
+ * @param _x Value of x
|
||||
+ * @param _y Value of y
|
||||
+ * @param _z Value of z
|
||||
*/
|
||||
SIMD_FORCE_INLINE btQuadWord(const btScalar& _x, const btScalar& _y, const btScalar& _z)
|
||||
{
|
||||
@@ -191,10 +191,10 @@ public:
|
||||
}
|
||||
|
||||
/**@brief Initializing constructor
|
||||
- * @param x Value of x
|
||||
- * @param y Value of y
|
||||
- * @param z Value of z
|
||||
- * @param w Value of w
|
||||
+ * @param _x Value of x
|
||||
+ * @param _y Value of y
|
||||
+ * @param _z Value of z
|
||||
+ * @param _w Value of w
|
||||
*/
|
||||
SIMD_FORCE_INLINE btQuadWord(const btScalar& _x, const btScalar& _y, const btScalar& _z, const btScalar& _w)
|
||||
{
|
||||
diff --git a/src/LinearMath/btQuaternion.h b/src/LinearMath/btQuaternion.h
|
||||
index 40d6e14..6c68fae 100644
|
||||
--- a/src/LinearMath/btQuaternion.h
|
||||
+++ b/src/LinearMath/btQuaternion.h
|
||||
@@ -84,8 +84,8 @@ public:
|
||||
{
|
||||
}
|
||||
/**@brief Axis angle Constructor
|
||||
- * @param axis The axis which the rotation is around
|
||||
- * @param angle The magnitude of the rotation around the angle (Radians) */
|
||||
+ * @param _axis The axis which the rotation is around
|
||||
+ * @param _angle The magnitude of the rotation around the angle (Radians) */
|
||||
btQuaternion(const btVector3& _axis, const btScalar& _angle)
|
||||
{
|
||||
setRotation(_axis, _angle);
|
||||
@@ -104,7 +104,7 @@ public:
|
||||
}
|
||||
/**@brief Set the rotation using axis angle notation
|
||||
* @param axis The axis around which to rotate
|
||||
- * @param angle The magnitude of the rotation in Radians */
|
||||
+ * @param _angle The magnitude of the rotation in Radians */
|
||||
void setRotation(const btVector3& axis, const btScalar& _angle)
|
||||
{
|
||||
btScalar d = axis.length();
|
||||
@@ -134,9 +134,9 @@ public:
|
||||
cosRoll * cosPitch * cosYaw + sinRoll * sinPitch * sinYaw);
|
||||
}
|
||||
/**@brief Set the quaternion using euler angles
|
||||
- * @param yaw Angle around Z
|
||||
- * @param pitch Angle around Y
|
||||
- * @param roll Angle around X */
|
||||
+ * @param yawZ Angle around Z
|
||||
+ * @param pitchY Angle around Y
|
||||
+ * @param rollX Angle around X */
|
||||
void setEulerZYX(const btScalar& yawZ, const btScalar& pitchY, const btScalar& rollX)
|
||||
{
|
||||
btScalar halfYaw = btScalar(yawZ) * btScalar(0.5);
|
||||
@@ -155,9 +155,9 @@ public:
|
||||
}
|
||||
|
||||
/**@brief Get the euler angles from this quaternion
|
||||
- * @param yaw Angle around Z
|
||||
- * @param pitch Angle around Y
|
||||
- * @param roll Angle around X */
|
||||
+ * @param yawZ Angle around Z
|
||||
+ * @param pitchY Angle around Y
|
||||
+ * @param rollX Angle around X */
|
||||
void getEulerZYX(btScalar& yawZ, btScalar& pitchY, btScalar& rollX) const
|
||||
{
|
||||
btScalar squ;
|
||||
diff --git a/src/LinearMath/btVector3.h b/src/LinearMath/btVector3.h
|
||||
index 9da1627..942f1a0 100644
|
||||
--- a/src/LinearMath/btVector3.h
|
||||
+++ b/src/LinearMath/btVector3.h
|
||||
@@ -119,9 +119,9 @@ public:
|
||||
}
|
||||
|
||||
/**@brief Constructor from scalars
|
||||
- * @param x X value
|
||||
- * @param y Y value
|
||||
- * @param z Z value
|
||||
+ * @param _x X value
|
||||
+ * @param _y Y value
|
||||
+ * @param _z Z value
|
||||
*/
|
||||
SIMD_FORCE_INLINE btVector3(const btScalar& _x, const btScalar& _y, const btScalar& _z)
|
||||
{
|
||||
@@ -155,7 +155,7 @@ public:
|
||||
#endif // #if defined (BT_USE_SSE_IN_API) || defined (BT_USE_NEON)
|
||||
|
||||
/**@brief Add a vector to this one
|
||||
- * @param The vector to add to this one */
|
||||
+ * @param v The vector to add to this one */
|
||||
SIMD_FORCE_INLINE btVector3& operator+=(const btVector3& v)
|
||||
{
|
||||
#if defined(BT_USE_SSE_IN_API) && defined(BT_USE_SSE)
|
||||
@@ -171,7 +171,7 @@ public:
|
||||
}
|
||||
|
||||
/**@brief Subtract a vector from this one
|
||||
- * @param The vector to subtract */
|
||||
+ * @param v The vector to subtract */
|
||||
SIMD_FORCE_INLINE btVector3& operator-=(const btVector3& v)
|
||||
{
|
||||
#if defined(BT_USE_SSE_IN_API) && defined(BT_USE_SSE)
|
||||
@@ -1190,10 +1190,10 @@ public:
|
||||
}
|
||||
*/
|
||||
/**@brief Set the values
|
||||
- * @param x Value of x
|
||||
- * @param y Value of y
|
||||
- * @param z Value of z
|
||||
- * @param w Value of w
|
||||
+ * @param _x Value of x
|
||||
+ * @param _y Value of y
|
||||
+ * @param _z Value of z
|
||||
+ * @param _w Value of w
|
||||
*/
|
||||
SIMD_FORCE_INLINE void setValue(const btScalar& _x, const btScalar& _y, const btScalar& _z, const btScalar& _w)
|
||||
{
|
||||
@@ -0,0 +1,58 @@
|
||||
# Decide if we're using clipper2
|
||||
cad_enable(CLIPPER2 "libbg;librt")
|
||||
|
||||
bext_enable(CLIPPER2)
|
||||
|
||||
# Decision made
|
||||
|
||||
if (ENABLE_CLIPPER2)
|
||||
|
||||
git_submodule_init(Clipper2 README.md)
|
||||
|
||||
RegisterDeps(CLIPPER2)
|
||||
|
||||
ExternalProject_Add(CLIPPER2_BLD
|
||||
URL "${CMAKE_CURRENT_SOURCE_DIR}/Clipper2/CPP"
|
||||
BUILD_ALWAYS ${EXT_BUILD_ALWAYS} ${LOG_OPTS}
|
||||
PATCH_COMMAND ${PATCH_EXECUTABLE};-E;-p1;${PATCH_OPTIONS};-i;${CMAKE_CURRENT_SOURCE_DIR}/clipper2.patch
|
||||
CMAKE_ARGS
|
||||
${BUILD_TYPE_SPECIFIER}
|
||||
-DCLIPPER2_UTILS=OFF
|
||||
-DCLIPPER2_EXAMPLES=OFF
|
||||
-DCLIPPER2_TESTS=OFF
|
||||
-DCLIPPER2_USINGZ=OFF
|
||||
-DBIN_DIR=${BIN_DIR}
|
||||
-DLIB_DIR=${LIB_DIR}
|
||||
-DBUILD_SHARED_LIBS=ON
|
||||
-DBUILD_STATIC_LIBS=${BUILD_STATIC_LIBS}
|
||||
-DCMAKE_WINDOWS_EXPORT_ALL_SYMBOLS=ON
|
||||
-DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
|
||||
-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
|
||||
-DCMAKE_INSTALL_PREFIX=${CMAKE_BUNDLE_INSTALL_PREFIX}
|
||||
-DCMAKE_INSTALL_LIBDIR:PATH=${LIB_DIR}
|
||||
-DCMAKE_INSTALL_RPATH=${CMAKE_BUNDLE_INSTALL_PREFIX}/${LIB_DIR}
|
||||
LOG_CONFIGURE ${EXT_BUILD_QUIET}
|
||||
LOG_BUILD ${EXT_BUILD_QUIET}
|
||||
LOG_INSTALL ${EXT_BUILD_QUIET}
|
||||
LOG_OUTPUT_ON_FAILURE ${EXT_BUILD_QUIET}
|
||||
STEP_TARGETS install
|
||||
)
|
||||
|
||||
TargetInstallDeps(CLIPPER2 CLIPPER2_DEPENDS)
|
||||
|
||||
# Copy the license into position in CMAKE_BUNDLE_INSTALL_PREFIX
|
||||
configure_file(
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/Clipper2/LICENSE
|
||||
${DOC_LICENSE_DIR}/clipper2.txt
|
||||
COPYONLY
|
||||
)
|
||||
|
||||
endif (ENABLE_CLIPPER2)
|
||||
|
||||
# Local Variables:
|
||||
# tab-width: 8
|
||||
# mode: cmake
|
||||
# indent-tabs-mode: t
|
||||
# End:
|
||||
# ex: shiftwidth=2 tabstop=8
|
||||
|
||||
Submodule
+1
Submodule clipper2/Clipper2 added at ef88ee97c0
@@ -0,0 +1,2 @@
|
||||
PATCH
|
||||
|
||||
@@ -0,0 +1,80 @@
|
||||
diff -Naur CLIPPER2_BLD/CMakeLists.txt CLIPPER2/CMakeLists.txt
|
||||
--- CLIPPER2_BLD/CMakeLists.txt 2026-04-30 12:34:52.299493949 -0400
|
||||
+++ CLIPPER2/CMakeLists.txt 2026-04-30 12:38:11.412869621 -0400
|
||||
@@ -18,6 +18,7 @@
|
||||
option(USE_EXTERNAL_GTEST "Use system-wide installed GoogleTest" OFF)
|
||||
option(USE_EXTERNAL_GBENCHMARK "Use the googlebenchmark" OFF)
|
||||
option(BUILD_SHARED_LIBS "Build shared libs" OFF)
|
||||
+option(BUILD_STATIC_LIBS "Also build static library archives (Clipper2-static / Clipper2Z-static) alongside the primary libraries" OFF)
|
||||
set(CLIPPER2_USINGZ "ON" CACHE STRING "Build Clipper2Z, either \"ON\" or \"OFF\" or \"ONLY\"")
|
||||
|
||||
# CLIPPER2_MAX_DECIMAL_PRECISION: maximum decimal precision when scaling PathsD to Paths64.
|
||||
@@ -78,6 +79,68 @@
|
||||
endif()
|
||||
endif()
|
||||
|
||||
+# -----------------------------------------------------------------------
|
||||
+# Optional static library targets (meaningful when BUILD_SHARED_LIBS=ON)
|
||||
+# -----------------------------------------------------------------------
|
||||
+if(BUILD_STATIC_LIBS)
|
||||
+ set(CLIPPER2_STATIC_LIBS "")
|
||||
+
|
||||
+ if (NOT (CLIPPER2_USINGZ STREQUAL "ONLY"))
|
||||
+ list(APPEND CLIPPER2_STATIC_LIBS Clipper2_static)
|
||||
+ add_library(Clipper2_static STATIC ${CLIPPER2_INC} ${CLIPPER2_SRC})
|
||||
+
|
||||
+ set_target_properties(Clipper2_static PROPERTIES
|
||||
+ OUTPUT_NAME Clipper2-static
|
||||
+ EXPORT_NAME Clipper2-static
|
||||
+ )
|
||||
+
|
||||
+ target_compile_definitions(Clipper2_static PUBLIC
|
||||
+ CLIPPER2_MAX_DECIMAL_PRECISION=${CLIPPER2_MAX_DECIMAL_PRECISION}
|
||||
+ $<$<BOOL:${CLIPPER2_HI_PRECISION}>:CLIPPER2_HI_PRECISION>
|
||||
+ )
|
||||
+
|
||||
+ target_include_directories(Clipper2_static PUBLIC
|
||||
+ $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/Clipper2Lib/include>
|
||||
+ $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
|
||||
+ )
|
||||
+
|
||||
+ if (NOT MSVC)
|
||||
+ target_link_libraries(Clipper2_static PUBLIC m)
|
||||
+ endif()
|
||||
+ endif()
|
||||
+
|
||||
+ if (NOT (CLIPPER2_USINGZ STREQUAL "OFF"))
|
||||
+ list(APPEND CLIPPER2_STATIC_LIBS Clipper2Z_static)
|
||||
+ add_library(Clipper2Z_static STATIC ${CLIPPER2_INC} ${CLIPPER2_SRC})
|
||||
+
|
||||
+ set_target_properties(Clipper2Z_static PROPERTIES
|
||||
+ OUTPUT_NAME Clipper2Z-static
|
||||
+ EXPORT_NAME Clipper2Z-static
|
||||
+ )
|
||||
+
|
||||
+ target_compile_definitions(Clipper2Z_static PUBLIC
|
||||
+ USINGZ
|
||||
+ CLIPPER2_MAX_DECIMAL_PRECISION=${CLIPPER2_MAX_DECIMAL_PRECISION}
|
||||
+ $<$<BOOL:${CLIPPER2_HI_PRECISION}>:CLIPPER2_HI_PRECISION>
|
||||
+ )
|
||||
+
|
||||
+ target_include_directories(Clipper2Z_static PUBLIC
|
||||
+ $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/Clipper2Lib/include>
|
||||
+ $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
|
||||
+ )
|
||||
+
|
||||
+ if (NOT MSVC)
|
||||
+ target_link_libraries(Clipper2Z_static PUBLIC m)
|
||||
+ endif()
|
||||
+ endif()
|
||||
+
|
||||
+ install(TARGETS ${CLIPPER2_STATIC_LIBS} EXPORT Clipper2-targets
|
||||
+ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
+ INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
|
||||
+ )
|
||||
+endif()
|
||||
+
|
||||
+
|
||||
# secondary Clipper2 library with USINGZ defined (if required)
|
||||
if (NOT (CLIPPER2_USINGZ STREQUAL "OFF"))
|
||||
list(APPEND CLIPPER2_LIBS Clipper2Z)
|
||||
@@ -1,32 +0,0 @@
|
||||
find_path(ZLIBNG_INCLUDE_DIRS NAMES zlib-ng.h)
|
||||
|
||||
if(ZLIB_INCLUDE_DIRS)
|
||||
set(ZLIBNG_LIBRARY_DIRS ${ZLIBNG_INCLUDE_DIRS})
|
||||
|
||||
if("${ZLIBNG_LIBRARY_DIRS}" MATCHES "/include$")
|
||||
# Strip off the trailing "/include" in the path.
|
||||
get_filename_component(ZLIBNG_LIBRARY_DIRS ${ZLIBNG_LIBRARY_DIRS} PATH)
|
||||
endif()
|
||||
|
||||
if(EXISTS "${ZLIBNG_LIBRARY_DIRS}/lib")
|
||||
set(ZLIBNG_LIBRARY_DIRS ${ZLIBNG_LIBRARY_DIRS}/lib)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
find_library(ZLIBNG_LIBRARY NAMES z-ng libz-ng libz-ng.a)
|
||||
|
||||
set(ZLIBNG_LIBRARIES ${ZLIBNG_LIBRARY})
|
||||
set(ZLIBNG_INCLUDE_DIRS ${ZLIBNG_INCLUDE_DIRS})
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(ZLIBNG DEFAULT_MSG ZLIBNG_LIBRARY ZLIBNG_INCLUDE_DIRS)
|
||||
|
||||
if(ZLIBNG_INCLUDE_DIRS AND ZLIBNG_LIBRARIES)
|
||||
set(ZLIBNG_FOUND ON)
|
||||
else(ZLIBNG_INCLUDE_DIRS AND ZLIBNG_LIBRARIES)
|
||||
set(ZLIBNG_FOUND OFF)
|
||||
endif()
|
||||
|
||||
if(ZLIBNG_FOUND)
|
||||
message(STATUS "Found zlib-ng: ${ZLIBNG_LIBRARIES}, ${ZLIBNG_INCLUDE_DIRS}")
|
||||
endif()
|
||||
@@ -1,35 +0,0 @@
|
||||
# Checkout remote repository
|
||||
macro(clone_repo name url)
|
||||
string(TOLOWER ${name} name_lower)
|
||||
string(TOUPPER ${name} name_upper)
|
||||
|
||||
if(NOT ${name_upper}_REPOSITORY)
|
||||
set(${name_upper}_REPOSITORY ${url})
|
||||
endif()
|
||||
if(NOT ${name_upper}_TAG)
|
||||
set(${name_upper}_TAG master)
|
||||
endif()
|
||||
|
||||
message(STATUS "Fetching ${name} ${${name_upper}_REPOSITORY} ${${name_upper}_TAG}")
|
||||
|
||||
# Check for FetchContent cmake support
|
||||
if(${CMAKE_VERSION} VERSION_LESS "3.11")
|
||||
message(FATAL_ERROR "CMake 3.11 required to fetch ${name}")
|
||||
else()
|
||||
include(FetchContent)
|
||||
|
||||
FetchContent_Declare(${name}
|
||||
GIT_REPOSITORY ${${name_upper}_REPOSITORY}
|
||||
GIT_TAG ${${name_upper}_TAG}
|
||||
SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/third_party/${name_lower})
|
||||
|
||||
FetchContent_GetProperties(${name} POPULATED ${name_lower}_POPULATED)
|
||||
|
||||
if(NOT ${name_lower}_POPULATED)
|
||||
FetchContent_Populate(${name})
|
||||
endif()
|
||||
|
||||
set(${name_upper}_SOURCE_DIR ${${name_lower}_SOURCE_DIR})
|
||||
set(${name_upper}_BINARY_DIR ${${name_lower}_BINARY_DIR})
|
||||
endif()
|
||||
endmacro()
|
||||
@@ -1,166 +0,0 @@
|
||||
# detect-sanitizer.cmake -- Detect supported compiler sanitizer flags
|
||||
# Licensed under the Zlib license, see LICENSE.md for details
|
||||
|
||||
macro(add_common_sanitizer_flags)
|
||||
if(CMAKE_C_COMPILER_ID MATCHES "GNU" OR CMAKE_C_COMPILER_ID MATCHES "Clang")
|
||||
add_compile_options(-g3)
|
||||
endif()
|
||||
# check_c_compiler_flag(-fno-omit-frame-pointer HAVE_NO_OMIT_FRAME_POINTER)
|
||||
# if(HAVE_NO_OMIT_FRAME_POINTER)
|
||||
add_compile_options(-fno-omit-frame-pointer)
|
||||
add_link_options(-fno-omit-frame-pointer)
|
||||
# endif()
|
||||
# check_c_compiler_flag(-fno-optimize-sibling-calls HAVE_NO_OPTIMIZE_SIBLING_CALLS)
|
||||
# if(HAVE_NO_OPTIMIZE_SIBLING_CALLS)
|
||||
add_compile_options(-fno-optimize-sibling-calls)
|
||||
add_link_options(-fno-optimize-sibling-calls)
|
||||
# endif()
|
||||
endmacro()
|
||||
|
||||
macro(check_sanitizer_support known_checks supported_checks)
|
||||
set(available_checks "")
|
||||
|
||||
# Build list of supported sanitizer flags by incrementally trying compilation with
|
||||
# known sanitizer checks
|
||||
|
||||
foreach(check ${known_checks})
|
||||
if(available_checks STREQUAL "")
|
||||
set(compile_checks "${check}")
|
||||
else()
|
||||
set(compile_checks "${available_checks},${check}")
|
||||
endif()
|
||||
|
||||
set(CMAKE_REQUIRED_FLAGS -fsanitize=${compile_checks})
|
||||
|
||||
check_c_source_compiles("int main() { return 0; }" HAVE_SANITIZER_${check}
|
||||
FAIL_REGEX "not supported|unrecognized command|unknown option")
|
||||
|
||||
set(CMAKE_REQUIRED_FLAGS)
|
||||
|
||||
if(HAVE_SANITIZER_${check})
|
||||
set(available_checks ${compile_checks})
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
set(${supported_checks} ${available_checks})
|
||||
endmacro()
|
||||
|
||||
macro(add_address_sanitizer)
|
||||
set(known_checks
|
||||
address
|
||||
pointer-compare
|
||||
pointer-subtract
|
||||
)
|
||||
|
||||
check_sanitizer_support("${known_checks}" supported_checks)
|
||||
if(NOT ${supported_checks} STREQUAL "")
|
||||
message(STATUS "Address sanitizer is enabled: ${supported_checks}")
|
||||
add_compile_options(-fsanitize=${supported_checks})
|
||||
add_link_options(-fsanitize=${supported_checks})
|
||||
add_common_sanitizer_flags()
|
||||
else()
|
||||
message(STATUS "Address sanitizer is not supported")
|
||||
endif()
|
||||
|
||||
if(CMAKE_CROSSCOMPILING_EMULATOR)
|
||||
# Only check for leak sanitizer if not cross-compiling due to qemu crash
|
||||
message(WARNING "Leak sanitizer is not supported when cross compiling")
|
||||
else()
|
||||
# Leak sanitizer requires address sanitizer
|
||||
check_sanitizer_support("leak" supported_checks)
|
||||
if(NOT ${supported_checks} STREQUAL "")
|
||||
message(STATUS "Leak sanitizer is enabled: ${supported_checks}")
|
||||
add_compile_options(-fsanitize=${supported_checks})
|
||||
add_link_options(-fsanitize=${supported_checks})
|
||||
add_common_sanitizer_flags()
|
||||
else()
|
||||
message(STATUS "Leak sanitizer is not supported")
|
||||
endif()
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
macro(add_memory_sanitizer)
|
||||
check_sanitizer_support("memory" supported_checks)
|
||||
if(NOT ${supported_checks} STREQUAL "")
|
||||
message(STATUS "Memory sanitizer is enabled: ${supported_checks}")
|
||||
add_compile_options(-fsanitize=${supported_checks})
|
||||
add_link_options(-fsanitize=${supported_checks})
|
||||
add_common_sanitizer_flags()
|
||||
|
||||
check_c_compiler_flag(-fsanitize-memory-track-origins HAVE_MEMORY_TRACK_ORIGINS)
|
||||
if(HAVE_MEMORY_TRACK_ORIGINS)
|
||||
add_compile_options(-fsanitize-memory-track-origins)
|
||||
add_link_options(-fsanitize-memory-track-origins)
|
||||
endif()
|
||||
else()
|
||||
message(STATUS "Memory sanitizer is not supported")
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
macro(add_thread_sanitizer)
|
||||
check_sanitizer_support("thread" supported_checks)
|
||||
if(NOT ${supported_checks} STREQUAL "")
|
||||
message(STATUS "Thread sanitizer is enabled: ${supported_checks}")
|
||||
add_compile_options(-fsanitize=${supported_checks})
|
||||
add_link_options(-fsanitize=${supported_checks})
|
||||
add_common_sanitizer_flags()
|
||||
else()
|
||||
message(STATUS "Thread sanitizer is not supported")
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
macro(add_undefined_sanitizer)
|
||||
set(known_checks
|
||||
array-bounds
|
||||
bool
|
||||
bounds
|
||||
builtin
|
||||
enum
|
||||
float-cast-overflow
|
||||
float-divide-by-zero
|
||||
function
|
||||
integer-divide-by-zero
|
||||
local-bounds
|
||||
null
|
||||
nonnull-attribute
|
||||
pointer-overflow
|
||||
return
|
||||
returns-nonnull-attribute
|
||||
shift
|
||||
shift-base
|
||||
shift-exponent
|
||||
signed-integer-overflow
|
||||
undefined
|
||||
unsigned-integer-overflow
|
||||
unsigned-shift-base
|
||||
vla-bound
|
||||
vptr
|
||||
)
|
||||
|
||||
# Only check for alignment sanitizer flag if unaligned access is not supported
|
||||
if(NOT WITH_UNALIGNED)
|
||||
list(APPEND known_checks alignment)
|
||||
endif()
|
||||
# Object size sanitizer has no effect at -O0 and produces compiler warning if enabled
|
||||
if(NOT CMAKE_C_FLAGS MATCHES "-O0")
|
||||
list(APPEND known_checks object-size)
|
||||
endif()
|
||||
|
||||
check_sanitizer_support("${known_checks}" supported_checks)
|
||||
|
||||
if(NOT ${supported_checks} STREQUAL "")
|
||||
message(STATUS "Undefined behavior sanitizer is enabled: ${supported_checks}")
|
||||
add_compile_options(-fsanitize=${supported_checks})
|
||||
add_link_options(-fsanitize=${supported_checks})
|
||||
|
||||
# Group sanitizer flag -fsanitize=undefined will automatically add alignment, even if
|
||||
# it is not in our sanitize flag list, so we need to explicitly disable alignment sanitizing.
|
||||
if(WITH_UNALIGNED)
|
||||
add_compile_options(-fno-sanitize=alignment)
|
||||
endif()
|
||||
|
||||
add_common_sanitizer_flags()
|
||||
else()
|
||||
message(STATUS "Undefined behavior sanitizer is not supported")
|
||||
endif()
|
||||
endmacro()
|
||||
@@ -0,0 +1,48 @@
|
||||
|
||||
bext_enable(DEFLATE)
|
||||
|
||||
if (ENABLE_DEFLATE)
|
||||
|
||||
git_submodule_init(libdeflate CMakeLists.txt)
|
||||
|
||||
RegisterDeps(DEFLATE)
|
||||
|
||||
ExternalProject_Add(DEFLATE_BLD
|
||||
URL "${CMAKE_CURRENT_SOURCE_DIR}/libdeflate"
|
||||
BUILD_ALWAYS ${EXT_BUILD_ALWAYS} ${LOG_OPTS}
|
||||
CMAKE_ARGS
|
||||
${BUILD_TYPE_SPECIFIER}
|
||||
-DDEFLATE_BUILD_CLI=OFF
|
||||
-DBIN_DIR=${BIN_DIR}
|
||||
-DLIB_DIR=${LIB_DIR}
|
||||
-DBUILD_STATIC_LIBS=${BUILD_STATIC_LIBS}
|
||||
-DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
|
||||
-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
|
||||
-DCMAKE_INSTALL_PREFIX=${CMAKE_BUNDLE_INSTALL_PREFIX}
|
||||
-DCMAKE_INSTALL_LIBDIR:PATH=${LIB_DIR}
|
||||
-DCMAKE_INSTALL_RPATH=${CMAKE_BUNDLE_INSTALL_PREFIX}/${LIB_DIR}
|
||||
LOG_CONFIGURE ${EXT_BUILD_QUIET}
|
||||
LOG_BUILD ${EXT_BUILD_QUIET}
|
||||
LOG_INSTALL ${EXT_BUILD_QUIET}
|
||||
LOG_OUTPUT_ON_FAILURE ${EXT_BUILD_QUIET}
|
||||
STEP_TARGETS install
|
||||
)
|
||||
|
||||
TargetInstallDeps(DEFLATE DEFLATE_DEPENDS)
|
||||
|
||||
# Copy the license into position in CMAKE_BUNDLE_INSTALL_PREFIX
|
||||
configure_file(
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/libdeflate/COPYING
|
||||
${DOC_LICENSE_DIR}/deflate.txt
|
||||
COPYONLY
|
||||
)
|
||||
|
||||
endif (ENABLE_DEFLATE)
|
||||
|
||||
# Local Variables:
|
||||
# tab-width: 8
|
||||
# mode: cmake
|
||||
# indent-tabs-mode: t
|
||||
# End:
|
||||
# ex: shiftwidth=2 tabstop=8
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
PATCH
|
||||
|
||||
Submodule
+1
Submodule deflate/libdeflate added at 275aa5141d
-269
@@ -1,269 +0,0 @@
|
||||
# minizip-ng Documentation <!-- omit in toc -->
|
||||
|
||||
### Table of Contents
|
||||
|
||||
- [API](#api)
|
||||
- [Limitations](#limitations)
|
||||
- [Minimum OS Requirements](#minimum-os-requirements)
|
||||
- [Xcode Instructions](#xcode-instructions)
|
||||
- [Zlib Configuration](#zlib-configuration)
|
||||
- [Upgrading from 1.x](#upgrading-from-1x)
|
||||
- [Security Considerations](#security-considerations)
|
||||
- [Using Streams](#using-streams)
|
||||
- [Memory Stream](#memory-stream)
|
||||
- [Buffered Stream](#buffered-stream)
|
||||
- [Disk Splitting Stream](#disk-splitting-stream)
|
||||
- [Additional Code Examples](#additional-code-examples)
|
||||
|
||||
## API
|
||||
|
||||
### Constants <!-- omit in toc -->
|
||||
|
||||
|Prefix|Description|
|
||||
|-|-|
|
||||
|[MZ_COMPRESS_LEVEL](mz_compress_level.md)|Compression level enumeration|
|
||||
|[MZ_COMPRESS_METHOD](mz_compress_method.md)|Compression method enumeration|
|
||||
|[MZ_ENCODING](mz_encoding.md)|Character encoding enumeration|
|
||||
|[MZ_ERROR](mz_error.md)|Error constants|
|
||||
|[MZ_HASH](mz_hash.md)|Hash algorithms and digest sizes
|
||||
|[MZ_HOST_SYSTEM](mz_host_system.md)|System identifiers|
|
||||
|[MZ_OPEN_MODE](mz_open_mode.md)|Stream open modes|
|
||||
|[MZ_SEEK](mz_seek.md)|Stream seek origins|
|
||||
|[MZ_ZIP64](mz_zip64.md)|Zip64 extrafield options|
|
||||
|
||||
### Interfaces <!-- omit in toc -->
|
||||
|
||||
|Name|Description|
|
||||
|-|-|
|
||||
|MZ_COMPAT|Old minizip 1.x compatibility layer|
|
||||
|[MZ_OS](mz_os.md)|Operating system level file system operations|
|
||||
|[MZ_ZIP](mz_zip.md)|Zip archive and entry interface |
|
||||
|[MZ_ZIP_RW](mz_zip_rw.md)|Easy zip file extraction and creation|
|
||||
|
||||
### Structures <!-- omit in toc -->
|
||||
|
||||
|Name|Description|
|
||||
|-|-|
|
||||
|[MZ_ZIP_FILE](mz_zip_file.md)|Zip entry information|
|
||||
|
||||
### Extrafield Proposals <!-- omit in toc -->
|
||||
|
||||
The zip reader and writer interface provides support for extended hash algorithms for zip entries and compression of the central directory. In order to add support for these features, extrafields were added and are described in the [minizip extrafield documentation](mz_extrafield.md).
|
||||
|
||||
## Limitations
|
||||
|
||||
+ Archives are required to have a central directory unless recovery mode is enabled.
|
||||
+ Central directory header values should be correct and it is necessary for the compressed size to be accurate for encryption.
|
||||
+ Central directory is the only data stored on the last disk of a split-disk archive and doesn't follow disk size restrictions.
|
||||
|
||||
### Third-Party Limitations <!-- omit in toc -->
|
||||
|
||||
* Windows Explorer zip extraction utility does not support disk splitting. [1](https://stackoverflow.com/questions/31286707/the-same-volume-can-not-be-used-as-both-the-source-and-destination)
|
||||
* macOS archive utility does not properly support ZIP files over 4GB. [1](http://web.archive.org/web/20140331005235/http://www.springyarchiver.com/blog/topic/topic/203) [2](https://bitinn.net/10716/)
|
||||
|
||||
## Minimum OS Requirements
|
||||
|
||||
Actively supported minimum operating system versions:
|
||||
|
||||
* Windows Vista
|
||||
* macOS 10.13
|
||||
* Ubuntu 18
|
||||
|
||||
Pull requests can be submitted to maintain support for older versions.
|
||||
|
||||
## Xcode Instructions
|
||||
|
||||
To create an Xcode project with CMake use:
|
||||
```
|
||||
cmake -G Xcode .
|
||||
```
|
||||
|
||||
## Zlib Configuration
|
||||
|
||||
By default, if zlib is not found, it will be pulled as an external project and installed. This requires [Git](https://git-scm.com/) to be installed and available to your command interpreter.
|
||||
|
||||
* To specify your own zlib repository use `ZLIB_REPOSITORY` and/or `ZLIB_TAG`.
|
||||
* To specify your own zlib installation use `ZLIB_LIBRARY` and `ZLIB_INCLUDE_DIR`.
|
||||
|
||||
**Compiling with Zlib-ng**
|
||||
|
||||
To compile using zlib-ng use the following cmake args:
|
||||
|
||||
```
|
||||
-DZLIB_REPOSITORY=https://github.com/zlib-ng/zlib-ng -DZLIB_TAG=develop
|
||||
```
|
||||
**Compiling and Installing Zlib (Windows)**
|
||||
|
||||
To compile and install zlib to the Program Files directory with an Administrator command prompt:
|
||||
|
||||
```
|
||||
cmake -DCMAKE_INSTALL_PREFIX="C:\Program Files (x86)\zlib" .
|
||||
cmake --build . --config Release --target INSTALL
|
||||
```
|
||||
**Configure Existing Zlib Installation (Windows)**
|
||||
|
||||
To configure cmake with an existing zlib installation point cmake to your install directories:
|
||||
|
||||
```
|
||||
cmake -DZLIB_LIBRARY:FILEPATH="C:\Program Files (x86)\zlib\lib\zlibstaticd.lib" .
|
||||
cmake -DZLIB_INCLUDE_DIR:PATH="C:\Program Files (x86)\zlib\include" .
|
||||
```
|
||||
|
||||
## Upgrading from 1.x
|
||||
|
||||
If you are using CMAKE it will automatically include all the files and define all the #defines
|
||||
required based on your configuration and it will also build the project files necessary for your platform.
|
||||
|
||||
However, for some projects it may be necessary to drop in the new files into an existing project. In that
|
||||
instance, some #defines will have to be set as they have changed.
|
||||
|
||||
|1.x|2.x|Description|
|
||||
|-|-|:-|
|
||||
||HAVE_ZLIB|Compile with ZLIB library. Older versions of Minizip required ZLIB. It is now possible to alternatively compile only using liblzma library.|
|
||||
||HAVE_LZMA|Compile with LZMA support.|
|
||||
|HAVE_BZIP2|HAVE_BZIP2|Compile with BZIP2 library support.|
|
||||
|HAVE_APPLE_COMPRESSION|HAVE_LIBCOMP|Compile using Apple Compression library.|
|
||||
|HAVE_AES|HAVE_WZAES|Compile using AES encryption support.|
|
||||
||HAVE_PKCRYPT|Compile using PKWARE traditional encryption support. Previously this was automatically assumed.|
|
||||
|NOUNCRYPT|Nearest to MZ_ZIP_NO_ENCRYPTION|Previously turn off all decryption support.|
|
||||
|NOCRYPT|Nearest to MZ_ZIP_NO_ENCRYPTION|Previously turned off all encryption support.|
|
||||
||MZ_ZIP_NO_ENCRYPTION|Turns off all encryption/decryption support.|
|
||||
|NO_ADDFILEINEXISTINGZIP||Not currently supported.|
|
||||
||MZ_ZIP_NO_COMPRESSION|Intended to reduce compilation size if not using zipping functionality.|
|
||||
||MZ_ZIP_NO_COMPRESSION|Intended to reduce compilation size if not using zipping functionality.|
|
||||
|
||||
At a minimum HAVE_ZLIB and HAVE_PKCRYPT will be necessary to be defined for drop-in replacement. To determine which files to drop in, see the Contents section of the [README](https://github.com/zlib-ng/minizip-ng/blob/master/README.md).
|
||||
|
||||
## Security Considerations
|
||||
|
||||
### WinZip AES <!-- omit in toc -->
|
||||
|
||||
When compressing an archive with WinZIP AES enabled, by default it uses 256 bit encryption. During decompression whatever bit encryption was specified when the entry was added to the archive will be used.
|
||||
|
||||
WinZip AES encryption uses CTR on top of ECB which prevents identical ciphertext blocks that might occur when using ECB by itself. More details about the WinZIP AES format can be found in the [winzip documentation](zip/winzip_aes.md).
|
||||
|
||||
### How to Create a Secure Zip <!-- omit in toc -->
|
||||
|
||||
In order to create a secure zip file you must:
|
||||
|
||||
* Use WinZIP AES encryption
|
||||
* Zip the central directory
|
||||
* Sign the zip file using a certificate
|
||||
|
||||
The combination of using AES encryption and zipping the central directory prevents data leakage through filename exposure.
|
||||
|
||||
## Using Streams
|
||||
|
||||
All input/output operations are done through the use of streams.
|
||||
|
||||
### Memory Stream
|
||||
|
||||
To unzip from a zip file in memory pass the memory stream to the open function.
|
||||
```c
|
||||
uint8_t *zip_buffer = NULL;
|
||||
int32_t zip_buffer_size = 0;
|
||||
void *mem_stream = NULL;
|
||||
void *zip_handle = NULL;
|
||||
|
||||
/* TODO: fill zip_buffer with zip contents.. */
|
||||
|
||||
mem_stream = mz_stream_mem_create();
|
||||
mz_stream_mem_set_buffer(mem_stream, zip_buffer, zip_buffer_size);
|
||||
mz_stream_open(mem_stream, NULL, MZ_OPEN_MODE_READ);
|
||||
|
||||
zip_handle = mz_zip_create();
|
||||
err = mz_zip_open(zip_handle, mem_stream, MZ_OPEN_MODE_READ);
|
||||
|
||||
/* TODO: unzip operations.. */
|
||||
|
||||
mz_zip_close(zip_handle);
|
||||
mz_zip_delete(&zip_handle);
|
||||
|
||||
mz_stream_mem_delete(&mem_stream);
|
||||
```
|
||||
|
||||
To create a zip file in memory first create a growable memory stream and pass it to the open function.
|
||||
|
||||
```c
|
||||
void *mem_stream = NULL;
|
||||
void *zip_handle = NULL;
|
||||
|
||||
mem_stream = mz_stream_mem_create();
|
||||
mz_stream_mem_set_grow_size(mem_stream, (128 * 1024));
|
||||
mz_stream_open(mem_stream, NULL, MZ_OPEN_MODE_CREATE);
|
||||
|
||||
zip_handle = mz_zip_create();
|
||||
err = mz_zip_open(zip_handle, mem_stream, MZ_OPEN_MODE_WRITE);
|
||||
|
||||
/* TODO: unzip operations.. */
|
||||
|
||||
mz_zip_close(zip_handle);
|
||||
mz_zip_delete(&zip_handle);
|
||||
|
||||
mz_stream_mem_delete(&mem_stream);
|
||||
```
|
||||
|
||||
For a complete example, see test_stream_mem() in [test.c](https://github.com/nmoinvaz/minizip/blob/master/test/test.c).
|
||||
|
||||
### Buffered Stream
|
||||
|
||||
By default the library will read bytes typically one at a time. The buffered stream allows for buffered read and write operations to improve I/O performance.
|
||||
|
||||
```c
|
||||
void *stream = NULL;
|
||||
void *buf_stream = NULL;
|
||||
void *zip_handle = NULL;
|
||||
|
||||
stream = mz_stream_os_create()
|
||||
|
||||
/* TODO: open os stream.. */
|
||||
|
||||
buf_stream = mz_stream_buffered_create();
|
||||
mz_stream_buffered_open(buf_stream, NULL, MZ_OPEN_MODE_READ);
|
||||
mz_stream_buffered_set_base(buf_stream, stream);
|
||||
|
||||
zip_handle = mz_zip_create();
|
||||
err = mz_zip_open(zip_handle, buf_stream, MZ_OPEN_MODE_READ);
|
||||
|
||||
/* TODO: unzip operation.. */
|
||||
|
||||
mz_zip_close(zip_handle);
|
||||
mz_zip_delete(&zip_handle);
|
||||
|
||||
mz_stream_buffered_delete(&buf_stream);
|
||||
```
|
||||
|
||||
### Disk Splitting Stream
|
||||
|
||||
To create an archive with multiple disks use the disk splitting stream and supply a disk size value in bytes.
|
||||
|
||||
```c
|
||||
void *stream = NULL;
|
||||
void *split_stream = NULL;
|
||||
void *zip_handle = NULL;
|
||||
|
||||
stream = mz_stream_os_create();
|
||||
|
||||
split_stream = mz_stream_split_create();
|
||||
mz_stream_split_set_prop_int64(split_stream, MZ_STREAM_PROP_DISK_SIZE, 64 * 1024);
|
||||
mz_stream_set_base(split_stream, stream);
|
||||
mz_stream_open(split_stream, path..
|
||||
|
||||
zip_handle = mz_zip_create();
|
||||
err = mz_zip_open(zip_handle, split_stream, MZ_OPEN_MODE_WRITE);
|
||||
|
||||
/* TODO: unzip operation.. */
|
||||
|
||||
mz_zip_close(zip_handle);
|
||||
mz_zip_delete(&zip_handle);
|
||||
|
||||
mz_stream_buffered_delete(&split_stream);
|
||||
```
|
||||
|
||||
### Additional Code Examples
|
||||
|
||||
Some of these may be out of date, but they can also be helpful.
|
||||
|
||||
* [Compressed stream tests](https://github.com/zlib-ng/minizip-ng/blob/master/test/test_stream_compress.cc)
|
||||
* [Code to copy raw entries from one zip file to another](https://gist.github.com/chenxiaolong/bcbb0835182ef16a25f09db8d99e0619) by chenxiaolong
|
||||
* [Buffered streaming](https://gist.github.com/chenxiaolong/dbab3fbef51b9d0fa969e220dbb85967) by chenxiaolong
|
||||
@@ -1,10 +0,0 @@
|
||||
# MZ_COMPRESS_LEVEL
|
||||
|
||||
Compression level enumeration.
|
||||
|
||||
|Name|Code|Description|
|
||||
|-|-|-|
|
||||
|MZ_COMPRESS_LEVEL_DEFAULT|-1|Default compression level (6)|
|
||||
|MZ_COMPRESS_LEVEL_FAST|2|Fast compression level|
|
||||
|MZ_COMPRESS_LEVEL_NORMAL|6|Mid compression level|
|
||||
|MZ_COMPRESS_LEVEL_BEST|9|Slow compression level|
|
||||
@@ -1,14 +0,0 @@
|
||||
# MZ_COMPRESS_METHOD
|
||||
|
||||
Compression method enumeration.
|
||||
|
||||
|Name|Code|Description|
|
||||
|-|-|-|
|
||||
|MZ_COMPRESS_METHOD_STORE|0|No compression|
|
||||
|MZ_COMPRESS_METHOD_DEFLATE|8|Deflate compression|
|
||||
|MZ_COMPRESS_METHOD_BZIP2|12|Bzip2 compression|
|
||||
|MZ_COMPRESS_METHOD_LZMA|14|LZMA1 compression|
|
||||
|MZ_COMPRESS_METHOD_ZSTD|93|ZSTD compression|
|
||||
|MZ_COMPRESS_METHOD_XZ|95|XZ compression|
|
||||
|
||||
_MZ_COMPRESS_METHOD_AES_ is only for internal use.
|
||||
@@ -1,11 +0,0 @@
|
||||
# MZ_ENCODING
|
||||
|
||||
Character encoding enumeration. Older zip files may store the filename in a different character encoding.
|
||||
|
||||
|Name|Code|Description|
|
||||
|-|-|-|
|
||||
|MZ_ENCODING_CODEPAGE_437|437|[Code page 437](https://en.wikipedia.org/wiki/Code_page_437)|
|
||||
|MZ_ENCODING_CODEPAGE_932|932|[Code page 932](https://en.wikipedia.org/wiki/Code_page_932)|
|
||||
|MZ_ENCODING_CODEPAGE_936|936|[Code page 936](https://en.wikipedia.org/wiki/Code_page_936)|
|
||||
|MZ_ENCODING_CODEPAGE_950|950|[Code page 950](https://en.wikipedia.org/wiki/Code_page_950)|
|
||||
|MZ_ENCODING_CODEPAGE_UTF8|65001|[UTF-8](https://en.wikipedia.org/wiki/UTF-8)|
|
||||
@@ -1,31 +0,0 @@
|
||||
# MZ_ERROR
|
||||
|
||||
Error code enumeration. These errors codes are compatible with and extend zlib error codes.
|
||||
|
||||
|Name|Code|Description|
|
||||
|-|-|-|
|
||||
|MZ_OK|0|OK error (zlib)|
|
||||
|MZ_STREAM_ERROR|-1|Stream error (zlib)|
|
||||
|MZ_DATA_ERROR|-3|Data error (zlib)|
|
||||
|MZ_MEM_ERROR|-4|Memory allocation error (zlib)|
|
||||
|MZ_BUF_ERROR|-5|Buffer error (zlib)|
|
||||
|MZ_VERSION_ERROR|-6|Version error (zlib)|
|
||||
|MZ_END_OF_LIST|-100|End of list error|
|
||||
|MZ_END_OF_STREAM|-101|End of stream error|
|
||||
|MZ_PARAM_ERROR|-102|Invalid parameter error|
|
||||
|MZ_FORMAT_ERROR|-103|File format error|
|
||||
|MZ_INTERNAL_ERROR|-104|Library internal error|
|
||||
|MZ_CRC_ERROR|-105|CRC error|
|
||||
|MZ_CRYPT_ERROR|-106|Cryptography error|
|
||||
|MZ_EXIST_ERROR|-107|Does not exist error|
|
||||
|MZ_PASSWORD_ERROR|-108|Invalid password error|
|
||||
|MZ_SUPPORT_ERROR|-109|Library support error|
|
||||
|MZ_HASH_ERROR|-110|Hash error|
|
||||
|MZ_OPEN_ERROR|-111|Stream open error|
|
||||
|MZ_CLOSE_ERROR|-112|Stream close error|
|
||||
|MZ_SEEK_ERROR|-113|Stream seek error|
|
||||
|MZ_TELL_ERROR|-114|Stream tell error|
|
||||
|MZ_READ_ERROR|-115|Stream read error|
|
||||
|MZ_WRITE_ERROR|-116|Stream write error|
|
||||
|MZ_SIGN_ERROR|-117|Signing error|
|
||||
|MZ_SYMLINK_ERROR|-118|Symbolic link error|
|
||||
@@ -1,27 +0,0 @@
|
||||
# Extrafields
|
||||
|
||||
These are proposals for additional extrafields that are not in the ZIP specification.
|
||||
|
||||
## Hash (0x1a51)
|
||||
|
||||
|Size|Type|Description|
|
||||
|-|-|:-|
|
||||
|2|uint16_t|Algorithm|
|
||||
|2|uint16_t|Digest size|
|
||||
|*|uint8_t*|Digest|
|
||||
|
||||
|Value|Description|
|
||||
|-|:-|
|
||||
|10|MD5|
|
||||
|20|SHA1|
|
||||
|23|SHA256|
|
||||
|
||||
By default, the ZIP specification only includes a CRC hash of the uncompressed content. The Hash extrafield allows additional hash digests of the uncompressed content to be stored with the central directory or local file headers. If there are multiple Hash extrafields stored for an entry, they should be sorted in order of most secure to least secure. So that the first Hash extrafield that appears for the entry is always the one considered the most secure and the one used for signing.
|
||||
|
||||
## Central Directory (0xcdcd)
|
||||
|
||||
|Size|Type|Description|
|
||||
|-|-|:-|
|
||||
|8|uint64_t|Number of entries|
|
||||
|
||||
If the zip entry is the central directory for the archive, then this record contains information about that central directory.
|
||||
@@ -1,12 +0,0 @@
|
||||
# MZ_HASH
|
||||
|
||||
Hash algorithm enumeration. The _mz_zip_reader_ and _mz_zip_writer_ instances support storing more secure hash algorithms for each zip entry.
|
||||
|
||||
|Name|Code|Description|
|
||||
|-|-|-|
|
||||
|MZ_HASH_MD5|10|MD5 algorithm identifier|
|
||||
|MZ_HASH_MD5_SIZE|16|MD5 digest size|
|
||||
|MZ_HASH_SHA1|20|SHA1 algorithm identifier|
|
||||
|MZ_HASH_SHA1_SIZE|20|SHA1 digest size|
|
||||
|MZ_HASH_SHA256|23|SHA256 algorithm identifer|
|
||||
|MZ_HASH_SHA256_SIZE|32|SHA256 digest size|
|
||||
@@ -1,24 +0,0 @@
|
||||
# MZ_HOST_SYSTEM
|
||||
|
||||
Host system enumeration. These values correspond to section 4.4.2.2 of the [PKWARE zip app note](zip/appnote.txt).
|
||||
|
||||
|Name|Code|Description|
|
||||
|-|-|-|
|
||||
|MZ_HOST_SYSTEM_MSDOS|0|MS-DOS|
|
||||
|MZ_HOST_SYSTEM_UNIX|3|UNIX|
|
||||
|MZ_HOST_SYSTEM_WINDOWS_NTFS|10|Windows NTFS|
|
||||
|MZ_HOST_SYSTEM_RISCOS|13|RISC OS|
|
||||
|MZ_HOST_SYSTEM_OSX_DARWIN|19|Darwin|
|
||||
|
||||
The host system information is available in the _version_madeby_ field in _mz_zip_file_.
|
||||
|
||||
**Example**
|
||||
```
|
||||
mz_zip_file *file_info = NULL;
|
||||
mz_zip_entry_get_info(zip_handle, &file_info);
|
||||
int32_t host_sys = MZ_HOST_SYSTEM(file_info->version_madeby);
|
||||
printf("Host system value: %d\n", host_sys);
|
||||
if (host_sys == MZ_HOST_SYSTEM_MSDOS) {
|
||||
printf("Zip entry attributes are MS-DOS compatible\n");
|
||||
}
|
||||
```
|
||||
@@ -1,12 +0,0 @@
|
||||
# MZ_OPEN
|
||||
|
||||
Stream open flag enumeration.
|
||||
|
||||
|Name|Code|Description|
|
||||
|-|-|-|
|
||||
|MZ_OPEN_MODE_READ|0x01|Open for reading|
|
||||
|MZ_OPEN_MODE_WRITE|0x02|Open for writing|
|
||||
|MZ_OPEN_MODE_READWRITE|0x03|Open for reading and writing|
|
||||
|MZ_OPEN_MODE_APPEND|0x04|Open for appending|
|
||||
|MZ_OPEN_MODE_CREATE|0x08|Open for creating|
|
||||
|MZ_OPEN_MODE_EXISTING|0x10|Open existing|
|
||||
-859
@@ -1,859 +0,0 @@
|
||||
# MZ_OS <!-- omit in toc -->
|
||||
|
||||
These functions provide support for handling common file system operations.
|
||||
|
||||
- [Path](#path)
|
||||
- [mz_path_combine](#mz_path_combine)
|
||||
- [mz_path_append_slash](#mz_path_append_slash)
|
||||
- [mz_path_remove_slash](#mz_path_remove_slash)
|
||||
- [mz_path_has_slash](#mz_path_has_slash)
|
||||
- [mz_path_convert_slashes](#mz_path_convert_slashes)
|
||||
- [mz_path_compare_wc](#mz_path_compare_wc)
|
||||
- [mz_path_resolve](#mz_path_resolve)
|
||||
- [mz_path_remove_filename](#mz_path_remove_filename)
|
||||
- [mz_path_remove_extension](#mz_path_remove_extension)
|
||||
- [mz_path_get_filename](#mz_path_get_filename)
|
||||
- [Directory](#directory)
|
||||
- [mz_dir_make](#mz_dir_make)
|
||||
- [File](#file)
|
||||
- [mz_file_get_crc](#mz_file_get_crc)
|
||||
- [Operating System](#operating-system)
|
||||
- [mz_os_unicode_string_create](#mz_os_unicode_string_create)
|
||||
- [mz_os_unicode_string_delete](#mz_os_unicode_string_delete)
|
||||
- [mz_os_utf8_string_create](#mz_os_utf8_string_create)
|
||||
- [mz_os_utf8_string_delete](#mz_os_utf8_string_delete)
|
||||
- [mz_os_rand](#mz_os_rand)
|
||||
- [mz_os_rename](#mz_os_rename)
|
||||
- [mz_os_unlink](#mz_os_unlink)
|
||||
- [mz_os_file_exists](#mz_os_file_exists)
|
||||
- [mz_os_get_file_size](#mz_os_get_file_size)
|
||||
- [mz_os_get_file_date](#mz_os_get_file_date)
|
||||
- [mz_os_set_file_date](#mz_os_set_file_date)
|
||||
- [mz_os_get_file_attribs](#mz_os_get_file_attribs)
|
||||
- [mz_os_set_file_attribs](#mz_os_set_file_attribs)
|
||||
- [mz_os_make_dir](#mz_os_make_dir)
|
||||
- [mz_os_open_dir](#mz_os_open_dir)
|
||||
- [mz_os_read_dir](#mz_os_read_dir)
|
||||
- [mz_os_close_dir](#mz_os_close_dir)
|
||||
- [mz_os_is_dir](#mz_os_is_dir)
|
||||
- [mz_os_is_symlink](#mz_os_is_symlink)
|
||||
- [mz_os_make_symlink](#mz_os_make_symlink)
|
||||
- [mz_os_read_symlink](#mz_os_read_symlink)
|
||||
- [mz_os_ms_time](#mz_os_ms_time)
|
||||
|
||||
## Path
|
||||
|
||||
The _mz_path_ family of functions are helper functions used when constructing file system paths.
|
||||
|
||||
### mz_path_combine
|
||||
|
||||
Combines two paths.
|
||||
|
||||
**Arguments**
|
||||
|Type|Name|Description|
|
||||
|-|-|-|
|
||||
|char *|path|Base path|
|
||||
|const char *|join|Path to append|
|
||||
|int32_t|max_path|Maximum path buffer size|
|
||||
|
||||
**Return**
|
||||
|Type|Description|
|
||||
|-|-|
|
||||
|int32_t|[MZ_ERROR](mz_error.md) code, MZ_OK if successful|
|
||||
|
||||
**Example**
|
||||
```
|
||||
char path[120];
|
||||
strncat(path, "c:\\windows\\", sizeof(path));
|
||||
mz_path_combine(path, "temp", sizeof(path));
|
||||
printf("Combined path: %s\n", path);
|
||||
```
|
||||
|
||||
### mz_path_append_slash
|
||||
|
||||
Appends a path slash on to the end of the path. To get the path slash character for the compiler platform use _MZ_PATH_SLASH_PLATFORM_ preprocessor define.
|
||||
|
||||
**Arguments**
|
||||
|Type|Name|Description|
|
||||
|-|-|-|
|
||||
|char *|path|Path|
|
||||
|int32_t|max_path|Maximum bytes to store path|
|
||||
|char|slash|Path slash character|
|
||||
|
||||
**Return**
|
||||
|Type|Description|
|
||||
|-|-|
|
||||
|int32_t|[MZ_ERROR](mz_error.md) code, MZ_OK if successful|
|
||||
|
||||
**Example**
|
||||
```
|
||||
char path[120];
|
||||
strncat(path, "c:\\windows", sizeof(path));
|
||||
mz_path_append_slash(path, sizeof(path), MZ_PATH_SLASH_PLATFORM);
|
||||
printf("Path with end slash: %s\n", path);
|
||||
```
|
||||
|
||||
### mz_path_remove_slash
|
||||
|
||||
Removes a path slash from the end of the path.
|
||||
|
||||
**Arguments**
|
||||
|Type|Name|Description|
|
||||
|-|-|-|
|
||||
|char *|path|Path|
|
||||
|
||||
**Return**
|
||||
|Type|Description|
|
||||
|-|-|
|
||||
|int32_t|[MZ_ERROR](mz_error.md) code, MZ_OK if successful|
|
||||
|
||||
**Example**
|
||||
```
|
||||
char path[120];
|
||||
strncat(path, "c:\\windows\\", sizeof(path));
|
||||
mz_path_remove_slash(path);
|
||||
printf("Path with no slash: %s\n", path);
|
||||
```
|
||||
|
||||
### mz_path_has_slash
|
||||
|
||||
Returns whether or not the path ends with slash.
|
||||
|
||||
**Arguments**
|
||||
|Type|Name|Description|
|
||||
|-|-|-|
|
||||
|const char *|path|Path|
|
||||
|
||||
**Return**
|
||||
|Type|Description|
|
||||
|-|-|
|
||||
|int32_t|[MZ_ERROR](mz_error.md) code, MZ_OK if has slash.|
|
||||
|
||||
**Example**
|
||||
```
|
||||
const char *path = "c:\\windows\\";
|
||||
if (mz_path_has_slash(path) == MZ_OK)
|
||||
printf("Path ends with a slash\n");
|
||||
else
|
||||
printf("Path does not end with a slash\n");
|
||||
```
|
||||
|
||||
### mz_path_convert_slashes
|
||||
|
||||
Converts the slashes in a path. This can be used to convert all unix path slashes to windows path slashes or conver all windows path slashes to unix path slashes. If there are mixed slashes in the path, it can unify them to all one format.
|
||||
|
||||
**Arguments**
|
||||
|Type|Name|Description|
|
||||
|-|-|-|
|
||||
|char *|path|Path|
|
||||
|char|slash|Path slash character|
|
||||
|
||||
**Return**
|
||||
|Type|Description|
|
||||
|-|-|
|
||||
|int32_t|[MZ_ERROR](mz_error.md) code, MZ_OK if has slash.|
|
||||
|
||||
**Example**
|
||||
```
|
||||
char path[120];
|
||||
strncat(path, "c:\\windows\\", sizeof(path));
|
||||
if (mz_path_convert_slashes(path, MZ_PATH_SLASH_UNIX) == MZ_OK)
|
||||
printf("Path converted to unix slashes: %s\n", path);
|
||||
```
|
||||
|
||||
### mz_path_compare_wc
|
||||
|
||||
Compares two paths with a wildcard.
|
||||
|
||||
**Arguments**
|
||||
|Type|Name|Description|
|
||||
|-|-|-|
|
||||
|const char *|path|Path|
|
||||
|const char *|wildcard|Wildcard pattern|
|
||||
|uint8_t|ignore_case|Ignore case during comparison if 1.|
|
||||
|
||||
**Return**
|
||||
|Type|Description|
|
||||
|-|-|
|
||||
|int32_t|[MZ_ERROR](mz_error.md) code, MZ_OK if matched, MZ_EXIST_ERROR if not matched.|
|
||||
|
||||
**Example**
|
||||
```
|
||||
const char *path = "test.txt";
|
||||
if (mz_path_compare_wc(path, "*.txt", 0) == MZ_OK)
|
||||
printf("%s is a text file\n", path);
|
||||
else
|
||||
printf("%s is not a text file\n", path);
|
||||
```
|
||||
|
||||
### mz_path_resolve
|
||||
|
||||
Resolves a path. Path parts that only contain dots will be resolved. If a path part contains a single dot, it will be remoed. If a path part contains two dots, it will remove the last path part. This function can be used to prevent the _zipslip_ vulnerability and ensure that files are not written outside of their intended target.
|
||||
|
||||
**Arguments**
|
||||
|Type|Name|Description|
|
||||
|-|-|-|
|
||||
|const char *|path|Path|
|
||||
|char *|target|Resolved path character array|
|
||||
|int32_t|max_target|Maximum size of resolved path array|
|
||||
|
||||
**Return**
|
||||
|Type|Description|
|
||||
|-|-|
|
||||
|int32_t|[MZ_ERROR](mz_error.md) code, MZ_OK if successful|
|
||||
|
||||
**Example**
|
||||
```
|
||||
const char *path = "c:\\windows\\..\\";
|
||||
char target[120];
|
||||
mz_path_resolve(path, target, sizeof(target));
|
||||
printf("Resolved path: %s\n", target);
|
||||
```
|
||||
|
||||
### mz_path_remove_filename
|
||||
|
||||
Removes the filename from a path.
|
||||
|
||||
**Arguments**
|
||||
|Type|Name|Description|
|
||||
|-|-|-|
|
||||
|char *|path|Path|
|
||||
|
||||
**Return**
|
||||
|Type|Description|
|
||||
|-|-|
|
||||
|int32_t|[MZ_ERROR](mz_error.md) code, MZ_OK if successful|
|
||||
|
||||
**Example**
|
||||
```
|
||||
char path[120];
|
||||
strncpy(path, "c:\\windows\\test.txt", sizeof(path));
|
||||
printf("Path: %s\n", path);
|
||||
mz_path_remove_filename(path);
|
||||
printf("Path with no filename: %s\n", path);
|
||||
```
|
||||
|
||||
### mz_path_remove_extension
|
||||
|
||||
Remove the extension from a path.
|
||||
|
||||
**Arguments**
|
||||
|Type|Name|Description|
|
||||
|-|-|-|
|
||||
|char *|path|Path|
|
||||
|
||||
**Return**
|
||||
|Type|Description|
|
||||
|-|-|
|
||||
|int32_t|[MZ_ERROR](mz_error.md) code, MZ_OK if successful|
|
||||
|
||||
**Example**
|
||||
```
|
||||
char path[120];
|
||||
strncpy(path, "c:\\windows\\test.txt", sizeof(path));
|
||||
printf("Path: %s\n", path);
|
||||
mz_path_remove_extension(path);
|
||||
printf("Path with no file extension: %s\n", path);
|
||||
```
|
||||
|
||||
### mz_path_get_filename
|
||||
|
||||
Get the filename from a path.
|
||||
|
||||
**Arguments**
|
||||
|Type|Name|Description|
|
||||
|-|-|-|
|
||||
|const char *|path|Path|
|
||||
|const char **|filename|Pointer to filename string|
|
||||
|
||||
**Return**
|
||||
|Type|Description|
|
||||
|-|-|
|
||||
|int32_t|[MZ_ERROR](mz_error.md) code, MZ_OK if successful|
|
||||
|
||||
**Example**
|
||||
```
|
||||
const char *path = "c:\\windows\\test.txt";
|
||||
const char *filename = NULL;
|
||||
printf("Path: %s\n", path);
|
||||
if (mz_path_get_filename(path, &filename) == MZ_OK)
|
||||
printf("Filename: %s\n", filename);
|
||||
else
|
||||
printf("Path has no filename\n");
|
||||
```
|
||||
|
||||
## Directory
|
||||
|
||||
### mz_dir_make
|
||||
|
||||
Creates a directory recursively.
|
||||
|
||||
**Arguments**
|
||||
|Type|Name|Description|
|
||||
|-|-|-|
|
||||
|const char *|path|Path|
|
||||
|
||||
**Return**
|
||||
|Type|Description|
|
||||
|-|-|
|
||||
|int32_t|[MZ_ERROR](mz_error.md) code, MZ_OK if successful|
|
||||
|
||||
**Example**
|
||||
```
|
||||
const char *path = "c:\\temp\\x\\y\\z\\";
|
||||
if (mz_dir_make(path) == MZ_OK)
|
||||
printf("Dir was created: %s\n", path);
|
||||
else
|
||||
printf("Dir was not created: %s\n", path);
|
||||
```
|
||||
|
||||
## File
|
||||
|
||||
### mz_file_get_crc
|
||||
|
||||
Gets the crc32 hash of a file. This function helps provide functional backwards compatibility.
|
||||
|
||||
**Arguments**
|
||||
|Type|Name|Description|
|
||||
|-|-|-|
|
||||
|const char *|path|Path to calculate CRC value for|
|
||||
|uint32_t *|result_crc|Pointer to store the calculated CRC value|
|
||||
|
||||
**Return**
|
||||
|Type|Description|
|
||||
|-|-|
|
||||
|int32_t|[MZ_ERROR](mz_error.md) code, MZ_OK if successful|
|
||||
|
||||
**Example**
|
||||
```
|
||||
const char *path = "c:\\temp\\test.txt";
|
||||
uint32_t crc = 0;
|
||||
if (mz_file_get_crc(path, &crc) == MZ_OK)
|
||||
printf("File %s CRC: %08x\n", path, crc);
|
||||
else
|
||||
printf("Failed to calculate CRC: %s\n", path);
|
||||
```
|
||||
|
||||
## Operating System
|
||||
|
||||
The _mz_os_ family of functions wrap all platform specific code necessary to zip and unzip files.
|
||||
|
||||
### mz_os_unicode_string_create
|
||||
|
||||
Create unicode string from a string with another encoding.
|
||||
|
||||
**Arguments**
|
||||
|Type|Name|Description|
|
||||
|-|-|-|
|
||||
|const char *|string|String to convert|
|
||||
|int32_t|encoding|String encoding (See [MZ_ENCODING](mz_encoding.md))|
|
||||
|
||||
**Return**
|
||||
|Type|Description|
|
||||
|-|-|
|
||||
|wchar_t *|Returns pointer to unicode string if successful, otherwise NULL.|
|
||||
|
||||
**Example**
|
||||
```
|
||||
char *test = "test";
|
||||
wchar_t *test_unicode = mz_os_unicode_string_create(test, MZ_ENCODING_UTF8);
|
||||
if (test_unicode) {
|
||||
printf("Unicode test string created\n");
|
||||
mz_os_unicode_string_delete(&test_unicode);
|
||||
}
|
||||
```
|
||||
|
||||
### mz_os_unicode_string_delete
|
||||
|
||||
Delete a unicode string that was created with _mz_os_unicode_string_create_.
|
||||
|
||||
**Arguments**
|
||||
|Type|Name|Description|
|
||||
|-|-|-|
|
||||
|wchar_t **|string|Pointer to unicode string|
|
||||
|
||||
**Example**
|
||||
```
|
||||
char *test = "test";
|
||||
wchar_t *test_unicode = mz_os_unicode_string_create(test, MZ_ENCODING_UTF8);
|
||||
if (test_unicode) {
|
||||
printf("Unicode test string created\n");
|
||||
mz_os_unicode_string_delete(&test_unicode);
|
||||
}
|
||||
```
|
||||
|
||||
### mz_os_utf8_string_create
|
||||
|
||||
Create a utf8 string from a string with another encoding.
|
||||
|
||||
**Arguments**
|
||||
|Type|Name|Description|
|
||||
|-|-|-|
|
||||
|const char *|string|String to convert|
|
||||
|int32_t|encoding|String encoding (See [MZ_ENCODING](mz_encoding.md))|
|
||||
|
||||
**Return**
|
||||
|Type|Description|
|
||||
|-|-|
|
||||
|char *|Returns pointer to UTF-8 encoded string if successful, otherwise NULL.|
|
||||
|
||||
**Example**
|
||||
```
|
||||
char *test = "test";
|
||||
char *test_utf8 = mz_os_utf8_string_create(test, MZ_ENCODING_CODEPAGE_437);
|
||||
if (test_utf8) {
|
||||
printf("UTF-8 test string created\n");
|
||||
mz_os_utf8_string_delete(&test_utf8);
|
||||
}
|
||||
```
|
||||
|
||||
### mz_os_utf8_string_delete
|
||||
|
||||
Delete a utf8 string that was created with _mz_os_utf8_string_create_.
|
||||
|
||||
**Arguments**
|
||||
|Type|Name|Description|
|
||||
|-|-|-|
|
||||
|char **|string|Pointer to utf8 encoded string|
|
||||
|
||||
**Example**
|
||||
```
|
||||
char *test = "test";
|
||||
char *test_utf8 = mz_os_utf8_string_create(test, MZ_ENCODING_CODEPAGE_437);
|
||||
if (test_utf8) {
|
||||
printf("UTF-8 test string created\n");
|
||||
mz_os_utf8_string_delete(&test_utf8);
|
||||
}
|
||||
```
|
||||
|
||||
### mz_os_rand
|
||||
|
||||
Random number generator (not cryptographically secure). For a cryptographically secure random number generator use _mz_crypt_rand_.
|
||||
|
||||
**Arguments**
|
||||
|Type|Name|Description|
|
||||
|-|-|-|
|
||||
|uint8_t *|buf|Buffer to fill with random data|
|
||||
|int32_t|size|Maximum size of buffer array|
|
||||
|
||||
**Return**
|
||||
|Type|Description|
|
||||
|-|-|
|
||||
|int32_t|[MZ_ERROR](mz_error.md) code, MZ_OK if successful|
|
||||
|
||||
**Example**
|
||||
```
|
||||
uint8_t buf[120];
|
||||
if (mz_os_rand(buf, sizeof(buf)) == MZ_OK)
|
||||
printf("%d bytes of random data generated\n", sizeof(buf));
|
||||
```
|
||||
|
||||
### mz_os_rename
|
||||
|
||||
Rename a file.
|
||||
|
||||
**Arguments**
|
||||
|Type|Name|Description|
|
||||
|-|-|-|
|
||||
|const char *|source_path|Original path|
|
||||
|const char *|target_path|New path|
|
||||
|
||||
**Return**
|
||||
|Type|Description|
|
||||
|-|-|
|
||||
|int32_t|[MZ_ERROR](mz_error.md) code, MZ_OK if successful|
|
||||
|
||||
**Example**
|
||||
```
|
||||
if (mz_os_rename("c:\\test1.txt", "c:\\test2.txt") == MZ_OK)
|
||||
printf("File was renamed successfully\n");
|
||||
```
|
||||
|
||||
### mz_os_unlink
|
||||
|
||||
Delete an existing file.
|
||||
|
||||
**Arguments**
|
||||
|Type|Name|Description|
|
||||
|-|-|-|
|
||||
|const char *|path|File path|
|
||||
|
||||
**Return**
|
||||
|Type|Description|
|
||||
|-|-|
|
||||
|int32_t|[MZ_ERROR](mz_error.md) code, MZ_OK if successful|
|
||||
|
||||
**Example**
|
||||
```
|
||||
if (mz_os_unlink("c:\\test2.txt") == MZ_OK)
|
||||
printf("File was deleted successfully\n");
|
||||
```
|
||||
|
||||
### mz_os_file_exists
|
||||
|
||||
Check to see if a file exists.
|
||||
|
||||
**Arguments**
|
||||
|Type|Name|Description|
|
||||
|-|-|-|
|
||||
|const char *|path|File path|
|
||||
|
||||
**Return**
|
||||
|Type|Description|
|
||||
|-|-|
|
||||
|int32_t|[MZ_ERROR](mz_error.md) code, MZ_OK if successful|
|
||||
|
||||
**Example**
|
||||
```
|
||||
const char *path = "c:\\test2.txt";
|
||||
if (mz_os_file_exists(path) == MZ_OK)
|
||||
printf("File %s exists\n", path);
|
||||
else
|
||||
printf("File %s does not exist\n", path);
|
||||
```
|
||||
|
||||
### mz_os_get_file_size
|
||||
|
||||
Gets the length of a file.
|
||||
|
||||
**Arguments**
|
||||
|Type|Name|Description|
|
||||
|-|-|-|
|
||||
|const char *|path|File path|
|
||||
|
||||
**Return**
|
||||
|Type|Description|
|
||||
|-|-|
|
||||
|int64_t|Size of file, does not check for existence of file.|
|
||||
|
||||
**Example**
|
||||
```
|
||||
const char *path = "c:\\test3.txt";
|
||||
if (mz_os_file_exists(path) == MZ_OK) {
|
||||
int64_t file_size = mz_os_get_file_size(path);
|
||||
printf("File %s size %lld\n", path, file_size);
|
||||
} else {
|
||||
printf("File %s does not exist\n", path);
|
||||
}
|
||||
```
|
||||
|
||||
### mz_os_get_file_date
|
||||
|
||||
Gets a file's modified, access, and creation dates if supported. Creation date is not supported on Linux based systems and zero is returned for _creation_date_ on those systems.
|
||||
|
||||
**Arguments**
|
||||
|Type|Name|Description|
|
||||
|-|-|-|
|
||||
|const char *|path|File path|
|
||||
|time_t *|modified_date|Pointer to store file's modified unix timestamp|
|
||||
|time_t *|accessed_date|Pointer to store file's accessed unix timestamp|
|
||||
|time_t *|creation_date|Pointer to store file's creation unix timestamp|
|
||||
|
||||
**Return**
|
||||
|Type|Description|
|
||||
|-|-|
|
||||
|int32_t|[MZ_ERROR](mz_error.md) code, MZ_OK if successful|
|
||||
|
||||
**Example**
|
||||
```
|
||||
const char *path = "c:\\test4.txt";
|
||||
time_t modified_date, accessed_date, creation_date;
|
||||
if (mz_os_get_file_date(path, &modified_date, &accessed_date, &creation_date) == MZ_OK)
|
||||
printf("File %s modified %lld accessed %lld creation %lld\n", path, modified_date, accessed_date, creation_date);
|
||||
```
|
||||
|
||||
### mz_os_set_file_date
|
||||
|
||||
Sets a file's modified, access, and creation dates if supported. Creation date is not supported on Linux based systems.
|
||||
|
||||
**Arguments**
|
||||
|Type|Name|Description|
|
||||
|-|-|-|
|
||||
|const char *|path|File path|
|
||||
|time_t|modified_date|File's modified unix timestamp|
|
||||
|time_t|accessed_date|File's accessed unix timestamp|
|
||||
|time_t|creation_date|File's creation unix timestamp|
|
||||
|
||||
**Return**
|
||||
|Type|Description|
|
||||
|-|-|
|
||||
|int32_t|[MZ_ERROR](mz_error.md) code, MZ_OK if successful|
|
||||
|
||||
**Example**
|
||||
```
|
||||
const char *src_path = "c:\\test4.txt";
|
||||
const char *target_path = "c:\\test5.txt";
|
||||
time_t modified_date, accessed_date, creation_date;
|
||||
if (mz_os_get_file_date(src_path, &modified_date, &accessed_date, &creation_date) == MZ_OK) {
|
||||
printf("Source file %s modified %lld accessed %lld creation %lld\n", path, modified_date, accessed_date, creation_date);
|
||||
if (mz_os_set_file_date(target_path, modified_date, accessed_date, creation_date) == MZ_OK) {
|
||||
printf("Target file dates changed successfully\n");
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### mz_os_get_file_attribs
|
||||
|
||||
Gets a file's attributes.
|
||||
|
||||
**Arguments**
|
||||
|Type|Name|Description|
|
||||
|-|-|-|
|
||||
|const char *|path|File path|
|
||||
|uint32_t *|attributes|Pointer to store file attributes value|
|
||||
|
||||
**Return**
|
||||
|Type|Description|
|
||||
|-|-|
|
||||
|int32_t|[MZ_ERROR](mz_error.md) code, MZ_OK if successful|
|
||||
|
||||
**Example**
|
||||
```
|
||||
const char *path = "c:\\test6.txt";
|
||||
uint32_t attributes = 0;
|
||||
if (mz_os_get_file_attribs(path, &attributes) == MZ_OK)
|
||||
printf("File %s attributes %08x\n", attributes);
|
||||
```
|
||||
|
||||
### mz_os_set_file_attribs
|
||||
|
||||
Sets a file's attributes.
|
||||
|
||||
**Arguments**
|
||||
|Type|Name|Description|
|
||||
|-|-|-|
|
||||
|const char *|path|File path|
|
||||
|uint32_t|attributes|File attributes value|
|
||||
|
||||
**Return**
|
||||
|Type|Description|
|
||||
|-|-|
|
||||
|int32_t|[MZ_ERROR](mz_error.md) code, MZ_OK if successful|
|
||||
|
||||
**Example**
|
||||
```
|
||||
const char *path = "c:\\test6.txt";
|
||||
uint32_t attributes = 0;
|
||||
if (mz_os_get_file_attribs(path, &attributes) == MZ_OK) {
|
||||
printf("File %s attributes %08x\n", attributes);
|
||||
attributes |= FILE_ATTRIBUTE_READONLY;
|
||||
if (mz_os_set_file_attribs(path, attributes) == MZ_OK) {
|
||||
printf("File changed to readonly\n");
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### mz_os_make_dir
|
||||
|
||||
Creates a directory. To recursively create a directory use _mz_dir_make_.
|
||||
|
||||
**Arguments**
|
||||
|Type|Name|Description|
|
||||
|-|-|-|
|
||||
|const char *|path|Directory path|
|
||||
|
||||
**Return**
|
||||
|Type|Description|
|
||||
|-|-|
|
||||
|int32_t|[MZ_ERROR](mz_error.md) code, MZ_OK if successful|
|
||||
|
||||
**Example**
|
||||
```
|
||||
if (mz_os_make_dir("c:\\testdir\\") == MZ_OK)
|
||||
printf("Test directory created\n");
|
||||
```
|
||||
|
||||
### mz_os_open_dir
|
||||
|
||||
Opens a directory for listing.
|
||||
|
||||
**Arguments**
|
||||
|Type|Name|Description|
|
||||
|-|-|-|
|
||||
|const char *|path|Directory path|
|
||||
|
||||
**Return**
|
||||
|Type|Description|
|
||||
|-|-|
|
||||
|DIR *|Directory enumeration handle, returns NULL if error.|
|
||||
|
||||
**Example**
|
||||
```
|
||||
const char *search_dir = "c:\\test1\\";
|
||||
DIR *dir = mz_open_dir(search_dir);
|
||||
if (dir) {
|
||||
printf("Dir %s was opened\n", search_dir);
|
||||
mz_os_close_dir(dir);
|
||||
}
|
||||
```
|
||||
|
||||
### mz_os_read_dir
|
||||
|
||||
Reads a directory listing entry.
|
||||
|
||||
**Arguments**
|
||||
|Type|Name|Description|
|
||||
|-|-|-|
|
||||
|DIR *|dir|Directory enumeration handle|
|
||||
|
||||
**Return**
|
||||
|Type|Description|
|
||||
|-|-|
|
||||
|struct dirent *|Pointer to directory entry information structure. To get the name of the directory use the _d_name_ structure field.|
|
||||
|
||||
**Example**
|
||||
```
|
||||
const char *search_dir = "c:\\test2\\";
|
||||
DIR *dir = mz_open_dir(search_dir);
|
||||
if (dir) {
|
||||
struct dirent *entry = NULL;
|
||||
printf("Dir %s was opened\n", search_dir);
|
||||
while ((entry = mz_os_read_dir(dir))) {
|
||||
printf("Dir entry: %s was opened\n", entry->d_name);
|
||||
}
|
||||
mz_os_close_dir(dir);
|
||||
}
|
||||
```
|
||||
|
||||
### mz_os_close_dir
|
||||
|
||||
Closes a directory that has been opened for listing.
|
||||
|
||||
**Arguments**
|
||||
|Type|Name|Description|
|
||||
|-|-|-|
|
||||
|DIR *|dir|Directory enumeration handle|
|
||||
|
||||
**Return**
|
||||
|Type|Description|
|
||||
|-|-|
|
||||
|int32_t|[MZ_ERROR](mz_error.md) code, MZ_OK if successful|
|
||||
|
||||
**Example**
|
||||
```
|
||||
const char *search_dir = "c:\\test3\\";
|
||||
DIR *dir = mz_open_dir(search_dir);
|
||||
if (dir) {
|
||||
struct dirent *entry = NULL;
|
||||
printf("Dir %s was opened\n", search_dir);
|
||||
while ((entry = mz_os_read_dir(dir))) {
|
||||
printf("Dir entry: %s was opened\n", entry->d_name);
|
||||
}
|
||||
mz_os_close_dir(dir);
|
||||
}
|
||||
```
|
||||
|
||||
### mz_os_is_dir
|
||||
|
||||
Checks to see if path is a directory.
|
||||
|
||||
**Arguments**
|
||||
|Type|Name|Description|
|
||||
|-|-|-|
|
||||
|const char *|path|File system path|
|
||||
|
||||
**Return**
|
||||
|Type|Description|
|
||||
|-|-|
|
||||
|int32_t|[MZ_ERROR](mz_error.md) code, MZ_OK if it is a directory.|
|
||||
|
||||
**Example**
|
||||
```
|
||||
const char *path = "c:\\test7.txt";
|
||||
if (mz_os_is_dir(path) == MZ_OK)
|
||||
printf("Path %s is a directory\n", path);
|
||||
else
|
||||
printf("Path %s is not a directory\n", path);
|
||||
```
|
||||
|
||||
### mz_os_is_symlink
|
||||
|
||||
Checks to see if path is a symbolic link.
|
||||
|
||||
**Arguments**
|
||||
|Type|Name|Description|
|
||||
|-|-|-|
|
||||
|const char *|path|File system path|
|
||||
|
||||
**Return**
|
||||
|Type|Description|
|
||||
|-|-|
|
||||
|int32_t|[MZ_ERROR](mz_error.md) code, MZ_OK if it is a symbolic link.|
|
||||
|
||||
**Example**
|
||||
```
|
||||
const char *path = "c:\\test7.txt";
|
||||
if (mz_os_is_symlink(path) == MZ_OK)
|
||||
printf("Path %s is a symbolic link\n", path);
|
||||
else
|
||||
printf("Path %s is not a symbolic link\n", path);
|
||||
```
|
||||
|
||||
### mz_os_make_symlink
|
||||
|
||||
Creates a symbolic link pointing to a target.
|
||||
|
||||
**Arguments**
|
||||
|Type|Name|Description|
|
||||
|-|-|-|
|
||||
|const char *|path|Link path|
|
||||
|const char *|target_path|Actual path|
|
||||
|
||||
**Return**
|
||||
|Type|Description|
|
||||
|-|-|
|
||||
|int32_t|[MZ_ERROR](mz_error.md) code, MZ_OK if successful|
|
||||
|
||||
**Example**
|
||||
```
|
||||
const char *path = "c:\\test7.txt";
|
||||
const char *target_path = "c:\\test8.txt";
|
||||
if (mz_os_make_symlink(path, target_path) == MZ_OK)
|
||||
printf("Symbolic link created at %s pointing to %s\n", path, target_path);
|
||||
```
|
||||
|
||||
### mz_os_read_symlink
|
||||
|
||||
Gets the target path for a symbolic link.
|
||||
|
||||
**Arguments**
|
||||
|Type|Name|Description|
|
||||
|-|-|-|
|
||||
|const char *|path|Link path|
|
||||
|char *|target_path|Actual path|
|
||||
|int32_t|max_path|Maximum bytes to store actual path|
|
||||
|
||||
**Return**
|
||||
|Type|Description|
|
||||
|-|-|
|
||||
|int32_t|[MZ_ERROR](mz_error.md) code, MZ_OK if successful|
|
||||
|
||||
**Example**
|
||||
```
|
||||
const char *path = "c:\\test7.txt";
|
||||
const char *target_path = "c:\\test8.txt";
|
||||
if (mz_os_make_symlink(path, target_path) == MZ_OK) {
|
||||
char actual_path[120];
|
||||
printf("Symbolic link created at %s pointing to %s\n", path, target_path);
|
||||
if (mz_os_read_symlink(path, actual_path, sizeof(actual_path)) == MZ_OK) {
|
||||
if (strcmp(target_path, actual_path) == 0) {
|
||||
printf("Confirmed symbolic link created\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### mz_os_ms_time
|
||||
|
||||
Gets the time in milliseconds.
|
||||
|
||||
**Return**
|
||||
|Type|Description|
|
||||
|-|-|
|
||||
|uint64_t|Current time in milliseconds|
|
||||
|
||||
**Example**
|
||||
```
|
||||
uint64_t current_time = mz_os_ms_time();
|
||||
printf("Current time in %lldms\n", current_time);
|
||||
```
|
||||
@@ -1,9 +0,0 @@
|
||||
# MZ_SEEK
|
||||
|
||||
Stream seek origin enumeration.
|
||||
|
||||
|Name|Code|Description|
|
||||
|-|-|-|
|
||||
|MZ_SEEK_SET|0|Seek from beginning|
|
||||
|MZ_SEEK_CUR|1|Seek from current position|
|
||||
|MZ_SEEK_END|2|Seek from end|
|
||||
-1597
File diff suppressed because it is too large
Load Diff
@@ -1,9 +0,0 @@
|
||||
# MZ_ZIP64
|
||||
|
||||
Zip64 mode enumeration. The zip64 extension is documented in [PKWARE zip app note](zip/appnote.txt) section 4.5.3 and provides support for zip files and entries greater than 4GB. These modes are only supported while writing a zip entry.
|
||||
|
||||
|Name|Code|Description|
|
||||
|-|-|-|
|
||||
|MZ_ZIP64_AUTO|0|Only store and use zip64 extrafield if compressed size, uncompressed size, or disk offset is greater than -UINT32_MAX_.|
|
||||
|MZ_ZIP64_FORCE|1|Always use and store zip64 extrafield even if it is not necessary.|
|
||||
|MZ_ZIP64_DISABLE|2|Never use or store zip64 extrafield. If zip64 is required to write the entry it will result in MZ_PARAM_ERROR.|
|
||||
@@ -1,79 +0,0 @@
|
||||
# MZ_ZIP_FILE
|
||||
|
||||
Zip entry information structure. The _mz_zip_file_ structure is populated when reading zip entry information and can be used to populate zip entry information when writing zip entries.
|
||||
|
||||
|Type|Name|Description|[PKWARE zip app note](zip/appnote.txt) section|
|
||||
|-|-|-|-|
|
||||
|uint16_t|version_madeby|Version made by field|4.4.2|
|
||||
|uint16_t|version_needed|Version needed to extract|4.4.3|
|
||||
|uint16_t|flag|General purpose bit flag|4.4.4|
|
||||
|uint16_t|compression_method|Compression method|4.4.5 [MZ_COMPRESS_METHOD](mz_compress_method.md)|
|
||||
|time_t|modified_date|Last modified unix timestamp|4.4.6, 4.5.5, 4.5.7|
|
||||
|time_t|accessed_date|Last accessed unix timestamp|4.5.5, 4.5.7|
|
||||
|time_t|creation_date|Creation date unix timestamp|4.5.5|
|
||||
|uint32_t|crc|CRC32-B hash of uncompressed data|4.4.7|
|
||||
|int64_t|compressed_size|Compressed size|4.4.8|
|
||||
|int64_t|uncompressed_size|Uncompressed size|4.4.9|
|
||||
|uint16_t|filename_size|Filename length|4.4.10|
|
||||
|uint16_t|extrafield_size|Extrafield length|4.4.11|
|
||||
|uint16_t|comment_size|Comment size|4.4.12|
|
||||
|uint32_t|disk_number|Starting disk number|4.4.13|
|
||||
|int64_t|disk_offset|Starting disk offset|4.4.16|
|
||||
|uint16_t|internal_fa|Internal file attributes|4.4.14|
|
||||
|uint16_t|external_fa|External file attributes|4.4.15|
|
||||
|const char *|filename|Filename UTF-8 null-terminated string|4.4.17|
|
||||
|const uint8_t *|extrafield|Extrafield buffer array|4.4.28|
|
||||
|const char *|comment|Comment UTF-8 null-terminated string|4.4.18|
|
||||
|uint16_t|zip64|Zip64 extension mode|[MZ_ZIP64](mz_zip64.md)|
|
||||
|uint16_t|aes_version|WinZip AES version|[WinZip AES App Note](zip/winzip_aes.md)|
|
||||
|uint8_t|aes_strength|WinZip AES encryption strength|[WinZip AES App Note](zip/winzip_aes.md)|
|
||||
|
||||
For more information about each field please consult the referenced app note section.
|
||||
|
||||
## Extended Notes
|
||||
|
||||
### verison_madeby
|
||||
|
||||
> The upper byte indicates the compatibility of the file attribute information... The lower byte indicates the ZIP specification version... supported by the software used to encode the file.
|
||||
|
||||
The preprocessor define `MZ_VERSION_MADEBY` contains the version made by value for the current compiler runtime. To get the file attribute information use the preprocessor define `MZ_HOST_SYSTEM(version_madeby)`.
|
||||
|
||||
### version_needed
|
||||
|
||||
When writing zip entries, this will automatically be filled in if the value is zero.
|
||||
|
||||
### flag
|
||||
|
||||
|Flag|Value|Description|
|
||||
|-|-|-|
|
||||
| MZ_ZIP_FLAG_ENCRYPTED | 0x1 | Entry is encrypted. If using AES encryption `aes_version` needs to be set to `MZ_AES_VERSION` |
|
||||
| MZ_ZIP_FLAG_LZMA_EOS_MARKER | 0x2 | Entry contains LZMA end of stream marker |
|
||||
| MZ_ZIP_FLAG_DEFLATE_MAX | 0x2 | Entry compressed with deflate max algorithm |
|
||||
| MZ_ZIP_FLAG_DEFLATE_NORMAL | 0 | Entry compressed with deflate normal algorithm |
|
||||
| MZ_ZIP_FLAG_DEFLATE_FAST | 0x4 | Entry compressed with deflate fast algorithm |
|
||||
| MZ_ZIP_FLAG_DEFLATE_SUPER_FAST | MAX + FAST | Entry compressed with deflate super fast algorithm |
|
||||
| MZ_ZIP_FLAG_DATA_DESCRIPTOR | 0x08 | Entry contains data descriptor bytes at the end of the compressed content which contain the compressed and uncompressed size. Local file header contains zeros for these values. |
|
||||
| MZ_ZIP_FLAG_UTF8 | 0x800 | Entry filename is UTF-8 encoded |
|
||||
| MZ_ZIP_FLAG_MASK_LOCAL_INFO | 0x2000 | Local file header info is masked |
|
||||
|
||||
### creation_date
|
||||
|
||||
Creation date is only supported on Windows.
|
||||
|
||||
### external_fa
|
||||
|
||||
External file attributes. These attributes are native host system attribute values for the entry. To get the host system use `MZ_HOST_SYSTEM(version_madeby)`. It is possible to convert from one host system's attributes to another using `mz_zip_attrib_convert`.
|
||||
|
||||
### aes_version
|
||||
|
||||
This attribute must be set to `MZ_AES_VERSION` when AES encryption is used.
|
||||
|
||||
### aes_strength
|
||||
|
||||
AES encryption strength, by default 256-bit encryption is used for compression.
|
||||
|
||||
|Flag|Value|Description|
|
||||
|-|-|-|
|
||||
| MZ_AES_STRENGTH_128 | 0x01 | 128-bit AES encryption |
|
||||
| MZ_AES_STRENGTH_192 | 0x02 | 192-bit AES encryption |
|
||||
| MZ_AES_STRENGTH_256 | 0x03 | 256-bit AES encryption |
|
||||
-1992
File diff suppressed because it is too large
Load Diff
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user