mirror of
https://github.com/CrowCpp/Crow.git
synced 2024-06-07 21:10:44 +00:00
now crow becomes completely header only
This commit is contained in:
parent
81fcf4af01
commit
c36aa219e2
@ -1,6 +1,11 @@
|
||||
cmake_minimum_required(VERSION 2.8)
|
||||
project (crow_all)
|
||||
|
||||
if (NOT CMAKE_BUILD_TYPE)
|
||||
message(STATUS "No build type selected, default to Release")
|
||||
set(CMAKE_BUILD_TYPE "Release")
|
||||
endif()
|
||||
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -std=c++1y")
|
||||
|
||||
find_package( Boost 1.40 COMPONENTS date_time filesystem system thread REQUIRED )
|
||||
@ -14,7 +19,7 @@ ${PROJECT_SOURCE_DIR}/http-parser
|
||||
include_directories("${PROJECT_INCLUDE_DIR}")
|
||||
include_directories("${PROJECT_SOURCE_DIR}")
|
||||
|
||||
add_subdirectory(src)
|
||||
#add_subdirectory(src)
|
||||
add_subdirectory(tests)
|
||||
add_subdirectory(examples)
|
||||
|
||||
|
@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 2.8)
|
||||
project (crow_examples)
|
||||
|
||||
add_executable(example example.cpp)
|
||||
target_link_libraries(example crow)
|
||||
#target_link_libraries(example crow)
|
||||
target_link_libraries(example ${Boost_LIBRARIES} )
|
||||
add_custom_command(OUTPUT example_test.py
|
||||
COMMAND ${CMAKE_COMMAND} -E
|
||||
@ -12,7 +12,7 @@ add_custom_command(OUTPUT example_test.py
|
||||
add_custom_target(example_copy ALL DEPENDS example_test.py)
|
||||
|
||||
add_executable(example_chat example_chat.cpp)
|
||||
target_link_libraries(example_chat crow)
|
||||
#target_link_libraries(example_chat crow)
|
||||
target_link_libraries(example_chat ${Boost_LIBRARIES} )
|
||||
add_custom_command(OUTPUT example_chat.html
|
||||
COMMAND ${CMAKE_COMMAND} -E
|
||||
|
@ -1 +1 @@
|
||||
Subproject commit d19e12911a1b523885bdf0d82f1f3e91df90711d
|
||||
Subproject commit 5b951d74bd66ec9d38448e0a85b1cf8b85d97db3
|
@ -1,11 +1,12 @@
|
||||
#pragma once
|
||||
#include <boost/asio.hpp>
|
||||
#include <boost/algorithm/string/predicate.hpp>
|
||||
#include <boost/lexical_cast.hpp>
|
||||
#include <atomic>
|
||||
#include <chrono>
|
||||
#include <array>
|
||||
|
||||
#include <http_parser.h>
|
||||
#include "http_parser_merged.h"
|
||||
|
||||
#include "datetime.h"
|
||||
#include "parser.h"
|
||||
@ -29,7 +30,8 @@ namespace crow
|
||||
handler_(handler),
|
||||
parser_(this),
|
||||
server_name_(server_name),
|
||||
deadline_(socket_.get_io_service())
|
||||
deadline_(socket_.get_io_service()),
|
||||
address_str_(boost::lexical_cast<std::string>(socket_.remote_endpoint()))
|
||||
{
|
||||
#ifdef CROW_ENABLE_DEBUG
|
||||
connectionCount ++;
|
||||
@ -89,7 +91,7 @@ namespace crow
|
||||
}
|
||||
}
|
||||
|
||||
CROW_LOG_INFO << "Request: "<< this << " HTTP/" << parser_.http_major << "." << parser_.http_minor << ' '
|
||||
CROW_LOG_INFO << "Request: " << address_str_ << " " << this << " HTTP/" << parser_.http_major << "." << parser_.http_minor << ' '
|
||||
<< method_name(req.method) << " " << req.url;
|
||||
|
||||
|
||||
@ -308,6 +310,7 @@ namespace crow
|
||||
std::string date_str_;
|
||||
|
||||
boost::asio::deadline_timer deadline_;
|
||||
std::string address_str_;
|
||||
};
|
||||
|
||||
}
|
||||
|
2640
include/http_parser_merged.h
Normal file
2640
include/http_parser_merged.h
Normal file
File diff suppressed because it is too large
Load Diff
@ -528,7 +528,7 @@ namespace crow
|
||||
|
||||
namespace detail
|
||||
{
|
||||
inline std::function<std::string (std::string)> get_loader_ref()
|
||||
inline std::function<std::string (std::string)>& get_loader_ref()
|
||||
{
|
||||
static std::function<std::string (std::string)> loader = default_loader;
|
||||
return loader;
|
||||
|
@ -1,17 +0,0 @@
|
||||
cmake_minimum_required(VERSION 2.8)
|
||||
project (crow)
|
||||
|
||||
set(CROW_SRCS
|
||||
#${PROJECT_SOURCE_DIR}/some.cpp
|
||||
#${PROJECT_SOURCE_DIR}/someother.cpp
|
||||
${PROJECT_SOURCE_DIR}/../http-parser/http_parser.c
|
||||
)
|
||||
|
||||
set_source_files_properties(${PROJECT_SOURCE_DIR}/../http-parser/http_parser.c PROPERTIES LANGUAGE C )
|
||||
|
||||
include_directories("${PROJECT_BINARY_DIR}")
|
||||
include_directories("${PROJECT_INCLUDE_DIR}")
|
||||
|
||||
|
||||
add_library(${PROJECT_NAME} SHARED ${CROW_SRCS})
|
||||
#target_link_libraries(${PROJECT_NAME} tcmalloc)
|
@ -7,7 +7,7 @@ unittest.cpp
|
||||
)
|
||||
|
||||
add_executable(unittest ${TEST_SRCS})
|
||||
target_link_libraries(unittest crow)
|
||||
#target_link_libraries(unittest crow)
|
||||
target_link_libraries(unittest ${Boost_LIBRARIES} )
|
||||
|
||||
set_target_properties(unittest PROPERTIES COMPILE_FLAGS "--coverage -fprofile-arcs -ftest-coverage")
|
||||
|
@ -15,8 +15,8 @@ add_executable(mustachetest ${TEST_SRCS})
|
||||
#target_link_libraries(unittest ${Boost_LIBRARIES} )
|
||||
set_target_properties(mustachetest PROPERTIES COMPILE_FLAGS "-Wall -std=c++1y")
|
||||
|
||||
message(${PROJECT_SOURCE_DIR})
|
||||
message(${CMAKE_CURRENT_BINARY_DIR})
|
||||
#message(${PROJECT_SOURCE_DIR})
|
||||
#message(${CMAKE_CURRENT_BINARY_DIR})
|
||||
file(COPY DIRECTORY . DESTINATION ${CMAKE_CURRENT_BINARY_DIR}
|
||||
FILES_MATCHING
|
||||
PATTERN "*.json")
|
||||
|
Loading…
Reference in New Issue
Block a user