Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[edlib] Adding new port #12490

Merged
merged 6 commits into from
Jul 21, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions ports/edlib/CONTROL
Original file line number Diff line number Diff line change
@@ -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.
64 changes: 64 additions & 0 deletions ports/edlib/fix-cmake-install.patch
Original file line number Diff line number Diff line change
@@ -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
24 changes: 24 additions & 0 deletions ports/edlib/portfile.cmake
Original file line number Diff line number Diff line change
@@ -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)