Skip to content

Commit

Permalink
merging cmake improvements into integration_tests (resolved conflicts)
Browse files Browse the repository at this point in the history
  • Loading branch information
vijaiaeroastro committed Jun 2, 2024
2 parents 512882e + 96a3e50 commit c9d55f8
Show file tree
Hide file tree
Showing 26 changed files with 2,785 additions and 13 deletions.
190 changes: 182 additions & 8 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
on: [push, pull_request]
env:
LIB3MF_VERSION: "2.3.1"
# Set this to "on" to enable integration tests and "off" to skip integration tests
RUN_INTEGRATION_TESTS: "on"
name: Build
jobs:

build-linux-memtest:
runs-on: ubuntu-20.04
steps:
Expand All @@ -26,14 +28,12 @@ jobs:
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
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
-
name: Docker Build
Expand All @@ -55,12 +55,41 @@ jobs:

- run: unzip out.zip
working-directory: ./dist
-
name: Upload Artifact
- name: Upload Artifact
uses: actions/upload-artifact@v2
with:
name: lib3mf.so
path: dist/lib3mf.so.2
- name: Extract File Name (CPacked Archive)
run: |
ZIP_FILE=$(ls dist/lib3mf-*.zip)
echo "ARTIFACT_NAME_ZIP=$(basename ${ZIP_FILE})" >> $GITHUB_ENV
shell: bash
- name: Upload Artifact (CPacked Archive)
uses: actions/upload-artifact@v2
with:
name: ${{ env.ARTIFACT_NAME_ZIP }}
path: dist/${{ env.ARTIFACT_NAME_ZIP }}
- name: Extract File Name (Debian)
run: |
DEB_FILE=$(ls dist/lib3mf-*.deb)
echo "ARTIFACT_NAME_DEB=$(basename ${DEB_FILE})" >> $GITHUB_ENV
shell: bash
- name: Upload Artifact (Debian Archive)
uses: actions/upload-artifact@v2
with:
name: ${{ env.ARTIFACT_NAME_DEB }}
path: dist/${{ env.ARTIFACT_NAME_DEB }}
- name: Extract File Name (RPM)
run: |
RPM_FILE=$(ls dist/lib3mf-*.rpm)
echo "ARTIFACT_NAME_RPM=$(basename ${RPM_FILE})" >> $GITHUB_ENV
shell: bash
- name: Upload Artifact (RPM Archive)
uses: actions/upload-artifact@v2
with:
name: ${{ env.ARTIFACT_NAME_RPM }}
path: dist/${{ env.ARTIFACT_NAME_RPM }}

build-macos:
runs-on: macos-latest
Expand All @@ -73,11 +102,23 @@ jobs:
working-directory: ./build
- run: ctest -V
working-directory: ./build
- run: cpack -G ZIP -C Release
working-directory: ./build
- name: Extract File Name
run: |
ZIP_FILE=$(ls build/lib3mf-*.zip)
echo "ARTIFACT_NAME=$(basename ${ZIP_FILE})" >> $GITHUB_ENV
shell: bash
- name: Archive Mac binary
uses: actions/upload-artifact@v2
with:
name: lib3mf.dylib
path: build/lib3mf.dylib
- name: Upload Artifact (CPacked Archive)
uses: actions/upload-artifact@v2
with:
name: ${{ env.ARTIFACT_NAME }}
path: build/${{ env.ARTIFACT_NAME }}

build-macos-debug:
runs-on: macos-latest
Expand Down Expand Up @@ -122,7 +163,7 @@ jobs:
files: ./build/Test_CPP_Bindings_filtered.info
fail_ci_if_error: true # optional (default = false)
verbose: true # optional (default = false)

build-windows-release:
runs-on: windows-2019
steps:
Expand All @@ -134,6 +175,13 @@ jobs:
working-directory: ./build
- run: ctest -V
working-directory: ./build
- run: cpack -G ZIP -C Release
working-directory: ./build
- name: Extract File Name
run: |
$zipFile = Get-ChildItem build\lib3mf-*.zip -Name
echo "ARTIFACT_NAME=$zipFile" | Out-File -FilePath $env:GITHUB_ENV -Append
shell: pwsh
- name: Archive Windows Release binary
uses: actions/upload-artifact@v2
with:
Expand All @@ -144,6 +192,12 @@ jobs:
with:
name: lib3mf.lib
path: build/Release/lib3mf.lib
- name: Upload Artifact (CPacked Archive)
uses: actions/upload-artifact@v2
with:
name: ${{ env.ARTIFACT_NAME }}
path: build/${{ env.ARTIFACT_NAME }}

build-windows-debug:
runs-on: windows-2019
steps:
Expand Down Expand Up @@ -201,6 +255,8 @@ jobs:
working-directory: ./build
- run: ctest -V
working-directory: ./build


assemble-sdk:
runs-on: ubuntu-20.04
needs: [build-windows-release, build-macos, build-linux-ubi8-gcc12]
Expand All @@ -218,16 +274,43 @@ jobs:
- run: unzip bindings.zip/bindings.zip
working-directory: ./build
- run: bash SDK/GenerateSDK_github.sh
- name: Archive SDK artifact
- name: Archive SDK artifact (Comprehensive)
uses: actions/upload-artifact@v2
with:
name: lib3mf_sdk.zip
path: build/lib3mf_sdk.zip
- name: Archive SDK artifact (CPack - Linux)
uses: actions/upload-artifact@v2
with:
name: lib3mf-${{ env.LIB3MF_VERSION }}-Linux.zip
path: build/lib3mf-${{ env.LIB3MF_VERSION }}-Linux.zip
- name: Archive SDK artifact (CPack - Windows)
uses: actions/upload-artifact@v2
with:
name: lib3mf-${{ env.LIB3MF_VERSION }}-Windows.zip
path: build/lib3mf-${{ env.LIB3MF_VERSION }}-Windows.zip
- name: Archive SDK artifact (CPack - Darwin)
uses: actions/upload-artifact@v2
with:
name: lib3mf-${{ env.LIB3MF_VERSION }}-Darwin.zip
path: build/lib3mf-${{ env.LIB3MF_VERSION }}-Darwin.zip
- name: Archive SDK artifact (CPack - Debian)
uses: actions/upload-artifact@v2
with:
name: lib3mf-${{ env.LIB3MF_VERSION }}-Linux.deb
path: build/lib3mf-${{ env.LIB3MF_VERSION }}-Linux.deb
- name: Archive SDK artifact (CPack - RPM)
uses: actions/upload-artifact@v2
with:
name: lib3mf-${{ env.LIB3MF_VERSION }}-Linux.rpm
path: build/lib3mf-${{ env.LIB3MF_VERSION }}-Linux.rpm


deploy-linux:
runs-on: ubuntu-20.04
needs: [assemble-sdk]
steps:
- run: sudo apt install -y zip unzip
- run: sudo apt install -y zip unzip file
- run: pwd
- run: ls -Rl .
- name: Download lib3mf_sdk artifact
Expand All @@ -251,6 +334,54 @@ jobs:
cd Examples/Cpp/build
cmake --build .
./Example_ExtractInfo ../../Files/Helix.3mf
- name: Download lib3mf cpack (Linux)
uses: actions/download-artifact@v2
with:
name: lib3mf-${{ env.LIB3MF_VERSION }}-Linux.zip
path: lib3mf-${{ env.LIB3MF_VERSION }}-Linux.zip
- run: ls -Rl .
- name: Unpack the cpacked SDK
run: |
unzip lib3mf-${{ env.LIB3MF_VERSION }}-Linux.zip/lib3mf-${{ env.LIB3MF_VERSION }}-Linux.zip
- name: Build CppDynamicNew
run: |
sh Examples/CppDynamicNew/GenerateMake.sh
cd Examples/CppDynamicNew/build
cmake --build .
./Example_ExtractInfo ../../Files/Helix.3mf
- name: Build CppNew
run: |
sh Examples/CppNew/GenerateMake.sh
cd Examples/CppNew/build
cmake --build .
./Example_ExtractInfo ../../Files/Helix.3mf
- name: Download lib3mf (Debian Linux)
uses: actions/download-artifact@v2
with:
name: lib3mf-${{ env.LIB3MF_VERSION }}-Linux.deb
path: lib3mf-${{ env.LIB3MF_VERSION }}-Linux.deb
- name: Check the file type
run: |
file lib3mf-${{ env.LIB3MF_VERSION }}-Linux.deb
file lib3mf-${{ env.LIB3MF_VERSION }}-Linux.deb/lib3mf-${{ env.LIB3MF_VERSION }}-Linux.deb
- run: pwd
- run: ls -Rl .
- name: Install the debian package
run: |
sudo dpkg -i lib3mf-${{ env.LIB3MF_VERSION }}-Linux.deb/lib3mf-${{ env.LIB3MF_VERSION }}-Linux.deb
- name: Build CppDynamicNew (Debian)
run: |
sh Examples/CppDynamicNew/GenerateMake.sh
cd Examples/CppDynamicNew/build
cmake --build .
./Example_ExtractInfo ../../Files/Helix.3mf
- name: Build CppNew (Debian)
run: |
sh Examples/CppNew/GenerateMake.sh
cd Examples/CppNew/build
cmake --build .
./Example_ExtractInfo ../../Files/Helix.3mf
deploy-windows:
runs-on: windows-2019
needs: [assemble-sdk]
Expand All @@ -275,6 +406,27 @@ jobs:
cd Examples/Cpp/build
cmake --build . --config Release
./Release/Example_ExtractInfo.exe ../../Files/Helix.3mf
- name: Download lib3mf cpack (Windows)
uses: actions/download-artifact@v2
with:
name: lib3mf-${{ env.LIB3MF_VERSION }}-Windows.zip
path: lib3mf-${{ env.LIB3MF_VERSION }}-Windows.zip
- name: Unpack the cpacked SDK
run: |
unzip lib3mf-${{ env.LIB3MF_VERSION }}-Windows.zip/lib3mf-${{ env.LIB3MF_VERSION }}-Windows.zip
- name: Build CppDynamic (Windows)
run: |
./Examples/CppDynamic/GenerateVS2019.bat
cd Examples/CppDynamic/build
cmake --build . --config Release
./Release/Example_ExtractInfo.exe ../../Files/Helix.3mf
- name: Build Cpp (Windows)
run: |
./Examples/Cpp/GenerateVS2019.bat
cd Examples/Cpp/build
cmake --build . --config Release
./Release/Example_ExtractInfo.exe ../../Files/Helix.3mf
deploy-macos:
runs-on: macos-latest
needs: [assemble-sdk]
Expand All @@ -299,6 +451,28 @@ jobs:
cd Examples/Cpp/build
cmake --build .
./Example_ExtractInfo ../../Files/Helix.3mf
- name: Download lib3mf cpack (Darwin)
uses: actions/download-artifact@v2
with:
name: lib3mf-${{ env.LIB3MF_VERSION }}-Darwin.zip
path: lib3mf-${{ env.LIB3MF_VERSION }}-Darwin.zip
- run: ls -Rl .
- name: Unpack the cpacked SDK (Darwin)
run: |
unzip lib3mf-${{ env.LIB3MF_VERSION }}-Darwin.zip/lib3mf-${{ env.LIB3MF_VERSION }}-Darwin.zip
- name: Build CppDynamicNew (Darwin)
run: |
sh Examples/CppDynamicNew/GenerateMake.sh
cd Examples/CppDynamicNew/build
cmake --build .
./Example_ExtractInfo ../../Files/Helix.3mf
- name: Build CppNew (Darwin)
run: |
sh Examples/CppNew/GenerateMake.sh
cd Examples/CppNew/build
cmake --build .
./Example_ExtractInfo ../../Files/Helix.3mf
set-integration-tests-status:
runs-on: ubuntu-20.04
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,5 @@ Include/Model/COM/NMR_COMVersion.h
debug
.DS_Store
.vscode
.idea
cmake-build-*
17 changes: 16 additions & 1 deletion CI/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ RUN \
tar \
gzip \
zip \
rpm-build \
${GCCTOOLSET} \
&& microdnf clean all

Expand Down Expand Up @@ -53,14 +54,28 @@ RUN cmake --build .

RUN ctest -V .

# Add this line to generate a ZIP package with cpack
RUN cpack -G ZIP -C Release

# Generate a debian package
RUN cpack -G DEB -C Release

# Generate a RPM package
RUN cpack -G RPM -C Release

WORKDIR "/../../"

RUN mkdir -p out

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

RUN cd out && zip -r ../out.zip .
RUN cp ./lib3mf-repo/build/lib3mf-*-Linux.zip ./out/

RUN cp ./lib3mf-repo/build/lib3mf-*-Linux.deb ./out/

RUN cp ./lib3mf-repo/build/lib3mf-*-Linux.rpm ./out/

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



Expand Down
27 changes: 24 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,10 @@ if (${MSVC})
# using Visual Studio C++

# this ensures that the min/max macros of minwindef.h are not used
add_definitions(-DNOMINMAX /W3)
add_definitions(-DNOMINMAX)

#add_definitions(/W3)

add_definitions(/W3)

# add_definitions(-D_CRT_NONSTDC_NO_DEPRECATE -D_CRT_SECURE_NO_WARNINGS)
# set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /MT")
# set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /MTd")
Expand Down Expand Up @@ -131,6 +131,7 @@ target_include_directories(${PROJECT_NAME} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/I
target_include_directories(${PROJECT_NAME} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/Include)

if (USE_INCLUDED_LIBZIP)
# Something goes here to check if submodules exist and initialize the submodules if it does not
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)
Expand Down Expand Up @@ -226,6 +227,8 @@ endif(WIN32)

configure_file(lib3mf.pc.in lib3mf.pc @ONLY)
install(FILES ${CMAKE_BINARY_DIR}/lib3mf.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
install(FILES cmake/lib3mfConfig.cmake
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/lib3mf)
install(TARGETS ${PROJECT_NAME}
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
Expand All @@ -249,3 +252,21 @@ if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
set_property(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY VS_STARTUP_PROJECT ${STARTUPPROJECT})
ENDIF()
endif()


#########################################################
set(CPACK_PACKAGE_NAME "lib3mf")
set(CPACK_PACKAGE_VENDOR "3MF Consortium")
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "lib3mf - An implementation of the 3D Manufacturing Format file standard")
set(CPACK_PACKAGE_VERSION "${LIB3MF_VERSION_MAJOR}.${LIB3MF_VERSION_MINOR}.${LIB3MF_VERSION_MICRO}")
set(CPACK_PACKAGE_VERSION_MAJOR "${LIB3MF_VERSION_MAJOR}")
set(CPACK_PACKAGE_VERSION_MINOR "${LIB3MF_VERSION_MINOR}")
set(CPACK_PACKAGE_VERSION_PATCH "${LIB3MF_VERSION_MICRO}")
set(CPACK_DEBIAN_PACKAGE_ARCHITECTURE "amd64")
set(CPACK_PACKAGE_CONTACT "[email protected]")
set(CPACK_DEBIAN_PACKAGE_MAINTAINER "3MF Consortium")
set(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}-${CMAKE_SYSTEM_NAME}")
set(CPACK_SOURCE_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}-Source")

#########################################################
include(CPack)
Loading

0 comments on commit c9d55f8

Please sign in to comment.