Skip to content

Commit 2bb530c

Browse files
committed
[chore] ports: 添加 picohttpparser 正式依赖,移除 bundled 构建
- vcpkg.json 声明 picohttpparser 为正式依赖(对应 vcpkg#51743) - portfile.cmake 传递 -DHICAL_USE_SYSTEM_PICOHTTPPARSER=ON - 新增 ports/picohttpparser/ overlay port 供非 vcpkg 用户使用
1 parent a8a4a1e commit 2bb530c

9 files changed

Lines changed: 121 additions & 2 deletions

File tree

CMakeLists.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,13 @@ if(HICAL_BUILD_BENCH)
8080
target_link_libraries(bench_server PRIVATE hical_core)
8181
endif()
8282

83+
# TFB 压测服务器(TechEmpower Framework Benchmarks 专用)
84+
option(HICAL_BUILD_TFB "Build TFB benchmark server" OFF)
85+
if(HICAL_BUILD_TFB)
86+
add_executable(tfb_server docker/TFB/bench_main.cpp)
87+
target_link_libraries(tfb_server PRIVATE hical_core)
88+
endif()
89+
8390
# 生产部署服务器(docker/prod/ 目录)
8491
option(HICAL_BUILD_DEPLOY "Build production deployment server" OFF)
8592
if(HICAL_BUILD_DEPLOY)

docker/TFB/hical.dockerfile

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# TechEmpower Framework Benchmarks — Hical C++20 Web Framework
2+
# Dockerfile 命名遵循 TFB 规范:<framework-name>.dockerfile
3+
4+
# --- 构建阶段 ---
5+
FROM ubuntu:24.04 AS builder
6+
7+
ENV DEBIAN_FRONTEND=noninteractive
8+
9+
RUN sed -i 's|http://archive.ubuntu.com|http://mirrors.tuna.tsinghua.edu.cn|g' /etc/apt/sources.list.d/ubuntu.sources \
10+
&& sed -i 's|http://security.ubuntu.com|http://mirrors.tuna.tsinghua.edu.cn|g' /etc/apt/sources.list.d/ubuntu.sources
11+
12+
RUN apt-get update && apt-get install -y --no-install-recommends \
13+
gcc-14 g++-14 cmake ninja-build \
14+
libboost-all-dev libssl-dev libgtest-dev zlib1g-dev \
15+
&& rm -rf /var/lib/apt/lists/*
16+
17+
WORKDIR /src
18+
COPY . .
19+
20+
RUN cmake -B build -G Ninja \
21+
-DCMAKE_BUILD_TYPE=Release \
22+
-DCMAKE_C_COMPILER=gcc-14 \
23+
-DCMAKE_CXX_COMPILER=g++-14 \
24+
-DHICAL_BUILD_TFB=ON \
25+
-DHICAL_BUILD_TESTS=OFF \
26+
-DHICAL_BUILD_EXAMPLES=OFF \
27+
-DHICAL_DISABLE_IO_URING=ON \
28+
&& cmake --build build --target tfb_server -j$(nproc) \
29+
&& strip build/tfb_server
30+
31+
# --- 运行阶段(最小镜像) ---
32+
FROM ubuntu:24.04
33+
34+
RUN apt-get update && apt-get install -y --no-install-recommends \
35+
libboost-json1.83.0 libssl3t64 zlib1g \
36+
&& rm -rf /var/lib/apt/lists/*
37+
38+
COPY --from=builder /src/build/tfb_server /tfb_server
39+
40+
EXPOSE 8080
41+
42+
CMD ["/tfb_server"]

docker/bench_main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ int main()
128128
});
129129
}
130130

131-
// /sync-middleware/10 — 10 层同步中间件(仅 1 个协程帧)
131+
// /sync-middleware/10 — 10 层同步中间件
132132
{
133133
auto gs10 = server.router().group("");
134134
for (int i = 0; i < 10; ++i)

ports/hical61-hical/portfile.cmake

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ vcpkg_cmake_configure(
1818
OPTIONS
1919
-DHICAL_BUILD_TESTS=OFF
2020
-DHICAL_BUILD_EXAMPLES=OFF
21+
-DHICAL_USE_SYSTEM_PICOHTTPPARSER=ON
2122
${FEATURE_OPTIONS}
2223
)
2324

ports/hical61-hical/vcpkg.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "hical61-hical",
3-
"version": "2.6.0",
3+
"version": "2.6.1",
44
"description": "Modern C++20/C++26 high-performance web framework based on Boost.Asio with native HTTP/WebSocket stack",
55
"homepage": "https://github.com/Hical61/Hical",
66
"license": "MIT",
@@ -14,6 +14,7 @@
1414
"platform": "linux"
1515
},
1616
"openssl",
17+
"picohttpparser",
1718
"zlib",
1819
{
1920
"name": "vcpkg-cmake",

ports/hical61-hical/versions_template.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
{
22
"versions": [
3+
{
4+
"version": "2.6.1",
5+
"git-tree": "PLACEHOLDER_RUN_STEP_5_TO_FILL"
6+
},
37
{
48
"version": "2.6.0",
59
"git-tree": "PLACEHOLDER_RUN_STEP_5_TO_FILL"
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
cmake_minimum_required(VERSION 3.20)
2+
project(picohttpparser C)
3+
4+
add_library(picohttpparser picohttpparser.c)
5+
6+
target_include_directories(picohttpparser
7+
PUBLIC
8+
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
9+
$<INSTALL_INTERFACE:include>
10+
)
11+
12+
install(TARGETS picohttpparser
13+
EXPORT picohttpparserTargets
14+
ARCHIVE DESTINATION lib
15+
LIBRARY DESTINATION lib
16+
)
17+
18+
install(FILES picohttpparser.h DESTINATION include)
19+
20+
install(EXPORT picohttpparserTargets
21+
FILE picohttpparserConfig.cmake
22+
NAMESPACE picohttpparser::
23+
DESTINATION lib/cmake/picohttpparser
24+
)
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
vcpkg_check_linkage(ONLY_STATIC_LIBRARY)
2+
3+
vcpkg_from_github(
4+
OUT_SOURCE_PATH SOURCE_PATH
5+
REPO h2o/picohttpparser
6+
REF 066d2b1e9ab820703db0837571f3b6f353f3d0f4
7+
SHA512 f3781cbb4e9e190df38c3fe7fa80ba69bf6f9dbafb158e0426dd4604f2f1ba794450679005a38d0f9f1dad0696e2f22b8b086b2d7d08a0f99bb4fd3b0f7ed5d8
8+
HEAD_REF master
9+
)
10+
11+
# 上游没有 CMakeLists.txt,使用 overlay
12+
file(COPY "${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt" DESTINATION "${SOURCE_PATH}")
13+
14+
vcpkg_cmake_configure(
15+
SOURCE_PATH "${SOURCE_PATH}"
16+
)
17+
18+
vcpkg_cmake_install()
19+
vcpkg_cmake_config_fixup(PACKAGE_NAME picohttpparser CONFIG_PATH lib/cmake/picohttpparser)
20+
21+
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
22+
23+
vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE")

ports/picohttpparser/vcpkg.json

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"name": "picohttpparser",
3+
"version": "2024-11-01",
4+
"description": "Tiny, primitive, fast HTTP request/response parser (from H2O project)",
5+
"homepage": "https://github.com/h2o/picohttpparser",
6+
"license": "MIT",
7+
"dependencies": [
8+
{
9+
"name": "vcpkg-cmake",
10+
"host": true
11+
},
12+
{
13+
"name": "vcpkg-cmake-config",
14+
"host": true
15+
}
16+
]
17+
}

0 commit comments

Comments
 (0)