Skip to content
This repository has been archived by the owner on Jan 21, 2022. It is now read-only.

Commit

Permalink
Merge pull request #47 from OpenSimulationInterface/fix-fmi-installation
Browse files Browse the repository at this point in the history
Fix fmi installation and replace docker with explicit build
  • Loading branch information
pmai authored Feb 19, 2020
2 parents b57125f + 178b3d8 commit 3871055
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 37 deletions.
33 changes: 27 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,36 @@
# Define Distribution
dist: bionic

# Use C++ build environment.
language: cpp

sudo: required

# We use docker-based builds to enable current Ubuntu LTS BuildEnv
services:
- docker
# Protobuf requires g++ (see https://github.com/google/protobuf/blob/master/src/README.md)
compiler:
- gcc

# Handle dependencies in separate directory.
before_install:
- docker build -t osi-standard/osi-visualizer .
- DEPS_DIR="${HOME}/deps"
- mkdir -p "${DEPS_DIR}"
- cd "${DEPS_DIR}"

# Install necessary packages.
install:
# Install a recent version of CMake
- |
CMAKE_URL="https://cmake.org/files/v3.7/cmake-3.7.2-Linux-x86_64.tar.gz"
if [ ! -f ${DEPS_DIR}/cmake/bin/cmake ] ; then mkdir -p cmake ; travis_retry wget --no-check-certificate --quiet -O - ${CMAKE_URL} | tar --strip-components=1 -xz -C cmake ; fi
export PATH=${DEPS_DIR}/cmake/bin:${PATH}
# Change directory back to default build directory.
before_script:
- cd "${TRAVIS_BUILD_DIR}"
- sudo apt-get update && sudo apt-get upgrade && sudo apt-get autoremove
- sudo bash install-deps.sh
- sudo bash build-install-build-deps.sh

# Run the build script.
# Run the build script
script:
- docker run -it -v $(pwd):/project osi-standard/osi-visualizer /bin/sh -c "mkdir -p build && cd build && cmake .. && cmake --build ."
- bash build.sh
52 changes: 22 additions & 30 deletions build-install-build-deps.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,45 +24,37 @@ echo "
mkdir -p fmi_library
cd fmi_library

FMI_lib_version=2.0.2

fmi_library_include_install_dir=/usr/local/include/fmi-library
fmi_library_lib_install_dir=/usr/local/lib/fmi-library

if ! [ -e ${fmi_library_include_install_dir} -a -e ${fmi_library_lib_install_dir} ]
if ! [ -e ${fmi_library_include_install_dir} -a -e ${fmi_library_lib_install_dir} ]
then
echo "
Downloading FMI library...
"
echo "Downloading FMI library..."

if [ ! -d $FMI_lib_version ]
then
wget --no-parent -nH --cut-dirs=2 -r https://svn.jmodelica.org/FMILibrary/tags/$FMI_lib_version/
fi
if [ ! -d FMILibrary-2.0.2 ]
then
wget --no-parent -nH --cut-dirs=2 -r https://jmodelica.org/FMILibrary/FMILibrary-2.0.2-src.zip
fi

echo "
Building FMI library...
"
cd ${FMI_lib_version}
echo "Building FMI library..."
unzip FMILibrary-2.0.2-src.zip
cd FMILibrary-2.0.2
mkdir -p build
cd build
cmake ../. -DCMAKE_BUILD_TYPE=RELEASE
cmake ..
make -j8
make -j8 install
cd ..
if [[ -d "install" ]]
cd ../install

if [ ! -d ${fmi_library_include_install_dir} ]
then
sudo mkdir -p ${fmi_library_include_install_dir}
sudo cp -uvrf ./include/* ${fmi_library_include_install_dir}/
fi

if [ ! -d ${fmi_library_lib_install_dir} ]
then
cd install
mkdir -p ${fmi_library_include_install_dir}
if [[ -d ${fmi_library_include_install_dir} ]]
then
cp -uvrf ./include/* ${fmi_library_include_install_dir}/
fi
mkdir -p ${fmi_library_lib_install_dir}
if [[ -d ${fmi_library_lib_install_dir} ]]
then
cp -uvrf ./lib/* ${fmi_library_lib_install_dir}/
fi
else
echo "Could not install the fmi-library into usr/local"
sudo mkdir -p ${fmi_library_lib_install_dir}
sudo cp -uvrf ./lib/* ${fmi_library_lib_install_dir}/
fi
fi
2 changes: 1 addition & 1 deletion install-deps.sh
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,4 @@ echo "
# Installing OpenGL
#################################
"
apt-get install libgl1-mesa-dev libgl1-mesa-dri libgl1-mesa-glx -y
apt-get install libgl1-mesa-dev libgl1-mesa-dri libgl1-mesa-glx libqt5opengl5-dev -y

0 comments on commit 3871055

Please sign in to comment.