[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>
This commit is contained in:
Rémi Bédard-Couture 2020-07-21 18:43:03 -04:00 committed by GitHub
parent c0d7b3970c
commit bd13ea08d4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 92 additions and 0 deletions

4
ports/edlib/CONTROL Normal file
View File

@ -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.

View File

@ -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

View File

@ -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)