Skip to content

Commit

Permalink
Merge branch 'develop' into QueryRequiredNamespaces
Browse files Browse the repository at this point in the history
  • Loading branch information
3dJan committed Mar 1, 2024
2 parents 51c0245 + 8ceec9c commit 05e675a
Show file tree
Hide file tree
Showing 2,197 changed files with 822,366 additions and 4,883 deletions.
70 changes: 52 additions & 18 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,31 +1,66 @@
on: [push, pull_request]
name: Build
jobs:
build-linux:
runs-on: ubuntu-18.04
build-linux-memtest:
runs-on: ubuntu-20.04
steps:
- run: sudo apt update
- run: sudo apt install -y valgrind uuid-dev
- uses: actions/checkout@v2
with:
submodules: true
- run: sh cmake/GenerateMake.sh
- run: cmake --build . --target lib3mf_memcheck
working-directory: ./build
- run: ctest -V
working-directory: ./build
- name: Archive Linux binary
uses: actions/upload-artifact@v2

build-linux-ubi8-gcc12:
runs-on: ubuntu-20.04
steps:
- run: sudo apt update
- run: sudo apt install -y uuid-dev
- uses: actions/checkout@v2
with:
name: lib3mf.so
path: build/lib3mf.so.2
submodules: true
- run: mkdir -p build
- run: zip -r build/bindings.zip Autogenerated/Bindings

- name: Archive bindings
uses: actions/upload-artifact@v2
with:
name: bindings.zip
path: build/bindings.zip
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
-
name: Docker Build
uses: docker/build-push-action@v5
with:
context: .
file: ./CI/Dockerfile
platforms: linux/amd64
tags: lib3mf_ubi8:latest
load: true
-
name: Docker Extract
uses: shrink/[email protected]
id: extract
with:
image: lib3mf_ubi8:latest
path: out.zip
destination: dist

- run: unzip out.zip
working-directory: ./dist
-
name: Upload Artifact
uses: actions/upload-artifact@v2
with:
name: lib3mf.so
path: dist/lib3mf.so.2

build-macos:
runs-on: macos-10.15
runs-on: macos-latest
steps:
- uses: actions/checkout@v2
with:
Expand All @@ -40,11 +75,10 @@ jobs:
with:
name: lib3mf.dylib
path: build/lib3mf.dylib

codecoverage-macos:
runs-on: macos-10.15
runs-on: macos-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
submodules: true
- name: Install Prerequisites
Expand All @@ -61,7 +95,7 @@ jobs:
name: codecoverage.zip
path: build/codecoverage.zip
- name: Upload code coverage to codecov
uses: codecov/codecov-action@v1
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./build/Test_CPP_Bindings_filtered.info
Expand Down Expand Up @@ -139,8 +173,8 @@ jobs:
- run: ctest -V
working-directory: ./build
assemble-sdk:
runs-on: ubuntu-18.04
needs: [build-windows-release, build-linux, build-macos]
runs-on: ubuntu-20.04
needs: [build-windows-release, build-macos, build-linux-ubi8-gcc12]
steps:
- run: sudo apt install -y zip unzip
- run: mkdir build
Expand All @@ -161,7 +195,7 @@ jobs:
name: lib3mf_sdk.zip
path: build/lib3mf_sdk.zip
deploy-linux:
runs-on: ubuntu-18.04
runs-on: ubuntu-20.04
needs: [assemble-sdk]
steps:
- run: sudo apt install -y zip unzip
Expand Down Expand Up @@ -213,7 +247,7 @@ jobs:
cmake --build . --config Release
./Release/Example_ExtractInfo.exe ../../Files/Helix.3mf
deploy-macos:
runs-on: macos-10.15
runs-on: macos-latest
needs: [assemble-sdk]
steps:
- name: Download lib3mf_sdk artifact
Expand All @@ -235,4 +269,4 @@ jobs:
sh Examples/Cpp/GenerateMake.sh
cd Examples/Cpp/build
cmake --build .
./Example_ExtractInfo ../../Files/Helix.3mf
./Example_ExtractInfo ../../Files/Helix.3mf
21 changes: 15 additions & 6 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,9 +1,18 @@
[submodule "Tests/googletest"]
path = Tests/googletest
url = https://github.com/google/googletest.git
[submodule "Tests/libressl"]
path = Tests/libressl
url = https://github.com/3MFConsortium/forks-libressl-distribution.git
[submodule "submodules/AutomaticComponentToolkit"]
path = submodules/AutomaticComponentToolkit
url = https://github.com/Autodesk/AutomaticComponentToolkit.git
[submodule "submodules/fast_float"]
path = submodules/fast_float
url = https://github.com/fastfloat/fast_float.git
[submodule "submodules/zlib"]
path = submodules/zlib
url = https://github.com/madler/zlib.git
[submodule "submodules/cpp-base64"]
path = submodules/cpp-base64
url = https://github.com/ReneNyffenegger/cpp-base64.git
[submodule "submodules/libzip"]
path = submodules/libzip
url = https://github.com/nih-at/libzip.git
[submodule "submodules/googletest"]
path = submodules/googletest
url = https://github.com/google/googletest.git
72 changes: 69 additions & 3 deletions CI/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,70 @@
FROM martinweismann/lib3mf_ppcbuilds:latest
FROM registry.access.redhat.com/ubi8/ubi-minimal:latest

LABEL maintainer="[email protected]"

ENV GCCTOOLSET=gcc-toolset-12

RUN \
microdnf update -y && \
microdnf -y install --nodocs \
wget \
which \
libuuid-devel \
glibc-langpack-en \
tar \
gzip \
zip \
${GCCTOOLSET} \
&& microdnf clean all

ENV LD_LIBRARY_PATH=/opt/rh/${GCCTOOLSET}/root/usr/lib64:/opt/rh/${GCCTOOLSET}/root/usr/lib${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
ENV PKG_CONFIG_PATH=/opt/rh/${GCCTOOLSET}/root/usr/lib64/pkgconfig${PKG_CONFIG_PATH:+:${PKG_CONFIG_PATH}}
ENV PATH=/opt/rh/${GCCTOOLSET}/root/usr/bin${PATH:+:${PATH}}

# CMake
ARG CMAKE_VERSION=3.28.1
ADD "https://github.com/Kitware/CMake/releases/download/v${CMAKE_VERSION}/cmake-${CMAKE_VERSION}-linux-x86_64.tar.gz" /usr/tmp/
RUN tar xzf /usr/tmp/cmake-$CMAKE_VERSION-linux-x86_64.tar.gz -C /opt && rm /usr/tmp/cmake-$CMAKE_VERSION-linux-x86_64.tar.gz
ENV PATH /opt/cmake-$CMAKE_VERSION-linux-x86_64/bin:${PATH}


RUN ln -s /opt/cmake-$CMAKE_VERSION-linux-x86_64/bin/cmake /usr/bin/cmake3
RUN ln -s /opt/cmake-$CMAKE_VERSION-linux-x86_64/bin/cpack /usr/bin/cpack3
RUN ln -s /opt/cmake-$CMAKE_VERSION-linux-x86_64/bin/ctest /usr/bin/ctest3


RUN ldd --version
RUN cmake --version
RUN cmake3 --version
RUN gcc --version


ADD . lib3mf-repo
ADD CI/script.sh script.sh
ENTRYPOINT ["sh", "script.sh"]

WORKDIR "/lib3mf-repo"

RUN chmod +x cmake/GenerateMake.sh

RUN cmake/GenerateMake.sh

WORKDIR "/lib3mf-repo/build"

RUN cmake --build .

RUN ctest -V .

WORKDIR "/../../"

RUN mkdir -p out

RUN cp ./lib3mf-repo/build/lib3mf.so.2 ./out/

RUN cd out && zip -r ../out.zip .








18 changes: 18 additions & 0 deletions CI/Dockerfile.ubuntu
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Copy this to root folder of lib3mf then build and run this image.
FROM ubuntu:20.04

RUN apt-get update && DEBIAN_FRONTEND=noninteractive TZ=Etc/UTC apt-get -y install build-essential uuid-dev wget

RUN wget -qO- "https://cmake.org/files/v3.28/cmake-3.28.1-linux-x86_64.tar.gz" | tar --strip-components=1 -xz -C /usr/local

ADD . lib3mf-repo

WORKDIR "/lib3mf-repo"

RUN cmake/GenerateMake.sh

WORKDIR "/lib3mf-repo/build"

RUN cmake --build .

RUN ctest -V .
7 changes: 0 additions & 7 deletions CI/script.sh

This file was deleted.

56 changes: 47 additions & 9 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ set(CMAKE_INSTALL_INCLUDEDIR include/lib3mf CACHE PATH "directory for installing

option(USE_INCLUDED_ZLIB "Use included zlib" ON)
option(USE_INCLUDED_LIBZIP "Use included libzip" ON)
option(USE_INCLUDED_GTEST "Used included gtest" ON)
option(USE_INCLUDED_SSL "Use included libressl" ON)
option(BUILD_FOR_CODECOVERAGE "Build for code coverage analysis" OFF)
option(STRIP_BINARIES "Strip binaries (on non-apple)" ON)
Expand Down Expand Up @@ -115,35 +114,74 @@ add_library(${PROJECT_NAME} SHARED ${SRCS_COMMON} ${HDRS_COMMON}
)
SOURCE_GROUP("Source Files\\Autogenerated" FILES ${ACT_GENERATED_SOURCE})


file(GLOB
LIBS_INCLUDE
LIST_DIRECTORIES true
${CMAKE_CURRENT_SOURCE_DIR}/Libraries/*/Include
)
list(FILTER LIBS_INCLUDE EXCLUDE REGEX "zlib|libzip|libressl")
target_include_directories(${PROJECT_NAME} PRIVATE ${LIBS_INCLUDE})

# allow FASTFLOAT_ALLOWS_LEADING_PLUS
add_definitions(-DFASTFLOAT_ALLOWS_LEADING_PLUS=1)

target_include_directories(${PROJECT_NAME} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR_AUTOGENERATED}/Source)
target_include_directories(${PROJECT_NAME} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/Include/API)
target_include_directories(${PROJECT_NAME} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/Include)

if (USE_INCLUDED_LIBZIP)
target_compile_options(${PROJECT_NAME} PRIVATE "-DZIP_STATIC")
target_include_directories(${PROJECT_NAME} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/Include/Libraries/libzip)
target_include_directories(${PROJECT_NAME} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/Libraries/libzip/Include)
if(MSVC)
target_compile_definitions(${PROJECT_NAME} PRIVATE _CRT_SECURE_NO_WARNINGS)
target_compile_definitions(${PROJECT_NAME} PRIVATE _CRT_NONSTDC_NO_DEPRECATE)
endif()
if(WIN32)
target_link_libraries(${PROJECT_NAME} PRIVATE advapi32)
# disable win32 build failing 'initializing': conversion from 'zip_uint64_t' to 'size_t', possible loss of data
if("${CMAKE_SIZEOF_VOID_P}" STREQUAL "4")
target_compile_options(${PROJECT_NAME} PRIVATE /wd4244)
endif()
endif()

# create libzip autogenerated platform specific headers
if(NOT EXISTS ${CMAKE_BINARY_DIR}/libzip)
execute_process(
COMMAND ${CMAKE_COMMAND} "-DZLIB_INCLUDE_DIR=${CMAKE_CURRENT_SOURCE_DIR}/submodules/zlib"
"-DZLIB_LIBRARY=zlibstatic" "-DENABLE_COMMONCRYPTO=OFF" "-DENABLE_GNUTLS=OFF" "-DENABLE_MBEDTLS=OFF"
"-DENABLE_OPENSSL=OFF" "-DENABLE_WINDOWS_CRYPTO=OFF"
"-DENABLE_BZIP2=OFF" "-DENABLE_LZMA=OFF" "-DENABLE_ZSTD=OFF"
"-DBUILD_TOOLS=OFF" "-DBUILD_REGRESS=OFF"
"-DBUILD_EXAMPLES=OFF" "-DBUILD_DOC=OFF" "-DBUILD_SHARED_LIBS=OFF" "-DLIBZIP_DO_INSTALL=OFF"
"-S" "${CMAKE_CURRENT_SOURCE_DIR}/submodules/libzip" "-B" "${CMAKE_CURRENT_BINARY_DIR}/libzip"
RESULT_VARIABLE CMD_ERROR
OUTPUT_QUIET)
MESSAGE( STATUS "CMD_ERROR:" ${CMD_ERROR})
endif()
target_include_directories(${PROJECT_NAME} PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/libzip)

if (UNIX OR MINGW)
target_compile_options(${PROJECT_NAME} PRIVATE "-DHAVE_FSEEKO")
target_compile_options(${PROJECT_NAME} PRIVATE "-DHAVE_FTELLO")
target_compile_options(${PROJECT_NAME} PRIVATE "-DHAVE_STRCASECMP")
target_compile_options(${PROJECT_NAME} PRIVATE "-DHAVE_UNISTD_H")
target_compile_options(${PROJECT_NAME} PRIVATE "-DHAVE_FSEEKO")
target_compile_options(${PROJECT_NAME} PRIVATE "-DHAVE_FTELLO")
target_compile_options(${PROJECT_NAME} PRIVATE "-DHAVE_STRCASECMP")
target_compile_options(${PROJECT_NAME} PRIVATE "-DHAVE_UNISTD_H")
endif()

else()
find_package(PkgConfig REQUIRED)
pkg_check_modules(LIBZIP REQUIRED libzip)
target_link_libraries(${PROJECT_NAME} ${LIBZIP_LIBRARIES})
endif()


if (USE_INCLUDED_ZLIB)
target_include_directories(${PROJECT_NAME} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/Include/Libraries/zlib)
target_include_directories(${PROJECT_NAME} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/Libraries/zlib/Include)
else()
find_package(PkgConfig REQUIRED)
pkg_check_modules(ZLIB REQUIRED zlib)
target_link_libraries(${PROJECT_NAME} ${ZLIB_LIBRARIES})
endif()


set_target_properties(${PROJECT_NAME} PROPERTIES PREFIX "" IMPORT_PREFIX "" )
# This makes sure symbols are exported
target_compile_options(${PROJECT_NAME} PRIVATE "-D__LIB3MF_EXPORTS")
Expand Down
3 changes: 3 additions & 0 deletions Include/Common/NMR_ErrorConst.h
Original file line number Diff line number Diff line change
Expand Up @@ -1228,6 +1228,9 @@ Model error codes (0x8XXX)
// A component resource is invalid
#define NMR_ERROR_INVALIDCOMPONENTRESOURCE 0x810D

// A keystore element is not base64 encoded
#define NMR_ERROR_KEYSTOREINVALIDENCODING 0x810E

/*-------------------------------------------------------------------
XML Parser Error Constants (0x9XXX)
-------------------------------------------------------------------*/
Expand Down
3 changes: 3 additions & 0 deletions Include/Common/NMR_StringUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ and Exception-safe

#include "Common/NMR_Types.h"
#include "Common/NMR_Local.h"

#include <fast_float.h>

#include <string>
#include <string.h>
#include <vector>
Expand Down
2 changes: 1 addition & 1 deletion Include/Common/OPC/NMR_OpcPackageReader.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ NMR_OpcPackageReader.h defines an OPC Package reader in a portable way.
#include "Common/OPC/NMR_OpcPackageRelationship.h"
#include "Common/3MF_ProgressMonitor.h"
#include "Common/NMR_ModelWarnings.h"
#include "Libraries/libzip/zip.h"
#include "zip.h"
#include <list>
#include <vector>
#include <map>
Expand Down
2 changes: 1 addition & 1 deletion Include/Common/Platform/NMR_ExportStream_Compressed.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ NMR_ExportStream_Compressed.h defines a stream to write compressed files
#include "Common/NMR_Types.h"
#include "Common/Platform/NMR_ExportStream.h"
#include "Common/Platform/NMR_PortableZIPWriter.h"
#include "Libraries/zlib/zlib.h"
#include "zlib.h"

#define EXPORTSTREAM_WRITE_BUFFER_CHUNKSIZE 1024

Expand Down
2 changes: 1 addition & 1 deletion Include/Common/Platform/NMR_ExportStream_ZIP.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ NMR_PortableZIPWriter.h defines a portable stream to write into ZIP files
#include "Common/NMR_Types.h"
#include "Common/Platform/NMR_ExportStream.h"
#include "Common/Platform/NMR_PortableZIPWriter.h"
#include "Libraries/zlib/zlib.h"
#include "zlib.h"

#include <array>

Expand Down
Loading

0 comments on commit 05e675a

Please sign in to comment.