mirror of
https://git.mirrors.martin98.com/https://github.com/gulrak/filesystem
synced 2025-09-19 23:23:13 +08:00
Compare commits
501 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
9fda7b0afb | ||
![]() |
076592ce6e | ||
![]() |
157feb3651 | ||
![]() |
f08e8b0064 | ||
![]() |
99c3500205 | ||
![]() |
f43846877b | ||
![]() |
b1982f06c8 | ||
![]() |
fbc5d213fc | ||
![]() |
72a03b3c6d | ||
![]() |
9fe68b91c7 | ||
![]() |
56776c92f7 | ||
![]() |
42ea4fc615 | ||
![]() |
eeed314237 | ||
![]() |
768b5cb11b | ||
![]() |
2fc4b46375 | ||
![]() |
fc19b58459 | ||
![]() |
f19cbbbd31 | ||
![]() |
0ef214a7a0 | ||
![]() |
fcea331ebb | ||
![]() |
1ab54e53cc | ||
![]() |
58e983167c | ||
![]() |
c4683aa4a1 | ||
![]() |
144954ff4e | ||
![]() |
48d46cccef | ||
![]() |
23710d3b56 | ||
![]() |
64f9c5a61a | ||
![]() |
a55c96a2ba | ||
![]() |
aaaf381d9d | ||
![]() |
72a76d774e | ||
![]() |
e5ae1bd3e3 | ||
![]() |
8a2edd6d92 | ||
![]() |
e9e32f8830 | ||
![]() |
9f61ee0eb5 | ||
![]() |
d1f0d79054 | ||
![]() |
61176cd82a | ||
![]() |
78b746d901 | ||
![]() |
9df22d5396 | ||
![]() |
9ffca3839f | ||
![]() |
2a81c2c355 | ||
![]() |
e3341b2f64 | ||
![]() |
6a94e84da4 | ||
![]() |
a7a6d930fb | ||
![]() |
7da9be91c9 | ||
![]() |
e6b34e29bf | ||
![]() |
b1ff2ce95e | ||
![]() |
3afbd9c315 | ||
![]() |
de64decd91 | ||
![]() |
f3c1058928 | ||
![]() |
f3033c29fb | ||
![]() |
4041174f96 | ||
![]() |
c8113e14b1 | ||
![]() |
b6d302f5b9 | ||
![]() |
efc077f553 | ||
![]() |
bc05cc59f4 | ||
![]() |
a9c18e0880 | ||
![]() |
9afb43851d | ||
![]() |
c57242b4bc | ||
![]() |
3337cc252a | ||
![]() |
655b0b354a | ||
![]() |
f0caeb7d58 | ||
![]() |
6c6f2c2ec0 | ||
![]() |
3e5b930d96 | ||
![]() |
d3d968e583 | ||
![]() |
404c57f1b0 | ||
![]() |
4c33b91fe9 | ||
![]() |
089ef64aa3 | ||
![]() |
4f0824fd76 | ||
![]() |
28f7c929e0 | ||
![]() |
ab8a78d806 | ||
![]() |
f6d7d5b826 | ||
![]() |
cd6805e94d | ||
![]() |
6cc60fb687 | ||
![]() |
fb4bb2b764 | ||
![]() |
c4907cc681 | ||
![]() |
5d1d579048 | ||
![]() |
7fa1bde113 | ||
![]() |
7a53650e73 | ||
![]() |
1ae0195287 | ||
![]() |
e5bbc754e7 | ||
![]() |
977e5d6284 | ||
![]() |
723c787b9e | ||
![]() |
91e71f7f54 | ||
![]() |
c4b507e9d8 | ||
![]() |
e8a17c1319 | ||
![]() |
d4e12344d6 | ||
![]() |
f437344e79 | ||
![]() |
f0467f4384 | ||
![]() |
a07ddedeae | ||
![]() |
614bbe87b8 | ||
![]() |
09908b7241 | ||
![]() |
1dbe2d9bec | ||
![]() |
7b8cf519f2 | ||
![]() |
d279a4f73d | ||
![]() |
97d7fa8d10 | ||
![]() |
1f3943b1c4 | ||
![]() |
6a835afddf | ||
![]() |
7bc5c17305 | ||
![]() |
924d84acf0 | ||
![]() |
d87ac130cf | ||
![]() |
1d3d5f5d7d | ||
![]() |
6fad24ecb9 | ||
![]() |
b3d9a50bb5 | ||
![]() |
cd68567543 | ||
![]() |
15e814e820 | ||
![]() |
4e21ab3057 | ||
![]() |
a0e5e43c90 | ||
![]() |
c029736d27 | ||
![]() |
19d0c63c29 | ||
![]() |
e402bad9b8 | ||
![]() |
51d62f88bb | ||
![]() |
231b64fec0 | ||
![]() |
31665c040a | ||
![]() |
70cf2f03ba | ||
![]() |
d0b13bbc8e | ||
![]() |
05a41f6dae | ||
![]() |
9c6ff202e7 | ||
![]() |
a697b05dd7 | ||
![]() |
cf4e05d42f | ||
![]() |
e51e6ee46b | ||
![]() |
873a55addf | ||
![]() |
7e009bcf6f | ||
![]() |
e65a6baf76 | ||
![]() |
37442cc5ea | ||
![]() |
134dffdcbd | ||
![]() |
777e3c9a34 | ||
![]() |
22d1133ea5 | ||
![]() |
b9faee7f5d | ||
![]() |
7fb50217da | ||
![]() |
6ab0cb2844 | ||
![]() |
fc875735dd | ||
![]() |
6dc4ece24b | ||
![]() |
494e751709 | ||
![]() |
76c3966df4 | ||
![]() |
2a8b380f8d | ||
![]() |
c29d535bb5 | ||
![]() |
865f09be7b | ||
![]() |
fd9bb43015 | ||
![]() |
9092e09c99 | ||
![]() |
1037c02950 | ||
![]() |
b82066f27e | ||
![]() |
d768b60d49 | ||
![]() |
b8cff0c99c | ||
![]() |
828062889a | ||
![]() |
67e708cc4f | ||
![]() |
399941fe55 | ||
![]() |
8d45dc4d41 | ||
![]() |
0858444609 | ||
![]() |
7b6b600fd1 | ||
![]() |
b15977a05a | ||
![]() |
dbf882b124 | ||
![]() |
6033320a1a | ||
![]() |
2a7ebf36c0 | ||
![]() |
f86be09be3 | ||
![]() |
f37cdd5af5 | ||
![]() |
264445eaee | ||
![]() |
5c02ca36b4 | ||
![]() |
8a19af1f63 | ||
![]() |
bc69aa355c | ||
![]() |
f98478c33b | ||
![]() |
0e5f2f5d1b | ||
![]() |
b78b0239a3 | ||
![]() |
daf0e7dfbf | ||
![]() |
34fe1e314a | ||
![]() |
011e039c4b | ||
![]() |
799fcb4d4d | ||
![]() |
31ea91b7bd | ||
![]() |
57f3186ee2 | ||
![]() |
0d109a7666 | ||
![]() |
402f462062 | ||
![]() |
77a8df068d | ||
![]() |
88f9c3613a | ||
![]() |
2dbb71acae | ||
![]() |
2298e68d5c | ||
![]() |
0f6f0af4b4 | ||
![]() |
3d3c02ce35 | ||
![]() |
9970d3354f | ||
![]() |
306ad540ed | ||
![]() |
967c563d07 | ||
![]() |
c1fcd93c29 | ||
![]() |
8353715199 | ||
![]() |
fdf5bb0179 | ||
![]() |
05f0aa8ae1 | ||
![]() |
4e0a591a59 | ||
![]() |
9e3d42fd72 | ||
![]() |
75c647f327 | ||
![]() |
ff271edfee | ||
![]() |
6699f6a3da | ||
![]() |
3eddea2ea8 | ||
![]() |
4944a87e18 | ||
![]() |
a7abc2ad4a | ||
![]() |
c96b0059c3 | ||
![]() |
8fac7e5254 | ||
![]() |
b869b9fc4b | ||
![]() |
973abff4b9 | ||
![]() |
de57485877 | ||
![]() |
0dde29d260 | ||
![]() |
6bf13c0ce1 | ||
![]() |
9206877fc8 | ||
![]() |
8166dd1546 | ||
![]() |
fed499b543 | ||
![]() |
56c58756aa | ||
![]() |
06433ccb3c | ||
![]() |
5bf0d440e7 | ||
![]() |
3225d122ac | ||
![]() |
ab3cb84648 | ||
![]() |
45d36a8e19 | ||
![]() |
0282098c13 | ||
![]() |
3629ba96e5 | ||
![]() |
5b5b529398 | ||
![]() |
dc8eb2d004 | ||
![]() |
3ad9525acc | ||
![]() |
b3451220ca | ||
![]() |
d2100b431f | ||
![]() |
011659ff75 | ||
![]() |
9c83cc14ff | ||
![]() |
0962f46650 | ||
![]() |
eef2c2ba55 | ||
![]() |
97577f4c3b | ||
![]() |
440e556f21 | ||
![]() |
b51fe02f1a | ||
![]() |
ff56073075 | ||
![]() |
10e0da40bc | ||
![]() |
1edf4a3339 | ||
![]() |
427108c8e2 | ||
![]() |
809d680df9 | ||
![]() |
b3f9635581 | ||
![]() |
b6dd2cd0f1 | ||
![]() |
3fd3482559 | ||
![]() |
cf7890719f | ||
![]() |
416c60a1d4 | ||
![]() |
1c7204285d | ||
![]() |
f824d0d46b | ||
![]() |
7e37433f31 | ||
![]() |
c82e11af33 | ||
![]() |
6649653be9 | ||
![]() |
ff6e5e8959 | ||
![]() |
51d94c098a | ||
![]() |
2fe72421c5 | ||
![]() |
3cd5bc6873 | ||
![]() |
a22c0a94d0 | ||
![]() |
f15dea9695 | ||
![]() |
56b5e7a174 | ||
![]() |
d34cf83f7e | ||
![]() |
993a6be3ce | ||
![]() |
b96e1e7423 | ||
![]() |
a2ce250cd8 | ||
![]() |
c8cfcf823f | ||
![]() |
56d6fc9159 | ||
![]() |
f31b5baac4 | ||
![]() |
a9302df045 | ||
![]() |
d8abf146a4 | ||
![]() |
80543b681b | ||
![]() |
fd9b1c5300 | ||
![]() |
cdfb593d40 | ||
![]() |
f6e886f999 | ||
![]() |
a47a874bee | ||
![]() |
3131e9735d | ||
![]() |
9e69dd4a82 | ||
![]() |
46db4d8961 | ||
![]() |
0e40179aeb | ||
![]() |
1d41167941 | ||
![]() |
2ea00170e1 | ||
![]() |
3f1c185ab4 | ||
![]() |
9a047b9f8d | ||
![]() |
6b30995e41 | ||
![]() |
2ad75e1ff0 | ||
![]() |
4bf0160a15 | ||
![]() |
a0f28a93bc | ||
![]() |
ee9b432e3f | ||
![]() |
498dd371fa | ||
![]() |
4fe99da720 | ||
![]() |
bab6409d4e | ||
![]() |
a0ef036074 | ||
![]() |
2671c2f83b | ||
![]() |
3605e86915 | ||
![]() |
683ed6838e | ||
![]() |
56827ea52d | ||
![]() |
82d5d83bf8 | ||
![]() |
e3201da883 | ||
![]() |
26077f272e | ||
![]() |
d93ccea812 | ||
![]() |
70a0085a47 | ||
![]() |
1a70520422 | ||
![]() |
083a981464 | ||
![]() |
bd30737e81 | ||
![]() |
a778e6d76e | ||
![]() |
05bcd2ccc4 | ||
![]() |
65957f43f0 | ||
![]() |
1d85ec3572 | ||
![]() |
21b1fb9d1d | ||
![]() |
37fafe5f1a | ||
![]() |
6c806a7145 | ||
![]() |
94738c9065 | ||
![]() |
e63a58c5ba | ||
![]() |
c193676fe9 | ||
![]() |
05ecaa498c | ||
![]() |
84c905016f | ||
![]() |
c428aba39d | ||
![]() |
0989fd1ca1 | ||
![]() |
8157b4eb9d | ||
![]() |
7b9e8a5894 | ||
![]() |
10937ca294 | ||
![]() |
c96bc30a3f | ||
![]() |
f5bfb98aea | ||
![]() |
e7169c4943 | ||
![]() |
8facfa0044 | ||
![]() |
a47e15d434 | ||
![]() |
9a873d3705 | ||
![]() |
c5f16d6ce7 | ||
![]() |
f29dd973c2 | ||
![]() |
07b7d46e8b | ||
![]() |
2c3242a38e | ||
![]() |
c37d756a7f | ||
![]() |
5a933d5c52 | ||
![]() |
c97ac97b30 | ||
![]() |
4726dd5713 | ||
![]() |
43db588e61 | ||
![]() |
73da6e1a95 | ||
![]() |
8ea72cfb73 | ||
![]() |
d3d4597f42 | ||
![]() |
461a6c0154 | ||
![]() |
059b2fab78 | ||
![]() |
01d1f685fc | ||
![]() |
3a6c550dc0 | ||
![]() |
c1a2fb5d17 | ||
![]() |
7301cd1105 | ||
![]() |
9ac9c9ca49 | ||
![]() |
741eaca3fd | ||
![]() |
b5df8c5942 | ||
![]() |
9db85faf14 | ||
![]() |
cf5188899b | ||
![]() |
8302328ef9 | ||
![]() |
24d6c7e7de | ||
![]() |
21fc37b0e2 | ||
![]() |
9b9528cfad | ||
![]() |
8f4ea166a2 | ||
![]() |
ee8dd08c6c | ||
![]() |
65b54093ea | ||
![]() |
49df1eaefb | ||
![]() |
9a3c37fedf | ||
![]() |
9de8ce5b38 | ||
![]() |
ccdd8ec40e | ||
![]() |
aae1331300 | ||
![]() |
15a82e9098 | ||
![]() |
6a9196fc39 | ||
![]() |
fbdee68f21 | ||
![]() |
589219bb0d | ||
![]() |
d12bdbed99 | ||
![]() |
daebcb3c96 | ||
![]() |
135015f20b | ||
![]() |
1da2158ed1 | ||
![]() |
79fb211570 | ||
![]() |
4b10425417 | ||
![]() |
af3d35cc1d | ||
![]() |
b6526679a3 | ||
![]() |
57f3a14d59 | ||
![]() |
e980ed0dc4 | ||
![]() |
8906e8ce91 | ||
![]() |
17bad8c51d | ||
![]() |
c2c74695d2 | ||
![]() |
3c14bd1af2 | ||
![]() |
361af7e51d | ||
![]() |
8dee4d7731 | ||
![]() |
09bd182416 | ||
![]() |
e046f1ad2b | ||
![]() |
b71022f70c | ||
![]() |
7c8fb02574 | ||
![]() |
8e824cedef | ||
![]() |
091c08663a | ||
![]() |
eec82f8de6 | ||
![]() |
98dad7f0a1 | ||
![]() |
2969bad152 | ||
![]() |
2aa08c17c1 | ||
![]() |
d80948287e | ||
![]() |
e4e6246eaa | ||
![]() |
b5e18c859d | ||
![]() |
7aa38946a9 | ||
![]() |
3fcb3f51e1 | ||
![]() |
235a594240 | ||
![]() |
8552dc6092 | ||
![]() |
96ea0dd12e | ||
![]() |
b970da3128 | ||
![]() |
962df76d10 | ||
![]() |
22de93ac45 | ||
![]() |
db09380e4b | ||
![]() |
4a749c02b8 | ||
![]() |
ca969ab341 | ||
![]() |
fa99351935 | ||
![]() |
4a9d2901ef | ||
![]() |
169fac8274 | ||
![]() |
8b37292acb | ||
![]() |
2a15f1833f | ||
![]() |
4d880e1be9 | ||
![]() |
2635c0815c | ||
![]() |
4f2d54af74 | ||
![]() |
b84593086f | ||
![]() |
7d89059b17 | ||
![]() |
c782650f33 | ||
![]() |
d2ed3e5614 | ||
![]() |
d4951839ca | ||
![]() |
aae12ecf9f | ||
![]() |
2336e02dd3 | ||
![]() |
63cdf7f97a | ||
![]() |
f0b75701a8 | ||
![]() |
61fd23d9cd | ||
![]() |
fdf5d37383 | ||
![]() |
3dc4319e08 | ||
![]() |
1d4cf99540 | ||
![]() |
082e606591 | ||
![]() |
dcf28643f0 | ||
![]() |
6d173c50a9 | ||
![]() |
40ef125494 | ||
![]() |
5c72bacf2c | ||
![]() |
9d5bc604c9 | ||
![]() |
33e3a36044 | ||
![]() |
61182d039f | ||
![]() |
91e02dc2c4 | ||
![]() |
3117060ed9 | ||
![]() |
38b9192d3a | ||
![]() |
16a5fbb86e | ||
![]() |
7e975a8f7f | ||
![]() |
71a50bb34a | ||
![]() |
9ea5a8773b | ||
![]() |
bdf434d4bb | ||
![]() |
fe3d15f449 | ||
![]() |
163d401f99 | ||
![]() |
2b2bd77020 | ||
![]() |
275a1b714c | ||
![]() |
87ae60ed83 | ||
![]() |
bc1abfa01e | ||
![]() |
04b6fa278b | ||
![]() |
cc476ac1fd | ||
![]() |
de1a631db9 | ||
![]() |
280a8590f9 | ||
![]() |
dc37276a9a | ||
![]() |
da215a8c96 | ||
![]() |
e8ced30a84 | ||
![]() |
dac42f89aa | ||
![]() |
2dd77916cf | ||
![]() |
5ea334899a | ||
![]() |
3ef859bd2b | ||
![]() |
547ecfb28f | ||
![]() |
cce8c431c2 | ||
![]() |
43e75c3869 | ||
![]() |
882c60baf2 | ||
![]() |
4eb622868a | ||
![]() |
c75a663ec9 | ||
![]() |
55cf5307c6 | ||
![]() |
c63d9d7481 | ||
![]() |
8e6e9a41e7 | ||
![]() |
c16681473f | ||
![]() |
42f9040b81 | ||
![]() |
626521b713 | ||
![]() |
f027d3055f | ||
![]() |
9b670e316e | ||
![]() |
b42a94e1a3 | ||
![]() |
5b67e04379 | ||
![]() |
9085725056 | ||
![]() |
8b222fc06f | ||
![]() |
48d794e180 | ||
![]() |
9c98a0cbaa | ||
![]() |
ca84fcbb78 | ||
![]() |
1e0d0323b2 | ||
![]() |
00a0a09ba0 | ||
![]() |
9c2cdf64d3 | ||
![]() |
141c42d106 | ||
![]() |
2e9cf2940f | ||
![]() |
00a8d0437d | ||
![]() |
6ab8c8fc72 | ||
![]() |
e49340a846 | ||
![]() |
ec2bc5af0c | ||
![]() |
de2c1187a4 | ||
![]() |
d4eae36f7c | ||
![]() |
e8b2bee859 | ||
![]() |
243963558e | ||
![]() |
03f849d23f | ||
![]() |
72e8d2e950 | ||
![]() |
96b8384886 | ||
![]() |
4e98fbf315 | ||
![]() |
1b7d9457c0 | ||
![]() |
48259ed052 | ||
![]() |
78ddb7aed7 | ||
![]() |
3338d968ea | ||
![]() |
ede29b0495 | ||
![]() |
d780c18d60 | ||
![]() |
e8218feebe | ||
![]() |
1dd0455e9c | ||
![]() |
036cf96bb6 | ||
![]() |
b98a74ab1d | ||
![]() |
4966d1b822 | ||
![]() |
1349d3d5a5 | ||
![]() |
71d05aa49d | ||
![]() |
39f9a9d6e4 | ||
![]() |
ade387c05f | ||
![]() |
9c4b8204e4 | ||
![]() |
c8ab61dcf8 | ||
![]() |
e91c868e41 | ||
![]() |
c6050c3a18 | ||
![]() |
8cddfcbf7b | ||
![]() |
974c9bd1a0 | ||
![]() |
a4303f9207 |
85
.appveyor.yml
Normal file
85
.appveyor.yml
Normal file
@ -0,0 +1,85 @@
|
||||
environment:
|
||||
matrix:
|
||||
- platform: x86
|
||||
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
|
||||
generator: "Visual Studio 14 2015"
|
||||
compiler: msvc
|
||||
configuration: Release
|
||||
|
||||
- platform: x64
|
||||
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
|
||||
generator: "Visual Studio 14 2015 Win64"
|
||||
compiler: msvc
|
||||
configuration: Release
|
||||
|
||||
- platform: x86
|
||||
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
|
||||
generator: "Visual Studio 15 2017"
|
||||
compiler: msvc
|
||||
configuration: Release
|
||||
|
||||
- platform: x64
|
||||
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
|
||||
generator: "Visual Studio 15 2017 Win64"
|
||||
compiler: msvc
|
||||
configuration: Release
|
||||
|
||||
- platform: x86
|
||||
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019
|
||||
generator: "Visual Studio 16 2019"
|
||||
compiler: msvc19
|
||||
configuration: Release
|
||||
arch: Win32
|
||||
|
||||
- platform: x64
|
||||
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019
|
||||
generator: "Visual Studio 16 2019"
|
||||
compiler: msvc19
|
||||
configuration: Release
|
||||
arch: x64
|
||||
|
||||
- platform: x86
|
||||
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
|
||||
generator: "MinGW Makefiles"
|
||||
compiler: mingw
|
||||
TOOLCHAIN_PATH: C:\mingw-w64\i686-6.3.0-posix-dwarf-rt_v5-rev1/mingw32\bin
|
||||
CC: C:/mingw-w64/i686-6.3.0-posix-dwarf-rt_v5-rev1/mingw32/bin/gcc.exe
|
||||
CXX: C:/mingw-w64/i686-6.3.0-posix-dwarf-rt_v5-rev1/mingw32/bin/g++.exe
|
||||
configuration: Release
|
||||
|
||||
- platform: x64
|
||||
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
|
||||
generator: "MinGW Makefiles"
|
||||
compiler: mingw
|
||||
TOOLCHAIN_PATH: C:\mingw-w64\x86_64-7.2.0-posix-seh-rt_v5-rev1\mingw64\bin
|
||||
CC: C:/mingw-w64/x86_64-7.2.0-posix-seh-rt_v5-rev1/mingw64/bin/gcc.exe
|
||||
CXX: C:/mingw-w64/x86_64-7.2.0-posix-seh-rt_v5-rev1/mingw64/bin/g++.exe
|
||||
configuration: Release
|
||||
|
||||
matrix:
|
||||
fast_finish: false
|
||||
|
||||
init:
|
||||
- cmd: cmake --version
|
||||
- cmd: msbuild /version
|
||||
|
||||
install:
|
||||
- cmd: reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\AppModelUnlock" /t REG_DWORD /f /v "AllowDevelopmentWithoutDevLicense" /d "1"
|
||||
- cmd: ren "C:\Program Files\Git\usr\bin\sh.exe" _sh.exe
|
||||
|
||||
build_script:
|
||||
- mkdir build
|
||||
- cd build
|
||||
- if [%compiler%]==[msvc] cmake -G"%generator%" ..
|
||||
- if [%compiler%]==[msvc19] cmake -G"%generator%" -A "%arch%" ..
|
||||
- if [%compiler%]==[mingw] set PATH=%TOOLCHAIN_PATH%;%PATH%
|
||||
- if [%compiler%]==[mingw] cmake -G"%generator%" -DCMAKE_C_COMPILER=%CC% -DCMAKE_CXX_COMPILER=%CXX% -DCMAKE_SH=CMAKE_SH-NOTFOUND -DCMAKE_BUILD_TYPE=%configuration% ..
|
||||
- cmake --build . --config %configuration%
|
||||
|
||||
test_script:
|
||||
- cd %APPVEYOR_BUILD_FOLDER%\build
|
||||
- set CTEST_OUTPUT_ON_FAILURE=1
|
||||
- ctest -C %configuration%
|
||||
- if exist "test\Release\std_filesystem_test.exe" test\Release\std_filesystem_test.exe & exit 0
|
||||
- cd ..
|
||||
|
4
.ci/unix-build.sh
Executable file
4
.ci/unix-build.sh
Executable file
@ -0,0 +1,4 @@
|
||||
#!/bin/sh
|
||||
mkdir build && cd build
|
||||
cmake -DCMAKE_BUILD_TYPE=Release ..
|
||||
cmake --build .
|
7
.ci/unix-test.sh
Executable file
7
.ci/unix-test.sh
Executable file
@ -0,0 +1,7 @@
|
||||
#!/bin/sh
|
||||
cd build
|
||||
echo "Tests run as user: $USER"
|
||||
ctest -E Windows
|
||||
if [ -f "test/std_filesystem_test" ]; then
|
||||
test/std_filesystem_test || true
|
||||
fi
|
34
.cirrus.yml
Normal file
34
.cirrus.yml
Normal file
@ -0,0 +1,34 @@
|
||||
freebsd_task:
|
||||
freebsd_instance:
|
||||
image_family: freebsd-14-0
|
||||
install_script: |
|
||||
pkg install -y cmake
|
||||
pw groupadd testgrp
|
||||
pw useradd testuser -g testgrp -w none -m
|
||||
chown -R testuser:testgrp .
|
||||
build_script: |
|
||||
sudo -u testuser .ci/unix-build.sh
|
||||
test_script: |
|
||||
sudo -u testuser .ci/unix-test.sh
|
||||
|
||||
rockylinux8_task:
|
||||
container:
|
||||
image: docker.io/rockylinux:8
|
||||
install_script: |
|
||||
dnf group install -y "Development Tools"
|
||||
dnf install cmake -y
|
||||
build_script: |
|
||||
.ci/unix-build.sh
|
||||
test_script: |
|
||||
.ci/unix-test.sh
|
||||
|
||||
rockylinux9_task:
|
||||
container:
|
||||
image: docker.io/rockylinux:9
|
||||
install_script: |
|
||||
dnf group install -y "Development Tools"
|
||||
dnf install cmake -y
|
||||
build_script: |
|
||||
.ci/unix-build.sh
|
||||
test_script: |
|
||||
.ci/unix-test.sh
|
@ -21,5 +21,5 @@ BraceWrapping:
|
||||
SplitEmptyNamespace: true
|
||||
BreakConstructorInitializers: BeforeComma
|
||||
ConstructorInitializerAllOnOneLineOrOnePerLine: false
|
||||
|
||||
IndentPPDirectives: None
|
||||
...
|
||||
|
3
.clang-tidy
Normal file
3
.clang-tidy
Normal file
@ -0,0 +1,3 @@
|
||||
---
|
||||
Checks: -modernize-use-nodiscard
|
||||
...
|
43
.drone.yml-disabled
Normal file
43
.drone.yml-disabled
Normal file
@ -0,0 +1,43 @@
|
||||
kind: pipeline
|
||||
name: arm
|
||||
|
||||
platform:
|
||||
os: linux
|
||||
arch: arm
|
||||
|
||||
steps:
|
||||
- name: build
|
||||
image: alpine
|
||||
failure: ignore
|
||||
commands:
|
||||
- apk update
|
||||
- apk add --no-cache build-base cmake sudo
|
||||
- addgroup testgrp
|
||||
- adduser --disabled-password testuser testgrp
|
||||
- passwd testuser -u -d
|
||||
- chown -R testuser:testgrp .
|
||||
- sudo -u testuser .ci/unix-build.sh
|
||||
- sudo -u testuser .ci/unix-test.sh
|
||||
|
||||
---
|
||||
|
||||
kind: pipeline
|
||||
name: arm64
|
||||
|
||||
platform:
|
||||
os: linux
|
||||
arch: arm64
|
||||
|
||||
steps:
|
||||
- name: build
|
||||
image: alpine
|
||||
failure: ignore
|
||||
commands:
|
||||
- apk update
|
||||
- apk add --no-cache build-base cmake
|
||||
- addgroup testgrp
|
||||
- adduser --disabled-password testuser testgrp
|
||||
- passwd testuser -u -d
|
||||
- chown -R testuser:testgrp .
|
||||
- su -c "./.ci/unix-build.sh" testuser
|
||||
- su -c "./.ci/unix-test.sh" testuser
|
170
.github/workflows/build_cmake.yml
vendored
Normal file
170
.github/workflows/build_cmake.yml
vendored
Normal file
@ -0,0 +1,170 @@
|
||||
name: CMake Build Matrix
|
||||
|
||||
on: [ push, pull_request ]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: ${{ matrix.config.name }}
|
||||
runs-on: ${{ matrix.config.os }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
config:
|
||||
- name: "Ubuntu 22.04 GCC 11"
|
||||
os: ubuntu-22.04
|
||||
build_type: Release
|
||||
packages: ninja-build
|
||||
generator: Ninja
|
||||
compatibility: "cxx_std_11;cxx_std_17;cxx_std_20"
|
||||
cc: gcc
|
||||
cxx: g++
|
||||
|
||||
- name: "Ubuntu 22.04 Clang 13.0"
|
||||
os: ubuntu-22.04
|
||||
build_type: Release
|
||||
packages: ninja-build libc++-13-dev libc++abi-13-dev
|
||||
generator: Ninja
|
||||
compatibility: "cxx_std_11;cxx_std_17;cxx_std_20"
|
||||
cc: clang-13
|
||||
cxx: clang++-13
|
||||
|
||||
- name: "Ubuntu 22.04 Clang 15.0"
|
||||
os: ubuntu-22.04
|
||||
build_type: Release
|
||||
packages: ninja-build libc++-15-dev libc++abi-15-dev
|
||||
generator: Ninja
|
||||
compatibility: "cxx_std_11;cxx_std_17;cxx_std_20"
|
||||
cc: clang-15
|
||||
cxx: clang++-15
|
||||
|
||||
- name: "Ubuntu 22.04 GCC 11 coverage"
|
||||
os: ubuntu-22.04
|
||||
build_type: Debug
|
||||
packages: ninja-build lcov
|
||||
generator: Ninja
|
||||
compatibility: "cxx_std_11;cxx_std_17;cxx_std_20"
|
||||
cc: gcc
|
||||
cxx: g++
|
||||
|
||||
- name: "Ubuntu 20.04 GCC 9.3"
|
||||
os: ubuntu-20.04
|
||||
build_type: Release
|
||||
packages: ninja-build
|
||||
generator: Ninja
|
||||
compatibility: "cxx_std_11;cxx_std_17;cxx_std_20"
|
||||
cc: gcc
|
||||
cxx: g++
|
||||
|
||||
- name: "Ubuntu 20.04 Clang 10.0"
|
||||
os: ubuntu-20.04
|
||||
build_type: Release
|
||||
packages: ninja-build
|
||||
generator: Ninja
|
||||
compatibility: "cxx_std_11;cxx_std_17;cxx_std_20"
|
||||
cc: clang-10
|
||||
cxx: clang++-10
|
||||
|
||||
- name: "Ubuntu 20.04 Clang 11.0"
|
||||
os: ubuntu-20.04
|
||||
build_type: Release
|
||||
packages: ninja-build clang-11 libc++-11-dev libc++abi-11-dev
|
||||
generator: Ninja
|
||||
compatibility: "cxx_std_11;cxx_std_17;cxx_std_20"
|
||||
cc: clang-11
|
||||
cxx: clang++-11
|
||||
|
||||
- name: "Ubuntu 20.04 GCC 9.3 coverage"
|
||||
os: ubuntu-20.04
|
||||
build_type: Debug
|
||||
packages: ninja-build lcov
|
||||
generator: Ninja
|
||||
compatibility: "cxx_std_11;cxx_std_17;cxx_std_20"
|
||||
cc: gcc
|
||||
cxx: g++
|
||||
|
||||
- name: "Windows MSVC 2019"
|
||||
os: windows-2019
|
||||
build_type: Release
|
||||
packages: ninja
|
||||
generator: "Visual Studio 16 2019"
|
||||
compatibility: "cxx_std_11;cxx_std_17;cxx_std_20"
|
||||
cc: cl
|
||||
cxx: cl
|
||||
|
||||
- name: "macOS 13 AppleClang"
|
||||
os: macos-13
|
||||
build_type: Release
|
||||
packages: ninja
|
||||
generator: Ninja
|
||||
compatibility: "cxx_std_11;cxx_std_17;cxx_std_20"
|
||||
cc: clang
|
||||
cxx: clang++
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
- name: print environment
|
||||
run: |
|
||||
echo github.event.action: ${{ github.event.action }}
|
||||
echo github.event_name: ${{ github.event_name }}
|
||||
|
||||
- name: Install dependencies on Ubuntu
|
||||
if: startsWith(matrix.config.os, 'ubuntu')
|
||||
shell: bash
|
||||
run: |
|
||||
sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y
|
||||
sudo apt update
|
||||
sudo apt install ${{ matrix.config.packages }}
|
||||
|
||||
- name: Install dependencies on windows
|
||||
if: startsWith(matrix.config.os, 'windows')
|
||||
run: |
|
||||
choco install ${{ matrix.config.packages }}
|
||||
|
||||
- name: Install dependencies on macOS
|
||||
if: startsWith(matrix.config.os, 'macos')
|
||||
run: |
|
||||
brew install ${{ matrix.config.packages }}
|
||||
|
||||
- name: Configure project
|
||||
shell: bash
|
||||
run: |
|
||||
export CC=${{ matrix.config.cc }}
|
||||
export CXX=${{ matrix.config.cxx }}
|
||||
ninja --version
|
||||
cmake --version
|
||||
mkdir build
|
||||
mkdir install
|
||||
if [[ "${{ matrix.config.build_type }}" == "Debug" ]]; then
|
||||
cmake -G "${{ matrix.config.generator }}" -S . -B build -DCMAKE_BUILD_TYPE=Debug -DGHC_COVERAGE=ON -DGHC_FILESYSTEM_TEST_COMPILE_FEATURES="${{ matrix.config.compatibility }}" -DCMAKE_INSTALL_PREFIX:PATH=install
|
||||
else
|
||||
cmake -G "${{ matrix.config.generator }}" -S . -B build -DCMAKE_BUILD_TYPE=${{ matrix.config.build_type }} -DGHC_FILESYSTEM_TEST_COMPILE_FEATURES="${{ matrix.config.compatibility }}" -DCMAKE_INSTALL_PREFIX:PATH=install
|
||||
fi
|
||||
|
||||
- name: Build project
|
||||
shell: bash
|
||||
run: |
|
||||
cmake --build build --config ${{ matrix.config.build_type }}
|
||||
|
||||
- name: Run tests
|
||||
run: |
|
||||
cd build && ctest -C ${{ matrix.config.build_type }}
|
||||
|
||||
- name: Collect coverage info
|
||||
if: startsWith(matrix.config.build_type, 'Debug')
|
||||
run: |
|
||||
cd build
|
||||
lcov --compat-libtool --directory . --capture --output-file coverage_output.info
|
||||
lcov --remove coverage_output.info '/usr/*' '*/c++/*' '*.h' '*/catch.hpp' -o coverage.info
|
||||
# sed -i 's|SF:/.*/filesystem/|SF:../|g' coverage.info
|
||||
|
||||
- name: Upload coverage info
|
||||
if: startsWith(matrix.config.build_type, 'Debug')
|
||||
env:
|
||||
COVERALLS_DEBUG: true
|
||||
NODE_COVERALLS_DEBUG: 1
|
||||
uses: coverallsapp/github-action@master
|
||||
with:
|
||||
path-to-lcov: ${{ github.workspace }}/build/coverage.info
|
||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
8
.gitignore
vendored
8
.gitignore
vendored
@ -1 +1,7 @@
|
||||
/build*/
|
||||
/*build*/
|
||||
.vs/
|
||||
.vscode/
|
||||
.idea/
|
||||
*.swp
|
||||
*~
|
||||
.DS_Store
|
||||
|
@ -1,12 +1,90 @@
|
||||
cmake_minimum_required(VERSION 3.10)
|
||||
project(ghcfilesystem)
|
||||
cmake_minimum_required(VERSION 3.7.2)
|
||||
project(
|
||||
ghcfilesystem,
|
||||
VERSION 1.5.15
|
||||
)
|
||||
|
||||
set(CMAKE_CXX_STANDARD 11)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
set(CMAKE_CXX_EXTENSIONS OFF)
|
||||
if (POLICY CMP0077)
|
||||
cmake_policy(SET CMP0077 NEW)
|
||||
endif()
|
||||
if(POLICY CMP0110)
|
||||
cmake_policy(SET CMP0110 NEW)
|
||||
endif()
|
||||
|
||||
add_compile_options("$<$<C_COMPILER_ID:MSVC>:/utf-8>")
|
||||
add_compile_options("$<$<CXX_COMPILER_ID:MSVC>:/utf-8>")
|
||||
if(CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR)
|
||||
option(GHC_FILESYSTEM_BUILD_TESTING "Enable tests" ON)
|
||||
option(GHC_FILESYSTEM_BUILD_EXAMPLES "Build examples" ON)
|
||||
option(GHC_FILESYSTEM_WITH_INSTALL "With install target" ON)
|
||||
else()
|
||||
option(GHC_FILESYSTEM_BUILD_EXAMPLES "Build examples" OFF)
|
||||
option(GHC_FILESYSTEM_BUILD_TESTING "Enable tests" OFF)
|
||||
option(GHC_FILESYSTEM_WITH_INSTALL "With install target" OFF)
|
||||
endif()
|
||||
option(GHC_FILESYSTEM_BUILD_STD_TESTING "Enable STD tests" ${GHC_FILESYSTEM_BUILD_TESTING})
|
||||
if(NOT DEFINED GHC_FILESYSTEM_TEST_COMPILE_FEATURES)
|
||||
set(GHC_FILESYSTEM_TEST_COMPILE_FEATURES ${CMAKE_CXX_COMPILE_FEATURES})
|
||||
endif()
|
||||
|
||||
add_subdirectory(test)
|
||||
add_subdirectory(examples)
|
||||
if(NOT DEFINED CMAKE_CXX_STANDARD)
|
||||
set(CMAKE_CXX_STANDARD 11)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
if(NOT CYGWIN)
|
||||
set(CMAKE_CXX_EXTENSIONS OFF)
|
||||
endif()
|
||||
endif()
|
||||
if(CMAKE_CXX_STANDARD LESS 11)
|
||||
message(FATAL_ERROR "CMAKE_CXX_STANDARD is less than 11, ghc::filesystem only works with C++11 and above.")
|
||||
endif()
|
||||
if(CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR)
|
||||
message(STATUS "System name: ${CMAKE_SYSTEM_NAME}")
|
||||
message(STATUS "Compiler ID: ${CMAKE_CXX_COMPILER_ID}")
|
||||
message(STATUS "CMAKE_CXX_COMPILE_FEATURES: ${CMAKE_CXX_COMPILE_FEATURES}")
|
||||
endif()
|
||||
|
||||
add_library(ghc_filesystem INTERFACE)
|
||||
add_library(ghcFilesystem::ghc_filesystem ALIAS ghc_filesystem)
|
||||
target_include_directories(ghc_filesystem INTERFACE
|
||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
|
||||
$<INSTALL_INTERFACE:include>)
|
||||
target_compile_options(ghc_filesystem INTERFACE "$<$<C_COMPILER_ID:MSVC>:/utf-8>")
|
||||
target_compile_options(ghc_filesystem INTERFACE "$<$<CXX_COMPILER_ID:MSVC>:/utf-8>")
|
||||
|
||||
if(GHC_FILESYSTEM_BUILD_TESTING OR GHC_FILESYSTEM_BUILD_EXAMPLES)
|
||||
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
|
||||
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake/")
|
||||
include(GhcHelper)
|
||||
|
||||
if(GHC_FILESYSTEM_BUILD_TESTING)
|
||||
enable_testing()
|
||||
add_subdirectory(test)
|
||||
endif()
|
||||
|
||||
if(GHC_FILESYSTEM_BUILD_EXAMPLES)
|
||||
add_subdirectory(examples)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(GHC_FILESYSTEM_WITH_INSTALL)
|
||||
include(CMakePackageConfigHelpers)
|
||||
include(GNUInstallDirs)
|
||||
install(DIRECTORY include/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
|
||||
install(TARGETS ghc_filesystem EXPORT ghc_filesystem-targets)
|
||||
install(EXPORT ghc_filesystem-targets NAMESPACE ghcFilesystem:: DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/ghc_filesystem")
|
||||
export(EXPORT ghc_filesystem-targets NAMESPACE ghcFilesystem:: FILE "${CMAKE_CURRENT_BINARY_DIR}/cmake/ghc_filesystem-targets.cmake")
|
||||
configure_package_config_file(
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/config.cmake.in"
|
||||
"${PROJECT_BINARY_DIR}/cmake/ghc_filesystem-config.cmake"
|
||||
INSTALL_DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/ghc_filesystem"
|
||||
PATH_VARS CMAKE_INSTALL_INCLUDEDIR)
|
||||
write_basic_package_version_file(
|
||||
"${PROJECT_BINARY_DIR}/cmake/ghc_filesystem-config-version.cmake"
|
||||
VERSION ${PROJECT_VERSION}
|
||||
COMPATIBILITY SameMinorVersion
|
||||
)
|
||||
install(
|
||||
FILES
|
||||
"${PROJECT_BINARY_DIR}/cmake/ghc_filesystem-config.cmake"
|
||||
"${PROJECT_BINARY_DIR}/cmake/ghc_filesystem-config-version.cmake"
|
||||
DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/ghc_filesystem"
|
||||
)
|
||||
endif()
|
||||
|
38
LICENSE
38
LICENSE
@ -1,27 +1,19 @@
|
||||
Copyright (c) 2018, Steffen Schümann <s.schuemann@pobox.com>
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
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:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer.
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
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. Neither the name of the copyright holder nor the names of its contributors
|
||||
may 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.
|
||||
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.
|
||||
|
81
cmake/GhcHelper.cmake
Normal file
81
cmake/GhcHelper.cmake
Normal file
@ -0,0 +1,81 @@
|
||||
macro(AddExecutableWithStdFS targetName)
|
||||
if ("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang" AND (CMAKE_CXX_COMPILER_VERSION VERSION_EQUAL 7.0 OR CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 7.0))
|
||||
if(APPLE)
|
||||
include_directories(/usr/local/opt/llvm/include)
|
||||
link_directories(/usr/local/opt/llvm/lib)
|
||||
endif()
|
||||
add_executable(${targetName} ${ARGN})
|
||||
set_property(TARGET ${targetName} PROPERTY CXX_STANDARD 17)
|
||||
if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 9.0)
|
||||
if(APPLE)
|
||||
target_link_libraries(${targetName} -lc++fs)
|
||||
else()
|
||||
target_compile_options(${targetName} PRIVATE "-stdlib=libc++")
|
||||
target_link_libraries(${targetName} -stdlib=libc++ -lc++fs $<$<PLATFORM_ID:Linux>:rt>)
|
||||
endif()
|
||||
else()
|
||||
if(NOT APPLE)
|
||||
target_compile_options(${targetName} PRIVATE "-stdlib=libc++")
|
||||
target_link_libraries(${targetName} -stdlib=libc++)
|
||||
endif()
|
||||
endif()
|
||||
if(${CMAKE_SYSTEM_NAME} MATCHES "(SunOS|Solaris)")
|
||||
target_link_libraries(filesystem_test xnet)
|
||||
endif()
|
||||
if(${CMAKE_SYSTEM_NAME} MATCHES "Haiku")
|
||||
target_link_libraries(filesystem_test network)
|
||||
endif()
|
||||
target_compile_definitions(${targetName} PRIVATE USE_STD_FS)
|
||||
endif()
|
||||
|
||||
if (CMAKE_COMPILER_IS_GNUCXX AND (CMAKE_CXX_COMPILER_VERSION VERSION_EQUAL 8.0 OR CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 8.0))
|
||||
add_executable(${targetName} ${ARGN})
|
||||
set_property(TARGET ${targetName} PROPERTY CXX_STANDARD 17)
|
||||
if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 9.0)
|
||||
target_link_libraries(${targetName} -lstdc++fs)
|
||||
endif()
|
||||
if(${CMAKE_SYSTEM_NAME} MATCHES "(SunOS|Solaris)")
|
||||
target_link_libraries(${targetName} xnet)
|
||||
endif()
|
||||
if(${CMAKE_SYSTEM_NAME} MATCHES "Haiku")
|
||||
target_link_libraries(${targetName} network)
|
||||
endif()
|
||||
target_compile_options(${targetName} PRIVATE $<$<BOOL:${CYGWIN}>:-Wa,-mbig-obj>)
|
||||
target_compile_definitions(${targetName} PRIVATE USE_STD_FS)
|
||||
endif()
|
||||
|
||||
if(CMAKE_CXX_COMPILER_ID MATCHES MSVC AND (CMAKE_CXX_COMPILER_VERSION VERSION_EQUAL 19.15 OR CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 19.15))
|
||||
add_executable(${targetName} ${ARGN})
|
||||
set_property(TARGET ${targetName} PROPERTY CXX_STANDARD 17)
|
||||
set_property(TARGET ${targetName} PROPERTY CXX_STANDARD_REQUIRED ON)
|
||||
target_compile_options(${targetName} PRIVATE "/Zc:__cplusplus")
|
||||
target_compile_definitions(${targetName} PRIVATE USE_STD_FS _CRT_SECURE_NO_WARNINGS)
|
||||
endif()
|
||||
|
||||
endmacro()
|
||||
|
||||
macro(AddTestExecutableWithStdCpp cppStd)
|
||||
add_executable(filesystem_test_cpp${cppStd} ${ARGN})
|
||||
set_property(TARGET filesystem_test_cpp${cppStd} PROPERTY CXX_STANDARD ${cppStd})
|
||||
target_link_libraries(filesystem_test_cpp${cppStd} ghc_filesystem)
|
||||
if(${CMAKE_SYSTEM_NAME} MATCHES "(SunOS|Solaris)")
|
||||
target_link_libraries(filesystem_test_cpp${cppStd} xnet)
|
||||
endif()
|
||||
if(${CMAKE_SYSTEM_NAME} MATCHES "Haiku")
|
||||
target_link_libraries(filesystem_test_cpp${cppStd} network)
|
||||
endif()
|
||||
target_compile_options(filesystem_test_cpp${cppStd} PRIVATE
|
||||
$<$<BOOL:${EMSCRIPTEN}>:-s DISABLE_EXCEPTION_CATCHING=0>
|
||||
$<$<OR:$<CXX_COMPILER_ID:Clang>,$<CXX_COMPILER_ID:AppleClang>>:-Wall -Wextra -Wshadow -Wconversion -Wsign-conversion -Wpedantic -Werror -Wno-error=deprecated-declarations>
|
||||
$<$<CXX_COMPILER_ID:GNU>:-Wall -Wextra -Wshadow -Wconversion -Wsign-conversion -Wpedantic -Wno-psabi -Werror -Wno-error=deprecated-declarations>
|
||||
$<$<CXX_COMPILER_ID:MSVC>:/WX /wd4996>
|
||||
$<$<BOOL:${CYGWIN}>:-Wa,-mbig-obj>
|
||||
$<$<BOOL:${GHC_COVERAGE}>:--coverage>)
|
||||
if(CMAKE_CXX_COMPILER_ID MATCHES MSVC)
|
||||
target_compile_definitions(filesystem_test_cpp${cppStd} PRIVATE _CRT_SECURE_NO_WARNINGS)
|
||||
endif()
|
||||
if(EMSCRIPTEN)
|
||||
set_target_properties(filesystem_test_cpp${cppStd} PROPERTIES LINK_FLAGS "-g4 -s DISABLE_EXCEPTION_CATCHING=0 -s ALLOW_MEMORY_GROWTH=1")
|
||||
endif()
|
||||
ParseAndAddCatchTests(filesystem_test_cpp${cppStd})
|
||||
endmacro()
|
6
cmake/config.cmake.in
Normal file
6
cmake/config.cmake.in
Normal file
@ -0,0 +1,6 @@
|
||||
@PACKAGE_INIT@
|
||||
|
||||
# import targets
|
||||
include("${CMAKE_CURRENT_LIST_DIR}/ghc_filesystem-targets.cmake")
|
||||
|
||||
check_required_components(ghcfilesystem)
|
@ -1,29 +1,17 @@
|
||||
|
||||
add_executable(fs_dir dir.cpp ../filesystem.h)
|
||||
add_executable(fs_dir dir.cpp)
|
||||
target_link_libraries(fs_dir ghc_filesystem)
|
||||
if(CMAKE_CXX_COMPILER_ID MATCHES MSVC)
|
||||
target_compile_definitions(fs_dir PRIVATE _CRT_SECURE_NO_WARNINGS)
|
||||
endif()
|
||||
AddExecutableWithStdFS(std_fs_dir dir.cpp)
|
||||
|
||||
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" AND (CMAKE_CXX_COMPILER_VERSION VERSION_EQUAL 7.0 OR CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 7.0))
|
||||
if(APPLE)
|
||||
include_directories(/usr/local/opt/llvm/include)
|
||||
link_directories(/usr/local/opt/llvm/lib)
|
||||
endif()
|
||||
add_executable(std_fs_dir dir.cpp)
|
||||
set_property(TARGET std_fs_dir PROPERTY CXX_STANDARD 17)
|
||||
target_link_libraries(std_fs_dir -lc++fs)
|
||||
endif()
|
||||
add_executable(fs_du du.cpp)
|
||||
target_link_libraries(fs_du ghc_filesystem)
|
||||
AddExecutableWithStdFS(std_fs_du du.cpp)
|
||||
|
||||
if (CMAKE_COMPILER_IS_GNUCXX AND (CMAKE_CXX_COMPILER_VERSION VERSION_EQUAL 8.0 OR CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 8.0))
|
||||
add_executable(std_fs_dir dir.cpp)
|
||||
set_property(TARGET std_fs_dir PROPERTY CXX_STANDARD 17)
|
||||
target_link_libraries(std_fs_dir -lstdc++fs)
|
||||
endif()
|
||||
|
||||
if(CMAKE_CXX_COMPILER_ID MATCHES MSVC AND (CMAKE_CXX_COMPILER_VERSION VERSION_EQUAL 19.15 OR CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 19.15))
|
||||
add_executable(std_fs_dir dir.cpp)
|
||||
set_property(TARGET std_fs_dir PROPERTY CXX_STANDARD 17)
|
||||
set_property(TARGET std_fs_dir PROPERTY CXX_STANDARD_REQUIRED ON)
|
||||
target_compile_options(std_fs_dir PRIVATE "/Zc:__cplusplus")
|
||||
target_compile_definitions(std_fs_dir PRIVATE _CRT_SECURE_NO_WARNINGS)
|
||||
if(EXISTS "${PROJECT_SOURCE_DIR}/examples/benchmark.cpp")
|
||||
add_executable(fs_benchmark benchmark.cpp)
|
||||
set_property(TARGET fs_benchmark PROPERTY CXX_STANDARD 17)
|
||||
target_link_libraries(fs_benchmark ghc_filesystem)
|
||||
endif()
|
@ -1,16 +1,21 @@
|
||||
#include <iostream>
|
||||
#include <iomanip>
|
||||
#include <chrono>
|
||||
#include <iomanip>
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
|
||||
#if defined(__cplusplus) && __cplusplus >= 201703L && defined(__has_include) && __has_include(<filesystem>)
|
||||
#if defined(__cplusplus) && __cplusplus >= 201703L && defined(__has_include)
|
||||
#if __has_include(<filesystem>)
|
||||
#define GHC_USE_STD_FS
|
||||
#include <filesystem>
|
||||
namespace fs = std::filesystem;
|
||||
#else
|
||||
#include "../filesystem.h"
|
||||
#endif
|
||||
#endif
|
||||
#ifndef GHC_USE_STD_FS
|
||||
#include <ghc/filesystem.hpp>
|
||||
namespace fs = ghc::filesystem;
|
||||
#endif
|
||||
|
||||
template<typename TP>
|
||||
template <typename TP>
|
||||
std::time_t to_time_t(TP tp)
|
||||
{
|
||||
// Based on trick from: Nico Josuttis, C++17 - The Complete Guide
|
||||
@ -21,9 +26,9 @@ std::time_t to_time_t(TP tp)
|
||||
static std::string perm_to_str(fs::perms prms)
|
||||
{
|
||||
std::string result;
|
||||
result.reserve(6);
|
||||
for(int i = 0; i < 9; ++i) {
|
||||
result = ((static_cast<int>(prms) & (1<<i)) ? "xwrxwrxwr"[i] : '-') + result;
|
||||
result.reserve(9);
|
||||
for (int i = 0; i < 9; ++i) {
|
||||
result = ((static_cast<int>(prms) & (1 << i)) ? "xwrxwrxwr"[i] : '-') + result;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@ -32,27 +37,24 @@ int main(int argc, char* argv[])
|
||||
{
|
||||
#ifdef GHC_FILESYSTEM_VERSION
|
||||
fs::u8arguments u8guard(argc, argv);
|
||||
if(!u8guard.valid()) {
|
||||
if (!u8guard.valid()) {
|
||||
std::cerr << "Invalid character encoding, UTF-8 based encoding needed." << std::endl;
|
||||
std::exit(EXIT_FAILURE);
|
||||
}
|
||||
#endif
|
||||
if(argc > 2) {
|
||||
if (argc > 2) {
|
||||
std::cerr << "USAGE: dir <path>" << std::endl;
|
||||
exit(1);
|
||||
}
|
||||
fs::path dir{"."};
|
||||
if(argc == 2) {
|
||||
if (argc == 2) {
|
||||
dir = fs::u8path(argv[1]);
|
||||
}
|
||||
for(auto de : fs::directory_iterator(dir)) {
|
||||
for (auto de : fs::directory_iterator(dir)) {
|
||||
auto ft = to_time_t(de.last_write_time());
|
||||
auto ftm = *std::localtime(&ft);
|
||||
std::cout << (de.is_directory() ? "d" : "-") << perm_to_str(de.symlink_status().permissions()) << " "
|
||||
<< std::setw(8) << (de.is_directory() ? "-" : std::to_string(de.file_size())) << " "
|
||||
<< std::put_time(&ftm, "%Y-%m-%d %H:%M:%S") << " "
|
||||
<< de.path().filename().string()
|
||||
<< std::endl;
|
||||
std::cout << (de.is_directory() ? "d" : "-") << perm_to_str(de.symlink_status().permissions()) << " " << std::setw(8) << (de.is_directory() ? "-" : std::to_string(de.file_size())) << " " << std::put_time(&ftm, "%Y-%m-%d %H:%M:%S") << " "
|
||||
<< de.path().filename().string() << std::endl;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
61
examples/du.cpp
Normal file
61
examples/du.cpp
Normal file
@ -0,0 +1,61 @@
|
||||
#include <iostream>
|
||||
#include <iomanip>
|
||||
#include <chrono>
|
||||
|
||||
#if defined(__cplusplus) && __cplusplus >= 201703L && defined(__has_include)
|
||||
#if __has_include(<filesystem>)
|
||||
#define GHC_USE_STD_FS
|
||||
#include <filesystem>
|
||||
namespace fs = std::filesystem;
|
||||
#endif
|
||||
#endif
|
||||
#ifndef GHC_USE_STD_FS
|
||||
#include <ghc/filesystem.hpp>
|
||||
namespace fs = ghc::filesystem;
|
||||
#endif
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
#ifdef GHC_FILESYSTEM_VERSION
|
||||
fs::u8arguments u8guard(argc, argv);
|
||||
if(!u8guard.valid()) {
|
||||
std::cerr << "Invalid character encoding, UTF-8 based encoding needed." << std::endl;
|
||||
std::exit(EXIT_FAILURE);
|
||||
}
|
||||
#endif
|
||||
if(argc > 2) {
|
||||
std::cerr << "USAGE: du <path>" << std::endl;
|
||||
exit(1);
|
||||
}
|
||||
fs::path dir{"."};
|
||||
if(argc == 2) {
|
||||
dir = fs::u8path(argv[1]);
|
||||
}
|
||||
|
||||
uint64_t totalSize = 0;
|
||||
int totalDirs = 0;
|
||||
int totalFiles = 0;
|
||||
int maxDepth = 0;
|
||||
|
||||
try {
|
||||
auto rdi = fs::recursive_directory_iterator(dir);
|
||||
for(auto de : rdi) {
|
||||
if(rdi.depth() > maxDepth) {
|
||||
maxDepth = rdi.depth();
|
||||
}
|
||||
if(de.is_regular_file()) {
|
||||
totalSize += de.file_size();
|
||||
++totalFiles;
|
||||
}
|
||||
else if(de.is_directory()) {
|
||||
++totalDirs;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch(fs::filesystem_error fe) {
|
||||
std::cerr << "Error: " << fe.what() << std::endl;
|
||||
exit(1);
|
||||
}
|
||||
std::cout << totalSize << " bytes in " << totalFiles << " files and " << totalDirs << " directories, maximum depth: " << maxDepth << std::endl;
|
||||
return 0;
|
||||
}
|
4741
filesystem.h
4741
filesystem.h
File diff suppressed because it is too large
Load Diff
6075
include/ghc/filesystem.hpp
Normal file
6075
include/ghc/filesystem.hpp
Normal file
File diff suppressed because it is too large
Load Diff
38
include/ghc/fs_fwd.hpp
Normal file
38
include/ghc/fs_fwd.hpp
Normal file
@ -0,0 +1,38 @@
|
||||
//---------------------------------------------------------------------------------------
|
||||
//
|
||||
// ghc::filesystem - A C++17-like filesystem implementation for C++11/C++14
|
||||
//
|
||||
//---------------------------------------------------------------------------------------
|
||||
//
|
||||
// Copyright (c) 2018, Steffen Schümann <s.schuemann@pobox.com>
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all
|
||||
// copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
//
|
||||
//---------------------------------------------------------------------------------------
|
||||
// fs_fwd.hpp - The forwarding header for the header/implementation separated usage of
|
||||
// ghc::filesystem.
|
||||
// This file can be include at any place, where ghc::filesystem api is needed while
|
||||
// not bleeding implementation details (e.g. system includes) into the global namespace,
|
||||
// as long as one cpp includes fs_impl.hpp to deliver the matching implementations.
|
||||
//---------------------------------------------------------------------------------------
|
||||
#ifndef GHC_FILESYSTEM_FWD_H
|
||||
#define GHC_FILESYSTEM_FWD_H
|
||||
#define GHC_FILESYSTEM_FWD
|
||||
#include "filesystem.hpp"
|
||||
#endif // GHC_FILESYSTEM_FWD_H
|
35
include/ghc/fs_impl.hpp
Normal file
35
include/ghc/fs_impl.hpp
Normal file
@ -0,0 +1,35 @@
|
||||
//---------------------------------------------------------------------------------------
|
||||
//
|
||||
// ghc::filesystem - A C++17-like filesystem implementation for C++11/C++14
|
||||
//
|
||||
//---------------------------------------------------------------------------------------
|
||||
//
|
||||
// Copyright (c) 2018, Steffen Schümann <s.schuemann@pobox.com>
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all
|
||||
// copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
//
|
||||
//---------------------------------------------------------------------------------------
|
||||
// fs_impl.hpp - The implementation header for the header/implementation separated usage of
|
||||
// ghc::filesystem.
|
||||
// This file can be used to hide the implementation of ghc::filesystem into a single cpp.
|
||||
// The cpp has to include this before including fs_fwd.hpp directly or via a different
|
||||
// header to work.
|
||||
//---------------------------------------------------------------------------------------
|
||||
#define GHC_FILESYSTEM_IMPLEMENTATION
|
||||
#include "filesystem.hpp"
|
77
include/ghc/fs_std.hpp
Normal file
77
include/ghc/fs_std.hpp
Normal file
@ -0,0 +1,77 @@
|
||||
//---------------------------------------------------------------------------------------
|
||||
//
|
||||
// ghc::filesystem - A C++17-like filesystem implementation for C++11/C++14
|
||||
//
|
||||
//---------------------------------------------------------------------------------------
|
||||
//
|
||||
// Copyright (c) 2018, Steffen Schümann <s.schuemann@pobox.com>
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all
|
||||
// copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
//
|
||||
//---------------------------------------------------------------------------------------
|
||||
// fs_std.hpp - The dynamic switching header that includes std::filesystem if detected
|
||||
// or ghc::filesystem if not, and makes the resulting API available in the
|
||||
// namespace fs.
|
||||
//---------------------------------------------------------------------------------------
|
||||
#ifndef GHC_FILESYSTEM_STD_H
|
||||
#define GHC_FILESYSTEM_STD_H
|
||||
|
||||
#if defined(_MSVC_LANG) && _MSVC_LANG >= 201703L || __cplusplus >= 201703L && defined(__has_include)
|
||||
// ^ Supports MSVC prior to 15.7 without setting /Zc:__cplusplus to fix __cplusplus
|
||||
// _MSVC_LANG works regardless. But without the switch, the compiler always reported 199711L: https://blogs.msdn.microsoft.com/vcblog/2018/04/09/msvc-now-correctly-reports-__cplusplus/
|
||||
#if __has_include(<filesystem>) // Two stage __has_include needed for MSVC 2015 and per https://gcc.gnu.org/onlinedocs/cpp/_005f_005fhas_005finclude.html
|
||||
#define GHC_USE_STD_FS
|
||||
|
||||
// Old Apple OSs don't support std::filesystem, though the header is available at compile
|
||||
// time. In particular, std::filesystem is unavailable before macOS 10.15, iOS/tvOS 13.0,
|
||||
// and watchOS 6.0.
|
||||
#ifdef __APPLE__
|
||||
#include <Availability.h>
|
||||
// Note: This intentionally uses std::filesystem on any new Apple OS, like visionOS
|
||||
// released after std::filesystem, where std::filesystem is always available.
|
||||
// (All other __<platform>_VERSION_MIN_REQUIREDs will be undefined and thus 0.)
|
||||
#if defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && __MAC_OS_X_VERSION_MIN_REQUIRED < 101500 \
|
||||
|| defined(__IPHONE_OS_VERSION_MIN_REQUIRED) && __IPHONE_OS_VERSION_MIN_REQUIRED < 130000 \
|
||||
|| defined(__TV_OS_VERSION_MIN_REQUIRED) && __TV_OS_VERSION_MIN_REQUIRED < 130000 \
|
||||
|| defined(__WATCH_OS_VERSION_MAX_ALLOWED) && __WATCH_OS_VERSION_MAX_ALLOWED < 60000
|
||||
#undef GHC_USE_STD_FS
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef GHC_USE_STD_FS
|
||||
#include <filesystem>
|
||||
namespace fs {
|
||||
using namespace std::filesystem;
|
||||
using ifstream = std::ifstream;
|
||||
using ofstream = std::ofstream;
|
||||
using fstream = std::fstream;
|
||||
}
|
||||
#else
|
||||
#include "filesystem.hpp"
|
||||
namespace fs {
|
||||
using namespace ghc::filesystem;
|
||||
using ifstream = ghc::filesystem::ifstream;
|
||||
using ofstream = ghc::filesystem::ofstream;
|
||||
using fstream = ghc::filesystem::fstream;
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // GHC_FILESYSTEM_STD_H
|
79
include/ghc/fs_std_fwd.hpp
Normal file
79
include/ghc/fs_std_fwd.hpp
Normal file
@ -0,0 +1,79 @@
|
||||
//---------------------------------------------------------------------------------------
|
||||
//
|
||||
// ghc::filesystem - A C++17-like filesystem implementation for C++11/C++14
|
||||
//
|
||||
//---------------------------------------------------------------------------------------
|
||||
//
|
||||
// Copyright (c) 2018, Steffen Schümann <s.schuemann@pobox.com>
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all
|
||||
// copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
//
|
||||
//---------------------------------------------------------------------------------------
|
||||
// fs_std_fwd.hpp - The forwarding header for the header/implementation separated usage of
|
||||
// ghc::filesystem that uses std::filesystem if it detects it.
|
||||
// This file can be include at any place, where fs::filesystem api is needed while
|
||||
// not bleeding implementation details (e.g. system includes) into the global namespace,
|
||||
// as long as one cpp includes fs_std_impl.hpp to deliver the matching implementations.
|
||||
//---------------------------------------------------------------------------------------
|
||||
#ifndef GHC_FILESYSTEM_STD_FWD_H
|
||||
#define GHC_FILESYSTEM_STD_FWD_H
|
||||
|
||||
#if defined(_MSVC_LANG) && _MSVC_LANG >= 201703L || __cplusplus >= 201703L && defined(__has_include)
|
||||
// ^ Supports MSVC prior to 15.7 without setting /Zc:__cplusplus to fix __cplusplus
|
||||
// _MSVC_LANG works regardless. But without the switch, the compiler always reported 199711L: https://blogs.msdn.microsoft.com/vcblog/2018/04/09/msvc-now-correctly-reports-__cplusplus/
|
||||
#if __has_include(<filesystem>) // Two stage __has_include needed for MSVC 2015 and per https://gcc.gnu.org/onlinedocs/cpp/_005f_005fhas_005finclude.html
|
||||
#define GHC_USE_STD_FS
|
||||
|
||||
// Old Apple OSs don't support std::filesystem, though the header is available at compile
|
||||
// time. In particular, std::filesystem is unavailable before macOS 10.15, iOS/tvOS 13.0,
|
||||
// and watchOS 6.0.
|
||||
#ifdef __APPLE__
|
||||
#include <Availability.h>
|
||||
// Note: This intentionally uses std::filesystem on any new Apple OS, like visionOS
|
||||
// released after std::filesystem, where std::filesystem is always available.
|
||||
// (All other __<platform>_VERSION_MIN_REQUIREDs will be undefined and thus 0.)
|
||||
#if defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && __MAC_OS_X_VERSION_MIN_REQUIRED < 101500 \
|
||||
|| defined(__IPHONE_OS_VERSION_MIN_REQUIRED) && __IPHONE_OS_VERSION_MIN_REQUIRED < 130000 \
|
||||
|| defined(__TV_OS_VERSION_MIN_REQUIRED) && __TV_OS_VERSION_MIN_REQUIRED < 130000 \
|
||||
|| defined(__WATCH_OS_VERSION_MAX_ALLOWED) && __WATCH_OS_VERSION_MAX_ALLOWED < 60000
|
||||
#undef GHC_USE_STD_FS
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef GHC_USE_STD_FS
|
||||
#include <filesystem>
|
||||
namespace fs {
|
||||
using namespace std::filesystem;
|
||||
using ifstream = std::ifstream;
|
||||
using ofstream = std::ofstream;
|
||||
using fstream = std::fstream;
|
||||
}
|
||||
#else
|
||||
#include "fs_fwd.hpp"
|
||||
namespace fs {
|
||||
using namespace ghc::filesystem;
|
||||
using ifstream = ghc::filesystem::ifstream;
|
||||
using ofstream = ghc::filesystem::ofstream;
|
||||
using fstream = ghc::filesystem::fstream;
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // GHC_FILESYSTEM_STD_FWD_H
|
60
include/ghc/fs_std_impl.hpp
Normal file
60
include/ghc/fs_std_impl.hpp
Normal file
@ -0,0 +1,60 @@
|
||||
//---------------------------------------------------------------------------------------
|
||||
//
|
||||
// ghc::filesystem - A C++17-like filesystem implementation for C++11/C++14
|
||||
//
|
||||
//---------------------------------------------------------------------------------------
|
||||
//
|
||||
// Copyright (c) 2018, Steffen Schümann <s.schuemann@pobox.com>
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all
|
||||
// copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
//
|
||||
//---------------------------------------------------------------------------------------
|
||||
// fs_std_impl.hpp - The implementation header for the header/implementation separated usage of
|
||||
// ghc::filesystem that does nothing if std::filesystem is detected.
|
||||
// This file can be used to hide the implementation of ghc::filesystem into a single cpp.
|
||||
// The cpp has to include this before including fs_std_fwd.hpp directly or via a different
|
||||
// header to work.
|
||||
//---------------------------------------------------------------------------------------
|
||||
#if defined(_MSVC_LANG) && _MSVC_LANG >= 201703L || __cplusplus >= 201703L && defined(__has_include)
|
||||
// ^ Supports MSVC prior to 15.7 without setting /Zc:__cplusplus to fix __cplusplus
|
||||
// _MSVC_LANG works regardless. But without the switch, the compiler always reported 199711L: https://blogs.msdn.microsoft.com/vcblog/2018/04/09/msvc-now-correctly-reports-__cplusplus/
|
||||
#if __has_include(<filesystem>) // Two stage __has_include needed for MSVC 2015 and per https://gcc.gnu.org/onlinedocs/cpp/_005f_005fhas_005finclude.html
|
||||
#define GHC_USE_STD_FS
|
||||
|
||||
// Old Apple OSs don't support std::filesystem, though the header is available at compile
|
||||
// time. In particular, std::filesystem is unavailable before macOS 10.15, iOS/tvOS 13.0,
|
||||
// and watchOS 6.0.
|
||||
#ifdef __APPLE__
|
||||
#include <Availability.h>
|
||||
// Note: This intentionally uses std::filesystem on any new Apple OS, like visionOS
|
||||
// released after std::filesystem, where std::filesystem is always available.
|
||||
// (All other __<platform>_VERSION_MIN_REQUIREDs will be undefined and thus 0.)
|
||||
#if defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && __MAC_OS_X_VERSION_MIN_REQUIRED < 101500 \
|
||||
|| defined(__IPHONE_OS_VERSION_MIN_REQUIRED) && __IPHONE_OS_VERSION_MIN_REQUIRED < 130000 \
|
||||
|| defined(__TV_OS_VERSION_MIN_REQUIRED) && __TV_OS_VERSION_MIN_REQUIRED < 130000 \
|
||||
|| defined(__WATCH_OS_VERSION_MAX_ALLOWED) && __WATCH_OS_VERSION_MAX_ALLOWED < 60000
|
||||
#undef GHC_USE_STD_FS
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef GHC_USE_STD_FS
|
||||
#include "fs_impl.hpp"
|
||||
#endif
|
@ -1,39 +1,105 @@
|
||||
|
||||
add_executable(filesystem_test filesystem_test.cpp ../filesystem.h catch.hpp)
|
||||
target_compile_options(filesystem_test PRIVATE
|
||||
$<$<CXX_COMPILER_ID:Clang>:-Wall -Wextra -Werror>
|
||||
$<$<CXX_COMPILER_ID:GNU>:-Wall -Werror>
|
||||
$<$<CXX_COMPILER_ID:MSVC>:/WX>)
|
||||
if(CMAKE_CXX_COMPILER_ID MATCHES MSVC)
|
||||
target_compile_definitions(filesystem_test PRIVATE _CRT_SECURE_NO_WARNINGS)
|
||||
endif()
|
||||
if(CMAKE_GENERATOR STREQUAL Xcode)
|
||||
add_executable(filesystem_test_cov filesystem_test.cpp ../filesystem.h catch.hpp)
|
||||
target_compile_options(filesystem_test_cov PRIVATE "$<$<CONFIG:DEBUG>:--coverage>")
|
||||
target_link_libraries(filesystem_test_cov PRIVATE --coverage)
|
||||
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake/")
|
||||
set(PARSE_CATCH_TESTS_ADD_TO_CONFIGURE_DEPENDS ON)
|
||||
include(ParseAndAddCatchTests)
|
||||
|
||||
if("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang" AND UNIX AND NOT APPLE AND NOT BSD)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++")
|
||||
set(CMAKE_EXE_LINKER_FLAGS "-lc++abi")
|
||||
endif()
|
||||
|
||||
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" AND (CMAKE_CXX_COMPILER_VERSION VERSION_EQUAL 7.0 OR CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 7.0))
|
||||
if(APPLE)
|
||||
include_directories(/usr/local/opt/llvm/include)
|
||||
link_directories(/usr/local/opt/llvm/lib)
|
||||
function(SetTestCompileOptions target_name)
|
||||
target_compile_options(${target_name} PRIVATE
|
||||
$<$<BOOL:${EMSCRIPTEN}>:-s DISABLE_EXCEPTION_CATCHING=0>
|
||||
$<$<OR:$<CXX_COMPILER_ID:Clang>,$<CXX_COMPILER_ID:AppleClang>>:-Wall -Wextra -Wshadow -Wconversion -Wsign-conversion -Wpedantic -Werror -Wno-deprecated-declarations>
|
||||
$<$<CXX_COMPILER_ID:GNU>:-Wall -Wextra -Wshadow -Wconversion -Wsign-conversion -Wpedantic -Wno-psabi -Werror -Wno-deprecated-declarations>
|
||||
$<$<CXX_COMPILER_ID:MSVC>:/WX /wd4996>
|
||||
$<$<BOOL:${CYGWIN}>:-Wa,-mbig-obj>)
|
||||
endfunction()
|
||||
|
||||
if(GHC_COVERAGE)
|
||||
message("Generating test runner for coverage run...")
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${CMCMAKE_EXE_LINKER_FLAGS} --coverage")
|
||||
add_executable(filesystem_test filesystem_test.cpp catch.hpp)
|
||||
if(MINGW)
|
||||
target_compile_options(filesystem_test PUBLIC --coverage "-Wa,-mbig-obj")
|
||||
else()
|
||||
target_compile_options(filesystem_test PUBLIC --coverage)
|
||||
endif()
|
||||
target_link_libraries(filesystem_test PUBLIC ghc_filesystem --coverage)
|
||||
if(${CMAKE_SYSTEM_NAME} MATCHES "(SunOS|Solaris)")
|
||||
target_link_libraries(filesystem_test PUBLIC xnet)
|
||||
endif()
|
||||
if(${CMAKE_SYSTEM_NAME} MATCHES "Haiku")
|
||||
target_link_libraries(filesystem_test PUBLIC network)
|
||||
endif()
|
||||
if("cxx_std_17" IN_LIST GHC_FILESYSTEM_TEST_COMPILE_FEATURES)
|
||||
AddTestExecutableWithStdCpp(17 filesystem_test.cpp catch.hpp)
|
||||
endif()
|
||||
if("cxx_std_20" IN_LIST GHC_FILESYSTEM_TEST_COMPILE_FEATURES)
|
||||
AddTestExecutableWithStdCpp(20 filesystem_test.cpp catch.hpp)
|
||||
endif()
|
||||
else()
|
||||
message("Generating test runner for normal test...")
|
||||
add_executable(filesystem_test filesystem_test.cpp catch.hpp)
|
||||
target_link_libraries(filesystem_test ghc_filesystem)
|
||||
if(${CMAKE_SYSTEM_NAME} MATCHES "(SunOS|Solaris)")
|
||||
target_link_libraries(filesystem_test xnet)
|
||||
endif()
|
||||
if(${CMAKE_SYSTEM_NAME} MATCHES "Haiku")
|
||||
target_link_libraries(filesystem_test network)
|
||||
endif()
|
||||
SetTestCompileOptions(filesystem_test)
|
||||
if(CMAKE_CXX_COMPILER_ID MATCHES MSVC)
|
||||
target_compile_definitions(filesystem_test PRIVATE _CRT_SECURE_NO_WARNINGS WIN32_LEAN_AND_MEAN NOMINMAX)
|
||||
endif()
|
||||
if(EMSCRIPTEN)
|
||||
set_target_properties(filesystem_test PROPERTIES LINK_FLAGS "-g4 -s DISABLE_EXCEPTION_CATCHING=0 -s ALLOW_MEMORY_GROWTH=1")
|
||||
endif()
|
||||
ParseAndAddCatchTests(filesystem_test)
|
||||
if(GHC_FILESYSTEM_BUILD_STD_TESTING)
|
||||
AddExecutableWithStdFS(std_filesystem_test filesystem_test.cpp catch.hpp)
|
||||
endif()
|
||||
if(WIN32)
|
||||
add_executable(filesystem_test_char filesystem_test.cpp catch.hpp)
|
||||
target_link_libraries(filesystem_test_char ghc_filesystem)
|
||||
SetTestCompileOptions(filesystem_test_char)
|
||||
if(CMAKE_CXX_COMPILER_ID MATCHES MSVC)
|
||||
target_compile_definitions(filesystem_test_char PRIVATE _CRT_SECURE_NO_WARNINGS GHC_WIN_DISABLE_WSTRING_STORAGE_TYPE)
|
||||
else()
|
||||
target_compile_definitions(filesystem_test_char PRIVATE GHC_WIN_DISABLE_WSTRING_STORAGE_TYPE)
|
||||
endif()
|
||||
ParseAndAddCatchTests(filesystem_test_char)
|
||||
endif()
|
||||
if("cxx_std_17" IN_LIST GHC_FILESYSTEM_TEST_COMPILE_FEATURES)
|
||||
AddTestExecutableWithStdCpp(17 filesystem_test.cpp catch.hpp)
|
||||
endif()
|
||||
if("cxx_std_20" IN_LIST GHC_FILESYSTEM_TEST_COMPILE_FEATURES)
|
||||
AddTestExecutableWithStdCpp(20 filesystem_test.cpp catch.hpp)
|
||||
endif()
|
||||
add_executable(std_filesystem_test filesystem_test.cpp ../filesystem.h catch.hpp)
|
||||
set_property(TARGET std_filesystem_test PROPERTY CXX_STANDARD 17)
|
||||
target_compile_definitions(std_filesystem_test PRIVATE USE_STD_FS)
|
||||
target_link_libraries(std_filesystem_test -lc++fs)
|
||||
endif()
|
||||
if (CMAKE_COMPILER_IS_GNUCXX AND (CMAKE_CXX_COMPILER_VERSION VERSION_EQUAL 8.0 OR CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 8.0))
|
||||
add_executable(std_filesystem_test filesystem_test.cpp ../filesystem.h catch.hpp)
|
||||
set_property(TARGET std_filesystem_test PROPERTY CXX_STANDARD 17)
|
||||
target_compile_definitions(std_filesystem_test PRIVATE USE_STD_FS)
|
||||
target_link_libraries(std_filesystem_test -lstdc++fs)
|
||||
endif()
|
||||
if(CMAKE_CXX_COMPILER_ID MATCHES MSVC AND (CMAKE_CXX_COMPILER_VERSION VERSION_EQUAL 19.15 OR CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 19.15))
|
||||
add_executable(std_filesystem_test filesystem_test.cpp ../filesystem.h catch.hpp)
|
||||
set_property(TARGET std_filesystem_test PROPERTY CXX_STANDARD 17)
|
||||
target_compile_options(std_filesystem_test PRIVATE "/Zc:__cplusplus")
|
||||
target_compile_definitions(std_filesystem_test PRIVATE USE_STD_FS _CRT_SECURE_NO_WARNINGS)
|
||||
endif()
|
||||
|
||||
add_executable(multifile_test multi1.cpp multi2.cpp ../filesystem.h catch.hpp)
|
||||
add_executable(multifile_test multi1.cpp multi2.cpp catch.hpp)
|
||||
target_link_libraries(multifile_test ghc_filesystem)
|
||||
add_test(multifile_test multifile_test)
|
||||
|
||||
add_executable(fwd_impl_test fwd_test.cpp impl_test.cpp)
|
||||
target_link_libraries(fwd_impl_test ghc_filesystem)
|
||||
if(${CMAKE_SYSTEM_NAME} MATCHES "(SunOS|Solaris)")
|
||||
target_link_libraries(fwd_impl_test xnet)
|
||||
endif()
|
||||
if(${CMAKE_SYSTEM_NAME} MATCHES "Haiku")
|
||||
target_link_libraries(fwd_impl_test network)
|
||||
endif()
|
||||
SetTestCompileOptions(fwd_impl_test)
|
||||
if(CMAKE_CXX_COMPILER_ID MATCHES MSVC)
|
||||
target_compile_definitions(fwd_impl_test PRIVATE _CRT_SECURE_NO_WARNINGS WIN32_LEAN_AND_MEAN NOMINMAX)
|
||||
endif()
|
||||
add_test(fwd_impl_test fwd_impl_test)
|
||||
|
||||
add_executable(exception exception.cpp)
|
||||
if(NOT MSVC)
|
||||
target_compile_options(exception PRIVATE -fno-exceptions)
|
||||
endif()
|
||||
target_include_directories(exception PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../include)
|
||||
SetTestCompileOptions(exception)
|
||||
|
7827
test/catch.hpp
7827
test/catch.hpp
File diff suppressed because it is too large
Load Diff
230
test/cmake/ParseAndAddCatchTests.cmake
Normal file
230
test/cmake/ParseAndAddCatchTests.cmake
Normal file
@ -0,0 +1,230 @@
|
||||
#==================================================================================================#
|
||||
# supported macros #
|
||||
# - TEST_CASE, #
|
||||
# - SCENARIO, #
|
||||
# - TEST_CASE_METHOD, #
|
||||
# - CATCH_TEST_CASE, #
|
||||
# - CATCH_SCENARIO, #
|
||||
# - CATCH_TEST_CASE_METHOD. #
|
||||
# #
|
||||
# Usage #
|
||||
# 1. make sure this module is in the path or add this otherwise: #
|
||||
# set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake.modules/") #
|
||||
# 2. make sure that you've enabled testing option for the project by the call: #
|
||||
# enable_testing() #
|
||||
# 3. add the lines to the script for testing target (sample CMakeLists.txt): #
|
||||
# project(testing_target) #
|
||||
# set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake.modules/") #
|
||||
# enable_testing() #
|
||||
# #
|
||||
# find_path(CATCH_INCLUDE_DIR "catch.hpp") #
|
||||
# include_directories(${INCLUDE_DIRECTORIES} ${CATCH_INCLUDE_DIR}) #
|
||||
# #
|
||||
# file(GLOB SOURCE_FILES "*.cpp") #
|
||||
# add_executable(${PROJECT_NAME} ${SOURCE_FILES}) #
|
||||
# #
|
||||
# include(ParseAndAddCatchTests) #
|
||||
# ParseAndAddCatchTests(${PROJECT_NAME}) #
|
||||
# #
|
||||
# The following variables affect the behavior of the script: #
|
||||
# #
|
||||
# PARSE_CATCH_TESTS_VERBOSE (Default OFF) #
|
||||
# -- enables debug messages #
|
||||
# PARSE_CATCH_TESTS_NO_HIDDEN_TESTS (Default OFF) #
|
||||
# -- excludes tests marked with [!hide], [.] or [.foo] tags #
|
||||
# PARSE_CATCH_TESTS_ADD_FIXTURE_IN_TEST_NAME (Default ON) #
|
||||
# -- adds fixture class name to the test name #
|
||||
# PARSE_CATCH_TESTS_ADD_TARGET_IN_TEST_NAME (Default ON) #
|
||||
# -- adds cmake target name to the test name #
|
||||
# PARSE_CATCH_TESTS_ADD_TO_CONFIGURE_DEPENDS (Default OFF) #
|
||||
# -- causes CMake to rerun when file with tests changes so that new tests will be discovered #
|
||||
# #
|
||||
# One can also set (locally) the optional variable OptionalCatchTestLauncher to precise the way #
|
||||
# a test should be run. For instance to use test MPI, one can write #
|
||||
# set(OptionalCatchTestLauncher ${MPIEXEC} ${MPIEXEC_NUMPROC_FLAG} ${NUMPROC}) #
|
||||
# just before calling this ParseAndAddCatchTests function #
|
||||
# #
|
||||
# The AdditionalCatchParameters optional variable can be used to pass extra argument to the test #
|
||||
# command. For example, to include successful tests in the output, one can write #
|
||||
# set(AdditionalCatchParameters --success) #
|
||||
# #
|
||||
# After the script, the ParseAndAddCatchTests_TESTS property for the target, and for each source #
|
||||
# file in the target is set, and contains the list of the tests extracted from that target, or #
|
||||
# from that file. This is useful, for example to add further labels or properties to the tests. #
|
||||
# #
|
||||
#==================================================================================================#
|
||||
|
||||
if (CMAKE_MINIMUM_REQUIRED_VERSION VERSION_LESS 2.8.8)
|
||||
message(FATAL_ERROR "ParseAndAddCatchTests requires CMake 2.8.8 or newer")
|
||||
endif()
|
||||
|
||||
option(PARSE_CATCH_TESTS_VERBOSE "Print Catch to CTest parser debug messages" OFF)
|
||||
option(PARSE_CATCH_TESTS_NO_HIDDEN_TESTS "Exclude tests with [!hide], [.] or [.foo] tags" OFF)
|
||||
option(PARSE_CATCH_TESTS_ADD_FIXTURE_IN_TEST_NAME "Add fixture class name to the test name" ON)
|
||||
option(PARSE_CATCH_TESTS_ADD_TARGET_IN_TEST_NAME "Add target name to the test name" ON)
|
||||
option(PARSE_CATCH_TESTS_ADD_TO_CONFIGURE_DEPENDS "Add test file to CMAKE_CONFIGURE_DEPENDS property" OFF)
|
||||
|
||||
function(ParseAndAddCatchTests_PrintDebugMessage)
|
||||
if(PARSE_CATCH_TESTS_VERBOSE)
|
||||
message(STATUS "ParseAndAddCatchTests: ${ARGV}")
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
# This removes the contents between
|
||||
# - block comments (i.e. /* ... */)
|
||||
# - full line comments (i.e. // ... )
|
||||
# contents have been read into '${CppCode}'.
|
||||
# !keep partial line comments
|
||||
function(ParseAndAddCatchTests_RemoveComments CppCode)
|
||||
string(ASCII 2 CMakeBeginBlockComment)
|
||||
string(ASCII 3 CMakeEndBlockComment)
|
||||
string(REGEX REPLACE "/\\*" "${CMakeBeginBlockComment}" ${CppCode} "${${CppCode}}")
|
||||
string(REGEX REPLACE "\\*/" "${CMakeEndBlockComment}" ${CppCode} "${${CppCode}}")
|
||||
string(REGEX REPLACE "${CMakeBeginBlockComment}[^${CMakeEndBlockComment}]*${CMakeEndBlockComment}" "" ${CppCode} "${${CppCode}}")
|
||||
string(REGEX REPLACE "\n[ \t]*//+[^\n]+" "\n" ${CppCode} "${${CppCode}}")
|
||||
|
||||
set(${CppCode} "${${CppCode}}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
# Worker function
|
||||
function(ParseAndAddCatchTests_ParseFile SourceFile TestTarget)
|
||||
# If SourceFile is an object library, do not scan it (as it is not a file). Exit without giving a warning about a missing file.
|
||||
if(SourceFile MATCHES "\\\$<TARGET_OBJECTS:.+>")
|
||||
ParseAndAddCatchTests_PrintDebugMessage("Detected OBJECT library: ${SourceFile} this will not be scanned for tests.")
|
||||
return()
|
||||
endif()
|
||||
# According to CMake docs EXISTS behavior is well-defined only for full paths.
|
||||
get_filename_component(SourceFile ${SourceFile} ABSOLUTE)
|
||||
if(NOT EXISTS ${SourceFile})
|
||||
message(WARNING "Cannot find source file: ${SourceFile}")
|
||||
return()
|
||||
endif()
|
||||
ParseAndAddCatchTests_PrintDebugMessage("parsing ${SourceFile}")
|
||||
file(STRINGS ${SourceFile} Contents NEWLINE_CONSUME)
|
||||
|
||||
# Remove block and fullline comments
|
||||
ParseAndAddCatchTests_RemoveComments(Contents)
|
||||
|
||||
# Find definition of test names
|
||||
string(REGEX MATCHALL "[ \t]*(CATCH_)?(TEST_CASE_METHOD|SCENARIO|TEST_CASE)[ \t]*\\([^\)]+\\)+[ \t\n]*{+[ \t]*(//[^\n]*[Tt][Ii][Mm][Ee][Oo][Uu][Tt][ \t]*[0-9]+)*" Tests "${Contents}")
|
||||
|
||||
if(PARSE_CATCH_TESTS_ADD_TO_CONFIGURE_DEPENDS AND Tests)
|
||||
ParseAndAddCatchTests_PrintDebugMessage("Adding ${SourceFile} to CMAKE_CONFIGURE_DEPENDS property")
|
||||
set_property(
|
||||
DIRECTORY
|
||||
APPEND
|
||||
PROPERTY CMAKE_CONFIGURE_DEPENDS ${SourceFile}
|
||||
)
|
||||
endif()
|
||||
|
||||
foreach(TestName ${Tests})
|
||||
# Strip newlines
|
||||
string(REGEX REPLACE "\\\\\n|\n" "" TestName "${TestName}")
|
||||
|
||||
# Get test type and fixture if applicable
|
||||
string(REGEX MATCH "(CATCH_)?(TEST_CASE_METHOD|SCENARIO|TEST_CASE)[ \t]*\\([^,^\"]*" TestTypeAndFixture "${TestName}")
|
||||
string(REGEX MATCH "(CATCH_)?(TEST_CASE_METHOD|SCENARIO|TEST_CASE)" TestType "${TestTypeAndFixture}")
|
||||
string(REGEX REPLACE "${TestType}\\([ \t]*" "" TestFixture "${TestTypeAndFixture}")
|
||||
|
||||
# Get string parts of test definition
|
||||
string(REGEX MATCHALL "\"+([^\\^\"]|\\\\\")+\"+" TestStrings "${TestName}")
|
||||
|
||||
# Strip wrapping quotation marks
|
||||
string(REGEX REPLACE "^\"(.*)\"$" "\\1" TestStrings "${TestStrings}")
|
||||
string(REPLACE "\";\"" ";" TestStrings "${TestStrings}")
|
||||
|
||||
# Validate that a test name and tags have been provided
|
||||
list(LENGTH TestStrings TestStringsLength)
|
||||
if(TestStringsLength GREATER 2 OR TestStringsLength LESS 1)
|
||||
message(FATAL_ERROR "You must provide a valid test name and tags for all tests in ${SourceFile}")
|
||||
endif()
|
||||
|
||||
# Assign name and tags
|
||||
list(GET TestStrings 0 Name)
|
||||
if("${TestType}" STREQUAL "SCENARIO")
|
||||
set(Name "Scenario: ${Name}")
|
||||
endif()
|
||||
if(PARSE_CATCH_TESTS_ADD_FIXTURE_IN_TEST_NAME AND "${TestType}" MATCHES "(CATCH_)?TEST_CASE_METHOD" AND TestFixture )
|
||||
set(CTestName "${TestFixture}:${Name}")
|
||||
else()
|
||||
set(CTestName "${Name}")
|
||||
endif()
|
||||
if(PARSE_CATCH_TESTS_ADD_TARGET_IN_TEST_NAME)
|
||||
set(CTestName "${TestTarget}:${CTestName}")
|
||||
endif()
|
||||
# add target to labels to enable running all tests added from this target
|
||||
set(Labels ${TestTarget})
|
||||
if(TestStringsLength EQUAL 2)
|
||||
list(GET TestStrings 1 Tags)
|
||||
string(TOLOWER "${Tags}" Tags)
|
||||
# remove target from labels if the test is hidden
|
||||
if("${Tags}" MATCHES ".*\\[!?(hide|\\.)\\].*")
|
||||
list(REMOVE_ITEM Labels ${TestTarget})
|
||||
endif()
|
||||
string(REPLACE "]" ";" Tags "${Tags}")
|
||||
string(REPLACE "[" "" Tags "${Tags}")
|
||||
else()
|
||||
# unset tags variable from previous loop
|
||||
unset(Tags)
|
||||
endif()
|
||||
|
||||
list(APPEND Labels ${Tags})
|
||||
|
||||
set(HiddenTagFound OFF)
|
||||
foreach(label ${Labels})
|
||||
string(REGEX MATCH "^!hide|^\\." result ${label})
|
||||
if(result)
|
||||
set(HiddenTagFound ON)
|
||||
break()
|
||||
endif(result)
|
||||
endforeach(label)
|
||||
if(PARSE_CATCH_TESTS_NO_HIDDEN_TESTS AND ${HiddenTagFound} AND ${CMAKE_VERSION} VERSION_LESS "3.9")
|
||||
ParseAndAddCatchTests_PrintDebugMessage("Skipping test \"${CTestName}\" as it has [!hide], [.] or [.foo] label")
|
||||
else()
|
||||
ParseAndAddCatchTests_PrintDebugMessage("Adding test \"${CTestName}\"")
|
||||
if(Labels)
|
||||
ParseAndAddCatchTests_PrintDebugMessage("Setting labels to ${Labels}")
|
||||
endif()
|
||||
|
||||
# Escape commas in the test spec
|
||||
string(REPLACE "," "\\," Name ${Name})
|
||||
|
||||
# Work around CMake 3.18.0 change in `add_test()`, before the escaped quotes were neccessary,
|
||||
# only with CMake 3.18.0 the escaped double quotes confuse the call. This change is reverted in 3.18.1
|
||||
if(NOT ${CMAKE_VERSION} VERSION_EQUAL "3.18")
|
||||
set(CTestName "\"${CTestName}\"")
|
||||
endif()
|
||||
# Add the test and set its properties
|
||||
add_test(NAME "${CTestName}" COMMAND ${OptionalCatchTestLauncher} $<TARGET_FILE:${TestTarget}> ${Name} ${AdditionalCatchParameters})
|
||||
# Old CMake versions do not document VERSION_GREATER_EQUAL, so we use VERSION_GREATER with 3.8 instead
|
||||
if(PARSE_CATCH_TESTS_NO_HIDDEN_TESTS AND ${HiddenTagFound} AND ${CMAKE_VERSION} VERSION_GREATER "3.8")
|
||||
ParseAndAddCatchTests_PrintDebugMessage("Setting DISABLED test property")
|
||||
set_tests_properties("${CTestName}" PROPERTIES DISABLED ON)
|
||||
else()
|
||||
set_tests_properties("${CTestName}" PROPERTIES FAIL_REGULAR_EXPRESSION "No tests ran"
|
||||
LABELS "${Labels}")
|
||||
endif()
|
||||
set_property(
|
||||
TARGET ${TestTarget}
|
||||
APPEND
|
||||
PROPERTY ParseAndAddCatchTests_TESTS "${CTestName}")
|
||||
set_property(
|
||||
SOURCE ${SourceFile}
|
||||
APPEND
|
||||
PROPERTY ParseAndAddCatchTests_TESTS "${CTestName}")
|
||||
endif()
|
||||
|
||||
|
||||
endforeach()
|
||||
endfunction()
|
||||
|
||||
# entry point
|
||||
function(ParseAndAddCatchTests TestTarget)
|
||||
ParseAndAddCatchTests_PrintDebugMessage("Started parsing ${TestTarget}")
|
||||
get_target_property(SourceFiles ${TestTarget} SOURCES)
|
||||
ParseAndAddCatchTests_PrintDebugMessage("Found the following sources: ${SourceFiles}")
|
||||
foreach(SourceFile ${SourceFiles})
|
||||
ParseAndAddCatchTests_ParseFile(${SourceFile} ${TestTarget})
|
||||
endforeach()
|
||||
ParseAndAddCatchTests_PrintDebugMessage("Finished parsing ${TestTarget}")
|
||||
endfunction()
|
5
test/exception.cpp
Normal file
5
test/exception.cpp
Normal file
@ -0,0 +1,5 @@
|
||||
#include <ghc/filesystem.hpp>
|
||||
|
||||
int main() {
|
||||
return 0;
|
||||
}
|
File diff suppressed because it is too large
Load Diff
7
test/fwd_test.cpp
Normal file
7
test/fwd_test.cpp
Normal file
@ -0,0 +1,7 @@
|
||||
// This test file is part of the fwd_test.cpp/impl_test.cpp pair
|
||||
// and used to test the new optional two-part usage of ghc::filesystem
|
||||
// where exactly one cpp includes fs_impl.hpp and all others use
|
||||
// fs_fwd.hpp (to test this with maximum functionality, the unit tests
|
||||
// are included here, signaling they should only include the fs_fwd.hpp)
|
||||
#define GHC_FILESYSTEM_FWD_TEST
|
||||
#include "filesystem_test.cpp"
|
8
test/impl_test.cpp
Normal file
8
test/impl_test.cpp
Normal file
@ -0,0 +1,8 @@
|
||||
// This test file is part of the fwd_test.cpp/impl_test.cpp pair
|
||||
// and used to test the new optional two-part usage of ghc::filesystem
|
||||
// where exactly one cpp includes fs_impl.hpp and all others use
|
||||
// fs_fwd.hpp (to test this with maximum functionality, the unit tests
|
||||
// are included here, signaling they should only include the fs_fwd.hpp)
|
||||
#include <ghc/fs_impl.hpp>
|
||||
#define CATCH_CONFIG_MAIN
|
||||
#include "catch.hpp"
|
@ -1,41 +1,33 @@
|
||||
//---------------------------------------------------------------------------------------
|
||||
//
|
||||
// Copyright (c) 2018, Steffen Schümann <s.schuemann@pobox.com>
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without modification,
|
||||
// are permitted provided that the following conditions are met:
|
||||
// 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:
|
||||
//
|
||||
// 1. Redistributions of source code must retain the above copyright notice, this
|
||||
// list of conditions and the following disclaimer.
|
||||
// The above copyright notice and this permission notice shall be included in all
|
||||
// copies or substantial portions of the Software.
|
||||
//
|
||||
// 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. Neither the name of the copyright holder nor the names of its contributors
|
||||
// may 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.
|
||||
// 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.
|
||||
//
|
||||
//---------------------------------------------------------------------------------------
|
||||
#define CATCH_CONFIG_MAIN
|
||||
#include "catch.hpp"
|
||||
|
||||
#include "../filesystem.h"
|
||||
#include <ghc/filesystem.hpp>
|
||||
namespace fs = ghc::filesystem;
|
||||
|
||||
// This test and the one in multi2.cpp doesn't actualy test relevant functionality,
|
||||
// This test and the one in multi2.cpp doesn't actually test relevant functionality,
|
||||
// it is just used to check that it is possible to include filesystem.h in multiple
|
||||
// source files.
|
||||
TEST_CASE("Multifile-test 1", "[multi]")
|
||||
|
@ -1,36 +1,28 @@
|
||||
//---------------------------------------------------------------------------------------
|
||||
//
|
||||
// Copyright (c) 2018, Steffen Schümann <s.schuemann@pobox.com>
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without modification,
|
||||
// are permitted provided that the following conditions are met:
|
||||
// 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:
|
||||
//
|
||||
// 1. Redistributions of source code must retain the above copyright notice, this
|
||||
// list of conditions and the following disclaimer.
|
||||
// The above copyright notice and this permission notice shall be included in all
|
||||
// copies or substantial portions of the Software.
|
||||
//
|
||||
// 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. Neither the name of the copyright holder nor the names of its contributors
|
||||
// may 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.
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
//
|
||||
//---------------------------------------------------------------------------------------
|
||||
#include "catch.hpp"
|
||||
#include "../filesystem.h"
|
||||
#include <ghc/filesystem.hpp>
|
||||
namespace fs = ghc::filesystem;
|
||||
|
||||
// This test and the one in multi1.cpp doesn't actualy test relevant functionality,
|
||||
|
Loading…
x
Reference in New Issue
Block a user