Skip to content

Commit

Permalink
Wizard recipe: MAiNGO-v0.7.2 (JuliaPackaging#7812)
Browse files Browse the repository at this point in the history
* New Recipe: MAiNGO v0.7.2

* Delete unused patch and cleanup build_tarballs.jl.

Add comments explaining why certain platforms are not yet build.
Add expansion over cxxstring and libgfortran 4 and 5.

* Lower preferred_gcc_version to 9

* Apply suggestions from code review

Apply directly useable suggestions.

Co-authored-by: Mosè Giordano <[email protected]>

* Update M/MAiNGO/build_tarballs.jl

Add suggested commands for moving lib and bin targets.

Co-authored-by: Mosè Giordano <[email protected]>

* Try building for MacOS and FreeBSD

* Filter out non-working platforms instead of picking ones that work

* Fix CMake options

* Fix missing build folder in first CMake command

* Fix missing build folder in first CMake command (again)

* Fix typo in CMAKE_TARGET_TOOLCHAIN

* Remove FreeBSD build.

Not supported upstream and fails on trial build with

/workspace/srcdir/maingo/build/dep/ipopt/IpoptConfig/include/config.h:17:4: error: #error "No finite/_finite function available"
[16:31:28]    17 |   #error "No finite/_finite function available"

Likely would need deeper investigation and modification of the CMake files, as Ipopt without CMake seems to build.

* Fix bash script error

* Test Clang for MacOS

* Try forcing SDK 10.15 for std::variant

* Fix where if statement ends

* Revert to using GCC for MacOS

---------

Co-authored-by: Aron Zingler <[email protected]>
Co-authored-by: Mosè Giordano <[email protected]>
  • Loading branch information
3 people authored and grasph committed Jul 1, 2024
1 parent 2915ecb commit 0c3db04
Showing 1 changed file with 85 additions and 0 deletions.
85 changes: 85 additions & 0 deletions M/MAiNGO/build_tarballs.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
# Note that this script can accept some limited command-line arguments, run
# `julia build_tarballs.jl --help` to see a usage message.
using BinaryBuilder, Pkg

name = "MAiNGO"
version = v"0.7.2"

# Collection of sources required to complete build
sources = [
GitSource("https://git.rwth-aachen.de/avt-svt/public/maingo.git", "252733413a29dbe5b84a4cdaf53e60e9934f372f"),
]

# Bash recipe for building across all platforms
script = raw"""
cd $WORKSPACE/srcdir/maingo/
git remote set-url origin https://git.rwth-aachen.de/avt-svt/public/maingo.git
mkdir build
cd build
git submodule init
git submodule update -j 1
common_cmake_options="-DCMAKE_BUILD_TYPE=Release \
-DMAiNGO_build_standalone=True \
-DMAiNGO_build_shared_c_api=True \
-DMAiNGO_build_parser=True \
-DMAiNGO_use_cplex=False \
-DMAiNGO_use_melon=False"
# GCC used because of https://github.com/JuliaPackaging/Yggdrasil/issues/7139
if [[ "${target}" == x86_64-apple-darwin* ]]; then
export MACOSX_DEPLOYMENT_TARGET=10.15
cmake -DCMAKE_INSTALL_PREFIX=${prefix} \
-DCMAKE_TOOLCHAIN_FILE=${CMAKE_TARGET_TOOLCHAIN%.*}_gcc.cmake \
${common_cmake_options} \
..
else
cmake -DCMAKE_INSTALL_PREFIX=${prefix} \
-DCMAKE_TOOLCHAIN_FILE=${CMAKE_TARGET_TOOLCHAIN} \
${common_cmake_options} \
..
fi
cmake --build . --config Release --parallel ${nproc}
install -Dvm 755 "MAiNGO${exeext}" "${bindir}/MAiNGO${exeext}"
install -Dvm 755 "MAiNGOcpp${exeext}" "${bindir}/MAiNGOcpp${exeext}"
install -Dvm 755 "libmaingo-c-api.${dlext}" "${libdir}/libmaingo-c-api.${dlext}"
install_license ../LICENSE
"""

# These are the platforms we will build for by default, unless further
# platforms are passed in on the command line


#Auditor complains about avx1.
#Without march the Auditor detects avx2
#but with march="avx2" avx512 is detected, so we build without march

platforms = supported_platforms()
#FreeBSD is not supported
filter!(!Sys.isfreebsd, platforms)
#only x64 is supported
filter!(p -> (arch(p) == "x86_64"), platforms)
platforms = expand_cxxstring_abis(platforms)
platforms = expand_gfortran_versions(platforms)
#We filter out gfortan 3 (seem not to have std::variant)
filter!(p -> !(libgfortran_version(p) == v"3"), platforms)


# The products that we will ensure are always built
products = [
LibraryProduct("libmaingo-c-api", :libmaingo_c_api),
ExecutableProduct("MAiNGOcpp", :MAiNGOcpp),
ExecutableProduct("MAiNGO", :MAiNGO)
]

# Dependencies that must be installed before this package can be built
dependencies = [
Dependency(PackageSpec(name="CompilerSupportLibraries_jll", uuid="e66e0078-7015-5450-92f7-15fbd957f2ae")),
]

# Build the tarballs, and possibly a `build.jl` as well.
build_tarballs(ARGS, name, version, sources, script, platforms, products, dependencies; julia_compat="1.6", preferred_gcc_version = v"9")

0 comments on commit 0c3db04

Please sign in to comment.