From 1936a5f99fd782b0d48c1a4ee573ca27f610b6c5 Mon Sep 17 00:00:00 2001 From: Alexis Montoison Date: Fri, 15 Nov 2024 09:29:09 -0600 Subject: [PATCH] [CI] Fix the compilation on Windows --- .github/julia/build_tarballs_release.jl | 10 ++++++++-- .github/julia/build_tarballs_yggdrasil.jl | 6 ++++-- .github/workflows/release.yml | 24 +++++++++++------------ 3 files changed, 24 insertions(+), 16 deletions(-) diff --git a/.github/julia/build_tarballs_release.jl b/.github/julia/build_tarballs_release.jl index 80172a35..088dffe8 100644 --- a/.github/julia/build_tarballs_release.jl +++ b/.github/julia/build_tarballs_release.jl @@ -83,6 +83,12 @@ cd $WORKSPACE/srcdir/Uno mkdir -p build cd build +if [[ "${target}" == *mingw* ]]; then + LIBHIGHS=${prefix}/lib/libhighs.dll.a +else + LIBHIGHS=${libdir}/libhighs.${dlext} +fi + if [[ "${target}" == *apple* ]] || [[ "${target}" == *freebsd* ]]; then OMP=omp else @@ -98,7 +104,7 @@ cmake \ -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TARGET_TOOLCHAIN} \ -DCMAKE_BUILD_TYPE=Release \ -DAMPLSOLVER=${libdir}/libasl.${dlext} \ - -DHIGHS=${libdir}/libhighs.${dlext} \ + -DHIGHS=${LIBHIGHS} \ -DHSL=${libdir}/libhsl.${dlext} \ -DMUMPS_INCLUDE_DIR=${includedir} \ -DMETIS_INCLUDE_DIR=${includedir} \ @@ -117,7 +123,7 @@ install -v -m 755 "uno_ampl${exeext}" -t "${bindir}" # Currently, Uno does not provide a shared library. This may be useful in the future once it has a C API. # We just check that we can generate it, but we don't include it in the tarballs. -${CXX} -shared $(flagon -Wl,--whole-archive) libuno.a $(flagon -Wl,--no-whole-archive) -o libuno.${dlext} -L${libdir} -l${OMP} -lopenblas -ldmumps -lmetis -lhsl +${CXX} -shared $(flagon -Wl,--whole-archive) libuno.a $(flagon -Wl,--no-whole-archive) -o libuno.${dlext} -L${libdir} -l${OMP} -lopenblas -ldmumps -lmetis -lhsl -lhighs cp libuno.a ${prefix}/lib/libuno.a cp libuno.${dlext} ${libdir}/libuno.${dlext} """ diff --git a/.github/julia/build_tarballs_yggdrasil.jl b/.github/julia/build_tarballs_yggdrasil.jl index 7105f9e5..ee9e9e83 100644 --- a/.github/julia/build_tarballs_yggdrasil.jl +++ b/.github/julia/build_tarballs_yggdrasil.jl @@ -23,8 +23,10 @@ cd build if [[ "${target}" == *mingw* ]]; then LBT=blastrampoline-5 + LIBHIGHS=${prefix}/lib/libhighs.dll.a else LBT=blastrampoline + LIBHIGHS=${libdir}/libhighs.${dlext} fi if [[ "${target}" == *apple* ]] || [[ "${target}" == *freebsd* ]]; then @@ -42,7 +44,7 @@ cmake \ -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TARGET_TOOLCHAIN} \ -DCMAKE_BUILD_TYPE=Release \ -DAMPLSOLVER=${libdir}/libasl.${dlext} \ - -DHIGHS=${libdir}/libhighs.${dlext} \ + -DHIGHS=${LIBHIGHS} \ -DHSL=${libdir}/libhsl.${dlext} \ -DBLA_VENDOR="libblastrampoline" \ -DMUMPS_INCLUDE_DIR=${includedir} \ @@ -62,7 +64,7 @@ install -v -m 755 "uno_ampl${exeext}" -t "${bindir}" # Currently, Uno does not provide a shared library. This may be useful in the future once it has a C API. # We just check that we can generate it, but we don't include it in the tarballs. -${CXX} -shared $(flagon -Wl,--whole-archive) libuno.a $(flagon -Wl,--no-whole-archive) -o libuno.${dlext} -L${libdir} -l${OMP} -l${LBT} -ldmumps -lmetis -lhsl +${CXX} -shared $(flagon -Wl,--whole-archive) libuno.a $(flagon -Wl,--no-whole-archive) -o libuno.${dlext} -L${libdir} -l${OMP} -l${LBT} -ldmumps -lmetis -lhsl -lhighs # cp libuno.${dlext} ${libdir}/libuno.${dlext} """ diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 947f8976..6c2d69eb 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -22,25 +22,25 @@ jobs: echo "BINARYBUILDER_AUTOMATIC_APPLE=true" >> $GITHUB_ENV echo "UNO_RELEASE=${{ github.ref_name }}" >> $GITHUB_ENV echo "UNO_COMMIT=${{ github.sha }}" >> $GITHUB_ENV - - name: Cross-compilation of Uno -- x86_64-linux-gnu-libgfortran5 + - name: Cross-compilation of Uno -- x86_64-linux-gnu-cxx11 run: | julia --color=yes -e 'using Pkg; Pkg.add("BinaryBuilder")' - julia --color=yes .github/julia/build_tarballs_release.jl x86_64-linux-gnu-libgfortran5 --verbose + julia --color=yes .github/julia/build_tarballs_release.jl x86_64-linux-gnu-cxx11 --verbose rm -r ~/.julia - - name: Cross-compilation of Uno -- x86_64-w64-mingw32-libgfortran5 + - name: Cross-compilation of Uno -- x86_64-w64-mingw32-cxx11 run: | julia --color=yes -e 'using Pkg; Pkg.add("BinaryBuilder")' - julia --color=yes .github/julia/build_tarballs_release.jl x86_64-w64-mingw32-libgfortran5 --verbose + julia --color=yes .github/julia/build_tarballs_release.jl x86_64-w64-mingw32-cxx11 --verbose rm -r ~/.julia - - name: Cross-compilation of Uno -- x86_64-apple-darwin-libgfortran5 + - name: Cross-compilation of Uno -- x86_64-apple-darwin-cxx11 run: | julia --color=yes -e 'using Pkg; Pkg.add("BinaryBuilder")' - julia --color=yes .github/julia/build_tarballs_release.jl x86_64-apple-darwin-libgfortran5 --verbose + julia --color=yes .github/julia/build_tarballs_release.jl x86_64-apple-darwin-cxx11 --verbose rm -r ~/.julia - - name: Cross-compilation of Uno -- aarch64-apple-darwin-libgfortran5 + - name: Cross-compilation of Uno -- aarch64-apple-darwin-cxx11 run: | julia --color=yes -e 'using Pkg; Pkg.add("BinaryBuilder")' - julia --color=yes .github/julia/build_tarballs_release.jl aarch64-apple-darwin-libgfortran5 --verbose + julia --color=yes .github/julia/build_tarballs_release.jl aarch64-apple-darwin-cxx11 --verbose rm -r ~/.julia - name: Generate the binaries run: julia --color=yes .github/julia/generate_binaries.jl @@ -61,7 +61,7 @@ jobs: GITHUB_TOKEN: ${{ github.token }} with: upload_url: ${{ steps.create_release.outputs.upload_url }} - asset_path: ./Uno_binaries.${{ github.ref_name }}.x86_64-linux-gnu-libgfortran5.tar.gz + asset_path: ./Uno_binaries.${{ github.ref_name }}.x86_64-linux-gnu-cxx11.tar.gz asset_name: Uno.${{ github.ref_name }}.linux.tar.gz asset_content_type: application/gzip - name: upload Mac (Intel) artifact @@ -70,7 +70,7 @@ jobs: GITHUB_TOKEN: ${{ github.token }} with: upload_url: ${{ steps.create_release.outputs.upload_url }} - asset_path: ./Uno_binaries.${{ github.ref_name }}.x86_64-apple-darwin-libgfortran5.tar.gz + asset_path: ./Uno_binaries.${{ github.ref_name }}.x86_64-apple-darwin-cxx11.tar.gz asset_name: Uno.${{ github.ref_name }}.mac-intel.tar.gz asset_content_type: application/gzip - name: upload Mac (ARM) artifact @@ -79,7 +79,7 @@ jobs: GITHUB_TOKEN: ${{ github.token }} with: upload_url: ${{ steps.create_release.outputs.upload_url }} - asset_path: ./Uno_binaries.${{ github.ref_name }}.aarch64-apple-darwin-libgfortran5.tar.gz + asset_path: ./Uno_binaries.${{ github.ref_name }}.aarch64-apple-darwin-cxx11.tar.gz asset_name: Uno.${{ github.ref_name }}.mac-arm.tar.gz asset_content_type: application/gzip - name: upload Windows artifact @@ -88,6 +88,6 @@ jobs: GITHUB_TOKEN: ${{ github.token }} with: upload_url: ${{ steps.create_release.outputs.upload_url }} - asset_path: ./Uno_binaries.${{ github.ref_name }}.x86_64-w64-mingw32-libgfortran5.zip + asset_path: ./Uno_binaries.${{ github.ref_name }}.x86_64-w64-mingw32-cxx11.zip asset_name: Uno.${{ github.ref_name }}.windows.zip asset_content_type: application/zip