diff --git a/recipes/libqdldl/bld.bat b/recipes/libqdldl/bld.bat new file mode 100644 index 0000000000000..cc1ac87911c8a --- /dev/null +++ b/recipes/libqdldl/bld.bat @@ -0,0 +1,25 @@ +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_SHARED_LIBS=ON ^ + -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 diff --git a/recipes/libqdldl/build.sh b/recipes/libqdldl/build.sh new file mode 100644 index 0000000000000..4c1796834907c --- /dev/null +++ b/recipes/libqdldl/build.sh @@ -0,0 +1,18 @@ +#!/bin/sh + +mkdir build +cd build + +cmake ${CMAKE_ARGS} \ + -DCMAKE_BUILD_TYPE=Release \ + -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 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) + diff --git a/recipes/libqdldl/meta.yaml b/recipes/libqdldl/meta.yaml new file mode 100644 index 0000000000000..2ae03134973b1 --- /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: 2868b0e61b7424174e9adef3cb87478329f8ab2075211ef28fe477f29e0e5c99 + 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/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\\qdldl-config.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