Skip to content

Instantly share code, notes, and snippets.

@berndhahnebach
Last active May 9, 2019 05:50
  • Star 3 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save berndhahnebach/e4d57634fe7eebbae537bf3da1b1b95a to your computer and use it in GitHub Desktop.
#!/bin/bash
# Released under GPL v2.0
# bernd@bimstatik.org
# Stretch--ifcplusplus.sh
# tested on Debian Stretch = 9.0
# cd ~ # on a local machine
# sudo rm -rf build_FC
mkdir build_FC
cd build_FC
base_dir=`pwd`
cd $base_dir
# *******************************************
echo START THE IfcPlusPlus JOURNEY !!!
echo ---------------------------------
# *******************************************
# update and upgrade system
sudo apt-get update
sudo apt-get upgrade -y
sudo apt-get dist-upgrade -y
sudo apt-get autoremove -y
sudo apt-get update
sudo apt-get clean
# *******************************************
# get dependencies from distribution
packages_build=" \
git \
cmake \
g++ \
libboost-all-dev \
"
sudo apt-get install -y $packages_build
# Qt5
packages_qt5="\
qt5-qmake \
libqt5widgets5 \
libqt5opengl5-dev \
qttools5-dev \
qtbase5-dev \
"
sudo apt-get install -y $packages_qt5
# Ifcpp
packages_ifcpp="\
libopenscenegraph-3.4-dev
"
sudo apt-get install -y $packages_ifcpp
# libopenscenegraph-3.4-dev is linked against qt5
# *******************************************
# update system
sudo apt-get update
sudo apt-get clean
# *******************************************
# get and compile ifcplusplus, patched version from bernd
cd $base_dir
mkdir ifcpp
cd ifcpp
git clone https://github.com/berndhahnebach/ifcplusplus/ ifcpp
# building ifcplusplus
cd $base_dir
cd ifcpp
mkdir build
cd build
rm -rf *
cmake ../ifcpp
# cmake -DCMAKE_BUILD_TYPE=Debug ../ifcpp # debugbuild
make -j 4
# *******************************************
# install ifcplusplus
sudo make install
# libcarve is not found, we add the library path to .bashrc in user home dir
# to find the lib the following could be used
# sudo find / -type f -name "libcarved.so"
cd $base_dir
echo 'export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH' >> ../.bashrc
# *******************************************
echo -----------------------------
echo END THE IfcPlusPlus JOURNEY !!!
# *******************************************
# get back to bas dir
# cd $base_dir
# *******************************************
# test IfcPlusPlus
# cd $base_dir/ifcpp/ifcpp/examples
# there is a file to test: IfcOpenHouse.ifc
# *******************************************
# get 210_King_Merged.ifc
# in Mai 2018 the site was offline
# cd $base_dir
# wget "http://www.digital210king.org/downloader.php?file=24"
# mv "downloader.php?file=24" 10-King-IFC-Merged__2012-02-07.zip
# unzip 10-King-IFC-Merged__2012-02-07.zip # we hopefully get the file: 210_King_Merged.ifc
# rm 10-King-IFC-Merged__2012-02-07.zip
# open kings file with viewer, does not work through vagrant
# SimpleViewerExampled 210_King_Merged.ifc
# SimpleViewerExampled $base_dir/ifcplusplus/IfcOpenHouse.ifc
# https://forum.freecadweb.org/viewtopic.php?f=4&t=24115&p=232676#p232676
# export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
@nortikin
Copy link

SimpleViewerExampled: error while loading shared libraries: libcarved.so: cannot open shared object file: No such file or directory

@berndhahnebach
Copy link
Author

berndhahnebach commented May 8, 2019

Workaround:
add this to your bashrc ... export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH by

cd ~
echo 'export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH' >> /home/yourusername/.bashrc  # libcarve is not found

or start the viewer from build directory by

./Debug/SimpleViewerQt

hope that helps

@berndhahnebach
Copy link
Author

BTW:

found oce does not need to be compiled. Just use the correct oce pachages from Stretch which are linked against Qt5 ...
this one ...
libopenscenegraph-3.4-dev
and use
cmake -DCMAKE_BUILD_TYPE=Debug ../ifcplusplus

@berndhahnebach
Copy link
Author

I may update the script in this regard ...

@berndhahnebach
Copy link
Author

I may update the script in this regard ...

done :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment