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

Automatic Code Generation Support #77

Merged
merged 66 commits into from
May 7, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
66 commits
Select commit Hold shift + click to select a range
3cad804
Bump CMake to 3.5
diegoferigo Apr 3, 2018
47a920c
Split toolbox components (library, simulink, coder)
diegoferigo Apr 3, 2018
9ef189c
Minor changes to MxAnyType
diegoferigo Apr 3, 2018
efe9671
Simplified ClockServer's CMakeLists.txt
diegoferigo Apr 3, 2018
0b10327
Moved images folder inside toolbox
diegoferigo Apr 3, 2018
e199a2e
Improved Log class
diegoferigo Apr 3, 2018
60fdb60
Ported log messages to the rewritten Log class
diegoferigo Apr 3, 2018
3ec8f34
Updated how to compute number of block's parameters
diegoferigo Apr 3, 2018
a121b75
Changed enums for signal DataType and DataFormat, and DynamicSize const
diegoferigo Apr 3, 2018
e61be50
New BlockInformation interface (1/3)
diegoferigo Apr 4, 2018
fdc5241
New BlockInformation interface (1/3) - Simulink implementation
diegoferigo Apr 3, 2018
3acd5a8
New BlockInformation interface (1/3) - Updated blocks
diegoferigo Apr 3, 2018
0819d68
New classes for processing parameters
diegoferigo Apr 3, 2018
3dc4d0c
Implemented new logic for parsing parameters
diegoferigo Apr 3, 2018
60d3053
New BlockInformation interface (2/3)
diegoferigo Apr 4, 2018
85da5fd
New BlockInformation interface (2/3) - Updated blocks
diegoferigo Apr 3, 2018
cf04c7e
Small changes in Configuration class
diegoferigo Apr 4, 2018
5aaff97
Explicit template specialization of RobotInterface::getInterface
diegoferigo Apr 4, 2018
502aea8
Explicit template specialization of Signal' getBuffer and setBuffer
diegoferigo Apr 4, 2018
9f637e0
Implemented new parameter parsing logic in SimulinkBlockInterface
diegoferigo Apr 4, 2018
9f1d535
Stricter checks on Signal validity
diegoferigo Apr 4, 2018
b7e0089
Renamed toolbox.cpp to WBToolbox.cpp
diegoferigo Apr 4, 2018
848c0c5
Improved S-Function functionalities
diegoferigo Apr 4, 2018
5b5a6b2
Write block parameters to RTW file
diegoferigo Apr 4, 2018
f8fbc45
Minor changes
diegoferigo Apr 4, 2018
46ced66
Handle yarp::os::Network in RealTimeSynchronizer
diegoferigo Apr 4, 2018
db96ba7
Developed a TLC file for inlining the WBToolbox.cpp S-Function
diegoferigo Apr 4, 2018
4eb79c9
Implemented BlockInformation for Simulink Coder
diegoferigo Apr 4, 2018
d193b7a
Small documentation changes
diegoferigo Apr 4, 2018
c6c67ed
Small edit in export_library.m
diegoferigo Apr 4, 2018
db1b52b
Updated .clang-format
diegoferigo Apr 4, 2018
0e54fe0
First wrapper version for the class autogenerated from the model
diegoferigo Apr 4, 2018
4896608
Put license headings in all files
diegoferigo Apr 6, 2018
3d3d9a0
Minor changes
diegoferigo Apr 6, 2018
1d35337
Fixed wrong buffer substitution in Signal class
diegoferigo Apr 6, 2018
d18ca36
Non-doc lines in doc commit
diegoferigo Apr 27, 2018
c50a0b3
Improved documentation
diegoferigo Apr 27, 2018
248d058
Allow omitting terminate() method if not necessary
diegoferigo Apr 27, 2018
60a496c
Implemented pimpl idiom for most classes
diegoferigo Apr 27, 2018
0c678fc
Cleaned headers using iwyu
diegoferigo Apr 27, 2018
6385004
Moved YarpInterface in cpp and minor related doxygen modifications
diegoferigo Apr 10, 2018
75c1d36
Pimpl idiom on wbt::Signal
diegoferigo Apr 10, 2018
cc1aa63
Minor argument name change
diegoferigo Apr 11, 2018
279bc4f
Used variable for setting external libraries in CMakeList.txt
diegoferigo Apr 11, 2018
0603018
Updated v3_1 changelog
diegoferigo Apr 11, 2018
cbf50e0
YARP and iCub are now linked privately
diegoferigo Apr 11, 2018
1f82185
Added new tests in Travis exploiting build stages
diegoferigo Apr 12, 2018
1e203d8
Compile S-Function only when Matlab is found
diegoferigo Apr 13, 2018
f623a55
Fixed wbt::Log for old versions of gcc and clang
diegoferigo Apr 13, 2018
eae3335
Missing header let osx fail compiling
diegoferigo Apr 16, 2018
99bd06a
Added new Appveyor test
diegoferigo Apr 16, 2018
6c5be76
Added badges in README
diegoferigo Apr 17, 2018
f440b3c
Fix Windows compilation
diegoferigo Apr 27, 2018
9011b26
Improved log messages of Parameters class
diegoferigo May 2, 2018
b4e532b
Small S-Function improvements
diegoferigo May 2, 2018
6e6bca4
Always check the return value of Signal::setBuffer
diegoferigo May 2, 2018
43bca59
Specify explicitly the parseParameter class
diegoferigo May 2, 2018
f6a53ff
Fixed Signal::setBuffer method
diegoferigo May 2, 2018
45e8488
Fixed small issues that prevented test controllers to run
diegoferigo May 3, 2018
7aeb701
Improved logic for cleaning S-Function resources at termination phase
diegoferigo May 3, 2018
ac0450d
Fixed compilation in Windows
diegoferigo May 3, 2018
93eb55c
Improved doxygen layout
diegoferigo May 3, 2018
40c9cd1
Small fixes
diegoferigo May 3, 2018
825c2b5
The autogenerated code should not call configureSizeAndPorts
diegoferigo May 7, 2018
44a5cfc
ParameterMetadata::operator== should be const
diegoferigo May 7, 2018
3960ed4
Improved how dynamic-sized parameters are handled
diegoferigo May 7, 2018
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
76 changes: 76 additions & 0 deletions .appveyor.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
version: appveyor.{build}
clone_folder: c:\dev\wb-toolbox
clone_depth: 1

platform: x64
configuration: Release

image:
- Visual Studio 2015
- Visual Studio 2017

skip_tags: true
skip_branch_with_pr: true

build:
parallel: true
verbosity: detailed

matrix:
fast_finish: true

pull_requests:
do_not_increment_build_number: true

init:
- ps: $YARP_LATEST = "2.3.72"
- ps: $ICUB_LATEST = "1.10.0"
- ps: $ROBOTOLOGY_VS = "v14"
- ps: if ($env:APPVEYOR_BUILD_WORKER_IMAGE -eq 'Visual Studio 2015') { $GENERATOR = "Visual Studio 14 2015 Win64" }
- ps: if ($env:APPVEYOR_BUILD_WORKER_IMAGE -eq 'Visual Studio 2017') { $GENERATOR = "Visual Studio 15 2017 Win64" }

install:
- ps: Start-FileDownload https://github.com/robotology/yarp/releases/download/v${YARP_LATEST}/yarp_${YARP_LATEST}_${ROBOTOLOGY_VS}_x86_amd64_1.exe -FileName c:\dev\yarp.exe -Timeout 300000
- ps: Start-FileDownload https://github.com/robotology/icub-main/releases/download/v${ICUB_LATEST}/iCub_${ICUB_LATEST}_${ROBOTOLOGY_VS}_x86_amd64_1.exe -FileName c:\dev\icub.exe -Timeout 300000
- ps: Start-Process -FilePath "c:\dev\yarp.exe" -ArgumentList "/S" -Wait -NoNewWindow -PassThru
- ps: Start-Process -FilePath "c:\dev\icub.exe" -ArgumentList "/S" -Wait -NoNewWindow -PassThru

- ps: |
# From: https://www.michaelmiklis.de/update-environment-variables-in-current-process/
# Modified to append appveyor's path
$ENV_MACHINE = ([Environment]::GetEnvironmentVariables('Machine'))
foreach ($EnvVar in $ENV_MACHINE.keys) {
Set-Item "Env:$($EnvVar)" -Value $ENV_MACHINE[$EnvVar]
}
$ENV_USER = ([Environment]::GetEnvironmentVariables('User'))
foreach ($EnvVar in $ENV_USER.keys) {
if ($EnvVar -ne 'Path') {
Set-Item "Env:$($EnvVar)" -Value $ENV_USER[$EnvVar]
}
}
if ($ENV_USER.ContainsKey('Path')) {
Set-Item Env:Path -Value ((($env:Path -split ";") + ($ENV_USER.Path -split ";") + ($ENV_MACHINE.Path -split ";") | select -Unique) -join ";")
}

- ps: git clone -q --depth 1 https://github.com/robotology/idyntree.git c:\dev\idyntree
- ps: cd c:\dev\idyntree
- ps: mkdir build
- ps: cd build
- ps: cmake -G"$GENERATOR" -DIDYNTREE_USES_QT5:BOOL=OFF ..
- ps: cmake --build . --config $env:CONFIGURATION --target INSTALL

- ps: git clone -q --depth 1 https://github.com/robotology/ycm.git c:\dev\ycm
- ps: mkdir "c:\Program Files\robotology\ycm"
- ps: $env:YCM_DIR = "C:/Program Files/robotology/ycm/share/YCM/cmake/"
- ps: cd c:\dev\ycm
- ps: mkdir build
- ps: cd build
- ps: cmake -Wno-dev -G"$GENERATOR" -DCMAKE_INSTALL_PREFIX:PATH="c:\Program Files\robotology\ycm" ..
- ps: cmake --build . --config $env:CONFIGURATION --target INSTALL

build_script:
- ps: cd $env:APPVEYOR_BUILD_FOLDER
- ps: mkdir build
- ps: cd build
- ps: cmake -G"$GENERATOR" ..
- ps: cmake --build . --config $env:CONFIGURATION
2 changes: 1 addition & 1 deletion .clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ AlignConsecutiveDeclarations: false
AlignEscapedNewlines: Left
AlignOperands: true
AlignTrailingComments: false
AllowAllParametersOfDeclarationOnNextLine: true
AllowAllParametersOfDeclarationOnNextLine: false
AllowShortBlocksOnASingleLine: false
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: Inline
Expand Down
236 changes: 213 additions & 23 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,220 @@ language: cpp
os:
- linux

matrix:
cache:
directories:
- $HOME/cache
- $HOME/.ccache
- $HOME/Library/Caches/Homebrew

stages:
- prepare linux
- test # Default stage with matrix
- osx
- deploy

addons:
apt:
sources:
- sourceline: 'ppa:nschloe/eigen-backports'
- sourceline: 'deb http://www.icub.org/ubuntu trusty contrib/science'
packages:
- cmake3
- ninja-build
# YARP / iCub / wb-toolbox
- icub-common
- libqt5opengl5-dev
- libeigen3-dev

compiler:
- gcc
- clang

env:
global: TRAVIS_CMAKE_GENERATOR="Ninja"
matrix:
- TRAVIS_BUILD_TYPE="Release"
- TRAVIS_BUILD_TYPE="Debug"

# ==============
# STAGE: prepare
# ==============

stage_prepare:
script: &prepare_script
# Clean the dependencies cache from previous builds (ccache is instead kept)
- rm -rf $DEPS_CACHE
- mkdir -p $DEPS_CACHE

# Install dependencies
# --------------------

# Limit concurrency for some project in order to avoid let the CI fail
- if [ "$TRAVIS_OS_NAME" == "linux" ] ; then CMAKE_BUILD_OPTIONS="-- -j4" ; fi
- if [ "$TRAVIS_OS_NAME" == "osx" ] ; then CMAKE_BUILD_OPTIONS="" ; fi

- mkdir $HOME/git
- export CXXFLAGS="-Wno-unused-command-line-argument"

# Install YCM
- cd $HOME/git
- git clone --depth 1 https://github.com/robotology/ycm.git
- cd ycm
- mkdir build && cd build
- >-
cmake .. \
-G"$TRAVIS_CMAKE_GENERATOR" \
-DCMAKE_INSTALL_PREFIX=$DEPS_CACHE
- cmake --build . --target install

# Install Yarp
- cd $HOME/git
- git clone --depth 1 https://github.com/robotology/yarp.git
- cd yarp
- mkdir build && cd build
- >-
cmake .. \
-G"$TRAVIS_CMAKE_GENERATOR" \
-DCMAKE_BUILD_TYPE=$TRAVIS_BUILD_TYPE \
-DCMAKE_INSTALL_PREFIX=$DEPS_CACHE \
-DCREATE_LIB_MATH=ON
- cmake --build . --config $TRAVIS_BUILD_TYPE --target install

# Install icub-main
- cd $HOME/git
- git clone --depth 1 https://github.com/robotology/icub-main.git
- cd icub-main
- mkdir build && cd build
- >-
cmake .. \
-G"$TRAVIS_CMAKE_GENERATOR" \
-DCMAKE_BUILD_TYPE=$TRAVIS_BUILD_TYPE \
-DCMAKE_INSTALL_PREFIX=$DEPS_CACHE
- cmake --build . --config $TRAVIS_BUILD_TYPE --target install $CMAKE_BUILD_OPTIONS

# Install iDynTree
- cd $HOME/git
- git clone --depth 1 https://github.com/robotology/idyntree.git
- cd idyntree
- mkdir build && cd build
- >-
cmake .. \
-G"$TRAVIS_CMAKE_GENERATOR" \
-DCMAKE_BUILD_TYPE=$TRAVIS_BUILD_TYPE \
-DCMAKE_INSTALL_PREFIX=$DEPS_CACHE
- cmake --build . --config $TRAVIS_BUILD_TYPE --target install $CMAKE_BUILD_OPTIONS

# ===================
# STAGE: test (linux)
# ===================

before_install: &before_install
# Prepare ccache
- mkdir -p $HOME/.local/bin
- ln -s $(which ccache) $HOME/.local/bin/$CC
- ln -s $(which ccache) $HOME/.local/bin/$CXX
- export PATH=/$HOME/.local/bin:$PATH
- echo "max_size = 1.0G" > $HOME/.ccache/ccache.conf
# Setup the dependencies cache
- export DEPS_CACHE=$HOME/cache/$TRAVIS_OS_NAME/$TRAVIS_BUILD_TYPE
- export PATH=$PATH:$DEPS_CACHE/bin
- export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$DEPS_CACHE/lib
- export CMAKE_PREFIX_PATH=$CMAKE_PREFIX_PATH:$DEPS_CACHE

script: &script
- cd $TRAVIS_BUILD_DIR
- mkdir build && cd build
- cmake -G"$TRAVIS_CMAKE_GENERATOR" -DCMAKE_BUILD_TYPE=$TRAVIS_BUILD_TYPE ..
- cmake --build . --config $TRAVIS_BUILD_TYPE

before_cache: &before_cache
- before_cache: rm -rf $DEPS_CACHE

# ==========
# STAGE: osx
# ==========

stage_osx:
before_install: &osx_before_install
# Setup the dependencies cache
- export DEPS_CACHE=$HOME/cache/$TRAVIS_OS_NAME/$TRAVIS_BUILD_TYPE
- export PATH=$PATH:$DEPS_CACHE/bin
- export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$DEPS_CACHE/lib
- export CMAKE_PREFIX_PATH=$CMAKE_PREFIX_PATH:$DEPS_CACHE
install: &osx_install
# Setup ccache
- brew install ccache
- export PATH="/usr/local/opt/ccache/libexec:$PATH"
# Install dependencies
- brew install eigen ace tinyxml gsl

# =============
# STAGE: deploy
# =============

stage_deploy:
install: &deploy_install
- pip3 install --user Pygments mkdocs mkdocs-material
- export PATH=$HOME/.local/bin:$PATH
script: &deploy_script
- ./$TRAVIS_BUILD_DIR/.ci/generateDocumentation.sh

#after_success: &after_success_deploy
#- ./$PROJECT_DIR_ABS/.ci/generateDocumentation.sh || travis_terminate 1

# ======================
# BUILD JOBS FROM STAGES
# ======================

jobs:
include:
# Enable a job for building the documentation
- os: linux
- &prepare_template
stage: prepare linux
before_install: *before_install
install: skip
script: *prepare_script
before_cache: skip
compiler: clang
env:
TRAVIS_BUILD_TYPE="Release"
- <<: *prepare_template
compiler: gcc
- <<: *prepare_template
compiler: clang
env:
TRAVIS_BUILD_TYPE="Debug"
- <<: *prepare_template
compiler: gcc
env:
TRAVIS_BUILD_TYPE="Debug"
- &osx_template
stage: osx
os: osx
compiler: clang
osx_image: xcode9.3
before_install: *osx_before_install
install: *osx_install
before_script: *prepare_script
script: *script
before_cache: skip
env:
TRAVIS_CMAKE_GENERATOR="Xcode"
TRAVIS_BUILD_TYPE="Debug"
- <<: *osx_template
env:
TRAVIS_CMAKE_GENERATOR="Unix Makefiles"
TRAVIS_BUILD_TYPE="Debug"
- stage: deploy
compiler:
cache:
if: ((branch = master) AND (type != pull_request))
before_install: skip
install: *deploy_install
before_script: skip
script: *deploy_script
before_cache: skip
#after_success: &deploy_after_success
after_success: skip
env:
TRAVIS_BUILD_DOCS=true
GIT_COMMITTER_USERNAME=LOC2Bot
Expand All @@ -25,26 +235,6 @@ matrix:
- graphviz
- python3-pip

before_install:
# Install documentation dependencies
- >-
if [[ "$TRAVIS_BRANCH" = "master" && -n "$TRAVIS_BUILD_DOCS" && "$TRAVIS_PULL_REQUEST" = "false" ]] ; then
pip3 install --user Pygments mkdocs mkdocs-material || travis_terminate 1
export PATH=$HOME/.local/bin:$PATH
fi

# before_script:
script:
# Right now Travis only builds the documentation
- true

after_success:
# Generate the docs only if master, the TRAVIS_BUILD_DOCS is true and we can use secure variables
- >-
if [[ "$TRAVIS_BRANCH" = "master" && -n "$TRAVIS_BUILD_DOCS" && "$TRAVIS_PULL_REQUEST" = "false" ]] ; then
./$PROJECT_DIR_ABS/.ci/generateDocumentation.sh || travis_terminate 1
fi

# notifications:
# email:
# - [email protected]
32 changes: 22 additions & 10 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,22 +1,34 @@
# Copyright (C) 2013-2017 iCub Facility - Istituto Italiano di Tecnologia
# Author: Jorhabib Eljaik, Francesco Romano, Diego Ferigo
# CopyPolicy: Released under the terms of the GNU GPL v2.0.
# Copyright (C) 2018 Istituto Italiano di Tecnologia (IIT). All rights reserved.
# This software may be modified and distributed under the terms of the
# GNU Lesser General Public License v2.1 or any later version.

cmake_minimum_required(VERSION 3.3)
project(WB-Toolbox)
cmake_minimum_required(VERSION 3.5)
project(WB-Toolbox LANGUAGES CXX VERSION 3.1)

set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

# Add custom functions / macros
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)

find_package(YCM REQUIRED)
include(YCMDefaultDirs)

set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
set(WB-TOOLBOX_SHARE_DIR "${CMAKE_INSTALL_PREFIX}/share/WB-Toolbox")
find_package(Matlab QUIET COMPONENTS
MX_LIBRARY
ENG_LIBRARY
MAIN_PROGRAM
# SIMULINK # Requires CMake > 3.7
)

add_subdirectory(MxAnyType)
add_subdirectory(toolbox)
if(NOT WBTOOLBOX_USES_MATLAB)
option(WBTOOLBOX_USES_MATLAB "Compile also Matlab-related components" ${Matlab_FOUND})
endif()

install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/images DESTINATION ${WB-TOOLBOX_SHARE_DIR})
if(WBTOOLBOX_USES_MATLAB)
add_subdirectory(MxAnyType)
endif()

add_subdirectory(toolbox)

include(AddUninstallTarget)
Loading