Skip to content

Commit

Permalink
Merge pull request #138 from elfenpiff/iox-#32-unit-tests-for-mac
Browse files Browse the repository at this point in the history
Iox #32 Mac OS fully supported
  • Loading branch information
mossmaurice authored Jun 25, 2020
2 parents 87ffb17 + 0fc970a commit 5dcc139
Show file tree
Hide file tree
Showing 97 changed files with 896 additions and 2,390 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/build-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@ jobs:
- name: Build tests
run: $GITHUB_WORKSPACE/tools/iceoryx_build_test.sh build-test

# - name: Run tests
# run: |
# cd $GITHUB_WORKSPACE/build
# ../tools/run_all_tests.sh
- name: Run tests
run: |
cd $GITHUB_WORKSPACE/build
../tools/run_all_tests.sh disable-timing-tests
117 changes: 76 additions & 41 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,24 +75,33 @@ the interwebs on a lonely evening, he finds out about iceoryx: Free-to-use, high
runtime overhead, real-time support! Brilliant! Maybe even Robby's biggest wish for a network binding will come true,
so he can stream his favorite [video](https://www.youtube.com/watch?v=g5NkgZXWl0w) even faster!

## Download
## Installation

<!--
Either download our pre-built daemon (called RouDi) and our runtime lib or build everything yourself.
### Release
iceoryx_utils and iceoryx_posh are deployed as independent cmake packages. Posh is using some functions from utils and is depending on it. You are able to build posh and utils and integrate in into existing cmake projects.

wget iceoryx.deb
dpkg -i iceoryx.deb
### Prerequisites

You've successfully installed iceoryx! Continue with the section examples to see how to get started developing applications using iceoryx.
-->
#### Mac OS

### Development
Before installing iceoryx you need a XCode installation, git and optional an installed ncurses library for
the introspection client. To install ncurses locally into your build folder follow these steps
```
cd iceoryx
ICEORYX_DIR=$PWD
mkdir -p build
cd build
git clone https://github.com/mirror/ncurses.git
cd ncurses
git checkout v6.2
./configure --prefix=$ICEORYX_DIR/build/dependencies/ --exec-prefix=$ICEORYX_DIR/build/dependencies/ --with-termlib
make -j12
make install
```

Great that you want start developing iceoryx! In order to get started please consider the next sections.
If you would like to use our Cyclone DDS Gateway you have to install Cyclone DDS first, see
[https://github.com/eclipse-cyclonedds/cyclonedds](https://github.com/eclipse-cyclonedds/cyclonedds).

#### Prerequisites
#### Linux

Although we strive to be fully POSIX-compliant, we recommend using Ubuntu 18.04 and at least GCC 7.4.0 for development.

Expand All @@ -103,40 +112,66 @@ You will need to install the following packages:
Additionally, there is an optional dependency to the MIT licensed cpptoml library, which is used to parse a RouDi config file for the mempool config.
[cpptoml](https://github.com/skystrife/cpptoml)

#### Build from sources

iceoryx_utils and iceoryx_posh are deployed as independent cmake packages. Posh is using some functions from utils and is depending on it. You are able to build posh and utils and integrate in into existing cmake projects.
### Build with CMake (all supported platforms)

##### Build Script
For the first start, we advise to use our build-test script for building everything.
**NOTE:** Requires CMake version 3.14 or higher. If you only have CMake version 3.5 or higher available please use the
build script.

The `CMakeLists.txt` from `iceoryx_meta` can be used to easily develop iceoryx with an IDE.

1. Clone the repository
```
git clone https://github.com/eclipse/iceoryx.git
./tools/iceoryx_build_test.sh

In default-mode, the script is not building the provided test. For a clean build just add "clean" as first argument to the script.

If the script is not used, keep in mind to pass `-DTOML_CONFIG=on` to cmake if the optional RouDi config file feature shall be built.

**NOTE:** Users who wish to build iceoryx with cmake can follow the below steps (Requires CMake 3.14 or higher).

* Step into root folder of iceoryx.

* Execute the below commands.

```
iceoryx$ cmake -Bbuild -Hiceoryx_meta // Customisation possible with cmake switches
iceoryx$ cmake --build build
```

#### Build with tests

To build iceoryx with tests, just add "test" as first argument to the script.
```
2. Generate the necessary build files
```bash
cd iceoryx
cmake -Bbuild -Hiceoryx_meta -DTOML_CONFIG=ON
# when you have installed external dependencies like ncurses you have to add them
# to your prefix path
cmake -Bbuild -Hiceoryx_meta -DTOML_CONFIG=ON -DCMAKE_PREFIX_PATH=$(PWD)/build/dependencies/
```
```
3. Compile the source code
```
cmake --build build
```
With the following CMake switches you can add additional features:
| switch | description |
|:---------|:-------------|
| ```dds``` | builds the iceoryx dds gateway which requires an installed CycloneDDS, see [https://github.com/eclipse-cyclonedds/cyclonedds](https://github.com/eclipse-cyclonedds/cyclonedds) |
| ```examples``` | builds all examples |
| ```introspection``` | the console introspection client which requires an installed ncurses library with terminfo support |
| ```test``` | enables module-, integration- and component-tests |
| ```TOML_CONFIG``` | activates config file support by using toml, if this is deactivated the central broker ```RouDi``` is not being build |
### Build with the build script (only Linux and QNX)
As an alternative we provide our build-test script which we use to integrate
iceoryx into our infrastructure.
1. Clone the repository
```
git clone https://github.com/eclipse/iceoryx.git
```
./tools/iceoryx_build_test.sh test
2. Build everything
```
cd iceoryx
./tools/iceoryx_build_test.sh
```
The Googletest-Framework will be automatically fetched from github and the test will be executed and the end of the script.
With the following arguments you can add additional features:
| switch | description |
|:---------|:-------------|
| ```clean``` | Removes the build directory and performs a clean build. If you have installed ncurses locally into your build directory you have to reinstall it first. |
| ```test``` | Enables module-, integration- and component-tests. The Googletest-Framework will be automatically fetched from github and the test will be executed and the end of the script. |
##### Build with colcon
### Build with colcon
Alternatively, iceoryx can be built with [colcon](https://colcon.readthedocs.io/en/released/user/installation.html) to provide a smooth integration for ROS2 developers.
Expand All @@ -152,7 +187,7 @@ This build method makes the most sense in combination with [rmw_iceoryx](https:/
Congrats! You've build all the necessary things to continue playing around with the examples.
##### Build and run in a Docker environment
### Build and run in a Docker environment
If you want to avoid installing anything on your host machine but you have Docker installed, it is possible to use it to build and run iceoryx applications.
Expand Down
16 changes: 11 additions & 5 deletions cmake/cpptoml/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
cmake_minimum_required(VERSION 3.5)
project(cpptoml-build CXX)

if(WIN32)
set(CREATE_PATH_COMMAND mkdir)
else()
set(CREATE_PATH_COMMAND mkdir -p)
endif(WIN32)

# set download config, source and build paths
set(DOWNLOAD_CONFIG_DIR ${CMAKE_BINARY_DIR}/cpptoml-download)
set(SOURCE_DIR ${CMAKE_BINARY_DIR}/cpptoml-src)
set(BUILD_DIR ${CMAKE_BINARY_DIR}/cpptoml-build)
set(INSTALL_DIR ${CMAKE_INSTALL_PREFIX})
set(DOWNLOAD_CONFIG_DIR ${CMAKE_BINARY_DIR}/dependencies/cpptoml/download)
set(SOURCE_DIR ${CMAKE_BINARY_DIR}/dependencies/cpptoml/src)
set(BUILD_DIR ${CMAKE_BINARY_DIR}/dependencies/cpptoml/build)
set(INSTALL_DIR ${CMAKE_BINARY_DIR}/dependencies/install)

# Download and unpack cpptoml at configure time
configure_file(cpptoml.cmake.in ${DOWNLOAD_CONFIG_DIR}/CMakeLists.txt)
Expand All @@ -23,7 +29,7 @@ if(result)
message(FATAL_ERROR "Build step [download] for cpptoml failed: ${result}")
endif()

execute_process(COMMAND mkdir -p "${BUILD_DIR}"
execute_process(COMMAND ${CREATE_PATH_COMMAND} "${BUILD_DIR}"
RESULT_VARIABLE result
WORKING_DIRECTORY ${CMAKE_BINARY_DIR} )
if(result)
Expand Down
4 changes: 2 additions & 2 deletions cmake/cpptoml/cpptoml.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ include(ExternalProject)
ExternalProject_Add(ext_cpptoml
GIT_REPOSITORY https://github.com/skystrife/cpptoml.git
GIT_TAG v0.1.1
SOURCE_DIR "${CMAKE_BINARY_DIR}/cpptoml-src"
BINARY_DIR "${CMAKE_BINARY_DIR}/cpptoml-build"
SOURCE_DIR "${CMAKE_BINARY_DIR}/dependencies/cpptoml/src"
BINARY_DIR "${CMAKE_BINARY_DIR}/dependencies/cpptoml/build"
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
INSTALL_COMMAND ""
Expand Down
13 changes: 8 additions & 5 deletions cmake/googletest/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,16 @@ project(googletest-build CXX)
if(test)
if(WIN32)
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
set(CREATE_PATH_COMMAND mkdir)
else()
set(CREATE_PATH_COMMAND mkdir -p)
endif(WIN32)

# set download confi, source and build paths
set(DOWNLOAD_CONFIG_DIR ${CMAKE_BINARY_DIR}/googletest-download)
set(SOURCE_DIR ${CMAKE_BINARY_DIR}/googletest-src)
set(BUILD_DIR ${CMAKE_BINARY_DIR}/googletest-build)
set(INSTALL_DIR ${CMAKE_INSTALL_PREFIX})
set(DOWNLOAD_CONFIG_DIR ${CMAKE_BINARY_DIR}/dependencies/googletest/download)
set(SOURCE_DIR ${CMAKE_BINARY_DIR}/dependencies/googletest/src)
set(BUILD_DIR ${CMAKE_BINARY_DIR}/dependencies/googletest/build)
set(INSTALL_DIR ${CMAKE_BINARY_DIR}/dependencies/install)

# Download and unpack googletest at configure time
configure_file(googletest.cmake.in ${DOWNLOAD_CONFIG_DIR}/CMakeLists.txt)
Expand All @@ -28,7 +31,7 @@ if(test)
message(FATAL_ERROR "Build step [download] for googletest failed: ${result}")
endif()

execute_process(COMMAND mkdir -p "${BUILD_DIR}"
execute_process(COMMAND ${CREATE_PATH_COMMAND} "${BUILD_DIR}"
RESULT_VARIABLE result
WORKING_DIRECTORY ${CMAKE_BINARY_DIR} )
if(result)
Expand Down
8 changes: 4 additions & 4 deletions cmake/googletest/googletest.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ if(WIN32)
ExternalProject_Add(googletest
GIT_REPOSITORY https://github.com/google/googletest.git
GIT_TAG release-1.10.0
SOURCE_DIR "${CMAKE_BINARY_DIR}/googletest-src"
BINARY_DIR "${CMAKE_BINARY_DIR}/googletest-build"
SOURCE_DIR "${CMAKE_BINARY_DIR}/dependencies/googletest/src"
BINARY_DIR "${CMAKE_BINARY_DIR}/dependencies/googletest/build"
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
INSTALL_COMMAND ""
Expand All @@ -18,8 +18,8 @@ else()
ExternalProject_Add(googletest
GIT_REPOSITORY https://github.com/google/googletest.git
GIT_TAG release-1.8.1
SOURCE_DIR "${CMAKE_BINARY_DIR}/googletest-src"
BINARY_DIR "${CMAKE_BINARY_DIR}/googletest-build"
SOURCE_DIR "${CMAKE_BINARY_DIR}/dependencies/googletest/src"
BINARY_DIR "${CMAKE_BINARY_DIR}/dependencies/googletest/build"
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
INSTALL_COMMAND ""
Expand Down
Empty file added iceoryx_dds/COLCON_IGNORE
Empty file.
69 changes: 27 additions & 42 deletions iceoryx_meta/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,53 +1,38 @@
cmake_minimum_required(VERSION 3.14)
cmake_minimum_required(VERSION 3.5)
file (STRINGS "../VERSION" iceoryx_VERSION)
project(iceoryx VERSION ${iceoryx_VERSION})

#uncomment this as soon the ExternalProject install path issue is solved
#if(test)
# add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../cmake/googletest ${CMAKE_BINARY_DIR}/gtest)
#endif(test)
option(TOML_CONFIG "activates or deactivates TOML support - without TOML RouDi will not be build" ON)
option(test "Build tests" ON)
option(examples "build with iceoryx examples" ON)
option(introspection "builds the introspection client which requires the ncurses library with an activated terminfo feature" OFF)
option(diagnostic "enables allmost all compiler warnings" OFF)
option(dds "enables dds support by compiling the iceoryx dds gateway" OFF)

if(TOML_CONFIG)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../cmake/cpptoml/ ${CMAKE_BINARY_DIR}/dependencies/cpptoml/prebuild)
endif(TOML_CONFIG)

include(FetchContent)
if(diagnostic)
add_compile_options(-Wall -W -Wextra -pedantic)
endif(diagnostic)

set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
if(test)
FetchContent_Declare(
GOOGLETEST
GIT_REPOSITORY https://github.com/google/googletest.git
GIT_TAG release-1.10.0
)
FetchContent_GetProperties(GOOGLETEST)
if (NOT googletest_POPULATED)
message(STATUS "updating: googletest" )
FetchContent_Populate(GOOGLETEST)
add_subdirectory(${googletest_SOURCE_DIR} ${googletest_BINARY_DIR})
set(GTest_FOUND true)
add_library(GTest::gtest ALIAS gtest)
add_library(GTest::gmock ALIAS gmock)
endif(NOT googletest_POPULATED)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../cmake/googletest ${CMAKE_BINARY_DIR}/dependencies/googletest/prebuild)
endif(test)

# must be additionally defined here, otherwise TOML_CONFIG is on default off
# and the module is loaded only after the second cmake -Bbuild -Hiceoryx_meta command call
option(TOML_CONFIG "activates or deactivates TOML support - without TOML RouDi will not be build" ON)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../iceoryx_utils ${CMAKE_BINARY_DIR}/utils)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../iceoryx_posh ${CMAKE_BINARY_DIR}/posh)

if (TOML_CONFIG )
FetchContent_Declare(
CPPTOML
GIT_REPOSITORY https://github.com/skystrife/cpptoml
GIT_TAG v0.1.1
)
FetchContent_GetProperties(CPPTOML)
if (NOT cpptoml_POPULATED)
message(STATUS "updating: cpptoml" )
FetchContent_Populate(CPPTOML)
add_subdirectory(${cpptoml_SOURCE_DIR} ${cpptoml_BINARY_DIR})
set(cpptoml_FOUND true)
endif(NOT cpptoml_POPULATED)
endif(TOML_CONFIG)
if(introspection)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../tools/introspection ${CMAKE_BINARY_DIR}/iceoryx_introspection)
endif(introspection)

if(examples)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../iceoryx_examples/icedelivery ${CMAKE_BINARY_DIR}/iceoryx_examples/icedelivery)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../iceoryx_examples/iceperf ${CMAKE_BINARY_DIR}/iceoryx_examples/iceperf)
endif(examples)

add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../iceoryx_utils ${CMAKE_BINARY_DIR}/iceoryx_utils )
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../iceoryx_posh ${CMAKE_BINARY_DIR}/iceoryx_posh )
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../iceoryx_examples/icedelivery ${CMAKE_BINARY_DIR}/examples/icedelivery )
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../iceoryx_examples/iceperf ${CMAKE_BINARY_DIR}/examples/iceperf )
if(dds)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../iceoryx_dds ${CMAKE_BINARY_DIR}/iceoryx_dds)
endif(dds)
12 changes: 5 additions & 7 deletions iceoryx_posh/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -266,16 +266,14 @@ endif(ICEORYX_LARGE_DEPLOYMENT)
#
########## exporting library ##########
#
if(TOML_CONFIG)
set(ROUDI_EXPORT RouDi)
endif(TOML_CONFIG)

setup_install_directories_and_export_package(
TARGETS iceoryx_posh iceoryx_posh_roudi
TARGETS iceoryx_posh iceoryx_posh_roudi ${ROUDI_EXPORT}
INCLUDE_DIRECTORY include/
)
if(TOML_CONFIG)
setup_install_directories_and_export_package(
TARGETS RouDi
INCLUDE_DIRECTORY include/
)
endif(TOML_CONFIG)

if(test)
add_subdirectory(test)
Expand Down
13 changes: 13 additions & 0 deletions iceoryx_posh/include/iceoryx_posh/iceoryx_posh_types.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,24 @@ namespace popo
class SenderPort;
class ReceiverPort;
} // namespace popo
namespace posix
{
class UnixDomainSocket;
class MessageQueue;
} // namespace posix

using SenderPortType = iox::popo::SenderPort;
using ReceiverPortType = iox::popo::ReceiverPort;

constexpr char MQ_ROUDI_NAME[] = "/roudi";
/// @brief The socket is created in the current path if no absolute path is given hence
/// we need an absolut path so that every application knows where our sockets can
/// be found.
#if defined(__APPLE__)
using IpcChannelType = iox::posix::UnixDomainSocket;
#else
using IpcChannelType = iox::posix::MessageQueue;
#endif

/// shared memmory segment for the iceoryx managment data
constexpr char SHM_NAME[] = "/iceoryx_mgmt";
Expand Down
Loading

0 comments on commit 5dcc139

Please sign in to comment.