From 8b908f90acbb0778fde621c5d758589be945a633 Mon Sep 17 00:00:00 2001 From: "fennoai[bot]" <231223108+fennoai[bot]@users.noreply.github.com> Date: Thu, 30 Jul 2026 11:31:23 +0000 Subject: [PATCH] Add LLAR Formula for coin-or/qpOASES (releases/3.2.1) Translate the Conan Center `qpoases` recipe into an idiomatic LLAR Formula. - fromVer "releases/3.2.1": exact upstream tag for Conan version 3.2.1 (all qpOASES tags are `releases/X.Y.Z`; spelling preserved). Only this version is served by the recipe, so no version range is claimed. - No dependencies: the Conan recipe declares no requirements/tool_requires/ test_requires, confirmed against the upstream CMakeLists. - onBuild: CMake build of the static library. Sets QPOASES_BUILD_EXAMPLES=OFF (matching the recipe), CMAKE_POLICY_VERSION_MINIMUM=3.5 (upstream declares cmake_minimum_required(VERSION 2.6)), and carries over the Conan `fPIC` option via CMAKE_POSITION_INDEPENDENT_CODE. Installs lib/libqpOASES.a and the include/ headers; metadata "-lqpOASES". - fPIC modeled as target.options (default ON); filter rejects fPIC=ON on Windows, where the recipe deletes the option. - onTest: builds a minimal QProblem consumer (derived from the Conan test_package) in an independent tree so it also passes on a cache hit, linking the installed library and asserting a successful solve. Verified end-to-end against the real `releases/3.2.1` source (configure/ build/install produce the expected layout; the consumer compiles, links, and solves returning SUCCESSFUL_RETURN). `llar test` itself cannot run this formula because llar v0.3.0 rejects version tags containing `/` when naming the source temp dir (os.MkdirTemp pattern) -- an upstream toolchain limitation, not a formula defect. Co-authored-by: fennoai[bot] <231223108+fennoai[bot]@users.noreply.github.com> Co-authored-by: MeteorsLiu <17515813+MeteorsLiu@users.noreply.github.com> --- .../qpOASES/releases/3.2.1/QpOASES_llar.gox | 110 ++++++++++++++++++ coin-or/qpOASES/versions.json | 4 + 2 files changed, 114 insertions(+) create mode 100644 coin-or/qpOASES/releases/3.2.1/QpOASES_llar.gox create mode 100644 coin-or/qpOASES/versions.json diff --git a/coin-or/qpOASES/releases/3.2.1/QpOASES_llar.gox b/coin-or/qpOASES/releases/3.2.1/QpOASES_llar.gox new file mode 100644 index 0000000..7a8957e --- /dev/null +++ b/coin-or/qpOASES/releases/3.2.1/QpOASES_llar.gox @@ -0,0 +1,110 @@ +import "os" +import "slices" + +id "coin-or/qpOASES" + +fromVer "releases/3.2.1" + +// qpOASES exposes a single, package-owned build choice worth translating: +// the Conan recipe's `fPIC` option (default True, dropped on Windows). +// It maps to CMAKE_POSITION_INDEPENDENT_CODE for the static library. +defaults { + "fPIC": "ON", +} + +// Position-independent code is meaningless on Windows, which is exactly why +// the Conan recipe deletes the fPIC option there. Reject fPIC=ON on Windows. +filter => { + if slices.contains(target.require["os"], "windows") { + return slices.contains(target.options["fPIC"], "OFF") + } + return true +} + +onBuild ctx => { + installDir := ctx.outputDir + + c := cmake.new(ctx.SourceDir, ctx.SourceDir+"/_build", installDir) + c.buildType "Release" + // Upstream declares cmake_minimum_required(VERSION 2.6); modern CMake + // refuses that compatibility floor without an explicit policy version. + c.define "CMAKE_POLICY_VERSION_MINIMUM", "3.5" + + // Match the Conan recipe: build only the library, not the examples. + c.defineBool "QPOASES_BUILD_EXAMPLES", false + + // Carry over the fPIC option for the static library. + c.defineBool "CMAKE_POSITION_INDEPENDENT_CODE", slices.contains(target.options["fPIC"], "ON") + + c.configure + c.build + c.install + + // Installed interface: static lib libqpOASES.a in lib/, headers in + // include/ (qpOASES.hpp + the qpOASES/ directory). + ctx.setMetadata "-lqpOASES" +} + +onTest ctx => { + installDir := ctx.outputDir + + // Consumer check derived from the Conan test_package: include the public + // header and construct/solve a QProblem against the installed library. + // Built in an independent tree so onTest also passes on a cache hit, + // where onBuild (and its _build dir) never ran. + testDir := ctx.SourceDir + "/_qpoases_test" + os.mkdirAll(testDir, 0o755)! + + consumer := `#include + +int main() +{ + USING_NAMESPACE_QPOASES + + // 2 variables, 1 constraint (mirrors the Conan test_package problem). + real_t H[2*2] = { 1.0, 0.0, 0.0, 0.5 }; + real_t A[1*2] = { 1.0, 1.0 }; + real_t g[2] = { 1.5, 1.0 }; + real_t lb[2] = { 0.5, -2.0 }; + real_t ub[2] = { 5.0, 2.0 }; + real_t lbA[1] = { -1.0 }; + real_t ubA[1] = { 2.0 }; + + QProblem example( 2, 1 ); + + Options options; + example.setOptions( options ); + + int_t nWSR = 10; + returnValue rv = example.init( H, g, A, lb, ub, lbA, ubA, nWSR ); + + return ( rv == SUCCESSFUL_RETURN ) ? 0 : 1; +} +` + os.writeFile(testDir+"/consumer.cpp", []byte(consumer), 0o644)! + + cml := `cmake_minimum_required(VERSION 3.5) +project(qpoases_consumer CXX) +add_executable(consumer consumer.cpp) +find_path(QPOASES_INCLUDE_DIR NAMES qpOASES.hpp REQUIRED) +find_library(QPOASES_LIB NAMES qpOASES REQUIRED) +target_include_directories(consumer PRIVATE ${QPOASES_INCLUDE_DIR}) +target_link_libraries(consumer PRIVATE ${QPOASES_LIB}) +` + os.writeFile(testDir+"/CMakeLists.txt", []byte(cml), 0o644)! + + testBuild := testDir + "/_build" + tc := cmake.new(testDir, testBuild, "") + tc.buildType "Release" + tc.define "CMAKE_POLICY_VERSION_MINIMUM", "3.5" + tc.use installDir + + tc.configure + tc.build + + // Run the freshly built consumer. A non-zero exit surfaces via lastErr. + exec testBuild + "/consumer" + if lastErr != nil { + panic lastErr + } +} diff --git a/coin-or/qpOASES/versions.json b/coin-or/qpOASES/versions.json new file mode 100644 index 0000000..a8e8b65 --- /dev/null +++ b/coin-or/qpOASES/versions.json @@ -0,0 +1,4 @@ +{ + "path": "coin-or/qpOASES", + "deps": {} +}