From fae4bd406ad40dfd7e5bc5f935816295337c4254 Mon Sep 17 00:00:00 2001 From: Navid Rahimi Date: Tue, 3 Jul 2018 16:06:18 +0430 Subject: [PATCH] Adding OGDF and LEMON library port (#3779) * Adding OGDF library port * Adding C++ Graph library - LEMON * [liblemon][ogdf] Rename lemon -> liblemon. Fix cmake targets. --- ports/liblemon/CONTROL | 3 ++ ports/liblemon/cmake.patch | 34 ++++++++++++++++++++ ports/liblemon/fixup-targets.patch | 50 ++++++++++++++++++++++++++++++ ports/liblemon/portfile.cmake | 46 +++++++++++++++++++++++++++ ports/ogdf/CONTROL | 3 ++ ports/ogdf/portfile.cmake | 22 +++++++++++++ 6 files changed, 158 insertions(+) create mode 100644 ports/liblemon/CONTROL create mode 100644 ports/liblemon/cmake.patch create mode 100644 ports/liblemon/fixup-targets.patch create mode 100644 ports/liblemon/portfile.cmake create mode 100644 ports/ogdf/CONTROL create mode 100644 ports/ogdf/portfile.cmake diff --git a/ports/liblemon/CONTROL b/ports/liblemon/CONTROL new file mode 100644 index 000000000..7e7a07402 --- /dev/null +++ b/ports/liblemon/CONTROL @@ -0,0 +1,3 @@ +Source: liblemon +Version: 1.3.1-1 +Description: Library for Efficient Modeling and Optimization in Networks diff --git a/ports/liblemon/cmake.patch b/ports/liblemon/cmake.patch new file mode 100644 index 000000000..3b08a2d98 --- /dev/null +++ b/ports/liblemon/cmake.patch @@ -0,0 +1,34 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 03e1cc7..fd9d737 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -280,6 +280,13 @@ ELSEIF(WIN32) + ) + ENDIF() + ++install( ++ EXPORT lemon-targets ++ FILE lemon-config.cmake ++ NAMESPACE lemon:: ++ DESTINATION share/lemon ++) ++ + CONFIGURE_FILE( + ${PROJECT_SOURCE_DIR}/cmake/version.cmake.in + ${PROJECT_BINARY_DIR}/cmake/version.cmake +diff --git a/lemon/CMakeLists.txt b/lemon/CMakeLists.txt +index 4e6567e..76f9cae 100644 +--- a/lemon/CMakeLists.txt ++++ b/lemon/CMakeLists.txt +@@ -71,6 +71,11 @@ INSTALL( + COMPONENT library + ) + ++install(TARGETS lemon EXPORT lemon-targets ++ LIBRARY DESTINATION lib ++ ARCHIVE DESTINATION lib ++) ++ + INSTALL( + DIRECTORY . bits concepts + DESTINATION include/lemon diff --git a/ports/liblemon/fixup-targets.patch b/ports/liblemon/fixup-targets.patch new file mode 100644 index 000000000..8a77f65d7 --- /dev/null +++ b/ports/liblemon/fixup-targets.patch @@ -0,0 +1,50 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 9a7c918..3d6cf35 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -268,7 +268,7 @@ CONFIGURE_FILE( + ${PROJECT_BINARY_DIR}/cmake/LEMONConfig.cmake + @ONLY + ) +-IF(UNIX) ++IF(UNIX OR TRUE) + INSTALL( + FILES ${PROJECT_BINARY_DIR}/cmake/LEMONConfig.cmake + DESTINATION share/lemon/cmake +@@ -282,9 +282,9 @@ ENDIF() + + install( + EXPORT lemon-targets +- FILE lemon-config.cmake +- NAMESPACE lemon:: +- DESTINATION share/lemon ++ FILE lemon-targets.cmake ++ NAMESPACE unofficial::lemon:: ++ DESTINATION share/lemon/cmake + ) + + CONFIGURE_FILE( +diff --git a/cmake/LEMONConfig.cmake.in b/cmake/LEMONConfig.cmake.in +index b0d2d8b..ce54986 100644 +--- a/cmake/LEMONConfig.cmake.in ++++ b/cmake/LEMONConfig.cmake.in +@@ -1,4 +1,4 @@ +-SET(LEMON_INCLUDE_DIR "@CMAKE_INSTALL_PREFIX@/include" CACHE PATH "LEMON include directory") ++SET(LEMON_INCLUDE_DIR "${CMAKE_CURRENT_LIST_DIR}/../../include" CACHE PATH "LEMON include directory") + SET(LEMON_INCLUDE_DIRS "${LEMON_INCLUDE_DIR}") + + IF(UNIX) +@@ -7,7 +7,12 @@ ELSEIF(WIN32) + SET(LEMON_LIB_NAME "lemon.lib") + ENDIF(UNIX) + +-SET(LEMON_LIBRARY "@CMAKE_INSTALL_PREFIX@/lib/${LEMON_LIB_NAME}" CACHE FILEPATH "LEMON library") ++SET(LEMON_LIBRARY ++ optimized "${CMAKE_CURRENT_LIST_DIR}/../../lib/${LEMON_LIB_NAME}" ++ debug "${CMAKE_CURRENT_LIST_DIR}/../../debug/lib/${LEMON_LIB_NAME}" ++ CACHE FILEPATH "LEMON library") + SET(LEMON_LIBRARIES "${LEMON_LIBRARY}") + + MARK_AS_ADVANCED(LEMON_LIBRARY LEMON_INCLUDE_DIR) ++ ++include(./lemon-targets.cmake) diff --git a/ports/liblemon/portfile.cmake b/ports/liblemon/portfile.cmake new file mode 100644 index 000000000..6cc2c9618 --- /dev/null +++ b/ports/liblemon/portfile.cmake @@ -0,0 +1,46 @@ +include(vcpkg_common_functions) + +if(VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic") + message("Dynamic linkage not supported. Building static instead.") + set(VCPKG_LIBRARY_LINKAGE static) +endif() + +set(VERSION 1.3.1) +set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/lemon-${VERSION}) +vcpkg_download_distfile(ARCHIVE + URLS "http://lemon.cs.elte.hu/pub/sources/lemon-${VERSION}.zip" + FILENAME "lemon-${VERSION}.zip" + SHA512 86d15914b8c3cd206a20c37dbe3b8ca4b553060567a07603db7b6f8dd7dcf9cb043cca31660ff1b7fb77e359b59fac5ca0aab57fd415fda5ecca0f42eade6567 +) +vcpkg_extract_source_archive(${ARCHIVE}) + +vcpkg_apply_patches( + SOURCE_PATH ${SOURCE_PATH} + PATCHES + ${CMAKE_CURRENT_LIST_DIR}/cmake.patch + ${CMAKE_CURRENT_LIST_DIR}/fixup-targets.patch +) + +vcpkg_configure_cmake( + SOURCE_PATH ${SOURCE_PATH} + PREFER_NINJA + OPTIONS + -DLEMON_ENABLE_GLPK=OFF + -DLEMON_ENABLE_ILOG=OFF + -DLEMON_ENABLE_COIN=OFF + -DLEMON_ENABLE_SOPLEX=OFF +) + +vcpkg_install_cmake() + +vcpkg_fixup_cmake_targets(CONFIG_PATH share/lemon/cmake TARGET_PATH share/lemon) + +file(GLOB EXE ${CURRENT_PACKAGES_DIR}/bin/*.exe) +file(COPY ${EXE} DESTINATION ${CURRENT_PACKAGES_DIR}/tools/liblemon/) +vcpkg_copy_tool_dependencies(${CURRENT_PACKAGES_DIR}/tools/liblemon) + +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include) +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/bin ${CURRENT_PACKAGES_DIR}/debug/bin) + +# Handle copyright +file(INSTALL ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/liblemon RENAME copyright) diff --git a/ports/ogdf/CONTROL b/ports/ogdf/CONTROL new file mode 100644 index 000000000..f02ae6450 --- /dev/null +++ b/ports/ogdf/CONTROL @@ -0,0 +1,3 @@ +Source: ogdf +Version: 2018-03-28-1 +Description: Open Graph Drawing Framework diff --git a/ports/ogdf/portfile.cmake b/ports/ogdf/portfile.cmake new file mode 100644 index 000000000..9033b9e5f --- /dev/null +++ b/ports/ogdf/portfile.cmake @@ -0,0 +1,22 @@ +include(vcpkg_common_functions) +set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/2018-03-28/OGDF-snapshot) +vcpkg_download_distfile(ARCHIVE + URLS "http://www.ogdf.net/lib/exe/fetch.php/tech:ogdf-snapshot-2018-03-28.zip" + FILENAME "ogdf-2018-03-28.zip" + SHA512 a6ddb33bc51dca4d59fcac65ff66459043b11ce5303e9d40e4fc1756adf84a0af7d0ac7debab670111e7a145dcdd9373c0e350d5b7e831b169811f246b6e19b6 +) +vcpkg_extract_source_archive(${ARCHIVE} ${CURRENT_BUILDTREES_DIR}/src/2018-03-28) + +vcpkg_configure_cmake( + SOURCE_PATH ${SOURCE_PATH} + PREFER_NINJA +) + +vcpkg_install_cmake() + +vcpkg_fixup_cmake_targets(CONFIG_PATH lib/cmake/OGDF) + +# Handle copyright +file(INSTALL ${SOURCE_PATH}/LICENSE.txt DESTINATION ${CURRENT_PACKAGES_DIR}/share/ogdf RENAME copyright) +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include ${CURRENT_PACKAGES_DIR}/debug/share) +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/lib/minisat/doc ${CURRENT_PACKAGES_DIR}/include/ogdf/lib/minisat/doc)