-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #10 from kamrann/pr/v11-modules
fmt v11 and (preliminary) c++20 modules support
- Loading branch information
Showing
24 changed files
with
241 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
.bdep/ | ||
.vs/ | ||
|
||
# Local default options files. | ||
# | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# Compiler/linker output. | ||
# | ||
*.d | ||
*.t | ||
*.i | ||
*.i.* | ||
*.ii | ||
*.ii.* | ||
*.o | ||
*.obj | ||
*.gcm | ||
*.pcm | ||
*.ifc | ||
*.so | ||
*.dylib | ||
*.dll | ||
*.a | ||
*.lib | ||
*.exp | ||
*.pdb | ||
*.ilk | ||
*.exe | ||
*.exe.dlls/ | ||
*.exe.manifest | ||
*.pc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
basics | ||
|
||
# Testscript output directory (can be symlink). | ||
# | ||
test-basics |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
include ../test-main/ | ||
|
||
# NOTE: Maintaining explicit lists to match upstream, as it's not clear that there is intended to be a uniform pattern that can be reliably globbed. | ||
# See individual invocations of add_fmt_test() in upstream/test/CMakeLists.txt | ||
|
||
|
||
# Tests that use gtest, and do not require any additional source/headers beyond a single cc file | ||
|
||
gtest_test_names = \ | ||
args-test \ | ||
assert-test \ | ||
base-test \ | ||
chrono-test \ | ||
color-test \ | ||
compile-fp-test \ | ||
compile-test \ | ||
format-test \ | ||
gtest-extra-test \ | ||
noexception-test \ | ||
os-test \ | ||
ostream-test \ | ||
printf-test \ | ||
std-test \ | ||
unicode-test \ | ||
xchar-test | ||
|
||
# NOTE: header-only-test - Excluded as this package does not currently provide support for FMT_HEADER_ONLY. | ||
# TODO: scan-test - Excluded due to unresolved linker errors. | ||
|
||
for test_name : $gtest_test_names | ||
{ | ||
./: exe{$test_name} : test/cxx{$test_name} | ||
exe{$test_name}: ../test-main/liba{test-main}: | ||
{ | ||
bin.whole = true | ||
} | ||
} | ||
|
||
# END [Tests that use gtest, and do not require any additional source/headers beyond a single cc file] | ||
|
||
|
||
# Tests using gtest but with additional prerequisites | ||
|
||
./: exe{ranges-test} : test/cxx{ranges-test ranges-odr-test} | ||
exe{ranges-test}: ../test-main/liba{test-main}: | ||
{ | ||
bin.whole = true | ||
} | ||
|
||
# NOTE: format-impl-test- For whatever reason, format-impl-test is tied in upstream to header-only-test, which we do not support. Attempting to compile it alone yields errors, therefore omitted. | ||
# TODO: posix-mock-test - Excluded pending further work. Needs posix-mock.h, and has some msvc/runtime conditional logic that needs looking into. | ||
|
||
# END [Tests using gtest but with additional prerequisites] | ||
|
||
|
||
# Tests which do not use gtest and therefore should link directly to fmt only and not the test-main lib | ||
|
||
# TODO: Is there a clean way to use a declarative list but with more structure, in order to pair names to additional options? | ||
standalone_test_names = \ | ||
enforce-checks-test # -DFMT_ENFORCE_COMPILE_STRING | ||
|
||
import fmt = fmt%lib{fmt} | ||
|
||
for test_name : $standalone_test_names | ||
{ | ||
./: exe{$test_name} : test/cxx{$test_name} $fmt | ||
} | ||
|
||
# END [Tests which do not use gtest and therefore should link directly to fmt only and not the test-main lib] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../upstream/test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
/config.build | ||
/root/ | ||
/bootstrap/ | ||
build/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
project = fmt-tests | ||
|
||
using version | ||
using config | ||
using test | ||
using dist |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# Uncomment to suppress warnings coming from external libraries. | ||
# | ||
#cxx.internal.scope = current | ||
|
||
cxx.std = latest | ||
|
||
using cxx | ||
|
||
hxx{*}: extension = h | ||
mxx{*}: extension = cc | ||
cxx{*}: extension = cc | ||
|
||
# All executables are tests | ||
# | ||
exe{*}: test = true | ||
|
||
# The test target for cross-testing (running tests under Wine, etc). | ||
# | ||
test.target = $cxx.target |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
./: {*/ -build/} manifest |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
: 1 | ||
name: fmt-tests | ||
version: 11.0.1-a.0.z | ||
project: fmt | ||
summary: Tests package for fmt upstream tests | ||
license: MIT | ||
url: https://github.com/fmtlib/fmt/ | ||
|
||
depends: * build2 >= 0.17.0 | ||
depends: * bpkg >= 0.17.0 | ||
|
||
depends: gtest ^1.11.0 | ||
depends: gmock ^1.11.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
|
||
libs = | ||
import libs += fmt%lib{fmt} | ||
import libs += gtest%lib{gtest} gmock%lib{gmock} | ||
|
||
liba{test-main}: test/cxx{test-main gtest-extra util} test/hxx{gtest-extra mock-allocator test-assert util} $libs | ||
|
||
# Export options. | ||
# | ||
liba{test-main}: | ||
{ | ||
cxx.export.poptions += "-I$src_base/test" | ||
cxx.export.libs = $libs | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../upstream/test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,6 +9,18 @@ url: https://github.com/fmtlib/fmt/ | |
package-url: https://github.com/build2-packaging/fmt/ | ||
package-email: [email protected] | ||
|
||
tests: fmt-tests == $ | ||
|
||
depends: * build2 >= 0.17.0 | ||
depends: * bpkg >= 0.17.0 | ||
|
||
builds: default | ||
builds: -freebsd ; fmt tests failing, fixed on upstream master, pending removal next package release after 11.0.2 | ||
build-exclude: linux_debian_12-clang_17 ; clang-17 bug with libstdc++ std::tuple (https://github.com/llvm/llvm-project/issues/61415) | ||
build-exclude: **/x86_64-w64-mingw32 ; unknown error building installed tests 'error: unable to stat path D:\a\msys64\mingw64\lib\x86_64-w64-mingw32\14.1.0\pkgconfig\: the device is not ready' | ||
|
||
# Modules support still not sufficient to enable on CI | ||
#modules-builds: latest : &( +clang-18+ +msvc ) ; Modules builds only supported for latest Clang and MSVC | ||
#modules-build-config: config.cxx.features.modules=true ; Enable c++20 modules | ||
#modules-only-builds: latest : &( +clang-18+ +msvc ) ; Modules builds only supported for latest Clang and MSVC | ||
#modules-only-build-config: config.cxx.features.modules=true config.fmt.modules_only=true ; Enable c++20 modules and disable header usage |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,11 @@ | ||
import! [metadata, rule_hint=cxx.link] libs = fmt%lib{fmt} | ||
|
||
./ : exe{driver} : {cxx}{driver} hxx{tests.inl} $libs testscript{**} | ||
./ : exe{driver} : include = $($libs: fmt.has_header) | ||
./ : exe{driver-modules} : include = $($libs: fmt.has_module) | ||
|
||
if $($libs: fmt.is_module) | ||
{ | ||
./ : exe{driver-modules} : {cxx}{driver-modules} hxx{tests.inl} $libs testscript{**} | ||
} | ||
exe{driver} : {cxx}{driver} hxx{tests.inl} $libs testscript{**} | ||
|
||
# For purposes of verifying that fmt headers are not made available for include when in modules-only mode | ||
cxx.poptions =+ "-DFMT_BUILD2_HAS_HEADER=($($libs: fmt.has_header) ? 1 : 0)" | ||
|
||
exe{driver-modules} : {cxx}{driver-modules} hxx{tests.inl} $libs testscript{**} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,14 @@ | ||
|
||
// Verify that fmt headers are not available if config.fmt.modules_only is true | ||
#if __has_include(<fmt/version.h>) != FMT_BUILD2_HAS_HEADER | ||
#error fmt headers should be available for include iff config.fmt.modules_only == false | ||
#endif | ||
|
||
#include <cassert> | ||
import std; | ||
#include <string> | ||
#include <chrono> | ||
#include <vector> | ||
|
||
import fmt; | ||
|
||
#include "tests.inl" | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
#include <cassert> | ||
#include <string> | ||
#include <chrono> | ||
#include <vector> | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,4 @@ | ||
: 1 | ||
location: fmt/ | ||
: | ||
location: fmt-tests/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,6 @@ | ||
: 1 | ||
summary: fmt project repository | ||
|
||
#: | ||
#role: prerequisite | ||
#location: https://pkg.cppget.org/1/stable | ||
#trust: ... | ||
|
||
#: | ||
#role: prerequisite | ||
#location: https://git.build2.org/hello/libhello.git | ||
: | ||
role: prerequisite | ||
location: https://pkg.cppget.org/1/stable |
Submodule upstream
updated
15 files
+1 −0 | .github/workflows/lint.yml | |
+30 −0 | ChangeLog.md | |
+9 −9 | README.md | |
+2 −2 | doc/api.md | |
+47 −31 | include/fmt/base.h | |
+32 −8 | include/fmt/format-inl.h | |
+22 −14 | include/fmt/format.h | |
+1 −1 | include/fmt/ranges.h | |
+43 −0 | support/check-commits | |
+4 −1 | test/CMakeLists.txt | |
+19 −1 | test/base-test.cc | |
+43 −0 | test/format-test.cc | |
+25 −0 | test/perf-sanity.cc | |
+22 −10 | test/ranges-test.cc | |
+5 −2 | test/scan.h |