Skip to content

Commit

Permalink
Consume YCM as a hard dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
PeterBowman committed Jun 20, 2018
1 parent afcd161 commit f06fa4c
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 531 deletions.
21 changes: 21 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,14 @@ compiler: gcc

env:
global:
- YCM_VER=0.8.1
- YCM_CACHE_DIR=~/.ycm
- YARP_VER=2.3.72.1
- YARP_CACHE_DIR=~/.yarp

cache:
directories:
- $YCM_CACHE_DIR
- $YARP_CACHE_DIR

before_install:
Expand All @@ -19,6 +22,24 @@ before_install:
- if [ ! $(git config --get user.name) ]; then $(git config --global user.name 'Travis CI'); fi

install:
# Clone and build YCM if not in cache
- >-
if [ ! "$(ls -A "$YCM_CACHE_DIR")" ] || [ ! -f "$YCM_CACHE_DIR/.version" ] || [ ! $(cat "$YCM_CACHE_DIR/.version") = "$YCM_VER" ]; then
echo "YCM not in cache or wrong version"
rm -rf "$YCM_CACHE_DIR/*"
cd
wget -qO- "https://github.com/robotology/ycm/archive/v$YCM_VER.tar.gz" | tar xz
mkdir -p "ycm-$YCM_VER/build" && cd "$_"
cmake .. -DCMAKE_INSTALL_PREFIX:PATH="$YCM_CACHE_DIR"
sudo make -j$(nproc) install
echo "$YCM_VER" > "$YCM_CACHE_DIR/.version"
else
echo "YCM directory found in cache (version $(cat "$YCM_CACHE_DIR/.version"))"
fi
# Make installed YCM discoverable by CMake's find_package() command
- export YCM_DIR=$YCM_CACHE_DIR/share/YCM/cmake

# Clone and build YARP if not in cache
- >-
if [ ! "$(ls -A "$YARP_CACHE_DIR")" ] || [ ! -f "$YARP_CACHE_DIR/.version" ] || [ ! $(cat "$YARP_CACHE_DIR/.version") = "$YARP_VER" ]; then
Expand Down
9 changes: 3 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,10 @@ project(TEMPLATE_NAME)
# Set module path.
list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake
${CMAKE_SOURCE_DIR}/cmake/modules
${CMAKE_SOURCE_DIR}/cmake/find-modules
${CMAKE_SOURCE_DIR}/cmake/ycm-modules)
${CMAKE_SOURCE_DIR}/cmake/find-modules)

# Bootstrap YCM.
# https://github.com/robotology/ycm/issues/118
set(YCM_TAG v0.2.2)
include(YCMBootstrap)
# Find YCM.
find_package(YCM 0.8 REQUIRED)

# Find YARP.
# https://github.com/roboticslab-uc3m/questions-and-answers/issues/65
Expand Down
Loading

0 comments on commit f06fa4c

Please sign in to comment.