Compiling and running the example applications

Lars Hagström edited this page Sep 19, 2017 · 6 revisions

These instructions will help you to compile the example applications and run them. You will need Safir SDK Core version 6.3.10 to be able to follow these instructions. If you want to use an older version of Safir SDK Core the steps will be slightly different, and so is outside the scope of this guide.

These instructions show you an easiest way to accomplish this task on each platform. There are other ways to accomplish the same thing. For example you could use cmake and NMake or Ninja, or QtCreator.

Windows

If you didn't do that already, install Safir SDK Core as per Quick Start.

You will need to install Visual Studio of a version corresponding to the Safir SDK Core installer you used. Express/Community editions work fine (beware of licensing restrictions, though). You also need to install CMake. If you want to build the example Qt5 gui you will also need to install an appropriate version of Qt5.

Copy the example application code to your work area. The code is located in C:\Program Files\Safir SDK Core\docs\examples.

Now you need to build the example dou files and the example application code. This can be done in several ways, using the Visual Studio Command line, the Visual Studio IDE or a Safir SDK Core tool called Dobmake. These instructions are going to use the latter, because it is by far the easiest to describe. At some stage we will write up a guide for the IDE approach (send us a message to make this happen sooner rather than later).

Launch Dobmake from the Start Menu and:

  1. Select the CMakeLists.txt file in the copied examples directory for "Dou directory".
  2. Set "Prefix" to be the directory to which you want to install the example dou files and binaries. This will be important later.
  3. Click "Build & Install".
  4. Wait until the build is complete (you can view the log by clicking "Show Log").

You will now have built and installed the dou files and binaries to the directory you selected above.

Now you need to edit typesystem.ini (use "Edit typesystem.ini" in the Start Menu) to let Safir SDK Core know where your dou files and the generated dlls are.

Add the following section at the very bottom (replacing with the directory you selected in step 2 above):

[Example]
kind=library
dependencies=Core
dou_directory=<your install dir>\dou
cpp_library_location=<your install dir>\bin
dotnet_assembly_location=<your install dir>\dotnet
java_jar_location=<your install dir>\java

Now you should be able to launch safir_control, dope_main, sate (use "Run" or a command prompt to start the first two, and the start menu for the last one) and see the new example types in sate. You can now launch VehicleAppCpp and VehicleAppMmiCs (or VehicleAppMmiCppQt if you installed Qt5) to run the C++ example applications.

If you have any trouble, check the output of the commands above, and the Windows Event Log.

Ubuntu Linux

If you didn't do that already, install Safir SDK Core as per Quick Start.

Now you will need to install the development tools. You need g++, make and cmake, which can be installed using sudo apt-get install g++ make cmake. You may also want to install qt5-default if you want to build the example Qt5 gui. Install mono-devel and openjdk-7-jdk if you want to try out the C# and Java examples.

Now copy the example application code to your work area. cp -r /usr/share/doc/safir-sdk-core/examples $HOME should do it.

Step into the examples directory and run the following commands, one at a time, making sure they are successful.

cmake .              # configure the example code (note the space and period!)
make                 # compile the example code
sudo make install    # install the binaries and dou files into /usr/local
sudo /sbin/ldconfig  # make sure Linux can find the new libraries

If all goes well you should now have installed the example applications and dou files into /usr/local (which is not user-writeable, hence the use of sudo). If you prefer to install them somewhere else you can add -DCMAKE_INSTALL_PREFIX=<somewhere else> to the cmake command line, but then you will have to make sure the executables and libraries can be found by Linux (e.g. by modifying PATH and LD_LIBRARY_PATH).

Now you need to edit /etc/safir-sdk-core/typesystem.ini to let Safir SDK Core know where your dou files are. Add /usr/local/dou to dou_search_path near the top of the file:

dou_search_path=/usr/share/safir-sdk-core/dou,/usr/local/dou

And add the following section at the very bottom:

[Example]
kind=library
dependencies=Core

Now you should be able to launch safir_control, dope_main, sate and see the new example types in sate. You can now launch VehicleAppCpp and VehicleAppMmiCppQt to run the C++ example applications.

If you have any trouble, check the output of the commands above, and the system log /var/log/messages.

You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.