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