FCPPT: Installation and Usage














































FCPPT: Installation and Usage



Requirements:

These Dependencies are very much needed to make the fcppt:

 1.>= cmake-3.7.0

Other than this there are some optional dependencies also:

 1.For creating fcppt.boost we require >= boost-1.47

      2.If we want to create and maintain documents we require >= doxygen-1.7.5

     3.For running tests and creating we require Catch2. This also helps to build fcppt.catch.


Tested Platforms:

Platforms that are suitable: 

 1.gcc-11.2 (Gentoo linux and MinGW)

      2.clang-14 (Gentoo Linux)

     3.VC++-14.32 (Visual Studio 2022)

     4.fcppt needs a C++20-conforming compiler.


Building and Installation:

Cmake is used as a build system in fcppt, so the regular or commonly used process for building a project through Cmake applies: Take out the tarball after downloading or you can make a copy of the git repository. Then make a build directory which will be a new directory, that is also called . Change
the old directory to . If we assume that fcppt is in , call cmake and we let all valid arguments pass, like -G Ninja, to Cmake.

There are many Cmake options available:

<!- ENABLE_BOOST:
Whether to build fcppt.boost. Boost is important for this. Look at CMake's FindBoost.cmake to helps us to find boost and where to use.

     ENABLE_CATCH:
Whether to build fcppt.catch. Catch2 is needed for this.

    ENABLE_EXAMPLES:
Whether to build fcppt's examples. We should turn this off when we install fcppt only.

<   ENABLE_TEST:
Whether to build fcppt's tests. Catch2 and ENABLE_CATCH is important for this.

     ENABLE_DOC:
Whether to build fcppt's documentation. Doxygen is significant for this. Look at CMake's FindDoxygen.cmake it helps during installation.

     ENABLE_SHARED:
Build shared libraries. This defaults to on.

     ENABLE_STATIC:
Build static libraries. This defaults to off.

     ENABLE_THREADS:
Enables thread-support in fcppt.log. This defaults to on.


There is no need to install fcppt for using it. Once we create fcppt anyone can directly use it from source directory. If now we want to install then we should set CMAKE_INSTALL_PREFIX.


Using Fcppt:

Modify your CMakeLists.txt:

To explain fcppt’s targets, fcppt comes with an exported Cmake files. Some of them are boost, catch, core, filesystem, log, parse, and options. Let’s take an example in which the target ‘mytarget’ connects to core and log:

target_link_containers(

        mytarget

        PRIVATE

       fcppt_core_interface)


When we link to a specific target, for example, it receives all includes directories and build flags that are required by us. But when we want to use a specific header for a particular target, for example, fcppt core, we can connect to its interface library:

target_link_containers(

        mytarget

        PRIVATE       

fcppt_core_interface)


fcppt.boost, fcppt.catch and fcppt.parse only helps us with interface targets. Basically, interfaces are the Cmake targets that doesn’t have a library to connect to, but in case of simple targets, gives us include directories and build flags. By chance when if Cmake doesn’t recognize the location where we installed fcppt then depending on where it is located we must give specific additional parameters:


From the build directory using fcppt:

When we don’t install fcppt, then we must properly tell about the fcppt’s build config directory with the help of -D fcppt_DIR=/config, in this fcppt_build_dir tells us about the fcppt’s build directory.


From an installation using fcppt:

After installing fcppt, the default where fcppt configuration is installed to INSTALL_CMAKECONFIG_DIR (which is usually /usr/lib/cmake), we use find_package(fcppt) to locate it when we use Cmake. If we don’t want this then we must specify everything manually.


Share builds and static:

We can also make fcppt as shared library or static, which is then monitored by ENABLE_SHARED and ENABLE_STATIC, respectively. First we need to set fcppt_USE_STATIC_LIBS=ON before we bring find_package(fcppt) if we are planning on using fcppt as a static library. Let’s take an example, instead of directing to fcppt_core, fcppt_core_TARGET will direct to fcppt_core_static. 


Comments