using BinaryBuilder, Pkg

name = "AlphaMolWrapper"
version = v"0.6.0"
julia_versions = [v"1.10", v"1.11", v"1.12"]

sources = [
    GitSource("https://github.com/IvanSpirandelli/AlphaMolWrapper", "e48cb4c7b5210379650ad93ca8881fbd2368479d"),
]

script = raw"""
cd ${WORKSPACE}/srcdir/AlphaMolWrapper
mkdir build && cd build
cmake .. \
    -DCMAKE_INSTALL_PREFIX=${prefix} \
    -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TARGET_TOOLCHAIN} \
    -DJulia_PREFIX=${prefix}
VERBOSE=ON cmake --build . --config Release --target install -- -j${nproc}
"""
include("../../L/libjulia/common.jl")
julia_compat = libjulia_julia_compat(julia_versions)
platforms = expand_cxxstring_abis(vcat(libjulia_platforms.(julia_versions)...))

products = [
    LibraryProduct("libalphamolwrapper", :libalphamolwrapper),
]

dependencies = [
    BuildDependency("libjulia_jll"),
    Dependency("libcxxwrap_julia_jll"; compat="0.14.8"),
    Dependency("GMP_jll"),
]

build_tarballs(ARGS, name, version, sources, script, platforms, products, dependencies;
    preferred_gcc_version=v"9", julia_compat=julia_compat)
