From 045db3f61f776f8472a6ce7bd2ddbeda77cae872 Mon Sep 17 00:00:00 2001 From: Stefan Radomski Date: Sat, 21 May 2016 00:39:07 +0200 Subject: Passing all Lua tests again - might have broken external builds --- contrib/cmake/BuildLibCurl.cmake | 35 +++-- contrib/cmake/BuildLibEvent.cmake | 26 ++-- contrib/cmake/BuildURIParser.cmake | 105 +++++++++---- contrib/patches/uriparser-vs2013/uriparser.vcxproj | 168 --------------------- contrib/patches/uriparser/CMakeLists.txt | 14 ++ docs/BUILDING.md | 13 +- src/uscxml/interpreter/BasicContentExecutor.cpp | 6 +- src/uscxml/interpreter/FastMicroStep.cpp | 19 ++- src/uscxml/plugins/invoker/scxml/USCXMLInvoker.cpp | 2 +- 9 files changed, 144 insertions(+), 244 deletions(-) delete mode 100644 contrib/patches/uriparser-vs2013/uriparser.vcxproj create mode 100644 contrib/patches/uriparser/CMakeLists.txt diff --git a/contrib/cmake/BuildLibCurl.cmake b/contrib/cmake/BuildLibCurl.cmake index 61e998a..54bfe4a 100644 --- a/contrib/cmake/BuildLibCurl.cmake +++ b/contrib/cmake/BuildLibCurl.cmake @@ -1,19 +1,10 @@ include(ExternalProject) +if (WIN32) + add_definitions("-DCURL_STATICLIB") +endif() -if (UNIX) - externalproject_add(libcurl - URL https://curl.haxx.se/download/curl-7.48.0.tar.gz - URL_MD5 b2cac71029d28cb989150bac72aafab5 - BUILD_IN_SOURCE 0 - PREFIX ${CMAKE_BINARY_DIR}/deps/libcurl - CONFIGURE_COMMAND - "/configure" - "--without-ssl" - "--enable-shared" - "--prefix=" - ) -elseif (WIN32) +if (MSVC) # see https://en.wikipedia.org/wiki/Visual_C%2B%2B set(VC_VERSION 14) @@ -34,11 +25,7 @@ elseif (WIN32) elseif (MSVC_VERSION LESS 1900) set(VC_VERSION 12) endif() - - if (WIN32) - add_definitions("-DCURL_STATICLIB") - endif() - + if( CMAKE_SIZEOF_VOID_P EQUAL 8 ) externalproject_add(libcurl URL https://curl.haxx.se/download/curl-7.48.0.tar.gz @@ -60,6 +47,18 @@ elseif (WIN32) INSTALL_COMMAND ${CMAKE_COMMAND} -E copy_directory builds/libcurl-vc${VC_VERSION}-x86-release-static-ipv6-sspi-winssl ${CMAKE_BINARY_DIR}/deps/libcurl/ ) endif() +else() + externalproject_add(libcurl + URL https://curl.haxx.se/download/curl-7.48.0.tar.gz + URL_MD5 b2cac71029d28cb989150bac72aafab5 + BUILD_IN_SOURCE 0 + PREFIX ${CMAKE_BINARY_DIR}/deps/libcurl + CONFIGURE_COMMAND + "/configure" + "--without-ssl" + "--enable-shared" + "--prefix=" + ) endif() set(LIBCURL_INCLUDE_DIR ${CMAKE_BINARY_DIR}/deps/libcurl/include) diff --git a/contrib/cmake/BuildLibEvent.cmake b/contrib/cmake/BuildLibEvent.cmake index f3bbc66..79fed51 100644 --- a/contrib/cmake/BuildLibEvent.cmake +++ b/contrib/cmake/BuildLibEvent.cmake @@ -2,17 +2,7 @@ # see http://tools.cinemapub.be/opendcp/opendcp-0.19-src/contrib/CMakeLists.txt include(ExternalProject) -if (UNIX) - externalproject_add(libevent - URL https://github.com/libevent/libevent/releases/download/release-2.0.22-stable/libevent-2.0.22-stable.tar.gz - URL_MD5 c4c56f986aa985677ca1db89630a2e11 - BUILD_IN_SOURCE 0 - PREFIX ${CMAKE_BINARY_DIR}/deps/libevent - CONFIGURE_COMMAND - CFLAGS=-fPIC /configure --enable-static --enable-shared --disable-openssl --prefix= - ) - -elseif (WIN32) +if (MSVC) externalproject_add(libevent URL https://github.com/libevent/libevent/releases/download/release-2.0.22-stable/libevent-2.0.22-stable.tar.gz @@ -29,6 +19,20 @@ elseif (WIN32) ${CMAKE_COMMAND} -E copy_directory include ${CMAKE_BINARY_DIR}/deps/libevent/include && ${CMAKE_COMMAND} -E copy Win32-Code/event2/event-config.h ${CMAKE_BINARY_DIR}/deps/libevent/include/event2/ ) +else () + if (UNIX) + set(FORCE_FPIC "CFLAGS=-fPIC") + endif() + + externalproject_add(libevent + URL https://github.com/libevent/libevent/releases/download/release-2.0.22-stable/libevent-2.0.22-stable.tar.gz + URL_MD5 c4c56f986aa985677ca1db89630a2e11 + BUILD_IN_SOURCE 0 + PREFIX ${CMAKE_BINARY_DIR}/deps/libevent + CONFIGURE_COMMAND + ${FORCE_FPIC} /configure --enable-static --enable-shared --disable-openssl --prefix= + ) + endif() set(LIBEVENT_INCLUDE_DIR ${CMAKE_BINARY_DIR}/deps/libevent/include) diff --git a/contrib/cmake/BuildURIParser.cmake b/contrib/cmake/BuildURIParser.cmake index 4df11ed..b6b228b 100644 --- a/contrib/cmake/BuildURIParser.cmake +++ b/contrib/cmake/BuildURIParser.cmake @@ -1,48 +1,91 @@ include(ExternalProject) + +if (WIN32) + set(URIPARSER_LIBNAME "uriparser.lib") +elseif(UNIX) + set(URIPARSER_LIBNAME "liburiparser.a") +endif() + if (UNIX) + set(FORCE_FPIC "CFLAGS=-fPIC") + externalproject_add(uriparser URL http://ufpr.dl.sourceforge.net/project/uriparser/Sources/0.8.4/uriparser-0.8.4.zip URL_MD5 a24c9ba0fd1a2c6c75d02859bf337cfa BUILD_IN_SOURCE 0 PREFIX ${CMAKE_BINARY_DIR}/deps/uriparser - CONFIGURE_COMMAND - "CFLAGS=-fPIC" - "/configure" + CONFIGURE_COMMAND + ${FORCE_FPIC} + "/configure" "--disable-test" "--disable-doc" "--enable-static" "--prefix=" ) -elseif(WIN32) - - if( CMAKE_SIZEOF_VOID_P EQUAL 8 ) - externalproject_add(uriparser - URL http://ufpr.dl.sourceforge.net/project/uriparser/Sources/0.8.4/uriparser-0.8.4.zip - URL_MD5 a24c9ba0fd1a2c6c75d02859bf337cfa - BUILD_IN_SOURCE 1 - PREFIX ${CMAKE_BINARY_DIR}/deps/uriparser - PATCH_COMMAND - ${CMAKE_COMMAND} -E copy_directory ${PROJECT_SOURCE_DIR}/contrib/patches/uriparser-vs2013 /win32/uriparser-vs2013 - CONFIGURE_COMMAND "" - BUILD_COMMAND cd win32/uriparser-vs2013 && devenv /Upgrade uriparser.vcxproj && msbuild /p:Configuration=Release /p:Platform=x64 /t:build uriparser.vcxproj - INSTALL_COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_BINARY_DIR}/deps/uriparser/lib && ${CMAKE_COMMAND} -E copy win32/uriparser.lib ${CMAKE_BINARY_DIR}/deps/uriparser/lib/ && ${CMAKE_COMMAND} -E copy_directory include ${CMAKE_BINARY_DIR}/deps/uriparser/include - ) - else() - set(VSPROJECT_PATH "win32/Visual_Studio_2005") - - externalproject_add(uriparser - URL http://ufpr.dl.sourceforge.net/project/uriparser/Sources/0.8.4/uriparser-0.8.4.zip - URL_MD5 a24c9ba0fd1a2c6c75d02859bf337cfa - BUILD_IN_SOURCE 1 - PREFIX ${CMAKE_BINARY_DIR}/deps/uriparser - CONFIGURE_COMMAND "" - BUILD_COMMAND cd ${VSPROJECT_PATH} && devenv /Upgrade uriparser.vcproj && msbuild /p:Configuration=Release /p:Platform=Win32 /t:build uriparser.vcxproj - INSTALL_COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_BINARY_DIR}/deps/uriparser/lib && ${CMAKE_COMMAND} -E copy win32/uriparser.lib ${CMAKE_BINARY_DIR}/deps/uriparser/lib/ && ${CMAKE_COMMAND} -E copy_directory include ${CMAKE_BINARY_DIR}/deps/uriparser/include - ) - endif() - +else() + externalproject_add(uriparser + URL http://ufpr.dl.sourceforge.net/project/uriparser/Sources/0.8.4/uriparser-0.8.4.zip + URL_MD5 a24c9ba0fd1a2c6c75d02859bf337cfa + BUILD_IN_SOURCE 1 + PREFIX ${CMAKE_BINARY_DIR}/deps/uriparser + PATCH_COMMAND + ${CMAKE_COMMAND} -E copy ${PROJECT_SOURCE_DIR}/contrib/patches/uriparser/CMakeLists.txt + INSTALL_COMMAND + ${CMAKE_COMMAND} -E make_directory ${CMAKE_BINARY_DIR}/deps/uriparser/lib && + ${CMAKE_COMMAND} -E copy ${URIPARSER_LIBNAME} ${CMAKE_BINARY_DIR}/deps/uriparser/lib/ && + ${CMAKE_COMMAND} -E copy_directory include ${CMAKE_BINARY_DIR}/deps/uriparser/include + ) endif() + +# +# if(MSVC) +# +# if( CMAKE_SIZEOF_VOID_P EQUAL 8 ) +# externalproject_add(uriparser +# URL http://ufpr.dl.sourceforge.net/project/uriparser/Sources/0.8.4/uriparser-0.8.4.zip +# URL_MD5 a24c9ba0fd1a2c6c75d02859bf337cfa +# BUILD_IN_SOURCE 1 +# PREFIX ${CMAKE_BINARY_DIR}/deps/uriparser +# PATCH_COMMAND +# ${CMAKE_COMMAND} -E copy_directory ${PROJECT_SOURCE_DIR}/contrib/patches/uriparser-vs2013 /win32/uriparser-vs2013 +# CONFIGURE_COMMAND "" +# BUILD_COMMAND cd win32/uriparser-vs2013 && devenv /Upgrade uriparser.vcxproj && msbuild /p:Configuration=Release /p:Platform=x64 /t:build uriparser.vcxproj +# INSTALL_COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_BINARY_DIR}/deps/uriparser/lib && ${CMAKE_COMMAND} -E copy win32/uriparser.lib ${CMAKE_BINARY_DIR}/deps/uriparser/lib/ && ${CMAKE_COMMAND} -E copy_directory include ${CMAKE_BINARY_DIR}/deps/uriparser/include +# ) +# else() +# set(VSPROJECT_PATH "win32/Visual_Studio_2005") +# +# externalproject_add(uriparser +# URL http://ufpr.dl.sourceforge.net/project/uriparser/Sources/0.8.4/uriparser-0.8.4.zip +# URL_MD5 a24c9ba0fd1a2c6c75d02859bf337cfa +# BUILD_IN_SOURCE 1 +# PREFIX ${CMAKE_BINARY_DIR}/deps/uriparser +# CONFIGURE_COMMAND "" +# BUILD_COMMAND cd ${VSPROJECT_PATH} && devenv /Upgrade uriparser.vcproj && msbuild /p:Configuration=Release /p:Platform=Win32 /t:build uriparser.vcxproj +# INSTALL_COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_BINARY_DIR}/deps/uriparser/lib && ${CMAKE_COMMAND} -E copy win32/uriparser.lib ${CMAKE_BINARY_DIR}/deps/uriparser/lib/ && ${CMAKE_COMMAND} -E copy_directory include ${CMAKE_BINARY_DIR}/deps/uriparser/include +# ) +# endif() +# +# elseif(MINGW) +# # MinGW +# +# externalproject_add(uriparser +# URL http://ufpr.dl.sourceforge.net/project/uriparser/Sources/0.8.4/uriparser-0.8.4.zip +# URL_MD5 a24c9ba0fd1a2c6c75d02859bf337cfa +# BUILD_IN_SOURCE 1 +# PREFIX ${CMAKE_BINARY_DIR}/deps/uriparser +# CONFIGURE_COMMAND "" +# BUILD_COMMAND +# cd win32/MinGW && +# mingw32-make.exe +# INSTALL_COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_BINARY_DIR}/deps/uriparser/lib && ${CMAKE_COMMAND} -E copy win32/uriparser.lib ${CMAKE_BINARY_DIR}/deps/uriparser/lib/ && ${CMAKE_COMMAND} -E copy_directory include ${CMAKE_BINARY_DIR}/deps/uriparser/include +# ) +# +# else () +# +# endif() + set(URIPARSER_INCLUDE_DIR ${CMAKE_BINARY_DIR}/deps/uriparser/include) if (UNIX) diff --git a/contrib/patches/uriparser-vs2013/uriparser.vcxproj b/contrib/patches/uriparser-vs2013/uriparser.vcxproj deleted file mode 100644 index f115185..0000000 --- a/contrib/patches/uriparser-vs2013/uriparser.vcxproj +++ /dev/null @@ -1,168 +0,0 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - {8E2F76A2-59B5-4DF7-8062-EBD6FCF0C8B3} - uriparser - Win32Proj - - - - StaticLibrary - v120 - Unicode - true - - - StaticLibrary - v120 - Unicode - true - - - StaticLibrary - v120 - Unicode - - - StaticLibrary - v120 - Unicode - - - - - - - - - - - - - - - - - - - <_ProjectFileVersion>12.0.21005.1 - - - $(SolutionDir)$(Configuration)\ - $(Configuration)\ - - - - $(SolutionDir)$(Configuration)\ - $(Configuration)\ - - - - - Disabled - ..\..\include;%(AdditionalIncludeDirectories) - WIN32;_DEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;%(PreprocessorDefinitions) - true - EnableFastChecks - MultiThreadedDebugDLL - - Level4 - EditAndContinue - - - ..\uriparser.lib - - - - - Disabled - ..\..\include;%(AdditionalIncludeDirectories) - WIN32;_DEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;%(PreprocessorDefinitions) - EnableFastChecks - MultiThreadedDebugDLL - - - Level4 - ProgramDatabase - - - ..\uriparser.lib - - - - - ..\..\include;%(AdditionalIncludeDirectories) - WIN32;NDEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;%(PreprocessorDefinitions) - MultiThreadedDLL - - Level3 - ProgramDatabase - - - ..\uriparser.lib - - - - - ..\..\include;%(AdditionalIncludeDirectories) - WIN32;NDEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;%(PreprocessorDefinitions) - MultiThreadedDLL - - - Level3 - ProgramDatabase - - - ..\uriparser.lib - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/contrib/patches/uriparser/CMakeLists.txt b/contrib/patches/uriparser/CMakeLists.txt new file mode 100644 index 0000000..2c76992 --- /dev/null +++ b/contrib/patches/uriparser/CMakeLists.txt @@ -0,0 +1,14 @@ +cmake_minimum_required(VERSION 2.8.4) +project(uriparser) + +set(BUILD_SHARED_LIBS OFF) + +include_directories(${PROJECT_SOURCE_DIR}/include) + +file(GLOB URIPARSER_FILES + ${PROJECT_SOURCE_DIR}/src/*.h + ${PROJECT_SOURCE_DIR}/src/*.c) + +add_library(uriparser ${URIPARSER_FILES}) + +# set_target_properties(uriparser PROPERTIES PREFIX "") diff --git a/docs/BUILDING.md b/docs/BUILDING.md index cf504c3..690d98e 100644 --- a/docs/BUILDING.md +++ b/docs/BUILDING.md @@ -20,15 +20,11 @@ For **Makefiles on Unices**, these steps essentially boil down to: $ git clone git://github.com/tklab-tud/uscxml.git $ mkdir uscxml/build && cd uscxml/build - $ cmake .. - $ make + $ cmake .. && make -On **NMake on Windows**, you may have luck to run the following from a VS2013 or VS2015 command prompt: +For **MSVC on Windows**, run form a developer command-prompt and substitute the last line above by: - $ git clone git://github.com/tklab-tud/uscxml.git - $ mkdir uscxml/build && cd uscxml/build - $ cmake -G"NMake Makefiles" .. - $ nmake + $ cmake -G "NMake Makefiles" .. && nmake Note: If you want to build for another IDE or build-system, just create a new *out-of-source* build directory and start over with CMake. To get an idea @@ -44,6 +40,9 @@ directory anywhere else. This only applies to the Eclipse CDT project generator. generator as it croaks when calling SWIG, just have another build directory with the "NMake Makefiles" project generator. +Note: In order to compile with `MinGW` on windows you will ave to adapt the build scripts in `contrib/cmake/Build*`. If you succeed, a pull request would be most appreciated. + + \section deps Build Dependencies Overview of the uSCXML dependencies. See the [Platform Notes](#platform-notes) for details. diff --git a/src/uscxml/interpreter/BasicContentExecutor.cpp b/src/uscxml/interpreter/BasicContentExecutor.cpp index 2010ae2..c1eb8f6 100644 --- a/src/uscxml/interpreter/BasicContentExecutor.cpp +++ b/src/uscxml/interpreter/BasicContentExecutor.cpp @@ -444,6 +444,9 @@ void BasicContentExecutor::invoke(XERCESC_NS::DOMElement* element) { // content std::list contents = DOMUtils::filterChildElements(XML_PREFIX(element).str() + "content", element); if (contents.size() > 0) { +#if 1 + invokeEvent.data.node = contents.front(); +#else Data d = elementAsData(contents.front()); if (d.type == Data::INTERPRETED && d.atom.size() > 0) { // immediately evaluate! @@ -451,9 +454,10 @@ void BasicContentExecutor::invoke(XERCESC_NS::DOMElement* element) { } else { invokeEvent.data = d; } +#endif } } catch (Event e) { - ERROR_EXECUTION_THROW2("Syntax error in send element content", element); + ERROR_EXECUTION_THROW2("Syntax error in invoke element content", element); } // autoforward diff --git a/src/uscxml/interpreter/FastMicroStep.cpp b/src/uscxml/interpreter/FastMicroStep.cpp index fd9f1a9..bf58f7b 100644 --- a/src/uscxml/interpreter/FastMicroStep.cpp +++ b/src/uscxml/interpreter/FastMicroStep.cpp @@ -289,19 +289,24 @@ void FastMicroStep::init(XERCESC_NS::DOMElement* scxml) { DOMNode* parent = _states[i]->element->getParentNode(); if (parent && parent->getNodeType() == DOMNode::ELEMENT_NODE) { State* uscxmlState = (State*)parent->getUserData(X("uscxmlState")); - // parent - _states[i]->parent = uscxmlState->documentOrder; + // parent maybe a content element + if (uscxmlState != NULL) { + _states[i]->parent = uscxmlState->documentOrder; + } } while(parent && parent->getNodeType() == DOMNode::ELEMENT_NODE) { State* uscxmlState = (State*)parent->getUserData(X("uscxmlState")); - // ancestors - BIT_SET_AT(uscxmlState->documentOrder, _states[i]->ancestors); + if (uscxmlState == NULL) + break; - // children - BIT_SET_AT(i, uscxmlState->children); - parent = parent->getParentNode(); + // ancestors + BIT_SET_AT(uscxmlState->documentOrder, _states[i]->ancestors); + + // children + BIT_SET_AT(i, uscxmlState->children); + parent = parent->getParentNode(); } } diff --git a/src/uscxml/plugins/invoker/scxml/USCXMLInvoker.cpp b/src/uscxml/plugins/invoker/scxml/USCXMLInvoker.cpp index f80d427..885f70d 100644 --- a/src/uscxml/plugins/invoker/scxml/USCXMLInvoker.cpp +++ b/src/uscxml/plugins/invoker/scxml/USCXMLInvoker.cpp @@ -146,7 +146,7 @@ void USCXMLInvoker::invoke(const std::string& source, const Event& invokeEvent) // std::cout << *document << std::endl; // TODO: where do we get the namespace from? - _invokedInterpreter = Interpreter::fromDocument(document, _interpreter->getBaseURL()); + _invokedInterpreter = Interpreter::fromDocument(document, _interpreter->getBaseURL(), false); } else { _isActive = false; -- cgit v0.12