From 646a84c01af7f8d08ecd2131bc767d48c81a4b43 Mon Sep 17 00:00:00 2001 From: Cameron Angus Date: Wed, 10 Aug 2022 19:10:48 +0100 Subject: [PATCH 01/54] Added .gitattributes for symlink annotation --- .gitattributes | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 .gitattributes diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..7844e89 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,23 @@ +# This is a good default: files that are auto-detected by git to be text are +# converted to the platform-native line ending (LF on Unix, CRLF on Windows) +# in the working tree and to LF in the repository. +# +* text=auto + +# Use `eol=crlf` for files that should have the CRLF line ending both in the +# working tree (even on Unix) and in the repository. +# +#*.bat text eol=crlf + +# Use `eol=lf` for files that should have the LF line ending both in the +# working tree (even on Windows) and in the repository. +# +#*.sh text eol=lf + +# Use `binary` to make sure certain files are never auto-detected as text. +# +#*.png binary + +fmt/include symlink=dir +fmt/src symlink=dir +doc symlink=dir From 71b03fdebfed7a5266fc35d382bcfa03c004b992 Mon Sep 17 00:00:00 2001 From: Cameron Angus Date: Wed, 10 Aug 2022 19:34:01 +0100 Subject: [PATCH 02/54] Bumped upstream to 9.0.0. Note that this fixes some compile errors that were showing up in the tests on more recent compiler versions (MSVC & Clang) with 8.1.1. --- upstream | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/upstream b/upstream index b6f4cea..c4ee726 160000 --- a/upstream +++ b/upstream @@ -1 +1 @@ -Subproject commit b6f4ceaed0a0a24ccf575fab6c56dd50ccf6f1a9 +Subproject commit c4ee726532178e556d923372f29163bd206d7732 From a1dcba77270cb049410b6e4ba3000ec190b26606 Mon Sep 17 00:00:00 2001 From: Cameron Angus Date: Wed, 10 Aug 2022 19:55:01 +0100 Subject: [PATCH 03/54] Bumped package version to 9.0.0, and build2 toolchain dependency version to 0.15. --- manifest | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/manifest b/manifest index b3c4349..b6baf58 100644 --- a/manifest +++ b/manifest @@ -1,6 +1,6 @@ : 1 name: fmt -version: 8.1.1 +version: 9.0.0 summary: "{fmt} is an open-source formatting library for C++. It can be used as a safe and fast alternative to (s)printf and iostreams." license: MIT description-file: README.md @@ -9,6 +9,6 @@ url: https://github.com/fmtlib/fmt/ package-url: https://github.com/build2-packaging/fmt/ package-email: mjklaim@gmail.com -depends: * build2 >= 0.13.0 -depends: * bpkg >= 0.13.0 +depends: * build2 >= 0.15.0 +depends: * bpkg >= 0.15.0 From cc24203c750b318401e9ec570c53f4e6eb153664 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Lamotte=20=28Klaim=29?= Date: Sat, 10 Dec 2022 21:35:03 +0100 Subject: [PATCH 04/54] Fixed conditional expression for fmt target as module or not --- fmt/buildfile | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/fmt/buildfile b/fmt/buildfile index f7a4a59..1922b53 100644 --- a/fmt/buildfile +++ b/fmt/buildfile @@ -6,14 +6,8 @@ imp_libs = # Implementation dependencies. lib{fmt}: include/hxx{**} hxx{version} $imp_libs $int_libs -if($config.fmt.enable_modules) -{ - lib{fmt}: src/mxx{fmt} # `fmt` C++ module -} -else -{ - lib{fmt}: src/cxx{** -fmt} -} +lib{fmt}: src/mxx{fmt} : include = ($config.fmt.enable_modules) # `fmt` C++ module only +lib{fmt}: src/cxx{** -fmt} : include = (!$config.fmt.enable_modules) # no modules only # Include the generated version header into the distribution (so that we don't # pick up an installed one) and don't remove it when cleaning in src (so that From bef2ed58944c912b993ae46e3b84d8673f9df12c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Lamotte=20=28Klaim=29?= Date: Sat, 10 Dec 2022 21:52:06 +0100 Subject: [PATCH 05/54] Replaced config setup to fix #2 and use lib meta data instead. --- build/config-options.build2 | 7 ------- build/root.build | 8 +++++++- fmt/buildfile | 6 ++++++ tests/basics/buildfile | 2 +- tests/basics/driver-modules.cxx | 4 +--- tests/build/config-options.build2 | 1 - tests/build/root.build | 7 +------ 7 files changed, 16 insertions(+), 19 deletions(-) delete mode 100644 build/config-options.build2 delete mode 120000 tests/build/config-options.build2 diff --git a/build/config-options.build2 b/build/config-options.build2 deleted file mode 100644 index 6ea1f08..0000000 --- a/build/config-options.build2 +++ /dev/null @@ -1,7 +0,0 @@ - -############################## -# Project-specific options: - -# Set to true to build and provide the `fmt` C++ module. -config [bool] config.fmt.enable_modules ?= $cxx.features.modules # $($cxx.features.modules == true) - diff --git a/build/root.build b/build/root.build index 3c1a988..6645442 100644 --- a/build/root.build +++ b/build/root.build @@ -10,4 +10,10 @@ mxx{*}: extension = cc # test.target = $cxx.target -include $src_root/build/config-options.build2 + +############################## +# Project-specific options: + +# Set to true to build and provide the `fmt` C++ module. +config [bool] config.fmt.enable_modules ?= $cxx.features.modules # $($cxx.features.modules == true) + diff --git a/fmt/buildfile b/fmt/buildfile index 1922b53..a44f080 100644 --- a/fmt/buildfile +++ b/fmt/buildfile @@ -9,6 +9,12 @@ lib{fmt}: include/hxx{**} hxx{version} $imp_libs $int_libs lib{fmt}: src/mxx{fmt} : include = ($config.fmt.enable_modules) # `fmt` C++ module only lib{fmt}: src/cxx{** -fmt} : include = (!$config.fmt.enable_modules) # no modules only +# Meta data for users +lib{fmt}: +{ + fmt.is_module = [bool] $config.fmt.enable_modules +} + # Include the generated version header into the distribution (so that we don't # pick up an installed one) and don't remove it when cleaning in src (so that # clean results in a state identical to distributed). diff --git a/tests/basics/buildfile b/tests/basics/buildfile index e593953..b300ac5 100644 --- a/tests/basics/buildfile +++ b/tests/basics/buildfile @@ -2,7 +2,7 @@ import libs = fmt%lib{fmt} ./ : exe{driver} : {cxx}{driver} hxx{tests.inl} $libs testscript{**} -if($config.fmt.enable_modules) +if $($libs: fmt.is_module) { ./ : exe{driver-modules} : {cxx}{driver-modules} hxx{tests.inl} $libs testscript{**} } diff --git a/tests/basics/driver-modules.cxx b/tests/basics/driver-modules.cxx index b5e15f3..15483c3 100644 --- a/tests/basics/driver-modules.cxx +++ b/tests/basics/driver-modules.cxx @@ -1,8 +1,6 @@ #include -import ; -import ; - +import std; import fmt; #include "tests.inl" diff --git a/tests/build/config-options.build2 b/tests/build/config-options.build2 deleted file mode 120000 index ad26fed..0000000 --- a/tests/build/config-options.build2 +++ /dev/null @@ -1 +0,0 @@ -../../build/config-options.build2 \ No newline at end of file diff --git a/tests/build/root.build b/tests/build/root.build index 643050a..9c1f6bd 100644 --- a/tests/build/root.build +++ b/tests/build/root.build @@ -6,6 +6,7 @@ hxx{*}: extension = hxx ixx{*}: extension = ixx txx{*}: extension = txx cxx{*}: extension = cxx +mxx{*}: extension = cc # Every exe{} in this subproject is by default a test. # @@ -15,9 +16,3 @@ exe{*}: test = true # test.target = $cxx.target -include $src_root/build/config-options.build2 - -if($config.fmt.enable_modules) -{ - mxx{*}: extension = cc -} \ No newline at end of file From 56c3e8dbc3694803ca30939b031dad05f7ae3772 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Lamotte=20=28Klaim=29?= Date: Sat, 10 Dec 2022 22:01:57 +0100 Subject: [PATCH 06/54] Attempt to fix meta-data in the installed-use scenario --- fmt/buildfile | 1 + tests/basics/buildfile | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/fmt/buildfile b/fmt/buildfile index a44f080..2baeb47 100644 --- a/fmt/buildfile +++ b/fmt/buildfile @@ -12,6 +12,7 @@ lib{fmt}: src/cxx{** -fmt} : include = (!$config.fmt.enable_modules) # no module # Meta data for users lib{fmt}: { + export.metadata = 1 fmt fmt.is_module = [bool] $config.fmt.enable_modules } diff --git a/tests/basics/buildfile b/tests/basics/buildfile index b300ac5..c66f3bc 100644 --- a/tests/basics/buildfile +++ b/tests/basics/buildfile @@ -1,4 +1,4 @@ -import libs = fmt%lib{fmt} +import! [metadata, rule_hint=cxx.link] libs = fmt%lib{fmt} ./ : exe{driver} : {cxx}{driver} hxx{tests.inl} $libs testscript{**} From d5d84826c657aa9dab5b1ee96127d78bd937684b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Lamotte=20=28Klaim=29?= Date: Sun, 11 Dec 2022 18:09:48 +0100 Subject: [PATCH 07/54] CI: Excludes building with msvc 14.33 and 14.34 This is due to a conflict between msvc's standard library and fmt when using `format_to` using C++20 flags. The issue have been reported: https://github.com/fmtlib/fmt/issues/3224 Recent and older versions of msvc will work as expected. --- manifest | 3 +++ 1 file changed, 3 insertions(+) diff --git a/manifest b/manifest index b6baf58..972cf93 100644 --- a/manifest +++ b/manifest @@ -12,3 +12,6 @@ package-email: mjklaim@gmail.com depends: * build2 >= 0.15.0 depends: * bpkg >= 0.15.0 +build-exclude: **windows_10-msvc_17.2** ; See https://github.com/fmtlib/fmt/issues/3224 +build-exclude: **windows_10-msvc_17.3** ; See https://github.com/fmtlib/fmt/issues/3224 + From 5d921dc7fb331aed66cc310682c14f3033dd25f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Lamotte=20=28Klaim=29?= Date: Sun, 11 Dec 2022 18:44:41 +0100 Subject: [PATCH 08/54] Workaround msvc 14.32/33 bug (see https://github.com/fmtlib/fmt/issues/3224) --- manifest | 3 --- tests/basics/tests.inl | 4 +++- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/manifest b/manifest index 972cf93..b6baf58 100644 --- a/manifest +++ b/manifest @@ -12,6 +12,3 @@ package-email: mjklaim@gmail.com depends: * build2 >= 0.15.0 depends: * bpkg >= 0.15.0 -build-exclude: **windows_10-msvc_17.2** ; See https://github.com/fmtlib/fmt/issues/3224 -build-exclude: **windows_10-msvc_17.3** ; See https://github.com/fmtlib/fmt/issues/3224 - diff --git a/tests/basics/tests.inl b/tests/basics/tests.inl index 28c0d60..5116419 100644 --- a/tests/basics/tests.inl +++ b/tests/basics/tests.inl @@ -55,7 +55,9 @@ struct fmt::formatter { template auto format(const date& d, FormatContext& ctx) { - return format_to(ctx.out(), "{}-{}-{}", d.year, d.month, d.day); + // Namespace-qualify to avoid ambiguity with std::format_to. + fmt::format_to(ctx.out(), "{}-{}-{}", d.year, d.month, d.day); + return ctx.out(); } }; From b6237557f69f17d1cbf35810c73d21a142d303b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Lamotte=20=28Klaim=29?= Date: Sun, 11 Dec 2022 19:03:00 +0100 Subject: [PATCH 09/54] Release version 9.0.0+1 --- manifest | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifest b/manifest index b6baf58..517ebd8 100644 --- a/manifest +++ b/manifest @@ -1,6 +1,6 @@ : 1 name: fmt -version: 9.0.0 +version: 9.0.0+1 summary: "{fmt} is an open-source formatting library for C++. It can be used as a safe and fast alternative to (s)printf and iostreams." license: MIT description-file: README.md From 926169ef3356c1afaae106b7a33036700d6d7b2b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Lamotte=20=28Klaim=29?= Date: Sat, 10 Dec 2022 22:17:04 +0100 Subject: [PATCH 10/54] Update to 9.1.0 --- manifest | 2 +- upstream | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/manifest b/manifest index 517ebd8..41756a1 100644 --- a/manifest +++ b/manifest @@ -1,6 +1,6 @@ : 1 name: fmt -version: 9.0.0+1 +version: 9.1.0 summary: "{fmt} is an open-source formatting library for C++. It can be used as a safe and fast alternative to (s)printf and iostreams." license: MIT description-file: README.md diff --git a/upstream b/upstream index c4ee726..a337011 160000 --- a/upstream +++ b/upstream @@ -1 +1 @@ -Subproject commit c4ee726532178e556d923372f29163bd206d7732 +Subproject commit a33701196adfad74917046096bf5a2aa0ab0bb50 From 83ff14c0313454cb43d56185217075e7e71f0194 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Lamotte=20=28Klaim=29?= Date: Tue, 13 Jun 2023 15:15:00 +0200 Subject: [PATCH 11/54] Update to v10.0.0 (only basic test, no modules support yet) --- fmt/buildfile | 2 +- manifest | 2 +- upstream | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/fmt/buildfile b/fmt/buildfile index 2baeb47..b534762 100644 --- a/fmt/buildfile +++ b/fmt/buildfile @@ -31,7 +31,7 @@ hxx{version} : in{version} $src_root/manifest # Build options. # cxx.poptions =+ "-I$src_base/include" "-I$out_root" "-I$src_root" -objs{*}: cxx.poptions += -DFMT_EXPORT -DFMT_SHARED +objs{*}: cxx.poptions += -DFMT_LIB_EXPORT # Export options. # diff --git a/manifest b/manifest index 41756a1..4c5cb83 100644 --- a/manifest +++ b/manifest @@ -1,6 +1,6 @@ : 1 name: fmt -version: 9.1.0 +version: 10.0.0 summary: "{fmt} is an open-source formatting library for C++. It can be used as a safe and fast alternative to (s)printf and iostreams." license: MIT description-file: README.md diff --git a/upstream b/upstream index a337011..a0b8a92 160000 --- a/upstream +++ b/upstream @@ -1 +1 @@ -Subproject commit a33701196adfad74917046096bf5a2aa0ab0bb50 +Subproject commit a0b8a92e3d1532361c2f7feb63babc5c18d00ef2 From 568a4a4bed50d5b68651195e77150f6b8c596475 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Lamotte=20=28Klaim=29?= Date: Tue, 13 Jun 2023 15:20:54 +0200 Subject: [PATCH 12/54] Prepare for new C++ modules support --- fmt/buildfile | 3 +++ 1 file changed, 3 insertions(+) diff --git a/fmt/buildfile b/fmt/buildfile index b534762..9f07692 100644 --- a/fmt/buildfile +++ b/fmt/buildfile @@ -33,6 +33,9 @@ hxx{version} : in{version} $src_root/manifest cxx.poptions =+ "-I$src_base/include" "-I$out_root" "-I$src_root" objs{*}: cxx.poptions += -DFMT_LIB_EXPORT +if($config.fmt.enable_modules) + cxx.poptions =+ -DFMT_MODULE=ON + # Export options. # lib{fmt}: From f681858d0bbf3e8a95772d82b83ef060477d560e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Lamotte=20=28Klaim=29?= Date: Fri, 15 Sep 2023 17:10:25 +0200 Subject: [PATCH 13/54] Bump to v10.1.1 --- manifest | 2 +- upstream | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/manifest b/manifest index 4c5cb83..1b0c1d0 100644 --- a/manifest +++ b/manifest @@ -1,6 +1,6 @@ : 1 name: fmt -version: 10.0.0 +version: 10.1.1 summary: "{fmt} is an open-source formatting library for C++. It can be used as a safe and fast alternative to (s)printf and iostreams." license: MIT description-file: README.md diff --git a/upstream b/upstream index a0b8a92..f5e5435 160000 --- a/upstream +++ b/upstream @@ -1 +1 @@ -Subproject commit a0b8a92e3d1532361c2f7feb63babc5c18d00ef2 +Subproject commit f5e54359df4c26b6230fc61d38aa294581393084 From 0196126fb78c81ddfbd2df32b25df9642f4665c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Lamotte=20=28Klaim=29?= Date: Tue, 9 Jan 2024 14:51:15 +0100 Subject: [PATCH 14/54] Bump to v10.2.1 --- manifest | 2 +- upstream | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/manifest b/manifest index 1b0c1d0..257e9c4 100644 --- a/manifest +++ b/manifest @@ -1,6 +1,6 @@ : 1 name: fmt -version: 10.1.1 +version: 10.2.1 summary: "{fmt} is an open-source formatting library for C++. It can be used as a safe and fast alternative to (s)printf and iostreams." license: MIT description-file: README.md diff --git a/upstream b/upstream index f5e5435..e69e5f9 160000 --- a/upstream +++ b/upstream @@ -1 +1 @@ -Subproject commit f5e54359df4c26b6230fc61d38aa294581393084 +Subproject commit e69e5f977d458f2650bb346dadf2ad30c5320281 From 2258320b764c59129a9ec6941598597849edebb2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Klaim=20=28Jo=C3=ABl=20Lamotte=29?= <142265+Klaim@users.noreply.github.com> Date: Mon, 1 Jul 2024 16:06:45 +0200 Subject: [PATCH 15/54] Update upstream to v11.0.0 + updated basic tests --- manifest | 2 +- tests/basics/tests.inl | 21 ++++++++++----------- upstream | 2 +- 3 files changed, 12 insertions(+), 13 deletions(-) diff --git a/manifest b/manifest index 257e9c4..d90e9e9 100644 --- a/manifest +++ b/manifest @@ -1,6 +1,6 @@ : 1 name: fmt -version: 10.2.1 +version: 11.0.0-a.0.z summary: "{fmt} is an open-source formatting library for C++. It can be used as a safe and fast alternative to (s)printf and iostreams." license: MIT description-file: README.md diff --git a/tests/basics/tests.inl b/tests/basics/tests.inl index 5116419..c087edb 100644 --- a/tests/basics/tests.inl +++ b/tests/basics/tests.inl @@ -21,17 +21,17 @@ int main () { fmt::print(fg(fmt::color::crimson) | fmt::emphasis::bold, - "Hello, {}!\n", "world"); + "Hello, {}!\n", "world"); fmt::print(fg(fmt::color::floral_white) | bg(fmt::color::slate_gray) | - fmt::emphasis::underline, "Hello, {}!\n", "мир"); + fmt::emphasis::underline, "Olá, {}!\n", "Mundo"); fmt::print(fg(fmt::color::steel_blue) | fmt::emphasis::italic, - "Hello, {}!\n", "世界"); + "你好{}!\n", "世界"); } { - using namespace std::literals::chrono_literals; - fmt::print("Default format: {} {}\n", 42s, 100ms); - fmt::print("strftime-like format: {:%H:%M:%S}\n", 3h + 15min + 30s); + auto now = std::chrono::system_clock::now(); + fmt::print("Date and time: {}\n", now); + fmt::print("Time: {:%H:%M}\n", now); } { @@ -51,13 +51,12 @@ struct date { template <> struct fmt::formatter { - constexpr auto parse(format_parse_context& ctx) { return ctx.begin(); } + constexpr auto parse(format_parse_context& ctx) const { return ctx.begin(); } template - auto format(const date& d, FormatContext& ctx) { - // Namespace-qualify to avoid ambiguity with std::format_to. - fmt::format_to(ctx.out(), "{}-{}-{}", d.year, d.month, d.day); - return ctx.out(); + constexpr auto format(const date& d, FormatContext& ctx) const { + // Namespace-qualify to avoid ambiguity with std::format_to. + return fmt::format_to(ctx.out(), "{}-{}-{}", d.year, d.month, d.day); } }; diff --git a/upstream b/upstream index e69e5f9..0041a40 160000 --- a/upstream +++ b/upstream @@ -1 +1 @@ -Subproject commit e69e5f977d458f2650bb346dadf2ad30c5320281 +Subproject commit 0041a40c1350ba702d475b9c4ad62da77caea164 From c85ebdaf6ccbebf972356a8cbed5abc9803da9a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Klaim=20=28Jo=C3=ABl=20Lamotte=29?= <142265+Klaim@users.noreply.github.com> Date: Mon, 1 Jul 2024 16:47:09 +0200 Subject: [PATCH 16/54] Requires build2 v0.17.0 --- manifest | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/manifest b/manifest index d90e9e9..ddfc03f 100644 --- a/manifest +++ b/manifest @@ -9,6 +9,6 @@ url: https://github.com/fmtlib/fmt/ package-url: https://github.com/build2-packaging/fmt/ package-email: mjklaim@gmail.com -depends: * build2 >= 0.15.0 -depends: * bpkg >= 0.15.0 +depends: * build2 >= 0.17.0 +depends: * bpkg >= 0.17.0 From f7553c75b450beaaba164dcc62f6ca2fae91a4da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Klaim=20=28Jo=C3=ABl=20Lamotte=29?= <142265+Klaim@users.noreply.github.com> Date: Sat, 13 Jul 2024 18:07:50 +0200 Subject: [PATCH 17/54] Update upstream to v11.0.1 --- manifest | 2 +- upstream | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/manifest b/manifest index ddfc03f..9ac843d 100644 --- a/manifest +++ b/manifest @@ -1,6 +1,6 @@ : 1 name: fmt -version: 11.0.0-a.0.z +version: 11.0.1-a.0.z summary: "{fmt} is an open-source formatting library for C++. It can be used as a safe and fast alternative to (s)printf and iostreams." license: MIT description-file: README.md diff --git a/upstream b/upstream index 0041a40..b50e685 160000 --- a/upstream +++ b/upstream @@ -1 +1 @@ -Subproject commit 0041a40c1350ba702d475b9c4ad62da77caea164 +Subproject commit b50e685db996c167e6c831dcef582aba6e14276a From 8a1516be6c6b9d9fc1f52cf9146a4a9e1ac1909f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Klaim=20=28Jo=C3=ABl=20Lamotte=29?= <142265+Klaim@users.noreply.github.com> Date: Sat, 13 Jul 2024 18:35:58 +0200 Subject: [PATCH 18/54] This repository is now a multi-package repository (fixed #6) --- .gitattributes | 6 +- buildfile | 9 +-- doc | 1 - README.md => fmt/README.md | 0 {build => fmt/build}/.gitignore | 0 {build => fmt/build}/bootstrap.build | 0 {build => fmt/build}/export.build | 0 {build => fmt/build}/root.build | 0 fmt/buildfile | 70 +------------------ fmt/doc | 1 + fmt/{ => fmt}/.gitignore | 0 fmt/fmt/buildfile | 69 ++++++++++++++++++ fmt/fmt/include | 1 + fmt/fmt/src | 1 + fmt/{ => fmt}/version.h.in | 0 fmt/include | 1 - manifest => fmt/manifest | 0 fmt/src | 1 - {tests => fmt/tests}/.gitignore | 0 {tests => fmt/tests}/basics/buildfile | 0 .../tests}/basics/driver-modules.cxx | 0 {tests => fmt/tests}/basics/driver.cxx | 0 {tests => fmt/tests}/basics/tests.inl | 0 {tests => fmt/tests}/build/.gitignore | 0 {tests => fmt/tests}/build/bootstrap.build | 0 {tests => fmt/tests}/build/root.build | 0 {tests => fmt/tests}/buildfile | 0 packages.manifest | 2 + repositories.manifest | 2 +- 29 files changed, 86 insertions(+), 78 deletions(-) delete mode 120000 doc rename README.md => fmt/README.md (100%) rename {build => fmt/build}/.gitignore (100%) rename {build => fmt/build}/bootstrap.build (100%) rename {build => fmt/build}/export.build (100%) rename {build => fmt/build}/root.build (100%) create mode 120000 fmt/doc rename fmt/{ => fmt}/.gitignore (100%) create mode 100644 fmt/fmt/buildfile create mode 120000 fmt/fmt/include create mode 120000 fmt/fmt/src rename fmt/{ => fmt}/version.h.in (100%) delete mode 120000 fmt/include rename manifest => fmt/manifest (100%) delete mode 120000 fmt/src rename {tests => fmt/tests}/.gitignore (100%) rename {tests => fmt/tests}/basics/buildfile (100%) rename {tests => fmt/tests}/basics/driver-modules.cxx (100%) rename {tests => fmt/tests}/basics/driver.cxx (100%) rename {tests => fmt/tests}/basics/tests.inl (100%) rename {tests => fmt/tests}/build/.gitignore (100%) rename {tests => fmt/tests}/build/bootstrap.build (100%) rename {tests => fmt/tests}/build/root.build (100%) rename {tests => fmt/tests}/buildfile (100%) create mode 100644 packages.manifest diff --git a/.gitattributes b/.gitattributes index 7844e89..6891e29 100644 --- a/.gitattributes +++ b/.gitattributes @@ -18,6 +18,6 @@ # #*.png binary -fmt/include symlink=dir -fmt/src symlink=dir -doc symlink=dir +fmt/fmt/include symlink=dir +fmt/fmt/src symlink=dir +fmt/doc symlink=dir diff --git a/buildfile b/buildfile index 146d18d..c3c8909 100644 --- a/buildfile +++ b/buildfile @@ -1,5 +1,6 @@ -./: {*/ -build/ -upstream/ -doc/} manifest doc{README.md} doc/doc{**} - -# Don't install tests. +# Glue buildfile that "pulls" all the packages in the project. # -tests/: install = false +import pkgs = [dir_paths] $process.run_regex(\ + cat $src_root/packages.manifest, '\s*location\s*:\s*(\S+)\s*', '\1') + +./: $pkgs diff --git a/doc b/doc deleted file mode 120000 index 112f1c2..0000000 --- a/doc +++ /dev/null @@ -1 +0,0 @@ -upstream/doc \ No newline at end of file diff --git a/README.md b/fmt/README.md similarity index 100% rename from README.md rename to fmt/README.md diff --git a/build/.gitignore b/fmt/build/.gitignore similarity index 100% rename from build/.gitignore rename to fmt/build/.gitignore diff --git a/build/bootstrap.build b/fmt/build/bootstrap.build similarity index 100% rename from build/bootstrap.build rename to fmt/build/bootstrap.build diff --git a/build/export.build b/fmt/build/export.build similarity index 100% rename from build/export.build rename to fmt/build/export.build diff --git a/build/root.build b/fmt/build/root.build similarity index 100% rename from build/root.build rename to fmt/build/root.build diff --git a/fmt/buildfile b/fmt/buildfile index 9f07692..146d18d 100644 --- a/fmt/buildfile +++ b/fmt/buildfile @@ -1,69 +1,5 @@ -int_libs = # Interface dependencies. -imp_libs = # Implementation dependencies. -#import imp_libs += libhello%lib{hello} +./: {*/ -build/ -upstream/ -doc/} manifest doc{README.md} doc/doc{**} -./ : lib{fmt} - -lib{fmt}: include/hxx{**} hxx{version} $imp_libs $int_libs - -lib{fmt}: src/mxx{fmt} : include = ($config.fmt.enable_modules) # `fmt` C++ module only -lib{fmt}: src/cxx{** -fmt} : include = (!$config.fmt.enable_modules) # no modules only - -# Meta data for users -lib{fmt}: -{ - export.metadata = 1 fmt - fmt.is_module = [bool] $config.fmt.enable_modules -} - -# Include the generated version header into the distribution (so that we don't -# pick up an installed one) and don't remove it when cleaning in src (so that -# clean results in a state identical to distributed). -# -hxx{version} : in{version} $src_root/manifest -{ - dist = true - clean = ($src_root != $out_root) - install = include/fmt -} - - -# Build options. -# -cxx.poptions =+ "-I$src_base/include" "-I$out_root" "-I$src_root" -objs{*}: cxx.poptions += -DFMT_LIB_EXPORT - -if($config.fmt.enable_modules) - cxx.poptions =+ -DFMT_MODULE=ON - -# Export options. -# -lib{fmt}: -{ - cxx.export.poptions = "-I$src_base/include" "-I$out_root" "-I$src_root" - cxx.export.libs = $int_libs -} - -libs{fmt}: cxx.export.poptions += -DFMT_SHARED - - -# For pre-releases use the complete version to make sure they cannot be used -# in place of another pre-release or the final version. See the version module -# for details on the version.* variable values. -# -if $version.pre_release - lib{fmt}: bin.lib.version = @"-$version.project_id" -else - lib{fmt}: bin.lib.version = @"-$version.major.$version.minor" - -# Install into the fmt/ subdirectory of, say, /usr/include/ -# recreating subdirectories. +# Don't install tests. # -include/ -{ - {hxx ixx txx}{*}: - { - install = include/ - install.subdirs = true - } -} +tests/: install = false diff --git a/fmt/doc b/fmt/doc new file mode 120000 index 0000000..f54573b --- /dev/null +++ b/fmt/doc @@ -0,0 +1 @@ +../upstream/doc \ No newline at end of file diff --git a/fmt/.gitignore b/fmt/fmt/.gitignore similarity index 100% rename from fmt/.gitignore rename to fmt/fmt/.gitignore diff --git a/fmt/fmt/buildfile b/fmt/fmt/buildfile new file mode 100644 index 0000000..9f07692 --- /dev/null +++ b/fmt/fmt/buildfile @@ -0,0 +1,69 @@ +int_libs = # Interface dependencies. +imp_libs = # Implementation dependencies. +#import imp_libs += libhello%lib{hello} + +./ : lib{fmt} + +lib{fmt}: include/hxx{**} hxx{version} $imp_libs $int_libs + +lib{fmt}: src/mxx{fmt} : include = ($config.fmt.enable_modules) # `fmt` C++ module only +lib{fmt}: src/cxx{** -fmt} : include = (!$config.fmt.enable_modules) # no modules only + +# Meta data for users +lib{fmt}: +{ + export.metadata = 1 fmt + fmt.is_module = [bool] $config.fmt.enable_modules +} + +# Include the generated version header into the distribution (so that we don't +# pick up an installed one) and don't remove it when cleaning in src (so that +# clean results in a state identical to distributed). +# +hxx{version} : in{version} $src_root/manifest +{ + dist = true + clean = ($src_root != $out_root) + install = include/fmt +} + + +# Build options. +# +cxx.poptions =+ "-I$src_base/include" "-I$out_root" "-I$src_root" +objs{*}: cxx.poptions += -DFMT_LIB_EXPORT + +if($config.fmt.enable_modules) + cxx.poptions =+ -DFMT_MODULE=ON + +# Export options. +# +lib{fmt}: +{ + cxx.export.poptions = "-I$src_base/include" "-I$out_root" "-I$src_root" + cxx.export.libs = $int_libs +} + +libs{fmt}: cxx.export.poptions += -DFMT_SHARED + + +# For pre-releases use the complete version to make sure they cannot be used +# in place of another pre-release or the final version. See the version module +# for details on the version.* variable values. +# +if $version.pre_release + lib{fmt}: bin.lib.version = @"-$version.project_id" +else + lib{fmt}: bin.lib.version = @"-$version.major.$version.minor" + +# Install into the fmt/ subdirectory of, say, /usr/include/ +# recreating subdirectories. +# +include/ +{ + {hxx ixx txx}{*}: + { + install = include/ + install.subdirs = true + } +} diff --git a/fmt/fmt/include b/fmt/fmt/include new file mode 120000 index 0000000..01fbb48 --- /dev/null +++ b/fmt/fmt/include @@ -0,0 +1 @@ +../../upstream/include \ No newline at end of file diff --git a/fmt/fmt/src b/fmt/fmt/src new file mode 120000 index 0000000..ff7dce8 --- /dev/null +++ b/fmt/fmt/src @@ -0,0 +1 @@ +../../upstream/src \ No newline at end of file diff --git a/fmt/version.h.in b/fmt/fmt/version.h.in similarity index 100% rename from fmt/version.h.in rename to fmt/fmt/version.h.in diff --git a/fmt/include b/fmt/include deleted file mode 120000 index ebe355d..0000000 --- a/fmt/include +++ /dev/null @@ -1 +0,0 @@ -../upstream/include \ No newline at end of file diff --git a/manifest b/fmt/manifest similarity index 100% rename from manifest rename to fmt/manifest diff --git a/fmt/src b/fmt/src deleted file mode 120000 index 8b4e399..0000000 --- a/fmt/src +++ /dev/null @@ -1 +0,0 @@ -../upstream/src \ No newline at end of file diff --git a/tests/.gitignore b/fmt/tests/.gitignore similarity index 100% rename from tests/.gitignore rename to fmt/tests/.gitignore diff --git a/tests/basics/buildfile b/fmt/tests/basics/buildfile similarity index 100% rename from tests/basics/buildfile rename to fmt/tests/basics/buildfile diff --git a/tests/basics/driver-modules.cxx b/fmt/tests/basics/driver-modules.cxx similarity index 100% rename from tests/basics/driver-modules.cxx rename to fmt/tests/basics/driver-modules.cxx diff --git a/tests/basics/driver.cxx b/fmt/tests/basics/driver.cxx similarity index 100% rename from tests/basics/driver.cxx rename to fmt/tests/basics/driver.cxx diff --git a/tests/basics/tests.inl b/fmt/tests/basics/tests.inl similarity index 100% rename from tests/basics/tests.inl rename to fmt/tests/basics/tests.inl diff --git a/tests/build/.gitignore b/fmt/tests/build/.gitignore similarity index 100% rename from tests/build/.gitignore rename to fmt/tests/build/.gitignore diff --git a/tests/build/bootstrap.build b/fmt/tests/build/bootstrap.build similarity index 100% rename from tests/build/bootstrap.build rename to fmt/tests/build/bootstrap.build diff --git a/tests/build/root.build b/fmt/tests/build/root.build similarity index 100% rename from tests/build/root.build rename to fmt/tests/build/root.build diff --git a/tests/buildfile b/fmt/tests/buildfile similarity index 100% rename from tests/buildfile rename to fmt/tests/buildfile diff --git a/packages.manifest b/packages.manifest new file mode 100644 index 0000000..7092409 --- /dev/null +++ b/packages.manifest @@ -0,0 +1,2 @@ +: 1 +location: fmt/ diff --git a/repositories.manifest b/repositories.manifest index fedfa2e..cd76feb 100644 --- a/repositories.manifest +++ b/repositories.manifest @@ -1,5 +1,5 @@ : 1 -summary: fmt-build2 project repository +summary: fmt project repository #: #role: prerequisite From 5bc0f0f9214e14f34c5743f9881f5d8f1104dcd9 Mon Sep 17 00:00:00 2001 From: Cameron Angus Date: Thu, 18 Jul 2024 17:44:10 +0100 Subject: [PATCH 19/54] Remove enable_modules build config variable, use cxx.features.modules to directly control modular build toggle. --- fmt/build/root.build | 3 --- fmt/fmt/buildfile | 13 ++++++++----- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/fmt/build/root.build b/fmt/build/root.build index 6645442..811e4e3 100644 --- a/fmt/build/root.build +++ b/fmt/build/root.build @@ -14,6 +14,3 @@ test.target = $cxx.target ############################## # Project-specific options: -# Set to true to build and provide the `fmt` C++ module. -config [bool] config.fmt.enable_modules ?= $cxx.features.modules # $($cxx.features.modules == true) - diff --git a/fmt/fmt/buildfile b/fmt/fmt/buildfile index 9f07692..48b7fd9 100644 --- a/fmt/fmt/buildfile +++ b/fmt/fmt/buildfile @@ -6,14 +6,17 @@ imp_libs = # Implementation dependencies. lib{fmt}: include/hxx{**} hxx{version} $imp_libs $int_libs -lib{fmt}: src/mxx{fmt} : include = ($config.fmt.enable_modules) # `fmt` C++ module only -lib{fmt}: src/cxx{** -fmt} : include = (!$config.fmt.enable_modules) # no modules only +# Automatically build as module if the feature is enabled +build_fmt_module = $cxx.features.modules + +lib{fmt}: src/mxx{fmt} : include = ($build_fmt_module) # `fmt` C++ module only +lib{fmt}: src/cxx{** -fmt} : include = (!$build_fmt_module) # no modules only # Meta data for users lib{fmt}: { export.metadata = 1 fmt - fmt.is_module = [bool] $config.fmt.enable_modules + fmt.is_module = [bool] $build_fmt_module } # Include the generated version header into the distribution (so that we don't @@ -33,8 +36,8 @@ hxx{version} : in{version} $src_root/manifest cxx.poptions =+ "-I$src_base/include" "-I$out_root" "-I$src_root" objs{*}: cxx.poptions += -DFMT_LIB_EXPORT -if($config.fmt.enable_modules) - cxx.poptions =+ -DFMT_MODULE=ON +if($build_fmt_module) + cxx.poptions =+ -DFMT_MODULE # Export options. # From a836c699236a9dd13d5ad61a8691a66f5ddda559 Mon Sep 17 00:00:00 2001 From: Cameron Angus Date: Thu, 18 Jul 2024 17:45:04 +0100 Subject: [PATCH 20/54] Include bmis target type when setting export poptions --- fmt/fmt/buildfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fmt/fmt/buildfile b/fmt/fmt/buildfile index 48b7fd9..b1e2342 100644 --- a/fmt/fmt/buildfile +++ b/fmt/fmt/buildfile @@ -34,7 +34,7 @@ hxx{version} : in{version} $src_root/manifest # Build options. # cxx.poptions =+ "-I$src_base/include" "-I$out_root" "-I$src_root" -objs{*}: cxx.poptions += -DFMT_LIB_EXPORT +{objs bmis}{*}: cxx.poptions += -DFMT_LIB_EXPORT if($build_fmt_module) cxx.poptions =+ -DFMT_MODULE From 1f146228b7afdfe6029fdaceb58cec30b9a9e79c Mon Sep 17 00:00:00 2001 From: Cameron Angus Date: Thu, 18 Jul 2024 18:30:06 +0100 Subject: [PATCH 21/54] Automatically enable FMT_ATTACH_TO_GLOBAL_MODULE when building as module, to permit #include usage. --- fmt/fmt/buildfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/fmt/fmt/buildfile b/fmt/fmt/buildfile index b1e2342..b967826 100644 --- a/fmt/fmt/buildfile +++ b/fmt/fmt/buildfile @@ -36,8 +36,9 @@ hxx{version} : in{version} $src_root/manifest cxx.poptions =+ "-I$src_base/include" "-I$out_root" "-I$src_root" {objs bmis}{*}: cxx.poptions += -DFMT_LIB_EXPORT +# If building fmt module, also enable attaching to the global module in order to allow concurrent #include and import. if($build_fmt_module) - cxx.poptions =+ -DFMT_MODULE + cxx.poptions =+ -DFMT_MODULE -DFMT_ATTACH_TO_GLOBAL_MODULE # Export options. # From f808761fe44498263823ed3a405cec43a72310db Mon Sep 17 00:00:00 2001 From: Cameron Angus Date: Thu, 18 Jul 2024 18:41:09 +0100 Subject: [PATCH 22/54] Replace import std; in smoke tests with #includes, pending implementing handling of std module (build2 complains if building package with clang on Windows). --- fmt/tests/basics/driver-modules.cxx | 5 ++++- fmt/tests/basics/driver.cxx | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/fmt/tests/basics/driver-modules.cxx b/fmt/tests/basics/driver-modules.cxx index 15483c3..6cdf1f5 100644 --- a/fmt/tests/basics/driver-modules.cxx +++ b/fmt/tests/basics/driver-modules.cxx @@ -1,6 +1,9 @@ #include -import std; +#include +#include +#include + import fmt; #include "tests.inl" diff --git a/fmt/tests/basics/driver.cxx b/fmt/tests/basics/driver.cxx index 88f1830..cff192d 100644 --- a/fmt/tests/basics/driver.cxx +++ b/fmt/tests/basics/driver.cxx @@ -1,4 +1,5 @@ #include +#include #include #include From 07571589b95fc2d3eb0e2384e2dadbdb9c3734f9 Mon Sep 17 00:00:00 2001 From: Cameron Angus Date: Mon, 22 Jul 2024 17:35:31 +0100 Subject: [PATCH 23/54] Add package configuration variable to toggle use of import std. --- fmt/build/root.build | 1 + fmt/fmt/buildfile | 2 ++ 2 files changed, 3 insertions(+) diff --git a/fmt/build/root.build b/fmt/build/root.build index 811e4e3..6cb1c15 100644 --- a/fmt/build/root.build +++ b/fmt/build/root.build @@ -14,3 +14,4 @@ test.target = $cxx.target ############################## # Project-specific options: +config [bool] config.fmt.enable_import_std ?= false diff --git a/fmt/fmt/buildfile b/fmt/fmt/buildfile index b967826..3f5d042 100644 --- a/fmt/fmt/buildfile +++ b/fmt/fmt/buildfile @@ -39,6 +39,8 @@ cxx.poptions =+ "-I$src_base/include" "-I$out_root" "-I$src_root" # If building fmt module, also enable attaching to the global module in order to allow concurrent #include and import. if($build_fmt_module) cxx.poptions =+ -DFMT_MODULE -DFMT_ATTACH_TO_GLOBAL_MODULE + if($config.fmt.enable_import_std) + cxx.poptions =+ -DFMT_IMPORT_STD # Export options. # From a9ee48b20b5066150bd58eea4725a159eb1e7938 Mon Sep 17 00:00:00 2001 From: Cameron Angus Date: Mon, 22 Jul 2024 19:40:32 +0100 Subject: [PATCH 24/54] Add config option for a modules-only mode. --- fmt/build/root.build | 1 + fmt/fmt/buildfile | 24 ++++++++++++++++-------- fmt/tests/basics/buildfile | 13 +++++++++---- fmt/tests/basics/driver-modules.cxx | 7 +++++-- 4 files changed, 31 insertions(+), 14 deletions(-) diff --git a/fmt/build/root.build b/fmt/build/root.build index 6cb1c15..499fa36 100644 --- a/fmt/build/root.build +++ b/fmt/build/root.build @@ -15,3 +15,4 @@ test.target = $cxx.target # Project-specific options: config [bool] config.fmt.enable_import_std ?= false +config [bool] config.fmt.modules_only ?= false diff --git a/fmt/fmt/buildfile b/fmt/fmt/buildfile index 3f5d042..5f179c5 100644 --- a/fmt/fmt/buildfile +++ b/fmt/fmt/buildfile @@ -8,6 +8,10 @@ lib{fmt}: include/hxx{**} hxx{version} $imp_libs $int_libs # Automatically build as module if the feature is enabled build_fmt_module = $cxx.features.modules +allow_header_usage = ($build_fmt_module == false || $config.fmt.modules_only == false) + +if($build_fmt_module && $allow_header_usage) + info "Building fmt with dual module/header mode enabled" lib{fmt}: src/mxx{fmt} : include = ($build_fmt_module) # `fmt` C++ module only lib{fmt}: src/cxx{** -fmt} : include = (!$build_fmt_module) # no modules only @@ -16,7 +20,8 @@ lib{fmt}: src/cxx{** -fmt} : include = (!$build_fmt_module) # no modules only lib{fmt}: { export.metadata = 1 fmt - fmt.is_module = [bool] $build_fmt_module + fmt.has_header = [bool] $allow_header_usage + fmt.has_module = [bool] $build_fmt_module } # Include the generated version header into the distribution (so that we don't @@ -38,21 +43,24 @@ cxx.poptions =+ "-I$src_base/include" "-I$out_root" "-I$src_root" # If building fmt module, also enable attaching to the global module in order to allow concurrent #include and import. if($build_fmt_module) - cxx.poptions =+ -DFMT_MODULE -DFMT_ATTACH_TO_GLOBAL_MODULE +{ + cxx.poptions =+ -DFMT_MODULE + if($allow_header_usage) + # Support mixing consuming as both modules and headers within a single build + cxx.poptions =+ -DFMT_ATTACH_TO_GLOBAL_MODULE if($config.fmt.enable_import_std) cxx.poptions =+ -DFMT_IMPORT_STD +} # Export options. # -lib{fmt}: +lib{fmt}: cxx.export.libs = $int_libs +if($allow_header_usage) # Note: exported poptions only relevant for header consumption { - cxx.export.poptions = "-I$src_base/include" "-I$out_root" "-I$src_root" - cxx.export.libs = $int_libs + lib{fmt}: cxx.export.poptions = "-I$src_base/include" "-I$out_root" "-I$src_root" + libs{fmt}: cxx.export.poptions += -DFMT_SHARED } -libs{fmt}: cxx.export.poptions += -DFMT_SHARED - - # For pre-releases use the complete version to make sure they cannot be used # in place of another pre-release or the final version. See the version module # for details on the version.* variable values. diff --git a/fmt/tests/basics/buildfile b/fmt/tests/basics/buildfile index c66f3bc..5dab89c 100644 --- a/fmt/tests/basics/buildfile +++ b/fmt/tests/basics/buildfile @@ -1,9 +1,14 @@ import! [metadata, rule_hint=cxx.link] libs = fmt%lib{fmt} -./ : exe{driver} : {cxx}{driver} hxx{tests.inl} $libs testscript{**} - -if $($libs: fmt.is_module) +if $($libs: fmt.has_header) { - ./ : exe{driver-modules} : {cxx}{driver-modules} hxx{tests.inl} $libs testscript{**} + ./ : exe{driver} : {cxx}{driver} hxx{tests.inl} $libs testscript{**} } +if $($libs: fmt.has_module) +{ + # 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{**} +} diff --git a/fmt/tests/basics/driver-modules.cxx b/fmt/tests/basics/driver-modules.cxx index 6cdf1f5..4d90052 100644 --- a/fmt/tests/basics/driver-modules.cxx +++ b/fmt/tests/basics/driver-modules.cxx @@ -1,4 +1,9 @@ +// Verify that fmt headers are not available if config.fmt.modules_only is true +#if __has_include() != FMT_BUILD2_HAS_HEADER +#error fmt headers should be available for include iff config.fmt.modules_only == false +#endif + #include #include #include @@ -7,5 +12,3 @@ import fmt; #include "tests.inl" - - From b2e4c3b6b84a2ead07a63b1fd970aca659d0914c Mon Sep 17 00:00:00 2001 From: Cameron Angus Date: Mon, 26 Aug 2024 17:38:59 +0900 Subject: [PATCH 25/54] Point upstream to master branch of upstream fmt - this has merged in the module fix PRs, but they're yet to make an upstream release. --- upstream | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/upstream b/upstream index b50e685..0379bf3 160000 --- a/upstream +++ b/upstream @@ -1 +1 @@ -Subproject commit b50e685db996c167e6c831dcef582aba6e14276a +Subproject commit 0379bf3a5d52d8542aec1874677c9df5ff9ba5f9 From c271d7778a5acbf32cd87625fd325329e37c48cf Mon Sep 17 00:00:00 2001 From: Cameron Angus Date: Fri, 30 Aug 2024 18:41:10 +0900 Subject: [PATCH 26/54] Add new package for hosting upstream tests. Add gtest and gmock dependencies via build2 packages. Begun to map the logic from upstream CMake; added static library test-main and some initial tests to a basics subfolder. --- .gitattributes | 2 ++ fmt-tests/.gitignore | 25 ++++++++++++++++++++++ fmt-tests/basics/.gitignore | 5 +++++ fmt-tests/basics/buildfile | 37 +++++++++++++++++++++++++++++++++ fmt-tests/basics/test | 1 + fmt-tests/build/.gitignore | 4 ++++ fmt-tests/build/bootstrap.build | 7 +++++++ fmt-tests/build/root.build | 15 +++++++++++++ fmt-tests/buildfile | 1 + fmt-tests/manifest | 13 ++++++++++++ fmt-tests/test-main/buildfile | 13 ++++++++++++ fmt-tests/test-main/test | 1 + fmt/manifest | 3 ++- packages.manifest | 2 ++ repositories.manifest | 11 +++------- 15 files changed, 131 insertions(+), 9 deletions(-) create mode 100644 fmt-tests/.gitignore create mode 100644 fmt-tests/basics/.gitignore create mode 100644 fmt-tests/basics/buildfile create mode 120000 fmt-tests/basics/test create mode 100644 fmt-tests/build/.gitignore create mode 100644 fmt-tests/build/bootstrap.build create mode 100644 fmt-tests/build/root.build create mode 100644 fmt-tests/buildfile create mode 100644 fmt-tests/manifest create mode 100644 fmt-tests/test-main/buildfile create mode 120000 fmt-tests/test-main/test diff --git a/.gitattributes b/.gitattributes index 6891e29..1abc10a 100644 --- a/.gitattributes +++ b/.gitattributes @@ -21,3 +21,5 @@ fmt/fmt/include symlink=dir fmt/fmt/src symlink=dir fmt/doc symlink=dir +fmt-tests/basics/test symlink=dir +fmt-tests/test-main/test symlink=dir diff --git a/fmt-tests/.gitignore b/fmt-tests/.gitignore new file mode 100644 index 0000000..1c363a0 --- /dev/null +++ b/fmt-tests/.gitignore @@ -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 diff --git a/fmt-tests/basics/.gitignore b/fmt-tests/basics/.gitignore new file mode 100644 index 0000000..8521b07 --- /dev/null +++ b/fmt-tests/basics/.gitignore @@ -0,0 +1,5 @@ +basics + +# Testscript output directory (can be symlink). +# +test-basics diff --git a/fmt-tests/basics/buildfile b/fmt-tests/basics/buildfile new file mode 100644 index 0000000..bec9d56 --- /dev/null +++ b/fmt-tests/basics/buildfile @@ -0,0 +1,37 @@ +include ../test-main/ + +#test_names = +# args-test \ +# assert-test \ +# base-test +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 posix-mock-test printf-test ranges-odr-test ranges-test std-test unicode-test xchar-test +# header-only-test +# scan-test + +standalone_test_names = enforce-checks-test # some way to pair these? -DFMT_ENFORCE_COMPILE_STRING + +for test_name : $gtest_test_names +{ + ./: exe{$test_name} : test/cxx{$test_name} + exe{$test_name}: ../test-main/liba{test-main}: + { + bin.whole = true + } +} + +# linker issues. +#./: exe{scan-test} : test/cxx{scan-test} ../test-main/liba{test-main} + +# @todo: cmake adds this test conditionally on NOT ( msvc AND fmt-shared ) +# in build2, i guess it's a bit different in that we can potentially build both shared and static variants within a single config? +# also not clear how fmt_shared/fmt_header_only is being configured, looks like the package doesn't do anything there. using defaults only? +# if $cxx. != msvc +#./: exe{format-impl-test} : test/cxx{format-impl-test header-only-test} ../test-main/liba{test-main} + + +import fmt = fmt%lib{fmt} + +for test_name : $standalone_test_names +{ + ./: exe{$test_name} : test/cxx{$test_name} $fmt +} diff --git a/fmt-tests/basics/test b/fmt-tests/basics/test new file mode 120000 index 0000000..18e4790 --- /dev/null +++ b/fmt-tests/basics/test @@ -0,0 +1 @@ +../../upstream/test \ No newline at end of file diff --git a/fmt-tests/build/.gitignore b/fmt-tests/build/.gitignore new file mode 100644 index 0000000..974e01d --- /dev/null +++ b/fmt-tests/build/.gitignore @@ -0,0 +1,4 @@ +/config.build +/root/ +/bootstrap/ +build/ diff --git a/fmt-tests/build/bootstrap.build b/fmt-tests/build/bootstrap.build new file mode 100644 index 0000000..70f798c --- /dev/null +++ b/fmt-tests/build/bootstrap.build @@ -0,0 +1,7 @@ +project = fmt-tests + +using version +using config +using test +using install +using dist diff --git a/fmt-tests/build/root.build b/fmt-tests/build/root.build new file mode 100644 index 0000000..6377162 --- /dev/null +++ b/fmt-tests/build/root.build @@ -0,0 +1,15 @@ +# 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 + +# The test target for cross-testing (running tests under Wine, etc). +# +test.target = $cxx.target diff --git a/fmt-tests/buildfile b/fmt-tests/buildfile new file mode 100644 index 0000000..bca55a2 --- /dev/null +++ b/fmt-tests/buildfile @@ -0,0 +1 @@ +./: {*/ -build/} manifest diff --git a/fmt-tests/manifest b/fmt-tests/manifest new file mode 100644 index 0000000..a34b168 --- /dev/null +++ b/fmt-tests/manifest @@ -0,0 +1,13 @@ +: 1 +name: fmt-tests +version: 0.1.0-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 diff --git a/fmt-tests/test-main/buildfile b/fmt-tests/test-main/buildfile new file mode 100644 index 0000000..e2676f0 --- /dev/null +++ b/fmt-tests/test-main/buildfile @@ -0,0 +1,13 @@ + +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} $libs + +# Export options. +# +liba{test-main}: +{ + cxx.export.libs = $libs +} diff --git a/fmt-tests/test-main/test b/fmt-tests/test-main/test new file mode 120000 index 0000000..18e4790 --- /dev/null +++ b/fmt-tests/test-main/test @@ -0,0 +1 @@ +../../upstream/test \ No newline at end of file diff --git a/fmt/manifest b/fmt/manifest index 9ac843d..3e41529 100644 --- a/fmt/manifest +++ b/fmt/manifest @@ -9,6 +9,7 @@ url: https://github.com/fmtlib/fmt/ package-url: https://github.com/build2-packaging/fmt/ package-email: mjklaim@gmail.com +tests: fmt-tests == $ + depends: * build2 >= 0.17.0 depends: * bpkg >= 0.17.0 - diff --git a/packages.manifest b/packages.manifest index 7092409..ccd3e1e 100644 --- a/packages.manifest +++ b/packages.manifest @@ -1,2 +1,4 @@ : 1 location: fmt/ +: +location: fmt-tests/ diff --git a/repositories.manifest b/repositories.manifest index cd76feb..230f8c0 100644 --- a/repositories.manifest +++ b/repositories.manifest @@ -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 From 110906e6d01352187b6e9df54816acc639f3544e Mon Sep 17 00:00:00 2001 From: Cameron Angus Date: Fri, 30 Aug 2024 18:52:12 +0900 Subject: [PATCH 27/54] Add .vs/ folder to gitignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 10d90d1..6d7a9f8 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ .bdep/ +.vs/ # Local default options files. # From ab0cc5e26d13f3e67cdb74232c097c1b3f12bd3d Mon Sep 17 00:00:00 2001 From: Cameron Angus Date: Fri, 30 Aug 2024 19:29:23 +0900 Subject: [PATCH 28/54] Align the test package version number to the main package. --- fmt-tests/manifest | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fmt-tests/manifest b/fmt-tests/manifest index a34b168..2b6b7fa 100644 --- a/fmt-tests/manifest +++ b/fmt-tests/manifest @@ -1,6 +1,6 @@ : 1 name: fmt-tests -version: 0.1.0-a.0.z +version: 11.0.1-a.0.z project: fmt summary: Tests package for fmt upstream tests license: MIT From 79827a31b0e952384cb8f2fb0883a70414127193 Mon Sep 17 00:00:00 2001 From: Cameron Angus Date: Sat, 31 Aug 2024 17:02:04 +0900 Subject: [PATCH 29/54] Adjusted fmt-tests buildfiles to attempt to fix issues with include path failures on CI. --- fmt-tests/basics/buildfile | 8 +++++--- fmt-tests/test-main/buildfile | 3 ++- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/fmt-tests/basics/buildfile b/fmt-tests/basics/buildfile index bec9d56..85bb4f3 100644 --- a/fmt-tests/basics/buildfile +++ b/fmt-tests/basics/buildfile @@ -4,9 +4,11 @@ include ../test-main/ # args-test \ # assert-test \ # base-test -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 posix-mock-test printf-test ranges-odr-test ranges-test std-test unicode-test xchar-test -# header-only-test -# scan-test +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 ranges-odr-test ranges-test std-test unicode-test xchar-test + +# header-only-test <- header only mode seemingly not supported by this build2 package? +# scan-test <- some linker issues +# posix-mock-test <- needs posix-mock.h, and has some msvc/runtime conditional logic going on standalone_test_names = enforce-checks-test # some way to pair these? -DFMT_ENFORCE_COMPILE_STRING diff --git a/fmt-tests/test-main/buildfile b/fmt-tests/test-main/buildfile index e2676f0..30b42fa 100644 --- a/fmt-tests/test-main/buildfile +++ b/fmt-tests/test-main/buildfile @@ -3,11 +3,12 @@ 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} $libs +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 } From b5ecdbfcad8b3adfc395c3eddf834c2f1a62a3b5 Mon Sep 17 00:00:00 2001 From: Cameron Angus Date: Sat, 31 Aug 2024 17:58:35 +0900 Subject: [PATCH 30/54] Marked all executable targets in fmt-tests as tests. Removed install module from fmt-tests bootstrap.build. --- fmt-tests/build/bootstrap.build | 1 - fmt-tests/build/root.build | 4 ++++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/fmt-tests/build/bootstrap.build b/fmt-tests/build/bootstrap.build index 70f798c..fbb1605 100644 --- a/fmt-tests/build/bootstrap.build +++ b/fmt-tests/build/bootstrap.build @@ -3,5 +3,4 @@ project = fmt-tests using version using config using test -using install using dist diff --git a/fmt-tests/build/root.build b/fmt-tests/build/root.build index 6377162..b269653 100644 --- a/fmt-tests/build/root.build +++ b/fmt-tests/build/root.build @@ -10,6 +10,10 @@ 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 From 6007797796ec2d8fa1468ee139ea20465d819fab Mon Sep 17 00:00:00 2001 From: Cameron Angus Date: Mon, 2 Sep 2024 13:36:06 +0900 Subject: [PATCH 31/54] Tweak to ranges-test to match upstream CMake setup. --- fmt-tests/basics/buildfile | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/fmt-tests/basics/buildfile b/fmt-tests/basics/buildfile index 85bb4f3..58fcb5b 100644 --- a/fmt-tests/basics/buildfile +++ b/fmt-tests/basics/buildfile @@ -4,7 +4,7 @@ include ../test-main/ # args-test \ # assert-test \ # base-test -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 ranges-odr-test ranges-test std-test unicode-test xchar-test +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 # header-only-test <- header only mode seemingly not supported by this build2 package? # scan-test <- some linker issues @@ -21,6 +21,12 @@ for test_name : $gtest_test_names } } +./: exe{ranges-test} : test/cxx{ranges-test ranges-odr-test} +exe{ranges-test}: ../test-main/liba{test-main}: +{ + bin.whole = true +} + # linker issues. #./: exe{scan-test} : test/cxx{scan-test} ../test-main/liba{test-main} From 60423130ce74ddf8928d2e53dea8698030fb6f1b Mon Sep 17 00:00:00 2001 From: Cameron Angus Date: Mon, 2 Sep 2024 13:51:34 +0900 Subject: [PATCH 32/54] Symc to latest upstream --- upstream | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/upstream b/upstream index 0379bf3..bc3af51 160000 --- a/upstream +++ b/upstream @@ -1 +1 @@ -Subproject commit 0379bf3a5d52d8542aec1874677c9df5ff9ba5f9 +Subproject commit bc3af512720da527690c58d2edab4ca1892b1f1d From 4841d772e60116074da12289dbfa7dd0751e94d2 Mon Sep 17 00:00:00 2001 From: Cameron Angus Date: Mon, 2 Sep 2024 18:25:26 +0900 Subject: [PATCH 33/54] Refactor smoke test buildfile to avoid conditional target dependencies. --- fmt/tests/basics/buildfile | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/fmt/tests/basics/buildfile b/fmt/tests/basics/buildfile index 5dab89c..1756471 100644 --- a/fmt/tests/basics/buildfile +++ b/fmt/tests/basics/buildfile @@ -1,14 +1,13 @@ import! [metadata, rule_hint=cxx.link] libs = fmt%lib{fmt} -if $($libs: fmt.has_header) -{ - ./ : exe{driver} : {cxx}{driver} hxx{tests.inl} $libs testscript{**} -} - -if $($libs: fmt.has_module) -{ - # 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{**} -} +./ : + +./ : exe{driver} : include = $($libs: fmt.has_header) +./ : exe{driver-modules} : include = $($libs: fmt.has_module) + +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{**} From 014a3d87c35a56c61298f3c62e67da3823ead8eb Mon Sep 17 00:00:00 2001 From: Cameron Angus Date: Mon, 2 Sep 2024 19:00:27 +0900 Subject: [PATCH 34/54] Experiment with package specific CI configurations. --- fmt/manifest | 3 +++ 1 file changed, 3 insertions(+) diff --git a/fmt/manifest b/fmt/manifest index 3e41529..b832abb 100644 --- a/fmt/manifest +++ b/fmt/manifest @@ -13,3 +13,6 @@ tests: fmt-tests == $ depends: * build2 >= 0.17.0 depends: * bpkg >= 0.17.0 + +modules-build-config: config.cxx.features.modules=true ; Enable c++20 modules +modules-only-build-config: config.cxx.features.modules=true config.fmt.modules_only=true ; Enable c++20 modules and disable header usage From 80557624f7bcbe4a5b0e8c26109c06d47b7f10ae Mon Sep 17 00:00:00 2001 From: Cameron Angus Date: Mon, 2 Sep 2024 19:10:51 +0900 Subject: [PATCH 35/54] Force reproces=true on MSVC modules builds to work around compiler bug. See https://developercommunity.visualstudio.com/t/Separate-preprocessing-with-P-fails-wit/10707183 --- fmt/fmt/buildfile | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/fmt/fmt/buildfile b/fmt/fmt/buildfile index 5f179c5..9d1192a 100644 --- a/fmt/fmt/buildfile +++ b/fmt/fmt/buildfile @@ -13,6 +13,10 @@ allow_header_usage = ($build_fmt_module == false || $config.fmt.modules_only == if($build_fmt_module && $allow_header_usage) info "Building fmt with dual module/header mode enabled" +# Workaround for MSVC bug: https://developercommunity.visualstudio.com/t/Separate-preprocessing-with-P-fails-wit/10707183 +if($build_fmt_module && $cxx.class == 'msvc') + cxx.reprocess = true + lib{fmt}: src/mxx{fmt} : include = ($build_fmt_module) # `fmt` C++ module only lib{fmt}: src/cxx{** -fmt} : include = (!$build_fmt_module) # no modules only From 1130bb67397f7d4713fc7951ea3a07f84a6e5c92 Mon Sep 17 00:00:00 2001 From: Cameron Angus Date: Mon, 2 Sep 2024 19:17:57 +0900 Subject: [PATCH 36/54] Fix for incorrect variable prefix. --- fmt/fmt/buildfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fmt/fmt/buildfile b/fmt/fmt/buildfile index 9d1192a..98b1876 100644 --- a/fmt/fmt/buildfile +++ b/fmt/fmt/buildfile @@ -15,7 +15,7 @@ if($build_fmt_module && $allow_header_usage) # Workaround for MSVC bug: https://developercommunity.visualstudio.com/t/Separate-preprocessing-with-P-fails-wit/10707183 if($build_fmt_module && $cxx.class == 'msvc') - cxx.reprocess = true + cc.reprocess = true lib{fmt}: src/mxx{fmt} : include = ($build_fmt_module) # `fmt` C++ module only lib{fmt}: src/cxx{** -fmt} : include = (!$build_fmt_module) # no modules only From c553ca83e7284c328188c01ee5729c2fea290dc5 Mon Sep 17 00:00:00 2001 From: Cameron Angus Date: Mon, 2 Sep 2024 19:35:54 +0900 Subject: [PATCH 37/54] Constrain modules CI build configs to latest. --- fmt/manifest | 2 ++ 1 file changed, 2 insertions(+) diff --git a/fmt/manifest b/fmt/manifest index b832abb..bff155d 100644 --- a/fmt/manifest +++ b/fmt/manifest @@ -14,5 +14,7 @@ tests: fmt-tests == $ depends: * build2 >= 0.17.0 depends: * bpkg >= 0.17.0 +modules-builds: latest; modules-build-config: config.cxx.features.modules=true ; Enable c++20 modules +modules-only-builds: latest; modules-only-build-config: config.cxx.features.modules=true config.fmt.modules_only=true ; Enable c++20 modules and disable header usage From 495ab27cebae1dc242ac7a34c8affca0d10be2a5 Mon Sep 17 00:00:00 2001 From: Cameron Angus Date: Mon, 2 Sep 2024 19:58:03 +0900 Subject: [PATCH 38/54] Experiment constraining to clang. --- fmt/manifest | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fmt/manifest b/fmt/manifest index bff155d..a33bfac 100644 --- a/fmt/manifest +++ b/fmt/manifest @@ -14,7 +14,7 @@ tests: fmt-tests == $ depends: * build2 >= 0.17.0 depends: * bpkg >= 0.17.0 -modules-builds: latest; +modules-builds: latest : &( +clang-18+ ) ; 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; +modules-only-builds: latest : &( +clang-18+ ) ; 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 From c328c6c9dd8c142b26260a8c39843ba7367876b4 Mon Sep 17 00:00:00 2001 From: Cameron Angus Date: Mon, 2 Sep 2024 20:03:50 +0900 Subject: [PATCH 39/54] Switch from latest to experimental --- fmt/manifest | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fmt/manifest b/fmt/manifest index a33bfac..fb102c1 100644 --- a/fmt/manifest +++ b/fmt/manifest @@ -14,7 +14,7 @@ tests: fmt-tests == $ depends: * build2 >= 0.17.0 depends: * bpkg >= 0.17.0 -modules-builds: latest : &( +clang-18+ ) ; Modules builds only supported for latest Clang and MSVC +modules-builds: experimental : &( +clang-18+ ) ; 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+ ) ; Modules builds only supported for latest Clang and MSVC +modules-only-builds: experimental : &( +clang-18+ ) ; 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 From b3b1dcce8b5ed55c11b3f858a0e0514e1f42fd9b Mon Sep 17 00:00:00 2001 From: Cameron Angus Date: Mon, 2 Sep 2024 20:06:10 +0900 Subject: [PATCH 40/54] Add msvc to CI package configs --- fmt/manifest | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fmt/manifest b/fmt/manifest index fb102c1..0889813 100644 --- a/fmt/manifest +++ b/fmt/manifest @@ -14,7 +14,7 @@ tests: fmt-tests == $ depends: * build2 >= 0.17.0 depends: * bpkg >= 0.17.0 -modules-builds: experimental : &( +clang-18+ ) ; Modules builds only supported for latest Clang and MSVC +modules-builds: experimental : &( +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: experimental : &( +clang-18+ ) ; Modules builds only supported for latest Clang and MSVC +modules-only-builds: experimental : &( +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 From 82e02d5226f91efb445e70c7d9ad25e562e707a9 Mon Sep 17 00:00:00 2001 From: Cameron Angus Date: Mon, 2 Sep 2024 20:07:10 +0900 Subject: [PATCH 41/54] Revert CI configs to latest --- fmt/manifest | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fmt/manifest b/fmt/manifest index 0889813..6b46692 100644 --- a/fmt/manifest +++ b/fmt/manifest @@ -14,7 +14,7 @@ tests: fmt-tests == $ depends: * build2 >= 0.17.0 depends: * bpkg >= 0.17.0 -modules-builds: experimental : &( +clang-18+ +msvc ) ; Modules builds only supported for latest Clang and MSVC +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: experimental : &( +clang-18+ +msvc ) ; Modules builds only supported for latest Clang and MSVC +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 From dc8fb4b95e72be70c4032719c356dc33961ebdac Mon Sep 17 00:00:00 2001 From: Cameron Angus Date: Mon, 2 Sep 2024 20:21:32 +0900 Subject: [PATCH 42/54] Change smoke test to use template parameter for format parse context, rather than format_parse_context alias which is not exported by the fmt module. --- fmt/tests/basics/tests.inl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/fmt/tests/basics/tests.inl b/fmt/tests/basics/tests.inl index c087edb..b5de3e8 100644 --- a/fmt/tests/basics/tests.inl +++ b/fmt/tests/basics/tests.inl @@ -51,7 +51,8 @@ struct date { template <> struct fmt::formatter { - constexpr auto parse(format_parse_context& ctx) const { return ctx.begin(); } + template + constexpr auto parse(ParseContext& ctx) const { return ctx.begin(); } template constexpr auto format(const date& d, FormatContext& ctx) const { From 105613fbd26af7ec6fae9167d3347dcd31afae06 Mon Sep 17 00:00:00 2001 From: Cameron Angus Date: Wed, 4 Sep 2024 09:07:05 +0900 Subject: [PATCH 43/54] Update upstream to grab latest fixes. --- upstream | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/upstream b/upstream index bc3af51..15694c9 160000 --- a/upstream +++ b/upstream @@ -1 +1 @@ -Subproject commit bc3af512720da527690c58d2edab4ca1892b1f1d +Subproject commit 15694c9a84f120e21ca3095ed0f989d5b704e796 From 780ba03ca6086f74f355685a3720e02508b014cf Mon Sep 17 00:00:00 2001 From: Cameron Angus Date: Wed, 4 Sep 2024 10:52:30 +0900 Subject: [PATCH 44/54] Upstream submodule update. --- upstream | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/upstream b/upstream index 15694c9..3b9a3d2 160000 --- a/upstream +++ b/upstream @@ -1 +1 @@ -Subproject commit 15694c9a84f120e21ca3095ed0f989d5b704e796 +Subproject commit 3b9a3d26081f473309607f07bd04bfe026fa139d From 682c69b59318dd78628195d3af1c04e2af849d6f Mon Sep 17 00:00:00 2001 From: Cameron Angus Date: Wed, 4 Sep 2024 11:50:56 +0900 Subject: [PATCH 45/54] Upstream update. --- upstream | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/upstream b/upstream index 3b9a3d2..38e959d 160000 --- a/upstream +++ b/upstream @@ -1 +1 @@ -Subproject commit 3b9a3d26081f473309607f07bd04bfe026fa139d +Subproject commit 38e959d9af1caf6fa154641684d58410d2668669 From 2922bb41fbfc95f34bcc949d2ad97fca2f349e16 Mon Sep 17 00:00:00 2001 From: Cameron Angus Date: Wed, 4 Sep 2024 13:05:24 +0900 Subject: [PATCH 46/54] Upstream sync. --- upstream | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/upstream b/upstream index 38e959d..916e779 160000 --- a/upstream +++ b/upstream @@ -1 +1 @@ -Subproject commit 38e959d9af1caf6fa154641684d58410d2668669 +Subproject commit 916e779e245c0f8e4e9bca560105059956d72dfd From 3d7398ab916caf67d92af175265e853987057bff Mon Sep 17 00:00:00 2001 From: Cameron Angus Date: Wed, 4 Sep 2024 14:36:53 +0900 Subject: [PATCH 47/54] Upstream sync --- upstream | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/upstream b/upstream index 916e779..38e959d 160000 --- a/upstream +++ b/upstream @@ -1 +1 @@ -Subproject commit 916e779e245c0f8e4e9bca560105059956d72dfd +Subproject commit 38e959d9af1caf6fa154641684d58410d2668669 From c5c5ab50c6b3f9929e516d5be7d5719305ed351a Mon Sep 17 00:00:00 2001 From: Cameron Angus Date: Sat, 7 Sep 2024 21:49:04 +0900 Subject: [PATCH 48/54] Upstream sync. --- upstream | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/upstream b/upstream index 38e959d..1777002 160000 --- a/upstream +++ b/upstream @@ -1 +1 @@ -Subproject commit 38e959d9af1caf6fa154641684d58410d2668669 +Subproject commit 1777002ff3f68f2259fb00fafab5669b0cdc3f23 From 05855de698a888f180d4e9b0d03092975dbfa1fa Mon Sep 17 00:00:00 2001 From: Cameron Angus Date: Sun, 8 Sep 2024 01:38:52 +0900 Subject: [PATCH 49/54] Disable modules builds on CI. Revert upstream to master branch. --- fmt/manifest | 8 ++++---- upstream | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/fmt/manifest b/fmt/manifest index 6b46692..d2606ee 100644 --- a/fmt/manifest +++ b/fmt/manifest @@ -14,7 +14,7 @@ tests: fmt-tests == $ depends: * build2 >= 0.17.0 depends: * bpkg >= 0.17.0 -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 +#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 diff --git a/upstream b/upstream index 1777002..9408c2a 160000 --- a/upstream +++ b/upstream @@ -1 +1 @@ -Subproject commit 1777002ff3f68f2259fb00fafab5669b0cdc3f23 +Subproject commit 9408c2ae8c264f2c94495db73251f75fcc35cad0 From 88412586797e054f239c8814305c19dde3ae3dae Mon Sep 17 00:00:00 2001 From: Cameron Angus Date: Tue, 10 Sep 2024 11:54:36 +0900 Subject: [PATCH 50/54] Switch upstream branch bag to latest tagged release (11.0.2) --- upstream | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/upstream b/upstream index 9408c2a..0c9fce2 160000 --- a/upstream +++ b/upstream @@ -1 +1 @@ -Subproject commit 9408c2ae8c264f2c94495db73251f75fcc35cad0 +Subproject commit 0c9fce2ffefecfdce794e1859584e25877b7b592 From 7c56c1c6064046a187d01c5112a056c202b91358 Mon Sep 17 00:00:00 2001 From: Cameron Angus Date: Tue, 10 Sep 2024 13:36:39 +0900 Subject: [PATCH 51/54] Add some CI build exclusions. --- fmt/manifest | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/fmt/manifest b/fmt/manifest index d2606ee..5cf740b 100644 --- a/fmt/manifest +++ b/fmt/manifest @@ -14,6 +14,11 @@ 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-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 From b6d3af966294ff9b543c332a96fcd47c03c6db8c Mon Sep 17 00:00:00 2001 From: Cameron Angus Date: Tue, 10 Sep 2024 14:54:27 +0900 Subject: [PATCH 52/54] Revert "Fixed module support but cannot test for now" This reverts commit 10d6a2a8890183d1e0c5b8e933f82a113ad63e57. --- fmt/buildfile | 12 ++++++++++-- tests/basics/buildfile | 6 +----- tests/basics/driver.cxx | 1 + 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/fmt/buildfile b/fmt/buildfile index 800a6cf..f7a4a59 100644 --- a/fmt/buildfile +++ b/fmt/buildfile @@ -5,8 +5,15 @@ imp_libs = # Implementation dependencies. ./ : lib{fmt} lib{fmt}: include/hxx{**} hxx{version} $imp_libs $int_libs -lib{fmt}: src/mxx{fmt} : include = ($config.fmt.enable_modules == true) -lib{fmt}: src/cxx{** -fmt} : include = ($config.fmt.enable_modules == false) + +if($config.fmt.enable_modules) +{ + lib{fmt}: src/mxx{fmt} # `fmt` C++ module +} +else +{ + lib{fmt}: src/cxx{** -fmt} +} # Include the generated version header into the distribution (so that we don't # pick up an installed one) and don't remove it when cleaning in src (so that @@ -19,6 +26,7 @@ hxx{version} : in{version} $src_root/manifest install = include/fmt } + # Build options. # cxx.poptions =+ "-I$src_base/include" "-I$out_root" "-I$src_root" diff --git a/tests/basics/buildfile b/tests/basics/buildfile index 78dfc81..e593953 100644 --- a/tests/basics/buildfile +++ b/tests/basics/buildfile @@ -1,13 +1,9 @@ import libs = fmt%lib{fmt} - +./ : exe{driver} : {cxx}{driver} hxx{tests.inl} $libs testscript{**} if($config.fmt.enable_modules) { ./ : exe{driver-modules} : {cxx}{driver-modules} hxx{tests.inl} $libs testscript{**} } -else -{ - ./ : exe{driver} : {cxx}{driver} hxx{tests.inl} $libs testscript{**} -} diff --git a/tests/basics/driver.cxx b/tests/basics/driver.cxx index 408215f..88f1830 100644 --- a/tests/basics/driver.cxx +++ b/tests/basics/driver.cxx @@ -2,6 +2,7 @@ #include #include +#include #include #include #include From 6b5d1145725f851767b663a870f5102450fd2849 Mon Sep 17 00:00:00 2001 From: Cameron Angus Date: Tue, 10 Sep 2024 15:01:39 +0900 Subject: [PATCH 53/54] Update package readme with latest information on modules compatibility. --- fmt/README.md | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/fmt/README.md b/fmt/README.md index 3910761..f921b95 100644 --- a/fmt/README.md +++ b/fmt/README.md @@ -9,9 +9,18 @@ See [`{fmt}` documentation](https://fmt.dev/) for usage and details. Note: This is the source code for the build2 package of the `{fmt}` C++ library, the actual library sources snapshot can be found in the `./upstream/` submodule. -## Configuration Options: +## Configuration Options - - `config.fmt.enable_modules` : Set to `true` to build and provide the `fmt` C++ modules. If the compiler and C++ version don't support C++ modules (which is C++ > 20), this will result in a compilation failure. Set to `true` if `$cxx.features.modules == true` which means the configuration is set to enable C++ modules, `false` otherwise. +### Experimental C++20 modules support +Modules support is WIP, both in the `build2` package and also in `fmt` upstream. Latest versions of MSVC or Clang are recommended, and the most up-to-date version of the package with regards to modules compatibility can be used via git and the [modules branch](https://github.com/build2-packaging/fmt/tree/modules). For example, in project `repositories.manifest`: +``` +: +role: prerequisite +location: https://github.com/build2-packaging/fmt.git#modules +``` +Enable with `config.cxx.features.modules=true`. When enabled, by default dual mode is used meaning that the library can be consumed either through `import` or via `#include`. To enable this safely, all entities are attached to the global module (extern "C++"). See `modules_only` option for the alternative. + - `config.fmt.enable_import_std` : Set to `true` to consume the standard library as a module when building the `fmt` module. Support dependent on compiler and std lib. Defaults to `false`. + - `config.fmt.modules_only` : Set to `true` to enable modules-only mode for the package. In this mode, `fmt` entities are fully encapsulated in the `fmt` module meaning `#include`-based consumption cannot be mixed, and the package will not export headers. Defaults to `false`. From 8f3e14849973b4dca33ccc1879d3eafca2dec1cb Mon Sep 17 00:00:00 2001 From: Cameron Angus Date: Tue, 10 Sep 2024 15:04:00 +0900 Subject: [PATCH 54/54] Add comment to manifest re CI modules configs. --- fmt/manifest | 1 + 1 file changed, 1 insertion(+) diff --git a/fmt/manifest b/fmt/manifest index 5cf740b..a425587 100644 --- a/fmt/manifest +++ b/fmt/manifest @@ -19,6 +19,7 @@ builds: -freebsd ; fmt tests failing, fixed on upstream master, pending re 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