feat reformat CMakeLists.txt
All checks were successful
android / build (arm64-v8a) (push) Successful in 1m5s
android / build (armeabi-v7a) (push) Successful in 1m4s
android / build (x86_64) (push) Successful in 1m12s
android / build (x86) (push) Successful in 1m50s
linux-aarch64-cpu-gcc / linux-gcc-aarch64 (Debug) (push) Successful in 11m22s
linux-aarch64-cpu-gcc / linux-gcc-aarch64 (Release) (push) Successful in 11m28s
linux-x64-clang / linux-clang (Debug) (push) Successful in 3m34s
linux-x64-gcc / linux-gcc (Debug) (push) Successful in 4m58s
linux-x64-gcc / linux-gcc (Release) (push) Successful in 5m14s
linux-x64-clang / linux-clang (Release) (push) Successful in 6m15s
linux-x86-gcc / linux-gcc (Debug) (push) Successful in 6m39s
linux-x86-gcc / linux-gcc (Release) (push) Successful in 8m7s
linux-riscv64-gcc / linux-gcc-riscv64 (Debug) (push) Successful in 6m52s
linux-mips-gcc / linux-gcc-mipsel (Debug) (push) Successful in 5m54s
linux-mips-gcc / linux-gcc-mipsel (Release) (push) Successful in 5m59s
linux-arm-gcc / linux-gcc-arm (Debug) (push) Successful in 6m41s
linux-riscv64-gcc / linux-gcc-riscv64 (Release) (push) Successful in 9m24s
linux-arm-gcc / linux-gcc-arm (Release) (push) Successful in 9m37s
linux-arm-gcc / linux-gcc-armhf (Release) (push) Successful in 3m58s
linux-mips64-gcc / linux-gcc-mips64el (Release) (push) Successful in 11m1s
linux-mips64-gcc / linux-gcc-mips64el (Debug) (push) Successful in 11m29s
linux-arm-gcc / linux-gcc-armhf (Debug) (push) Successful in 4m41s

This commit is contained in:
tqcq 2025-01-07 23:16:46 +08:00
parent 376f9b3c92
commit 5e93fa78fb
3 changed files with 37 additions and 48 deletions

View File

@ -7,24 +7,20 @@ set(tile_VERSION_BUILD $ENV{CI_STEP_NUMBER})
if(NOT tile_VERSION_BUILD)
set(tile_VERSION_BUILD "0")
endif()
set(TILE_VERSION
"${tile_VERSION_MAJOR}.${tile_VERSION_MINOR}.${tile_VERSION_PATCH}.${tile_VERSION_BUILD}"
)
project(
tile
VERSION "${tile_VERSION_MAJOR}.${tile_VERSION_MINOR}.${tile_VERSION_PATCH}"
LANGUAGES C CXX)
set(TILE_VERSION "${PROJECT_VERSION}.${tile_VERSION_BUILD}")
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
# add static libgcc and libstdc++ for static linking set(CMAKE_C_FLAGS
# "${CMAKE_C_FLAGS} -static-libgcc -static-libstdc++") set(CMAKE_CXX_FLAGS
# "${CMAKE_CXX_FLAGS} -static-libgcc -static-libstdc++")
option(TILE_BUILD_TESTS "Build tests" OFF)
option(TILE_BUILD_BENCHMARKS "Build tests" OFF)
option(TILE_WITH_OPENSSL "Build wih openssl" OFF)
@ -95,39 +91,17 @@ set(gflags_DIR "${CMAKE_CURRENT_BINARY_DIR}/third_party/gflags")
# add_subdirectory("third_party/context")
set(CURL_DISABLE_TESTS ON)
set(CURL_CA_PATH
"none"
CACHE STRING "" FORCE)
set(CURL_ENABLE_SSL
OFF
CACHE BOOL "" FORCE)
set(USE_LIBIDN2
OFF
CACHE BOOL "" FORCE)
set(CURL_USE_LIBPSL
OFF
CACHE BOOL "" FORCE)
set(CURL_USE_LIBSSH
OFF
CACHE BOOL "" FORCE)
set(CURL_USE_LIBSSH2
OFF
CACHE BOOL "" FORCE)
set(CURL_USE_GSSAPI
OFF
CACHE BOOL "" FORCE)
set(CURL_USE_RTMP
OFF
CACHE BOOL "" FORCE)
set(USE_OPENSSL_QUIC
OFF
CACHE BOOL "" FORCE)
set(USE_MSH3
OFF
CACHE BOOL "" FORCE)
set(CURL_DISABLE_LDAP
ON
CACHE BOOL "" FORCE)
set(CURL_CA_PATH "none" CACHE STRING "" FORCE)
set(CURL_ENABLE_SSL OFF CACHE BOOL "" FORCE)
set(USE_LIBIDN2 OFF CACHE BOOL "" FORCE)
set(CURL_USE_LIBPSL OFF CACHE BOOL "" FORCE)
set(CURL_USE_LIBSSH OFF CACHE BOOL "" FORCE)
set(CURL_USE_LIBSSH2 OFF CACHE BOOL "" FORCE)
set(CURL_USE_GSSAPI OFF CACHE BOOL "" FORCE)
set(CURL_USE_RTMP OFF CACHE BOOL "" FORCE)
set(USE_OPENSSL_QUIC OFF CACHE BOOL "" FORCE)
set(USE_MSH3 OFF CACHE BOOL "" FORCE)
set(CURL_DISABLE_LDAP ON CACHE BOOL "" FORCE)
set(ZLIB_FOUND ON)
set(ZLIB_INCLUDE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/third_party/zlib")
set(ZLIB_LIBRARIES zlib)
@ -331,7 +305,7 @@ if(TILE_BUILD_TESTS)
tile_add_test(${TEST_NAME} ${SRC_FILE})
endforeach()
endfunction(add_test_group)
endfunction()
add_test_group(${CMAKE_CURRENT_SOURCE_DIR}/tile/system system)
add_test_group(${CMAKE_CURRENT_SOURCE_DIR}/tile/base base)
@ -340,7 +314,7 @@ if(TILE_BUILD_TESTS)
add_test_group(${CMAKE_CURRENT_SOURCE_DIR}/tile/net net)
add_test_group(${CMAKE_CURRENT_SOURCE_DIR}/tile/rpc rpc)
tile_add_custom_test("custom_http_client_test" "tests/http_client_test.cc")
endif(TILE_BUILD_TESTS)
endif()
if(TILE_BUILD_BENCHMARKS)
add_subdirectory("third_party/benchmark")
@ -366,4 +340,4 @@ if(TILE_BUILD_BENCHMARKS)
tile_add_bm(base_internal_time_keeper_benchmark
"tile/base/internal/time_keeper_benchmark.cc")
tile_add_bm(base_chrono_benchmark "tile/base/chrono_benchmark.cc")
endif(TILE_BUILD_BENCHMARKS)
endif()

View File

@ -0,0 +1,8 @@
#ifndef TILE_RPC_HTTP_HANDLER_H
#define TILE_RPC_HTTP_HANDLER_H
#pragma once
#include <stdio.h>
#endif// TILE_RPC_HTTP_HANDLER_H

View File

@ -54,14 +54,20 @@ EasyDetectHttp(const void *data, std::size_t length)
}
std::size_t
DetermineHeaderSizeFast(const char *const ptr, std::size_t limit)
DetermineHeaderSizeFast(const char *const ptr, std::size_t length)
{
auto ep = ptr + limit;
auto p = ptr + 1;
char *first_end_pos = (char *) memmem(ptr, length, "\r\n\r\n", 4);
if (first_end_pos == NULL) { return -1; }
return first_end_pos + 4 - ptr;
/*
auto end_ptr = ptr + length;
auto p = ptr + 1;
while (true) {
// First '\n' in '\r\n\r\n'
p = static_cast<char *>(memchr(const_cast<char *>(p), '\n', ep - p));
if (TILE_UNLIKELY(p == nullptr || ep - p < 3)) { return -1; }
p = static_cast<char *>(memchr(const_cast<char *>(p), '\n', end_ptr - p));
if (TILE_UNLIKELY(p == nullptr || end_ptr - p < 3)) { return -1; }
if (p[2] == '\n') {
TILE_CHECK_GE(p - 1, ptr);
@ -73,6 +79,7 @@ DetermineHeaderSizeFast(const char *const ptr, std::size_t limit)
}
++p;
}
*/
}
}// namespace