From 7f72a3dbad1dea830c386bb890daea307e5c0c63 Mon Sep 17 00:00:00 2001 From: kamchatka-volcano Date: Tue, 28 May 2024 00:53:19 +0500 Subject: [PATCH] -updated seal_lake to v0.2.0; -updated sfun to v5.1.0; -updated fcgi_responder to v1.7.0; -updated whaleroute to v3.1.0; -updated hot_teacup to v3.3.0; -added CMakePresets.json; -set version to 0.6.0; --- .github/workflows/build_and_test.yml | 55 ++++++------ CMakeLists.txt | 17 ++-- CMakePresets.json | 123 +++++++++++++++++++++++++++ external/seal_lake | 14 +-- include/asyncgi/events.h | 2 +- 5 files changed, 165 insertions(+), 46 deletions(-) create mode 100644 CMakePresets.json diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml index 0b19578..ee3665a 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/build_and_test.yml @@ -1,6 +1,7 @@ name: build & test (clang, gcc, MSVC) on: + workflow_dispatch: push: branches: [ "master", "dev" ] paths-ignore: @@ -25,57 +26,51 @@ jobs: - { name: "Ubuntu Latest gcc", os: ubuntu-latest, - cc: "gcc", - cxx: "g++", + cmake-preset: gcc-release, cmake_vars: "", - asio_type: "standalone", - flags: "-Wall -Werror -Wextra -Wpedantic -Wcast-align -Wnon-virtual-dtor -Woverloaded-virtual -Wunused", - artifacts-path-postfix: "" + asio_type: "standalone" } - { name: "Ubuntu Latest clang", os: ubuntu-latest, - cc: "clang", - cxx: "clang++", + cmake-preset: clang-release, cmake_vars: "", - asio_type: "standalone", - flags: "-Wall -Werror -Wextra -Wpedantic -Wcast-align -Wnon-virtual-dtor -Woverloaded-virtual -Wunused", - artifacts-path-postfix: "" + asio_type: "standalone" } - { name: "Windows Latest MSVC", os: windows-latest, - cc: "cl", - cxx: "cl", + cmake-preset: msvc-release, cmake_vars: "", - asio_type: "standalone", - flags: "/EHsc /W4 /WX", - artifacts-path-postfix: "Release" + asio_type: "standalone" } - { name: "Ubuntu Latest clang (Boost.Asio)", os: ubuntu-latest, - cc: "clang", - cxx: "clang++", + cmake-preset: clang-release, asio_type: "boost", cmake_vars: "-DASYNCGI_USE_BOOST_ASIO=ON -DBoost_USE_STATIC_LIBS=ON -DBoost_USE_STATIC_RUNTIME=ON -DCMAKE_TOOLCHAIN_FILE=vcpkg/scripts/buildsystems/vcpkg.cmake", - flags: "-Wall -Werror -Wextra -Wpedantic -Wcast-align -Wnon-virtual-dtor -Woverloaded-virtual -Wunused", - artifacts-path-postfix: "" } - { name: "Windows Latest MSVC (Boost.Asio)", os: windows-latest, - cc: "cl", - cxx: "cl", + cmake-preset: msvc-release, asio_type: "boost", - cmake_vars: "-DASYNCGI_USE_BOOST_ASIO=ON -DCMAKE_GENERATOR_PLATFORM=x64 -DVCPKG_TARGET_TRIPLET=x64-windows-static-md -DCMAKE_TOOLCHAIN_FILE='vcpkg/scripts/buildsystems/vcpkg.cmake'", - flags: "/EHsc /W4 /WX", - artifacts-path-postfix: "Release" + cmake_vars: "-DASYNCGI_USE_BOOST_ASIO=ON -DVCPKG_TARGET_TRIPLET=x64-windows-static-md -DCMAKE_TOOLCHAIN_FILE='vcpkg/scripts/buildsystems/vcpkg.cmake'" } steps: - - name: Git checkout - uses: actions/checkout@v3 + - name: Install ninja (Windows) + if: matrix.config.os == 'windows-latest' + run: choco install ninja + - name: Install ninja (Linux) + if: matrix.config.os == 'ubuntu-latest' + run: sudo apt install ninja-build + - uses: actions/checkout@v4 + + - uses: rui314/setup-mold@v1 + - uses: hendrikmuhs/ccache-action@v1.2 + - uses: ilammy/msvc-dev-cmd@v1 - name: Install vcpkg uses: lukka/run-vcpkg@v10 @@ -83,7 +78,7 @@ jobs: vcpkgGitCommitId: 31a159c1cae2bf905299085d9ef01bdfea0ca7b8 - name: Configure CMake - run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=Release -DENABLE_EXAMPLES=ON ${{ matrix.config.cmake_vars }} -DCMAKE_CXX_FLAGS="${{ matrix.config.flags }}" + run: cmake -B ${{github.workspace}}/build -DENABLE_EXAMPLES=ON ${{ matrix.config.cmake_vars }} --preset="${{ matrix.config.cmake-preset }}" - name: Build run: cmake --build ${{github.workspace}}/build --config Release @@ -92,13 +87,13 @@ jobs: uses: actions/upload-artifact@v3 with: name: asyncgi-examples-${{ matrix.config.os }}-${{ matrix.config.asio_type }}-asio - path: build/examples/${{ matrix.config.artifacts-path-postfix }} + path: build/examples/ - name: Upload build test artifact uses: actions/upload-artifact@v3 with: name: asyncgi-test-examples-${{ matrix.config.os }}-${{ matrix.config.asio_type }}-asio - path: build/test_examples/${{ matrix.config.artifacts-path-postfix }} + path: build/test_examples/ functional_tests: name: Functional testing (${{ matrix.config.name }} ${{ matrix.asio_type }}-asio) @@ -115,7 +110,7 @@ jobs: lunchtoast_exec: "lunchtoast.exe", shell_command: -shell="msys2 -c", tags: -skip=linux, - nginx_exec: "c:/tools/nginx-1.25.3/nginx.exe", + nginx_exec: "c:/tools/nginx-1.27.0/nginx.exe", nginx_cfg: "nginx_windows.conf" } - { diff --git a/CMakeLists.txt b/CMakeLists.txt index f822d0a..3740fc8 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,7 +1,6 @@ cmake_minimum_required(VERSION 3.18) -project(asyncgi VERSION 0.4.0 DESCRIPTION "asyncgi - asynchronous FastCGI web application microframework") +project(asyncgi VERSION 0.6.0 DESCRIPTION "asyncgi - asynchronous FastCGI web application microframework") -include(GNUInstallDirs) include(external/seal_lake) if (ASYNCGI_USE_BOOST_ASIO) find_package(Boost REQUIRED COMPONENTS system) @@ -12,7 +11,7 @@ endif() SealLake_Bundle( NAME asyncgi_sfun GIT_REPOSITORY https://github.com/kamchatka-volcano/sfun.git - GIT_TAG v5.0.0 + GIT_TAG v5.1.0 DESTINATION include/asyncgi/detail/external DIRECTORIES include/sfun TEXT_REPLACEMENTS @@ -24,7 +23,7 @@ set(ASYNCGI_FCGI_RESPONDER_OBJECT_LIB ON) SealLake_Bundle( NAME asyncgi_fcgi_responder GIT_REPOSITORY https://github.com/kamchatka-volcano/fcgi_responder.git - GIT_TAG v1.6.2 + GIT_TAG v1.7.0 TEXT_REPLACEMENTS "namespace fcgi" "namespace asyncgi::fcgi" ) @@ -32,7 +31,7 @@ SealLake_Bundle( SealLake_Bundle( NAME asyncgi_whaleroute GIT_REPOSITORY https://github.com/kamchatka-volcano/whaleroute.git - GIT_TAG v3.0.0 + GIT_TAG v3.1.0 DESTINATION include/asyncgi/detail/external DIRECTORIES include/whaleroute TEXT_REPLACEMENTS @@ -44,7 +43,7 @@ set(ASYNCGI_HOT_TEACUP_OBJECT_LIB ON) SealLake_Bundle( NAME asyncgi_hot_teacup GIT_REPOSITORY https://github.com/kamchatka-volcano/hot_teacup.git - GIT_TAG v3.2.0 + GIT_TAG v3.3.0 WILDCARDS include/hot_teacup/*.h DESTINATION include/asyncgi/http @@ -92,12 +91,12 @@ SealLake_StaticLibrary( ) if (ASYNCGI_USE_BOOST_ASIO) - SealLake_Libraries(Boost::boost) + SealLake_AddLibraries(Boost::boost) else() - SealLake_Libraries(asio) + SealLake_AddLibraries(asio) endif() -SealLake_OptionalBuildSteps(examples) +SealLake_OptionalSubProjects(examples) if (ENABLE_EXAMPLES) add_subdirectory(test_examples) endif() diff --git a/CMakePresets.json b/CMakePresets.json new file mode 100644 index 0000000..7b37b20 --- /dev/null +++ b/CMakePresets.json @@ -0,0 +1,123 @@ +{ + "version": 6, + "configurePresets": [ + { + "name": "base-linux", + "hidden": true, + "displayName": "linux base preset", + "generator": "Ninja", + "binaryDir": "build-${presetName}", + "cacheVariables": { + "CMAKE_EXE_LINKER_FLAGS": "-fuse-ld=mold", + "CMAKE_CXX_COMPILER_LAUNCHER": "ccache", + "CPM_SOURCE_CACHE": "cpm_cache" + } + }, + { + "name": "clang-base", + "hidden": true, + "displayName": "clang base preset", + "inherits": "base-linux", + "cacheVariables": { + "CMAKE_CXX_COMPILER": "clang++", + "CMAKE_C_COMPILER": "clang", + "CMAKE_CXX_FLAGS": "-Wall -Wextra -Wpedantic -Werror -Wcast-align -Wnon-virtual-dtor -Woverloaded-virtual -Wunused" + } + }, + { + "name": "clang-debug", + "displayName": "clang (Debug)", + "inherits": "clang-base", + "cacheVariables": { + "CMAKE_BUILD_TYPE": "Debug" + } + }, + { + "name": "clang-release", + "displayName": "clang (Release)", + "inherits": "clang-base", + "cacheVariables": { + "CMAKE_BUILD_TYPE": "Release" + } + }, + { + "name": "gcc-base", + "hidden": true, + "displayName": "gcc base preset", + "inherits": "base-linux", + "cacheVariables": { + "CMAKE_CXX_COMPILER": "g++", + "CMAKE_C_COMPILER": "gcc", + "CMAKE_CXX_FLAGS": "-Wall -Wextra -Wpedantic -Werror -Wcast-align -Wnon-virtual-dtor -Woverloaded-virtual -Wunused" + } + }, + { + "name": "gcc-debug", + "displayName": "gcc (Debug)", + "inherits": "gcc-base", + "cacheVariables": { + "CMAKE_BUILD_TYPE": "Debug" + } + }, + { + "name": "gcc-release", + "displayName": "gcc (Release)", + "inherits": "gcc-base", + "cacheVariables": { + "CMAKE_BUILD_TYPE": "Release" + } + }, + { + "name": "base-windows", + "displayName": "windows base preset", + "hidden": true, + "generator": "Ninja", + "binaryDir": "build-${presetName}", + "architecture": { + "value": "x64", + "strategy": "external" + }, + "cacheVariables": { + "CPM_SOURCE_CACHE": "cpm_cache", + "CMAKE_CXX_COMPILER_LAUNCHER": "ccache" + }, + "vendor": { + "microsoft.com/VisualStudioSettings/CMake/1.0": { + "hostOS": [ + "Windows" + ] + }, + "jetbrains.com/clion": { + "toolchain": "Visual Studio" + } + } + }, + { + "name": "msvc-base", + "hidden": true, + "displayName": "msvc base preset", + "inherits": "base-windows", + "cacheVariables": { + "CMAKE_CXX_COMPILER": "cl.exe", + "CMAKE_C_COMPILER": "cl.exe", + "CMAKE_CXX_FLAGS": "/EHsc /W4 /WX /wd4267" + } + }, + { + "name": "msvc-debug", + "displayName": "msvc (Debug)", + "inherits": "msvc-base", + "cacheVariables": { + "CMAKE_BUILD_TYPE": "Debug" + } + }, + { + "name": "msvc-release", + "displayName": "msvc (Release)", + "inherits": "msvc-base", + "cacheVariables": { + "CMAKE_BUILD_TYPE": "Release" + } + } + ] +} \ No newline at end of file diff --git a/external/seal_lake b/external/seal_lake index b6a33ac..b533df0 100644 --- a/external/seal_lake +++ b/external/seal_lake @@ -1,8 +1,10 @@ include(FetchContent) -Set(FETCHCONTENT_QUIET FALSE) -FetchContent_Declare(seal_lake - GIT_REPOSITORY https://github.com/kamchatka-volcano/seal_lake.git - GIT_TAG master +set(SEAL_LAKE_VERSION v0.2.0) +set(FETCHCONTENT_QUIET FALSE) +FetchContent_Declare(seal_lake_${SEAL_LAKE_VERSION} + SOURCE_DIR seal_lake_${SEAL_LAKE_VERSION} + GIT_REPOSITORY "https://github.com/kamchatka-volcano/seal_lake.git" + GIT_TAG ${SEAL_LAKE_VERSION} ) -FetchContent_MakeAvailable(seal_lake) -include(${seal_lake_SOURCE_DIR}/seal_lake.cmake) \ No newline at end of file +FetchContent_MakeAvailable(seal_lake_${SEAL_LAKE_VERSION}) +include(${seal_lake_${SEAL_LAKE_VERSION}_SOURCE_DIR}/seal_lake.cmake) \ No newline at end of file diff --git a/include/asyncgi/events.h b/include/asyncgi/events.h index 8e152bf..bd06fce 100644 --- a/include/asyncgi/events.h +++ b/include/asyncgi/events.h @@ -12,6 +12,6 @@ enum ErrorEvent { RouteParametersError }; -}; //namespace asyncgi +} //namespace asyncgi #endif //ASYNCGI_EVENTS_H