Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create -devel and -static variants #103

Merged
merged 5 commits into from
May 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions recipe/SUPERLU_MT_LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
Copyright (c) 2003, The Regents of the University of California, through
Lawrence Berkeley National Laboratory (subject to receipt of any required
approvals from U.S. Dept. of Energy)

All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

(1) Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
(2) Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
(3) Neither the name of Lawrence Berkeley National Laboratory, U.S. Dept. of
Energy nor the names of its contributors may be used to endorse or promote
products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
37 changes: 37 additions & 0 deletions recipe/bld-sundials.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
@echo ON

cmake -LAH -G "Ninja" -B superlu_mt/build -S superlu_mt -DCMAKE_INSTALL_PREFIX=%LIBRARY_PREFIX% -DPLAT="_OPENMP" -DBUILD_SHARED_LIBS=OFF
if errorlevel 1 exit 1
cmake --build superlu_mt/build --target install --config Release
if errorlevel 1 exit 1

set SUNDIALS_BUILD_SHARED=ON
if /I "%PKG_NAME%" == "sundials-static" (
set SUNDIALS_BUILD_SHARED=OFF
)

set SUNDIALS_BUILD_STATIC=ON
if /I "%PKG_NAME%" == "sundials" (
set SUNDIALS_BUILD_STATIC=OFF
)

cmake -LAH -G "Ninja" -B sundials/build -S sundials ^
-DCMAKE_INSTALL_PREFIX=%LIBRARY_PREFIX% ^
-DCMAKE_BUILD_TYPE=Release ^
-DBUILD_SHARED_LIBS=%SUNDIALS_BUILD_SHARED% ^
-DBUILD_STATIC_LIBS=%SUNDIALS_BUILD_STATIC% ^
-DEXAMPLES_ENABLE_C=ON ^
-DEXAMPLES_INSTALL=OFF ^
-DENABLE_OPENMP=OFF ^
-DENABLE_LAPACK=OFF ^
-DENABLE_SUPERLUMT=ON ^
-DCMAKE_C_FLAGS="/DWIN32 /D_WINDOWS /W3 /D__OPENMP" ^
-DSUPERLUMT_THREAD_TYPE=OPENMP ^
-DSUPERLUMT_LIBRARY="superlu_mt_OPENMP.lib" ^
-DSUPERLUMT_LIBRARIES="%LIBRARY_PREFIX:\=/%/lib/superlu_mt_OPENMP.lib;blas" ^
-DSUPERLUMT_INCLUDE_DIR="%LIBRARY_PREFIX:\=/%/include/superlu_mt" ^
-DSUNDIALS_INDEX_SIZE=32
if errorlevel 1 exit 1

cmake --build sundials/build --target install --config Release
if errorlevel 1 exit 1
26 changes: 0 additions & 26 deletions recipe/bld.bat

This file was deleted.

50 changes: 50 additions & 0 deletions recipe/build-sundials.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
#!/bin/sh
set -euxo pipefail

cmake ${CMAKE_ARGS} -LAH -G "Ninja" -B superlu_mt/build -S superlu_mt -DCMAKE_PREFIX_PATH=${PREFIX} -DPLAT="_OPENMP" -DBUILD_SHARED_LIBS=OFF
cmake --build superlu_mt/build --target install --parallel ${CPU_COUNT}

if [ $(uname -s) == 'Darwin' ]; then
WITH_OPENMP=0 # CMake script fails to setup OpenMP_C_FLAGS anyway
else
WITH_OPENMP=1
fi

if [[ $PKG_NAME == "sundials-devel" || $PKG_NAME == "sundials" ]]; then
SUNDIALS_BUILD_SHARED=ON
else
SUNDIALS_BUILD_SHARED=OFF
fi

if [[ $PKG_NAME == "sundials-devel" || $PKG_NAME == "sundials-static" ]]; then
SUNDIALS_BUILD_STATIC=ON
else
SUNDIALS_BUILD_STATIC=OFF
fi

cmake ${CMAKE_ARGS} -LAH -G "Ninja" -B sundials/build -S sundials \
-DCMAKE_PREFIX_PATH=$PREFIX \
-DCMAKE_INSTALL_PREFIX=$PREFIX \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_LIBDIR=lib \
-DBUILD_SHARED_LIBS=$SUNDIALS_BUILD_SHARED \
-DBUILD_STATIC_LIBS=$SUNDIALS_BUILD_STATIC \
-DCMAKE_C_STANDARD=11 \
-DEXAMPLES_ENABLE_C=ON \
-DEXAMPLES_INSTALL=OFF \
-DENABLE_OPENMP=$WITH_OPENMP \
-DENABLE_LAPACK=ON \
-DLAPACK_LIBRARIES="lapack;blas" \
-DCMAKE_INSTALL_RPATH="${PREFIX}/lib" \
-DCMAKE_BUILD_WITH_INSTALL_RPATH=ON \
-DCMAKE_MACOSX_RPATH=ON \
-DENABLE_KLU=ON \
-DKLU_LIBRARY_DIR=${PREFIX}/lib \
-DENABLE_SUPERLUMT=ON \
-DSUPERLUMT_THREAD_TYPE=OPENMP \
-DSUPERLUMT_INCLUDE_DIR="${PREFIX}/include/superlu_mt" \
-DSUPERLUMT_LIBRARY=libsuperlu_mt_OPENMP.a \
-DSUPERLUMT_LIBRARIES="${PREFIX}/lib/libsuperlu_mt_OPENMP.a;blas" \
-DSUNDIALS_INDEX_SIZE=32 # int32_t needed for Lapack not to be disabled

cmake --build sundials/build --target install --parallel ${CPU_COUNT}
43 changes: 0 additions & 43 deletions recipe/build.sh

This file was deleted.

26 changes: 26 additions & 0 deletions recipe/fix-win-static-and-shared.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
diff --git a/cmake/macros/SundialsAddLibrary.cmake b/cmake/macros/SundialsAddLibrary.cmake
index ca0d22619..6a029978c 100644
--- a/cmake/macros/SundialsAddLibrary.cmake
+++ b/cmake/macros/SundialsAddLibrary.cmake
@@ -325,10 +325,17 @@ macro(sundials_add_library target)

# set the correct output name
if(sundials_add_library_OUTPUT_NAME)
- set_target_properties(${_actual_target_name} PROPERTIES
- OUTPUT_NAME ${sundials_add_library_OUTPUT_NAME}
- CLEAN_DIRECT_OUTPUT 1
- )
+ if(WIN32 AND ${_libtype} MATCHES "STATIC")
+ set_target_properties(${_actual_target_name} PROPERTIES
+ OUTPUT_NAME "${sundials_add_library_OUTPUT_NAME}_static"
+ CLEAN_DIRECT_OUTPUT 1
+ )
+ else()
+ set_target_properties(${_actual_target_name} PROPERTIES
+ OUTPUT_NAME ${sundials_add_library_OUTPUT_NAME}
+ CLEAN_DIRECT_OUTPUT 1
+ )
+ endif()
else()
set_target_properties(${_actual_target_name} PROPERTIES
OUTPUT_NAME ${target}
122 changes: 97 additions & 25 deletions recipe/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,40 +2,112 @@
{% set version = "7.0.0" %}

package:
name: {{ name }}
name: {{ name }}-split
version: {{ version }}

source:
url: https://github.com/LLNL/{{ name }}/archive/v{{ version }}.tar.gz
sha256: 63d1f76207161612f36f5017d8333e00e5297b0cd8cbc4628f5dd54102c763a6
- url: https://github.com/LLNL/{{ name }}/archive/v{{ version }}.tar.gz
sha256: 63d1f76207161612f36f5017d8333e00e5297b0cd8cbc4628f5dd54102c763a6
folder: sundials
patches:
- fix-win-static-and-shared.patch # [win]
- url: https://github.com/xiaoyeli/superlu_mt/archive/3d805210e95bb5b86b9ec3ade0e200714b6964dc.zip
folder: superlu_mt
sha256: 6b2a914209c1e007ccbfb0aa864b9782377ef45262376b611a193963e43c1972

build:
number: 0
run_exports:
- {{ pin_subpackage('sundials', max_pin='x.x') }}

requirements:
build:
- cmake
- ninja
- {{ compiler('c') }}
- {{ compiler('cxx') }}
- {{ compiler('fortran') }} # [unix]
host:
- libblas
- liblapack # [not win]
- suitesparse # [not win]
run:
- suitesparse # [not win]

test:
commands:
- test -f ${PREFIX}/include/sundials/sundials_band.h # [unix]
number: 1

outputs:
- name: {{ name }}
script: build-sundials.sh # [unix]
script: bld-sundials.bat # [win]
run_exports:
- {{ pin_subpackage('sundials', max_pin='x.x') }}
requirements:
build:
- cmake
- ninja
- {{ compiler('c') }}
- {{ compiler('cxx') }}
- {{ compiler('fortran') }} # [unix]
host:
- libblas
- liblapack # [not win]
- suitesparse # [not win]
run:
- suitesparse # [not win]
test:
commands:
- test -f ${PREFIX}/include/sundials/sundials_band.h # [unix]
adriendelsalle marked this conversation as resolved.
Show resolved Hide resolved
- test -e ${PREFIX}/lib/libsundials_core${SHLIB_EXT} # [unix]
- test -e ${PREFIX}/lib/libsundials_core${SHLIB_EXT} # [unix]
- test ! -e ${PREFIX}/lib/libsundials_core.a # [unix]
- if not exist %LIBRARY_PREFIX%\include\sundials\sundials_band.h (exit 1) # [win]
- if not exist %LIBRARY_PREFIX%\lib\sundials_core.dll (exit 1) # [win]
- if not exist %LIBRARY_PREFIX%\lib\sundials_core.lib (exit 1) # [win]
- if exist %LIBRARY_PREFIX%\lib\sundials_core_static.lib (exit 1) # [win]

- name: {{ name }}-static
script: build-sundials.sh # [unix]
script: bld-sundials.bat # [win]
requirements:
build:
- cmake
- ninja
- {{ compiler('c') }}
- {{ compiler('cxx') }}
- {{ compiler('fortran') }} # [unix]
host:
- libblas
- liblapack # [not win]
- suitesparse # [not win]
run:
- suitesparse # [not win]
test:
commands:
- test -f ${PREFIX}/include/sundials/sundials_band.h # [unix]
- test ! -e ${PREFIX}/lib/libsundials_core${SHLIB_EXT} # [unix]
- test ! -e ${PREFIX}/lib/libsundials_core${SHLIB_EXT} # [unix]
- test -e ${PREFIX}/lib/libsundials_core.a # [unix]
- if not exist %LIBRARY_PREFIX%\include\sundials\sundials_band.h (exit 1) # [win]
- if exist %LIBRARY_PREFIX%\lib\sundials_core.dll (exit 1) # [win]
- if exist %LIBRARY_PREFIX%\lib\sundials_core.lib (exit 1) # [win]
- if not exist %LIBRARY_PREFIX%\lib\sundials_core_static.lib (exit 1) # [win]

- name: {{ name }}-devel
script: build-sundials.sh # [unix]
script: bld-sundials.bat # [win]
requirements:
build:
- cmake
- ninja
- {{ compiler('c') }}
- {{ compiler('cxx') }}
- {{ compiler('fortran') }} # [unix]
host:
- libblas
- liblapack # [not win]
- suitesparse # [not win]
run:
- suitesparse # [not win]
test:
commands:
- test -f ${PREFIX}/include/sundials/sundials_band.h # [unix]
- test -e ${PREFIX}/lib/libsundials_core${SHLIB_EXT} # [unix]
- test -e ${PREFIX}/lib/libsundials_core${SHLIB_EXT} # [unix]
- test -e ${PREFIX}/lib/libsundials_core.a # [unix]
- if not exist %LIBRARY_PREFIX%\include\sundials\sundials_band.h (exit 1) # [win]
- if not exist %LIBRARY_PREFIX%\lib\sundials_core.dll (exit 1) # [win]
- if not exist %LIBRARY_PREFIX%\lib\sundials_core.lib (exit 1) # [win]
- if not exist %LIBRARY_PREFIX%\lib\sundials_core_static.lib (exit 1) # [win]

about:
home: https://computing.llnl.gov/projects/sundials
license: BSD-3-Clause
license_file: LICENSE
license_file:
- sundials/LICENSE
- superlu_mt/License.txt
summary: SUite of Nonlinear and DIfferential/ALgebraic equation Solvers

extra:
Expand Down
13 changes: 0 additions & 13 deletions recipe/superlumt.patch

This file was deleted.