Skip to content

Commit

Permalink
Merge pull request #77
Browse files Browse the repository at this point in the history
Automatic Code Generation Support
  • Loading branch information
diegoferigo authored May 7, 2018
2 parents 755187d + 3960ed4 commit da74420
Show file tree
Hide file tree
Showing 104 changed files with 9,644 additions and 3,754 deletions.
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

0 comments on commit da74420

Please sign in to comment.