diff --git a/recipes/libtdlpack/bld.bat b/recipes/libtdlpack/bld.bat new file mode 100644 index 0000000000000..bb74e8cb5a606 --- /dev/null +++ b/recipes/libtdlpack/bld.bat @@ -0,0 +1,29 @@ + +mkdir build +cd build + +REM Make shared libs +cmake -G"Ninja" ^ + %CMAKE_ARGS% ^ + -DCMAKE_BUILD_TYPE=Release ^ + -DCMAKE_PREFIX_PATH=%LIBRARY_PREFIX% ^ + -DCMAKE_LIBRARY_PATH=%LIBRARY_LIB% ^ + -DCMAKE_INSTALL_PREFIX=%LIBRARY_PREFIX% ^ + -DCMAKE_FIND_FRAMEWORK=NEVER ^ + -DCMAKE_FIND_APPBUNDLE=NEVER ^ + -DBUILD_SHARED_LIBS=ON ^ + -DBUILD_STATIC_LIBS=ON ^ + %SRC_DIR% +if errorlevel 1 exit 1 + +REM Build step +cmake --build . --config Release +if errorlevel 1 exit 1 + +REM Test step +ctest --output-on-failure +if errorlevel 1 exit 1 + +REM Install step +cmake --build . --config Release --target install +if errorlevel 1 exit 1 diff --git a/recipes/libtdlpack/build.sh b/recipes/libtdlpack/build.sh new file mode 100644 index 0000000000000..09774f05a30a8 --- /dev/null +++ b/recipes/libtdlpack/build.sh @@ -0,0 +1,39 @@ +#!/bin/bash + +set -ex # Abort on error. + +declare -a CMAKE_PLATFORM_FLAGS +if [[ ${HOST} =~ .*darwin.* ]]; then + CMAKE_PLATFORM_FLAGS+=(-DCMAKE_OSX_SYSROOT="${CONDA_BUILD_SYSROOT}") +else + CMAKE_PLATFORM_FLAGS+=(-DCMAKE_TOOLCHAIN_FILE="${RECIPE_DIR}/cross-linux.cmake") +fi + +echo "Building using ${PREFIX}" +echo "From ${PWD}" + +mkdir build +cd build + +# Make shared libs +cmake -G "${CMAKE_GENERATOR}" \ + "${CMAKE_ARGS}" \ + "${CMAKE_PLATFORM_FLAGS[@]}" \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_PREFIX_PATH="${PREFIX}" \ + -DCMAKE_INSTALL_PREFIX="${PREFIX}" \ + -DCMAKE_INSTALL_LIBDIR=lib \ + -DCMAKE_FIND_FRAMEWORK=NEVER \ + -DCMAKE_FIND_APPBUNDLE=NEVER \ + -DBUILD_SHARED_LIBS=ON \ + -DBUILD_STATIC_LIBS=OFF \ + "${SRC_DIR}" + +# Build +make + +# Test +ctest -VV --output-on-failure -j"${CPU_COUNT}" + +# Install +make install diff --git a/recipes/libtdlpack/cross-linux.cmake b/recipes/libtdlpack/cross-linux.cmake new file mode 100644 index 0000000000000..bb837eea5ba7b --- /dev/null +++ b/recipes/libtdlpack/cross-linux.cmake @@ -0,0 +1,20 @@ +# this one is important +set(CMAKE_SYSTEM_NAME Linux) +set(CMAKE_PLATFORM Linux) +#this one not so much +set(CMAKE_SYSTEM_VERSION 1) + +# specify the cross compiler +set(CMAKE_C_COMPILER $ENV{CC}) + +# where is the target environment +set(CMAKE_FIND_ROOT_PATH $ENV{PREFIX} $ENV{BUILD_PREFIX}/$ENV{HOST}/sysroot) + +# search for programs in the build host directories +set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) +# for libraries and headers in the target directories +set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) +set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) + +# god-awful hack because it seems to not run correct tests to determine this: +set(__CHAR_UNSIGNED___EXITCODE 1) diff --git a/recipes/libtdlpack/meta.yaml b/recipes/libtdlpack/meta.yaml new file mode 100644 index 0000000000000..b1adbdd6c90b5 --- /dev/null +++ b/recipes/libtdlpack/meta.yaml @@ -0,0 +1,50 @@ +{% set name = "libtdlpack" %} +{% set version = "1.0.0" %} + +package: + name: {{ name|lower }} + version: {{ version }} + +source: + url: https://github.com/NOAA-MDL/libtdlpack/archive/refs/tags/v{{ version }}.tar.gz + sha256: c434c7f2cc5641a4924f323e0dd1f38b7120995922c3b43e75e5f414e891e326 + +build: + number: 0 + skip: true # [win] + +requirements: + build: + - {{ compiler('fortran') }} # [not win] + - {{ compiler('c') }} # [not win] + - {{ stdlib("c") }} # [not win] + - make # [not win] + - {{ compiler('m2w64_fortran') }} # [win] + - {{ compiler('m2w64_c') }} # [win] + - {{ stdlib("m2w64_c") }} # [win] + - ninja # [win] + - cmake + - pkg-config >=0.21 + host: + - libgomp # [linux] + - llvm-openmp # [osx] + - openmp ==5.0.0 # [win] + run: + - libgomp # [linux] + - llvm-openmp # [osx] + - openmp ==5.0.0 # [win] + +test: + commands: + - test -f ${PREFIX}/lib/libtdlpack${SHLIB_EXT} # [not win] + - if not exist %LIBRARY_BIN%\\libtdlpack.dll exit 1 # [win] + +about: + home: https://github.com/NOAA-MDL/libtdlpack + summary: libtdlpack is a Fortran library with C-bindings for reading and writing TDLPACK files. + license: MIT + license_file: LICENSE + +extra: + recipe-maintainers: + - EricEngle-NOAA