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 1 commit
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.
32 changes: 32 additions & 0 deletions recipe/bld-sundials.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
@echo ON

if not exist "superlu_mt" (
git clone --depth 1 https://github.com/xiaoyeli/superlu_mt.git
adriendelsalle marked this conversation as resolved.
Show resolved Hide resolved
if errorlevel 1 exit 1
)
cmake -LAH -G "Ninja" -B build_slu -S superlu_mt -DCMAKE_INSTALL_PREFIX=%LIBRARY_PREFIX% -DPLAT="_OPENMP" -DBUILD_SHARED_LIBS=OFF
if errorlevel 1 exit 1
cmake --build build_slu --target install --config Release
if errorlevel 1 exit 1

cmake -LAH -G "Ninja" -B build ^
-DCMAKE_INSTALL_PREFIX=%LIBRARY_PREFIX% ^
-DCMAKE_BUILD_TYPE=Release ^
-DBUILD_SHARED_LIBS=ON ^
-DBUILD_STATIC_LIBS=ON ^
-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 ^
-S .
if errorlevel 1 exit 1

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

This file was deleted.

28 changes: 17 additions & 11 deletions recipe/build.sh → recipe/build-sundials.sh
Original file line number Diff line number Diff line change
@@ -1,25 +1,33 @@
#!/bin/sh
set -euxo pipefail

# local superlu install
git clone --depth 1 https://github.com/xiaoyeli/superlu_mt.git
cmake ${CMAKE_ARGS} -LAH -G "Ninja" -B build_slu -S superlu_mt -DCMAKE_PREFIX_PATH=${PREFIX} -DPLAT="_OPENMP" -DBUILD_SHARED_LIBS=OFF
cmake --build build_slu --parallel ${CPU_COUNT}
# clone superlu once
if [ ! -d "superlu_mt" ]; then
adriendelsalle marked this conversation as resolved.
Show resolved Hide resolved
git clone --depth 1 https://github.com/xiaoyeli/superlu_mt.git
fi

# EXAMPLES_ENABLE=1 enables tests to be run (requires Python)
cmake ${CMAKE_ARGS} -LAH -G "Ninja" -B build_slu -S superlu_mt -DCMAKE_PREFIX_PATH=${PREFIX} -DPLAT="_OPENMP" -DBUILD_SHARED_LIBS=OFF
cmake --build build_slu --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" ]]; then
SUNDIALS_BUILD_STATIC=ON
else
SUNDIALS_BUILD_STATIC=OFF
fi

cmake ${CMAKE_ARGS} -LAH -G "Ninja" -B build \
-DCMAKE_PREFIX_PATH=$PREFIX \
-DCMAKE_INSTALL_PREFIX=$PREFIX \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_LIBDIR=lib \
-DBUILD_SHARED_LIBS=ON \
-DBUILD_STATIC_LIBS=OFF \
-DBUILD_STATIC_LIBS=$SUNDIALS_BUILD_STATIC \
-DCMAKE_C_STANDARD=11 \
-DEXAMPLES_ENABLE_C=ON \
-DEXAMPLES_INSTALL=OFF \
Expand All @@ -33,11 +41,9 @@ cmake ${CMAKE_ARGS} -LAH -G "Ninja" -B build \
-DKLU_LIBRARY_DIR=${PREFIX}/lib \
-DENABLE_SUPERLUMT=ON \
-DSUPERLUMT_THREAD_TYPE=OPENMP \
-DSUPERLUMT_INCLUDE_DIR="$PWD/superlu_mt/SRC" \
-DSUPERLUMT_LIBRARY=$PWD/build_slu/SRC/libsuperlu_mt_OPENMP.a \
-DSUPERLUMT_LIBRARIES="$PWD/build_slu/SRC/libsuperlu_mt_OPENMP.a;blas" \
-DSUNDIALS_F77_FUNC_CASE="LOWER" -DSUNDIALS_F77_FUNC_UNDERSCORES="ONE" \
-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 build --target install --parallel ${CPU_COUNT}
cat ${PREFIX}/include/sundials/sundials_config.h
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}
69 changes: 48 additions & 21 deletions recipe/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,40 +2,67 @@
{% 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
patches:
- fix-win-static-and-shared.patch # [win]

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

requirements:
build:
- cmake
- ninja
- {{ compiler('c') }}
- {{ compiler('cxx') }}
- {{ compiler('fortran') }} # [unix]
host:
- libblas
- liblapack # [not win]
- suitesparse # [not win]
run:
- suitesparse # [not win]
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:
commands:
- test -f ${PREFIX}/include/sundials/sundials_band.h # [unix]
- 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]

about:
home: https://computing.llnl.gov/projects/sundials
license: BSD-3-Clause
license_file: LICENSE
license_file:
- LICENSE
- SUPERLU_MT_LICENSE
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.