From d695b9fda1b99afcaa8e0557a98d6403a9e9d3c1 Mon Sep 17 00:00:00 2001 From: Weihang Ding <798047000@qq.com> Date: Tue, 15 Aug 2023 08:28:50 +0800 Subject: [PATCH] [liblemon] Fix cmake config (#33130) * [liblemon] Fix cmake config * update version database * update patch * update version database --- ports/liblemon/cmake.patch | 34 ----- .../{fixup-targets.patch => fix-cmake.patch} | 128 +++++++++++------- ports/liblemon/portfile.cmake | 9 +- ports/liblemon/vcpkg.json | 2 +- versions/baseline.json | 2 +- versions/l-/liblemon.json | 5 + 6 files changed, 89 insertions(+), 91 deletions(-) delete mode 100644 ports/liblemon/cmake.patch rename ports/liblemon/{fixup-targets.patch => fix-cmake.patch} (56%) diff --git a/ports/liblemon/cmake.patch b/ports/liblemon/cmake.patch deleted file mode 100644 index 3b08a2d984..0000000000 --- a/ports/liblemon/cmake.patch +++ /dev/null @@ -1,34 +0,0 @@ -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/fix-cmake.patch similarity index 56% rename from ports/liblemon/fixup-targets.patch rename to ports/liblemon/fix-cmake.patch index 883e2a6eeb..17717295b7 100644 --- a/ports/liblemon/fixup-targets.patch +++ b/ports/liblemon/fix-cmake.patch @@ -1,50 +1,78 @@ -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(${CMAKE_CURRENT_LIST_DIR}/lemon-targets.cmake) +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 4406bc2..5717680 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -295,7 +295,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 +@@ -307,6 +307,13 @@ ELSEIF(WIN32) + ) + ENDIF() + ++install( ++ EXPORT lemon-targets ++ FILE lemon-targets.cmake ++ NAMESPACE unofficial::lemon:: ++ DESTINATION share/lemon/cmake ++) ++ + CONFIGURE_FILE( + ${PROJECT_SOURCE_DIR}/cmake/version.cmake.in + ${PROJECT_BINARY_DIR}/cmake/version.cmake +diff --git a/cmake/LEMONConfig.cmake.in b/cmake/LEMONConfig.cmake.in +index b0d2d8b..6bb662a 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(${CMAKE_CURRENT_LIST_DIR}/lemon-targets.cmake) +diff --git a/lemon/CMakeLists.txt b/lemon/CMakeLists.txt +index 4e6567e..ad6f5bf 100644 +--- a/lemon/CMakeLists.txt ++++ b/lemon/CMakeLists.txt +@@ -56,6 +56,10 @@ ENDIF() + + ADD_LIBRARY(lemon ${LEMON_SOURCES}) + ++INCLUDE(GNUInstallDirs) ++ ++TARGET_INCLUDE_DIRECTORIES(lemon PUBLIC $) ++ + TARGET_LINK_LIBRARIES(lemon + ${GLPK_LIBRARIES} ${COIN_LIBRARIES} ${ILOG_LIBRARIES} ${SOPLEX_LIBRARIES} + ) +@@ -71,6 +75,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/portfile.cmake b/ports/liblemon/portfile.cmake index 08c367e4be..d8579e6059 100644 --- a/ports/liblemon/portfile.cmake +++ b/ports/liblemon/portfile.cmake @@ -13,8 +13,7 @@ vcpkg_extract_source_archive( ARCHIVE "${ARCHIVE}" SOURCE_BASE "${VERSION}" PATCHES - cmake.patch - fixup-targets.patch + fix-cmake.patch ) vcpkg_cmake_configure( @@ -30,6 +29,8 @@ vcpkg_cmake_install() vcpkg_cmake_config_fixup(CONFIG_PATH share/lemon/cmake PACKAGE_NAME lemon) +vcpkg_fixup_pkgconfig() + 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") @@ -39,6 +40,4 @@ file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share") file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/bin" "${CURRENT_PACKAGES_DIR}/debug/bin") file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/share/doc") -# Handle copyright -file(INSTALL "${SOURCE_PATH}/LICENSE" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright) -vcpkg_fixup_pkgconfig() +vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE") diff --git a/ports/liblemon/vcpkg.json b/ports/liblemon/vcpkg.json index e0a9556dcc..dc767810fb 100644 --- a/ports/liblemon/vcpkg.json +++ b/ports/liblemon/vcpkg.json @@ -1,7 +1,7 @@ { "name": "liblemon", "version-date": "2019-06-13", - "port-version": 6, + "port-version": 7, "description": "Library for Efficient Modeling and Optimization in Networks", "homepage": "https://lemon.cs.elte.hu/trac/lemon", "dependencies": [ diff --git a/versions/baseline.json b/versions/baseline.json index cd774d956d..6e24876344 100644 --- a/versions/baseline.json +++ b/versions/baseline.json @@ -4278,7 +4278,7 @@ }, "liblemon": { "baseline": "2019-06-13", - "port-version": 6 + "port-version": 7 }, "liblinear": { "baseline": "243", diff --git a/versions/l-/liblemon.json b/versions/l-/liblemon.json index 0988cd4910..fcbabec40c 100644 --- a/versions/l-/liblemon.json +++ b/versions/l-/liblemon.json @@ -1,5 +1,10 @@ { "versions": [ + { + "git-tree": "e7357874ce9b71f43cb1c298dbb1228ac9241a69", + "version-date": "2019-06-13", + "port-version": 7 + }, { "git-tree": "b51839207be0c83364a5fa07660067ea774cc814", "version-date": "2019-06-13",