diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..7855e4f --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,17 @@ +# CMake 3.1 was the first release to provide target_compile_features +cmake_minimum_required(VERSION 3.1.0) +project(qhttpengine VERSION 0.1.0 LANGUAGES CXX) + +set(PROJECT_NAME "QHttpEngine") +set(PROJECT_DESCRIPTION "Simple and secure HTTP server for Qt applications") +set(PROJECT_URL "https://github.com/nitroshare/qhttpengine") + +# Ensure that the required Qt libraries are present +find_package(Qt5Network 5.1 REQUIRED) + +# Add the build directory to the include path and automatically run MOC +set(CMAKE_INCLUDE_CURRENT_DIR ON) +set(CMAKE_AUTOMOC ON) + +# Add the source directory +add_subdirectory(src) diff --git a/LICENSE.txt b/LICENSE.txt new file mode 100644 index 0000000..d0628c6 --- /dev/null +++ b/LICENSE.txt @@ -0,0 +1,10 @@ +The MIT License (MIT) + +Copyright (c) 2015 Nathan Osman + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + diff --git a/README.md b/README.md index 64c9b60..d407659 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,13 @@ ## QHTTPEngine +[![](http://img.shields.io/badge/license-MIT-blue.svg?style=flat)](http://opensource.org/licenses/MIT) + Simple and secure HTTP server for Qt applications. + +### Build Requirements + +QHttpEngine requires a modern C++ compiler. You will also need Qt 5.1+ in order to build the library. + +### Build Instructions + +[TODO] diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt new file mode 100644 index 0000000..93d42c9 --- /dev/null +++ b/src/CMakeLists.txt @@ -0,0 +1,42 @@ +# Prepare the config and .pc files +configure_file(config.h.in "${CMAKE_CURRENT_BINARY_DIR}/config.h") +configure_file(qhttpengine.pc.in "${CMAKE_CURRENT_BINARY_DIR}/qhttpengine.pc" @ONLY) + +# Include files for the library +set(INCLUDE + "${CMAKE_CURRENT_BINARY_DIR}/config.h" + qhttprequest.h + qhttpresponse.h + qhttpserver.h +) + +# Source files for the library +set(SRC + qhttprequest.cpp + qhttpresponse.cpp + qhttpserver.cpp +) + +# Create the shared library and link it against Qt5Network +add_library(qhttpengine SHARED ${SRC}) +target_link_libraries(qhttpengine Qt5::Network) + +# Set various library properties +set_target_properties(qhttpengine PROPERTIES + DEFINE_SYMBOL QHTTPENGINE_LIBRARY + VERSION ${PROJECT_VERSION} + SOVERSION ${PROJECT_VERSION_MAJOR} +) + +# Specify the location for the target +install(TARGETS qhttpengine + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib +) + +# Specify the location to install include and .pc files +install(FILES ${INCLUDE} + DESTINATION include/qhttpengine) +install(FILES "${CMAKE_CURRENT_BINARY_DIR}/qhttpengine.pc" + DESTINATION lib/pkgconfig +) diff --git a/src/config.h.in b/src/config.h.in new file mode 100644 index 0000000..e822f14 --- /dev/null +++ b/src/config.h.in @@ -0,0 +1,38 @@ +/** + * The MIT License (MIT) + * + * Copyright (c) 2015 Nathan Osman + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + **/ + +#ifndef QHTTPENGINE_CONFIG_H +#define QHTTPENGINE_CONFIG_H + +#include + +#define QHTTPENGINE_VERSION "@PROJECT_VERSION@" + +#if defined(QHTTPENGINE_LIBRARY) +# define QHTTPENGINE_EXPORT Q_DECL_EXPORT +#else +# define QHTTPENGINE_EXPORT Q_DECL_IMPORT +#endif + +#endif // QHTTPENGINE_CONFIG_H diff --git a/src/qhttpengine.pc.in b/src/qhttpengine.pc.in new file mode 100644 index 0000000..8bf66b5 --- /dev/null +++ b/src/qhttpengine.pc.in @@ -0,0 +1,11 @@ +prefix=@CMAKE_INSTALL_PREFIX@ +exec_prefix=${prefix} +libdir=${prefix}/lib +includedir=${prefix}/include + +Name: @PROJECT_NAME@ +Description: @PROJECT_DESCRIPTION@ +URL: @PROJECT_URL@ +Version: @PROJECT_VERSION@ +Cflags: -I${includedir} +Libs: -L${libdir} -lqhttpengine diff --git a/src/qhttprequest.cpp b/src/qhttprequest.cpp new file mode 100644 index 0000000..e69de29 diff --git a/src/qhttprequest.h b/src/qhttprequest.h new file mode 100644 index 0000000..e69de29 diff --git a/src/qhttpresponse.cpp b/src/qhttpresponse.cpp new file mode 100644 index 0000000..e69de29 diff --git a/src/qhttpresponse.h b/src/qhttpresponse.h new file mode 100644 index 0000000..e69de29 diff --git a/src/qhttpserver.cpp b/src/qhttpserver.cpp new file mode 100644 index 0000000..e69de29 diff --git a/src/qhttpserver.h b/src/qhttpserver.h new file mode 100644 index 0000000..e69de29