Added github flow, support for AppleClang (#5)

This commit is contained in:
Michele Adduci
2020-06-26 06:24:56 +02:00
committed by GitHub
parent 55cdff7489
commit 63f8814657
6 changed files with 25 additions and 19 deletions

View File

@@ -1,5 +1,7 @@
# openE57
![openE57](https://github.com/madduci/openE57/workflows/openE57/badge.svg)
openE57 is a forked version of the original LibE57 (http://www.libe57.org) project, with the intent to refine and optimize the source code in a modern C++ idiomatic way and remove unnecessary dependencies (e.g. Boost) in favour of the C++ Standard Library.
The library is compiled as C++17, since some of following language intrinsics and libraries are used:

View File

@@ -30,28 +30,28 @@ else(MSVC)
$<$<CONFIG:DEBUG>:-O0>
$<$<CONFIG:DEBUG>:-g>
$<$<CONFIG:DEBUG>:-p>
$<$<CONFIG:DEBUG>:-pg>
$<$<CXX_COMPILER_ID:Clang>:-stdlib=libc++>)
$<$<CONFIG:DEBUG>:-pg>)
list(APPEND compiler_definitions
$<$<OR:$<CONFIG:RELEASE>,$<CONFIG:MINSIZEREL>>:_FORTIFY_SOURCE=2>
)
list(APPEND linker_flags
-Wl,-z,defs
-Wl,-z,now
-Wl,-z,relro
$<$<NOT:$<BOOL:${BUILD_SHARED_LIBS}>>:-Wl,-pie>
$<$<NOT:$<BOOL:${BUILD_SHARED_LIBS}>>:-fpie>
$<$<NOT:$<BOOL:${BUILD_SHARED_LIBS}>>:-pipe>
$<$<BOOL:${BUILD_SHARED_LIBS}>:-static-libstdc++>
$<$<NOT:$<CXX_COMPILER_ID:AppleClang>>:-Wl,-z,defs>
$<$<NOT:$<CXX_COMPILER_ID:AppleClang>>:-Wl,-z,now>
$<$<NOT:$<CXX_COMPILER_ID:AppleClang>>:-Wl,-z,relro>
# Clang doesn't support these hardening flags
$<$<AND:$<NOT:$<CXX_COMPILER_ID:AppleClang>>,$<NOT:$<CXX_COMPILER_ID:Clang>>,$<NOT:$<BOOL:${BUILD_SHARED_LIBS}>>>:-Wl,-pie>
$<$<AND:$<NOT:$<CXX_COMPILER_ID:AppleClang>>,$<NOT:$<CXX_COMPILER_ID:Clang>>,$<NOT:$<BOOL:${BUILD_SHARED_LIBS}>>>:-fpie>
$<$<AND:$<NOT:$<CXX_COMPILER_ID:AppleClang>>,$<NOT:$<CXX_COMPILER_ID:Clang>>,$<NOT:$<BOOL:${BUILD_SHARED_LIBS}>>>:-pipe>
$<$<AND:$<NOT:$<CXX_COMPILER_ID:AppleClang>>,$<NOT:$<CXX_COMPILER_ID:Clang>>,$<NOT:$<BOOL:${BUILD_SHARED_LIBS}>>>:-static-libstdc++>
$<$<CONFIG:DEBUG>:-fno-omit-frame-pointer>
$<$<CONFIG:DEBUG>:-fsanitize=address>
$<$<CONFIG:DEBUG>:-fsanitize=leak>
$<$<CONFIG:DEBUG>:-fsanitize=undefined>
$<$<AND:$<NOT:$<CXX_COMPILER_ID:AppleClang>>,$<NOT:$<CXX_COMPILER_ID:Clang>>>:-fstack-clash-protection>
$<$<AND:$<NOT:$<CXX_COMPILER_ID:AppleClang>>,$<NOT:$<CXX_COMPILER_ID:Clang>>>:-fbounds-check>
-fstack-protector
-fbounds-check
-fstack-clash-protection
-fPIC)
endif()
endif()

View File

@@ -48,7 +48,7 @@
# else
# error "no supported compiler defined"
# endif
#elif defined(LINUX)
#elif defined(LINUX) || defined(__APPLE__) || defined(__unix__)
# define _LARGEFILE64_SOURCE
# define __LARGE64_FILES
# include <fcntl.h>
@@ -292,7 +292,6 @@ ustring NodeImpl::imageFileName()
void NodeImpl::setParent(shared_ptr<NodeImpl> parent, const ustring& elementName)
{
/// don't checkImageFileOpen
/// First check if our parent_ is already set, throw E57_ERROR_ALREADY_HAS_PARENT
/// The isAttached_ condition is to catch two errors:
/// 1) if user attempts to use the ImageFile root as a child (e.g. root.set("x", root))
@@ -351,6 +350,7 @@ bool NodeImpl::isTypeConstrained()
default:
break;
}
}
/// Didn't find any constraining VECTORs or COMPRESSED_VECTORs in path above us, so our type is not constrained.
return (false);
@@ -806,6 +806,7 @@ void StructureNodeImpl::set(const vector<ustring>& fields, unsigned level, share
parent->set(fields.at(level), child);
parent = child;
}
parent->set(fields.at(level), ni);
}
}
@@ -2614,6 +2615,7 @@ void FloatNodeImpl::writeXml(std::shared_ptr<ImageFileImpl> /*imf*/, CheckedFile
}
}
#ifdef E57_DEBUG
void FloatNodeImpl::dump(int indent, ostream& os)
{
@@ -4852,6 +4854,8 @@ uint64_t CheckedFile::lseek64(int64_t offset, int whence)
# endif
#elif defined(LINUX)
int64_t result = ::lseek64(fd_, offset, whence);
#elif defined(__APPLE__) || defined(__unix__)
int64_t result = ::lseek(fd_, offset, whence);
#else
# error "no supported OS platform defined"
#endif

View File

@@ -796,7 +796,7 @@ DEALINGS IN THE SOFTWARE.
# else
# error "no supported compiler defined"
# endif
#elif defined(LINUX)
#elif defined(LINUX) || defined(__APPLE__) || defined(__unix__)
# define _LARGEFILE64_SOURCE
# define __LARGE64_FILES
# include <sys/types.h>

View File

@@ -68,7 +68,7 @@
# else
# error "no supported compiler defined"
# endif
#elif defined(LINUX)
#elif defined(LINUX) || defined(__APPLE__) || defined(__unix__)
# define _LARGEFILE64_SOURCE
# define __LARGE64_FILES
# include <boost/uuid/uuid.hpp>

View File

@@ -415,12 +415,12 @@ struct GroupRecord
int64_t startIndex;
BoundingBox bbox;
GroupRecord(int64_t id);
explicit GroupRecord(int64_t id = 0);
void addMember(double coords[3], int64_t recordIndex);
void dump(int indent = 0, std::ostream& os = std::cout);
};
GroupRecord::GroupRecord(int64_t id_arg = 0) : id(id_arg), count(0), startIndex(0), bbox() {}
GroupRecord::GroupRecord(int64_t id_arg) : id(id_arg), count(0), startIndex(0), bbox() {}
void GroupRecord::addMember(double coords[3], int64_t recordIndex)
{