From bd13ea08d43d78ee6eec4807cc43d7cb00ab5aee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20B=C3=A9dard-Couture?= Date: Tue, 21 Jul 2020 18:43:03 -0400 Subject: [PATCH] [edlib] Adding new port (#12490) * Add edlib port * Fix cmake installation * Fixed the export error during install * Update ports/edlib/portfile.cmake Co-authored-by: NancyLi1013 <46708020+NancyLi1013@users.noreply.github.com> Co-authored-by: NancyLi1013 <46708020+NancyLi1013@users.noreply.github.com> --- ports/edlib/CONTROL | 4 ++ ports/edlib/fix-cmake-install.patch | 64 +++++++++++++++++++++++++++++ ports/edlib/portfile.cmake | 24 +++++++++++ 3 files changed, 92 insertions(+) create mode 100644 ports/edlib/CONTROL create mode 100644 ports/edlib/fix-cmake-install.patch create mode 100644 ports/edlib/portfile.cmake diff --git a/ports/edlib/CONTROL b/ports/edlib/CONTROL new file mode 100644 index 000000000..3a3e4b5e3 --- /dev/null +++ b/ports/edlib/CONTROL @@ -0,0 +1,4 @@ +Source: edlib +Version: 1.2.6 +Homepage: https://github.com/Martinsos/edlib +Description: Lightweight, super fast C/C++ (& Python) library for sequence alignment using edit (Levenshtein) distance. \ No newline at end of file diff --git a/ports/edlib/fix-cmake-install.patch b/ports/edlib/fix-cmake-install.patch new file mode 100644 index 000000000..8081bba78 --- /dev/null +++ b/ports/edlib/fix-cmake-install.patch @@ -0,0 +1,64 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 767d808..21f0cfc 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -74,14 +74,42 @@ if (NOT WIN32) # If on windows, do not build binaries that do not support window + target_link_libraries(edlib-aligner edlib) + endif() + +- +-# Create target 'install' for installing libraries. +-install(TARGETS edlib DESTINATION ${CMAKE_INSTALL_LIBDIR}) +-install(FILES edlib/include/edlib.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) +- + # configure and install pkg-config file + configure_file( + ${CMAKE_CURRENT_SOURCE_DIR}/edlib.pc.in + ${CMAKE_CURRENT_BINARY_DIR}/edlib-1.pc + @ONLY) + install(FILES ${CMAKE_CURRENT_BINARY_DIR}/edlib-1.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig) ++ ++### Additional config for VCPKG ++include(CMakePackageConfigHelpers) ++set(EDLIB_CMAKE_DIR "lib/cmake/edlib" CACHE STRING ++ "Installation directory for cmake files, relative to ${CMAKE_INSTALL_PREFIX}.") ++set(version_config "${PROJECT_BINARY_DIR}/edlib-config-version.cmake") ++set(project_config "${PROJECT_BINARY_DIR}/edlib-config.cmake") ++set(targets_export_name edlib-targets) ++ ++# Generate the version, config and target files into the build directory. ++write_basic_package_version_file( ++ ${version_config} ++ VERSION ${VERSION} ++ COMPATIBILITY AnyNewerVersion) ++configure_package_config_file( ++ ${PROJECT_SOURCE_DIR}/edlib-config.cmake.in ++ ${project_config} ++ INSTALL_DESTINATION ${EDLIB_CMAKE_DIR}) ++export(TARGETS edlib NAMESPACE edlib:: ++ FILE ${PROJECT_BINARY_DIR}/${targets_export_name}.cmake) ++ ++# Install version, config and target files. ++install( ++ FILES ${project_config} ${version_config} ++ DESTINATION ${EDLIB_CMAKE_DIR}) ++install(EXPORT ${targets_export_name} DESTINATION ${EDLIB_CMAKE_DIR} ++ NAMESPACE edlib::) ++ ++### // ++ ++# Create target 'install' for installing libraries. ++install(TARGETS edlib EXPORT ${targets_export_name} DESTINATION ${CMAKE_INSTALL_LIBDIR}) ++install(FILES edlib/include/edlib.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) +\ No newline at end of file +diff --git a/edlib-config.cmake.in b/edlib-config.cmake.in +new file mode 100644 +index 0000000..f2cc030 +--- /dev/null ++++ b/edlib-config.cmake.in +@@ -0,0 +1,4 @@ ++@PACKAGE_INIT@ ++ ++include(${CMAKE_CURRENT_LIST_DIR}/@targets_export_name@.cmake) ++check_required_components(edlib) +\ No newline at end of file diff --git a/ports/edlib/portfile.cmake b/ports/edlib/portfile.cmake new file mode 100644 index 000000000..788320015 --- /dev/null +++ b/ports/edlib/portfile.cmake @@ -0,0 +1,24 @@ +vcpkg_check_linkage(ONLY_STATIC_LIBRARY) + +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO Martinsos/edlib + REF v1.2.6 + SHA512 75b470c1403113e5f0895b3c1bb4163e65c6e04ccf41a75297a5b4cc915a567567ebcc79f3b9ea74b5e7188adfab2eceda5ac75e2d861aef8b3fefc6d4f39200 + HEAD_REF master + PATCHES + fix-cmake-install.patch +) + +vcpkg_configure_cmake( + SOURCE_PATH ${SOURCE_PATH} + PREFER_NINJA +) + +vcpkg_install_cmake() +vcpkg_fixup_cmake_targets(CONFIG_PATH lib/cmake/edlib) + +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include) + +# Handle copyright +file(INSTALL ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright)