Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CMakeLists fixes, to allow out-of-directory builds #2

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
95 changes: 91 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
##Tutorial

Text can be found here:

* Link: http://www.researchgate.net/publication/273136749_The_Data_Distribution_Service_Tutorial
* Source: https://github.com/PrismTech/dds-tutorial

#Overview

This repository contains the code C++ examples for the
Expand All @@ -13,24 +20,104 @@ this should not pose a problem.

To try out the examples you need to have:

- OpenSplice DDS (http://opensplice.org | http://prismtech.com)
- OpenSplice DDS (https://github.com/PrismTech/opensplice | http://opensplice.org | http://prismtech.com)
- g++ or clang with support for C+0x
- cmake 2.8 or higher

##Install OpenSplice

Here's a script for x86_64

```bash
#!/usr/bin/env bash


# http://www.prismtech.com/dds-community/building
# (but you don't need tao and all that stuff)

sudo apt-get install flex bison gawk

git clone https://github.com/PrismTech/opensplice.git

BASE_PATH=$(readlink -f opensplice)

cd $BASE_PATH
mkdir -p submods
cd submods
git clone https://github.com/OpenSplice/MPC_ROOT.git

cd $BASE_PATH

echo
echo " ####"
echo "When prompted (just now) for target: hit 6 (for x86_64.linux-dev)"
echo "Hit enter to continue..."

read

source ./configure
make
make install

sed -i "s|@@INSTALLDIR@@|$BASE_PATH/install|" $BASE_PATH/install/HDE/x86_64.linux-dev/release.com


# Please select a target number:6

# GCC: OK - using version 5.2.1
# NOTE: enabling link-time optimizations in release build
# GLIBC: version 2.19
# MAKE: OK - using GNU Make 4.0
# Perl: OK - using perl version='5.20.2';
# Qt: Warning - Cannot find Qt libraries. Standalone demo package will not be built.
# Please specifiy QTLIBDIR.
# GAWK: OK - using GNU Awk 4.1.1, API: 1.1 (GNU MPFR 3.1.3, GNU MP 6.0.0)
# BISON: OK - using bison (GNU Bison) 3.0.4
# FLEX: OK - using 2.5.39
# JAVAC: Warning - Java compiler environment not set, building of all Java related features is disabled.
# GMCS: Warning - No gmcs compiler found
# gmcs C# compiler not found, disabling SACS api build.
# TAO: Warning - No TAO found
# TAO environment not set, disabling TAO related features.
# JACORB: Warning - JACORB_HOME not set
# JACORB environment not set, disabling JACORB related features.
# GSOAP: Warning - Not found, cmsoap will not be built
# Doxygen: OK
# Configuration OK

# Variable Setup
# SPLICE_TARGET = x86_64.linux-dev
# SPLICE_HOST = x86_64.linux-dev
# OSPL_HOME = /tmp/opensplice
# SPLICE_ORB =
```

Once you have installed OpenSplice you'll have to configure
the support for C++11 -- by default OpenSplice C++ API is
built for C++98.

To enable C++11 support follow the instructions described
here http://dev.opensplice.org/releases/downloads/docs/isocpp/html/isocpp_customlibs.html

Basically do:
```bash
cd opensplice/install/HDE/x86_64.linux-dev/custom_lib

nano Makefile.Build_DCPS_ISO_Cpp_Lib
## add -std=c++11 to the CPPFLAGS line !!!!!!!!!!

make -f Makefile.Build_DCPS_ISO_Cpp_Lib clean
make -f Makefile.Build_DCPS_ISO_Cpp_Lib
```

## Compiling
To compile simply do:

$ cmake .
$ make

```
. opensplice/install/HDE/x86_64.linux-dev/custom_lib/release.com ## source opensplice
cmake .
make -j2 -l2
```

That's it.

Expand Down
4 changes: 2 additions & 2 deletions ch1/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
cmake_minimum_required (VERSION 2.6)
set(CMAKE_MODULE_PATH ../cmake)
set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/../cmake)
project (dds-tutorial)

include (MacroOpenSplice)
Expand All @@ -17,7 +17,7 @@ include_directories(
set (idls TempControl.idl)

foreach(idl ${idls})
OpenSplice_IDLGEN (${idl})
OpenSplice_IDLGEN (${CMAKE_SOURCE_DIR}/${idl})
string (REGEX REPLACE "\(.*\).idl" "./gen/\\1.cpp" VARS_1 ${idl})
string (REGEX REPLACE "\(.*\).idl" "./gen/\\1.h" VARS_2 ${idl})
string (REGEX REPLACE "\(.*\).idl" "./gen/\\1Dcps.cpp" VARS_3 ${idl})
Expand Down
4 changes: 2 additions & 2 deletions ch2/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
cmake_minimum_required (VERSION 2.6)
set(CMAKE_MODULE_PATH ../cmake)
set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/../cmake)
project (dds-tutorial)

include (MacroOpenSplice)
Expand All @@ -17,7 +17,7 @@ include_directories(
set (idls TempControl.idl)

foreach(idl ${idls})
OpenSplice_IDLGEN (${idl})
OpenSplice_IDLGEN (${CMAKE_SOURCE_DIR}/${idl})
string (REGEX REPLACE "\(.*\).idl" "./gen/\\1.cpp" VARS_1 ${idl})
string (REGEX REPLACE "\(.*\).idl" "./gen/\\1.h" VARS_2 ${idl})
string (REGEX REPLACE "\(.*\).idl" "./gen/\\1Dcps.cpp" VARS_3 ${idl})
Expand Down
4 changes: 2 additions & 2 deletions ch3/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
cmake_minimum_required (VERSION 2.6)
set(CMAKE_MODULE_PATH ../cmake)
set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/../cmake)
project (dds-tutorial)

include (MacroOpenSplice)
Expand All @@ -17,7 +17,7 @@ include_directories(
set (idls TempControl.idl)

foreach(idl ${idls})
OpenSplice_IDLGEN (${idl})
OpenSplice_IDLGEN (${CMAKE_SOURCE_DIR}/${idl})
string (REGEX REPLACE "\(.*\).idl" "./gen/\\1.cpp" VARS_1 ${idl})
string (REGEX REPLACE "\(.*\).idl" "./gen/\\1.h" VARS_2 ${idl})
string (REGEX REPLACE "\(.*\).idl" "./gen/\\1Dcps.cpp" VARS_3 ${idl})
Expand Down
2 changes: 1 addition & 1 deletion cmake/FindOpenSplice.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ FIND_LIBRARY(DCPSCPP_LIBRARY
SET(OpenSplice_LIBRARIES
${KERNEL_LIBRARY}
${DCPSISOCPP_LIBRARY}
${DCPSCPP_LIBRARY}
# ${DCPSCPP_LIBRARY}

)

Expand Down