{% set version = "0.8" %}

package:
    name: v2rdm_casscf
    version: {{ version }}

source:
    git_url: git@github.com:edeprince3/v2rdm_casscf.git      # [linux]
    git_url: https://github.com/edeprince3/v2rdm_casscf.git  # [osx]
    # git_tag: v{{ version }}
    git_tag: 976d8af  # v0.8 + 1 (version bump)

build:
    number: 0                                            # [linux]
    number: 0                                            # [osx]
    binary_relocation: true
    skip: true                                           # [win]
    ignore_run_exports:
        # interferes with solving build env (at least for prereleases?)
        - psi4
        # unused libraries
        - libgfortran-ng

requirements:
    build:
        - cmake >=3.3
        - {{ compiler('c') }}
        - {{ compiler('cxx') }}
        - {{ compiler('fortran') }}
    host:
        - mkl-devel {{ mkl }}
        - psi4                                            # for psi4OptionsTools to initiate plugin and to link against
        - pybind11 {{ pybind11 }}
        - python {{ python }}                             # to resolve site-packages dir name
    run:
        - intel-openmp
        - {{ pin_compatible('python', max_pin='x.x') }}

test:
    requires:
        - psi4
    imports:
        - v2rdm_casscf
        - psi4
    commands:
        # Verify module
        - test -f $SP_DIR/v2rdm_casscf/v2rdm_casscf.so
        - test -f $PREFIX/share/cmake/v2rdm_casscf/v2rdm_casscfConfig.cmake
        # Inspect linkage
        - ldd -r -u $SP_DIR/v2rdm_casscf/v2rdm_casscf.so && return 0  # [linux]
        - ldd -v $SP_DIR/v2rdm_casscf/v2rdm_casscf.so                 # [linux]
        - otool -L $SP_DIR/v2rdm_casscf/v2rdm_casscf.so               # [osx]
        - conda inspect linkages --show-files --groupby=dependency v2rdm_casscf
        - conda inspect objects -p $PREFIX $PKG_NAME                  # [osx]
        # Actually test
        - psi4 --test
        # * conda-build and pytest-shutil don't get along
        - python -c "import v2rdm_casscf as v2, sys; sys.exit(v2.test('long', extras=['-k', 'psiapi']))"
        - python -c "import v2rdm_casscf as v2; import psi4; print('*** v2rdm_casscf {} built successfully against Psi4 {}. Buy psinet a beer.'.format(v2.__version__, psi4.__version__))"

about:
    home: https://github.com/edeprince3/v2rdm_casscf
    dev_url: https://github.com/edeprince3/v2rdm_casscf
    doc_url: https://github.com/edeprince3/v2rdm_casscf/blob/master/README.md
    # doc_source_url:
    license: GPL-2.0+
    license_url: https://opensource.org/licenses/GPL-2.0+
    license_file: LICENSE
    license_family: GPL
    summary: "E. DePrince's variational 2-RDM-driven CASSCF plugin to Psi4"
    # description: >

# NOTES
# -----

# * To build against a certain, non-latest psi4, `req/host` will be e.g., `psi4 1.1+add49b9`
