Skip to main content

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

  1. Create a new Component called basic_oms, and create a new interface for it called basic_oms_if.
  2. basic_oms_if should have a single port called in, which uses the OMS::UCI::v74.0 message set and select any single OMS message contained therein. The direction should be In, and the type should be Data. Make sure to click Add, then Create and Use Interface and Create Component.
  3. When the workspace for the basic_oms Component opens, select the Workflows view in the top right and create a new workflow called gen.
  4. Skip the webhook selection
  5. Click on the gen workflow you created, then Add Tasks
  6. Configure the Code Gen 3.0 (NOT Code Gen) plugin, use default settings, and select Add to Workflow.
note

If 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.

  1. Configure the Cppcheck plugin with the Text Output (Directory) option. Set the Source Directory to code-gen-3/ (to match the output from code gen) and then click Add to Workflow.
  2. Hover over the Code Gen plugin in the Workflow Tree, then click and drag from the light grey border to the Cppcheck plugin to connect them.
  3. Configure the G++ plugin, selecting the Makefile Compilation option. Change the Root Directory to code-gen-3/, and the Output Location to libtangram_cal.so, then add the plugin to the workflow.
  4. Connect the Code Gen 3.0 plugin to the G++ plugin
  5. Click Run Workflow in the top right. For a new workflow, you may see Error triggering the workflow appear the first time running. You can ignore this, a new Active Job should appear shortly.
  6. 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:

# go to support directory
cd ~/tangramtransportssupport-cpp/ZeroMQ

# Create directory to install zmq into
rm -rf local_install && mkdir local_install

## Build c lib
cd libzmq
./autogen.sh
# install to local folder
./configure --prefix=$(cd ../local_install; pwd)
make -j4
make install

## Build c++ lib
cd ../cppzmq
rm -rf build && mkdir build
cd build
# pkg-config needs to know where to find libzmq
export PKG_CONFIG_PATH="$(cd ../../local_install/lib/pkgconfig; pwd)"
# install to local folder
cmake3 -D CMAKE_INSTALL_PREFIX=$(cd ../../local_install; pwd) -D CPPZMQ_BUILD_TESTS=OFF ..

make -j4
make install

For ActiveMQ:

# go to support directory
cd ~/tangramtransportssupport-cpp/ActiveMQ

LOCAL_INSTALL=$(cd local_install; pwd)

# Build APR first
cd apr-1.7.0
make distclean
./configure --prefix=$LOCAL_INSTALL
make -j4
make install

# build AMQ C++ lib
cd ../activemq-cpp-library-3.9.5
make distclean
./autogen.sh
./configure --prefix=$LOCAL_INSTALL --with-apr=$LOCAL_INSTALL
make -j4
make 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:

make clean
make -j4 depdir=~/tangramtransportssupport-cpp

You can then select the type of underlying transport to use:

ZeroMQ:

make -j4 depdir=~/tangramtransportssupport-cpp use_zeromq

ActiveMQ:

make -j4 depdir=~/tangramtransportssupport-cpp use_activemq

Building ZeroMQProxy

export LD_LIBRARY_PATH="<code-gen path>/transports-cpp/libs:${LD_LIBRARY_PATH}"
make -j4 zmqdir=~/tangramtransportssupport-cpp/ZeroMQ/local_install

Building OMS CAL

make clean
make -j4

Building OMS end-to-end test

cd test/end-to-end
# TRANSPORT_HOME needs to be the full path
export TRANSPORT_HOME=/root/Downloads/code-gen-3/dependencies/transports-cpp
make transport_home=$TRANSPORTS_HOME clean
make -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.

# 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_PATH
export 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 reader
cd <code-gen path>/oms/test/end-to-end/readers
# NOTE: the transports-cpp/libs path must be in your LD_LIBRARY_PATH
export LD_LIBRARY_PATH="$(cd ../../../dependencies/transports-cpp/libs; pwd):${LD_LIBRARY_PATH}"
./<msg name>TestReader

# Shell 3: Run the writer
cd <code-gen path>/oms/test/end-to-end/writers
# NOTE: the transports-cpp/libs path must be in your LD_LIBRARY_PATH
export LD_LIBRARY_PATH="$(cd ../../../dependencies/transports-cpp/libs; pwd):${LD_LIBRARY_PATH}"
./<msg name>TestWriter