IfcPlusPlus: Difference between revisions

From FreeCAD Documentation
(→‎Installation: More information about compilation)
(→‎Actual compilation: More information of the compilation and installation of the libraries.)
Line 69: Line 69:


{{incode|N}} is the number of processors that you assign to the compilation process; choose at least one fewer than the total number of CPU cores that you have.
{{incode|N}} is the number of processors that you assign to the compilation process; choose at least one fewer than the total number of CPU cores that you have.

=== Testing the compilation in the build directory ===

If the build was successful you should have a {{incode|Release/}} subdirectory with the newly compiled libraries.
</translate>
{{Code|code=
Release/libcarve.so
Release/libIfcPlusPlus.a
Release/SimpleViewerExample
}}
<translate>

The {{incode|SimpleViewerExample}} executable is a simple [[Arch_IFC|IFC]] viewer that uses the compiled library {{incode|libcarve.so}}.

=== Installation of the compiled libraries ===

If the compilation doesn't report any errors, you may run {{incode|make install}} to copy the headers, compiled libraries, and binaries to their corresponding installation directories.
</translate>
{{Code|code=
sudo make install
}}
<translate>

By default, the {{incode|CMAKE_INSTALL_PREFIX}} is {{incode|/usr/local/}}, so all compiled files will be placed under this directory, which normally requires elevated privileges.
</translate>
{{Code|code=
/usr/local/bin/SimpleViewerExample
/usr/local/lib/libcarve.so
/usr/local/lib/libIfcPlusPlus.a
/usr/local/include/carve/*.{h, hpp}
/usr/local/include/ifcpp/geometry/*.h
/usr/local/include/ifcpp/geometry/Carve/*.h
/usr/local/include/ifcpp/geometry/OCC/*.h
/usr/local/include/ifcpp/IFC4/*.h
/usr/local/include/ifcpp/IFC4/include/*.h
/usr/local/include/ifcpp/model/*.h
/usr/local/include/ifcpp/reader/*.h
/usr/local/include/ifcpp/writer/*.h
/usr/local/share/IFCPP/cmake/*.cmake
}}
<translate>

=== Removing the compiled libraries ===

To remove the installed libraries, just remove the corresponding files that were installed.
</translate>
{{Code|code=
sudo rm -rf /usr/local/bin/SimpleViewerExample
sudo rm -rf /usr/local/lib/libcarve.so
sudo rm -rf /usr/local/lib/libIfcPlusPlus.a
sudo rm -rf /usr/local/include/carve
sudo rm -rf /usr/local/include/ifcpp
sudo rm -rf /usr/local/share/IFCPP/cmake/
}}
<translate>


== Links ==
== Links ==

Revision as of 04:09, 20 August 2020

This page is a work in progress. Please do not edit or translate until this message is removed.
Other languages:

Description

IFC++ or IfcPlusPlus is an open source (MIT license) library for reading and viewing IFC files from the IfcQuery project.

While the library can be used for different purposes, the most useful component is the example viewer, which can be used to compare the performance of other viewers and editors of IFC data, like Blender and FreeCAD, which use IfcOpenShell.

The example viewer uses Qt and the OpenSceneGraph library to convert the implicit geometry in IFC files into explicit geometry on screen.

Installing

IFC++ is provided in source code so it must be compiled before being used. It is developed mostly in Window, so it includes solution files (.snl) to compile the IfcPlusPlus.dll library using Visual Studio. However, it can also be compiled for Linux using CMake.

Compiling in Windows

Follow the instructions in the official ifcplusplus repository.

Compiling in Linux

The general instructions are as follows:

  1. Get the source code of IFC++ from its main repository.
  2. Gather all dependencies for compiling, including a C++ compiler, CMake, and Make, and the development files for Boost, Qt 5, as well as the OpenSceneGraph (OSG) library for visualization.
  3. Run cmake to generate a Makefile, then start the compilation by running make.
  4. Install the ifcplusplus shared module to the appropriate library path so that it is found by the IFC++ viewer.

Prerequisites

In a Debian/Ubuntu based distribution, getting the required development files is usually simple.

sudo apt install git cmake gcc g++ libboost-all-dev
sudo apt install qt5-qmake qtbase5-dev qttools5-dev libqt5widgets5 libqt5opengl5-dev
sudo apt install libopenscenegraph-3.4-dev

Get the source code of the project and place it in a custom directory to which you have full write access.

git clone https://github.com/ifcquery/ifcplusplus ifcplusplus-source

CMake configuration

It is recommended to perform the configuration and compilation in a specific build directory separate from the source directory.

mkdir -p ifcplusplus-build
cd ifcplusplus-build

cmake ../ifcplusplus-source/

Actual compilation

If there were no error messages during configuration with CMake, a Makefile should have been created in the build directory, so you can proceed to compile the libraries by running make.

make -j N

N is the number of processors that you assign to the compilation process; choose at least one fewer than the total number of CPU cores that you have.

Testing the compilation in the build directory

If the build was successful you should have a Release/ subdirectory with the newly compiled libraries.

Release/libcarve.so
Release/libIfcPlusPlus.a
Release/SimpleViewerExample

The SimpleViewerExample executable is a simple IFC viewer that uses the compiled library libcarve.so.

Installation of the compiled libraries

If the compilation doesn't report any errors, you may run make install to copy the headers, compiled libraries, and binaries to their corresponding installation directories.

sudo make install

By default, the CMAKE_INSTALL_PREFIX is /usr/local/, so all compiled files will be placed under this directory, which normally requires elevated privileges.

/usr/local/bin/SimpleViewerExample
/usr/local/lib/libcarve.so
/usr/local/lib/libIfcPlusPlus.a
/usr/local/include/carve/*.{h, hpp}
/usr/local/include/ifcpp/geometry/*.h
/usr/local/include/ifcpp/geometry/Carve/*.h
/usr/local/include/ifcpp/geometry/OCC/*.h
/usr/local/include/ifcpp/IFC4/*.h
/usr/local/include/ifcpp/IFC4/include/*.h
/usr/local/include/ifcpp/model/*.h
/usr/local/include/ifcpp/reader/*.h
/usr/local/include/ifcpp/writer/*.h
/usr/local/share/IFCPP/cmake/*.cmake

Removing the compiled libraries

To remove the installed libraries, just remove the corresponding files that were installed.

sudo rm -rf /usr/local/bin/SimpleViewerExample
sudo rm -rf /usr/local/lib/libcarve.so
sudo rm -rf /usr/local/lib/libIfcPlusPlus.a
sudo rm -rf /usr/local/include/carve
sudo rm -rf /usr/local/include/ifcpp
sudo rm -rf /usr/local/share/IFCPP/cmake/

Links