aytey / ifc-reader

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

IFC Reader

This is C++ library for reading ifc-files (ifc-core and its more user friendly interface reflifc) and 2 optional extra tiny libraries, namely ifc-msvc and ifc-blob-reader. The reason for this separation is the following: ifc-core and reflifc don't want to know anything about files, configs and so on. The entry point for IFC-reading -- ifc::File -- is constructed from BlobView and how to get BlobView is responsibility of library users.

Tests and examples do it via single-function library ifc-blob-reader wrapping Boost::iostreams.

One more issue arising during inspecting IFC is how to process cross-module references. For example, the following module interface

export module hello;

import <string_view>;

export namespace hello {
  void say_hello(std::string_view name);
}

depends on type std::string_view defined in outer header unit <string_view> (see struct DeclReference). Conseqeuntly during inspecting some ifc-file it may be necessary to find other ifc-files. How to do it is not specified in IFC specification itself and depends on a compiler/build system. In ifc-core this is done via class Environment receiving Config and library ifc-msvc provides such config, reading it from .json produced by MSVC.

Dependecies

ifc-core and reflifc don't have external dependencies, but require C++20 for compilation.

ifc-blob-reader depends on Boost::iostreams for crossplatform implementation of file mapping.

ifc-msvc depends on nlohmann::json for reading .json configs produced by MSVC.

Tests depend on GoogleTest.

Build

  1. If tests or examples are needed, then install required dependencies, mentioned above. It not, then go to step 1.
  2. Just run CMake, something like this should be enough:
mkdir build
cd build
cmake ..

To build tests switch on CMake option BUILD_IFC_READER_TESTS, to build examples -- BUILD_IFC_READER_EXAMPLES (see top-level CMakeLists.txt).

Windows

Vcpkg could be used for fetching dependencies. If it's not installed yet, you could run the following commands for pulling package manager itself:

git clone https://github.com/microsoft/vcpkg
cd vcpkg
bootstrap-vcpkg.bat

And then install dependencies (required for both tests and examples):

vcpkg.exe install boost-iostreams:x64-windows
vcpkg.exe install nlohmann-json:x64-windows

and GoogleTest required only for tests:

vcpkg.exe install gtest:x64-windows

After that you could generate normal Visual Studio solution:

mkdir build
cd build
cmake -G "Visual Studio 16 2019" -A x64 -DCMAKE_TOOLCHAIN_FILE=[path to vcpkg]/scripts/buildsystems/vcpkg.cmake ..

or work with CMake directly in Visual Studio.

Visual Studio

From Visual Studio, open CMakeLists.txt

After cmake wizard pops up, open the CMake Settings Editor

In CMake toolchain file - browse and select vcpkg\scripts\buildsystems\vcpkg.cmake

Delete cache, generate cache.

Build solution normally.

About

License:MIT License


Languages

Language:C++ 98.5%Language:CMake 1.5%