[lib3mf] New port. Introduces version 2.3.2 (#39886)

Co-authored-by: Martin Weismann <30837766+martinweismann@users.noreply.github.com>
Co-authored-by: Kai Pastor <dg0yt@darc.de>
Co-authored-by: WangWeiLin-MV <156736127+WangWeiLin-MV@users.noreply.github.com>
Co-authored-by: Billy Robert O'Neal III <bion@microsoft.com>
This commit is contained in:
Vijai Kumar S 2024-08-01 21:24:35 +05:30 committed by GitHub
parent eb8e1f44ff
commit ba0cb491c6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 168 additions and 0 deletions

View File

@ -0,0 +1,95 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index aaca07d..a893ee1 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -116,13 +116,6 @@ 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)
@@ -170,20 +163,33 @@ if (USE_INCLUDED_LIBZIP)
endif()
else()
- find_package(PkgConfig REQUIRED)
- pkg_check_modules(LIBZIP REQUIRED libzip)
- target_link_libraries(${PROJECT_NAME} ${LIBZIP_LIBRARIES})
+ find_package(LIBZIP REQUIRED)
+ target_link_libraries(${PROJECT_NAME} PRIVATE libzip::zip)
endif()
if (USE_INCLUDED_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})
+ find_package(ZLIB REQUIRED)
+ target_link_libraries(${PROJECT_NAME} PRIVATE ZLIB::ZLIB)
endif()
+#devendor base64
+# Include the directory for header files
+find_path(CPP_BASE64_INCLUDE_DIRS "cpp-base64/base64.cpp")
+include_directories("${CPP_BASE64_INCLUDE_DIRS}/cpp-base64")
+set(BASE64_SRC
+ ${CPP_BASE64_INCLUDE_DIRS}/cpp-base64/base64.h
+ ${CPP_BASE64_INCLUDE_DIRS}/cpp-base64/base64.cpp)
+message("BASE64_SRC" ${BASE64_SRC})
+# Append BASE64_SRC to the target
+target_sources(${PROJECT_NAME} PRIVATE ${BASE64_SRC})
+
+#devendor FastFloat
+find_package(FastFloat CONFIG REQUIRED)
+target_link_libraries(${PROJECT_NAME} PRIVATE FastFloat::fast_float)
+
set_target_properties(${PROJECT_NAME} PROPERTIES PREFIX "" IMPORT_PREFIX "" )
# This makes sure symbols are exported
target_compile_options(${PROJECT_NAME} PRIVATE "-D__LIB3MF_EXPORTS")
diff --git a/Include/Common/NMR_StringUtils.h b/Include/Common/NMR_StringUtils.h
index 4cafe3a..b32bc76 100644
--- a/Include/Common/NMR_StringUtils.h
+++ b/Include/Common/NMR_StringUtils.h
@@ -37,7 +37,7 @@ and Exception-safe
#include "Common/NMR_Types.h"
#include "Common/NMR_Local.h"
-#include <fast_float.h>
+#include <fast_float/fast_float.h>
#include <string>
#include <string.h>
diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt
index 2d94b2c..4f2a96b 100644
--- a/Source/CMakeLists.txt
+++ b/Source/CMakeLists.txt
@@ -12,7 +12,6 @@ if (USE_INCLUDED_ZLIB)
file(GLOB ZLIB_FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "Libraries/zlib/Source/*.c")
endif()
-file (GLOB CPPBASE64_FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "Libraries/cpp-base64/Source/*.cpp")
# sources
set(SRCS_PLATFORM
diff --git a/cmake/lib3mfConfig.cmake b/cmake/lib3mfConfig.cmake
index f1305b8..b7755c3 100644
--- a/cmake/lib3mfConfig.cmake
+++ b/cmake/lib3mfConfig.cmake
@@ -1,4 +1,7 @@
# lib3mfConfig.cmake
+include(CMakeFindDependencyMacro)
+find_dependency(libzip)
+find_dependency(ZLIB)
if(VCPKG_TOOLCHAIN)
message("Lib3MF - VCPKG Tool Chain")

View File

@ -0,0 +1,31 @@
vcpkg_check_linkage(ONLY_DYNAMIC_LIBRARY)
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO 3MFConsortium/lib3mf
REF "v${VERSION}"
SHA512 875529759aff6128b32291d0719b95a75a72a3b19f98711b12c9b1076727b231668b3b14604e69bb1fec79b4725fd098f030b7e965072e566bfb061f3086279c
PATCHES
lib3mf_vcpkg.patch
)
vcpkg_cmake_configure(
SOURCE_PATH "${SOURCE_PATH}"
OPTIONS
-DUSE_INCLUDED_ZLIB=OFF
-DUSE_INCLUDED_LIBZIP=OFF
-DUSE_INCLUDED_SSL=OFF
-DBUILD_FOR_CODECOVERAGE=OFF
-DLIB3MF_TESTS=OFF
)
vcpkg_cmake_install()
vcpkg_copy_pdbs()
vcpkg_cmake_config_fixup(CONFIG_PATH lib/cmake/lib3mf)
vcpkg_fixup_pkgconfig()
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}")
vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE")

7
ports/lib3mf/usage Normal file
View File

@ -0,0 +1,7 @@
lib3mf provides CMake targets:
find_package(lib3mf CONFIG REQUIRED)
target_link_libraries(target_name PRIVATE lib3mf::lib3mf)
For examples and use cases, kindly check
https://github.com/3MFConsortium/lib3mf/tree/develop/SDK/CPackExamples

22
ports/lib3mf/vcpkg.json Normal file
View File

@ -0,0 +1,22 @@
{
"name": "lib3mf",
"version": "2.3.2",
"description": "lib3mf is an implementation of the 3D Manufacturing Format file standard",
"homepage": "https://github.com/3MFConsortium/lib3mf",
"license": "BSD-2-Clause",
"supports": "(windows & (x86 | x64) & !static & !staticcrt) | (linux & x64) | (osx & (x64 | arm64))",
"dependencies": [
"cpp-base64",
"fast-float",
"libzip",
{
"name": "vcpkg-cmake",
"host": true
},
{
"name": "vcpkg-cmake-config",
"host": true
},
"zlib"
]
}

View File

@ -4200,6 +4200,10 @@
"baseline": "2.3.0",
"port-version": 0
},
"lib3mf": {
"baseline": "2.3.2",
"port-version": 0
},
"libaaplus": {
"baseline": "2.36",
"port-version": 1

9
versions/l-/lib3mf.json Normal file
View File

@ -0,0 +1,9 @@
{
"versions": [
{
"git-tree": "5e21531033faf6ea4bb51803d3281947a840d0ef",
"version": "2.3.2",
"port-version": 0
}
]
}