From e4e3e42eb916a717b8bc6cae36f0fa476b2815d8 Mon Sep 17 00:00:00 2001 From: ClausKlein Date: Mon, 25 Mar 2024 10:10:25 +0100 Subject: [PATCH 01/13] merge in cmake-init generated files asio needs Threads library, so this is added to install-config.cmake export ASIO_NO_DEPRECATED definition add cmake user preset too do not convert british to american english add todos from codespell check liberate clang-tidy config file for use with async code too use cmake VERIFY_INTERFACE_HEADER_SETS install pkg config file too suppress compiler Warnings with llvm-17 on OSX do not verify nor install experimental headers disalbe some warnings in developer mode --- asio/.TODO.txt | 78 ++++++++ asio/.clang-format | 178 ++++++++++++++++++ asio/.clang-tidy | 162 ++++++++++++++++ asio/.cmake-format | 30 +++ asio/.codespellrc | 6 + asio/.gitignore | 18 ++ asio/BUILDING.md | 76 ++++++++ asio/CMakeLists.txt | 69 +++++++ asio/CMakePresets.json | 163 ++++++++++++++++ asio/CMakeUserPresets.json | 39 ++++ asio/HACKING.md | 96 ++++++++++ asio/asio.pc.cmake | 11 ++ asio/cmake/WarningsAsErrors.cmake | 12 ++ asio/cmake/coverage.cmake | 23 +++ asio/cmake/dev-mode.cmake | 21 +++ asio/cmake/folders.cmake | 21 +++ asio/cmake/install-config.cmake | 4 + asio/cmake/install-rules.cmake | 41 ++++ asio/cmake/lint-targets.cmake | 23 +++ asio/cmake/lint.cmake | 44 +++++ asio/cmake/open-cpp-coverage.cmake.example | 30 +++ asio/cmake/prelude.cmake | 9 + asio/cmake/project-is-top-level.cmake | 2 + asio/cmake/spell-targets.cmake | 17 ++ asio/cmake/spell.cmake | 32 ++++ asio/cmake/variables.cmake | 24 +++ asio/cmake/windows-set-path.cmake | 24 +++ .../asio/experimental/parallel_group.hpp | 1 + asio/include/asio/spawn.hpp | 5 + .../cpp11/timeouts/async_tcp_client.cpp | 1 + .../cpp11/timeouts/blocking_tcp_client.cpp | 1 + .../timeouts/blocking_token_tcp_client.cpp | 1 + .../cpp11/timeouts/blocking_udp_client.cpp | 1 + asio/src/examples/cpp11/timeouts/server.cpp | 1 + asio/src/tests/CMakeLists.txt | 33 ++++ 35 files changed, 1297 insertions(+) create mode 100644 asio/.TODO.txt create mode 100644 asio/.clang-format create mode 100644 asio/.clang-tidy create mode 100644 asio/.cmake-format create mode 100644 asio/.codespellrc create mode 100644 asio/BUILDING.md create mode 100644 asio/CMakeLists.txt create mode 100644 asio/CMakePresets.json create mode 100644 asio/CMakeUserPresets.json create mode 100644 asio/HACKING.md create mode 100644 asio/asio.pc.cmake create mode 100644 asio/cmake/WarningsAsErrors.cmake create mode 100644 asio/cmake/coverage.cmake create mode 100644 asio/cmake/dev-mode.cmake create mode 100644 asio/cmake/folders.cmake create mode 100644 asio/cmake/install-config.cmake create mode 100644 asio/cmake/install-rules.cmake create mode 100644 asio/cmake/lint-targets.cmake create mode 100644 asio/cmake/lint.cmake create mode 100644 asio/cmake/open-cpp-coverage.cmake.example create mode 100644 asio/cmake/prelude.cmake create mode 100644 asio/cmake/project-is-top-level.cmake create mode 100644 asio/cmake/spell-targets.cmake create mode 100644 asio/cmake/spell.cmake create mode 100644 asio/cmake/variables.cmake create mode 100644 asio/cmake/windows-set-path.cmake create mode 100644 asio/src/tests/CMakeLists.txt diff --git a/asio/.TODO.txt b/asio/.TODO.txt new file mode 100644 index 0000000000..84b8f40056 --- /dev/null +++ b/asio/.TODO.txt @@ -0,0 +1,78 @@ +Claus-iMac:dev clausklein$ make spell-check | grep -v encode | grep -vw alives +CMake Error at cmake/spell.cmake:27 (message): + Run again with FIX=YES to fix these errors. + + +make[3]: *** [CMakeFiles/spell-check] Error 1 +make[2]: *** [CMakeFiles/spell-check.dir/all] Error 2 +make[1]: *** [CMakeFiles/spell-check.dir/rule] Error 2 +make: *** [spell-check] Error 2 +[100%] Checking spelling +./include/asio/io_context.hpp:185: exeution ==> execution +./include/asio/io_context.hpp:318: reponsibility ==> responsibility +./include/asio/io_context.hpp:349: reponsibility ==> responsibility +./include/asio/io_context.hpp:401: reponsibility ==> responsibility +./include/asio/io_context.hpp:423: reponsibility ==> responsibility +./include/asio/use_future.hpp:102: retuned ==> returned +./include/asio/impl/use_future.hpp:203: exeption ==> exception, exemption +./include/asio/experimental/deferred.hpp:375: alue ==> value +./include/asio/experimental/impl/parallel_group.hpp:80: operatations ==> operations +./include/asio/detail/executor_function.hpp:124: copyable ==> copiable +./include/asio/detail/executor_function.hpp:171: copyable ==> copiable +./include/asio/detail/service_registry.hpp:79: Initalise ==> Initialise +./include/asio/detail/service_registry.hpp:84: Initalise ==> Initialise +./include/asio/detail/win_iocp_io_context.hpp:267: resouce ==> resource +./include/asio/detail/timer_queue_ptime.hpp:32: instantation ==> instantiation +./include/asio/execution/any_executor.hpp:98: requre ==> require +./include/asio/execution/impl/bad_executor.ipp:2: exection ==> execution +./include/asio/execution/impl/receiver_invocation_error.ipp:2: exection ==> execution +./include/asio/ip/detail/endpoint.hpp:31: implementating ==> implementing +./src/examples/cpp11/timers/time_t_timer.cpp:66: absoluate ==> absolute +./src/examples/cpp11/operations/composed_6.cpp:92: asychronous ==> asynchronous +./src/examples/cpp11/operations/composed_7.cpp:59: asychronous ==> asynchronous +./src/examples/cpp03/timers/time_t_timer.cpp:65: absoluate ==> absolute +./src/examples/cpp03/porthopper/client.cpp:100: renegotation ==> renegotiation +./src/examples/cpp03/porthopper/client.cpp:125: renegotation ==> renegotiation +./src/examples/cpp03/porthopper/client.cpp:153: renegotation ==> renegotiation +./src/examples/cpp03/porthopper/client.cpp:166: renegotation ==> renegotiation +./src/examples/cpp14/operations/composed_6.cpp:103: asychronous ==> asynchronous +./src/examples/cpp14/operations/composed_7.cpp:65: asychronous ==> asynchronous +./src/examples/cpp14/operations/composed_7.cpp:111: asychronous ==> asynchronous +./src/doc/using.qbk:227: Explictly ==> Explicitly +./src/doc/history.qbk:137: occured ==> occurred +./src/doc/history.qbk:984: compatiblity ==> compatibility +./src/doc/history.qbk:1101: Lightening ==> Lightning, lighting +./src/doc/history.qbk:1177: copyable ==> copiable +./src/doc/history.qbk:1220: discconected ==> disconnected +./src/doc/history.qbk:1382: compatability ==> compatibility +./src/doc/history.qbk:1807: copyable ==> copiable +./src/doc/history.qbk:1842: accomodate ==> accommodate +./src/doc/history.qbk:2062: tranferred ==> transferred +./src/doc/reference.qbk:1646: requre ==> require +./src/doc/reference.qbk:83101: requre ==> require +./src/doc/reference.qbk:96234: alue ==> value +./src/doc/reference.qbk:96274: alue ==> value +./src/doc/reference.qbk:103899: exeution ==> execution +./src/doc/reference.qbk:104790: reponsibility ==> responsibility +./src/doc/reference.qbk:104833: reponsibility ==> responsibility +./src/doc/reference.qbk:104917: reponsibility ==> responsibility +./src/doc/reference.qbk:104948: reponsibility ==> responsibility +./src/doc/reference.qbk:107562: exeution ==> execution +./src/doc/reference.qbk:157316: retuned ==> returned +./src/doc/quickref.xml:17: thead ==> thread +./src/doc/quickref.xml:26: thead ==> thread +./src/doc/quickref.xml:180: thead ==> thread +./src/doc/quickref.xml:186: thead ==> thread +./src/doc/quickref.xml:356: thead ==> thread +./src/doc/quickref.xml:362: thead ==> thread +./src/doc/quickref.xml:463: thead ==> thread +./src/doc/quickref.xml:469: thead ==> thread +./src/doc/quickref.xml:613: thead ==> thread +./src/doc/quickref.xml:628: thead ==> thread +./src/doc/quickref.xml:729: thead ==> thread +./src/doc/quickref.xml:741: thead ==> thread +./src/doc/requirements/asynchronous_operations.qbk:309: asynchonous ==> asynchronous +./src/doc/overview/coro.qbk:137: follwing ==> following +./src/doc/overview/coro.qbk:194: direclty ==> directly +Claus-iMac:dev clausklein$ + diff --git a/asio/.clang-format b/asio/.clang-format new file mode 100644 index 0000000000..d3bbf30c17 --- /dev/null +++ b/asio/.clang-format @@ -0,0 +1,178 @@ +--- +#XXX Language: Cpp +# BasedOnStyle: Chromium +AccessModifierOffset: -2 +AlignAfterOpenBracket: Align +AlignConsecutiveMacros: false +AlignConsecutiveAssignments: false +AlignConsecutiveBitFields: false +AlignConsecutiveDeclarations: false +AlignEscapedNewlines: DontAlign +AlignOperands: DontAlign +AlignTrailingComments: false +AllowAllArgumentsOnNextLine: true +AllowAllConstructorInitializersOnNextLine: false +AllowAllParametersOfDeclarationOnNextLine: true +AllowShortEnumsOnASingleLine: false +AllowShortBlocksOnASingleLine: Empty +AllowShortCaseLabelsOnASingleLine: false +AllowShortFunctionsOnASingleLine: Inline +AllowShortLambdasOnASingleLine: All +AllowShortIfStatementsOnASingleLine: Never +AllowShortLoopsOnASingleLine: false +AlwaysBreakAfterDefinitionReturnType: None +AlwaysBreakAfterReturnType: None +AlwaysBreakBeforeMultilineStrings: true +AlwaysBreakTemplateDeclarations: Yes +BinPackArguments: false +BinPackParameters: false +BraceWrapping: + AfterCaseLabel: false + AfterClass: true + AfterControlStatement: MultiLine + AfterEnum: true + AfterFunction: true + AfterNamespace: true + AfterObjCDeclaration: false + AfterStruct: true + AfterUnion: true + AfterExternBlock: true + BeforeCatch: false + BeforeElse: false + BeforeLambdaBody: true + BeforeWhile: false + IndentBraces: false + SplitEmptyFunction: true + SplitEmptyRecord: true + SplitEmptyNamespace: true +BreakBeforeBinaryOperators: NonAssignment +BreakBeforeBraces: Custom +# BreakBeforeInheritanceComma: true +BreakInheritanceList: BeforeComma +BreakBeforeTernaryOperators: true +BreakConstructorInitializersBeforeComma: true +BreakConstructorInitializers: BeforeComma +BreakAfterJavaFieldAnnotations: true +BreakStringLiterals: true +ColumnLimit: 80 +CommentPragmas: '^ IWYU pragma:' +CompactNamespaces: false +ConstructorInitializerAllOnOneLineOrOnePerLine: false +ConstructorInitializerIndentWidth: 4 +ContinuationIndentWidth: 4 +Cpp11BracedListStyle: true +DeriveLineEnding: false +DerivePointerAlignment: false +DisableFormat: false +ExperimentalAutoDetectBinPacking: false +FixNamespaceComments: true +ForEachMacros: + - foreach + - Q_FOREACH + - BOOST_FOREACH +IncludeBlocks: Regroup +IncludeCategories: + # Standard library headers come before anything else + - Regex: '^<[a-z_]+>' + Priority: -1 + - Regex: '^<.+\.h(pp)?>' + Priority: 1 + - Regex: '^<.*' + Priority: 2 + - Regex: '.*' + Priority: 3 +IncludeIsMainRegex: '' +IncludeIsMainSourceRegex: '' +IndentCaseLabels: true +IndentCaseBlocks: false +IndentGotoLabels: true +IndentPPDirectives: AfterHash +IndentExternBlock: NoIndent +IndentWidth: 2 +IndentWrappedFunctionNames: false +InsertTrailingCommas: Wrapped +JavaScriptQuotes: Double +JavaScriptWrapImports: true +KeepEmptyLinesAtTheStartOfBlocks: false +MacroBlockBegin: '' +MacroBlockEnd: '' +MaxEmptyLinesToKeep: 1 +NamespaceIndentation: None +ObjCBinPackProtocolList: Never +ObjCBlockIndentWidth: 2 +ObjCBreakBeforeNestedBlockParam: true +ObjCSpaceAfterProperty: false +ObjCSpaceBeforeProtocolList: true +PenaltyBreakAssignment: 2 +PenaltyBreakBeforeFirstCallParameter: 1 +PenaltyBreakComment: 300 +PenaltyBreakFirstLessLess: 120 +PenaltyBreakString: 1000 +PenaltyBreakTemplateDeclaration: 10 +PenaltyExcessCharacter: 1000000 +PenaltyReturnTypeOnItsOwnLine: 200 +PointerAlignment: Left +RawStringFormats: + - Language: Cpp + Delimiters: + - cc + - CC + - cpp + - Cpp + - CPP + - 'c++' + - 'C++' + CanonicalDelimiter: '' + BasedOnStyle: google + - Language: TextProto + Delimiters: + - pb + - PB + - proto + - PROTO + EnclosingFunctions: + - EqualsProto + - EquivToProto + - PARSE_PARTIAL_TEXT_PROTO + - PARSE_TEST_PROTO + - PARSE_TEXT_PROTO + - ParseTextOrDie + - ParseTextProtoOrDie + - ParseTestProto + - ParsePartialTestProto + CanonicalDelimiter: '' + BasedOnStyle: google +ReflowComments: true +SortIncludes: true +SortUsingDeclarations: true +SpaceAfterCStyleCast: false +SpaceAfterLogicalNot: false +SpaceAfterTemplateKeyword: false +SpaceBeforeAssignmentOperators: true +SpaceBeforeCpp11BracedList: true +SpaceBeforeCtorInitializerColon: true +SpaceBeforeInheritanceColon: true +SpaceBeforeParens: ControlStatementsExceptForEachMacros +SpaceBeforeRangeBasedForLoopColon: true +SpaceInEmptyBlock: false +SpaceInEmptyParentheses: false +SpacesBeforeTrailingComments: 2 +SpacesInAngles: false +SpacesInConditionalStatement: false +SpacesInContainerLiterals: false +SpacesInCStyleCastParentheses: false +SpacesInParentheses: false +SpacesInSquareBrackets: false +SpaceBeforeSquareBrackets: false +Standard: Auto +StatementMacros: + - Q_UNUSED + - QT_REQUIRE_VERSION +TabWidth: 8 +UseCRLF: false +UseTab: Never +WhitespaceSensitiveMacros: + - STRINGIZE + - PP_STRINGIZE + - BOOST_PP_STRINGIZE +... diff --git a/asio/.clang-tidy b/asio/.clang-tidy new file mode 100644 index 0000000000..b6fef8689c --- /dev/null +++ b/asio/.clang-tidy @@ -0,0 +1,162 @@ +--- +# Enable ALL the things! Except not really +# misc-non-private-member-variables-in-classes: the options don't do anything +Checks: "*,\ + -google-readability-todo,\ + -google-build-using-namespace,\ + -altera-unroll-loops,\ + -fuchsia-*,\ + fuchsia-multiple-inheritance,\ + -llvm-header-guard,\ + -llvm-include-order,\ + -llvmlibc-*,\ + -cppcoreguidelines-pro-bounds-pointer-arithmetic,\ + -*-magic-numbers,\ + -misc-non-private-member-variables-in-classes" +WarningsAsErrors: '' +CheckOptions: + - key: 'bugprone-argument-comment.StrictMode' + value: 'true' +# Prefer using enum classes with 2 values for parameters instead of bools + - key: 'bugprone-argument-comment.CommentBoolLiterals' + value: 'true' + - key: 'bugprone-misplaced-widening-cast.CheckImplicitCasts' + value: 'true' + - key: 'bugprone-sizeof-expression.WarnOnSizeOfIntegerExpression' + value: 'true' + - key: 'bugprone-suspicious-string-compare.WarnOnLogicalNotComparison' + value: 'true' + - key: readability-identifier-length.MinimumParameterNameLength + value: '2' + - key: readability-identifier-length.MinimumVariableNameLength + value: '1' + - key: 'readability-simplify-boolean-expr.ChainedConditionalReturn' + value: 'true' + - key: 'readability-simplify-boolean-expr.ChainedConditionalAssignment' + value: 'true' + - key: 'readability-uniqueptr-delete-release.PreferResetCall' + value: 'true' + - key: 'cppcoreguidelines-init-variables.MathHeader' + value: '' + - key: 'cppcoreguidelines-narrowing-conversions.PedanticMode' + value: 'true' + - key: 'readability-else-after-return.WarnOnUnfixable' + value: 'true' + - key: 'readability-else-after-return.WarnOnConditionVariables' + value: 'true' + - key: 'readability-inconsistent-declaration-parameter-name.Strict' + value: 'true' + - key: 'readability-qualified-auto.AddConstToQualified' + value: 'true' + - key: 'readability-redundant-access-specifiers.CheckFirstDeclaration' + value: 'true' +# These seem to be the most common identifier styles + - key: 'readability-identifier-naming.AbstractClassCase' + value: 'lower_case' + - key: 'readability-identifier-naming.ClassCase' + value: 'lower_case' + - key: 'readability-identifier-naming.ClassConstantCase' + value: 'lower_case' + - key: 'readability-identifier-naming.ClassMemberCase' + value: 'lower_case' + - key: 'readability-identifier-naming.ClassMethodCase' + value: 'lower_case' + - key: 'readability-identifier-naming.ConstantCase' + value: 'lower_case' + - key: 'readability-identifier-naming.ConstantMemberCase' + value: 'lower_case' + - key: 'readability-identifier-naming.ConstantParameterCase' + value: 'lower_case' + - key: 'readability-identifier-naming.ConstantPointerParameterCase' + value: 'lower_case' + - key: 'readability-identifier-naming.ConstexprFunctionCase' + value: 'lower_case' + - key: 'readability-identifier-naming.ConstexprMethodCase' + value: 'lower_case' + - key: 'readability-identifier-naming.ConstexprVariableCase' + value: 'lower_case' + - key: 'readability-identifier-naming.EnumCase' + value: 'lower_case' + - key: 'readability-identifier-naming.EnumConstantCase' + value: 'lower_case' + - key: 'readability-identifier-naming.FunctionCase' + value: 'lower_case' + - key: 'readability-identifier-naming.GlobalConstantCase' + value: 'lower_case' + - key: 'readability-identifier-naming.GlobalConstantPointerCase' + value: 'lower_case' + - key: 'readability-identifier-naming.GlobalFunctionCase' + value: 'lower_case' + - key: 'readability-identifier-naming.GlobalPointerCase' + value: 'lower_case' + - key: 'readability-identifier-naming.GlobalVariableCase' + value: 'lower_case' + - key: 'readability-identifier-naming.InlineNamespaceCase' + value: 'lower_case' + - key: 'readability-identifier-naming.LocalConstantCase' + value: 'lower_case' + - key: 'readability-identifier-naming.LocalConstantPointerCase' + value: 'lower_case' + - key: 'readability-identifier-naming.LocalPointerCase' + value: 'lower_case' + - key: 'readability-identifier-naming.LocalVariableCase' + value: 'lower_case' + - key: 'readability-identifier-naming.MacroDefinitionCase' + value: 'UPPER_CASE' + - key: 'readability-identifier-naming.MemberCase' + value: 'lower_case' + - key: 'readability-identifier-naming.MethodCase' + value: 'lower_case' + - key: 'readability-identifier-naming.NamespaceCase' + value: 'lower_case' + - key: 'readability-identifier-naming.ParameterCase' + value: 'lower_case' + - key: 'readability-identifier-naming.ParameterPackCase' + value: 'lower_case' + - key: 'readability-identifier-naming.PointerParameterCase' + value: 'lower_case' + - key: 'readability-identifier-naming.PrivateMemberCase' + value: 'lower_case' + # - key: 'readability-identifier-naming.PrivateMemberPrefix' + # value: 'm_' + - key: 'readability-identifier-naming.PrivateMemberSuffix' + value: '_' + - key: 'readability-identifier-naming.PrivateMethodCase' + value: 'lower_case' + - key: 'readability-identifier-naming.ProtectedMemberCase' + value: 'lower_case' + - key: 'readability-identifier-naming.ProtectedMemberPrefix' + value: 'm_' + - key: 'readability-identifier-naming.ProtectedMethodCase' + value: 'lower_case' + - key: 'readability-identifier-naming.PublicMemberCase' + value: 'lower_case' + - key: 'readability-identifier-naming.PublicMethodCase' + value: 'lower_case' + - key: 'readability-identifier-naming.ScopedEnumConstantCase' + value: 'lower_case' + - key: 'readability-identifier-naming.StaticConstantCase' + value: 'lower_case' + - key: 'readability-identifier-naming.StaticVariableCase' + value: 'lower_case' + - key: 'readability-identifier-naming.StructCase' + value: 'lower_case' + - key: 'readability-identifier-naming.TemplateParameterCase' + value: 'CamelCase' + - key: 'readability-identifier-naming.TemplateTemplateParameterCase' + value: 'CamelCase' + - key: 'readability-identifier-naming.TypeAliasCase' + value: 'lower_case' + - key: 'readability-identifier-naming.TypedefCase' + value: 'lower_case' + - key: 'readability-identifier-naming.TypeTemplateParameterCase' + value: 'CamelCase' + - key: 'readability-identifier-naming.UnionCase' + value: 'lower_case' + - key: 'readability-identifier-naming.ValueTemplateParameterCase' + value: 'CamelCase' + - key: 'readability-identifier-naming.VariableCase' + value: 'lower_case' + - key: 'readability-identifier-naming.VirtualMethodCase' + value: 'lower_case' +... diff --git a/asio/.cmake-format b/asio/.cmake-format new file mode 100644 index 0000000000..244841805d --- /dev/null +++ b/asio/.cmake-format @@ -0,0 +1,30 @@ +parse: + additional_commands: + foo: + flags: + - BAR + - BAZ + kwargs: + NAME: '1' + DEPENDS: '*' + HEADERS: '*' + SOURCES: '*' + +format: + dangle_parens: true + keyword_case: upper + line_ending: unix + line_width: 120 + max_lines_hwrap: 3 + max_pargs_hwrap: 8 + max_rows_cmdline: 3 + max_subgroups_hwrap: 4 + min_prefix_chars: 8 + separate_ctrl_name_with_space: false + separate_fn_name_with_space: false + tab_size: 2 + +markup: + bullet_char: '*' + enum_char: . + enable_markup: false diff --git a/asio/.codespellrc b/asio/.codespellrc new file mode 100644 index 0000000000..baa7851fe3 --- /dev/null +++ b/asio/.codespellrc @@ -0,0 +1,6 @@ +[codespell] +builtin = clear,rare,names,informal,code +check-filenames = +check-hidden = +skip = */.git,*/build,*/prefix,*/stage +quiet-level = 2 diff --git a/asio/.gitignore b/asio/.gitignore index 39252178ea..06ec6f2a0b 100644 --- a/asio/.gitignore +++ b/asio/.gitignore @@ -22,3 +22,21 @@ test-driver *.zip /*.cpp /*.hpp +### cmake-init generated: +# include/asio/asio.hpp +.git +.github/ +.idea/ +.vs/ +.vscode/ +build/ +cmake/open-cpp-coverage.cmake +cmake-build-*/ +prefix/ +CMakeLists.txt.user +# CMakeUserPresets.json +# BUILDING.md +CODE_OF_CONDUCT.md +CONTRIBUTING.md +# HACKING.md +README.md diff --git a/asio/BUILDING.md b/asio/BUILDING.md new file mode 100644 index 0000000000..150d31f7ac --- /dev/null +++ b/asio/BUILDING.md @@ -0,0 +1,76 @@ +# Building with CMake + +## CMake files are generated with [cmake-init][3] + +```sh +pip install cmake-init +cmake-init --no-cppcheck --overwrite -h . +``` + +## Build + +This project doesn't require any special command-line flags to build to keep +things simple. + +Here are the steps for building in release mode with a single-configuration +generator, like the Unix Makefiles one: + +```sh +cmake -S . -B build -D CMAKE_BUILD_TYPE=Release +cmake --build build +``` + +Here are the steps for building in release mode with a multi-configuration +generator, like the Visual Studio ones: + +```sh +cmake -S . -B build +cmake --build build --config Release +``` + +## Install + +This project doesn't require any special command-line flags to install to keep +things simple. As a prerequisite, the project has to be built with the above +commands already. + +The below commands require at least **CMake 3.15** to run, because that is the +version in which [Install a Project][1] was added. + +Here is the command for installing the release mode artifacts with a +single-configuration generator, like the Unix Makefiles one: + +```sh +cmake --install build +``` + +Here is the command for installing the release mode artifacts with a +multi-configuration generator, like the Visual Studio ones: + +```sh +cmake --install build --config Release +``` + +### CMake package + +This project exports a CMake package to be used with the [`find_package`][2] +command of CMake: + +* Package name: `asio` +* Target name: `asio::asio` + +Example usage: + +```cmake +find_package(asio REQUIRED) +# Declare the imported target as a build requirement using PRIVATE, where +# project_target is a target created in the consuming project +target_link_libraries( + project_target PRIVATE + asio::asio +) +``` + +[1]: https://cmake.org/cmake/help/latest/manual/cmake.1.html#install-a-project +[2]: https://cmake.org/cmake/help/latest/command/find_package.html +[3]: https://github.com/friendlyanon/cmake-init diff --git a/asio/CMakeLists.txt b/asio/CMakeLists.txt new file mode 100644 index 0000000000..08b224beb0 --- /dev/null +++ b/asio/CMakeLists.txt @@ -0,0 +1,69 @@ +cmake_minimum_required(VERSION 3.23...3.29) + +include(cmake/prelude.cmake) + +project(asio + VERSION 1.29.0 + DESCRIPTION "Asio C++ Library" + HOMEPAGE_URL "http://think-async.com/Asio/" + LANGUAGES CXX +) + +include(cmake/project-is-top-level.cmake) +include(cmake/variables.cmake) + +if(PROJECT_IS_TOP_LEVEL) + set(CMAKE_VERIFY_INTERFACE_HEADER_SETS ON) + include(CheckCXXSymbolExists) + check_cxx_symbol_exists(snprintf cstdio ASIO_HAS_SNPRINTF) + check_cxx_symbol_exists(sprintf_s cstdio ASIO_HAS_SECURE_RTL) +endif() + +# ---- Declare library ---- + +file(GLOB_RECURSE headers "include/asio/*.hpp") +list(FILTER headers EXCLUDE REGEX [=[.*/experimental/.*\.hpp]=]) +list(FILTER headers EXCLUDE REGEX [=[.*/(detail|ssl|impl)/.*\.hpp]=]) +list(FILTER headers EXCLUDE REGEX [=[.*/ssl\.hpp]=]) + +# foreach(header in LISTS ${headers}) +# message(STATUS "${header}") +# endforeach() + +file(GLOB_RECURSE implementation "include/asio/*/*.hpp" "include/asio/*.ipp") + +add_library(asio INTERFACE ${implementation}) +add_library(asio::asio ALIAS asio) + +target_sources(asio INTERFACE FILE_SET HEADERS BASE_DIRS include FILES ${headers}) + +target_compile_definitions(asio INTERFACE ASIO_NO_DEPRECATED) +if(ASIO_HAS_SECURE_RTL) + target_compile_definitions(asio INTERFACE ASIO_HAS_SECURE_RTL) +elseif(ASIO_HAS_SNPRINTF) + target_compile_definitions(asio INTERFACE ASIO_HAS_SNPRINTF) +endif() +target_compile_features(asio INTERFACE cxx_std_17) + +# ---- add dependenc libraries ---- + +find_package(Threads REQUIRED) +target_link_libraries(asio INTERFACE Threads::Threads) + +# ---- Install rules ---- + +if(NOT CMAKE_SKIP_INSTALL_RULES) + include(cmake/install-rules.cmake) + configure_file(asio.pc.cmake asio.pc) + install(FILES ${PROJECT_BINARY_DIR}/asio.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig) +endif() + +# ---- Developer mode ---- + +if(NOT asio_DEVELOPER_MODE) + return() +elseif(NOT PROJECT_IS_TOP_LEVEL) + message(AUTHOR_WARNING "Developer mode is intended for developers of asio") +endif() + +include(cmake/dev-mode.cmake) diff --git a/asio/CMakePresets.json b/asio/CMakePresets.json new file mode 100644 index 0000000000..bc79a3c03f --- /dev/null +++ b/asio/CMakePresets.json @@ -0,0 +1,163 @@ +{ + "version": 2, + "cmakeMinimumRequired": { + "major": 3, + "minor": 14, + "patch": 0 + }, + "configurePresets": [ + { + "name": "cmake-pedantic", + "hidden": true, + "warnings": { + "dev": true, + "deprecated": true, + "uninitialized": true, + "unusedCli": true, + "systemVars": false + }, + "errors": { + "dev": true, + "deprecated": true + } + }, + { + "name": "dev-mode", + "hidden": true, + "inherits": "cmake-pedantic", + "cacheVariables": { + "asio_DEVELOPER_MODE": "ON" + } + }, + { + "name": "cppcheck", + "hidden": true, + "cacheVariables": { + "CMAKE_CXX_CPPCHECK": "cppcheck;--inline-suppr" + } + }, + { + "name": "clang-tidy", + "hidden": true, + "cacheVariables": { + "CMAKE_CXX_CLANG_TIDY": "clang-tidy;--header-filter=${sourceDir}/*" + } + }, + { + "name": "ci-std", + "description": + "This preset makes sure the project actually builds with at least the specified standard", + "hidden": true, + "cacheVariables": { + "CMAKE_CXX_EXTENSIONS": "OFF", + "CMAKE_CXX_STANDARD": "17", + "CMAKE_CXX_STANDARD_REQUIRED": "ON" + } + }, + { + "name": "flags-unix", + "hidden": true, + "cacheVariables": { + "CMAKE_CXX_FLAGS": + "-Wall -Wextra -Wpedantic -Wconversion -Wsign-conversion -Wcast-qual -Wshadow -Wformat=2 -Wno-shorten-64-to-32 -Wno-undef -Wno-sign-conversion -Werror=float-equal" + } + }, + { + "name": "flags-windows", + "hidden": true, + "cacheVariables": { + "CMAKE_CXX_FLAGS": + "/W4 /permissive- /utf-8 /volatile:iso /Zc:preprocessor /EHsc /Zc:__cplusplus /Zc:externConstexpr /Zc:throwingNew" + } + }, + { + "name": "ci-unix", + "generator": "Unix Makefiles", + "hidden": true, + "inherits": [ + "flags-unix", + "ci-std" + ], + "cacheVariables": { + "CMAKE_BUILD_TYPE": "Release" + } + }, + { + "name": "ci-win64", + "inherits": [ + "flags-windows", + "ci-std" + ], + "generator": "Visual Studio 17 2022", + "architecture": "x64", + "hidden": true + }, + { + "name": "coverage-unix", + "binaryDir": "${sourceDir}/build/coverage", + "inherits": "ci-unix", + "hidden": true, + "cacheVariables": { + "ENABLE_COVERAGE": "ON", + "CMAKE_BUILD_TYPE": "Coverage", + "CMAKE_CXX_FLAGS_COVERAGE": "-Og -g --coverage", + "CMAKE_EXE_LINKER_FLAGS_COVERAGE": "--coverage", + "CMAKE_SHARED_LINKER_FLAGS_COVERAGE": "--coverage" + } + }, + { + "name": "ci-coverage", + "inherits": [ + "coverage-unix", + "dev-mode" + ], + "cacheVariables": { + "COVERAGE_HTML_COMMAND": "" + } + }, + { + "name": "ci-sanitize", + "binaryDir": "${sourceDir}/build/sanitize", + "inherits": [ + "ci-unix", + "dev-mode" + ], + "cacheVariables": { + "CMAKE_BUILD_TYPE": "Sanitize", + "CMAKE_CXX_FLAGS_SANITIZE": + "-O2 -g -fsanitize=address,undefined -fno-omit-frame-pointer -fno-common" + } + }, + { + "name": "ci-build", + "binaryDir": "${sourceDir}/build", + "hidden": true + }, + { + "name": "ci-macos", + "inherits": [ + "ci-build", + "ci-unix", + "dev-mode" + ] + }, + { + "name": "ci-ubuntu", + "inherits": [ + "ci-build", + "ci-unix", + "clang-tidy", + "cppcheck", + "dev-mode" + ] + }, + { + "name": "ci-windows", + "inherits": [ + "ci-build", + "ci-win64", + "dev-mode" + ] + } + ] +} diff --git a/asio/CMakeUserPresets.json b/asio/CMakeUserPresets.json new file mode 100644 index 0000000000..81ca8e3da7 --- /dev/null +++ b/asio/CMakeUserPresets.json @@ -0,0 +1,39 @@ +{ + "version": 2, + "cmakeMinimumRequired": { + "major": 3, + "minor": 20, + "patch": 0 + }, + "configurePresets": [ + { + "name": "dev", + "binaryDir": "${sourceDir}/build/dev", + "generator": "Ninja", + "inherits": [ + "dev-mode", + "ci-unix" + ], + "cacheVariables": { + "CMAKE_BUILD_TYPE": "Debug" + } + } + ], + "buildPresets": [ + { + "name": "dev", + "configurePreset": "dev", + "configuration": "Debug" + } + ], + "testPresets": [ + { + "name": "dev", + "configurePreset": "dev", + "configuration": "Debug", + "output": { + "outputOnFailure": true + } + } + ] +} diff --git a/asio/HACKING.md b/asio/HACKING.md new file mode 100644 index 0000000000..1911b3fcf6 --- /dev/null +++ b/asio/HACKING.md @@ -0,0 +1,96 @@ +# Hacking + +Here is some wisdom to help you build and test this project as a developer and +potential contributor. + +If you plan to contribute, please read the [CONTRIBUTING](CONTRIBUTING.md) +guide. + +## Developer mode + +Build system targets that are only useful for developers of this project are +hidden if the `asio_DEVELOPER_MODE` option is disabled. Enabling this +option makes tests and other developer targets and options available. Not +enabling this option means that you are a consumer of this project and thus you +have no need for these targets and options. + +Developer mode is always set to on in CI workflows. + +### Presets + +This project makes use of [presets][1] to simplify the process of configuring +the project. As a developer, you are recommended to always have the [latest +CMake version][2] installed to make use of the latest Quality-of-Life +additions. + +You have a few options to pass `asio_DEVELOPER_MODE` to the configure +command, but this project prefers to use presets. + +As a developer, you should create a `CMakeUserPresets.json` file at the root of +the project: + +```json +{ + "version": 2, + "cmakeMinimumRequired": { + "major": 3, + "minor": 14, + "patch": 0 + }, + "configurePresets": [ + { + "name": "dev", + "binaryDir": "${sourceDir}/build/dev", + "inherits": ["dev-mode", "ci-"], + "cacheVariables": { + "CMAKE_BUILD_TYPE": "Debug" + } + } + ], + "buildPresets": [ + { + "name": "dev", + "configurePreset": "dev", + "configuration": "Debug" + } + ], + "testPresets": [ + { + "name": "dev", + "configurePreset": "dev", + "configuration": "Debug", + "output": { + "outputOnFailure": true + } + } + ] +} +``` + +You should replace `` in your newly created presets file with the name of +the operating system you have, which may be `win64` or `unix`. You can see what +these correspond to in the [`CMakePresets.json`](CMakePresets.json) file. + +`CMakeUserPresets.json` is also the perfect place in which you can put all +sorts of things that you would otherwise want to pass to the configure command +in the terminal. + +### Configure, build and test + +If you followed the above instructions, then you can configure, build and test +the project respectively with the following commands from the project root on +any operating system with any build system: + +```sh +cmake --preset=dev +cmake --build --preset=dev +ctest --preset=dev +``` + +Please note that both the build and test command accepts a `-j` flag to specify +the number of jobs to use, which should ideally be specified to the number of +threads your CPU has. You may also want to add that to your preset using the +`jobs` property, see the [presets documentation][1] for more details. + +[1]: https://cmake.org/cmake/help/latest/manual/cmake-presets.7.html +[2]: https://cmake.org/download/ diff --git a/asio/asio.pc.cmake b/asio/asio.pc.cmake new file mode 100644 index 0000000000..31df77d380 --- /dev/null +++ b/asio/asio.pc.cmake @@ -0,0 +1,11 @@ +prefix=@CMAKE_INSTALL_PREFIX@ +exec_prefix=@CMAKE_INSTALL_PREFIX@/bin +includedir=@CMAKE_INSTALL_FULL_INCLUDEDIR@ + +Name: @PROJECT_NAME@ +Description: A cross-platform C++ library for network and low-level I/O programming that provides developers with a consistent asynchronous model using a modern C++ approach. +Version: @PROJECT_VERSION@ +Cflags: -I${CMAKE_INSTALL_FULL_INCLUDEDIR} -DASIO_NO_DEPRECATED +Lflags: +Requires: +Requires.private: diff --git a/asio/cmake/WarningsAsErrors.cmake b/asio/cmake/WarningsAsErrors.cmake new file mode 100644 index 0000000000..b23660c96a --- /dev/null +++ b/asio/cmake/WarningsAsErrors.cmake @@ -0,0 +1,12 @@ +if(CMAKE_CXX_COMPILER_ID MATCHES "Clang" AND CMAKE_CXX_SIMULATE_ID MATCHES "MSVC") + target_compile_options(${PROJECT_NAME} PRIVATE /W4 /WX) +elseif(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang") + target_compile_options(${PROJECT_NAME} PRIVATE -Wall -Wextra -Wpedantic -Werror -Wshadow) + + if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang" AND CMAKE_CXX_COMPILER_VERSION GREATER_EQUAL 10.0) + target_compile_options(${PROJECT_NAME} PRIVATE -Wdeprecated-copy-dtor -Wnewline-eof) + endif() +elseif(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") + string(REGEX REPLACE " /W[0-4]" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") + target_compile_options(${PROJECT_NAME} PRIVATE /W4 /WX) +endif() diff --git a/asio/cmake/coverage.cmake b/asio/cmake/coverage.cmake new file mode 100644 index 0000000000..5f3a32d833 --- /dev/null +++ b/asio/cmake/coverage.cmake @@ -0,0 +1,23 @@ +# ---- Variables ---- + +# We use variables separate from what CTest uses, because those have +# customization issues +set(COVERAGE_TRACE_COMMAND lcov -c -q -o "${PROJECT_BINARY_DIR}/coverage.info" -d "${PROJECT_BINARY_DIR}" --include + "${PROJECT_SOURCE_DIR}/*" + CACHE STRING "; separated command to generate a trace for the 'coverage' target" +) + +set(COVERAGE_HTML_COMMAND genhtml --legend -f -q "${PROJECT_BINARY_DIR}/coverage.info" -p "${PROJECT_SOURCE_DIR}" -o + "${PROJECT_BINARY_DIR}/coverage_html" + CACHE STRING "; separated command to generate an HTML report for the 'coverage' target" +) + +# ---- Coverage target ---- + +add_custom_target( + coverage + COMMAND ${COVERAGE_TRACE_COMMAND} + COMMAND ${COVERAGE_HTML_COMMAND} + COMMENT "Generating coverage report" + VERBATIM +) diff --git a/asio/cmake/dev-mode.cmake b/asio/cmake/dev-mode.cmake new file mode 100644 index 0000000000..0d1b3b08d5 --- /dev/null +++ b/asio/cmake/dev-mode.cmake @@ -0,0 +1,21 @@ +include(cmake/folders.cmake) + +option(BUILD_TESTING "Build the testing tree." ON) +if(BUILD_TESTING) + enable_testing() + add_subdirectory(src/tests) +endif() + +option(ENABLE_COVERAGE "Enable coverage support separate from CTest's" OFF) +if(ENABLE_COVERAGE) + include(cmake/coverage.cmake) +endif() + +if(CMAKE_HOST_SYSTEM_NAME STREQUAL "Windows") + include(cmake/open-cpp-coverage.cmake OPTIONAL) +endif() + +include(cmake/lint-targets.cmake) +include(cmake/spell-targets.cmake) + +add_folders(Project) diff --git a/asio/cmake/folders.cmake b/asio/cmake/folders.cmake new file mode 100644 index 0000000000..da7bd33a87 --- /dev/null +++ b/asio/cmake/folders.cmake @@ -0,0 +1,21 @@ +set_property(GLOBAL PROPERTY USE_FOLDERS YES) + +# Call this function at the end of a directory scope to assign a folder to +# targets created in that directory. Utility targets will be assigned to the +# UtilityTargets folder, otherwise to the ${name}Targets folder. If a target +# already has a folder assigned, then that target will be skipped. +function(add_folders name) + get_property(targets DIRECTORY PROPERTY BUILDSYSTEM_TARGETS) + foreach(target IN LISTS targets) + get_property(folder TARGET "${target}" PROPERTY FOLDER) + if(DEFINED folder) + continue() + endif() + set(folder Utility) + get_property(type TARGET "${target}" PROPERTY TYPE) + if(NOT type STREQUAL "UTILITY") + set(folder "${name}") + endif() + set_property(TARGET "${target}" PROPERTY FOLDER "${folder}Targets") + endforeach() +endfunction() diff --git a/asio/cmake/install-config.cmake b/asio/cmake/install-config.cmake new file mode 100644 index 0000000000..a770b2caff --- /dev/null +++ b/asio/cmake/install-config.cmake @@ -0,0 +1,4 @@ +include(CMakeFindDependencyMacro) +find_dependency(Threads) + +include("${CMAKE_CURRENT_LIST_DIR}/asioTargets.cmake") diff --git a/asio/cmake/install-rules.cmake b/asio/cmake/install-rules.cmake new file mode 100644 index 0000000000..793ffa4685 --- /dev/null +++ b/asio/cmake/install-rules.cmake @@ -0,0 +1,41 @@ +if(PROJECT_IS_TOP_LEVEL) + set(CMAKE_INSTALL_INCLUDEDIR include CACHE PATH "") +endif() + +# Project is configured with no languages, so tell GNUInstallDirs the lib dir +set(CMAKE_INSTALL_LIBDIR lib CACHE PATH "") + +include(CMakePackageConfigHelpers) +include(GNUInstallDirs) + +# find_package() call for consumers to find this project +set(package asio) + +install(DIRECTORY include/ DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}" COMPONENT asio_Development) + +install(TARGETS asio EXPORT asioTargets INCLUDES DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}" + FILE_SET HEADERS # NOTE: requierd from CMake to install the FILE_SET HEADERS again! +) + +write_basic_package_version_file("${package}ConfigVersion.cmake" COMPATIBILITY SameMajorVersion ARCH_INDEPENDENT) + +# Allow package maintainers to freely override the path for the configs +set(asio_INSTALL_CMAKEDIR "${CMAKE_INSTALL_DATADIR}/${package}" + CACHE PATH "CMake package config location relative to the install prefix" +) +mark_as_advanced(asio_INSTALL_CMAKEDIR) + +install(FILES cmake/install-config.cmake DESTINATION "${asio_INSTALL_CMAKEDIR}" RENAME "${package}Config.cmake" + COMPONENT asio_Development +) + +install(FILES "${PROJECT_BINARY_DIR}/${package}ConfigVersion.cmake" DESTINATION "${asio_INSTALL_CMAKEDIR}" + COMPONENT asio_Development +) + +install(EXPORT asioTargets NAMESPACE asio:: DESTINATION "${asio_INSTALL_CMAKEDIR}" COMPONENT asio_Development) + +if(PROJECT_IS_TOP_LEVEL) + set(CPACK_GENERATOR TGZ) + include(CPack) +endif() diff --git a/asio/cmake/lint-targets.cmake b/asio/cmake/lint-targets.cmake new file mode 100644 index 0000000000..518e046ec4 --- /dev/null +++ b/asio/cmake/lint-targets.cmake @@ -0,0 +1,23 @@ +set(FORMAT_PATTERNS src/*.cpp src/*.hpp include/*.hpp tests/*.cpp tests/*.hpp + CACHE STRING "; separated patterns relative to the project source dir to format" +) + +set(FORMAT_COMMAND clang-format CACHE STRING "Formatter to use") + +add_custom_target( + format-check + COMMAND "${CMAKE_COMMAND}" -D "FORMAT_COMMAND=${FORMAT_COMMAND}" -D "PATTERNS=${FORMAT_PATTERNS}" -P + "${PROJECT_SOURCE_DIR}/cmake/lint.cmake" + WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}" + COMMENT "Linting the code" + VERBATIM +) + +add_custom_target( + format-fix + COMMAND "${CMAKE_COMMAND}" -D "FORMAT_COMMAND=${FORMAT_COMMAND}" -D "PATTERNS=${FORMAT_PATTERNS}" -D FIX=YES -P + "${PROJECT_SOURCE_DIR}/cmake/lint.cmake" + WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}" + COMMENT "Fixing the code" + VERBATIM +) diff --git a/asio/cmake/lint.cmake b/asio/cmake/lint.cmake new file mode 100644 index 0000000000..ed8365df74 --- /dev/null +++ b/asio/cmake/lint.cmake @@ -0,0 +1,44 @@ +cmake_minimum_required(VERSION 3.14) + +macro(default name) + if(NOT DEFINED "${name}") + set("${name}" "${ARGN}") + endif() +endmacro() + +default(FORMAT_COMMAND clang-format) +default(PATTERNS src/*.cpp src/*.hpp include/asio/*.hpp tests/*.cpp tests/*.hpp) +default(FIX NO) + +set(flag --output-replacements-xml) +set(args OUTPUT_VARIABLE output) +if(FIX) + set(flag -i) + set(args "") +endif() + +file(GLOB_RECURSE files ${PATTERNS}) +set(badly_formatted "") +set(output "") +string(LENGTH "${CMAKE_SOURCE_DIR}/" path_prefix_length) + +foreach(file IN LISTS files) + execute_process( + COMMAND "${FORMAT_COMMAND}" --style=file "${flag}" "${file}" WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}" + RESULT_VARIABLE result ${args} + ) + if(NOT result EQUAL "0") + message(FATAL_ERROR "'${file}': formatter returned with ${result}") + endif() + if(NOT FIX AND output MATCHES "\n ...) +function(windows_set_path TEST) + if(NOT CMAKE_HOST_SYSTEM_NAME STREQUAL "Windows") + return() + endif() + + set(path "") + set(glue "") + foreach(target IN LISTS ARGN) + if(TARGET "${target}") + get_target_property(type "${target}" TYPE) + if(type STREQUAL "SHARED_LIBRARY") + set(path "${path}${glue}$") + set(glue "\;") # backslash is important + endif() + endif() + endforeach() + if(NOT path STREQUAL "") + set_property(TEST "${TEST}" PROPERTY ENVIRONMENT "PATH=${path}") + endif() +endfunction() diff --git a/asio/include/asio/experimental/parallel_group.hpp b/asio/include/asio/experimental/parallel_group.hpp index 35de3c3523..7de8f6f709 100644 --- a/asio/include/asio/experimental/parallel_group.hpp +++ b/asio/include/asio/experimental/parallel_group.hpp @@ -15,6 +15,7 @@ # pragma once #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) +#include "asio/async_result.hpp" #include "asio/detail/config.hpp" #include #include "asio/detail/array.hpp" diff --git a/asio/include/asio/spawn.hpp b/asio/include/asio/spawn.hpp index e9b3c4a98b..d7fa845474 100644 --- a/asio/include/asio/spawn.hpp +++ b/asio/include/asio/spawn.hpp @@ -16,6 +16,9 @@ #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include "asio/detail/config.hpp" + +#if defined(HAVE_BOOST) || defined(GENERATING_DOCUMENTATION) +#include #include "asio/any_io_executor.hpp" #include "asio/cancellation_signal.hpp" #include "asio/cancellation_state.hpp" @@ -869,4 +872,6 @@ void spawn(ExecutionContext& ctx, Function&& function, #include "asio/impl/spawn.hpp" +#endif // defined(HAVE_BOOST) || defined(GENERATING_DOCUMENTATION) + #endif // ASIO_SPAWN_HPP diff --git a/asio/src/examples/cpp11/timeouts/async_tcp_client.cpp b/asio/src/examples/cpp11/timeouts/async_tcp_client.cpp index cc4379fa7a..af8c9ad013 100644 --- a/asio/src/examples/cpp11/timeouts/async_tcp_client.cpp +++ b/asio/src/examples/cpp11/timeouts/async_tcp_client.cpp @@ -14,6 +14,7 @@ #include "asio/read_until.hpp" #include "asio/steady_timer.hpp" #include "asio/write.hpp" +#include #include #include #include diff --git a/asio/src/examples/cpp11/timeouts/blocking_tcp_client.cpp b/asio/src/examples/cpp11/timeouts/blocking_tcp_client.cpp index 37c92e3605..36694eaa7c 100644 --- a/asio/src/examples/cpp11/timeouts/blocking_tcp_client.cpp +++ b/asio/src/examples/cpp11/timeouts/blocking_tcp_client.cpp @@ -15,6 +15,7 @@ #include "asio/read_until.hpp" #include "asio/system_error.hpp" #include "asio/write.hpp" +#include #include #include #include diff --git a/asio/src/examples/cpp11/timeouts/blocking_token_tcp_client.cpp b/asio/src/examples/cpp11/timeouts/blocking_token_tcp_client.cpp index df3f573657..d9227ca7a6 100644 --- a/asio/src/examples/cpp11/timeouts/blocking_token_tcp_client.cpp +++ b/asio/src/examples/cpp11/timeouts/blocking_token_tcp_client.cpp @@ -15,6 +15,7 @@ #include "asio/streambuf.hpp" #include "asio/system_error.hpp" #include "asio/write.hpp" +#include #include #include #include diff --git a/asio/src/examples/cpp11/timeouts/blocking_udp_client.cpp b/asio/src/examples/cpp11/timeouts/blocking_udp_client.cpp index 27f95276ca..567969a990 100644 --- a/asio/src/examples/cpp11/timeouts/blocking_udp_client.cpp +++ b/asio/src/examples/cpp11/timeouts/blocking_udp_client.cpp @@ -11,6 +11,7 @@ #include "asio/buffer.hpp" #include "asio/io_context.hpp" #include "asio/ip/udp.hpp" +#include #include #include #include diff --git a/asio/src/examples/cpp11/timeouts/server.cpp b/asio/src/examples/cpp11/timeouts/server.cpp index baac47ed39..1fd2e2dc72 100644 --- a/asio/src/examples/cpp11/timeouts/server.cpp +++ b/asio/src/examples/cpp11/timeouts/server.cpp @@ -9,6 +9,7 @@ // #include +#include #include #include #include diff --git a/asio/src/tests/CMakeLists.txt b/asio/src/tests/CMakeLists.txt new file mode 100644 index 0000000000..23b3476e2a --- /dev/null +++ b/asio/src/tests/CMakeLists.txt @@ -0,0 +1,33 @@ +cmake_minimum_required(VERSION 3.21...3.29) + +project(asio_test LANGUAGES CXX) + +include(../../cmake/project-is-top-level.cmake OPTIONAL) +include(../../cmake/folders.cmake OPTIONAL) +include(../../cmake/windows-set-path.cmake OPTIONAL) + +# ---- Dependencies ---- + +if(PROJECT_IS_TOP_LEVEL) + find_package(asio REQUIRED) + enable_testing() +endif() + +# ---- Tests ---- + +add_executable(asio_test unit/read_until.cpp) + +target_link_libraries(asio_test PRIVATE asio::asio) +target_compile_features(asio_test PRIVATE cxx_std_17) + +# ---- Setup strict Compiler Warnings ---- + +include(../../cmake/WarningsAsErrors.cmake OPTIONAL) + +add_test(NAME asio_test COMMAND asio_test) + +# ---- End-of-file commands ---- + +if(NOT PROJECT_IS_TOP_LEVEL) + add_folders(Tests) +endif() From b559809fac87d383de8b3ff8ab62d4e9f8459b0f Mon Sep 17 00:00:00 2001 From: Claus Klein Date: Tue, 26 Mar 2024 13:48:26 +0100 Subject: [PATCH 02/13] Update cmake files with cmake-init v0.40.5 Add requirements.txt for pip Add ignore-workd-list for codespell Add CI cmake based project workflow --- .github/workflows/cmake.yml | 194 ++++++++++++++++++++++++++++ asio/.TODO.txt | 155 ++++++++++++---------- asio/.codespellrc | 3 +- asio/CMakePresets.json | 58 ++++++--- asio/CMakeUserPresets.json | 67 +++++++++- asio/GNUmakefile | 16 +++ asio/cmake/AddUninstallTarget.cmake | 93 +++++++++++++ asio/cmake/WarningsAsErrors.cmake | 12 -- asio/cmake/dev-mode.cmake | 11 +- asio/cmake/docs-ci.cmake | 104 +++++++++++++++ asio/cmake/docs.cmake | 41 ++++++ asio/cmake/install-rules.cmake | 4 +- asio/cmake/variables.cmake | 2 +- asio/docs/Doxyfile.in | 32 +++++ asio/docs/conf.py.in | 6 + asio/docs/pages/about.dox | 7 + asio/requirements.txt | 13 ++ 17 files changed, 704 insertions(+), 114 deletions(-) create mode 100644 .github/workflows/cmake.yml create mode 100644 asio/GNUmakefile create mode 100644 asio/cmake/AddUninstallTarget.cmake delete mode 100644 asio/cmake/WarningsAsErrors.cmake create mode 100644 asio/cmake/docs-ci.cmake create mode 100644 asio/cmake/docs.cmake create mode 100644 asio/docs/Doxyfile.in create mode 100644 asio/docs/conf.py.in create mode 100644 asio/docs/pages/about.dox create mode 100644 asio/requirements.txt diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml new file mode 100644 index 0000000000..acb6eadcf0 --- /dev/null +++ b/.github/workflows/cmake.yml @@ -0,0 +1,194 @@ +name: Continuous Integration + +on: + push: + branches: + - master + - develop + - feature/* + + pull_request: + branches: + - develop + +jobs: + lint: + runs-on: ubuntu-22.04 + + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-python@v5 + with: {python-version: "3.8"} + + - name: Install codespell + run: pip3 install codespell + + - name: Lint + if: always() + working-directory: asio + run: cmake -D FORMAT_COMMAND=clang-format-14 -P cmake/lint.cmake || echo ignored + + - name: Spell check + if: always() + working-directory: asio + run: cmake -P cmake/spell.cmake || echo ignored + + coverage: + needs: [lint] + + runs-on: ubuntu-22.04 + + # To enable coverage, delete the last line from the conditional below and + # edit the "" placeholder to your GitHub name. + # If you do not wish to use codecov, then simply delete this job from the + # workflow. + if: github.repository_owner == '' + && false + + steps: + - uses: actions/checkout@v4 + + - name: Install LCov + run: sudo apt-get update -q + && sudo apt-get install lcov -q -y + + - name: Configure + working-directory: asio + run: cmake --preset=ci-coverage + + - name: Build + working-directory: asio + run: cmake --build build/coverage -j 2 + + - name: Test + working-directory: asio/build/coverage + run: ctest --output-on-failure --no-tests=error -j 2 + + - name: Process coverage info + working-directory: asio + run: cmake --build build/coverage -t coverage + + - name: Submit to codecov.io + uses: codecov/codecov-action@v3 + with: + file: build/coverage/coverage.info + + sanitize: + needs: [lint] + + runs-on: ubuntu-22.04 + + env: {CXX: clang++-14} + + steps: + - uses: actions/checkout@v4 + + - name: Configure + working-directory: asio + run: cmake --preset=ci-sanitize + + - name: Build + working-directory: asio + run: cmake --build build/sanitize -j 2 + + - name: Test + working-directory: asio/build/sanitize + env: + ASAN_OPTIONS: "strict_string_checks=1:\ + detect_stack_use_after_return=1:\ + check_initialization_order=1:\ + strict_init_order=1:\ + detect_leaks=1" + UBSAN_OPTIONS: print_stacktrace=1 + run: ctest --output-on-failure --no-tests=error -j 2 + + test: + needs: [lint] + + strategy: + matrix: + os: [macos-12, ubuntu-22.04, windows-2022] + + runs-on: ${{ matrix.os }} + + steps: + - uses: actions/checkout@v4 + + - name: Install static analyzers + if: matrix.os == 'ubuntu-22.04' + run: >- + sudo apt-get install clang-tidy-14 cppcheck -y -q + + sudo update-alternatives --install + /usr/bin/clang-tidy clang-tidy + /usr/bin/clang-tidy-14 140 + + - name: Setup MultiToolTask + if: matrix.os == 'windows-2022' + run: | + Add-Content "$env:GITHUB_ENV" 'UseMultiToolTask=true' + Add-Content "$env:GITHUB_ENV" 'EnforceProcessCountAcrossBuilds=true' + + - name: Configure + shell: pwsh + working-directory: asio + run: cmake "--preset=ci-$("${{ matrix.os }}".split("-")[0])" + + - name: Build + working-directory: asio + run: cmake --build build --config Release -j 2 + + - name: Install + working-directory: asio + run: cmake --install build --config Release --prefix prefix + + - name: Test + working-directory: asio/build + run: ctest --output-on-failure --no-tests=error -C Release -j 2 + + docs: + # Deploy docs only when builds succeed + needs: [sanitize, test] + + runs-on: ubuntu-22.04 + + # To enable, first you have to create an orphaned gh-pages branch: + # + # git switch --orphan gh-pages + # git commit --allow-empty -m "Initial commit" + # git push -u origin gh-pages + # + # Edit the placeholder below to your GitHub name, so this action + # runs only in your repository and no one else's fork. After these, delete + # this comment and the last line in the conditional below. + # If you do not wish to use GitHub Pages for deploying documentation, then + # simply delete this job similarly to the coverage one. + if: github.ref == 'refs/heads/master' + && github.event_name == 'push' + && github.repository_owner == '' + && false + + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-python@v5 + with: {python-version: "3.8"} + + - name: Install m.css dependencies + run: pip3 install jinja2 Pygments + + - name: Install Doxygen + run: sudo apt-get update -q + && sudo apt-get install doxygen -q -y + + - name: Build docs + working-directory: asio + run: cmake "-DPROJECT_SOURCE_DIR=$PWD" "-DPROJECT_BINARY_DIR=$PWD/build" + -P cmake/docs-ci.cmake + + - name: Deploy docs + uses: peaceiris/actions-gh-pages@v3 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_dir: build/docs/html diff --git a/asio/.TODO.txt b/asio/.TODO.txt index 84b8f40056..571f32b427 100644 --- a/asio/.TODO.txt +++ b/asio/.TODO.txt @@ -1,78 +1,91 @@ -Claus-iMac:dev clausklein$ make spell-check | grep -v encode | grep -vw alives -CMake Error at cmake/spell.cmake:27 (message): - Run again with FIX=YES to fix these errors. - - -make[3]: *** [CMakeFiles/spell-check] Error 1 -make[2]: *** [CMakeFiles/spell-check.dir/all] Error 2 -make[1]: *** [CMakeFiles/spell-check.dir/rule] Error 2 -make: *** [spell-check] Error 2 -[100%] Checking spelling -./include/asio/io_context.hpp:185: exeution ==> execution -./include/asio/io_context.hpp:318: reponsibility ==> responsibility -./include/asio/io_context.hpp:349: reponsibility ==> responsibility -./include/asio/io_context.hpp:401: reponsibility ==> responsibility -./include/asio/io_context.hpp:423: reponsibility ==> responsibility +ninja -C build/dev spell-check +ninja: Entering directory `build/dev' +[1/1] Checking spelling +FAILED: CMakeFiles/spell-check /home/klein_cl/Workspace/cpp/asio/asio/build/dev/CMakeFiles/spell-check +cd /home/klein_cl/Workspace/cpp/asio/asio && /home/klein_cl/.local/lib/python3.10/site-packages/cmake/data/bin/cmake -D SPELL_COMMAND=codespell -P /home/klein_cl/Workspace/cpp/asio/asio/cmake/spell.cmake +Used config files: + 1: .codespellrc +./src/examples/cpp14/operations/composed_7.cpp:73: asychronous ==> asynchronous +./src/examples/cpp14/operations/composed_7.cpp:119: asychronous ==> asynchronous +./src/examples/cpp14/operations/composed_6.cpp:111: asychronous ==> asynchronous +./src/examples/cpp11/timers/time_t_timer.cpp:66: absoluate ==> absolute +./src/examples/cpp11/porthopper/client.cpp:96: renegotation ==> renegotiation +./src/examples/cpp11/porthopper/client.cpp:120: renegotation ==> renegotiation +./src/examples/cpp11/porthopper/client.cpp:149: renegotation ==> renegotiation +./src/examples/cpp11/porthopper/client.cpp:162: renegotation ==> renegotiation +./src/examples/cpp11/operations/composed_7.cpp:60: asychronous ==> asynchronous +./src/examples/cpp11/operations/composed_6.cpp:93: asychronous ==> asynchronous +./src/examples/cpp20/operations/composed_7.cpp:74: asychronous ==> asynchronous +./src/examples/cpp20/operations/composed_7.cpp:120: asychronous ==> asynchronous +./src/examples/cpp20/operations/composed_6.cpp:116: asychronous ==> asynchronous +./src/doc/reference.qbk:1697: requre ==> require +./src/doc/reference.qbk:3966: requre ==> require +./src/doc/reference.qbk:17885: ore ==> or +./src/doc/reference.qbk:17947: ore ==> or +./src/doc/reference.qbk:32144: ore ==> or +./src/doc/reference.qbk:32206: ore ==> or +./src/doc/reference.qbk:89453: requre ==> require +./src/doc/reference.qbk:110672: reponsibility ==> responsibility +./src/doc/reference.qbk:110715: reponsibility ==> responsibility +./src/doc/reference.qbk:110799: reponsibility ==> responsibility +./src/doc/reference.qbk:110833: reponsibility ==> responsibility +./src/doc/reference.qbk:164642: retuned ==> returned +./src/doc/history.qbk:41: potental ==> potential +./src/doc/history.qbk:165: immmediate ==> immediate +./src/doc/history.qbk:863: occured ==> occurred +./src/doc/history.qbk:1710: compatiblity ==> compatibility +./src/doc/history.qbk:1827: Lightening ==> Lightning, Lighting +./src/doc/history.qbk:1903: copyable ==> copiable +./src/doc/history.qbk:1946: discconected ==> disconnected +./src/doc/history.qbk:2108: compatability ==> compatibility +./src/doc/history.qbk:2533: copyable ==> copiable +./src/doc/history.qbk:2568: accomodate ==> accommodate +./src/doc/history.qbk:2788: tranferred ==> transferred +./src/doc/history.qbk:2907: re-use ==> reuse +./src/doc/quickref.xml:17: thead ==> thread +./src/doc/quickref.xml:26: thead ==> thread +./src/doc/quickref.xml:133: thead ==> thread +./src/doc/quickref.xml:139: thead ==> thread +./src/doc/quickref.xml:320: thead ==> thread +./src/doc/quickref.xml:326: thead ==> thread +./src/doc/quickref.xml:427: thead ==> thread +./src/doc/quickref.xml:433: thead ==> thread +./src/doc/quickref.xml:577: thead ==> thread +./src/doc/quickref.xml:592: thead ==> thread +./src/doc/quickref.xml:693: thead ==> thread +./src/doc/quickref.xml:705: thead ==> thread +./src/doc/using.qbk:232: Explictly ==> Explicitly +./src/doc/requirements/asynchronous_operations.qbk:332: asynchonous ==> asynchronous +./src/doc/overview/immediate_completion.qbk:16: immmediate ==> immediate +./src/doc/overview/cpp20_coroutines.qbk:223: Asynchonous ==> Asynchronous +./src/doc/overview/coro.qbk:15: transfomers ==> transformers +./src/doc/overview/coro.qbk:136: dermined ==> determined +./src/doc/overview/coro.qbk:137: follwing ==> following +./src/doc/overview/coro.qbk:194: direclty ==> directly +./src/doc/overview/implementation.qbk:63: asynchonous ==> asynchronous +./cmake/install-rules.cmake:19: requierd ==> required +./include/asio/io_context.hpp:300: reponsibility ==> responsibility +./include/asio/io_context.hpp:331: reponsibility ==> responsibility +./include/asio/io_context.hpp:381: reponsibility ==> responsibility +./include/asio/io_context.hpp:403: reponsibility ==> responsibility +./include/asio/basic_datagram_socket.hpp:348: ore ==> or +./include/asio/basic_datagram_socket.hpp:380: ore ==> or ./include/asio/use_future.hpp:102: retuned ==> returned -./include/asio/impl/use_future.hpp:203: exeption ==> exception, exemption -./include/asio/experimental/deferred.hpp:375: alue ==> value -./include/asio/experimental/impl/parallel_group.hpp:80: operatations ==> operations -./include/asio/detail/executor_function.hpp:124: copyable ==> copiable -./include/asio/detail/executor_function.hpp:171: copyable ==> copiable +./include/asio/basic_raw_socket.hpp:342: ore ==> or +./include/asio/basic_raw_socket.hpp:373: ore ==> or +./include/asio/detail/timer_queue_ptime.hpp:32: instantation ==> instantiation +./include/asio/detail/executor_function.hpp:119: copyable ==> copiable ./include/asio/detail/service_registry.hpp:79: Initalise ==> Initialise ./include/asio/detail/service_registry.hpp:84: Initalise ==> Initialise ./include/asio/detail/win_iocp_io_context.hpp:267: resouce ==> resource -./include/asio/detail/timer_queue_ptime.hpp:32: instantation ==> instantiation -./include/asio/execution/any_executor.hpp:98: requre ==> require +./include/asio/execution/any_executor.hpp:112: requre ==> require ./include/asio/execution/impl/bad_executor.ipp:2: exection ==> execution -./include/asio/execution/impl/receiver_invocation_error.ipp:2: exection ==> execution +./include/asio/experimental/impl/parallel_group.hpp:81: operatations ==> operations +./include/asio/experimental/impl/parallel_group.hpp:396: operatations ==> operations ./include/asio/ip/detail/endpoint.hpp:31: implementating ==> implementing -./src/examples/cpp11/timers/time_t_timer.cpp:66: absoluate ==> absolute -./src/examples/cpp11/operations/composed_6.cpp:92: asychronous ==> asynchronous -./src/examples/cpp11/operations/composed_7.cpp:59: asychronous ==> asynchronous -./src/examples/cpp03/timers/time_t_timer.cpp:65: absoluate ==> absolute -./src/examples/cpp03/porthopper/client.cpp:100: renegotation ==> renegotiation -./src/examples/cpp03/porthopper/client.cpp:125: renegotation ==> renegotiation -./src/examples/cpp03/porthopper/client.cpp:153: renegotation ==> renegotiation -./src/examples/cpp03/porthopper/client.cpp:166: renegotation ==> renegotiation -./src/examples/cpp14/operations/composed_6.cpp:103: asychronous ==> asynchronous -./src/examples/cpp14/operations/composed_7.cpp:65: asychronous ==> asynchronous -./src/examples/cpp14/operations/composed_7.cpp:111: asychronous ==> asynchronous -./src/doc/using.qbk:227: Explictly ==> Explicitly -./src/doc/history.qbk:137: occured ==> occurred -./src/doc/history.qbk:984: compatiblity ==> compatibility -./src/doc/history.qbk:1101: Lightening ==> Lightning, lighting -./src/doc/history.qbk:1177: copyable ==> copiable -./src/doc/history.qbk:1220: discconected ==> disconnected -./src/doc/history.qbk:1382: compatability ==> compatibility -./src/doc/history.qbk:1807: copyable ==> copiable -./src/doc/history.qbk:1842: accomodate ==> accommodate -./src/doc/history.qbk:2062: tranferred ==> transferred -./src/doc/reference.qbk:1646: requre ==> require -./src/doc/reference.qbk:83101: requre ==> require -./src/doc/reference.qbk:96234: alue ==> value -./src/doc/reference.qbk:96274: alue ==> value -./src/doc/reference.qbk:103899: exeution ==> execution -./src/doc/reference.qbk:104790: reponsibility ==> responsibility -./src/doc/reference.qbk:104833: reponsibility ==> responsibility -./src/doc/reference.qbk:104917: reponsibility ==> responsibility -./src/doc/reference.qbk:104948: reponsibility ==> responsibility -./src/doc/reference.qbk:107562: exeution ==> execution -./src/doc/reference.qbk:157316: retuned ==> returned -./src/doc/quickref.xml:17: thead ==> thread -./src/doc/quickref.xml:26: thead ==> thread -./src/doc/quickref.xml:180: thead ==> thread -./src/doc/quickref.xml:186: thead ==> thread -./src/doc/quickref.xml:356: thead ==> thread -./src/doc/quickref.xml:362: thead ==> thread -./src/doc/quickref.xml:463: thead ==> thread -./src/doc/quickref.xml:469: thead ==> thread -./src/doc/quickref.xml:613: thead ==> thread -./src/doc/quickref.xml:628: thead ==> thread -./src/doc/quickref.xml:729: thead ==> thread -./src/doc/quickref.xml:741: thead ==> thread -./src/doc/requirements/asynchronous_operations.qbk:309: asynchonous ==> asynchronous -./src/doc/overview/coro.qbk:137: follwing ==> following -./src/doc/overview/coro.qbk:194: direclty ==> directly -Claus-iMac:dev clausklein$ +./include/asio/impl/use_future.hpp:104: exeption ==> exception, exemption +CMake Error at cmake/spell.cmake:27 (message): + Run again with FIX=YES to fix these errors. + +ninja: build stopped: subcommand failed. diff --git a/asio/.codespellrc b/asio/.codespellrc index baa7851fe3..5c562c4cf2 100644 --- a/asio/.codespellrc +++ b/asio/.codespellrc @@ -2,5 +2,6 @@ builtin = clear,rare,names,informal,code check-filenames = check-hidden = -skip = */.git,*/build,*/prefix,*/stage +skip = */.git,*/build,*/prefix,*/stage,.TODO.txt quiet-level = 2 +ignore-words-list = tim,deque,endcode,keep-alives,nmake diff --git a/asio/CMakePresets.json b/asio/CMakePresets.json index bc79a3c03f..3378487632 100644 --- a/asio/CMakePresets.json +++ b/asio/CMakePresets.json @@ -40,7 +40,7 @@ "name": "clang-tidy", "hidden": true, "cacheVariables": { - "CMAKE_CXX_CLANG_TIDY": "clang-tidy;--header-filter=${sourceDir}/*" + "CMAKE_CXX_CLANG_TIDY": "clang-tidy;--header-filter=^${sourceDir}/" } }, { @@ -50,32 +50,59 @@ "hidden": true, "cacheVariables": { "CMAKE_CXX_EXTENSIONS": "OFF", - "CMAKE_CXX_STANDARD": "17", + "CMAKE_CXX_STANDARD": "20", "CMAKE_CXX_STANDARD_REQUIRED": "ON" } }, { - "name": "flags-unix", + "name": "flags-linux", "hidden": true, "cacheVariables": { "CMAKE_CXX_FLAGS": - "-Wall -Wextra -Wpedantic -Wconversion -Wsign-conversion -Wcast-qual -Wshadow -Wformat=2 -Wno-shorten-64-to-32 -Wno-undef -Wno-sign-conversion -Werror=float-equal" + "-U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3 -fstack-protector-strong -fcf-protection=full -fstack-clash-protection -Wall -Wextra -Wpedantic -Wconversion -Wsign-conversion -Wcast-qual -Wformat=2 -Wundef -Werror=float-equal -Wshadow -Wcast-align -Wunused -Wnull-dereference -Wdouble-promotion -Wimplicit-fallthrough -Wextra-semi -Woverloaded-virtual -Wnon-virtual-dtor -Wold-style-cast", + "CMAKE_EXE_LINKER_FLAGS": + "-Wl,--allow-shlib-undefined,--as-needed,-z,noexecstack,-z,relro,-z,now", + "CMAKE_SHARED_LINKER_FLAGS": + "-Wl,--allow-shlib-undefined,--as-needed,-z,noexecstack,-z,relro,-z,now" + } + }, + { + "name": "flags-darwin", + "hidden": true, + "cacheVariables": { + "CMAKE_CXX_FLAGS": + "-fstack-protector-strong -fcf-protection=full -Wall -Wextra -Wpedantic -Wconversion -Wsign-conversion -Wcast-qual -Wformat=2 -Wundef -Werror=float-equal -Wshadow -Wcast-align -Wunused -Wnull-dereference -Wdouble-promotion -Wimplicit-fallthrough -Wextra-semi -Woverloaded-virtual -Wnon-virtual-dtor -Wold-style-cast" } }, { "name": "flags-windows", + "description": + "Note that all the flags after /W4 are required for MSVC to conform to the language standard", "hidden": true, "cacheVariables": { "CMAKE_CXX_FLAGS": - "/W4 /permissive- /utf-8 /volatile:iso /Zc:preprocessor /EHsc /Zc:__cplusplus /Zc:externConstexpr /Zc:throwingNew" + "/sdl /guard:cf /utf-8 /diagnostics:caret /w14165 /w44242 /w44254 /w44263 /w34265 /w34287 /w44296 /w44365 /w44388 /w44464 /w14545 /w14546 /w14547 /w14549 /w14555 /w34619 /w34640 /w24826 /w14905 /w14906 /w14928 /w45038 /W4 /permissive- /volatile:iso /Zc:inline /Zc:preprocessor /Zc:enumTypes /Zc:lambda /Zc:__cplusplus /Zc:externConstexpr /Zc:throwingNew /EHsc", + "CMAKE_EXE_LINKER_FLAGS": "/machine:x64 /guard:cf" + } + }, + { + "name": "ci-linux", + "generator": "Unix Makefiles", + "hidden": true, + "inherits": [ + "flags-linux", + "ci-std" + ], + "cacheVariables": { + "CMAKE_BUILD_TYPE": "Release" } }, { - "name": "ci-unix", + "name": "ci-darwin", "generator": "Unix Makefiles", "hidden": true, "inherits": [ - "flags-unix", + "flags-darwin", "ci-std" ], "cacheVariables": { @@ -93,14 +120,15 @@ "hidden": true }, { - "name": "coverage-unix", + "name": "coverage-linux", "binaryDir": "${sourceDir}/build/coverage", - "inherits": "ci-unix", + "inherits": "ci-linux", "hidden": true, "cacheVariables": { "ENABLE_COVERAGE": "ON", "CMAKE_BUILD_TYPE": "Coverage", - "CMAKE_CXX_FLAGS_COVERAGE": "-Og -g --coverage", + "CMAKE_CXX_FLAGS_COVERAGE": + "-Og -g --coverage -fkeep-inline-functions -fkeep-static-functions", "CMAKE_EXE_LINKER_FLAGS_COVERAGE": "--coverage", "CMAKE_SHARED_LINKER_FLAGS_COVERAGE": "--coverage" } @@ -108,7 +136,7 @@ { "name": "ci-coverage", "inherits": [ - "coverage-unix", + "coverage-linux", "dev-mode" ], "cacheVariables": { @@ -119,7 +147,7 @@ "name": "ci-sanitize", "binaryDir": "${sourceDir}/build/sanitize", "inherits": [ - "ci-unix", + "ci-linux", "dev-mode" ], "cacheVariables": { @@ -137,7 +165,7 @@ "name": "ci-macos", "inherits": [ "ci-build", - "ci-unix", + "ci-darwin", "dev-mode" ] }, @@ -145,9 +173,7 @@ "name": "ci-ubuntu", "inherits": [ "ci-build", - "ci-unix", - "clang-tidy", - "cppcheck", + "ci-linux", "dev-mode" ] }, diff --git a/asio/CMakeUserPresets.json b/asio/CMakeUserPresets.json index 81ca8e3da7..3c74e1aa5e 100644 --- a/asio/CMakeUserPresets.json +++ b/asio/CMakeUserPresets.json @@ -2,28 +2,77 @@ "version": 2, "cmakeMinimumRequired": { "major": 3, - "minor": 20, + "minor": 14, "patch": 0 }, "configurePresets": [ { - "name": "dev", - "binaryDir": "${sourceDir}/build/dev", + "name": "dev-common", + "hidden": true, "generator": "Ninja", "inherits": [ - "dev-mode", - "ci-unix" + "dev-mode" + ], + "cacheVariables": { + "BUILD_MCSS_DOCS": "ON" + } + }, + { + "name": "dev-linux", + "binaryDir": "${sourceDir}/build/dev-linux", + "inherits": [ + "dev-common", + "ci-linux" + ], + "cacheVariables": { + "CMAKE_BUILD_TYPE": "Debug", + "CMAKE_EXPORT_COMPILE_COMMANDS": "ON" + } + }, + { + "name": "dev-darwin", + "binaryDir": "${sourceDir}/build/dev-darwin", + "inherits": [ + "dev-common", + "ci-darwin" ], "cacheVariables": { - "CMAKE_BUILD_TYPE": "Debug" + "CMAKE_BUILD_TYPE": "Debug", + "CMAKE_EXPORT_COMPILE_COMMANDS": "ON" + } + }, + { + "name": "dev-win64", + "binaryDir": "${sourceDir}/build/dev-win64", + "inherits": [ + "dev-common", + "ci-win64" + ], + "environment": { + "UseMultiToolTask": "true", + "EnforceProcessCountAcrossBuilds": "true" } + }, + { + "name": "dev", + "binaryDir": "${sourceDir}/build/dev", + "inherits": "dev-darwin" + }, + { + "name": "dev-coverage", + "binaryDir": "${sourceDir}/build/coverage", + "inherits": [ + "dev-mode", + "coverage-linux" + ] } ], "buildPresets": [ { "name": "dev", "configurePreset": "dev", - "configuration": "Debug" + "configuration": "Debug", + "jobs": 12 } ], "testPresets": [ @@ -33,6 +82,10 @@ "configuration": "Debug", "output": { "outputOnFailure": true + }, + "execution": { + "jobs": 12, + "noTestsAction": "error" } } ] diff --git a/asio/GNUmakefile b/asio/GNUmakefile new file mode 100644 index 0000000000..1b22c6d958 --- /dev/null +++ b/asio/GNUmakefile @@ -0,0 +1,16 @@ +.PHONY: all check clean +all: .init + cmake --preset dev + cmake --build --preset dev + ninja -C build/dev all_verify_interface_header_sets + +check: + ninja -C build/dev spell-check + ninja -C build/dev format-check + +.init: requirements.txt + pip3 install -U -r requirements.txt + touch .init + +clean: + ninja -C build/dev clean diff --git a/asio/cmake/AddUninstallTarget.cmake b/asio/cmake/AddUninstallTarget.cmake new file mode 100644 index 0000000000..e9bbcec327 --- /dev/null +++ b/asio/cmake/AddUninstallTarget.cmake @@ -0,0 +1,93 @@ +# SPDX-FileCopyrightText: 2012-2021 Istituto Italiano di Tecnologia (IIT) +# SPDX-FileCopyrightText: 2008-2013 Kitware Inc. +# SPDX-License-Identifier: BSD-3-Clause + +#[=======================================================================[.rst: +AddUninstallTarget +------------------ + +Add the "uninstall" target for your project:: + + include(AddUninstallTarget) + + +will create a file ``cmake_uninstall.cmake`` in the build directory and add a +custom target ``uninstall`` (or ``UNINSTALL`` on Visual Studio and Xcode) that +will remove the files installed by your package (using +``install_manifest.txt``). +See also +https://gitlab.kitware.com/cmake/community/wikis/FAQ#can-i-do-make-uninstall-with-cmake + +The :module:`AddUninstallTarget` module must be included in your main +``CMakeLists.txt``. If included in a subdirectory it does nothing. +This allows you to use it safely in your main ``CMakeLists.txt`` and include +your project using ``add_subdirectory`` (for example when using it with +:cmake:module:`FetchContent`). + +If the ``uninstall`` target already exists, the module does nothing. +#]=======================================================================] + +# AddUninstallTarget works only when included in the main CMakeLists.txt +if(NOT "${CMAKE_CURRENT_BINARY_DIR}" STREQUAL "${CMAKE_BINARY_DIR}") + return() +endif() + +# The name of the target is uppercase in MSVC and Xcode (for coherence with the +# other standard targets) +if("${CMAKE_GENERATOR}" MATCHES "^(Visual Studio|Xcode)") + set(_uninstall "UNINSTALL") +else() + set(_uninstall "uninstall") +endif() + +# If target is already defined don't do anything +if(TARGET ${_uninstall}) + return() +endif() + +set(_filename cmake_uninstall.cmake) + +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/${_filename}" + "if(NOT EXISTS \"${CMAKE_CURRENT_BINARY_DIR}/install_manifest.txt\") + message(WARNING \"Cannot find install manifest: \\\"${CMAKE_CURRENT_BINARY_DIR}/install_manifest.txt\\\"\") + return() +endif() + +file(READ \"${CMAKE_CURRENT_BINARY_DIR}/install_manifest.txt\" files) +string(STRIP \"\${files}\" files) +string(REGEX REPLACE \"\\n\" \";\" files \"\${files}\") +list(REVERSE files) +foreach(file \${files}) + if(IS_SYMLINK \"\$ENV{DESTDIR}\${file}\" OR EXISTS \"\$ENV{DESTDIR}\${file}\") + message(STATUS \"Uninstalling: \$ENV{DESTDIR}\${file}\") + execute_process( + COMMAND \${CMAKE_COMMAND} -E remove \"\$ENV{DESTDIR}\${file}\" + OUTPUT_VARIABLE rm_out + RESULT_VARIABLE rm_retval) + if(NOT \"\${rm_retval}\" EQUAL 0) + message(FATAL_ERROR \"Problem when removing \\\"\$ENV{DESTDIR}\${file}\\\"\") + endif() + else() + message(STATUS \"Not-found: \$ENV{DESTDIR}\${file}\") + endif() +endforeach(file) +" +) + +set(_desc "Uninstall the project...") +if(CMAKE_GENERATOR STREQUAL "Unix Makefiles") + set(_comment COMMAND \$\(CMAKE_COMMAND\) -E cmake_echo_color --switch=$\(COLOR\) --cyan "${_desc}") +else() + set(_comment COMMENT "${_desc}") +endif() +add_custom_target( + ${_uninstall} + ${_comment} + COMMAND ${CMAKE_COMMAND} -P ${_filename} + USES_TERMINAL + BYPRODUCTS uninstall_byproduct + WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}" +) +set_property(SOURCE uninstall_byproduct PROPERTY SYMBOLIC 1) + +set_property(TARGET ${_uninstall} PROPERTY FOLDER "CMakePredefinedTargets") diff --git a/asio/cmake/WarningsAsErrors.cmake b/asio/cmake/WarningsAsErrors.cmake deleted file mode 100644 index b23660c96a..0000000000 --- a/asio/cmake/WarningsAsErrors.cmake +++ /dev/null @@ -1,12 +0,0 @@ -if(CMAKE_CXX_COMPILER_ID MATCHES "Clang" AND CMAKE_CXX_SIMULATE_ID MATCHES "MSVC") - target_compile_options(${PROJECT_NAME} PRIVATE /W4 /WX) -elseif(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang") - target_compile_options(${PROJECT_NAME} PRIVATE -Wall -Wextra -Wpedantic -Werror -Wshadow) - - if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang" AND CMAKE_CXX_COMPILER_VERSION GREATER_EQUAL 10.0) - target_compile_options(${PROJECT_NAME} PRIVATE -Wdeprecated-copy-dtor -Wnewline-eof) - endif() -elseif(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") - string(REGEX REPLACE " /W[0-4]" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") - target_compile_options(${PROJECT_NAME} PRIVATE /W4 /WX) -endif() diff --git a/asio/cmake/dev-mode.cmake b/asio/cmake/dev-mode.cmake index 0d1b3b08d5..94f0c353eb 100644 --- a/asio/cmake/dev-mode.cmake +++ b/asio/cmake/dev-mode.cmake @@ -1,20 +1,21 @@ include(cmake/folders.cmake) -option(BUILD_TESTING "Build the testing tree." ON) +option(BUILD_TESTING "Use ctest" ON) if(BUILD_TESTING) enable_testing() add_subdirectory(src/tests) endif() +option(BUILD_MCSS_DOCS "Build documentation using Doxygen and m.css" OFF) +if(BUILD_MCSS_DOCS) + include(cmake/docs.cmake) +endif() + option(ENABLE_COVERAGE "Enable coverage support separate from CTest's" OFF) if(ENABLE_COVERAGE) include(cmake/coverage.cmake) endif() -if(CMAKE_HOST_SYSTEM_NAME STREQUAL "Windows") - include(cmake/open-cpp-coverage.cmake OPTIONAL) -endif() - include(cmake/lint-targets.cmake) include(cmake/spell-targets.cmake) diff --git a/asio/cmake/docs-ci.cmake b/asio/cmake/docs-ci.cmake new file mode 100644 index 0000000000..1a4727bd2b --- /dev/null +++ b/asio/cmake/docs-ci.cmake @@ -0,0 +1,104 @@ +cmake_minimum_required(VERSION 3.14) + +foreach(var IN ITEMS PROJECT_BINARY_DIR PROJECT_SOURCE_DIR) + if(NOT DEFINED "${var}") + message(FATAL_ERROR "${var} must be defined") + endif() +endforeach() +set(bin "${PROJECT_BINARY_DIR}") +set(src "${PROJECT_SOURCE_DIR}") + +# ---- Dependencies ---- + +set(mcss_SOURCE_DIR "${bin}/docs/.ci") +if(NOT IS_DIRECTORY "${mcss_SOURCE_DIR}") + file(MAKE_DIRECTORY "${mcss_SOURCE_DIR}") + file(DOWNLOAD https://github.com/friendlyanon/m.css/releases/download/release-1/mcss.zip "${mcss_SOURCE_DIR}/mcss.zip" + STATUS status EXPECTED_MD5 00cd2757ebafb9bcba7f5d399b3bec7f + ) + if(NOT status MATCHES "^0;") + message(FATAL_ERROR "Download failed with ${status}") + endif() + execute_process( + COMMAND "${CMAKE_COMMAND}" -E tar xf mcss.zip WORKING_DIRECTORY "${mcss_SOURCE_DIR}" RESULT_VARIABLE result + ) + if(NOT result EQUAL "0") + message(FATAL_ERROR "Extraction failed with ${result}") + endif() + file(REMOVE "${mcss_SOURCE_DIR}/mcss.zip") +endif() + +find_program(Python3_EXECUTABLE NAMES python3 python) +if(NOT Python3_EXECUTABLE) + message(FATAL_ERROR "Python executable was not found") +endif() + +# ---- Process project() call in CMakeLists.txt ---- + +file(READ "${src}/CMakeLists.txt" content) + +string(FIND "${content}" "project(" index) +if(index EQUAL "-1") + message(FATAL_ERROR "Could not find \"project(\"") +endif() +string(SUBSTRING "${content}" "${index}" -1 content) + +string(FIND "${content}" "\n)\n" index) +if(index EQUAL "-1") + message(FATAL_ERROR "Could not find \"\\n)\\n\"") +endif() +string(SUBSTRING "${content}" 0 "${index}" content) + +file(WRITE "${bin}/docs-ci.project.cmake" "docs_${content}\n)\n") + +macro(list_pop_front list out) + list(GET "${list}" 0 "${out}") + list(REMOVE_AT "${list}" 0) +endmacro() + +function(docs_project name) + cmake_parse_arguments(PARSE_ARGV 1 "" "" "VERSION;DESCRIPTION;HOMEPAGE_URL" LANGUAGES) + set(PROJECT_NAME "${name}" PARENT_SCOPE) + if(DEFINED _VERSION) + set(PROJECT_VERSION "${_VERSION}" PARENT_SCOPE) + string(REGEX MATCH "^[0-9]+(\\.[0-9]+)*" versions "${_VERSION}") + string(REPLACE . ";" versions "${versions}") + set(suffixes MAJOR MINOR PATCH TWEAK) + while(NOT versions STREQUAL "" AND NOT suffixes STREQUAL "") + list_pop_front(versions version) + list_pop_front(suffixes suffix) + set("PROJECT_VERSION_${suffix}" "${version}" PARENT_SCOPE) + endwhile() + endif() + if(DEFINED _DESCRIPTION) + set(PROJECT_DESCRIPTION "${_DESCRIPTION}" PARENT_SCOPE) + endif() + if(DEFINED _HOMEPAGE_URL) + set(PROJECT_HOMEPAGE_URL "${_HOMEPAGE_URL}" PARENT_SCOPE) + endif() +endfunction() + +include("${bin}/docs-ci.project.cmake") + +# ---- Generate docs ---- + +if(NOT DEFINED DOXYGEN_OUTPUT_DIRECTORY) + set(DOXYGEN_OUTPUT_DIRECTORY "${bin}/docs") +endif() +set(out "${DOXYGEN_OUTPUT_DIRECTORY}") + +foreach(file IN ITEMS Doxyfile conf.py) + configure_file("${src}/docs/${file}.in" "${bin}/docs/${file}" @ONLY) +endforeach() + +set(mcss_script "${mcss_SOURCE_DIR}/documentation/doxygen.py") +set(config "${bin}/docs/conf.py") + +file(REMOVE_RECURSE "${out}/html" "${out}/xml") + +execute_process( + COMMAND "${Python3_EXECUTABLE}" "${mcss_script}" "${config}" WORKING_DIRECTORY "${bin}/docs" RESULT_VARIABLE result +) +if(NOT result EQUAL "0") + message(FATAL_ERROR "m.css returned with ${result}") +endif() diff --git a/asio/cmake/docs.cmake b/asio/cmake/docs.cmake new file mode 100644 index 0000000000..5f41772f87 --- /dev/null +++ b/asio/cmake/docs.cmake @@ -0,0 +1,41 @@ +# ---- Dependencies ---- + +set(extract_timestamps "") +if(CMAKE_VERSION VERSION_GREATER_EQUAL "3.24") + set(extract_timestamps DOWNLOAD_EXTRACT_TIMESTAMP YES) +endif() + +include(FetchContent) +FetchContent_Declare( + mcss + URL https://github.com/friendlyanon/m.css/releases/download/release-1/mcss.zip + URL_MD5 00cd2757ebafb9bcba7f5d399b3bec7f + SOURCE_DIR "${PROJECT_BINARY_DIR}/mcss" + UPDATE_DISCONNECTED YES + ${extract_timestamps} +) +FetchContent_MakeAvailable(mcss) + +find_package(Python3 3.6 REQUIRED) + +# ---- Declare documentation target ---- + +set(DOXYGEN_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/docs" CACHE PATH "Path for the generated Doxygen documentation") + +set(working_dir "${PROJECT_BINARY_DIR}/docs") + +foreach(file IN ITEMS Doxyfile conf.py) + configure_file("docs/${file}.in" "${working_dir}/${file}" @ONLY) +endforeach() + +set(mcss_script "${mcss_SOURCE_DIR}/documentation/doxygen.py") +set(config "${working_dir}/conf.py") + +add_custom_target( + docs + COMMAND "${CMAKE_COMMAND}" -E remove_directory "${DOXYGEN_OUTPUT_DIRECTORY}/html" "${DOXYGEN_OUTPUT_DIRECTORY}/xml" + COMMAND "${Python3_EXECUTABLE}" "${mcss_script}" "${config}" + COMMENT "Building documentation using Doxygen and m.css" + WORKING_DIRECTORY "${working_dir}" + VERBATIM +) diff --git a/asio/cmake/install-rules.cmake b/asio/cmake/install-rules.cmake index 793ffa4685..274ea73a6f 100644 --- a/asio/cmake/install-rules.cmake +++ b/asio/cmake/install-rules.cmake @@ -1,10 +1,12 @@ if(PROJECT_IS_TOP_LEVEL) - set(CMAKE_INSTALL_INCLUDEDIR include CACHE PATH "") + set(CMAKE_INSTALL_INCLUDEDIR "include/asio-${PROJECT_VERSION}" CACHE PATH "") endif() # Project is configured with no languages, so tell GNUInstallDirs the lib dir set(CMAKE_INSTALL_LIBDIR lib CACHE PATH "") +include(cmake/AddUninstallTarget.cmake) + include(CMakePackageConfigHelpers) include(GNUInstallDirs) diff --git a/asio/cmake/variables.cmake b/asio/cmake/variables.cmake index d5d87471bb..1e7fdde342 100644 --- a/asio/cmake/variables.cmake +++ b/asio/cmake/variables.cmake @@ -5,7 +5,7 @@ # Targets necessary to build the project must be provided unconditionally, so # consumers can trivially build and package the project if(PROJECT_IS_TOP_LEVEL) - option(asio_DEVELOPER_MODE "Enable developer mode" ON) + option(asio_DEVELOPER_MODE "Enable developer mode" OFF) endif() # ---- Warning guard ---- diff --git a/asio/docs/Doxyfile.in b/asio/docs/Doxyfile.in new file mode 100644 index 0000000000..dc37a2ab80 --- /dev/null +++ b/asio/docs/Doxyfile.in @@ -0,0 +1,32 @@ +# Configuration for Doxygen for use with CMake +# Only options that deviate from the default are included +# To create a new Doxyfile containing all available options, call `doxygen -g` + +# Get Project name and version from CMake +PROJECT_NAME = "@PROJECT_NAME@" +PROJECT_NUMBER = "@PROJECT_VERSION@" + +# Add sources +INPUT = "@PROJECT_SOURCE_DIR@/README.md" "@PROJECT_SOURCE_DIR@/include" "@PROJECT_SOURCE_DIR@/docs/pages" +EXTRACT_ALL = YES +RECURSIVE = YES +OUTPUT_DIRECTORY = "@DOXYGEN_OUTPUT_DIRECTORY@" + +# Use the README as a main page +USE_MDFILE_AS_MAINPAGE = "@PROJECT_SOURCE_DIR@/README.md" + +# set relative include paths +FULL_PATH_NAMES = YES +STRIP_FROM_PATH = "@PROJECT_SOURCE_DIR@/include" "@PROJECT_SOURCE_DIR@" +STRIP_FROM_INC_PATH = + +# We use m.css to generate the html documentation, so we only need XML output +GENERATE_XML = YES +GENERATE_HTML = NO +GENERATE_LATEX = NO +XML_PROGRAMLISTING = NO +CREATE_SUBDIRS = NO + +# Include all directories, files and namespaces in the documentation +# Disable to include only explicitly documented objects +M_SHOW_UNDOCUMENTED = YES diff --git a/asio/docs/conf.py.in b/asio/docs/conf.py.in new file mode 100644 index 0000000000..b81e3d92a8 --- /dev/null +++ b/asio/docs/conf.py.in @@ -0,0 +1,6 @@ +DOXYFILE = 'Doxyfile' + +LINKS_NAVBAR1 = [ + (None, 'pages', [(None, 'about')]), + (None, 'namespaces', []), +] diff --git a/asio/docs/pages/about.dox b/asio/docs/pages/about.dox new file mode 100644 index 0000000000..2efbda9369 --- /dev/null +++ b/asio/docs/pages/about.dox @@ -0,0 +1,7 @@ +/** + * @page about About + * @section about-doxygen Doxygen documentation + * This page is auto generated using + * Doxygen, making use of some useful + * special commands. + */ diff --git a/asio/requirements.txt b/asio/requirements.txt new file mode 100644 index 0000000000..ef73240407 --- /dev/null +++ b/asio/requirements.txt @@ -0,0 +1,13 @@ +# +# usage: pip install -U -r requirements.txt +# +Pygments +cmake-init>=0.40.5 +cmake>=3.28.4 +cmakelint>=1.4.2 +codespell>=2.2.6 +gcovr>=7.2 +jinja2>=3.1.3 +ninja>=1.11.1 +yamllint +builddriver From a863ad536f76e7ddd3aacd2af728b3a27a8cd7ef Mon Sep 17 00:00:00 2001 From: ClausKlein Date: Tue, 26 Mar 2024 19:25:55 +0100 Subject: [PATCH 03/13] Add CMake Workflow Presets Update used tools versions on CI build --- .github/workflows/cmake.yml | 22 ++++++++---------- asio/CMakePresets.json | 25 ++++++++++++++++---- asio/CMakeUserPresets.json | 46 +++++++++++++++++++++++++++++++++++-- asio/GNUmakefile | 8 +++---- 4 files changed, 78 insertions(+), 23 deletions(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index acb6eadcf0..fad49a53a6 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -5,7 +5,7 @@ on: branches: - master - develop - - feature/* + # - feature/* pull_request: branches: @@ -19,7 +19,7 @@ jobs: - uses: actions/checkout@v4 - uses: actions/setup-python@v5 - with: {python-version: "3.8"} + with: {python-version: "3.10"} - name: Install codespell run: pip3 install codespell @@ -27,7 +27,7 @@ jobs: - name: Lint if: always() working-directory: asio - run: cmake -D FORMAT_COMMAND=clang-format-14 -P cmake/lint.cmake || echo ignored + run: cmake -D FORMAT_COMMAND=clang-format-15 -P cmake/lint.cmake || echo ignored - name: Spell check if: always() @@ -43,8 +43,7 @@ jobs: # edit the "" placeholder to your GitHub name. # If you do not wish to use codecov, then simply delete this job from the # workflow. - if: github.repository_owner == '' - && false + if: github.repository_owner == 'ClausKlein' steps: - uses: actions/checkout@v4 @@ -70,7 +69,7 @@ jobs: run: cmake --build build/coverage -t coverage - name: Submit to codecov.io - uses: codecov/codecov-action@v3 + uses: codecov/codecov-action@v4 with: file: build/coverage/coverage.info @@ -79,7 +78,7 @@ jobs: runs-on: ubuntu-22.04 - env: {CXX: clang++-14} + env: {CXX: clang++-15} steps: - uses: actions/checkout@v4 @@ -118,11 +117,11 @@ jobs: - name: Install static analyzers if: matrix.os == 'ubuntu-22.04' run: >- - sudo apt-get install clang-tidy-14 cppcheck -y -q + sudo apt-get install clang-tidy-15 cppcheck -y -q sudo update-alternatives --install /usr/bin/clang-tidy clang-tidy - /usr/bin/clang-tidy-14 140 + /usr/bin/clang-tidy-15 150 - name: Setup MultiToolTask if: matrix.os == 'windows-2022' @@ -166,14 +165,13 @@ jobs: # simply delete this job similarly to the coverage one. if: github.ref == 'refs/heads/master' && github.event_name == 'push' - && github.repository_owner == '' - && false + && github.repository_owner == 'ClausKlein' steps: - uses: actions/checkout@v4 - uses: actions/setup-python@v5 - with: {python-version: "3.8"} + with: {python-version: "3.10"} - name: Install m.css dependencies run: pip3 install jinja2 Pygments diff --git a/asio/CMakePresets.json b/asio/CMakePresets.json index 3378487632..b3183bfc2f 100644 --- a/asio/CMakePresets.json +++ b/asio/CMakePresets.json @@ -1,8 +1,8 @@ { - "version": 2, + "version": 3, "cmakeMinimumRequired": { "major": 3, - "minor": 14, + "minor": 21, "patch": 0 }, "configurePresets": [ @@ -59,11 +59,16 @@ "hidden": true, "cacheVariables": { "CMAKE_CXX_FLAGS": - "-U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3 -fstack-protector-strong -fcf-protection=full -fstack-clash-protection -Wall -Wextra -Wpedantic -Wconversion -Wsign-conversion -Wcast-qual -Wformat=2 -Wundef -Werror=float-equal -Wshadow -Wcast-align -Wunused -Wnull-dereference -Wdouble-promotion -Wimplicit-fallthrough -Wextra-semi -Woverloaded-virtual -Wnon-virtual-dtor -Wold-style-cast", + "-U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3 -fstack-protector-strong -fcf-protection=full -fstack-clash-protection -Wall -Wextra -Wpedantic -Wno-conversion -Wno-sign-conversion -Wcast-qual -Wformat=2 -Wundef -Werror=float-equal -Wshadow -Wcast-align -Wunused -Wnull-dereference -Wdouble-promotion -Wimplicit-fallthrough -Wextra-semi -Woverloaded-virtual -Wnon-virtual-dtor -Wold-style-cast", "CMAKE_EXE_LINKER_FLAGS": "-Wl,--allow-shlib-undefined,--as-needed,-z,noexecstack,-z,relro,-z,now", "CMAKE_SHARED_LINKER_FLAGS": "-Wl,--allow-shlib-undefined,--as-needed,-z,noexecstack,-z,relro,-z,now" + }, + "condition": { + "type": "equals", + "lhs": "${hostSystemName}", + "rhs": "Linux" } }, { @@ -71,7 +76,12 @@ "hidden": true, "cacheVariables": { "CMAKE_CXX_FLAGS": - "-fstack-protector-strong -fcf-protection=full -Wall -Wextra -Wpedantic -Wconversion -Wsign-conversion -Wcast-qual -Wformat=2 -Wundef -Werror=float-equal -Wshadow -Wcast-align -Wunused -Wnull-dereference -Wdouble-promotion -Wimplicit-fallthrough -Wextra-semi -Woverloaded-virtual -Wnon-virtual-dtor -Wold-style-cast" + "-fstack-protector-strong -fcf-protection=full -Wall -Wextra -Wpedantic -Wno-conversion -Wno-sign-conversion -Wcast-qual -Wformat=2 -Wundef -Werror=float-equal -Wshadow -Wcast-align -Wunused -Wnull-dereference -Wdouble-promotion -Wimplicit-fallthrough -Wextra-semi -Woverloaded-virtual -Wnon-virtual-dtor -Wold-style-cast" + }, + "condition": { + "type": "equals", + "lhs": "${hostSystemName}", + "rhs": "Darwin" } }, { @@ -83,6 +93,11 @@ "CMAKE_CXX_FLAGS": "/sdl /guard:cf /utf-8 /diagnostics:caret /w14165 /w44242 /w44254 /w44263 /w34265 /w34287 /w44296 /w44365 /w44388 /w44464 /w14545 /w14546 /w14547 /w14549 /w14555 /w34619 /w34640 /w24826 /w14905 /w14906 /w14928 /w45038 /W4 /permissive- /volatile:iso /Zc:inline /Zc:preprocessor /Zc:enumTypes /Zc:lambda /Zc:__cplusplus /Zc:externConstexpr /Zc:throwingNew /EHsc", "CMAKE_EXE_LINKER_FLAGS": "/machine:x64 /guard:cf" + }, + "condition": { + "type": "equals", + "lhs": "${hostSystemName}", + "rhs": "Windows" } }, { @@ -127,6 +142,7 @@ "cacheVariables": { "ENABLE_COVERAGE": "ON", "CMAKE_BUILD_TYPE": "Coverage", + "CMAKE_CONFIGURATION_TYPES": "Coverage;Release;Debug", "CMAKE_CXX_FLAGS_COVERAGE": "-Og -g --coverage -fkeep-inline-functions -fkeep-static-functions", "CMAKE_EXE_LINKER_FLAGS_COVERAGE": "--coverage", @@ -152,6 +168,7 @@ ], "cacheVariables": { "CMAKE_BUILD_TYPE": "Sanitize", + "CMAKE_CONFIGURATION_TYPES": "Sanitize;Release;Debug", "CMAKE_CXX_FLAGS_SANITIZE": "-O2 -g -fsanitize=address,undefined -fno-omit-frame-pointer -fno-common" } diff --git a/asio/CMakeUserPresets.json b/asio/CMakeUserPresets.json index 3c74e1aa5e..8346551d8c 100644 --- a/asio/CMakeUserPresets.json +++ b/asio/CMakeUserPresets.json @@ -1,8 +1,8 @@ { - "version": 2, + "version": 6, "cmakeMinimumRequired": { "major": 3, - "minor": 14, + "minor": 25, "patch": 0 }, "configurePresets": [ @@ -73,6 +73,12 @@ "configurePreset": "dev", "configuration": "Debug", "jobs": 12 + }, + { + "name": "verify", + "configurePreset": "dev", + "jobs": 12, + "targets": ["all_verify_interface_header_sets"] } ], "testPresets": [ @@ -88,5 +94,41 @@ "noTestsAction": "error" } } + ], + "packagePresets": [ + { + "name": "dev", + "configurePreset": "dev", + "generators": [ + "TGZ" + ] + } + ], + "workflowPresets": [ + { + "name": "dev", + "steps": [ + { + "type": "configure", + "name": "dev" + }, + { + "type": "build", + "name": "dev" + }, + { + "type": "build", + "name": "verify" + }, + { + "type": "test", + "name": "dev" + }, + { + "type": "package", + "name": "dev" + } + ] + } ] } diff --git a/asio/GNUmakefile b/asio/GNUmakefile index 1b22c6d958..ffaade7f38 100644 --- a/asio/GNUmakefile +++ b/asio/GNUmakefile @@ -1,16 +1,14 @@ .PHONY: all check clean all: .init - cmake --preset dev - cmake --build --preset dev - ninja -C build/dev all_verify_interface_header_sets + cmake --workflow --preset dev check: ninja -C build/dev spell-check ninja -C build/dev format-check .init: requirements.txt - pip3 install -U -r requirements.txt + -pip3 install --user --upgrade -r requirements.txt touch .init clean: - ninja -C build/dev clean + rm -rf build From 6686f3c46f91f51241256927e3a16adfd3a44058 Mon Sep 17 00:00:00 2001 From: ClausKlein Date: Tue, 26 Mar 2024 21:28:44 +0100 Subject: [PATCH 04/13] Use clang-tidy with CI sanitize preset --- asio/CMakePresets.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/asio/CMakePresets.json b/asio/CMakePresets.json index b3183bfc2f..5687d5baee 100644 --- a/asio/CMakePresets.json +++ b/asio/CMakePresets.json @@ -40,7 +40,7 @@ "name": "clang-tidy", "hidden": true, "cacheVariables": { - "CMAKE_CXX_CLANG_TIDY": "clang-tidy;--header-filter=^${sourceDir}/" + "CMAKE_CXX_CLANG_TIDY": "clang-tidy-15;--header-filter=^${sourceDir}/" } }, { @@ -50,7 +50,7 @@ "hidden": true, "cacheVariables": { "CMAKE_CXX_EXTENSIONS": "OFF", - "CMAKE_CXX_STANDARD": "20", + "CMAKE_CXX_STANDARD": "17", "CMAKE_CXX_STANDARD_REQUIRED": "ON" } }, @@ -164,6 +164,7 @@ "binaryDir": "${sourceDir}/build/sanitize", "inherits": [ "ci-linux", + "clang-tidy", "dev-mode" ], "cacheVariables": { From 57b73d7fa2c8905582fd450bb36c7f5067878053 Mon Sep 17 00:00:00 2001 From: Claus Klein Date: Wed, 27 Mar 2024 15:18:21 +0100 Subject: [PATCH 05/13] Suppress more clang-17 warnings --- asio/.clang-tidy | 2 ++ asio/CMakePresets.json | 4 ++-- asio/CMakeUserPresets.json | 2 +- asio/GNUmakefile | 5 +++-- asio/include/asio/impl/io_context.ipp | 4 +++- 5 files changed, 11 insertions(+), 6 deletions(-) diff --git a/asio/.clang-tidy b/asio/.clang-tidy index b6fef8689c..5840726ebc 100644 --- a/asio/.clang-tidy +++ b/asio/.clang-tidy @@ -12,6 +12,8 @@ Checks: "*,\ -llvmlibc-*,\ -cppcoreguidelines-pro-bounds-pointer-arithmetic,\ -*-magic-numbers,\ + -misc-include-cleaner,\ + -misc-header-include-cycle,\ -misc-non-private-member-variables-in-classes" WarningsAsErrors: '' CheckOptions: diff --git a/asio/CMakePresets.json b/asio/CMakePresets.json index 5687d5baee..845f9309e8 100644 --- a/asio/CMakePresets.json +++ b/asio/CMakePresets.json @@ -59,7 +59,7 @@ "hidden": true, "cacheVariables": { "CMAKE_CXX_FLAGS": - "-U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3 -fstack-protector-strong -fcf-protection=full -fstack-clash-protection -Wall -Wextra -Wpedantic -Wno-conversion -Wno-sign-conversion -Wcast-qual -Wformat=2 -Wundef -Werror=float-equal -Wshadow -Wcast-align -Wunused -Wnull-dereference -Wdouble-promotion -Wimplicit-fallthrough -Wextra-semi -Woverloaded-virtual -Wnon-virtual-dtor -Wold-style-cast", + "-U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3 -fstack-protector-strong -fcf-protection=full -fstack-clash-protection -Wall -Wextra -Wpedantic -Wno-conversion -Wno-sign-conversion -Wcast-qual -Wformat=2 -Wundef -Werror=float-equal -Wshadow -Wcast-align -Wunused -Wnull-dereference -Wdouble-promotion -Wimplicit-fallthrough -Wextra-semi -Woverloaded-virtual -Wnon-virtual-dtor -Wno-old-style-cast", "CMAKE_EXE_LINKER_FLAGS": "-Wl,--allow-shlib-undefined,--as-needed,-z,noexecstack,-z,relro,-z,now", "CMAKE_SHARED_LINKER_FLAGS": @@ -76,7 +76,7 @@ "hidden": true, "cacheVariables": { "CMAKE_CXX_FLAGS": - "-fstack-protector-strong -fcf-protection=full -Wall -Wextra -Wpedantic -Wno-conversion -Wno-sign-conversion -Wcast-qual -Wformat=2 -Wundef -Werror=float-equal -Wshadow -Wcast-align -Wunused -Wnull-dereference -Wdouble-promotion -Wimplicit-fallthrough -Wextra-semi -Woverloaded-virtual -Wnon-virtual-dtor -Wold-style-cast" + "-fstack-protector-strong -fcf-protection=full -Wall -Wextra -Wpedantic -Wno-conversion -Wno-sign-conversion -Wcast-qual -Wformat=2 -Wundef -Werror=float-equal -Wshadow -Wcast-align -Wunused -Wnull-dereference -Wdouble-promotion -Wimplicit-fallthrough -Wextra-semi -Woverloaded-virtual -Wnon-virtual-dtor -Wno-old-style-cast" }, "condition": { "type": "equals", diff --git a/asio/CMakeUserPresets.json b/asio/CMakeUserPresets.json index 8346551d8c..747e309c2e 100644 --- a/asio/CMakeUserPresets.json +++ b/asio/CMakeUserPresets.json @@ -56,7 +56,7 @@ { "name": "dev", "binaryDir": "${sourceDir}/build/dev", - "inherits": "dev-darwin" + "inherits": "dev-linux" }, { "name": "dev-coverage", diff --git a/asio/GNUmakefile b/asio/GNUmakefile index ffaade7f38..163c4cb70c 100644 --- a/asio/GNUmakefile +++ b/asio/GNUmakefile @@ -3,8 +3,9 @@ all: .init cmake --workflow --preset dev check: - ninja -C build/dev spell-check - ninja -C build/dev format-check + run-clang-tidy -p build/dev -checks='-*,misc-header-*' src/tests + # ninja -C build/dev spell-check + # ninja -C build/dev format-check .init: requirements.txt -pip3 install --user --upgrade -r requirements.txt diff --git a/asio/include/asio/impl/io_context.ipp b/asio/include/asio/impl/io_context.ipp index 586c3552f9..53ae66434a 100644 --- a/asio/include/asio/impl/io_context.ipp +++ b/asio/include/asio/impl/io_context.ipp @@ -16,7 +16,9 @@ #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include "asio/detail/config.hpp" -#include "asio/io_context.hpp" + +// warning: circular header file dependency detected while including 'io_context.hpp', please check the include path [misc-header-include-cycle] +// XXX #include "asio/io_context.hpp" #include "asio/detail/concurrency_hint.hpp" #include "asio/detail/limits.hpp" #include "asio/detail/scoped_ptr.hpp" From e67a6370ae1aec286ae6717c07a6b9c8574e935a Mon Sep 17 00:00:00 2001 From: Claus Klein Date: Wed, 27 Mar 2024 19:35:24 +0100 Subject: [PATCH 06/13] Add ASIO_SEPARATE_COMPILATION option --- asio/.clang-tidy | 2 ++ asio/CMakeLists.txt | 48 ++++++++++++++++++++++++--------- asio/CMakeUserPresets.json | 2 +- asio/GNUmakefile | 9 ++++++- asio/cmake/install-config.cmake | 1 + asio/cmake/install-rules.cmake | 17 +++++++++--- asio/src/tests/CMakeLists.txt | 9 ++++--- 7 files changed, 67 insertions(+), 21 deletions(-) diff --git a/asio/.clang-tidy b/asio/.clang-tidy index 5840726ebc..ba7f6ba84c 100644 --- a/asio/.clang-tidy +++ b/asio/.clang-tidy @@ -11,7 +11,9 @@ Checks: "*,\ -llvm-include-order,\ -llvmlibc-*,\ -cppcoreguidelines-pro-bounds-pointer-arithmetic,\ + -cppcoreguidelines-avoid-do-while,\ -*-magic-numbers,\ + -performance-avoid-endl, -misc-include-cleaner,\ -misc-header-include-cycle,\ -misc-non-private-member-variables-in-classes" diff --git a/asio/CMakeLists.txt b/asio/CMakeLists.txt index 08b224beb0..3cea83eedb 100644 --- a/asio/CMakeLists.txt +++ b/asio/CMakeLists.txt @@ -13,7 +13,7 @@ include(cmake/project-is-top-level.cmake) include(cmake/variables.cmake) if(PROJECT_IS_TOP_LEVEL) - set(CMAKE_VERIFY_INTERFACE_HEADER_SETS ON) + option(CMAKE_VERIFY_INTERFACE_HEADER_SETS "FIXME: some header in include/asio/detail fails!" OFF) include(CheckCXXSymbolExists) check_cxx_symbol_exists(snprintf cstdio ASIO_HAS_SNPRINTF) check_cxx_symbol_exists(sprintf_s cstdio ASIO_HAS_SECURE_RTL) @@ -23,32 +23,56 @@ endif() file(GLOB_RECURSE headers "include/asio/*.hpp") list(FILTER headers EXCLUDE REGEX [=[.*/experimental/.*\.hpp]=]) -list(FILTER headers EXCLUDE REGEX [=[.*/(detail|ssl|impl)/.*\.hpp]=]) list(FILTER headers EXCLUDE REGEX [=[.*/ssl\.hpp]=]) -# foreach(header in LISTS ${headers}) -# message(STATUS "${header}") +set(public_headers ${headers}) +list(FILTER public_headers EXCLUDE REGEX [=[.*/impl/.*\.hpp]=]) + +# foreach(header in LISTS ${public_headers}) +# message(INFO "${header}") # endforeach() file(GLOB_RECURSE implementation "include/asio/*/*.hpp" "include/asio/*.ipp") +list(FILTER implementation EXCLUDE REGEX [=[.*/experimental/.*]=]) -add_library(asio INTERFACE ${implementation}) -add_library(asio::asio ALIAS asio) +add_library(asio_header INTERFACE ${implementation}) +add_library(asio::asio_header ALIAS asio_header) -target_sources(asio INTERFACE FILE_SET HEADERS BASE_DIRS include FILES ${headers}) +target_sources(asio_header INTERFACE FILE_SET HEADERS BASE_DIRS include FILES ${implementation}) -target_compile_definitions(asio INTERFACE ASIO_NO_DEPRECATED) +set(CPPdefinitions ASIO_NO_DEPRECATED) if(ASIO_HAS_SECURE_RTL) - target_compile_definitions(asio INTERFACE ASIO_HAS_SECURE_RTL) + list(APPEND CPPdefinitions ASIO_HAS_SECURE_RTL) elseif(ASIO_HAS_SNPRINTF) - target_compile_definitions(asio INTERFACE ASIO_HAS_SNPRINTF) + list(APPEND CPPdefinitions ASIO_HAS_SNPRINTF) endif() -target_compile_features(asio INTERFACE cxx_std_17) +target_compile_definitions(asio_header INTERFACE ${CPPdefinitions}) +target_compile_features(asio_header INTERFACE cxx_std_17) # ---- add dependenc libraries ---- find_package(Threads REQUIRED) -target_link_libraries(asio INTERFACE Threads::Threads) +target_link_libraries(asio_header INTERFACE Threads::Threads) + +option(ASIO_SEPARATE_COMPILATION "build asio lib too" ${PROJECT_IS_TOP_LEVEL}) +if(ASIO_SEPARATE_COMPILATION) + find_package(OpenSSL) + set(libasio_SOURCES src/asio.cpp) + if(OpenSSL_FOUND) + set(libasio_SOURCES ${libasio_SOURCES} src/asio_ssl.cpp) + endif() + + add_library(asio ${libasio_SOURCES}) + add_library(asio::asio ALIAS asio) + target_sources(asio PUBLIC FILE_SET public_headers TYPE HEADERS BASE_DIRS include FILES ${public_headers}) + + target_compile_definitions(asio PUBLIC ASIO_SEPARATE_COMPILATION ${CPPdefinitions}) + target_link_libraries(asio PUBLIC Threads::Threads) + target_compile_features(asio INTERFACE cxx_std_17) + if(OpenSSL_FOUND) + target_link_libraries(asio PUBLIC OpenSSL::SSL) + endif() +endif() # ---- Install rules ---- diff --git a/asio/CMakeUserPresets.json b/asio/CMakeUserPresets.json index 747e309c2e..5e5500a6fe 100644 --- a/asio/CMakeUserPresets.json +++ b/asio/CMakeUserPresets.json @@ -118,7 +118,7 @@ }, { "type": "build", - "name": "verify" + "name": "dev" }, { "type": "test", diff --git a/asio/GNUmakefile b/asio/GNUmakefile index 163c4cb70c..e057d7e9e5 100644 --- a/asio/GNUmakefile +++ b/asio/GNUmakefile @@ -1,4 +1,4 @@ -.PHONY: all check clean +.PHONY: all check test clean all: .init cmake --workflow --preset dev @@ -7,6 +7,13 @@ check: # ninja -C build/dev spell-check # ninja -C build/dev format-check +test: + cmake --preset ci-ubuntu + DESTDIR=$(CURDIR)/stagedir cmake --build build --target install + cmake -G Ninja -B build/tests -S src/tests -D CMAKE_PREFIX_PATH=$(CURDIR)/stagedir/usr/local + cmake --build build/tests + ctest --test-dir build/tests + .init: requirements.txt -pip3 install --user --upgrade -r requirements.txt touch .init diff --git a/asio/cmake/install-config.cmake b/asio/cmake/install-config.cmake index a770b2caff..cd46e3ee16 100644 --- a/asio/cmake/install-config.cmake +++ b/asio/cmake/install-config.cmake @@ -1,4 +1,5 @@ include(CMakeFindDependencyMacro) find_dependency(Threads) +find_dependency(OpenSSL) include("${CMAKE_CURRENT_LIST_DIR}/asioTargets.cmake") diff --git a/asio/cmake/install-rules.cmake b/asio/cmake/install-rules.cmake index 274ea73a6f..cc3ccb3e7b 100644 --- a/asio/cmake/install-rules.cmake +++ b/asio/cmake/install-rules.cmake @@ -13,11 +13,22 @@ include(GNUInstallDirs) # find_package() call for consumers to find this project set(package asio) -install(DIRECTORY include/ DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}" COMPONENT asio_Development) +#NO! install(DIRECTORY include/ DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}" COMPONENT asio_Development) -install(TARGETS asio EXPORT asioTargets INCLUDES DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}" - FILE_SET HEADERS # NOTE: requierd from CMake to install the FILE_SET HEADERS again! +install(TARGETS asio_header + EXPORT asioTargets + INCLUDES + DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}" + FILE_SET HEADERS ) +if(TARGET asio) + install(TARGETS asio + EXPORT asioTargets + INCLUDES + DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}" + FILE_SET public_headers + ) +endif() write_basic_package_version_file("${package}ConfigVersion.cmake" COMPATIBILITY SameMajorVersion ARCH_INDEPENDENT) diff --git a/asio/src/tests/CMakeLists.txt b/asio/src/tests/CMakeLists.txt index 23b3476e2a..a03d946818 100644 --- a/asio/src/tests/CMakeLists.txt +++ b/asio/src/tests/CMakeLists.txt @@ -17,13 +17,14 @@ endif() add_executable(asio_test unit/read_until.cpp) -target_link_libraries(asio_test PRIVATE asio::asio) -target_compile_features(asio_test PRIVATE cxx_std_17) +if(TARGET asio::asio) + target_link_libraries(asio_test PRIVATE asio::asio) +else() + target_link_libraries(asio_test PRIVATE asio::asio_header) +endif() # ---- Setup strict Compiler Warnings ---- -include(../../cmake/WarningsAsErrors.cmake OPTIONAL) - add_test(NAME asio_test COMMAND asio_test) # ---- End-of-file commands ---- From d46d88cba4352f9f74c51ec32065d06b8244b7fa Mon Sep 17 00:00:00 2001 From: ClausKlein Date: Wed, 27 Mar 2024 23:06:23 +0100 Subject: [PATCH 07/13] Check only public interface header, no details --- asio/CMakeLists.txt | 28 +++++++++++++++------------- asio/CMakePresets.json | 6 +++--- asio/CMakeUserPresets.json | 2 +- asio/GNUmakefile | 2 +- asio/src/tests/CMakeLists.txt | 2 +- asio/src/tests/unit/read_until.cpp | 4 ++++ 6 files changed, 25 insertions(+), 19 deletions(-) diff --git a/asio/CMakeLists.txt b/asio/CMakeLists.txt index 3cea83eedb..ef0df5d851 100644 --- a/asio/CMakeLists.txt +++ b/asio/CMakeLists.txt @@ -13,7 +13,6 @@ include(cmake/project-is-top-level.cmake) include(cmake/variables.cmake) if(PROJECT_IS_TOP_LEVEL) - option(CMAKE_VERIFY_INTERFACE_HEADER_SETS "FIXME: some header in include/asio/detail fails!" OFF) include(CheckCXXSymbolExists) check_cxx_symbol_exists(snprintf cstdio ASIO_HAS_SNPRINTF) check_cxx_symbol_exists(sprintf_s cstdio ASIO_HAS_SECURE_RTL) @@ -21,17 +20,6 @@ endif() # ---- Declare library ---- -file(GLOB_RECURSE headers "include/asio/*.hpp") -list(FILTER headers EXCLUDE REGEX [=[.*/experimental/.*\.hpp]=]) -list(FILTER headers EXCLUDE REGEX [=[.*/ssl\.hpp]=]) - -set(public_headers ${headers}) -list(FILTER public_headers EXCLUDE REGEX [=[.*/impl/.*\.hpp]=]) - -# foreach(header in LISTS ${public_headers}) -# message(INFO "${header}") -# endforeach() - file(GLOB_RECURSE implementation "include/asio/*/*.hpp" "include/asio/*.ipp") list(FILTER implementation EXCLUDE REGEX [=[.*/experimental/.*]=]) @@ -49,7 +37,7 @@ endif() target_compile_definitions(asio_header INTERFACE ${CPPdefinitions}) target_compile_features(asio_header INTERFACE cxx_std_17) -# ---- add dependenc libraries ---- +# ---- add dependency libraries ---- find_package(Threads REQUIRED) target_link_libraries(asio_header INTERFACE Threads::Threads) @@ -62,6 +50,20 @@ if(ASIO_SEPARATE_COMPILATION) set(libasio_SOURCES ${libasio_SOURCES} src/asio_ssl.cpp) endif() + set(CMAKE_VERIFY_INTERFACE_HEADER_SETS ${PROJECT_IS_TOP_LEVEL}) + + file(GLOB_RECURSE headers "include/asio/*.hpp") + list(FILTER headers EXCLUDE REGEX [=[.*/experimental/.*\.hpp]=]) + list(FILTER headers EXCLUDE REGEX [=[.*/ssl\.hpp]=]) + + # FIXME: some header in include/asio/detail fails CMAKE_VERIFY_INTERFACE_HEADER_SETS! + set(public_headers ${headers}) + list(FILTER public_headers EXCLUDE REGEX [=[.*/detail/.*\.hpp]=]) + list(FILTER public_headers EXCLUDE REGEX [=[.*/impl/.*\.hpp]=]) + # foreach(header in LISTS ${public_headers}) + # message(INFO "${header}") + # endforeach() + add_library(asio ${libasio_SOURCES}) add_library(asio::asio ALIAS asio) target_sources(asio PUBLIC FILE_SET public_headers TYPE HEADERS BASE_DIRS include FILES ${public_headers}) diff --git a/asio/CMakePresets.json b/asio/CMakePresets.json index 845f9309e8..1d5f8adf79 100644 --- a/asio/CMakePresets.json +++ b/asio/CMakePresets.json @@ -1,8 +1,8 @@ { - "version": 3, + "version": 4, "cmakeMinimumRequired": { "major": 3, - "minor": 21, + "minor": 23, "patch": 0 }, "configurePresets": [ @@ -76,7 +76,7 @@ "hidden": true, "cacheVariables": { "CMAKE_CXX_FLAGS": - "-fstack-protector-strong -fcf-protection=full -Wall -Wextra -Wpedantic -Wno-conversion -Wno-sign-conversion -Wcast-qual -Wformat=2 -Wundef -Werror=float-equal -Wshadow -Wcast-align -Wunused -Wnull-dereference -Wdouble-promotion -Wimplicit-fallthrough -Wextra-semi -Woverloaded-virtual -Wnon-virtual-dtor -Wno-old-style-cast" + "-fstack-protector-strong -fcf-protection=full -Wall -Wextra -Wpedantic -Wno-conversion -Wno-sign-conversion -Wcast-qual -Wformat=2 -Wno-undef -Werror=float-equal -Wshadow -Wcast-align -Wunused -Wnull-dereference -Wdouble-promotion -Wno-implicit-fallthrough -Wextra-semi -Woverloaded-virtual -Wnon-virtual-dtor -Wno-old-style-cast" }, "condition": { "type": "equals", diff --git a/asio/CMakeUserPresets.json b/asio/CMakeUserPresets.json index 5e5500a6fe..e0759ca817 100644 --- a/asio/CMakeUserPresets.json +++ b/asio/CMakeUserPresets.json @@ -56,7 +56,7 @@ { "name": "dev", "binaryDir": "${sourceDir}/build/dev", - "inherits": "dev-linux" + "inherits": "dev-darwin" }, { "name": "dev-coverage", diff --git a/asio/GNUmakefile b/asio/GNUmakefile index e057d7e9e5..234e662d28 100644 --- a/asio/GNUmakefile +++ b/asio/GNUmakefile @@ -8,7 +8,7 @@ check: # ninja -C build/dev format-check test: - cmake --preset ci-ubuntu + cmake --preset ci-macos DESTDIR=$(CURDIR)/stagedir cmake --build build --target install cmake -G Ninja -B build/tests -S src/tests -D CMAKE_PREFIX_PATH=$(CURDIR)/stagedir/usr/local cmake --build build/tests diff --git a/asio/src/tests/CMakeLists.txt b/asio/src/tests/CMakeLists.txt index a03d946818..112402121d 100644 --- a/asio/src/tests/CMakeLists.txt +++ b/asio/src/tests/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.21...3.29) +cmake_minimum_required(VERSION 3.23...3.29) project(asio_test LANGUAGES CXX) diff --git a/asio/src/tests/unit/read_until.cpp b/asio/src/tests/unit/read_until.cpp index 64282f39cc..36b7f04f52 100644 --- a/asio/src/tests/unit/read_until.cpp +++ b/asio/src/tests/unit/read_until.cpp @@ -96,6 +96,8 @@ class test_stream size_t next_read_length_; }; +// NOLINTBEGIN + static const char read_data[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; @@ -1627,3 +1629,5 @@ ASIO_TEST_SUITE ASIO_TEST_CASE(test_dynamic_string_async_read_until_match_condition) ASIO_TEST_CASE(test_streambuf_async_read_until_match_condition) ) + +// NOLINTEND From 46d06645a189be8712667990394d761f3c199833 Mon Sep 17 00:00:00 2001 From: Claus Klein Date: Thu, 28 Mar 2024 14:51:10 +0100 Subject: [PATCH 08/13] Use hostSystemName for presets --- asio/CMakeLists.txt | 30 +++++++++++++---------- asio/CMakePresets.json | 44 ++++++++++++++++++++-------------- asio/CMakeUserPresets.json | 24 +++++++++---------- asio/GNUmakefile | 12 +++++++--- asio/cmake/install-rules.cmake | 16 ++++--------- 5 files changed, 68 insertions(+), 58 deletions(-) diff --git a/asio/CMakeLists.txt b/asio/CMakeLists.txt index ef0df5d851..f4fc0e557d 100644 --- a/asio/CMakeLists.txt +++ b/asio/CMakeLists.txt @@ -18,34 +18,36 @@ if(PROJECT_IS_TOP_LEVEL) check_cxx_symbol_exists(sprintf_s cstdio ASIO_HAS_SECURE_RTL) endif() -# ---- Declare library ---- - -file(GLOB_RECURSE implementation "include/asio/*/*.hpp" "include/asio/*.ipp") -list(FILTER implementation EXCLUDE REGEX [=[.*/experimental/.*]=]) - -add_library(asio_header INTERFACE ${implementation}) -add_library(asio::asio_header ALIAS asio_header) - -target_sources(asio_header INTERFACE FILE_SET HEADERS BASE_DIRS include FILES ${implementation}) - set(CPPdefinitions ASIO_NO_DEPRECATED) if(ASIO_HAS_SECURE_RTL) list(APPEND CPPdefinitions ASIO_HAS_SECURE_RTL) elseif(ASIO_HAS_SNPRINTF) list(APPEND CPPdefinitions ASIO_HAS_SNPRINTF) endif() -target_compile_definitions(asio_header INTERFACE ${CPPdefinitions}) -target_compile_features(asio_header INTERFACE cxx_std_17) + +option(ASIO_SEPARATE_COMPILATION "build asio lib too" ${PROJECT_IS_TOP_LEVEL}) # ---- add dependency libraries ---- find_package(Threads REQUIRED) + +# ---- Declare library ---- + +file(GLOB_RECURSE implementation "include/asio/*/*.hpp" "include/asio/*.ipp") +list(FILTER implementation EXCLUDE REGEX [=[.*/experimental/.*]=]) + +add_library(asio_header INTERFACE) +add_library(asio::asio_header ALIAS asio_header) +target_sources(asio_header INTERFACE FILE_SET HEADERS BASE_DIRS include FILES ${implementation}) + +target_compile_definitions(asio_header INTERFACE ${CPPdefinitions}) +target_compile_features(asio_header INTERFACE cxx_std_17) target_link_libraries(asio_header INTERFACE Threads::Threads) -option(ASIO_SEPARATE_COMPILATION "build asio lib too" ${PROJECT_IS_TOP_LEVEL}) if(ASIO_SEPARATE_COMPILATION) find_package(OpenSSL) set(libasio_SOURCES src/asio.cpp) + if(OpenSSL_FOUND) set(libasio_SOURCES ${libasio_SOURCES} src/asio_ssl.cpp) endif() @@ -57,6 +59,7 @@ if(ASIO_SEPARATE_COMPILATION) list(FILTER headers EXCLUDE REGEX [=[.*/ssl\.hpp]=]) # FIXME: some header in include/asio/detail fails CMAKE_VERIFY_INTERFACE_HEADER_SETS! + # NOTE: we need them installed, but we used them install with asio_header INTERFACE! CK set(public_headers ${headers}) list(FILTER public_headers EXCLUDE REGEX [=[.*/detail/.*\.hpp]=]) list(FILTER public_headers EXCLUDE REGEX [=[.*/impl/.*\.hpp]=]) @@ -71,6 +74,7 @@ if(ASIO_SEPARATE_COMPILATION) target_compile_definitions(asio PUBLIC ASIO_SEPARATE_COMPILATION ${CPPdefinitions}) target_link_libraries(asio PUBLIC Threads::Threads) target_compile_features(asio INTERFACE cxx_std_17) + if(OpenSSL_FOUND) target_link_libraries(asio PUBLIC OpenSSL::SSL) endif() diff --git a/asio/CMakePresets.json b/asio/CMakePresets.json index 1d5f8adf79..b542a574a2 100644 --- a/asio/CMakePresets.json +++ b/asio/CMakePresets.json @@ -55,7 +55,7 @@ } }, { - "name": "flags-linux", + "name": "flags-Linux", "hidden": true, "cacheVariables": { "CMAKE_CXX_FLAGS": @@ -72,7 +72,7 @@ } }, { - "name": "flags-darwin", + "name": "flags-Darwin", "hidden": true, "cacheVariables": { "CMAKE_CXX_FLAGS": @@ -85,7 +85,7 @@ } }, { - "name": "flags-windows", + "name": "flags-Windows", "description": "Note that all the flags after /W4 are required for MSVC to conform to the language standard", "hidden": true, @@ -101,11 +101,11 @@ } }, { - "name": "ci-linux", + "name": "gen-Linux", "generator": "Unix Makefiles", "hidden": true, "inherits": [ - "flags-linux", + "flags-Linux", "ci-std" ], "cacheVariables": { @@ -113,11 +113,11 @@ } }, { - "name": "ci-darwin", + "name": "gen-Darwin", "generator": "Unix Makefiles", "hidden": true, "inherits": [ - "flags-darwin", + "flags-Darwin", "ci-std" ], "cacheVariables": { @@ -125,9 +125,9 @@ } }, { - "name": "ci-win64", + "name": "gen-win64", "inherits": [ - "flags-windows", + "flags-Windows", "ci-std" ], "generator": "Visual Studio 17 2022", @@ -135,9 +135,9 @@ "hidden": true }, { - "name": "coverage-linux", + "name": "coverage-Linux", "binaryDir": "${sourceDir}/build/coverage", - "inherits": "ci-linux", + "inherits": "gen-Linux", "hidden": true, "cacheVariables": { "ENABLE_COVERAGE": "ON", @@ -152,7 +152,7 @@ { "name": "ci-coverage", "inherits": [ - "coverage-linux", + "coverage-Linux", "dev-mode" ], "cacheVariables": { @@ -163,7 +163,7 @@ "name": "ci-sanitize", "binaryDir": "${sourceDir}/build/sanitize", "inherits": [ - "ci-linux", + "gen-Linux", "clang-tidy", "dev-mode" ], @@ -180,26 +180,34 @@ "hidden": true }, { - "name": "ci-macos", + "name": "ci-Darwin", "inherits": [ "ci-build", - "ci-darwin", + "gen-Darwin", "dev-mode" ] }, { - "name": "ci-ubuntu", + "name": "ci-macos", + "inherits": "ci-Darwin" + }, + { + "name": "ci-Linux", "inherits": [ "ci-build", - "ci-linux", + "gen-Linux", "dev-mode" ] }, + { + "name": "ci-ubuntu", + "inherits": "ci-Linux" + }, { "name": "ci-windows", "inherits": [ "ci-build", - "ci-win64", + "gen-win64", "dev-mode" ] } diff --git a/asio/CMakeUserPresets.json b/asio/CMakeUserPresets.json index e0759ca817..1edd3e3934 100644 --- a/asio/CMakeUserPresets.json +++ b/asio/CMakeUserPresets.json @@ -18,11 +18,11 @@ } }, { - "name": "dev-linux", - "binaryDir": "${sourceDir}/build/dev-linux", + "name": "dev-Linux", + "binaryDir": "${sourceDir}/build/${presetName}", "inherits": [ "dev-common", - "ci-linux" + "ci-Linux" ], "cacheVariables": { "CMAKE_BUILD_TYPE": "Debug", @@ -30,11 +30,11 @@ } }, { - "name": "dev-darwin", - "binaryDir": "${sourceDir}/build/dev-darwin", + "name": "dev-Darwin", + "binaryDir": "${sourceDir}/build/${presetName}", "inherits": [ "dev-common", - "ci-darwin" + "ci-Darwin" ], "cacheVariables": { "CMAKE_BUILD_TYPE": "Debug", @@ -42,11 +42,11 @@ } }, { - "name": "dev-win64", - "binaryDir": "${sourceDir}/build/dev-win64", + "name": "dev-Windows", + "binaryDir": "${sourceDir}/build/${presetName}", "inherits": [ "dev-common", - "ci-win64" + "ci-windows" ], "environment": { "UseMultiToolTask": "true", @@ -56,14 +56,14 @@ { "name": "dev", "binaryDir": "${sourceDir}/build/dev", - "inherits": "dev-darwin" + "inherits": "dev-" }, { "name": "dev-coverage", "binaryDir": "${sourceDir}/build/coverage", "inherits": [ "dev-mode", - "coverage-linux" + "coverage-Linux" ] } ], @@ -118,7 +118,7 @@ }, { "type": "build", - "name": "dev" + "name": "verify" }, { "type": "test", diff --git a/asio/GNUmakefile b/asio/GNUmakefile index 234e662d28..4336b985c4 100644 --- a/asio/GNUmakefile +++ b/asio/GNUmakefile @@ -1,4 +1,6 @@ -.PHONY: all check test clean +export hostSystemName=$(shell uname) + +.PHONY: all check test clean distclean all: .init cmake --workflow --preset dev @@ -8,15 +10,19 @@ check: # ninja -C build/dev format-check test: - cmake --preset ci-macos + cmake --preset ci-${hostSystemName} DESTDIR=$(CURDIR)/stagedir cmake --build build --target install cmake -G Ninja -B build/tests -S src/tests -D CMAKE_PREFIX_PATH=$(CURDIR)/stagedir/usr/local cmake --build build/tests ctest --test-dir build/tests -.init: requirements.txt +.init: requirements.txt CMakeUserPresets.json + perl -p -i.bak -e 's//${hostSystemName}/;' CMakeUserPresets.json -pip3 install --user --upgrade -r requirements.txt touch .init clean: rm -rf build + +distclean: clean + rm -rf stagedir .init tags *.bak diff --git a/asio/cmake/install-rules.cmake b/asio/cmake/install-rules.cmake index cc3ccb3e7b..3973c7558d 100644 --- a/asio/cmake/install-rules.cmake +++ b/asio/cmake/install-rules.cmake @@ -15,19 +15,11 @@ set(package asio) #NO! install(DIRECTORY include/ DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}" COMPONENT asio_Development) -install(TARGETS asio_header - EXPORT asioTargets - INCLUDES - DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}" - FILE_SET HEADERS -) +if(TARGET asio_header) + install(TARGETS asio_header EXPORT asioTargets FILE_SET HEADERS) +endif() if(TARGET asio) - install(TARGETS asio - EXPORT asioTargets - INCLUDES - DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}" - FILE_SET public_headers - ) + install(TARGETS asio EXPORT asioTargets FILE_SET public_headers) endif() write_basic_package_version_file("${package}ConfigVersion.cmake" COMPATIBILITY SameMajorVersion ARCH_INDEPENDENT) From e8aba4183827f84d0dd3a5dfda41e8f95a892815 Mon Sep 17 00:00:00 2001 From: ClausKlein Date: Fri, 29 Mar 2024 13:58:14 +0100 Subject: [PATCH 09/13] Update GNUmakefile and *.md files --- ...serPresets.json => .CMakeUserPresets.json} | 0 asio/.gitignore | 11 +--- asio/BUILDING.md | 39 ++++++++---- asio/CODE_OF_CONDUCT.md | 5 ++ asio/CONTRIBUTING.md | 19 ++++++ asio/GNUmakefile | 21 ++++++- asio/HACKING.md | 59 ++++++++++++++++++- asio/README.md | 19 ++++++ 8 files changed, 147 insertions(+), 26 deletions(-) rename asio/{CMakeUserPresets.json => .CMakeUserPresets.json} (100%) create mode 100644 asio/CODE_OF_CONDUCT.md create mode 100644 asio/CONTRIBUTING.md create mode 100644 asio/README.md diff --git a/asio/CMakeUserPresets.json b/asio/.CMakeUserPresets.json similarity index 100% rename from asio/CMakeUserPresets.json rename to asio/.CMakeUserPresets.json diff --git a/asio/.gitignore b/asio/.gitignore index 06ec6f2a0b..edd3b240c7 100644 --- a/asio/.gitignore +++ b/asio/.gitignore @@ -23,20 +23,15 @@ test-driver /*.cpp /*.hpp ### cmake-init generated: -# include/asio/asio.hpp .git .github/ .idea/ .vs/ .vscode/ +.init build/ -cmake/open-cpp-coverage.cmake cmake-build-*/ +stagedir/ prefix/ CMakeLists.txt.user -# CMakeUserPresets.json -# BUILDING.md -CODE_OF_CONDUCT.md -CONTRIBUTING.md -# HACKING.md -README.md +CMakeUserPresets.json diff --git a/asio/BUILDING.md b/asio/BUILDING.md index 150d31f7ac..c93a304070 100644 --- a/asio/BUILDING.md +++ b/asio/BUILDING.md @@ -1,12 +1,5 @@ # Building with CMake -## CMake files are generated with [cmake-init][3] - -```sh -pip install cmake-init -cmake-init --no-cppcheck --overwrite -h . -``` - ## Build This project doesn't require any special command-line flags to build to keep @@ -28,14 +21,26 @@ cmake -S . -B build cmake --build build --config Release ``` +### Building with MSVC + +Note that MSVC by default is not standards compliant and you need to pass some +flags to make it behave properly. See the `flags-windows` preset in the +[CMakePresets.json](CMakePresets.json) file for the flags and with what +variable to provide them to CMake during configuration. + +### Building on Apple Silicon + +CMake supports building on Apple Silicon properly since 3.20.1. Make sure you +have the [latest version][1] installed. + ## Install This project doesn't require any special command-line flags to install to keep things simple. As a prerequisite, the project has to be built with the above commands already. -The below commands require at least **CMake 3.15** to run, because that is the -version in which [Install a Project][1] was added. +The below commands require at least CMake 3.15 to run, because that is the +version in which [Install a Project][2] was added. Here is the command for installing the release mode artifacts with a single-configuration generator, like the Unix Makefiles one: @@ -53,7 +58,7 @@ cmake --install build --config Release ### CMake package -This project exports a CMake package to be used with the [`find_package`][2] +This project exports a CMake package to be used with the [`find_package`][3] command of CMake: * Package name: `asio` @@ -71,6 +76,14 @@ target_link_libraries( ) ``` -[1]: https://cmake.org/cmake/help/latest/manual/cmake.1.html#install-a-project -[2]: https://cmake.org/cmake/help/latest/command/find_package.html -[3]: https://github.com/friendlyanon/cmake-init +### Note to packagers + +The `CMAKE_INSTALL_INCLUDEDIR` is set to a path other than just `include` if +the project is configured as a top level project to avoid indirectly including +other libraries when installed to a common prefix. Please review the +[install-rules.cmake](cmake/install-rules.cmake) file for the full set of +install rules. + +[1]: https://cmake.org/download/ +[2]: https://cmake.org/cmake/help/latest/manual/cmake.1.html#install-a-project +[3]: https://cmake.org/cmake/help/latest/command/find_package.html diff --git a/asio/CODE_OF_CONDUCT.md b/asio/CODE_OF_CONDUCT.md new file mode 100644 index 0000000000..d1202311b8 --- /dev/null +++ b/asio/CODE_OF_CONDUCT.md @@ -0,0 +1,5 @@ +# Code of Conduct + +* You will be judged by your contributions first, and your sense of humor + second. +* Nobody owes you anything. diff --git a/asio/CONTRIBUTING.md b/asio/CONTRIBUTING.md new file mode 100644 index 0000000000..10cccf381c --- /dev/null +++ b/asio/CONTRIBUTING.md @@ -0,0 +1,19 @@ +# Contributing + + + +## Code of Conduct + +Please see the [`CODE_OF_CONDUCT.md`](CODE_OF_CONDUCT.md) document. + +## Getting started + +Helpful notes for developers can be found in the [`HACKING.md`](HACKING.md) +document. + +In addition to he above, if you use the presets file as instructed, then you +should NOT check it into source control, just as the CMake documentation +suggests. diff --git a/asio/GNUmakefile b/asio/GNUmakefile index 4336b985c4..5be38566b6 100644 --- a/asio/GNUmakefile +++ b/asio/GNUmakefile @@ -1,3 +1,11 @@ +# Standard stuff + +.SUFFIXES: +$(VERBOSE).SILENT: + +MAKEFLAGS+= --no-builtin-rules +MAKEFLAGS+= --warn-undefined-variables + export hostSystemName=$(shell uname) .PHONY: all check test clean distclean @@ -16,8 +24,8 @@ test: cmake --build build/tests ctest --test-dir build/tests -.init: requirements.txt CMakeUserPresets.json - perl -p -i.bak -e 's//${hostSystemName}/;' CMakeUserPresets.json +.init: requirements.txt .CMakeUserPresets.json + perl -p -e 's//${hostSystemName}/;' .CMakeUserPresets.json > CMakeUserPresets.json -pip3 install --user --upgrade -r requirements.txt touch .init @@ -26,3 +34,12 @@ clean: distclean: clean rm -rf stagedir .init tags *.bak + +GNUmakefile :: ; +*.txt :: ; +*.json :: ; + +# Anything we don't know how to build will use this rule. +# The command is a do-nothing command. +# +% :: ; diff --git a/asio/HACKING.md b/asio/HACKING.md index 1911b3fcf6..553503b8e3 100644 --- a/asio/HACKING.md +++ b/asio/HACKING.md @@ -68,13 +68,25 @@ the project: ``` You should replace `` in your newly created presets file with the name of -the operating system you have, which may be `win64` or `unix`. You can see what -these correspond to in the [`CMakePresets.json`](CMakePresets.json) file. +the operating system you have, which may be `win64`, `linux` or `darwin`. You +can see what these correspond to in the +[`CMakePresets.json`](CMakePresets.json) file. `CMakeUserPresets.json` is also the perfect place in which you can put all sorts of things that you would otherwise want to pass to the configure command in the terminal. +> **Note** +> Some editors are pretty greedy with how they open projects with presets. +> Some just randomly pick a preset and start configuring without your consent, +> which can be confusing. Make sure that your editor configures when you +> actually want it to, for example in CLion you have to make sure only the +> `dev-dev preset` has `Enable profile` ticked in +> `File > Settings... > Build, Execution, Deployment > CMake` and in Visual +> Studio you have to set the option `Never run configure step automatically` +> in `Tools > Options > CMake` **prior to opening the project**, after which +> you can manually configure using `Project > Configure Cache`. + ### Configure, build and test If you followed the above instructions, then you can configure, build and test @@ -87,10 +99,51 @@ cmake --build --preset=dev ctest --preset=dev ``` -Please note that both the build and test command accepts a `-j` flag to specify +If you are using a compatible editor (e.g. VSCode) or IDE (e.g. CLion, VS), you +will also be able to select the above created user presets for automatic +integration. + +Please note that both the build and test commands accept a `-j` flag to specify the number of jobs to use, which should ideally be specified to the number of threads your CPU has. You may also want to add that to your preset using the `jobs` property, see the [presets documentation][1] for more details. +### Developer mode targets + +These are targets you may invoke using the build command from above, with an +additional `-t ` flag: + +#### `coverage` + +Available if `ENABLE_COVERAGE` is enabled. This target processes the output of +the previously run tests when built with coverage configuration. The commands +this target runs can be found in the `COVERAGE_TRACE_COMMAND` and +`COVERAGE_HTML_COMMAND` cache variables. The trace command produces an info +file by default, which can be submitted to services with CI integration. The +HTML command uses the trace command's output to generate an HTML document to +`/coverage_html` by default. + +#### `docs` + +Available if `BUILD_MCSS_DOCS` is enabled. Builds to documentation using +Doxygen and m.css. The output will go to `/docs` by default +(customizable using `DOXYGEN_OUTPUT_DIRECTORY`). + +#### `format-check` and `format-fix` + +These targets run the clang-format tool on the codebase to check errors and to +fix them respectively. Customization available using the `FORMAT_PATTERNS` and +`FORMAT_COMMAND` cache variables. + +#### `run-examples` + +Runs all the examples created by the `add_example` command. + +#### `spell-check` and `spell-fix` + +These targets run the codespell tool on the codebase to check errors and to fix +them respectively. Customization available using the `SPELL_COMMAND` cache +variable. + [1]: https://cmake.org/cmake/help/latest/manual/cmake-presets.7.html [2]: https://cmake.org/download/ diff --git a/asio/README.md b/asio/README.md new file mode 100644 index 0000000000..3e38f02fd0 --- /dev/null +++ b/asio/README.md @@ -0,0 +1,19 @@ +# asio + +This is the asio project. + +# Building and installing + +See the [BUILDING](BUILDING.md) document. + +# Contributing + +See the [CONTRIBUTING](CONTRIBUTING.md) document. + +# Licensing + + From de22c6182fdf6f7f4bd60a9869096ed09f7f2ec6 Mon Sep 17 00:00:00 2001 From: Claus Klein Date: Thu, 4 Apr 2024 15:50:30 +0200 Subject: [PATCH 10/13] Fix some clang-tidy warnings --- asio/.gitignore | 3 +++ asio/GNUmakefile | 6 +++++- .../asio/detail/base_from_completion_cond.hpp | 1 + asio/include/asio/detail/config.hpp | 4 ++-- .../asio/detail/reactive_socket_send_op.hpp | 1 + asio/src/tests/unit/read_until.cpp | 14 ++++++++------ 6 files changed, 20 insertions(+), 9 deletions(-) diff --git a/asio/.gitignore b/asio/.gitignore index edd3b240c7..1843c2c225 100644 --- a/asio/.gitignore +++ b/asio/.gitignore @@ -35,3 +35,6 @@ stagedir/ prefix/ CMakeLists.txt.user CMakeUserPresets.json +tags +*.swp +*.bak diff --git a/asio/GNUmakefile b/asio/GNUmakefile index 5be38566b6..ed791b4f18 100644 --- a/asio/GNUmakefile +++ b/asio/GNUmakefile @@ -13,7 +13,11 @@ all: .init cmake --workflow --preset dev check: - run-clang-tidy -p build/dev -checks='-*,misc-header-*' src/tests + -iwyu_tool -p build/dev \ + build/dev/asio_verify_interface_header_sets/asio/basic_readable_pipe.hpp.cxx \ + build/dev/asio_verify_interface_header_sets/asio/detail/reactive_socket_send_op.hpp.cxx \ + -- -Xiwyu --cxx17ns #XXX -Xiwyu --transitive_includes_only + run-clang-tidy -p build/dev -checks='-*,misc-header-*,misc-include-*' src/tests # ninja -C build/dev spell-check # ninja -C build/dev format-check diff --git a/asio/include/asio/detail/base_from_completion_cond.hpp b/asio/include/asio/detail/base_from_completion_cond.hpp index d7589e4697..2a3e1fb6a7 100644 --- a/asio/include/asio/detail/base_from_completion_cond.hpp +++ b/asio/include/asio/detail/base_from_completion_cond.hpp @@ -17,6 +17,7 @@ #include "asio/detail/config.hpp" #include "asio/completion_condition.hpp" +#include "asio/error_code.hpp" #include "asio/detail/push_options.hpp" diff --git a/asio/include/asio/detail/config.hpp b/asio/include/asio/detail/config.hpp index ad3be582c9..72b25cff83 100644 --- a/asio/include/asio/detail/config.hpp +++ b/asio/include/asio/detail/config.hpp @@ -1314,13 +1314,13 @@ # if __has_include() # define ASIO_HAS_CO_AWAIT 1 # endif // __has_include() -# elif (__cplusplus >= 201703) && (__cpp_coroutines >= 201703) +# elif (__cplusplus >= 201703) && defined(__cpp_coroutines) && (__cpp_coroutines >= 201703) # if __has_include() # define ASIO_HAS_CO_AWAIT 1 # endif // __has_include() # endif // (__cplusplus >= 201703) && (__cpp_coroutines >= 201703) # else // (__clang_major__ >= 14) -# if (__cplusplus >= 201703) && (__cpp_coroutines >= 201703) +# if (__cplusplus >= 201703) && defined(__cpp_coroutines)&& (__cpp_coroutines >= 201703) # if __has_include() # define ASIO_HAS_CO_AWAIT 1 # endif // __has_include() diff --git a/asio/include/asio/detail/reactive_socket_send_op.hpp b/asio/include/asio/detail/reactive_socket_send_op.hpp index 5a88cff015..63c4f7ad7c 100644 --- a/asio/include/asio/detail/reactive_socket_send_op.hpp +++ b/asio/include/asio/detail/reactive_socket_send_op.hpp @@ -24,6 +24,7 @@ #include "asio/detail/memory.hpp" #include "asio/detail/reactor_op.hpp" #include "asio/detail/socket_ops.hpp" +#include "asio/socket_base.hpp" #include "asio/detail/push_options.hpp" diff --git a/asio/src/tests/unit/read_until.cpp b/asio/src/tests/unit/read_until.cpp index 36b7f04f52..e606b21c55 100644 --- a/asio/src/tests/unit/read_until.cpp +++ b/asio/src/tests/unit/read_until.cpp @@ -16,8 +16,10 @@ // Test that header file is self-contained. #include "asio/read_until.hpp" -#include -#include +#include // for memcpy +#include // for _Bind_helper<>::type, bind +#include "asio/error_code.hpp" // for error_code +#include "asio/buffer.hpp" // for is_dynamic_buffer_v2 #include "archetypes/async_result.hpp" #include "asio/io_context.hpp" #include "asio/post.hpp" @@ -80,7 +82,7 @@ class test_stream template void async_read_some(const Mutable_Buffers& buffers, Handler handler) { - size_t bytes_transferred = read_some(buffers); + const size_t bytes_transferred = read_some(buffers); asio::post(get_executor(), asio::detail::bind_handler( static_cast(handler), @@ -91,9 +93,9 @@ class test_stream asio::io_context& io_context_; enum { max_length = 8192 }; char data_[max_length]; - size_t length_; - size_t position_; - size_t next_read_length_; + size_t length_{0}; + size_t position_{0}; + size_t next_read_length_{0}; }; // NOLINTBEGIN From 00c61ff65f6e4007b4f06d93187b80e77f7bc593 Mon Sep 17 00:00:00 2001 From: ClausKlein Date: Sat, 6 Apr 2024 19:00:51 +0200 Subject: [PATCH 11/13] Modernize GNUmakefile --- asio/GNUmakefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/asio/GNUmakefile b/asio/GNUmakefile index ed791b4f18..8885692bc8 100644 --- a/asio/GNUmakefile +++ b/asio/GNUmakefile @@ -23,7 +23,8 @@ check: test: cmake --preset ci-${hostSystemName} - DESTDIR=$(CURDIR)/stagedir cmake --build build --target install + cmake --build build + cmake --install build --prefix $(CURDIR)/stagedir cmake -G Ninja -B build/tests -S src/tests -D CMAKE_PREFIX_PATH=$(CURDIR)/stagedir/usr/local cmake --build build/tests ctest --test-dir build/tests From f326cc85638a195ba0f647f479536e076d9a1549 Mon Sep 17 00:00:00 2001 From: ClausKlein Date: Thu, 28 Nov 2024 18:40:03 +0100 Subject: [PATCH 12/13] Disable openssl files for now --- asio/.cmakefiles.txt | 38 ++++++++++++++++++++++++++++++++++++++ asio/CMakeLists.txt | 6 ++++-- asio/GNUmakefile | 2 +- asio/requirements.txt | 3 ++- 4 files changed, 45 insertions(+), 4 deletions(-) create mode 100644 asio/.cmakefiles.txt diff --git a/asio/.cmakefiles.txt b/asio/.cmakefiles.txt new file mode 100644 index 0000000000..ff4912cac6 --- /dev/null +++ b/asio/.cmakefiles.txt @@ -0,0 +1,38 @@ +#!/bin/sh +# +# git ls-files '::*.md' '::*.cmake' '::*CMakeLists.txt' '::*.json' '::*.cmake.in' +# +files=' +GNUMakefile +requirements.txt +.cmakefiles.txt +.TODO.txt +.CMakeUserPresets.json +BUILDING.md +CMakeLists.txt +CMakePresets.json +CODE_OF_CONDUCT.md +CONTRIBUTING.md +HACKING.md +README.md +asio.pc.cmake +cmake/AddUninstallTarget.cmake +cmake/coverage.cmake +cmake/dev-mode.cmake +cmake/docs-ci.cmake +cmake/docs.cmake +cmake/folders.cmake +cmake/install-config.cmake +cmake/install-rules.cmake +cmake/lint-targets.cmake +cmake/lint.cmake +cmake/prelude.cmake +cmake/project-is-top-level.cmake +cmake/spell-targets.cmake +cmake/spell.cmake +cmake/variables.cmake +cmake/windows-set-path.cmake +src/tests/CMakeLists.txt +' + +tar czvf .cmakefiles.tgz ${files} diff --git a/asio/CMakeLists.txt b/asio/CMakeLists.txt index f4fc0e557d..9cb9e87f33 100644 --- a/asio/CMakeLists.txt +++ b/asio/CMakeLists.txt @@ -45,11 +45,11 @@ target_compile_features(asio_header INTERFACE cxx_std_17) target_link_libraries(asio_header INTERFACE Threads::Threads) if(ASIO_SEPARATE_COMPILATION) - find_package(OpenSSL) + #XXX find_package(OpenSSL) set(libasio_SOURCES src/asio.cpp) if(OpenSSL_FOUND) - set(libasio_SOURCES ${libasio_SOURCES} src/asio_ssl.cpp) + #XXX set(libasio_SOURCES ${libasio_SOURCES} src/asio_ssl.cpp) endif() set(CMAKE_VERIFY_INTERFACE_HEADER_SETS ${PROJECT_IS_TOP_LEVEL}) @@ -57,12 +57,14 @@ if(ASIO_SEPARATE_COMPILATION) file(GLOB_RECURSE headers "include/asio/*.hpp") list(FILTER headers EXCLUDE REGEX [=[.*/experimental/.*\.hpp]=]) list(FILTER headers EXCLUDE REGEX [=[.*/ssl\.hpp]=]) + list(FILTER headers EXCLUDE REGEX [=[.*/ssl/\.*]=]) # FIXME: some header in include/asio/detail fails CMAKE_VERIFY_INTERFACE_HEADER_SETS! # NOTE: we need them installed, but we used them install with asio_header INTERFACE! CK set(public_headers ${headers}) list(FILTER public_headers EXCLUDE REGEX [=[.*/detail/.*\.hpp]=]) list(FILTER public_headers EXCLUDE REGEX [=[.*/impl/.*\.hpp]=]) + list(FILTER public_headers EXCLUDE REGEX [=[.*/ssl/\.*]=]) # foreach(header in LISTS ${public_headers}) # message(INFO "${header}") # endforeach() diff --git a/asio/GNUmakefile b/asio/GNUmakefile index 8885692bc8..261d188c7d 100644 --- a/asio/GNUmakefile +++ b/asio/GNUmakefile @@ -10,7 +10,7 @@ export hostSystemName=$(shell uname) .PHONY: all check test clean distclean all: .init - cmake --workflow --preset dev + cmake --workflow --preset dev --fresh check: -iwyu_tool -p build/dev \ diff --git a/asio/requirements.txt b/asio/requirements.txt index ef73240407..3d13e0dd7b 100644 --- a/asio/requirements.txt +++ b/asio/requirements.txt @@ -1,7 +1,8 @@ # -# usage: pip install -U -r requirements.txt +# usage: pip install --user --upgrade -r requirements.txt # Pygments +PyYAML cmake-init>=0.40.5 cmake>=3.28.4 cmakelint>=1.4.2 From c4bad8a36d67a06aaf337f84e7e0192a7edf53cb Mon Sep 17 00:00:00 2001 From: ClausKlein Date: Thu, 28 Nov 2024 18:47:53 +0100 Subject: [PATCH 13/13] update --- asio/.cmakefiles.txt | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/asio/.cmakefiles.txt b/asio/.cmakefiles.txt index ff4912cac6..a954372d4e 100644 --- a/asio/.cmakefiles.txt +++ b/asio/.cmakefiles.txt @@ -3,11 +3,17 @@ # git ls-files '::*.md' '::*.cmake' '::*CMakeLists.txt' '::*.json' '::*.cmake.in' # files=' +.CMakeUserPresets.json +.TODO.txt +.clang-format +.clang-tidy +.cmake-format +.cmakefiles.txt +.codespellrc +.gitignore GNUMakefile +docs requirements.txt -.cmakefiles.txt -.TODO.txt -.CMakeUserPresets.json BUILDING.md CMakeLists.txt CMakePresets.json