Workflows and Builds
Once Tangram Pro™ has been installed successfully, after designing a Component-based system, you can use Tangram Workflows to generate a Component-software interface (CSI) and build your system.
Example Workflow
Create a new Component called
basic_oms
, and create a new interface for it calledbasic_oms_if
.basic_oms_if
should have a single port called in, which uses theOMS::UCI::v74.0
message set and select any single OMS message contained therein. The direction should beIn
, and the type should beData
. Make sure to clickAdd
, thenCreate
andUse Interface
andCreate Component
.When the workspace for the
basic_oms
Component opens, select theWorkflows
view in the top right and create a new workflow calledgen
.Skip the webhook selection
Click on the
gen
workflow you created, thenAdd Tasks
Configure the
Code Gen 3.0
(NOT Code Gen) plugin, use default settings, and selectAdd to Workflow
.noteIf you look at the default settings, you'll notice that the plugin will be outputting generated code to the
code-gen-3/
folder. This is important to configure subsequent tasks.Configure the
Cppcheck
plugin with theText Output (Directory)
option. Set theSource Directory
tocode-gen-3/
(to match the output from code gen) and then clickAdd to Workflow
.Hover over the
Code Gen
plugin in the Workflow Tree, then click and drag from the light grey border to theCppcheck
plugin to connect them.Configure the
G++
plugin, selecting theMakefile Compilation
option. Change the Root Directory tocode-gen-3/
, and the Output Location tolibtangram_cal.so
, then add the plugin to the workflow.Connect the
Code Gen 3.0
plugin to theG++
pluginClick
Run Workflow
in the top right. For a new workflow, you may seeError triggering the workflow
appear the first time running. You can ignore this, a new Active Job should appear shortly.Wait for the job to finish.
Building Code-Gen Output
To successfully build everything in the VM, you'll need to build the support libraries that are included at ~/tangramtransportssupport-cpp
.
- If you chose the ZeroMQ transport in the CodeGen plugin configuration, you should build the ZeroMQ support libraries as well as the ZeroMQProxy located at
~/ZeroMQProxy
. - If you chose the ActiveMQ transport, you should build the ActiveMQ support library. The Apache ActiveMQ JAR file is already present in the support folders, if you need to run the broker.
- After building the required dependency, you'll need to build
transports-cpp
, which is located inside the downloaded artifact folder that you got from the CodeGen plugin in the workflow. - After
transports-cpp
is built, you should build the CAL and then (optionally) build the end-to-end test. - Finally, if you wish you can run the end-to-end test.
Building tangramtransportssupport-cpp
For ZeroMQ:
bash
# go to support directorycd ~/tangramtransportssupport-cpp/ZeroMQ# Create directory to install zmq intorm -rf local_install && mkdir local_install## Build c libcd libzmq./autogen.sh# install to local folder./configure --prefix=$(cd ../local_install; pwd)make -j4make install## Build c++ libcd ../cppzmqrm -rf build && mkdir buildcd build# pkg-config needs to know where to find libzmqexport PKG_CONFIG_PATH="$(cd ../../local_install/lib/pkgconfig; pwd)"# install to local foldercmake3 -D CMAKE_INSTALL_PREFIX=$(cd ../../local_install; pwd) -D CPPZMQ_BUILD_TESTS=OFF ..make -j4make install
For ActiveMQ:
bash
# go to support directorycd ~/tangramtransportssupport-cpp/ActiveMQLOCAL_INSTALL=$(cd local_install; pwd)# Build APR firstcd apr-1.7.0make distclean./configure --prefix=$LOCAL_INSTALLmake -j4make install# build AMQ C++ libcd ../activemq-cpp-library-3.9.5make distclean./autogen.sh./configure --prefix=$LOCAL_INSTALL --with-apr=$LOCAL_INSTALLmake -j4make install
Building transports-cpp
This requires a compiler with full C++11 support, such as the GCC 9.3 compiler included in the VM.
You can build the Transport library with:
bash
make cleanmake -j4 depdir=~/tangramtransportssupport-cpp
You can then select the type of underlying transport to use:
ZeroMQ:
bash
make -j4 depdir=~/tangramtransportssupport-cpp use_zeromq
ActiveMQ:
bash
make -j4 depdir=~/tangramtransportssupport-cpp use_activemq
Building ZeroMQProxy
bash
export LD_LIBRARY_PATH="<code-gen path>/transports-cpp/libs:${LD_LIBRARY_PATH}"make -j4 zmqdir=~/tangramtransportssupport-cpp/ZeroMQ/local_install
Building OMS CAL
bash
make cleanmake -j4
Building OMS end-to-end test
bash
cd test/end-to-end# TRANSPORT_HOME needs to be the full pathexport TRANSPORT_HOME=/root/Downloads/code-gen-3/dependencies/transports-cppmake transport_home=$TRANSPORTS_HOME cleanmake -j4 transport_home=$TRANSPORTS_HOME
Running OMS end-to-end test
The example provided uses ZeroMQ. The ActiveMQ broker should be used instead if using that transport.
bash
# Reader example, but run both the reader and the writer# You'll need three shells/tabs:# Shell 1: Start by running the proxy# NOTE: the transports-cpp/libs path must be in your LD_LIBRARY_PATHexport LD_LIBRARY_PATH="$(cd <path_to_cal_root>/dependencies/transports-cpp/libs; pwd):${LD_LIBRARY_PATH}"~/ZeroMQProxy/zmq_proxy tcp://*:6667 tcp://*:6668# Shell 2: Run the readercd <code-gen path>/oms/test/end-to-end/readers# NOTE: the transports-cpp/libs path must be in your LD_LIBRARY_PATHexport LD_LIBRARY_PATH="$(cd ../../../dependencies/transports-cpp/libs; pwd):${LD_LIBRARY_PATH}"./<msg name>TestReader# Shell 3: Run the writercd <code-gen path>/oms/test/end-to-end/writers# NOTE: the transports-cpp/libs path must be in your LD_LIBRARY_PATHexport LD_LIBRARY_PATH="$(cd ../../../dependencies/transports-cpp/libs; pwd):${LD_LIBRARY_PATH}"./<msg name>TestWriter