Fixed compilation of swiften plugin for win32

This commit is contained in:
Vitaly Takmazov 2012-05-22 12:28:26 +04:00
parent 8f2ea32da3
commit f68020a6ba
3 changed files with 10 additions and 2 deletions

View file

@ -7,8 +7,6 @@ if (PROTOBUF_FOUND)
ADD_SUBDIRECTORY(libcommuni)
endif()
ADD_SUBDIRECTORY(smstools3)
ADD_SUBDIRECTORY(swiften)
ADD_SUBDIRECTORY(template)

View file

@ -4,7 +4,11 @@ FILE(GLOB SRC *.cpp)
ADD_EXECUTABLE(spectrum2_swiften_backend ${SRC})
IF (NOT WIN32)
target_link_libraries(spectrum2_swiften_backend transport pthread ${Boost_LIBRARIES} ${SWIFTEN_LIBRARY} ${LOG4CXX_LIBRARIES})
else()
target_link_libraries(spectrum2_swiften_backend transport ${Boost_LIBRARIES} ${SWIFTEN_LIBRARY} ${LOG4CXX_LIBRARIES})
endif()
INSTALL(TARGETS spectrum2_swiften_backend RUNTIME DESTINATION bin)

View file

@ -6,11 +6,13 @@
// Swiften
#include "Swiften/Swiften.h"
#ifndef WIN32
// for signal handler
#include "unistd.h"
#include "signal.h"
#include "sys/wait.h"
#include "sys/signal.h"
#endif
// malloc_trim
#include "malloc.h"
@ -231,6 +233,7 @@ class SwiftenPlugin : public NetworkPlugin {
std::map<std::string, boost::shared_ptr<Swift::Client> > m_users;
};
#ifndef WIN32
static void spectrum_sigchld_handler(int sig)
{
int status;
@ -246,16 +249,19 @@ static void spectrum_sigchld_handler(int sig)
perror(errmsg);
}
}
#endif
int main (int argc, char* argv[]) {
std::string host;
int port;
#ifndef WIN32
if (signal(SIGCHLD, spectrum_sigchld_handler) == SIG_ERR) {
std::cout << "SIGCHLD handler can't be set\n";
return -1;
}
#endif
boost::program_options::options_description desc("Usage: spectrum [OPTIONS] <config_file.cfg>\nAllowed options");
desc.add_options()