|
| 1 | +# !!! note |
| 2 | +# This file is a version of the file we use to package HiGHS for the Julia |
| 3 | +# ecosystem. If you make changes to this file during the development of |
| 4 | +# HiGHS, please tag `@odow` so we can make the correponding changes to: |
| 5 | +# https://github.com/JuliaPackaging/Yggdrasil/blob/master/H/HiGHS |
| 6 | + |
| 7 | +using BinaryBuilder, Pkg |
| 8 | + |
| 9 | +name = "HiGHS" |
| 10 | +version = VersionNumber(ENV["HIGHS_RELEASE"]) |
| 11 | + |
| 12 | +sources = [GitSource(ENV["HIGHS_URL"], ENV["HIGHS_COMMIT"])] |
| 13 | + |
| 14 | +script = raw""" |
| 15 | +export BUILD_SHARED="ON" |
| 16 | +export BUILD_STATIC="OFF" |
| 17 | +
|
| 18 | +cd $WORKSPACE/srcdir/HiGHS |
| 19 | +
|
| 20 | +# Remove system CMake to use the jll version |
| 21 | +apk del cmake |
| 22 | +
|
| 23 | +mkdir -p build |
| 24 | +cd build |
| 25 | +
|
| 26 | +# Do fully static build only on Windows |
| 27 | +if [[ "${BUILD_SHARED}" == "OFF" ]] && [[ "${target}" == *-mingw* ]]; then |
| 28 | + export CXXFLAGS="-static" |
| 29 | +fi |
| 30 | +
|
| 31 | +cmake -DCMAKE_INSTALL_PREFIX=${prefix} \ |
| 32 | + -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TARGET_TOOLCHAIN} \ |
| 33 | + -DCMAKE_BUILD_TYPE=Release \ |
| 34 | + -DBUILD_SHARED_LIBS=${BUILD_SHARED} \ |
| 35 | + -DZLIB_USE_STATIC_LIBS=${BUILD_STATIC} \ |
| 36 | + -DHIPO=ON \ |
| 37 | + -DBLAS_LIBRARIES="${libdir}/libopenblas.${dlext}" \ |
| 38 | + .. |
| 39 | +
|
| 40 | +if [[ "${target}" == *-linux-* ]]; then |
| 41 | + make -j ${nproc} |
| 42 | +else |
| 43 | + if [[ "${target}" == *-mingw* ]]; then |
| 44 | + cmake --build . --config Release |
| 45 | + else |
| 46 | + cmake --build . --config Release --parallel |
| 47 | + fi |
| 48 | +fi |
| 49 | +make install |
| 50 | +
|
| 51 | +install_license ../LICENSE.txt |
| 52 | +""" |
| 53 | + |
| 54 | +products = [ |
| 55 | + LibraryProduct("libhighs", :libhighs), |
| 56 | + ExecutableProduct("highs", :highs), |
| 57 | +] |
| 58 | + |
| 59 | +platforms = supported_platforms() |
| 60 | +platforms = expand_cxxstring_abis(platforms) |
| 61 | + |
| 62 | +dependencies = [ |
| 63 | + Dependency("CompilerSupportLibraries_jll"), |
| 64 | + Dependency("Zlib_jll"), |
| 65 | + Dependency("OpenBLAS32_jll"), |
| 66 | + HostBuildDependency(PackageSpec(; name="CMake_jll")), |
| 67 | +] |
| 68 | + |
| 69 | +build_tarballs( |
| 70 | + ARGS, |
| 71 | + name, |
| 72 | + version, |
| 73 | + sources, |
| 74 | + script, |
| 75 | + platforms, |
| 76 | + products, |
| 77 | + dependencies; |
| 78 | + preferred_gcc_version = v"11", |
| 79 | + julia_compat = "1.6", |
| 80 | +) |
0 commit comments