From 305a76fcae4acbd55878809820828abbc7263932 Mon Sep 17 00:00:00 2001 From: shixiong2333 <50489744+shixiong2333@users.noreply.github.com> Date: Wed, 7 Jan 2026 18:02:14 +0800 Subject: [PATCH] [qpoases] Add new port (#49101) --- ports/qpoases/export_target.diff | 113 +++++++++++++++++++++++++++++++ ports/qpoases/portfile.cmake | 25 +++++++ ports/qpoases/usage | 10 +++ ports/qpoases/vcpkg.json | 17 +++++ versions/baseline.json | 4 ++ versions/q-/qpoases.json | 9 +++ 6 files changed, 178 insertions(+) create mode 100644 ports/qpoases/export_target.diff create mode 100644 ports/qpoases/portfile.cmake create mode 100644 ports/qpoases/usage create mode 100644 ports/qpoases/vcpkg.json create mode 100644 versions/q-/qpoases.json diff --git a/ports/qpoases/export_target.diff b/ports/qpoases/export_target.diff new file mode 100644 index 0000000000..9dc820bee5 --- /dev/null +++ b/ports/qpoases/export_target.diff @@ -0,0 +1,113 @@ +Index: qpOASESConfig.cmake.in +IDEA additional info: +Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +<+>GBK +=================================================================== +diff --git a/qpOASESConfig.cmake.in b/qpOASESConfig.cmake.in +--- a/qpOASESConfig.cmake.in (revision 35b762ba3fee2e009d9e99650c68514da05585c5) ++++ b/qpOASESConfig.cmake.in (date 1766737135519) +@@ -5,25 +5,54 @@ + # qpOASES_INCLUDE_DIR - The qpOASES include directory + # qpOASES_LIBRARY_DIR - The qpOASES library directory + # qpOASES_LIBRARY - The qpOASES library +-# qpOASES_VERSION - The qpOASES version in the form . +- +- ++# qpOASES_VERSION - The qpOASES version in the form . ++# ++# It also provides the following imported target: ++# ++# qpOASES::qpOASES + + @PACKAGE_INIT@ + + set(qpOASES_VERSION @PACKAGE_VERSION@) + ++# ------------------------------------------------------------ ++# Load exported targets (modern CMake) ++# ------------------------------------------------------------ ++include("${CMAKE_CURRENT_LIST_DIR}/qpOASESTargets.cmake") + +-set_and_check(qpOASES_INCLUDE_DIR "@PACKAGE_INCLUDE_INSTALL_DIR@") ++# ------------------------------------------------------------ ++# Backward compatibility variables (derived from target) ++# ------------------------------------------------------------ + ++# Include directory ++get_target_property(_qpOASES_INCLUDE_DIR qpOASES::qpOASES INTERFACE_INCLUDE_DIRECTORIES) ++ ++# Handle generator expressions and lists ++list(GET _qpOASES_INCLUDE_DIR 0 qpOASES_INCLUDE_DIR) + + set(qpOASES_INCLUDE_DIR "${qpOASES_INCLUDE_DIR}" CACHE STRING "Include path for qpOASES and its dependencies") +-set_and_check(qpOASES_LIBRARY_DIR @PACKAGE_LIB_INSTALL_DIR@) ++ ++# Library file (configuration-aware) ++get_target_property(_qpOASES_LIB_LOCATION qpOASES::qpOASES IMPORTED_LOCATION) ++ ++if(NOT _qpOASES_LIB_LOCATION) ++ if(CMAKE_BUILD_TYPE STREQUAL Debug) ++ get_target_property(_qpOASES_LIB_LOCATION qpOASES::qpOASES IMPORTED_LOCATION_DEBUG) ++ else() ++ get_target_property(_qpOASES_LIB_LOCATION qpOASES::qpOASES IMPORTED_LOCATION_RELEASE) ++ endif() ++endif() ++ ++set(qpOASES_LIBRARY "${_qpOASES_LIB_LOCATION}") ++ ++# Library directory ++get_filename_component(qpOASES_LIBRARY_DIR "${qpOASES_LIBRARY}" DIRECTORY) ++ + set(qpOASES_LIBRARY_DIR "${qpOASES_LIBRARY_DIR}" CACHE STRING "Library path for qpOASES and its dependencies") + +-find_library(qpOASES_LIBRARY NAMES qpOASES +- PATHS ${qpOASES_LIBRARY_DIR} NO_DEFAULT_PATH) +- +- ++# ------------------------------------------------------------ ++# Standard find_package result handling ++# ------------------------------------------------------------ + include(FindPackageHandleStandardArgs) +-find_package_handle_standard_args(qpOASES DEFAULT_MSG qpOASES_INCLUDE_DIR qpOASES_LIBRARY_DIR qpOASES_LIBRARY qpOASES_VERSION) +\ No newline at end of file ++ ++find_package_handle_standard_args(qpOASES REQUIRED_VARS qpOASES_LIBRARY qpOASES_INCLUDE_DIR VERSION_VAR qpOASES_VERSION) +\ No newline at end of file +Index: CMakeLists.txt +IDEA additional info: +Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +<+>GBK +=================================================================== +diff --git a/CMakeLists.txt b/CMakeLists.txt +--- a/CMakeLists.txt (revision 35b762ba3fee2e009d9e99650c68514da05585c5) ++++ b/CMakeLists.txt (date 1766735663415) +@@ -125,7 +125,17 @@ + + # library + ADD_LIBRARY(qpOASES ${SRC}) ++ ++add_library(qpOASES::qpOASES ALIAS qpOASES) ++ ++target_include_directories(qpOASES ++ PUBLIC ++ $ ++ $ ++) ++ + INSTALL(TARGETS qpOASES ++ EXPORT qpOASESTargets + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} +@@ -164,6 +174,11 @@ + VERSION ${PACKAGE_VERSION} + COMPATIBILITY SameMajorVersion) + ++install(EXPORT qpOASESTargets ++ NAMESPACE qpOASES:: ++ DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/qpOASES ++) ++ + install(FILES ${CMAKE_CURRENT_BINARY_DIR}/qpOASESConfig.cmake + ${CMAKE_CURRENT_BINARY_DIR}/qpOASESConfigVersion.cmake + DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/qpOASES diff --git a/ports/qpoases/portfile.cmake b/ports/qpoases/portfile.cmake new file mode 100644 index 0000000000..8445e4b290 --- /dev/null +++ b/ports/qpoases/portfile.cmake @@ -0,0 +1,25 @@ +vcpkg_check_linkage(ONLY_STATIC_LIBRARY) + +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO coin-or/qpOASES + REF 35b762ba3fee2e009d9e99650c68514da05585c5 + SHA512 691b91113cc8c0ab05f3143749c225a44bcb16a2dc6e60ecd3a4d00f44b8284a3d57dad83e4ef53d56b033e9ce9346735496263fb9f8def6f62ccd429f154a0d + HEAD_REF master + PATCHES + export_target.diff +) + +vcpkg_cmake_configure( + SOURCE_PATH "${SOURCE_PATH}" + OPTIONS + -DQPOASES_BUILD_EXAMPLES=OFF +) + +vcpkg_cmake_install() +vcpkg_cmake_config_fixup(CONFIG_PATH lib/cmake/qpOASES) + +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include") + +vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE") +file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}") diff --git a/ports/qpoases/usage b/ports/qpoases/usage new file mode 100644 index 0000000000..2bc1e26242 --- /dev/null +++ b/ports/qpoases/usage @@ -0,0 +1,10 @@ +The package quarter provides CMake targets: + + find_package(qpOASES CONFIG REQUIRED) + + target_link_libraries(your_target PRIVATE qpOASES::qpOASES) + + For backward compatibility, the following variables are also provided: + + target_include_directories(your_target PRIVATE ${qpOASES_INCLUDE_DIR}) + target_link_libraries(your_target PRIVATE ${qpOASES_LIBRARY}) diff --git a/ports/qpoases/vcpkg.json b/ports/qpoases/vcpkg.json new file mode 100644 index 0000000000..1cfefc9892 --- /dev/null +++ b/ports/qpoases/vcpkg.json @@ -0,0 +1,17 @@ +{ + "name": "qpoases", + "version": "3.2.2", + "description": "Open-source C++ implementation of the online active set strategy for quadratic programming", + "homepage": "https://github.com/coin-or/qpOASES", + "license": "LGPL-2.1-only", + "dependencies": [ + { + "name": "vcpkg-cmake", + "host": true + }, + { + "name": "vcpkg-cmake-config", + "host": true + } + ] +} diff --git a/versions/baseline.json b/versions/baseline.json index 907f7e4da5..09736ef9a2 100644 --- a/versions/baseline.json +++ b/versions/baseline.json @@ -7928,6 +7928,10 @@ "baseline": "0.40.0", "port-version": 0 }, + "qpoases": { + "baseline": "3.2.2", + "port-version": 0 + }, "qscintilla": { "baseline": "2.14.1", "port-version": 1 diff --git a/versions/q-/qpoases.json b/versions/q-/qpoases.json new file mode 100644 index 0000000000..7812a4a3be --- /dev/null +++ b/versions/q-/qpoases.json @@ -0,0 +1,9 @@ +{ + "versions": [ + { + "git-tree": "0d697d0ba4fabd912f943b4f22fd41416b247ca2", + "version": "3.2.2", + "port-version": 0 + } + ] +}