From 3b65d2c32c406ba1f77e85990a547d367ac3b569 Mon Sep 17 00:00:00 2001 From: Silvio Traversaro Date: Wed, 2 Jun 2021 23:21:30 +0200 Subject: [PATCH 1/9] Create meta.yaml --- recipes/libqdldl/meta.yaml | 46 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 recipes/libqdldl/meta.yaml diff --git a/recipes/libqdldl/meta.yaml b/recipes/libqdldl/meta.yaml new file mode 100644 index 0000000000000..6294f224ea9d3 --- /dev/null +++ b/recipes/libqdldl/meta.yaml @@ -0,0 +1,46 @@ +{% set name = "libqdldl" %} +{% set version = "0.1.5" %} + +package: + name: {{ name }} + version: {{ version }} + +source: + - url: https://github.com/osqp/qdldl/archive/v{{ version }}.tar.gz + sha256: 9b5bfd811ee523be601f11abc514a93c67fe5c6e957cd6c36fe6ea4f28e009bb + patches: + - fix_build_shared_libs_and_windows_shared.patch + +build: + number: 0 + run_exports: + - {{ pin_subpackage(name, max_pin='x.x.x') }} + +requirements: + build: + - {{ compiler('c') }} + - {{ compiler('cxx') }} + - make # [not win] + - cmake + +test: + commands: + - test -f ${PREFIX}/include/qdldl/qdldl.h # [not win] + - test -f ${PREFIX}/lib/libqdldl.so # [linux] + - test -f ${PREFIX}/lib/libqdldl.dylib # [osx] + - test -f ${PREFIX}/lib/cmake/qdldl/qdldlConfig.cmake # [not win] + - if not exist %PREFIX%\\Library\\include\\qdldl\\qdldl.h exit 1 # [win] + - if not exist $PREFIX$\\Library\\lib\\qdldl.lib exit 1 # [win] + - if not exist $PREFIX$\\Library\\bin\\qdldl.dll exit 1 # [win] + - if not exist %PREFIX%\\Library\\lib\\cmake\\qdldl\\qdldlConfig.cmake exit 1 # [win] + +about: + home: https://github.com/osqp/qdldl + license: Apache-2.0 + license_file: LICENSE + summary: A free LDL factorisation routine. + +extra: + recipe-maintainers: + - traversaro + - h-vetinari From 69d0b9ef6e27fd7f0cee1c126fa5393882114e41 Mon Sep 17 00:00:00 2001 From: Silvio Traversaro Date: Wed, 2 Jun 2021 23:23:28 +0200 Subject: [PATCH 2/9] Create fix_build_shared_libs_and_windows_shared.patch --- ...build_shared_libs_and_windows_shared.patch | 73 +++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100644 recipes/libqdldl/fix_build_shared_libs_and_windows_shared.patch diff --git a/recipes/libqdldl/fix_build_shared_libs_and_windows_shared.patch b/recipes/libqdldl/fix_build_shared_libs_and_windows_shared.patch new file mode 100644 index 0000000000000..e82cfd7971a1e --- /dev/null +++ b/recipes/libqdldl/fix_build_shared_libs_and_windows_shared.patch @@ -0,0 +1,73 @@ +From e093889e54bfba4676fe95ce0bbb3eb578ae74b3 Mon Sep 17 00:00:00 2001 +From: Silvio Traversaro +Date: Wed, 2 Jun 2021 23:12:42 +0200 +Subject: [PATCH] Respect BUILD_SHARED_LIBS and fix shared library on Windows + +--- + CMakeLists.txt | 33 ++++++++++----------------------- + 1 file changed, 10 insertions(+), 23 deletions(-) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 06c3d9c..e17300a 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -101,26 +101,6 @@ target_include_directories(qdldlobject PRIVATE ${PROJECT_SOURCE_DIR}/include) + + include(GNUInstallDirs) + +-# Static library +-add_library (qdldlstatic STATIC ${qdldl_src} ${qdldl_headers}) +-# Give same name to static library output +-set_target_properties(qdldlstatic PROPERTIES OUTPUT_NAME qdldl) +- +-# Declare include directories for the cmake exported target +-target_include_directories(qdldlstatic +- PUBLIC "$" +- "$/${CMAKE_INSTALL_INCLUDEDIR}/qdldl>") +- +-# Install Static Library +-# ---------------------------------------------- +- +-install(TARGETS qdldlstatic +- EXPORT ${PROJECT_NAME} +- ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" +- LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" +- RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}") +- +- + # Install Headers + # ---------------------------------------------- + install(FILES ${qdldl_headers} DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/qdldl") +@@ -128,21 +108,28 @@ install(FILES ${qdldl_headers} DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/qdldl") + + # Install Shared Library + # ---------------------------------------------- +-# Create qdldl shared library +-add_library (qdldl SHARED ${qdldl_src} ${qdldl_headers}) ++# Create qdldl shared or static library, depending on BUILD_SHARED_LIBS ++add_library (qdldl ${qdldl_src} ${qdldl_headers}) ++ ++if(BUILD_SHARED_LIBS) ++ set_target_properties(qdldl PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS TRUE) ++endif() + + # Declare include directories for the cmake exported target + target_include_directories(qdldl + PUBLIC "$" + "$/${CMAKE_INSTALL_INCLUDEDIR}/qdldl>") + +-# Install qdldl shared library ++# Install qdldl library + install(TARGETS qdldl + EXPORT ${PROJECT_NAME} + LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" + ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" + RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}") + ++# Add qdldlstatic alias ++add_library(qdldlstatic ALIAS qdldl) ++ + # Create demo executable (linked to static library) + add_executable (qdldl_example ${PROJECT_SOURCE_DIR}/examples/example.c) + target_link_libraries (qdldl_example qdldlstatic) + From 5bdf5c9a2e73b03675b4f93ea075e7f000c59ae7 Mon Sep 17 00:00:00 2001 From: Silvio Traversaro Date: Wed, 2 Jun 2021 23:24:42 +0200 Subject: [PATCH 3/9] Create bld.bat --- recipes/libqdldl/bld.bat | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 recipes/libqdldl/bld.bat diff --git a/recipes/libqdldl/bld.bat b/recipes/libqdldl/bld.bat new file mode 100644 index 0000000000000..313cd0b223a4d --- /dev/null +++ b/recipes/libqdldl/bld.bat @@ -0,0 +1,24 @@ +mkdir build +cd build + +cmake ^ + -G "NMake Makefiles" ^ + -DCMAKE_INSTALL_PREFIX=%LIBRARY_PREFIX% ^ + -DCMAKE_BUILD_TYPE=Release ^ + -DCMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_SKIP=True ^ + -DBUILD_TESTING=ON ^ + -DUNITTESTS=OFF ^ + %SRC_DIR% +if errorlevel 1 exit 1 + +:: Build. +cmake --build . --config Release +if errorlevel 1 exit 1 + +:: Install. +cmake --build . --config Release --target install +if errorlevel 1 exit 1 + +:: Test +ctest --output-on-failure -C Release +if errorlevel 1 exit 1 From 6367a94b6d7de744a8e56d7d8b8040f8136e7853 Mon Sep 17 00:00:00 2001 From: Silvio Traversaro Date: Wed, 2 Jun 2021 23:25:25 +0200 Subject: [PATCH 4/9] Create build.sh --- recipes/libqdldl/build.sh | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 recipes/libqdldl/build.sh diff --git a/recipes/libqdldl/build.sh b/recipes/libqdldl/build.sh new file mode 100644 index 0000000000000..8f0da6e626da2 --- /dev/null +++ b/recipes/libqdldl/build.sh @@ -0,0 +1,21 @@ +#!/bin/sh + +mkdir build +cd build + +cmake ${CMAKE_ARGS} \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_PREFIX_PATH=$PREFIX \ + -DCMAKE_INSTALL_PREFIX=$PREFIX \ + -DCMAKE_INSTALL_LIBDIR=lib \ + -DCMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_SKIP=True \ + -DBUILD_SHARED_LIBS=ON \ + -DBUILD_TESTING=ON \ + -DUNITTESTS=ON \ + .. + +cmake --build . --config Release --parallel ${CPU_COUNT} +cmake --build . --config Release --parallel ${CPU_COUNT} --target install +if [[ "${CONDA_BUILD_CROSS_COMPILATION}" != "1" ]]; then +ctest --output-on-failure -C Release +fi From 5f74f992b683b0ed1e47c24459a7d903b44f9030 Mon Sep 17 00:00:00 2001 From: Silvio Traversaro Date: Wed, 2 Jun 2021 23:32:03 +0200 Subject: [PATCH 5/9] Update meta.yaml --- recipes/libqdldl/meta.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/libqdldl/meta.yaml b/recipes/libqdldl/meta.yaml index 6294f224ea9d3..888f552a0b461 100644 --- a/recipes/libqdldl/meta.yaml +++ b/recipes/libqdldl/meta.yaml @@ -7,7 +7,7 @@ package: source: - url: https://github.com/osqp/qdldl/archive/v{{ version }}.tar.gz - sha256: 9b5bfd811ee523be601f11abc514a93c67fe5c6e957cd6c36fe6ea4f28e009bb + sha256: 2868b0e61b7424174e9adef3cb87478329f8ab2075211ef28fe477f29e0e5c99 patches: - fix_build_shared_libs_and_windows_shared.patch From 1a96127bb7122e42d6f7e5e1e5c044248c331b8f Mon Sep 17 00:00:00 2001 From: Silvio Traversaro Date: Wed, 2 Jun 2021 23:40:24 +0200 Subject: [PATCH 6/9] Update meta.yaml --- recipes/libqdldl/meta.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/recipes/libqdldl/meta.yaml b/recipes/libqdldl/meta.yaml index 888f552a0b461..3ff7d255ff1b6 100644 --- a/recipes/libqdldl/meta.yaml +++ b/recipes/libqdldl/meta.yaml @@ -28,11 +28,11 @@ test: - test -f ${PREFIX}/include/qdldl/qdldl.h # [not win] - test -f ${PREFIX}/lib/libqdldl.so # [linux] - test -f ${PREFIX}/lib/libqdldl.dylib # [osx] - - test -f ${PREFIX}/lib/cmake/qdldl/qdldlConfig.cmake # [not win] + - test -f ${PREFIX}/lib/cmake/qdldl/qdldl-config.cmake # [not win] - if not exist %PREFIX%\\Library\\include\\qdldl\\qdldl.h exit 1 # [win] - if not exist $PREFIX$\\Library\\lib\\qdldl.lib exit 1 # [win] - if not exist $PREFIX$\\Library\\bin\\qdldl.dll exit 1 # [win] - - if not exist %PREFIX%\\Library\\lib\\cmake\\qdldl\\qdldlConfig.cmake exit 1 # [win] + - if not exist %PREFIX%\\Library\\lib\\cmake\\qdldl\\qdldl-config.cmake exit 1 # [win] about: home: https://github.com/osqp/qdldl From 3569e397258a4b76022b1ca2dbd45eda2f7a93b6 Mon Sep 17 00:00:00 2001 From: Silvio Traversaro Date: Wed, 2 Jun 2021 23:51:58 +0200 Subject: [PATCH 7/9] Update bld.bat --- recipes/libqdldl/bld.bat | 1 + 1 file changed, 1 insertion(+) diff --git a/recipes/libqdldl/bld.bat b/recipes/libqdldl/bld.bat index 313cd0b223a4d..cc1ac87911c8a 100644 --- a/recipes/libqdldl/bld.bat +++ b/recipes/libqdldl/bld.bat @@ -6,6 +6,7 @@ cmake ^ -DCMAKE_INSTALL_PREFIX=%LIBRARY_PREFIX% ^ -DCMAKE_BUILD_TYPE=Release ^ -DCMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_SKIP=True ^ + -DBUILD_SHARED_LIBS=ON ^ -DBUILD_TESTING=ON ^ -DUNITTESTS=OFF ^ %SRC_DIR% From feb8da1d9a8d0be4c03ec92680a7a5138ae90c6e Mon Sep 17 00:00:00 2001 From: Silvio Traversaro Date: Sun, 6 Jun 2021 19:35:46 +0200 Subject: [PATCH 8/9] Update meta.yaml --- recipes/libqdldl/meta.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/recipes/libqdldl/meta.yaml b/recipes/libqdldl/meta.yaml index 3ff7d255ff1b6..2ae03134973b1 100644 --- a/recipes/libqdldl/meta.yaml +++ b/recipes/libqdldl/meta.yaml @@ -30,8 +30,8 @@ test: - test -f ${PREFIX}/lib/libqdldl.dylib # [osx] - test -f ${PREFIX}/lib/cmake/qdldl/qdldl-config.cmake # [not win] - if not exist %PREFIX%\\Library\\include\\qdldl\\qdldl.h exit 1 # [win] - - if not exist $PREFIX$\\Library\\lib\\qdldl.lib exit 1 # [win] - - if not exist $PREFIX$\\Library\\bin\\qdldl.dll exit 1 # [win] + - if not exist %PREFIX%\\Library\\lib\\qdldl.lib exit 1 # [win] + - if not exist %PREFIX%\\Library\\bin\\qdldl.dll exit 1 # [win] - if not exist %PREFIX%\\Library\\lib\\cmake\\qdldl\\qdldl-config.cmake exit 1 # [win] about: From bc99b668f303198d3cd88ff77d2dd14b58a218f2 Mon Sep 17 00:00:00 2001 From: Silvio Traversaro Date: Mon, 7 Jun 2021 08:25:10 +0200 Subject: [PATCH 9/9] Update build.sh --- recipes/libqdldl/build.sh | 3 --- 1 file changed, 3 deletions(-) diff --git a/recipes/libqdldl/build.sh b/recipes/libqdldl/build.sh index 8f0da6e626da2..4c1796834907c 100644 --- a/recipes/libqdldl/build.sh +++ b/recipes/libqdldl/build.sh @@ -5,9 +5,6 @@ cd build cmake ${CMAKE_ARGS} \ -DCMAKE_BUILD_TYPE=Release \ - -DCMAKE_PREFIX_PATH=$PREFIX \ - -DCMAKE_INSTALL_PREFIX=$PREFIX \ - -DCMAKE_INSTALL_LIBDIR=lib \ -DCMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_SKIP=True \ -DBUILD_SHARED_LIBS=ON \ -DBUILD_TESTING=ON \