move build system to cmake
This commit is contained in:
parent
c31db4d2a8
commit
734e37de37
|
@ -1,8 +1,10 @@
|
|||
FROM alpine as build-env
|
||||
|
||||
RUN apk add --no-cache build-base python3
|
||||
RUN apk add --no-cache build-base python3 cmake
|
||||
COPY ./src/ .
|
||||
RUN make build-release
|
||||
RUN rm -rf CMakeCache.txt CMakeFiles
|
||||
RUN cmake -DCMAKE_BUILD_TYPE=Release .
|
||||
RUN make anthracite-bin
|
||||
|
||||
FROM alpine
|
||||
RUN apk add --no-cache build-base
|
||||
|
|
34
src/Makefile
34
src/Makefile
|
@ -1,34 +0,0 @@
|
|||
.PHONY: format lint build build-release build-docker run debug
|
||||
|
||||
build-supplemental:
|
||||
cd ./build && ./version.sh && python3 ./error_gen.py
|
||||
|
||||
build: build-supplemental
|
||||
g++ main.cpp --std=c++20 -g -o ./anthracite
|
||||
|
||||
build-release: build-supplemental
|
||||
g++ main.cpp --std=c++20 -O3 -o ./anthracite
|
||||
|
||||
build-docker:
|
||||
docker build . -t anthracite
|
||||
|
||||
run: build
|
||||
./anthracite 8080
|
||||
|
||||
run-test: build
|
||||
./anthracite 8080 ./test_www
|
||||
|
||||
debug: build
|
||||
gdb --args ./anthracite 8080
|
||||
|
||||
debug-test: build
|
||||
gdb --args ./anthracite 8080 ./test_www
|
||||
|
||||
format:
|
||||
clang-format *.cpp -i
|
||||
|
||||
lint:
|
||||
clang-tidy *.cpp
|
||||
|
||||
lint-fix:
|
||||
clang-tidy *.cpp -fix -fix-errors
|
|
@ -19,9 +19,9 @@ constexpr int max_worker_threads = 128;
|
|||
|
||||
void handle_client(anthracite_socket s, backend& b, file_backend& fb, std::mutex& thread_wait_mutex, std::condition_variable& thread_wait_condvar, int& active_threads)
|
||||
{
|
||||
while(true) {
|
||||
while (true) {
|
||||
std::string raw_request = s.recv_message(HTTP_HEADER_BYTES);
|
||||
if(raw_request == "") {
|
||||
if (raw_request == "") {
|
||||
break;
|
||||
}
|
||||
http_request req(raw_request, s.get_client_ip());
|
||||
|
@ -31,7 +31,7 @@ void handle_client(anthracite_socket s, backend& b, file_backend& fb, std::mutex
|
|||
s.send_message(header);
|
||||
s.send_message(resp->content());
|
||||
resp.reset();
|
||||
if(req.close_connection()) {
|
||||
if (req.close_connection()) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,9 +6,9 @@
|
|||
#include <netinet/in.h>
|
||||
#include <sstream>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/time.h>
|
||||
#include <unistd.h>
|
||||
#include <unordered_map>
|
||||
#include <sys/time.h>
|
||||
|
||||
constexpr int MAX_QUEUE_LENGTH = 100;
|
||||
|
||||
|
|
Loading…
Reference in a new issue