From 8daf2ea0a7192e556cc059c2220469ea22155380 Mon Sep 17 00:00:00 2001 From: Stefan Radomski Date: Tue, 8 Oct 2013 02:24:59 +0200 Subject: More fixes for MSVC --- CMakeLists.txt | 5 ++++- src/uscxml/Common.h | 2 ++ .../plugins/datamodel/xpath/XPathDataModel.cpp | 3 +-- test/CMakeLists.txt | 13 ++++++------ test/src/test-w3c.cpp | 24 ++-------------------- 5 files changed, 16 insertions(+), 31 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 077368a..b1d5bcf 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -688,6 +688,9 @@ SET(USCXML_LANGUAGE_BINDINGS) add_subdirectory(src/uscxml) include_directories(${USCXML_INCLUDE_DIRS}) +if (WIN32) + list(APPEND USCXML_FILES "${PROJECT_SOURCE_DIR}/contrib/src/getopt/getopt.c") +endif() if (UNIX AND NOT APPLE) list (APPEND USCXML_CORE_LIBS "rt") @@ -757,7 +760,7 @@ if (NOT CMAKE_CROSSCOMPILING) endif() if (NOT CMAKE_CROSSCOMPILING) - add_executable(uscxml-browser apps/uscxml-browser.cpp ${PROJECT_SOURCE_DIR}/contrib/src/getopt/XGetopt.cpp) + add_executable(uscxml-browser apps/uscxml-browser.cpp) target_link_libraries(uscxml-browser uscxml) set_target_properties(uscxml-browser PROPERTIES FOLDER "Apps") install_executable(TARGETS uscxml-browser COMPONENT tools) diff --git a/src/uscxml/Common.h b/src/uscxml/Common.h index f73e8bd..09785be 100644 --- a/src/uscxml/Common.h +++ b/src/uscxml/Common.h @@ -5,7 +5,9 @@ #include // see http://stackoverflow.com/questions/1372480/c-redefinition-header-files #define _WINSOCKAPI_ // stops windows.h including winsock.h +#define WIN32_LEAN_AND_MEAN #include +#undef WIN32_LEAN_AND_MEAN #else #include #endif diff --git a/src/uscxml/plugins/datamodel/xpath/XPathDataModel.cpp b/src/uscxml/plugins/datamodel/xpath/XPathDataModel.cpp index ee74a5f..c155644 100644 --- a/src/uscxml/plugins/datamodel/xpath/XPathDataModel.cpp +++ b/src/uscxml/plugins/datamodel/xpath/XPathDataModel.cpp @@ -211,7 +211,7 @@ Data XPathDataModel::getStringAsData(const std::string& content) { switch (result.type()) { case ANY: break; - case BOOL: + case Arabica::XPath::BOOL: ss << result.asBool(); break; case NUMBER: @@ -225,7 +225,6 @@ Data XPathDataModel::getStringAsData(const std::string& content) { for (int i = 0; i < ns.size(); i++) { ss << ns[i]; } - ss << result; break; } diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 51fe962..4fba8a5 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -68,11 +68,12 @@ if (NOT WIN32) add_test(test-stress ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/test-stress ${CMAKE_SOURCE_DIR}/test/samples/w3c) set_target_properties(test-stress PROPERTIES FOLDER "Tests") - add_executable(test-instant-messaging src/test-instant-messaging.cpp) - target_link_libraries(test-instant-messaging uscxml) - add_test(test-instant-messaging ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/test-instant-messaging) - set_target_properties(test-instant-messaging PROPERTIES FOLDER "Tests") - + if (LIBPURPLE_FOUND) + add_executable(test-instant-messaging src/test-instant-messaging.cpp) + target_link_libraries(test-instant-messaging uscxml) + add_test(test-instant-messaging ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/test-instant-messaging) + set_target_properties(test-instant-messaging PROPERTIES FOLDER "Tests") + endif() endif() add_executable(test-url src/test-url.cpp) @@ -113,7 +114,7 @@ set_target_properties(scxml-test-framework-client PROPERTIES FOLDER "Tests") # add_test(test-curl-multi-api ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/test-completion) # set_target_properties(test-curl-multi-api PROPERTIES FOLDER "Tests") - add_executable(test-w3c src/test-w3c.cpp ${PROJECT_SOURCE_DIR}/contrib/src/getopt/XGetopt.cpp) + add_executable(test-w3c src/test-w3c.cpp) target_link_libraries(test-w3c uscxml) set_target_properties(test-w3c PROPERTIES FOLDER "Tests") diff --git a/test/src/test-w3c.cpp b/test/src/test-w3c.cpp index e89ab2c..94cafa4 100644 --- a/test/src/test-w3c.cpp +++ b/test/src/test-w3c.cpp @@ -123,32 +123,12 @@ int main(int argc, char** argv) { google::InitGoogleLogging(argv[0]); google::LogToStderr(); -#ifndef _WIN32 - opterr = 0; -#endif - int option; - while ((option = getopt(argc, argv, "vl:p:")) != -1) { - switch(option) { - case 'l': - google::InitGoogleLogging(optarg); - break; - case 'p': - uscxml::Factory::pluginPath = optarg; - break; - case '?': - break; - default: - printUsageAndExit(); - break; - } - } - // for (int i = 0; i < argc; i++) // std::cout << argv[i] << std::endl; // std::cout << optind << std::endl; - LOG(INFO) << "Processing " << argv[optind]; - Interpreter interpreter = Interpreter::fromURI(argv[optind]); + LOG(INFO) << "Processing " << argv[1]; + Interpreter interpreter = Interpreter::fromURI(argv[1]); if (interpreter) { // interpreter.setCmdLineOptions(argc, argv); // interpreter->setCapabilities(Interpreter::CAN_NOTHING); -- cgit v0.12