私の Qt プロジェクトの一部として、Web サービスとして WSO2 WSF/C++ モジュールがあります。このモジュールをビルドする手順は、CLI (Windows 環境) で非常に簡単です。
コンパイルする:
cl.exe /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "AXIS2_DECLARE_EXPORT" /D "AXIS2_SVR_MULTI_THREADED" /w /nologo /I %WSFCPP_HOME%\include /c hello.cpp
リンクすること:
link.exe /nologo /LIBPATH:%WSFCPP_HOME%\lib axutil.lib axiom.lib axis2_parser.lib axis2_engine.lib wso2_wsf.lib /DLL /OUT:hello.dll *.obj
ビルド プロセスを自動化するために、これらの手順を .pro ファイルに統合したいと考えています。しかし、私はどのように進むべきか全くわかりません。助言がありますか?
編集:これが私の現在のコードです:
project.pro
TEMPLATE = lib
CONFIG += dll
CONFIG -= qt
VERSION = 1.0
TARGET = hello
SOURCES += hello.cpp
HEADERS += hello.hpp
DEFINES += AXIS2_DECLARE_EXPORT AXIS2_SVR_MULTI_THREADED
INCLUDEPATH += "C:\wsfcpp\include"
LIBS += \
-L"C:\wsfcpp\lib" -laxutil \
-laxiom \
-laxis2_parser \
-laxis2_engine \
-lwso2_wsf
こんにちは.hpp
#ifndef HELLO_H
#define HELLO_H
#include <ServiceSkeleton.h>
using namespace wso2wsf;
class Hello : public ServiceSkeleton
{
public:
WSF_EXTERN WSF_CALL Hello(){};
OMElement* WSF_CALL invoke(OMElement *message, MessageContext *msgCtx);
OMElement* WSF_CALL onFault(OMElement *message);
void WSF_CALL init();
OMElement* greet(OMElement *inMsg);
};
#endif // HELLO_H
こんにちは.cpp
#include <ServiceSkeleton.h>
#include <iostream>
#include <stdio.h>
#include <axutil_env.h>
#include <Environment.h>
#include <OMText.h>
#include "hello.hpp"
using namespace wso2wsf;
using namespace std;
/** Load the service into axis2 engine */
WSF_SERVICE_INIT(Hello)
OMElement* Hello::invoke(OMElement *ele, MessageContext *msgCtx)
{
return greet(ele);
}
OMElement* Hello::onFault(OMElement *ele)
{
OMElement *responseEle = new OMElement("HelloServiceErrorResponse");
responseEle->setText("Hello Service Failed");
return responseEle;
}
void Hello::init()
{
}
OMElement* Hello::greet(OMElement* inMsg)
{
OMElement *helloEle = new OMElement("greetResponse");
OMElement *text = new OMElement("text");
helloEle->setText(greet);
return helloEle;
}