mirror of
https://github.com/CrowCpp/Crow.git
synced 2024-06-07 21:10:44 +00:00
Merge branch 'master' into sessions
This commit is contained in:
commit
93710edd77
@ -8,6 +8,9 @@ project(Crow
|
||||
LANGUAGES CXX
|
||||
)
|
||||
|
||||
# Make sure Findasio.cmake module is found
|
||||
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
|
||||
|
||||
# Check if Crow is the main project
|
||||
set(CROW_IS_MAIN_PROJECT OFF)
|
||||
if (CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR)
|
||||
@ -52,16 +55,11 @@ target_include_directories(Crow
|
||||
$<INSTALL_INTERFACE:include>
|
||||
)
|
||||
|
||||
find_path(ASIO_INCLUDE_DIR asio.hpp REQUIRED)
|
||||
find_package(Threads REQUIRED)
|
||||
find_package(asio REQUIRED)
|
||||
|
||||
target_link_libraries(Crow
|
||||
INTERFACE
|
||||
Threads::Threads
|
||||
)
|
||||
target_include_directories(Crow
|
||||
INTERFACE
|
||||
${ASIO_INCLUDE_DIR}
|
||||
asio::asio
|
||||
)
|
||||
|
||||
if("compression" IN_LIST CROW_FEATURES)
|
||||
@ -130,6 +128,7 @@ if(CROW_INSTALL)
|
||||
INSTALL_DESTINATION lib/cmake/Crow
|
||||
)
|
||||
install(FILES
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/Findasio.cmake"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/CrowConfig.cmake"
|
||||
DESTINATION lib/cmake/Crow
|
||||
)
|
||||
|
@ -1,8 +1,12 @@
|
||||
@PACKAGE_INIT@
|
||||
|
||||
include(CMakeFindDependencyMacro)
|
||||
find_path(ASIO_INCLUDE_DIR asio.hpp REQUIRED)
|
||||
find_dependency(Threads)
|
||||
|
||||
get_filename_component(CROW_CMAKE_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH)
|
||||
|
||||
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
|
||||
find_dependency(asio)
|
||||
list(REMOVE_AT CMAKE_MODULE_PATH -1)
|
||||
|
||||
set(CROW_INSTALLED_FEATURES "@CROW_FEATURES@")
|
||||
|
||||
@ -41,8 +45,3 @@ set_target_properties(Crow::Crow PROPERTIES
|
||||
INTERFACE_COMPILE_DEFINITIONS "${_CROW_ICD}"
|
||||
INTERFACE_LINK_LIBRARIES "${_CROW_ILL}"
|
||||
)
|
||||
|
||||
target_include_directories(Crow::Crow
|
||||
INTERFACE
|
||||
${ASIO_INCLUDE_DIR}
|
||||
)
|
||||
|
50
cmake/Findasio.cmake
Normal file
50
cmake/Findasio.cmake
Normal file
@ -0,0 +1,50 @@
|
||||
#Findasio.cmake
|
||||
#
|
||||
# Finds the asio library
|
||||
#
|
||||
# from https://think-async.com/Asio/
|
||||
#
|
||||
# This will define the following variables
|
||||
#
|
||||
# ASIO_FOUND
|
||||
# ASIO_INCLUDE_DIR
|
||||
#
|
||||
# and the following imported targets
|
||||
#
|
||||
# asio::asio
|
||||
#
|
||||
|
||||
find_package(Threads QUIET)
|
||||
if (Threads_FOUND)
|
||||
find_path(ASIO_INCLUDE_DIR asio.hpp)
|
||||
|
||||
mark_as_advanced(ASIO_FOUND ASIO_INCLUDE_DIR)
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(asio
|
||||
FOUND_VAR ASIO_FOUND
|
||||
REQUIRED_VARS ASIO_INCLUDE_DIR
|
||||
)
|
||||
|
||||
if(ASIO_FOUND AND NOT TARGET asio::asio)
|
||||
add_library(asio::asio INTERFACE IMPORTED)
|
||||
target_include_directories(asio::asio
|
||||
INTERFACE
|
||||
${ASIO_INCLUDE_DIR}
|
||||
)
|
||||
target_compile_definitions(asio::asio
|
||||
INTERFACE
|
||||
"ASIO_STANDALONE"
|
||||
)
|
||||
target_link_libraries(asio::asio
|
||||
INTERFACE
|
||||
Threads::Threads
|
||||
)
|
||||
endif()
|
||||
else()
|
||||
if(asio_FIND_REQUIRED)
|
||||
message(FATAL_ERROR "asio requires Threads, which couldn't be found.")
|
||||
elseif(asio_FIND_QUIETLY)
|
||||
message(STATUS "asio requires Threads, which couldn't be found.")
|
||||
endif()
|
||||
endif()
|
@ -1,5 +1,7 @@
|
||||
#pragma once
|
||||
#ifndef ASIO_STANDALONE
|
||||
#define ASIO_STANDALONE
|
||||
#endif
|
||||
#include <asio.hpp>
|
||||
#include <atomic>
|
||||
#include <chrono>
|
||||
|
@ -13,11 +13,7 @@
|
||||
|
||||
// clang-format off
|
||||
#pragma once
|
||||
#include "crow/common.h"
|
||||
namespace crow
|
||||
{
|
||||
extern "C" {
|
||||
|
||||
#include <stddef.h>
|
||||
#if defined(_WIN32) && !defined(__MINGW32__) && \
|
||||
(!defined(_MSC_VER) || _MSC_VER<1600) && !defined(__WINE__)
|
||||
@ -35,9 +31,15 @@ typedef unsigned __int64 uint64_t;
|
||||
#else
|
||||
#include <stdint.h>
|
||||
#endif
|
||||
#include <assert.h>
|
||||
#include <ctype.h>
|
||||
#include <string.h>
|
||||
#include <limits.h>
|
||||
}
|
||||
|
||||
|
||||
|
||||
#include "crow/common.h"
|
||||
namespace crow
|
||||
{
|
||||
/* Maximium header size allowed. If the macro is not defined
|
||||
* before including this header then the default is used. To
|
||||
* change the maximum header size, define the macro in the build
|
||||
@ -188,12 +190,6 @@ enum http_errno {
|
||||
|
||||
|
||||
// SOURCE (.c) CODE
|
||||
#include <assert.h>
|
||||
#include <stddef.h>
|
||||
#include <ctype.h>
|
||||
#include <string.h>
|
||||
#include <limits.h>
|
||||
|
||||
static uint32_t max_header_size = CROW_HTTP_MAX_HEADER_SIZE;
|
||||
|
||||
#ifndef CROW_ULLONG_MAX
|
||||
@ -2011,7 +2007,6 @@ http_parser_set_max_header_size(uint32_t size) {
|
||||
#undef CROW_STRICT_CHECK
|
||||
#undef CROW_NEW_MESSAGE
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// clang-format on
|
||||
|
@ -1,6 +1,8 @@
|
||||
#pragma once
|
||||
|
||||
#ifndef ASIO_STANDALONE
|
||||
#define ASIO_STANDALONE
|
||||
#endif
|
||||
#include <asio.hpp>
|
||||
|
||||
#include "crow/common.h"
|
||||
|
@ -1,7 +1,9 @@
|
||||
#pragma once
|
||||
|
||||
#include <chrono>
|
||||
#ifndef ASIO_STANDALONE
|
||||
#define ASIO_STANDALONE
|
||||
#endif
|
||||
#include <asio.hpp>
|
||||
#ifdef CROW_ENABLE_SSL
|
||||
#include <asio/ssl.hpp>
|
||||
|
@ -1,5 +1,7 @@
|
||||
#pragma once
|
||||
#ifndef ASIO_STANDALONE
|
||||
#define ASIO_STANDALONE
|
||||
#endif
|
||||
#include <asio.hpp>
|
||||
#ifdef CROW_ENABLE_SSL
|
||||
#include <asio/ssl.hpp>
|
||||
|
@ -1,6 +1,8 @@
|
||||
#pragma once
|
||||
|
||||
#ifndef ASIO_STANDALONE
|
||||
#define ASIO_STANDALONE
|
||||
#endif
|
||||
#include <asio.hpp>
|
||||
#include <asio/basic_waitable_timer.hpp>
|
||||
|
||||
|
15
vcpkg.json
15
vcpkg.json
@ -2,15 +2,8 @@
|
||||
"name": "crow-examples",
|
||||
"version-string": "master",
|
||||
"dependencies": [
|
||||
{
|
||||
"name": "asio"
|
||||
},
|
||||
{
|
||||
"name": "openssl"
|
||||
},
|
||||
{
|
||||
"name": "zlib"
|
||||
}
|
||||
],
|
||||
"builtin-baseline": "44d94c2edbd44f0c01d66c2ad95eb6982a9a61bc"
|
||||
"asio",
|
||||
"openssl",
|
||||
"zlib"
|
||||
]
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user