summaryrefslogtreecommitdiffstats
path: root/config/unicosmk2.0.6.X
Commit message (Expand)AuthorAgeFilesLines
* [svn-r8010] Purpose:Quincey Koziol2003-12-311-0/+4
* [svn-r6818] Elena Pourmal2003-05-061-0/+138
a/docs/BUILDING.md +++ b/docs/BUILDING.md @@ -12,19 +12,27 @@ essentially the same on every platform: in <USCXML_SRC>/build/. 4. Run cmake (or ccmake / CMake-GUI) to create the files required by your actual build-system. 5. Use your actual build-system or development environment to build uscxml. -6. Read the SCXML draft and have a look at the tests to get started. +6. Optionally build the [language bindings](#language-bindings) to embed the SCXML interpreter in another language. +7. Read the SCXML draft and have a look at the tests to get started. 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 of +*out-of-source* build directory and start over with CMake. To get an idea of supported IDEs and build-environments on your platform, type cmake --help or run the CMake-GUI and look for the *Generators* section at the end of the output. Default on Unices is Makefiles. +Note: If you plan to use Eclipse CDT, you cannot have a build directory anywhere under +the source directory - just create the build directory anywhere else. This only applies to the Eclipse CDT +project generator. + +Note: You cannot build the language bindings with the Visual Studio project as it croaks when calling SWIG, +just have another build directory with the "NMake Makefiles" project generator. + # Build Dependencies Overview of the uscxml dependencies. See the [Platform Notes](#platform-notes) for details. -Note: We download pre-compiled versions of most dependencies at cmake configure-time. If you want +Note: We download pre-compiled versions of most dependencies at CMake configure-time. If you want to provide you own libraries, remove them from <USCXML_SRC>/contrib/prebuilt/ and provide your own. @@ -36,11 +44,15 @@ your own. >= 2.8.6 The build-system used for uscxml. + SWIG
optional + >= 2.0.6 + Generates language bindings to embed uSCXML in other target languages. + libevent
pre-compiled >= 2.1.x Event queues with callbacks and the HTTP server. - curl
required + curl
pre-compiled / required >= 7.29.0 URL downloads. @@ -110,7 +122,7 @@ This section will detail the preparation of the respective platforms to ultimate ## Mac OSX -You will have to install cmake via Macports: +You will have to install CMake via Macports: sudo port install cmake @@ -126,9 +138,9 @@ Just download the source and invoke CMake to create Makefiles or a Xcode project -- Build files have been written to: .../build/cli $ make -You can test whether everything works by starting the mmi-browser with a test.scxml file: +You can test whether everything works by starting the uscxml-browser with a test.scxml file: - $ ./bin/mmi-browser ../../test/samples/uscxml/test-ecmascript.scxml + $ ./bin/uscxml-browser ../../test/uscxml/test-ecmascript.scxml ### Xcode @@ -157,7 +169,7 @@ This would be all distributions based on Debian, like Ubuntu, Linux Mint and the $ sudo apt-get install libxml2-dev libcurl4-openssl-dev There may still be packages missing due to the set of dependencies among packages -in the various distributons. Try to run cmake and resolve dependencies until you +in the various distributons. Try to run CMake and resolve dependencies until you are satisfied. ### Preparing *yum based* distributions @@ -214,34 +226,28 @@ Instructions are a literal copy of building uscxml for MacOSX on the console fro -- Build files have been written to: .../build/cli $ make -You can test whether everything works by starting the mmi-browser with a test.scxml file: +You can test whether everything works by starting the uscxml-browser with a test.scxml file: - $ ./bin/mmi-browser ../../test/samples/uscxml/test-ecmascript.scxml + $ ./bin/uscxml-browser ../../test/uscxml/test-ecmascript.scxml ### Eclipse CDT Note: Eclipse does not like the project to be a subdirectory in the source. You have to choose your build directory with the generated project accordingly. - $ mkdir -p build/uscxml/eclipse && cd build/uscxml/eclipse + $ mkdir -p ~/Desktop/build/uscxml/eclipse && cd ~/Desktop/build/uscxml/eclipse $ cmake -G "Eclipse CDT4 - Unix Makefiles" [...] -- Build files have been written to: .../build/uscxml/eclipse Now open Eclipse CDT and import the out-of-source directory as an existing project into workspace, leaving the "Copy projects into workspace" checkbox unchecked. There are some more [detailed instruction](http://www.cmake.org/Wiki/Eclipse_CDT4_Generator) available -in the cmake wiki as well. - -### Compiling Dependencies - -If the packages in your distribution are too old, you will have to compile current -binaries. This applies especially for SWI and CMake as they *need* to be rather -current. Have a look at the build dependencies above for minimum versions. +in the CMake wiki as well. ## Windows -Building from source on windows is somewhat more involved and instructions are necessarily in prose form. These instructions were -created using Windows 7 and MS Visual Studio 2010. +Building from source on windows is somewhat more involved and instructions are necessarily in prose form. These +instructions were created using Windows 7 and MS Visual Studio 2010. ### Prepare compilation @@ -262,3 +268,93 @@ Just open it up to continue in your IDE. Note: We only tested with the MSVC compiler. You can try to compile with MinGW but you would have to build all the dependent libraries as well. +Note: We do no provide prebuilt dependencies for MSVC18.x (Visual Studio 2012 / 2013). +You can still use the bindings for C#, but not the native C++ libraries. + +## Language Bindings + +In order to build any language bindings, you will need to have SWIG and the development kit of your target language +installed. The set of available language bindings is printed at the end of the CMake invocation: + + $ cmake + ... + -- Available custom elements ...... : respond file postpone fetch + -- Available language bindings .... : csharp java + -- General information: + ... + +### Java + +We are relying on CMake's [FindJNI.CMake](http://www.cmake.org/cmake/help/v2.8.12/cmake.html#module:FindJNI) module +to find the JNI headers and respective libraries. On unices, it's easiest to check whether jni.h is available +in JAVA_HOME: + + $ find $JAVA_HOME -name jni.h + /usr/lib/jvm/java-7-openjdk-i386/include/jni.h + +In addition, you will need apache's ant in the path or in $ENV{ANT_HOME}/bin: + + $ ant -version + Apache Ant(TM) version 1.8.2 compiled on September 22 2011 + +If both of these are given, you ought to get java as an available language binding and a new target called +java for your build system. If you used plain Makefiles (default on unices), you will get everything you need via: + + $ make && make java + $ ls lib/*.jnilib lib/*.jar + lib/libuscxmlNativeJava64.jnilib lib/uscxml.jar + +The uscxml.jar is to be added to your project's classpath, while the libuscxmlNativeJava64.jnilib +(or .so, .dll) needs to be loaded once via System.load() before you can use native objects. + +### CSharp + +For the CSharp bindings, we need to find either csc.exe from the Microsoft.NET framework or dmcs +from the mono project. We search the following places for these: + + $ENV{CSC_HOME}; $ENV{DMCS_HOME} + "C:/Windows/Microsoft.NET/Framework/v3.5" + "C:/Windows/Microsoft.NET/Framework/v4.0.30319" + +If we find one of those binaries (and SWIG obviously), we will enable the language bindings. + + $ which dmcs + /opt/local/bin/dmcs + +Again, if you used plain Makefiles, you will get everything you need via: + + $ make && make csharp + $ $ find lib -type f -iname *csharp* + lib/csharp/libuscxmlNativeCSharp.so + lib/uscxmlCSharp.dll + +The libuscxmlNativeCSharp.so has to be available to your C# runtime, either by installing it in +/usr/local/lib or (preferred) by using LD_PRELOAD or SetDllDirectory. See the +embedding examples. The uscxmlCSharp.dll contains the managed code portion and needs to be added +to your C# project as a reference. + +Note: You cannot use uSCXML with Xamarin Studio / Mono on Mac out of the box, as they still +have no 64Bit support. The last Macintosh without 64Bit support was the (late 2006) Mac Mini with an Intel Core Duo. + +### Important Note for Windows + +You cannot use CMake projects generated for Visual Studio to build the target language specific part of the +various bindings - you have to use nmake at a command prompt. Open a Visual Studio [x64 Win64] +Command Prompt (2010) and type: + + > cd c:\path\to\build\dir + > cmake -G"NMake Makefiles" c:\path\to\uscxml\source + ... + > nmake && nmake csharp && nmake java + ... + +## About 32/64Bit Support + +We do support both, 32 and 64Bit for Linux and Windows. On Macintosh, most prebuilt dependencies are compiled as +universal binaries with 32/64Bit but we build 64Bit binaries exclusively. The reason is that e.g. curl +cannot be compiled as a universal binary as its header files make assumptions about the bit-depth of an int. +Furthermore, most libraries used by invokers and provided by brew or Macports will be 64Bit only and fail to link. + +If you feel adventurous, you can uncomment set(CMAKE_OSX_ARCHITECTURES "i386;x86_64") in the topmost +CMakeLists.txt and fight your way through the linker errors. + \ No newline at end of file diff --git a/docs/CentOS.md b/docs/CentOS.md deleted file mode 100644 index 8a3424e..0000000 --- a/docs/CentOS.md +++ /dev/null @@ -1,47 +0,0 @@ -Install CentOS -Minimal Profile -sudo yum install wget -sudo yum groupinstall "Development tools" - - -$ wget http://sourceforge.net/projects/boost/files/latest/download -$ tar xvjf boost* -$ cd boost* -$ ./bootstrap.sh -$ sudo ./b2 --layout=tagged install - -sudo yum install libtool-ltdl-devel libxml2-devel libpng-devel libjpeg-devel libtiff-devel libcurl-devel mesa-libGL-devel pcre-devel -sudo yum remove swig - -$ wget http://sourceforge.net/projects/openvrml/files/latest/download -$ tar xvjf openvrml* -$ cd openvrml* -$ ./configure --disable-render-text-node --disable-script-node-javascript --disable-script-node-java --disable-gl-renderer --disable-xembed --disable-player --disable-examples --disable-mozilla-plugin -$ sudo make install - -$ wget http://www.cmake.org/files/v2.8/cmake-2.8.10.2.tar.gz -$ tar xvzf cmake-2.8.10.2.tar.gz -$ cd cmake-2.8.10 -$ ./configure -$ make install - -$ svn co http://www.openscenegraph.org/svn/osg/OpenSceneGraph/tags/OpenSceneGraph-3.1.5 OpenSceneGraph -$ cd OpenSceneGraph -$ mkdir build && cd build -$ cmake .. -$ make -j4 -$ sudo make install - -$ wget http://sourceforge.net/projects/swig/files/latest/download -$ tar xvjf swig* -$ cd swig* -$ ./configure -$ make -$ make install - -$ git clone git://github.com/tklab-tud/uscxml.git -$ cd uscxml -$ mkdir build && cd build -$ cmake .. -$ make - diff --git a/docs/CentOS.txt b/docs/CentOS.txt new file mode 100644 index 0000000..8a3424e --- /dev/null +++ b/docs/CentOS.txt @@ -0,0 +1,47 @@ +Install CentOS +Minimal Profile +sudo yum install wget +sudo yum groupinstall "Development tools" + + +$ wget http://sourceforge.net/projects/boost/files/latest/download +$ tar xvjf boost* +$ cd boost* +$ ./bootstrap.sh +$ sudo ./b2 --layout=tagged install + +sudo yum install libtool-ltdl-devel libxml2-devel libpng-devel libjpeg-devel libtiff-devel libcurl-devel mesa-libGL-devel pcre-devel +sudo yum remove swig + +$ wget http://sourceforge.net/projects/openvrml/files/latest/download +$ tar xvjf openvrml* +$ cd openvrml* +$ ./configure --disable-render-text-node --disable-script-node-javascript --disable-script-node-java --disable-gl-renderer --disable-xembed --disable-player --disable-examples --disable-mozilla-plugin +$ sudo make install + +$ wget http://www.cmake.org/files/v2.8/cmake-2.8.10.2.tar.gz +$ tar xvzf cmake-2.8.10.2.tar.gz +$ cd cmake-2.8.10 +$ ./configure +$ make install + +$ svn co http://www.openscenegraph.org/svn/osg/OpenSceneGraph/tags/OpenSceneGraph-3.1.5 OpenSceneGraph +$ cd OpenSceneGraph +$ mkdir build && cd build +$ cmake .. +$ make -j4 +$ sudo make install + +$ wget http://sourceforge.net/projects/swig/files/latest/download +$ tar xvjf swig* +$ cd swig* +$ ./configure +$ make +$ make install + +$ git clone git://github.com/tklab-tud/uscxml.git +$ cd uscxml +$ mkdir build && cd build +$ cmake .. +$ make + diff --git a/docs/Ubuntu-LTS.md b/docs/Ubuntu-LTS.md deleted file mode 100644 index df687ab..0000000 --- a/docs/Ubuntu-LTS.md +++ /dev/null @@ -1,44 +0,0 @@ -Install Ubuntu LTS 12 - -For core functionality without fancy plugins: - -$ sudo apt-get install cmake build-essential libxml2-dev libcurl4-openssl-dev - -For OpenSceneGraph invoker (version in repositories lacks vrml plugin): - -$ sudo apt-get install libpng12-dev libjpeg-dev libboost-all-dev libltdl-dev -$ sudo apt-get install libopenscenegraph-dev # just for the dependencies -$ sudo apt-get remove libopenscenegraph-dev - -$ wget http://sourceforge.net/projects/openvrml/files/latest/download -$ tar xvjf openvrml* -$ cd openvrml* -$ ./configure --disable-render-text-node --disable-script-node-javascript --disable-script-node-java --disable-gl-renderer --disable-xembed --disable-player --disable-examples --disable-mozilla-plugin -$ sudo make install -$ cd .. - -for mavericks: -PNG_CFLAGS="-I/opt/local/include" PNG_LIBS="-L/opt/local/lib" XML_CFLAGS="-I`xcrun --show-sdk-path`/usr/include/libxml2" XML_LIBS="-L`xcrun --show-sdk-path`/usr/lib" CPPFLAGS="--sysroot=`xcrun --show-sdk-path` -I/opt/local/include -I`xcrun --show-sdk-path`/usr/include/libxml2" LDFLAGS="--sysroot=`xcrun --show-sdk-path` -L/opt/local/lib -lboost_system-mt -lxml2 -lpng" ./configure --disable-render-text-node --disable-script-node-javascript --disable-script-node-java --disable-gl-renderer --disable-xembed --disable-player --disable-examples --disable-mozilla-plugin - - -$ sudo apt-get install git -$ git clone https://github.com/openscenegraph/osg -$ cd osg -$ nano src/osgPlugins/vrml/IndexedFaceSet.cpp # Edit line 207 and remove the else block - -$ mkdir build && cd build -$ cmake .. -$ make -j4 -$ sudo make install - -For ffmpeg invoker: - -Follow http://ffmpeg.org/trac/ffmpeg/wiki/UbuntuCompilationGuide for a version of recent version of ffmpeg -on ubuntu. The various libav* packages that come with the distribution are inadequate. - -Install uscxml: -$ git clone https://github.com/tklab-tud/uscxml.git -$ cd uscxml -$ mkdir build && cd build -$ cmake .. -$ make \ No newline at end of file diff --git a/docs/Ubuntu-LTS.txt b/docs/Ubuntu-LTS.txt new file mode 100644 index 0000000..df687ab --- /dev/null +++ b/docs/Ubuntu-LTS.txt @@ -0,0 +1,44 @@ +Install Ubuntu LTS 12 + +For core functionality without fancy plugins: + +$ sudo apt-get install cmake build-essential libxml2-dev libcurl4-openssl-dev + +For OpenSceneGraph invoker (version in repositories lacks vrml plugin): + +$ sudo apt-get install libpng12-dev libjpeg-dev libboost-all-dev libltdl-dev +$ sudo apt-get install libopenscenegraph-dev # just for the dependencies +$ sudo apt-get remove libopenscenegraph-dev + +$ wget http://sourceforge.net/projects/openvrml/files/latest/download +$ tar xvjf openvrml* +$ cd openvrml* +$ ./configure --disable-render-text-node --disable-script-node-javascript --disable-script-node-java --disable-gl-renderer --disable-xembed --disable-player --disable-examples --disable-mozilla-plugin +$ sudo make install +$ cd .. + +for mavericks: +PNG_CFLAGS="-I/opt/local/include" PNG_LIBS="-L/opt/local/lib" XML_CFLAGS="-I`xcrun --show-sdk-path`/usr/include/libxml2" XML_LIBS="-L`xcrun --show-sdk-path`/usr/lib" CPPFLAGS="--sysroot=`xcrun --show-sdk-path` -I/opt/local/include -I`xcrun --show-sdk-path`/usr/include/libxml2" LDFLAGS="--sysroot=`xcrun --show-sdk-path` -L/opt/local/lib -lboost_system-mt -lxml2 -lpng" ./configure --disable-render-text-node --disable-script-node-javascript --disable-script-node-java --disable-gl-renderer --disable-xembed --disable-player --disable-examples --disable-mozilla-plugin + + +$ sudo apt-get install git +$ git clone https://github.com/openscenegraph/osg +$ cd osg +$ nano src/osgPlugins/vrml/IndexedFaceSet.cpp # Edit line 207 and remove the else block + +$ mkdir build && cd build +$ cmake .. +$ make -j4 +$ sudo make install + +For ffmpeg invoker: + +Follow http://ffmpeg.org/trac/ffmpeg/wiki/UbuntuCompilationGuide for a version of recent version of ffmpeg +on ubuntu. The various libav* packages that come with the distribution are inadequate. + +Install uscxml: +$ git clone https://github.com/tklab-tud/uscxml.git +$ cd uscxml +$ mkdir build && cd build +$ cmake .. +$ make \ No newline at end of file diff --git a/embedding/csharp/uSCXMLEmbedding.suo b/embedding/csharp/uSCXMLEmbedding.suo index 9bacedf..823eecc 100644 Binary files a/embedding/csharp/uSCXMLEmbedding.suo and b/embedding/csharp/uSCXMLEmbedding.suo differ diff --git a/embedding/csharp/uSCXMLEmbedding/Extensions/CustomDataModel.cs b/embedding/csharp/uSCXMLEmbedding/Extensions/CustomDataModel.cs index b2ee1de..65e517a 100644 --- a/embedding/csharp/uSCXMLEmbedding/Extensions/CustomDataModel.cs +++ b/embedding/csharp/uSCXMLEmbedding/Extensions/CustomDataModel.cs @@ -10,7 +10,9 @@ namespace embedding { public override DataModel create(Interpreter interpreter) { - return new CustomDataModel(); + CustomDataModel dm = new CustomDataModel(); + dm.swigCMemOwn = false; + return dm; } public override void eval(string scriptElem, string expr) diff --git a/embedding/csharp/uSCXMLEmbedding/Extensions/CustomExecutableContent.cs b/embedding/csharp/uSCXMLEmbedding/Extensions/CustomExecutableContent.cs index 94cf111..ac79065 100644 --- a/embedding/csharp/uSCXMLEmbedding/Extensions/CustomExecutableContent.cs +++ b/embedding/csharp/uSCXMLEmbedding/Extensions/CustomExecutableContent.cs @@ -25,7 +25,9 @@ namespace embedding public override ExecutableContent create(Interpreter interpreter) { - return new CustomExecutableContent(); + CustomExecutableContent execContent = new CustomExecutableContent(); + execContent.swigCMemOwn = false; + return execContent; } diff --git a/embedding/csharp/uSCXMLEmbedding/Extensions/CustomIOProc.cs b/embedding/csharp/uSCXMLEmbedding/Extensions/CustomIOProc.cs index 0480a34..866c148 100644 --- a/embedding/csharp/uSCXMLEmbedding/Extensions/CustomIOProc.cs +++ b/embedding/csharp/uSCXMLEmbedding/Extensions/CustomIOProc.cs @@ -3,6 +3,9 @@ using System.Collections.Generic; using System.Linq; using System.Text; using org.uscxml; +using System.Xml; +using System.Xml.XPath; +using System.IO; namespace embedding { @@ -10,7 +13,9 @@ namespace embedding { public override IOProcessor create(Interpreter interpreter) { - return new CustomIOProc(); + CustomIOProc ioProc = new CustomIOProc(); + ioProc.swigCMemOwn = false; + return ioProc; } public override Data getDataModelVariables() @@ -22,12 +27,39 @@ namespace embedding public override StringList getNames() { StringList names = new StringList(); - names.add("simple"); + names.add("custom"); return names; } public override void send(SendRequest req) { + Console.WriteLine(req); + // send in s1.onentry + if ("This is some content!" == req.getContent()) + { + returnEvent(new Event("received1")); + return; + } + // send in s2.onentry + if (req.getParams().ContainsKey("foo") + && "bar" == (req.getParams()["foo"][0].getAtom())) + { + returnEvent(new Event("received2")); + return; + } + // send in s3 + if (req.getXML().Length > 0) + { + XmlReaderSettings set = new XmlReaderSettings(); + set.ConformanceLevel = ConformanceLevel.Fragment; + XPathDocument doc = new XPathDocument(XmlReader.Create(new StringReader(req.getXML()), set)); + XPathNavigator nav = doc.CreateNavigator(); + + Console.WriteLine("Root element :" + nav.SelectSingleNode("/").Value); + returnEvent(new Event("received3")); + return; + } + } } } diff --git a/embedding/csharp/uSCXMLEmbedding/Extensions/CustomInvoker.cs b/embedding/csharp/uSCXMLEmbedding/Extensions/CustomInvoker.cs index da941b0..7c174ed 100644 --- a/embedding/csharp/uSCXMLEmbedding/Extensions/CustomInvoker.cs +++ b/embedding/csharp/uSCXMLEmbedding/Extensions/CustomInvoker.cs @@ -13,7 +13,9 @@ namespace embedding { public override Invoker create(Interpreter interpreter) { - return new CustomInvoker(); + CustomInvoker invoker = new CustomInvoker(); + invoker.swigCMemOwn = false; + return invoker; } public override Data getDataModelVariables() @@ -31,20 +33,20 @@ namespace embedding public override void invoke(InvokeRequest req) { - } - - public override void send(SendRequest req) - { Console.WriteLine(req); // send in s1.onentry - if ("This is some content!" == req.getContent()) + if ("Some string content" == req.getContent()) { - returnEvent(new Event("received1")); + returnEvent(new Event("received1"), true); return; } + } + + public override void send(SendRequest req) + { + Console.WriteLine(req); // send in s2.onentry - if (req.getParams().ContainsKey("foo") - && "bar" == (req.getParams()["foo"][0].getAtom())) + if (req.getName() == "foo") { returnEvent(new Event("received2")); return; diff --git a/embedding/csharp/uSCXMLEmbedding/RunTests.cs b/embedding/csharp/uSCXMLEmbedding/RunTests.cs index d98bca1..38e3736 100644 --- a/embedding/csharp/uSCXMLEmbedding/RunTests.cs +++ b/embedding/csharp/uSCXMLEmbedding/RunTests.cs @@ -29,14 +29,19 @@ namespace embedding SetDllDirectory("C:\\Users\\sradomski\\Desktop\\build\\uscxml\\lib\\csharp"); } - testLifeCycle(); - testExecutableContent(); - testIOProcessor(); - testInvoker(); + int i = 1; + while (i-- > 0) + { + testLifeCycle(); + testExecutableContent(); + testIOProcessor(); + testInvoker(); + } Console.ReadKey(); } public static void testInvoker() { + Console.WriteLine("testInvoker"); CustomInvoker invoker = new CustomInvoker(); // just register prototype at global factory Factory.getInstance().registerInvoker(invoker); @@ -47,13 +52,15 @@ namespace embedding " " + " Some string content" + " " + - " " + + " " + " " + - " " + + " " + + " " + " " + " " + " " + " " + + " " + " " + " " + " " + @@ -69,6 +76,7 @@ namespace embedding public static void testIOProcessor() { + Console.WriteLine("testIOProcessor"); CustomIOProc ioproc = new CustomIOProc(); // just register prototype at global factory Factory.getInstance().registerIOProcessor(ioproc); @@ -77,7 +85,7 @@ namespace embedding "" + " " + " " + - " " + + " " + " This is some content!" + " " + " " + @@ -85,7 +93,7 @@ namespace embedding " " + " " + " " + - " " + + " " + " " + " " + " " + @@ -93,7 +101,7 @@ namespace embedding " " + " " + " " + - " " + + " " + " " + " " + " " + @@ -112,6 +120,7 @@ namespace embedding public static void testExecutableContent() { + Console.WriteLine("testExecutableContent"); CustomExecutableContent execContent = new CustomExecutableContent(); Factory.getInstance().registerExecutableContent(execContent); @@ -119,12 +128,12 @@ namespace embedding "\n" + " \n" + " \n" + - " \n" + + "