Skip to content

Commit

Permalink
Add Qompoter support and export
Browse files Browse the repository at this point in the history
  • Loading branch information
oliviermaridat committed Dec 1, 2016
1 parent 499786e commit f7fc160
Show file tree
Hide file tree
Showing 13 changed files with 3,415 additions and 17 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ build/
docs/
res/keys
res/
vendor
build.properties
commit-*
TODO.md

# vim/neovim / YouCompleteMe
Expand Down
8 changes: 8 additions & 0 deletions build.properties.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
config.job=2
config.qtversion=5
config.qompotercmd=./qompoter.sh
config.qmakecmd=qmake-qt${config.qtversion}
config.makecmd=make
config.qompoterrepo=/Project/PlateformeVehiculeElectrique/qompoter
config.os=linux
config.arch=64
133 changes: 133 additions & 0 deletions build.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
<?xml version="1.0" encoding="UTF-8"?>
<project name="qhttp" default="build">
<property name="appname" value="${ant.project.name}" />
<property name="workspace" value="${basedir}/build-ant" />
<property name="sourcedir" value="${basedir}/src" />
<property name="builddir" value="${workspace}" />
<property name="docdir" value="${basedir}/docs/${appname}" />
<property file="build.properties.dist"/>

<target name="prebuild" depends="prepare,qompoter"/>
<target name="build" depends="qmake,make"/>
<target name="build-test" depends="qmake,make,unittest"/>
<target name="build-ci" depends="clean,prebuild,build,install,cppcheck"/>

<target name="clean" description="Cleanup build artifacts">
<delete dir="${basedir}/vendor" />
<delete dir="${builddir}" />
<delete dir="${builddir}/unittest" />
<delete dir="${builddir}/coverage" />
<delete dir="${builddir}/cppcheck" />
<delete dir="${docdir}" />
</target>

<target name="prepare" description="Prepare for build">
<mkdir dir="${builddir}/unittest" />
<mkdir dir="${builddir}/coverage" />
<mkdir dir="${builddir}/cppcheck" />
<mkdir dir="${builddir}/../docs" />
<mkdir dir="${docdir}" />
<exec executable="${config.qmakecmd}">
<arg value="--version" />
</exec>
</target>

<target name="qompoter" description="Retrieve dependencies">
<exec executable="${config.qompotercmd}" dir="${basedir}" failonerror="true">
<arg value="install" />
<arg value="--repo" />
<arg value="${config.qompoterrepo}" />
</exec>
</target>

<target name="qmake" description="Prebuild">
<exec executable="${config.qmakecmd}" dir="${builddir}" failonerror="true">
<arg value="../${appname}.pro" />
<arg value="-r" />
<arg value="-spec" />
<arg value="${config.os}-g++-${config.arch}" />
<arg value="EXPORT_PATH_PREFIX=${config.qompoterrepo}" />
</exec>
</target>

<target name="make" description="Build">
<exec executable="${config.makecmd}" dir="${builddir}" failonerror="true">
<arg value="-j" />
<arg value="${config.job}" />
</exec>
</target>

<target name="install" description="Install">
<exec executable="${config.makecmd}" dir="${builddir}" failonerror="true">
<arg value="install" />
</exec>
</target>

<target name="unittest" description="Run unit tests with QTestLib">
<exec
executable="./${appname}"
dir="${builddir}/test/release/build_${config.os}_${config.arch}"
output="${builddir}/unittest/unittest-log-${appname}.txt"
failonerror="true">
<env key="LD_LIBRARY_PATH" value="${basedir}/vendor/lib_${config.os}_${config.arch}" />
<arg value="-xml" />
<arg value="-logdir" />
<arg value="${builddir}/unittest" />
<arg value="-o" />
</exec>
<concat>
<fileset dir="${builddir}/unittest" />
</concat>
</target>

<target name="coverage" description="Compute unit tests coverage">
<exec
executable="gcovr"
dir="${builddir}/test">
<arg value="-kbpu" />
<arg value="--xml" />
<arg value="-e" />
<arg value=".*moc_.*" />
<arg value="-e" />
<arg value=".*Test\..*" />
<arg value="-e" />
<arg value=".*vendor/.*" />
<arg value="-e" />
<arg value=".*release/.*" />
<arg value="-e" />
<arg value=".*docs/.*" />
<arg value="-e" />
<arg value=".*export/.*" />
<arg value="-e" />
<arg value=".*TestRunner\.cpp" />
<arg value="-e" />
<arg value=".*qrc_resources\.cpp" />
<arg value="-e" />
<arg value=".*\.h" />
<arg value="-e" />
<arg value=".*c\+\+/.*" />
<arg value="-o" />
<arg value="${builddir}/coverage/coverage.xml" />
</exec>
</target>

<target name="cppcheck" description="Find coding standard violations">
<exec
executable="cppcheck" dir="${basedir}"
error="${builddir}/cppcheck/cppcheck.xml">
<arg value="--enable=all" />
<arg value="--inconclusive" />
<arg value="--xml" />
<arg value="--xml-version=2" />
<arg value="${sourcedir}" />
</exec>
</target>

<target name="doc" description="Generate documentation">
<exec
executable="doxygen"
dir="${basedir}">
</exec>
</target>

</project>
5 changes: 2 additions & 3 deletions commondir.pri
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,12 @@ win32 {
DEFINES += _WINDOWS WIN32_LEAN_AND_MEAN NOMINMAX
}


DESTDIR = $$PRJDIR/xbin
DESTDIR = $$OUT_PWD/$$PRJDIR/xbin
MOC_DIR = $$TEMPDIR
OBJECTS_DIR = $$TEMPDIR
RCC_DIR = $$TEMPDIR
UI_DIR = $$TEMPDIR/Ui
LIBS += -L$$PRJDIR/xbin
LIBS += -L$$OUT_PWD/$$PRJDIR/xbin

INCLUDEPATH += . $$PRJDIR/src $$PRJDIR/3rdparty

3 changes: 2 additions & 1 deletion example/basic-server/basic-server.pro
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,5 @@ HEADERS +=

SOURCES += main.cpp

LIBS += -lqhttp
include($$PWD/../../vendor/qompote.pri)
LIBS += -L$${OUT_PWD}/../../src -l$$getLibName(qhttp, "Qt")
4 changes: 3 additions & 1 deletion example/helloworld/helloworld.pro
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,6 @@ HEADERS +=

SOURCES += main.cpp

LIBS += -lqhttp
include($$PWD/../../vendor/qompote.pri)
LIBS += -L$${OUT_PWD}/../../src -l$$getLibName(qhttp, "Qt")

4 changes: 3 additions & 1 deletion example/keep-alive/keep-alive.pro
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,6 @@ HEADERS +=

SOURCES += main.cpp

LIBS += -lqhttp
include($$PWD/../../vendor/qompote.pri)
LIBS += -L$${OUT_PWD}/../../src -l$$getLibName(qhttp, "Qt")

3 changes: 2 additions & 1 deletion example/postcollector/postcollector.pro
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,5 @@ HEADERS +=

SOURCES += main.cpp

LIBS += -lqhttp
include($$PWD/../../vendor/qompote.pri)
LIBS += -L$${OUT_PWD}/../../src -l$$getLibName(qhttp, "Qt")
13 changes: 13 additions & 0 deletions qhttp.pro
Original file line number Diff line number Diff line change
@@ -1,6 +1,19 @@
TEMPLATE = subdirs

APPNAME=qhttp
SUBDIRS += src
SUBDIRS += example

example.depends = src

OTHER_FILES += \
build.properties \
build.xml \
qompoter.json \
qompoter.pri \
README.md \
changelogs.md \

include($$PWD/vendor/qompote.pri)
$$setBuildDir()
message("$$APPNAME [ build folder is $$OBJECTS_DIR ]")
17 changes: 17 additions & 0 deletions qompoter.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"name": "azadkuh/qhttp",
"description": "a light-weight and asynchronous HTTP library (both server & client) in Qt5 and c++14",
"keywords": ["Qt", "C++", "HTTP"],
"authors": [
{
"name": "azadkuh",
"homepage": "https://github.com/azadkuh"
}
],
"require": {
"nodejs/http-parser": "v2.7.0"
},
"repositories": {
"nodejs/http-parser": "https://github.com"
}
}
57 changes: 57 additions & 0 deletions qompoter.pri
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
qhttp-lib {
DEFINES += QOMP_QHTTP
QOMP_NAME_QHTTP=qhttp

LIBNAME = $$QOMP_NAME_QHTTP
IMPORT_INCLUDEPATH = $$PWD/$$QOMP_NAME_QHTTP/include
IMPORT_LIBPATH = $$PWD/$$LIBPATH
INCLUDEPATH += $$IMPORT_INCLUDEPATH
LIBS += -L$$IMPORT_LIBPATH -l$$getLibName($${LIBNAME}, "Qt")
}

qhttp {
DEFINES += QOMP_QHTTP
QOMP_NAME_QHTTP=qhttp

HEADERS += \
$$PWD/http-parser/http_parser.h \
$$PWD/$$QOMP_NAME_QHTTP/src/qhttpfwd.hpp \
$$PWD/$$QOMP_NAME_QHTTP/src/qhttpabstracts.hpp \
$$PWD/$$QOMP_NAME_QHTTP/src/qhttpserverconnection.hpp \
$$PWD/$$QOMP_NAME_QHTTP/src/qhttpserverrequest.hpp \
$$PWD/$$QOMP_NAME_QHTTP/src/qhttpserverresponse.hpp \
$$PWD/$$QOMP_NAME_QHTTP/src/qhttpserver.hpp \
$$PWD/$$QOMP_NAME_QHTTP/src/private/qhttpbase.hpp \
$$PWD/$$QOMP_NAME_QHTTP/src/private/qhttpserverconnection_private.hpp \
$$PWD/$$QOMP_NAME_QHTTP/src/private/qhttpserverrequest_private.hpp \
$$PWD/$$QOMP_NAME_QHTTP/src/private/qhttpserverresponse_private.hpp \
$$PWD/$$QOMP_NAME_QHTTP/src/private/qhttpserver_private.hpp \
$$PWD/$$QOMP_NAME_QHTTP/src/private/qhttpclientrequest_private.hpp \
$$PWD/$$QOMP_NAME_QHTTP/src/private/qhttpclientresponse_private.hpp \
$$PWD/$$QOMP_NAME_QHTTP/src/private/qhttpclient_private.hpp \

SOURCES += \
$$PWD/http-parser/http_parser.c \
$$PWD/$$QOMP_NAME_QHTTP/src/qhttpabstracts.cpp \
$$PWD/$$QOMP_NAME_QHTTP/src/qhttpserverconnection.cpp \
$$PWD/$$QOMP_NAME_QHTTP/src/qhttpserverrequest.cpp \
$$PWD/$$QOMP_NAME_QHTTP/src/qhttpserverresponse.cpp \
$$PWD/$$QOMP_NAME_QHTTP/src/qhttpserver.cpp

contains(DEFINES, QHTTP_HAS_CLIENT) {
HEADERS += \
$$PWD/$$QOMP_NAME_QHTTP/src/qhttpclient.hpp \
$$PWD/$$QOMP_NAME_QHTTP/src/qhttpclientresponse.hpp \
$$PWD/$$QOMP_NAME_QHTTP/src/qhttpclientrequest.hpp

SOURCES += \
$$PWD/$$QOMP_NAME_QHTTP/src/qhttpclientrequest.cpp \
$$PWD/$$QOMP_NAME_QHTTP/src/qhttpclientresponse.cpp \
$$PWD/$$QOMP_NAME_QHTTP/src/qhttpclient.cpp
}

INCLUDEPATH += \
$$PWD/$$QOMP_NAME_QHTTP \
$$PWD/$$QOMP_NAME_QHTTP/src \
$$PWD/$$QOMP_NAME_QHTTP/vendor
}
Loading

0 comments on commit f7fc160

Please sign in to comment.