Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 4 additions & 11 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
cmake_minimum_required(VERSION 3.15)
project(http_server VERSION 1.0 LANGUAGES C CXX)
project(http_server_library VERSION 1.0 LANGUAGES C CXX)

add_subdirectory(demo)

set(LIBRARY "server_library")
set(TEST_TARGET "server_tests_bin")
set(TARGET "server_impl_bin")
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)

# Override Debug flags
Expand All @@ -17,7 +18,7 @@ find_package(Threads REQUIRED)


# server library
add_library(${LIBRARY}
add_library(${LIBRARY} STATIC
src/HttpServer.cpp
src/HttpParser.cpp
src/PathParams.cpp
Expand Down Expand Up @@ -47,14 +48,6 @@ include(GoogleTest)
gtest_discover_tests(${TEST_TARGET})


# server implementation executable
add_executable(${TARGET}
src/main.cpp
)
target_link_options(${TARGET} PRIVATE -O0 -g --coverage)
target_link_libraries(${TARGET} PRIVATE ${LIBRARY})


# coverage target
# find required tools
find_program(LCOV lcov REQUIRED)
Expand Down
11 changes: 6 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,9 @@ try {
.
├── src/ # Server implementation
├── include/ # Public headers
├── tests/ # gtest-based test suite
├── cmake/ # CMake helpers
├── test/ # gtest-based test suite
├── demo/ # demo of the library implementation
├── benchmarks/ # k6 performance benchmark outputs with a node server comparison
├── .github/ # GitHub Actions workflows
└── README.md
```
Expand Down Expand Up @@ -186,16 +187,16 @@ conan build . --build=missing -s build_type=Debug

---

## Running the Server
## Running the Server Demo

Command to run the HTTP server implementation example:

```bash
# in release mode
./build/Release/server_impl_bin
./build/Release/demo/server_demo_bin

# in debug mode
./build/Debug/server_impl_bin
./build/Debug/demo/server_demo_bin
```

---
Expand Down
19 changes: 19 additions & 0 deletions demo/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
cmake_minimum_required(VERSION 3.15)
project(server_demo VERSION 1.0 LANGUAGES C CXX)

set(LIBRARY "server_library")
set(TARGET "server_demo_bin")
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)

# Override Debug flags
set(CMAKE_CXX_FLAGS_DEBUG "-g -O0 --coverage")
set(CMAKE_C_FLAGS_DEBUG "-g -O0 --coverage")
set(CMAKE_EXE_LINKER_FLAGS_DEBUG "--coverage")
set(CMAKE_SHARED_LINKER_FLAGS_DEBUG "--coverage")


# server implementation executable
add_executable(${TARGET}
main.cpp
)
target_link_libraries(${TARGET} PRIVATE ${LIBRARY})
File renamed without changes.
2 changes: 1 addition & 1 deletion test/HttpParserTest.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include <gtest/gtest.h>
#include "../include/HttpParser.h"
#include "HttpParser.h"

#include <arpa/inet.h>
#include <netinet/in.h>
Expand Down
Loading