diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml new file mode 100644 index 0000000000..fad49a53a6 --- /dev/null +++ b/.github/workflows/cmake.yml @@ -0,0 +1,192 @@ +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.10"} + + - name: Install codespell + run: pip3 install codespell + + - name: Lint + if: always() + working-directory: asio + run: cmake -D FORMAT_COMMAND=clang-format-15 -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 == 'ClausKlein' + + 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@v4 + with: + file: build/coverage/coverage.info + + sanitize: + needs: [lint] + + runs-on: ubuntu-22.04 + + env: {CXX: clang++-15} + + 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-15 cppcheck -y -q + + sudo update-alternatives --install + /usr/bin/clang-tidy clang-tidy + /usr/bin/clang-tidy-15 150 + + - 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 == 'ClausKlein' + + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-python@v5 + with: {python-version: "3.10"} + + - 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/.CMakeUserPresets.json b/asio/.CMakeUserPresets.json new file mode 100644 index 0000000000..1edd3e3934 --- /dev/null +++ b/asio/.CMakeUserPresets.json @@ -0,0 +1,134 @@ +{ + "version": 6, + "cmakeMinimumRequired": { + "major": 3, + "minor": 25, + "patch": 0 + }, + "configurePresets": [ + { + "name": "dev-common", + "hidden": true, + "generator": "Ninja", + "inherits": [ + "dev-mode" + ], + "cacheVariables": { + "BUILD_MCSS_DOCS": "ON" + } + }, + { + "name": "dev-Linux", + "binaryDir": "${sourceDir}/build/${presetName}", + "inherits": [ + "dev-common", + "ci-Linux" + ], + "cacheVariables": { + "CMAKE_BUILD_TYPE": "Debug", + "CMAKE_EXPORT_COMPILE_COMMANDS": "ON" + } + }, + { + "name": "dev-Darwin", + "binaryDir": "${sourceDir}/build/${presetName}", + "inherits": [ + "dev-common", + "ci-Darwin" + ], + "cacheVariables": { + "CMAKE_BUILD_TYPE": "Debug", + "CMAKE_EXPORT_COMPILE_COMMANDS": "ON" + } + }, + { + "name": "dev-Windows", + "binaryDir": "${sourceDir}/build/${presetName}", + "inherits": [ + "dev-common", + "ci-windows" + ], + "environment": { + "UseMultiToolTask": "true", + "EnforceProcessCountAcrossBuilds": "true" + } + }, + { + "name": "dev", + "binaryDir": "${sourceDir}/build/dev", + "inherits": "dev-" + }, + { + "name": "dev-coverage", + "binaryDir": "${sourceDir}/build/coverage", + "inherits": [ + "dev-mode", + "coverage-Linux" + ] + } + ], + "buildPresets": [ + { + "name": "dev", + "configurePreset": "dev", + "configuration": "Debug", + "jobs": 12 + }, + { + "name": "verify", + "configurePreset": "dev", + "jobs": 12, + "targets": ["all_verify_interface_header_sets"] + } + ], + "testPresets": [ + { + "name": "dev", + "configurePreset": "dev", + "configuration": "Debug", + "output": { + "outputOnFailure": true + }, + "execution": { + "jobs": 12, + "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/.TODO.txt b/asio/.TODO.txt new file mode 100644 index 0000000000..571f32b427 --- /dev/null +++ b/asio/.TODO.txt @@ -0,0 +1,91 @@ +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/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/execution/any_executor.hpp:112: requre ==> require +./include/asio/execution/impl/bad_executor.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 +./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/.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..ba7f6ba84c --- /dev/null +++ b/asio/.clang-tidy @@ -0,0 +1,166 @@ +--- +# 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,\ + -cppcoreguidelines-avoid-do-while,\ + -*-magic-numbers,\ + -performance-avoid-endl, + -misc-include-cleaner,\ + -misc-header-include-cycle,\ + -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/.cmakefiles.txt b/asio/.cmakefiles.txt new file mode 100644 index 0000000000..a954372d4e --- /dev/null +++ b/asio/.cmakefiles.txt @@ -0,0 +1,44 @@ +#!/bin/sh +# +# 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 +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/.codespellrc b/asio/.codespellrc new file mode 100644 index 0000000000..5c562c4cf2 --- /dev/null +++ b/asio/.codespellrc @@ -0,0 +1,7 @@ +[codespell] +builtin = clear,rare,names,informal,code +check-filenames = +check-hidden = +skip = */.git,*/build,*/prefix,*/stage,.TODO.txt +quiet-level = 2 +ignore-words-list = tim,deque,endcode,keep-alives,nmake diff --git a/asio/.gitignore b/asio/.gitignore index 39252178ea..1843c2c225 100644 --- a/asio/.gitignore +++ b/asio/.gitignore @@ -22,3 +22,19 @@ test-driver *.zip /*.cpp /*.hpp +### cmake-init generated: +.git +.github/ +.idea/ +.vs/ +.vscode/ +.init +build/ +cmake-build-*/ +stagedir/ +prefix/ +CMakeLists.txt.user +CMakeUserPresets.json +tags +*.swp +*.bak diff --git a/asio/BUILDING.md b/asio/BUILDING.md new file mode 100644 index 0000000000..c93a304070 --- /dev/null +++ b/asio/BUILDING.md @@ -0,0 +1,89 @@ +# Building with CMake + +## 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 +``` + +### 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][2] 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`][3] +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 +) +``` + +### 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/CMakeLists.txt b/asio/CMakeLists.txt new file mode 100644 index 0000000000..9cb9e87f33 --- /dev/null +++ b/asio/CMakeLists.txt @@ -0,0 +1,101 @@ +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) + include(CheckCXXSymbolExists) + check_cxx_symbol_exists(snprintf cstdio ASIO_HAS_SNPRINTF) + check_cxx_symbol_exists(sprintf_s cstdio ASIO_HAS_SECURE_RTL) +endif() + +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() + +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) + +if(ASIO_SEPARATE_COMPILATION) + #XXX find_package(OpenSSL) + set(libasio_SOURCES src/asio.cpp) + + if(OpenSSL_FOUND) + #XXX 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]=]) + 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() + + 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 ---- + +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..b542a574a2 --- /dev/null +++ b/asio/CMakePresets.json @@ -0,0 +1,215 @@ +{ + "version": 4, + "cmakeMinimumRequired": { + "major": 3, + "minor": 23, + "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-15;--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-Linux", + "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 -Wno-old-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" + } + }, + { + "name": "flags-Darwin", + "hidden": true, + "cacheVariables": { + "CMAKE_CXX_FLAGS": + "-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", + "lhs": "${hostSystemName}", + "rhs": "Darwin" + } + }, + { + "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": + "/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" + } + }, + { + "name": "gen-Linux", + "generator": "Unix Makefiles", + "hidden": true, + "inherits": [ + "flags-Linux", + "ci-std" + ], + "cacheVariables": { + "CMAKE_BUILD_TYPE": "Release" + } + }, + { + "name": "gen-Darwin", + "generator": "Unix Makefiles", + "hidden": true, + "inherits": [ + "flags-Darwin", + "ci-std" + ], + "cacheVariables": { + "CMAKE_BUILD_TYPE": "Release" + } + }, + { + "name": "gen-win64", + "inherits": [ + "flags-Windows", + "ci-std" + ], + "generator": "Visual Studio 17 2022", + "architecture": "x64", + "hidden": true + }, + { + "name": "coverage-Linux", + "binaryDir": "${sourceDir}/build/coverage", + "inherits": "gen-Linux", + "hidden": true, + "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", + "CMAKE_SHARED_LINKER_FLAGS_COVERAGE": "--coverage" + } + }, + { + "name": "ci-coverage", + "inherits": [ + "coverage-Linux", + "dev-mode" + ], + "cacheVariables": { + "COVERAGE_HTML_COMMAND": "" + } + }, + { + "name": "ci-sanitize", + "binaryDir": "${sourceDir}/build/sanitize", + "inherits": [ + "gen-Linux", + "clang-tidy", + "dev-mode" + ], + "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" + } + }, + { + "name": "ci-build", + "binaryDir": "${sourceDir}/build", + "hidden": true + }, + { + "name": "ci-Darwin", + "inherits": [ + "ci-build", + "gen-Darwin", + "dev-mode" + ] + }, + { + "name": "ci-macos", + "inherits": "ci-Darwin" + }, + { + "name": "ci-Linux", + "inherits": [ + "ci-build", + "gen-Linux", + "dev-mode" + ] + }, + { + "name": "ci-ubuntu", + "inherits": "ci-Linux" + }, + { + "name": "ci-windows", + "inherits": [ + "ci-build", + "gen-win64", + "dev-mode" + ] + } + ] +} 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 new file mode 100644 index 0000000000..261d188c7d --- /dev/null +++ b/asio/GNUmakefile @@ -0,0 +1,50 @@ +# Standard stuff + +.SUFFIXES: +$(VERBOSE).SILENT: + +MAKEFLAGS+= --no-builtin-rules +MAKEFLAGS+= --warn-undefined-variables + +export hostSystemName=$(shell uname) + +.PHONY: all check test clean distclean +all: .init + cmake --workflow --preset dev --fresh + +check: + -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 + +test: + cmake --preset ci-${hostSystemName} + 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 + +.init: requirements.txt .CMakeUserPresets.json + perl -p -e 's//${hostSystemName}/;' .CMakeUserPresets.json > CMakeUserPresets.json + -pip3 install --user --upgrade -r requirements.txt + touch .init + +clean: + rm -rf build + +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 new file mode 100644 index 0000000000..553503b8e3 --- /dev/null +++ b/asio/HACKING.md @@ -0,0 +1,149 @@ +# 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`, `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 +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 +``` + +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 + + 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/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/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..94f0c353eb --- /dev/null +++ b/asio/cmake/dev-mode.cmake @@ -0,0 +1,22 @@ +include(cmake/folders.cmake) + +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() + +include(cmake/lint-targets.cmake) +include(cmake/spell-targets.cmake) + +add_folders(Project) 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/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..cd46e3ee16 --- /dev/null +++ b/asio/cmake/install-config.cmake @@ -0,0 +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 new file mode 100644 index 0000000000..3973c7558d --- /dev/null +++ b/asio/cmake/install-rules.cmake @@ -0,0 +1,46 @@ +if(PROJECT_IS_TOP_LEVEL) + 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) + +# find_package() call for consumers to find this project +set(package asio) + +#NO! install(DIRECTORY include/ DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}" COMPONENT asio_Development) + +if(TARGET asio_header) + install(TARGETS asio_header EXPORT asioTargets FILE_SET HEADERS) +endif() +if(TARGET asio) + install(TARGETS asio EXPORT asioTargets FILE_SET public_headers) +endif() + +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/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/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/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/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" 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/requirements.txt b/asio/requirements.txt new file mode 100644 index 0000000000..3d13e0dd7b --- /dev/null +++ b/asio/requirements.txt @@ -0,0 +1,14 @@ +# +# usage: pip install --user --upgrade -r requirements.txt +# +Pygments +PyYAML +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 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..112402121d --- /dev/null +++ b/asio/src/tests/CMakeLists.txt @@ -0,0 +1,34 @@ +cmake_minimum_required(VERSION 3.23...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) + +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 ---- + +add_test(NAME asio_test COMMAND asio_test) + +# ---- End-of-file commands ---- + +if(NOT PROJECT_IS_TOP_LEVEL) + add_folders(Tests) +endif() diff --git a/asio/src/tests/unit/read_until.cpp b/asio/src/tests/unit/read_until.cpp index 64282f39cc..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,11 +93,13 @@ 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 + static const char read_data[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; @@ -1627,3 +1631,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