summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorManuel Bentele2021-03-11 17:05:24 +0100
committerManuel Bentele2021-03-11 18:18:37 +0100
commitf5a3dd5fa08f39c2331e0a4faf42ece96dc3d93b (patch)
treec2668341163510210832887b91c301dd9b712d99
parent[BUILD] Enable lint targets if lint programs are found (diff)
downloaddnbd3-f5a3dd5fa08f39c2331e0a4faf42ece96dc3d93b.tar.gz
dnbd3-f5a3dd5fa08f39c2331e0a4faf42ece96dc3d93b.tar.xz
dnbd3-f5a3dd5fa08f39c2331e0a4faf42ece96dc3d93b.zip
[BUILD] Build picohttpparser as independent library
-rw-r--r--src/server/CMakeLists.txt7
-rw-r--r--src/server/picohttpparser/.clang-format12
-rw-r--r--src/server/picohttpparser/CMakeLists.txt11
3 files changed, 15 insertions, 15 deletions
diff --git a/src/server/CMakeLists.txt b/src/server/CMakeLists.txt
index 915da74..1db5f06 100644
--- a/src/server/CMakeLists.txt
+++ b/src/server/CMakeLists.txt
@@ -50,7 +50,6 @@ set(DNBD3_SERVER_SOURCE_FILES ${CMAKE_CURRENT_SOURCE_DIR}/altservers.c
${CMAKE_CURRENT_SOURCE_DIR}/integrity.c
${CMAKE_CURRENT_SOURCE_DIR}/locks.c
${CMAKE_CURRENT_SOURCE_DIR}/net.c
- ${CMAKE_CURRENT_SOURCE_DIR}/picohttpparser/picohttpparser.c
${CMAKE_CURRENT_SOURCE_DIR}/reference.c
${CMAKE_CURRENT_SOURCE_DIR}/rpc.c
${CMAKE_CURRENT_SOURCE_DIR}/server.c
@@ -67,7 +66,6 @@ set(DNBD3_SERVER_HEADER_FILES ${CMAKE_CURRENT_SOURCE_DIR}/altservers.h
${CMAKE_CURRENT_SOURCE_DIR}/integrity.h
${CMAKE_CURRENT_SOURCE_DIR}/locks.h
${CMAKE_CURRENT_SOURCE_DIR}/net.h
- ${CMAKE_CURRENT_SOURCE_DIR}/picohttpparser/picohttpparser.h
${CMAKE_CURRENT_SOURCE_DIR}/reference.h
${CMAKE_CURRENT_SOURCE_DIR}/reftypes.h
${CMAKE_CURRENT_SOURCE_DIR}/rpc.h
@@ -78,7 +76,7 @@ set(DNBD3_SERVER_HEADER_FILES ${CMAKE_CURRENT_SOURCE_DIR}/altservers.h
add_executable(dnbd3-server ${DNBD3_SERVER_SOURCE_FILES})
target_include_directories(dnbd3-server PRIVATE ${JANSSON_INCLUDE_DIR})
-target_link_libraries(dnbd3-server dnbd3-version dnbd3-build dnbd3-shared Libatomic::Libatomic ${CMAKE_THREAD_LIBS_INIT} ${JANSSON_LIBRARIES})
+target_link_libraries(dnbd3-server dnbd3-version dnbd3-build dnbd3-shared picohttpparser Libatomic::Libatomic ${CMAKE_THREAD_LIBS_INIT} ${JANSSON_LIBRARIES})
if(DNBD3_SERVER_FUSE)
find_package(Fuse REQUIRED)
@@ -108,3 +106,6 @@ install(TARGETS dnbd3-server RUNTIME DESTINATION bin
add_linter(dnbd3-server-lint "${DNBD3_SERVER_SOURCE_FILES}" "${DNBD3_SERVER_HEADER_FILES}")
add_linter_fix(dnbd3-server-lint-fix "${DNBD3_SERVER_SOURCE_FILES}" "${DNBD3_SERVER_HEADER_FILES}")
+
+# add external dependency (HTTP parser) for the dnbd3-server
+add_subdirectory(picohttpparser)
diff --git a/src/server/picohttpparser/.clang-format b/src/server/picohttpparser/.clang-format
deleted file mode 100644
index 8738fdd..0000000
--- a/src/server/picohttpparser/.clang-format
+++ /dev/null
@@ -1,12 +0,0 @@
-# SPDX-License-Identifier: GPL-2.0
-#
-# clang-format configuration file. Intended for clang-format >= 4.
-#
-# For more information, see:
-#
-# Documentation/process/clang-format.rst
-# https://clang.llvm.org/docs/ClangFormat.html
-# https://clang.llvm.org/docs/ClangFormatStyleOptions.html
-#
----
-DisableFormat: true
diff --git a/src/server/picohttpparser/CMakeLists.txt b/src/server/picohttpparser/CMakeLists.txt
new file mode 100644
index 0000000..cc6ec96
--- /dev/null
+++ b/src/server/picohttpparser/CMakeLists.txt
@@ -0,0 +1,11 @@
+cmake_minimum_required(VERSION 3.10)
+
+# set the project name
+project(picohttpparser
+ LANGUAGES C)
+
+set(PICOHTTPPARSER_SOURCE_FILES ${CMAKE_CURRENT_SOURCE_DIR}/picohttpparser.c)
+set(PICOHTTPPARSER_HEADER_FILES ${CMAKE_CURRENT_SOURCE_DIR}/picohttpparser.h)
+
+add_library(picohttpparser STATIC ${PICOHTTPPARSER_SOURCE_FILES})
+target_include_directories(picohttpparser PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})