From 68c6835c82bdb0fdd5b3f3c7d2a4a5835dada001 Mon Sep 17 00:00:00 2001 From: Dennis Date: Wed, 18 May 2022 08:06:15 +0200 Subject: [PATCH] [new port] Add openctm (#24680) * New port: openctm * Change openctm from "version-semver" to "version" Co-authored-by: Frank <65999885+FrankXie05@users.noreply.github.com> * Update openctm versions file * Use ${PORT} instead of openctm directly * Put CMake configs in the unofficial namespace. * dos2unix Co-authored-by: Frank <65999885+FrankXie05@users.noreply.github.com> Co-authored-by: Billy Robert O'Neal III --- ports/openctm/CMakeLists.txt | 60 ++++++++++++++++++++++++++++++++++++ ports/openctm/portfile.cmake | 21 +++++++++++++ ports/openctm/vcpkg.json | 17 ++++++++++ versions/baseline.json | 4 +++ versions/o-/openctm.json | 9 ++++++ 5 files changed, 111 insertions(+) create mode 100644 ports/openctm/CMakeLists.txt create mode 100644 ports/openctm/portfile.cmake create mode 100644 ports/openctm/vcpkg.json create mode 100644 versions/o-/openctm.json diff --git a/ports/openctm/CMakeLists.txt b/ports/openctm/CMakeLists.txt new file mode 100644 index 0000000000..2d1de6a455 --- /dev/null +++ b/ports/openctm/CMakeLists.txt @@ -0,0 +1,60 @@ +cmake_minimum_required(VERSION 3.19...3.23) +project( + openctm + VERSION 1.0.3 + LANGUAGES C) + +set(PUBLIC_HEADERS lib/openctm.h lib/openctmpp.h) + +add_library( + openctm + lib/compressMG1.c + lib/compressMG2.c + lib/compressRAW.c + lib/openctm.c + lib/stream.c + lib/liblzma/Alloc.c + lib/liblzma/LzFind.c + lib/liblzma/LzmaDec.c + lib/liblzma/LzmaEnc.c + lib/liblzma/LzmaLib.c) + +target_include_directories( + openctm + PUBLIC $ + $ + $) +target_compile_definitions(openctm PRIVATE OPENCTM_BUILD LZMA_PREFIX_CTM) +if(NOT BUILD_SHARED_LIBS) + target_compile_definitions(openctm PUBLIC OPENCTM_STATIC) +endif() +target_compile_features(openctm PRIVATE c_std_99) +set_target_properties(openctm PROPERTIES C_VISIBILITY_PRESET hidden + PUBLIC_HEADER "${PUBLIC_HEADERS}") + +include(GNUInstallDirs) +install( + TARGETS openctm + EXPORT unofficial-openctmConfig + RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" + ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" + LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" + PUBLIC_HEADER DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}" COMPONENT dev) + +include(CMakePackageConfigHelpers) +set(VERSION_FILE_PATH "${CMAKE_CURRENT_BINARY_DIR}/unofficial-openctmConfigVersion.cmake") +write_basic_package_version_file( + "${VERSION_FILE_PATH}" + VERSION ${PROJECT_VERSION} + COMPATIBILITY SameMajorVersion) +install(FILES "${VERSION_FILE_PATH}" DESTINATION share/unofficial-openctm) + +install(FILES ${PUBLIC_HEADERS} DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}") + +install( + EXPORT unofficial-openctmConfig + FILE unofficial-openctmConfig.cmake + NAMESPACE unofficial::openctm:: + DESTINATION share/unofficial-openctm) + +export(PACKAGE openctm) diff --git a/ports/openctm/portfile.cmake b/ports/openctm/portfile.cmake new file mode 100644 index 0000000000..5be1b1d064 --- /dev/null +++ b/ports/openctm/portfile.cmake @@ -0,0 +1,21 @@ +vcpkg_from_sourceforge( + OUT_SOURCE_PATH SOURCE_PATH + REPO openctm + REF OpenCTM-1.0.3 + SHA512 fdfa08d19ecbfea99ba01aa2032e941ed6313394a96bd69f8984c2d2d079d836c616471d2bdf6f40175e75659f3ad0ba41502bc3d8224091472f40893ea8746e + FILENAME "OpenCTM-1.0.3-src.tar.bz2" +) + +file(COPY "${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt" DESTINATION "${SOURCE_PATH}") + +vcpkg_cmake_configure( + SOURCE_PATH "${SOURCE_PATH}" +) + +vcpkg_cmake_install() +vcpkg_copy_pdbs() +vcpkg_cmake_config_fixup(PACKAGE_NAME unofficial-openctm) + +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include") + +file(INSTALL "${SOURCE_PATH}/LICENSE.txt" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright) diff --git a/ports/openctm/vcpkg.json b/ports/openctm/vcpkg.json new file mode 100644 index 0000000000..fd0586f741 --- /dev/null +++ b/ports/openctm/vcpkg.json @@ -0,0 +1,17 @@ +{ + "name": "openctm", + "version": "1.0.3", + "description": "OpenCTM — the Open Compressed Triangle Mesh file format — is a file format, a software library and a tool set for compression of 3D triangle meshes.", + "homepage": "http://openctm.sourceforge.net/", + "license": "Zlib", + "dependencies": [ + { + "name": "vcpkg-cmake", + "host": true + }, + { + "name": "vcpkg-cmake-config", + "host": true + } + ] +} diff --git a/versions/baseline.json b/versions/baseline.json index cce2918afe..99108ceb17 100644 --- a/versions/baseline.json +++ b/versions/baseline.json @@ -5100,6 +5100,10 @@ "baseline": "1.4.2", "port-version": 2 }, + "openctm": { + "baseline": "1.0.3", + "port-version": 0 + }, "opencv": { "baseline": "4.5.5", "port-version": 0 diff --git a/versions/o-/openctm.json b/versions/o-/openctm.json new file mode 100644 index 0000000000..22d7ae8211 --- /dev/null +++ b/versions/o-/openctm.json @@ -0,0 +1,9 @@ +{ + "versions": [ + { + "git-tree": "ea30144a8ad57cb95b0603de14e4dc8e9f7b2ea2", + "version": "1.0.3", + "port-version": 0 + } + ] +}