From 24dfefcbc7f6c7e01146684ed02b21624d83d9e3 Mon Sep 17 00:00:00 2001 From: Stefan Radomski Date: Fri, 20 May 2016 14:25:59 +0200 Subject: Fixed issue77 with URL resolved from CWD on windows --- CMakeLists.txt | 2 +- contrib/cmake/BuildLibEvent.cmake | 4 +- contrib/cmake/BuildXercesC.cmake | 82 +++++++++++++++++------------------ src/uscxml/util/URL.cpp | 8 +++- test/src/test-validating.cpp | 90 +++++++++++++++++++-------------------- 5 files changed, 94 insertions(+), 92 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index bbf30bb..319fc8f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -344,7 +344,7 @@ if (NOT IGNORE_V8) endif() # Lua -OPTION(IGNORE_V8 "Do not search for the Lua libraries" OFF) +OPTION(IGNORE_LUA "Do not search for the Lua libraries" OFF) if (NOT IGNORE_LUA) if (WIN32) # LuaForWindows https://code.google.com/archive/p/luaforwindows/downloads diff --git a/contrib/cmake/BuildLibEvent.cmake b/contrib/cmake/BuildLibEvent.cmake index 486d4fb..f3bbc66 100644 --- a/contrib/cmake/BuildLibEvent.cmake +++ b/contrib/cmake/BuildLibEvent.cmake @@ -23,7 +23,9 @@ elseif (WIN32) BUILD_COMMAND nmake -f Makefile.nmake INSTALL_COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_BINARY_DIR}/deps/libevent/lib && - ${CMAKE_COMMAND} -E copy libevent.lib libevent_core.lib libevent_extras.lib ${CMAKE_BINARY_DIR}/deps/libevent/lib/ && + ${CMAKE_COMMAND} -E copy libevent.lib ${CMAKE_BINARY_DIR}/deps/libevent/lib/ && + ${CMAKE_COMMAND} -E copy libevent_core.lib ${CMAKE_BINARY_DIR}/deps/libevent/lib/ && + ${CMAKE_COMMAND} -E copy libevent_extras.lib ${CMAKE_BINARY_DIR}/deps/libevent/lib/ && ${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/ ) diff --git a/contrib/cmake/BuildXercesC.cmake b/contrib/cmake/BuildXercesC.cmake index 994a365..26cbdb1 100644 --- a/contrib/cmake/BuildXercesC.cmake +++ b/contrib/cmake/BuildXercesC.cmake @@ -2,19 +2,7 @@ # see http://tools.cinemapub.be/opendcp/opendcp-0.19-src/contrib/CMakeLists.txt include(ExternalProject) -if (UNIX) - externalproject_add(xerces-c - URL http://ftp.halifax.rwth-aachen.de/apache/xerces/c/3/sources/xerces-c-3.1.3.tar.gz - URL_MD5 70320ab0e3269e47d978a6ca0c0e1e2d - BUILD_IN_SOURCE 0 - PREFIX ${CMAKE_BINARY_DIR}/deps/xerces-c - CONFIGURE_COMMAND - "/configure" - "--enable-static" - "--enable-shared" - "--prefix=" - ) -elseif(WIN32) +if(MSVC) set(VC_VERSION VC12) # see https://en.wikipedia.org/wiki/Visual_C%2B%2B @@ -42,38 +30,46 @@ elseif(WIN32) set(VSPROJECT_PATH "projects/Win32/${VC_VERSION}/xerces-all/XercesLib") + set(XERCESC_BUILD_PATH_SUFFIX Win32) + set(XERCESC_BUILD_PLATFORM Win32) if( CMAKE_SIZEOF_VOID_P EQUAL 8 ) - externalproject_add(xerces-c - URL http://ftp.halifax.rwth-aachen.de/apache/xerces/c/3/sources/xerces-c-3.1.3.tar.gz - URL_MD5 70320ab0e3269e47d978a6ca0c0e1e2d - BUILD_IN_SOURCE 1 - PREFIX ${CMAKE_BINARY_DIR}/deps/xerces-c - CONFIGURE_COMMAND "" - # BUILD_COMMAND cd ${VSPROJECT_PATH} && msbuild /p:Configuration=Static\ Release /p:Platform=x64 /p:RuntimeLibrary=MD_DynamicRelease ${VC_PLATFORM} /t:build XercesLib.vcxproj - # INSTALL_COMMAND ${CMAKE_COMMAND} -E copy_directory Build/Win64/${VC_VERSION}/Static\ Release/ ${CMAKE_BINARY_DIR}/deps/xerces-c/lib/ && ${CMAKE_COMMAND} -E copy_directory src/ ${CMAKE_BINARY_DIR}/deps/xerces-c/include/ - BUILD_COMMAND cd ${VSPROJECT_PATH} && msbuild /p:Configuration=Release /p:Platform=x64 ${VC_PLATFORM} /t:build XercesLib.vcxproj - INSTALL_COMMAND - ${CMAKE_COMMAND} -E copy_directory Build/Win64/${VC_VERSION}/Release/ ${CMAKE_BINARY_DIR}/deps/xerces-c/lib/ && - ${CMAKE_COMMAND} -E copy ${CMAKE_BINARY_DIR}/deps/xerces-c/lib/xerces-c_3_1.dll ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/ && - ${CMAKE_COMMAND} -E copy_directory src/ ${CMAKE_BINARY_DIR}/deps/xerces-c/include/ - ) - else() - externalproject_add(xerces-c - URL http://ftp.halifax.rwth-aachen.de/apache/xerces/c/3/sources/xerces-c-3.1.3.tar.gz - URL_MD5 70320ab0e3269e47d978a6ca0c0e1e2d - BUILD_IN_SOURCE 1 - PREFIX ${CMAKE_BINARY_DIR}/deps/xerces-c - CONFIGURE_COMMAND "" - # BUILD_COMMAND cd ${VSPROJECT_PATH} && msbuild /p:Configuration=Static\ Release /p:Platform=Win32 /p:RuntimeLibrary=MD_DynamicRelease ${VC_PLATFORM} /t:build XercesLib.vcxproj - # INSTALL_COMMAND ${CMAKE_COMMAND} -E copy_directory Build/Win32/${VC_VERSION}/Static\ Release/ ${CMAKE_BINARY_DIR}/deps/xerces-c/lib/ && ${CMAKE_COMMAND} -E copy_directory src/ ${CMAKE_BINARY_DIR}/deps/xerces-c/include/ - BUILD_COMMAND cd ${VSPROJECT_PATH} && msbuild /p:Configuration=Release /p:Platform=Win32 ${VC_PLATFORM} /t:build XercesLib.vcxproj - INSTALL_COMMAND - ${CMAKE_COMMAND} -E copy_directory Build/Win32/${VC_VERSION}/Release/ ${CMAKE_BINARY_DIR}/deps/xerces-c/lib/ && - ${CMAKE_COMMAND} -E copy ${CMAKE_BINARY_DIR}/deps/xerces-c/lib/xerces-c_3_1.dll ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/ && - ${CMAKE_COMMAND} -E copy_directory src/ ${CMAKE_BINARY_DIR}/deps/xerces-c/include/ - ) + set(XERCESC_BUILD_PATH_SUFFIX Win64) + set(XERCESC_BUILD_PLATFORM x64) endif() -endif() + + externalproject_add(xerces-c + URL http://ftp.halifax.rwth-aachen.de/apache/xerces/c/3/sources/xerces-c-3.1.3.tar.gz + URL_MD5 70320ab0e3269e47d978a6ca0c0e1e2d + BUILD_IN_SOURCE 1 + PREFIX ${CMAKE_BINARY_DIR}/deps/xerces-c + CONFIGURE_COMMAND "" + # BUILD_COMMAND cd ${VSPROJECT_PATH} && msbuild /p:Configuration=Static\ Release /p:Platform=x64 /p:RuntimeLibrary=MD_DynamicRelease ${VC_PLATFORM} /t:build XercesLib.vcxproj + # INSTALL_COMMAND ${CMAKE_COMMAND} -E copy_directory Build/Win64/${VC_VERSION}/Static\ Release/ ${CMAKE_BINARY_DIR}/deps/xerces-c/lib/ && ${CMAKE_COMMAND} -E copy_directory src/ ${CMAKE_BINARY_DIR}/deps/xerces-c/include/ + BUILD_COMMAND cd ${VSPROJECT_PATH} && msbuild /p:Configuration=Release /p:Platform=${XERCESC_BUILD_PLATFORM} ${VC_PLATFORM} /t:build XercesLib.vcxproj + INSTALL_COMMAND + ${CMAKE_COMMAND} -E make_directory Build/${XERCESC_BUILD_PATH_SUFFIX}/${VC_VERSION}/Debug && + ${CMAKE_COMMAND} -E make_directory ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/Debug && + ${CMAKE_COMMAND} -E make_directory Build/${XERCESC_BUILD_PATH_SUFFIX}/${VC_VERSION}/Release && + ${CMAKE_COMMAND} -E make_directory ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/Release && + ${CMAKE_COMMAND} -E copy_directory Build/${XERCESC_BUILD_PATH_SUFFIX}/${VC_VERSION}/Debug/ ${CMAKE_BINARY_DIR}/deps/xerces-c/lib/ && + ${CMAKE_COMMAND} -E copy ${CMAKE_BINARY_DIR}/deps/xerces-c/lib/xerces-c_3_1.dll ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/Debug/ && + ${CMAKE_COMMAND} -E copy_directory Build/${XERCESC_BUILD_PATH_SUFFIX}/${VC_VERSION}/Release/ ${CMAKE_BINARY_DIR}/deps/xerces-c/lib/ && + ${CMAKE_COMMAND} -E copy ${CMAKE_BINARY_DIR}/deps/xerces-c/lib/xerces-c_3_1.dll ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/Release/ && + ${CMAKE_COMMAND} -E copy_directory src/ ${CMAKE_BINARY_DIR}/deps/xerces-c/include/ + ) +else() + externalproject_add(xerces-c + URL http://ftp.halifax.rwth-aachen.de/apache/xerces/c/3/sources/xerces-c-3.1.3.tar.gz + URL_MD5 70320ab0e3269e47d978a6ca0c0e1e2d + BUILD_IN_SOURCE 0 + PREFIX ${CMAKE_BINARY_DIR}/deps/xerces-c + CONFIGURE_COMMAND + "/configure" + "--enable-static" + "--enable-shared" + "--prefix=" + ) +endif() # TODO: --with-curl=DIR diff --git a/src/uscxml/util/URL.cpp b/src/uscxml/util/URL.cpp index cb3abe3..561b9aa 100644 --- a/src/uscxml/util/URL.cpp +++ b/src/uscxml/util/URL.cpp @@ -141,8 +141,12 @@ URL URLImpl::resolveWithCWD(URLImpl* relative) { currPath[sizeof(currPath) - 1] = '\0'; /* not really required? */ // without the trailing slash, last component is assumed a file - std::shared_ptr cwdURL(new URLImpl(std::string("file://") + currPath + PATH_SEPERATOR)); - +#if WIN32 + std::shared_ptr cwdURL(new URLImpl(std::string(currPath))); +#else + std::shared_ptr cwdURL(new URLImpl(std::string("file://") + currPath + PATH_SEPERATOR)); +#endif + return resolve(relative, cwdURL.get()); } diff --git a/test/src/test-validating.cpp b/test/src/test-validating.cpp index 34d8122..3f7d0f9 100644 --- a/test/src/test-validating.cpp +++ b/test/src/test-validating.cpp @@ -44,9 +44,9 @@ int main(int argc, char** argv) { while(iterations--) { - if (1) { + if (Factory::getInstance()->hasDataModel("ecmascript")) { // Potential endless loop - + const char* xml = "" " " @@ -72,7 +72,7 @@ int main(int argc, char** argv) { // Unreachable states 1 const char* xml = - "" + "" " " " " " " @@ -91,9 +91,9 @@ int main(int argc, char** argv) { if (1) { // Invalid parents const char* xml = - "" + "" " " - " " + " " " " ""; @@ -102,11 +102,11 @@ int main(int argc, char** argv) { assert(issueLocations.size() == 1); } - if (0) { + if (1) { // State has no 'id' attribute // *** This is not actually an error! *** const char* xml = - "" + "" " " " " " " @@ -120,7 +120,7 @@ int main(int argc, char** argv) { if (1) { // Duplicate state with id const char* xml = - "" + "" " " " " ""; @@ -134,7 +134,7 @@ int main(int argc, char** argv) { // Transition has non-existant target state const char* xml = - "" + "" " " " " " " @@ -149,7 +149,7 @@ int main(int argc, char** argv) { // Useless history 1 const char* xml = - "" + "" " " " " " " @@ -168,7 +168,7 @@ int main(int argc, char** argv) { // Useless history 2 const char* xml = - "" + "" " " " " " " @@ -188,7 +188,7 @@ int main(int argc, char** argv) { // No legal completion const char* xml = - "" + "" " " " " " " @@ -208,7 +208,7 @@ int main(int argc, char** argv) { { // initial attribute and child const char* xml = - "" + "" " " " " " " @@ -225,7 +225,7 @@ int main(int argc, char** argv) { { // initial attribute with atomic state const char* xml = - "" + "" " " ""; @@ -237,7 +237,7 @@ int main(int argc, char** argv) { { // initial child with atomic state const char* xml = - "" + "" " " " " " " @@ -254,7 +254,7 @@ int main(int argc, char** argv) { { // send with content and namelist, not allowed const char* xml = - "" + "" " " " " " " @@ -272,7 +272,7 @@ int main(int argc, char** argv) { { // send with content and params, not allowed const char* xml = - "" + "" " " " " " " @@ -291,7 +291,7 @@ int main(int argc, char** argv) { { // send with params and namelist, perfectly acceptable const char* xml = - "" + "" " " " " " " @@ -308,7 +308,7 @@ int main(int argc, char** argv) { { // invoke with content and src, not allowed const char* xml = - "" + "" " " " " " Foo!" @@ -324,7 +324,7 @@ int main(int argc, char** argv) { { // invoke with namelist and param, not allowed const char* xml = - "" + "" " " " " " " @@ -340,7 +340,7 @@ int main(int argc, char** argv) { { // invoke with param and content, perfectly acceptable const char* xml = - "" + "" " " " " " " @@ -356,7 +356,7 @@ int main(int argc, char** argv) { { // invoke with namelist and content, perfectly acceptable const char* xml = - "" + "" " " " " " Foo!" @@ -371,7 +371,7 @@ int main(int argc, char** argv) { { // donedata with content and param, not allowed const char* xml = - "" + "" " " " " " " @@ -392,7 +392,7 @@ int main(int argc, char** argv) { // Transition can never be optimally enabled (conditionless, eventless) const char* xml = - "" + "" " " " " " " @@ -408,7 +408,7 @@ int main(int argc, char** argv) { // Transition can never be optimally enabled (conditionless, more events) const char* xml = - "" + "" " " " " " " @@ -426,7 +426,7 @@ int main(int argc, char** argv) { // Initial attribute has invalid target state const char* xml = - "" + "" ""; std::set issueLocations = issueLocationsForXML(xml); @@ -438,7 +438,7 @@ int main(int argc, char** argv) { // Initial attribute with target outside of children const char* xml = - "" + "" " " " " " " @@ -453,7 +453,7 @@ int main(int argc, char** argv) { // Initial transition with target outside of children const char* xml = - "" + "" " " " " " " @@ -471,7 +471,7 @@ int main(int argc, char** argv) { // Initial history transition with target outside of children const char* xml = - "" + "" " " " " " " @@ -492,7 +492,7 @@ int main(int argc, char** argv) { // Initial transition with target outside of children const char* xml = - "" + "" " " " " " " @@ -510,7 +510,7 @@ int main(int argc, char** argv) { if (1) { // Initial transition with event const char* xml = - "" + "" " " " " " " @@ -529,7 +529,7 @@ int main(int argc, char** argv) { if (1) { // Initial transition with condition const char* xml = - "" + "" " " " " " " @@ -548,7 +548,7 @@ int main(int argc, char** argv) { if (1) { // Initial with multiple transitions const char* xml = - "" + "" " " " " " " @@ -568,7 +568,7 @@ int main(int argc, char** argv) { if (1) { // Initial with no transitions const char* xml = - "" + "" " " " " " " @@ -586,7 +586,7 @@ int main(int argc, char** argv) { if (1) { // History transition with event const char* xml = - "" + "" " " " " " " @@ -610,7 +610,7 @@ int main(int argc, char** argv) { if (1) { // History transition with condition const char* xml = - "" + "" " " " " " " @@ -635,7 +635,7 @@ int main(int argc, char** argv) { // Send to unknown IO Processor const char* xml = - "" + "" " " " " " " @@ -664,7 +664,7 @@ int main(int argc, char** argv) { // Unknown executable content element const char* xml = - "" + "" " " " " " " @@ -677,7 +677,7 @@ int main(int argc, char** argv) { assert(issueLocations.size() == 1); } - if (1) { + if (Factory::getInstance()->hasDataModel("ecmascript")) { // Syntax error in script const char* xml = @@ -692,7 +692,7 @@ int main(int argc, char** argv) { assert(issueLocations.size() == 1); } - if (1) { + if (Factory::getInstance()->hasDataModel("ecmascript")) { // Syntax error in cond attribute const char* xml = @@ -714,7 +714,7 @@ int main(int argc, char** argv) { assert(issueLocations.size() == 3); } - if (1) { + if (Factory::getInstance()->hasDataModel("ecmascript")) { // Syntax error in expr attribute const char* xml = @@ -745,7 +745,7 @@ int main(int argc, char** argv) { assert(issueLocations.size() == 5); } - if (1) { + if (Factory::getInstance()->hasDataModel("ecmascript")) { // Syntax error with foreach const char* xml = @@ -763,7 +763,7 @@ int main(int argc, char** argv) { assert(issueLocations.size() == 1); } - if (1) { + if (Factory::getInstance()->hasDataModel("ecmascript")) { // Syntax error with send const char* xml = @@ -780,7 +780,7 @@ int main(int argc, char** argv) { assert(issueLocations.size() == 1); } - if (1) { + if (Factory::getInstance()->hasDataModel("ecmascript")) { // Syntax error with invoke const char* xml = @@ -795,7 +795,7 @@ int main(int argc, char** argv) { assert(issueLocations.size() == 1); } - if (1) { + if (Factory::getInstance()->hasDataModel("ecmascript")) { // Syntax error with cancel const char* xml = -- cgit v0.12