Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add CI to build with CMake #270

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 59 additions & 0 deletions .github/workflows/cmake.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: "CMake build"

on:
push:
pull_request:
workflow_dispatch:

defaults:
run:
shell: bash

jobs:
build:
name: ${{ matrix.toolchain }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
toolchain:
- linux-gcc
- macos-clang
- windows-msvc
- windows-mingw
configuration:
- Release
include:
- toolchain: linux-gcc
os: ubuntu-latest
compiler: gcc
- toolchain: macos-clang
os: macos-latest
compiler: clang
- toolchain: windows-msvc
os: windows-latest
compiler: msvc
- toolchain: windows-mingw
os: windows-latest
compiler: mingw
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 5
- name: Configure (${{ matrix.configuration }})
run: |
if [ "${{ matrix.compiler }}" == "msvc" ]; then
cmake -S . -B build -DBUILD_VIEWER_APPLICATION=OFF
elif [ "${{ matrix.compiler }}" == "mingw" ]; then
cmake -S . -B build -DCMAKE_BUILD_TYPE=${{ matrix.configuration }} -DBUILD_VIEWER_APPLICATION=OFF -G "MinGW Makefiles"
else
cmake -S . -B build -DCMAKE_BUILD_TYPE=${{ matrix.configuration }} -DBUILD_VIEWER_APPLICATION=OFF
fi
- name: Build with ${{ matrix.compiler }}
run: |
if [ "${{ matrix.compiler }}" == "msvc" ]; then
cmake --build build --config ${{ matrix.configuration }}
else
cmake --build build -- -j8
fi
20 changes: 14 additions & 6 deletions IfcPlusPlus/src/ifcpp/reader/ReaderUtil.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,18 @@ static T convertToHex(unsigned char mc)
// return (returnValue);
//}

static std::string utf16_to_utf8(const std::u16string& u16str)
{
#if _MSC_VER >= 1900
std::wstring_convert<std::codecvt_utf8_utf16<int16_t>, int16_t> convert;
auto p = reinterpret_cast<const int16_t *>(u16str.data());
return convert.to_bytes(p, p + u16str.size());
#else
std::wstring_convert<std::codecvt_utf8_utf16<char16_t>, char16_t> convert;
return convert.to_bytes(u16str);
#endif
}

std::string wstring2string(const std::wstring& wstr)
{
if (wstr.empty()) return std::string();
Expand Down Expand Up @@ -1147,9 +1159,7 @@ void decodeArgumentString(const std::string& argument_str, std::string& arg_out)
{
combined16[0] = checkAndConvertAppleEncoding(combined16[0]);
}
std::u16string u16str(combined16, 1);
std::wstring_convert<std::codecvt_utf8_utf16<char16_t>, char16_t> convert;
std::string utf8 = convert.to_bytes(u16str);
std::string utf8 = utf16_to_utf8(std::u16string(combined16, 1));

arg_str_new += utf8;
stream_pos += 5;
Expand Down Expand Up @@ -1211,9 +1221,7 @@ void decodeArgumentString(const std::string& argument_str, std::string& arg_out)

} while ((*stream_pos != '\0'));

std::u16string u16str(reinterpret_cast<char16_t*>(&utf16Characters[0]), utf16Characters.size() / 2);
std::wstring_convert<std::codecvt_utf8_utf16<char16_t>, char16_t> convert;
std::string utf8 = convert.to_bytes(u16str);
std::string utf8 = utf16_to_utf8(std::u16string(reinterpret_cast<char16_t*>(&utf16Characters[0]), utf16Characters.size() / 2));
arg_str_new += utf8;
}
continue;
Expand Down
1 change: 1 addition & 0 deletions IfcPlusPlus/src/ifcpp/reader/ReaderUtil.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OU
#include "ifcpp/IFC4X3/TypeFactory.h"

#ifdef _MSC_VER
#include <cctype>
#include <cstdio>
#include <cstring>
#pragma warning(disable : 4996)
Expand Down
11 changes: 6 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ for (auto it : currentBuildingStorey->m_IsDecomposedBy_inverse)
}
```
Inverse attribute pointers are automatically generated by IFC++ for all object references in the model.

- casting is possible for all types:
```cpp
shared_ptr<IfcPropertySet> pset = dynamic_pointer_cast<IfcPropertySet>(relatingPropertyDefinition);
Expand All @@ -42,9 +42,11 @@ for (auto it : currentBuildingStorey->m_IsDecomposedBy_inverse)
- Professional support is available for bug fixing or custom implementations on www.ifcquery.com.



## Status

[![CMake build](https://github.com/ifcquery/ifcplusplus/actions/workflows/cmake.yml/badge.svg)](https://github.com/ifcquery/ifcplusplus/actions/workflows/cmake.yml)



## License
The project is published under the MIT license, which means that you can use it for any purpose, personal or commercial. There is no obligation to publish your source code.

Expand All @@ -60,5 +62,4 @@ https://github.com/ifcquery/ifcplusplus/wiki/Build-instructions
## Screenshot of steel frame model in the example viewer
980 000 entities loaded, 8000 with geometric representation. Loaded in < 4 sec. on a standard PC, including geometry.
![Steel frame model](http://www.ifcquery.com/img/Building-model-steel-frame-2018-02-05.png)