diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000000..d1600df96a --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,41 @@ +# Part of Beast + +cmake_minimum_required (VERSION 3.5) + +project (Beast) + +set_property (GLOBAL PROPERTY USE_FOLDERS ON) + +if (WIN32) + set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W4 /wd4100 /D_SCL_SECURE_NO_WARNINGS=1 /D_CRT_SECURE_NO_WARNINGS=1") +else() +endif() + +message ("cxx Flags: " ${CMAKE_CXX_FLAGS}) + +macro(GroupSources curdir) + file(GLOB children RELATIVE ${PROJECT_SOURCE_DIR}/${curdir} ${PROJECT_SOURCE_DIR}/${curdir}/*) + foreach(child ${children}) + if(IS_DIRECTORY ${PROJECT_SOURCE_DIR}/${curdir}/${child}) + GroupSources(${curdir}/${child}) + elseif(${child} STREQUAL "CMakeLists.txt") + source_group("" FILES ${PROJECT_SOURCE_DIR}/${curdir}/${child}) + else() + string(REPLACE "/" "\\" groupname ${curdir}) + string(REPLACE "src" "Common" groupname ${groupname}) + source_group(${groupname} FILES ${PROJECT_SOURCE_DIR}/${curdir}/${child}) + endif() + endforeach() +endmacro() + +include_directories (include) + +file(GLOB_RECURSE BEAST_INCLUDES + ${PROJECT_SOURCE_DIR}/include/beast/*.hpp + ${PROJECT_SOURCE_DIR}/include/beast/*.ipp +) + +add_subdirectory (test) +add_subdirectory (examples) + +#enable_testing() diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt new file mode 100644 index 0000000000..5b193b4468 --- /dev/null +++ b/examples/CMakeLists.txt @@ -0,0 +1,30 @@ +# Part of Beast + +GroupSources(include/beast) +GroupSources(examples) + +add_executable (http-crawl + ${BEAST_INCLUDES} + http_crawl.cpp + urls_large_data.cpp +) + +add_executable (http-server + ${BEAST_INCLUDES} + http_server.cpp +) + +add_executable (http-example + ${BEAST_INCLUDES} + http_example.cpp +) + +add_executable (websocket-echo + ${BEAST_INCLUDES} + websocket_echo.cpp +) + +add_executable (websocket-example + ${BEAST_INCLUDES} + websocket_example.cpp +) diff --git a/examples/Jamfile b/examples/Jamfile index 2f438baaca..fade6b0b85 100644 --- a/examples/Jamfile +++ b/examples/Jamfile @@ -16,14 +16,14 @@ exe http_server : http_server.cpp ; -exe websocket_echo : - websocket_echo.cpp - ; - exe http_example : http_example.cpp ; +exe websocket_echo : + websocket_echo.cpp + ; + exe websocket_example : websocket_example.cpp ; diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt new file mode 100644 index 0000000000..ab83bdb767 --- /dev/null +++ b/test/CMakeLists.txt @@ -0,0 +1,82 @@ +# Part of Beast + +GroupSources(include/beast) +GroupSources(test) + +set(CORE_TESTS_SRCS + main.cpp + async_completion.cpp + basic_streambuf.cpp + bind_handler.cpp + buffer_cat.cpp + buffers_adapter.cpp + buffers_debug.cpp + consuming_buffers.cpp + handler_alloc.cpp + placeholders.cpp + prepare_buffers.cpp + static_streambuf.cpp + streambuf.cpp + streambuf_readstream.cpp + type_check.cpp + detail/base64.cpp + detail/empty_base_optimization.cpp +) + +add_executable (core-tests + ${BEAST_INCLUDES} + ${CORE_TESTS_SRCS} +) + +set(HTTP_TESTS_SRCS + main.cpp + http/basic_headers.cpp + http/basic_parser.cpp + http/chunk_encode.cpp + http/empty_body.cpp + http/error.cpp + http/headers.cpp + http/message.cpp + http/method.cpp + http/parse_error.cpp + http/parser.cpp + http/read.cpp + http/reason.cpp + http/resume_context.cpp + http/rfc2616.cpp + http/rfc7230.cpp + http/streambuf_body.cpp + http/string_body.cpp + http/write.cpp +) + +add_executable (http-tests + ${BEAST_INCLUDES} + ${HTTP_TESTS_SRCS} +) + +set(WEBSOCKET_TESTS_SRCS + main.cpp + websocket/error.cpp + websocket/option.cpp + websocket/rfc6455.cpp + websocket/static_string.cpp + websocket/teardown.cpp + websocket/utf8_checker.cpp +) + +add_executable (websocket-tests + ${BEAST_INCLUDES} + ${WEBSOCKET_TESTS_SRCS} +) + +set(PARSER_BENCH_SRCS + main.cpp + http/nodejs_parser.cpp + http/parser_bench.cpp +) + +add_executable (parser-bench + ${BEAST_INCLUDES} + ${PARSER_BENCH_SRCS} +)