-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fmt v11 and c++20 modules support #10
Merged
Merged
Changes from all commits
Commits
Show all changes
37 commits
Select commit
Hold shift + click to select a range
5bc0f0f
Remove enable_modules build config variable, use cxx.features.modules…
kamrann a836c69
Include bmis target type when setting export poptions
kamrann 1f14622
Automatically enable FMT_ATTACH_TO_GLOBAL_MODULE when building as mod…
kamrann f808761
Replace import std; in smoke tests with #includes, pending implementi…
kamrann 0757158
Add package configuration variable to toggle use of import std.
kamrann a9ee48b
Add config option for a modules-only mode.
kamrann b2e4c3b
Point upstream to master branch of upstream fmt - this has merged in …
kamrann c271d77
Add new package for hosting upstream tests.
kamrann 110906e
Add .vs/ folder to gitignore
kamrann ab0cc5e
Align the test package version number to the main package.
kamrann 79827a3
Adjusted fmt-tests buildfiles to attempt to fix issues with include p…
kamrann b5ecdbf
Marked all executable targets in fmt-tests as tests.
kamrann 6007797
Tweak to ranges-test to match upstream CMake setup.
kamrann 6042313
Symc to latest upstream
kamrann 4841d77
Refactor smoke test buildfile to avoid conditional target dependencies.
kamrann 014a3d8
Experiment with package specific CI configurations.
kamrann 8055762
Force reproces=true on MSVC modules builds to work around compiler bug.
kamrann 1130bb6
Fix for incorrect variable prefix.
kamrann c553ca8
Constrain modules CI build configs to latest.
kamrann 495ab27
Experiment constraining to clang.
kamrann c328c6c
Switch from latest to experimental
kamrann b3b1dcc
Add msvc to CI package configs
kamrann 82e02d5
Revert CI configs to latest
kamrann dc8fb4b
Change smoke test to use template parameter for format parse context,…
kamrann 105613f
Update upstream to grab latest fixes.
kamrann f3a93ca
Merge branch 'pr/v11-modules' into tests-prototyping
kamrann 780ba03
Upstream submodule update.
kamrann 682c69b
Upstream update.
kamrann 2922bb4
Upstream sync.
kamrann 3d7398a
Upstream sync
kamrann c5c5ab5
Upstream sync.
kamrann 05855de
Disable modules builds on CI.
kamrann 8841258
Switch upstream branch bag to latest tagged release (11.0.2)
kamrann 7c56c1c
Add some CI build exclusions.
kamrann 6b5d114
Update package readme with latest information on modules compatibility.
kamrann 8f3e148
Add comment to manifest re CI modules configs.
kamrann bffc9c4
Cleanup of fmt-tests buildfile organization and comments.
kamrann File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would defining it as
libu
would have helped usage?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Honestly, I'm yet to understand the intended usage of
libu*
, despite having read through the docs information on them many times. When/why do you choose to use it?I also found this:
Note also that if you plan to link any of your unit tests in the whole archive mode, then you will also need to exclude the source file containing the primary executable's main() from the utility library
which suggests that if used here then
test-main
library could not containtext-main.cc
. Having said that, thetest-main
library target is essentially reflecting upstream CMake and it's arguably not even worth having?