Add CMake scripts

This commit is contained in:
Vinnie Falco
2016-04-28 07:54:36 -04:00
parent cf0cea38fd
commit 8dad543671
4 changed files with 157 additions and 4 deletions

41
CMakeLists.txt Normal file
View File

@@ -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()

30
examples/CMakeLists.txt Normal file
View File

@@ -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
)

View File

@@ -16,14 +16,14 @@ exe http_server :
http_server.cpp http_server.cpp
; ;
exe websocket_echo :
websocket_echo.cpp
;
exe http_example : exe http_example :
http_example.cpp http_example.cpp
; ;
exe websocket_echo :
websocket_echo.cpp
;
exe websocket_example : exe websocket_example :
websocket_example.cpp websocket_example.cpp
; ;

82
test/CMakeLists.txt Normal file
View File

@@ -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}
)