Installation¶
If you’d like to work with the C++ core of IfcOpenShell, these guides will show you how to compile and install IfcOpenShell.
Note
It is not necessary to compile IfcOpenShell if you only want to use IfcOpenShell-Python, IfcConvert, or the other utilities such as IfcClash or IfcDiff. Compilation is only necessary for C++ developers.
By default, it will compile all available IFC schemas. To reduce compilation time you can specify only the schemas you need in CMakeLists.txt with set(SCHEMA_VERSIONS “2x3” “4”).
You will need:
IfcOpenShell depends on:
OpenCascade - for building IfcGeom For converting IFC representation items into BRep solids and tessellated meshes. Officially v7.5.0 is supported. Other versions may have unexpected behaviour.
(Optional) OpenCOLLADA - for IfcConvert to be able to write tessellated Collada (.dae) files
(Optional) SWIG and Python - for building the IfcOpenShell Python interface and use in Bonsai
Compiling on Linux¶
The following instructions are for Ubuntu, modify as required for other operating systems. GCC (4.7 or newer) or Clang (any version) is required.
See also
The nix/build-all.py script can be experimented with and studied for pointers for other operating systems. Note that this script is not currently meant to be used for a typical IfcOpenShell workspace setup.
Fetch the latest source code, including all submodules.
git clone --recursive https://github.com/IfcOpenShell/IfcOpenshell.git
Warning
The path where the source code is cloned to can contain spaces but non-ASCII characters are very likely to cause problems with the build.
Install basic dependencies:
sudo apt-get install git cmake gcc g++ libboost-all-dev libcgal-dev libeigen3-dev
The CGAL version that ships with Ubuntu 20.04 is too old. Users on Ubuntu 20.04 are advised to manually install CGAL 5.3.
Install OpenCascade Technology (OCCT).
sudo apt-get install libocct-data-exchange-dev libocct-draw-dev libocct-foundation-dev libocct-modeling-algorithms-dev libocct-modeling-data-dev libocct-ocaf-dev libocct-visualization-dev
See also
If OCCT is not available, an alternative is to manually compile OCCT.
IfcOpenShell 0.8 depends on fairly recent OCCT additions such as the BVH Tree functionality. Users on Ubuntu 20.04 are advised to manually compile and install OCCT 7.7.
Warning
Choose one option only between installing OCCT packages or self-compilation. If you install and compile multiple versions of OpenCascade, your system may get confused.
For building IfcConvert with COLLADA (.dae) support (ON by default), OpenCOLLADA is needed:
sudo apt-get install libpcre3-dev libxml2-dev git clone https://github.com/KhronosGroup/OpenCOLLADA.git cd OpenCOLLADA # Using a known good revision, but HEAD should work too: git checkout 064a60b65c2c31b94f013820856bc84fb1937cc6 mkdir build && cd build cmake .. # Replace X with number of CPU cores + 1 make -j X sudo make install
For building the IfcPython wrapper (ON by default), SWIG and Python development are needed:
sudo apt-get install python-all-dev swig
Compile IfcOpenShell itself.
cd /path/to/IfcOpenShell mkdir build && cd build # Customise the compile options to suit your environment # Dependencies are found automatically. # If you skipped step 4, pass -DCOLLADA_SUPPORT=Off. cmake ../cmake # Replace X with number of CPU cores + 1. Reduce when running out of memory. Compiling the code generated from the schemas is resource intensive. make -j X # Optionally install to the system sudo make install
Compiling on MacOS¶
GCC (4.7 or newer) or Clang (any version) is required.
Fetch the latest source code, including all submodules.
git clone --recursive https://github.com/IfcOpenShell/IfcOpenshell.git
Warning
The path where the source code is cloned to can contain spaces but non-ASCII characters are very likely to cause problems with the build.
Install all dependencies using Homebrew
brew install boost cmake python3 cgal ftgl gmp opencascade swig zlib eigen # homebrew automatically links most libraries, except some keg-only ones brew link zlib --force
3. Build IfcOpenShell with flags for Homebrew dependencies: (/usr/local/) for Intel machines with x84_64 architecture,
(/opt/homebrew/) for Apple Silicon processors with arm64 architecture.
cd /path/to/IfcOpenShell mkdir build && cd build # set library flags export LDFLAGS="$LDFLAGS -Wl,-flat_namespace,-undefined,suppress" cmake ../cmake \ -DPYTHON_EXECUTABLE=/opt/homebrew/bin/python3.13 \ -DPYTHON_LIBRARY=/opt/homebrew/opt/python@3.13/Frameworks/Python.framework/Versions/3.13/lib/libpython3.13.dylib \ -DPYTHON_INCLUDE_DIR=/opt/homebrew/opt/python@3.13/Frameworks/Python.framework/Versions/3.13/include/python3.13/ \ -DCOLLADA_SUPPORT=0 # `sysctl -n hw.ncpu` returns the number of cpu cores on macOS make -j$(sysctl -n hw.ncpu)
Compiling on Windows (Visual Studio)¶
This is for users of Visual Studio 2008 to 2022 with C++ toolset, recommend to install the C++ toolset with VisualStudio Installer (or Visual C++ Build Tools).
Fetch the latest source code, including all submodules.
git clone --recursive https://github.com/IfcOpenShell/IfcOpenshell.git
Warning
The path where the source code is cloned to can contain spaces but non-ASCII characters are very likely to cause problems with the build.
Assuming Visual Studio 2015 x64 environment variables set, build dependencies and run cmake.
cd IfcOpenShell\win python build-deps.py python run-cmake.pyOpen and build the solution file in Visual Studio:
..\build-vs2015-x64\IfcOpenShell.sln
As the scripts default to using the
RelWithDebInfoconfiguration, and a freshly created solution by CMake defaults toDebug, make sure to switch the used build configuration. Build theINSTALLproject (right-click -> Project Only) to deploy the headers and binaries into a single location if wanted/needed.Alternatively, one can use the utility script(s) to build and install the project easily from the command-line (installing a project will build it also, if required):
python install-ifcopenshell.py
See also
For more information on configuring a Windows compilation see the Windows Readme.
Packaged installation¶
Arch Linux: Direct from Git.