Skip to content

Commit 38eb174

Browse files
committed
WIP: add a CI job to iterate on the Windows build
1 parent b08c2f1 commit 38eb174

File tree

8 files changed

+164
-15
lines changed

8 files changed

+164
-15
lines changed

.github/julia/build_tarballs.jl

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
# Note that this script can accept some limited command-line arguments, run
2+
# `julia build_tarballs.jl --help` to see a usage message.
3+
using BinaryBuilder, Pkg
4+
5+
name = "SCIP"
6+
upstream_version = v"9.2.1"
7+
version = VersionNumber(upstream_version.major * 100, upstream_version.minor * 100, upstream_version.patch * 100)
8+
9+
# Collection of sources required to complete build
10+
sources = [
11+
ArchiveSource(
12+
"https://scipopt.org/download/release/scipoptsuite-$(upstream_version).tgz",
13+
"41b71a57af773403e9a6724f78c37d8396ac4b6b270a9bbf3716d67f1af12edf"
14+
),
15+
]
16+
17+
# Bash recipe for building across all platforms
18+
script = raw"""
19+
# needed for now
20+
# clock_gettime requires linking to librt -lrt with old glibc
21+
# remove when CMake accounts for this
22+
if [[ "${target}" == *86*-linux-gnu ]]; then
23+
export LDFLAGS="-lrt"
24+
elif [[ "${target}" == *-mingw* ]]; then
25+
# this is required to link to bliss on mingw
26+
export LDFLAGS=-L${libdir}
27+
fi
28+
29+
if [[ "${target}" == *w64* ]]; then
30+
export CFLAGS="-O0"
31+
fi
32+
33+
cd scipoptsuite*
34+
35+
# for soplex threadlocal
36+
export CXXFLAGS="-DTHREADLOCAL=''"
37+
38+
mkdir build
39+
cd build/
40+
cmake -DCMAKE_INSTALL_PREFIX=$prefix\
41+
-DCMAKE_TOOLCHAIN_FILE=${CMAKE_TARGET_TOOLCHAIN}\
42+
-DCMAKE_BUILD_TYPE=Release\
43+
-DPAPILO=0\
44+
-DZIMPL=OFF\
45+
-DGCG=0\
46+
-DUG=0\
47+
-DAMPL=0\
48+
-DBOOST=ON\
49+
-DSYM=snauty\
50+
-DTPI=tny\
51+
-DIPOPT_DIR=${prefix} \
52+
-DIPOPT_LIBRARIES=${libdir} \
53+
..
54+
make -j${nproc}
55+
make install
56+
57+
mkdir -p ${prefix}/share/licenses/SCIP
58+
for dir in scip soplex; do
59+
cp $WORKSPACE/srcdir/scipoptsuite*/${dir}/LICENSE ${prefix}/share/licenses/SCIP/LICENSE_${dir}
60+
done
61+
cp $WORKSPACE/srcdir/scipoptsuite*/papilo/COPYING ${prefix}/share/licenses/SCIP/LICENSE_papilo
62+
"""
63+
64+
# These are the platforms we will build for by default, unless further
65+
# platforms are passed in on the command line
66+
platforms = expand_cxxstring_abis(supported_platforms())
67+
filter!(platforms) do p
68+
!(Sys.isfreebsd(p) && arch(p) == "aarch64") && !occursin("riscv", arch(p))
69+
end
70+
71+
# The products that we will ensure are always built
72+
products = [
73+
LibraryProduct("libscip", :libscip),
74+
ExecutableProduct("scip", :scipexe),
75+
LibraryProduct("libsoplexshared", :libsoplex),
76+
]
77+
78+
# Dependencies that must be installed before this package can be built
79+
dependencies = [
80+
Dependency(PackageSpec(name="boost_jll", uuid="28df3c45-c428-5900-9ff8-a3135698ca75"); compat="=1.79.0"),
81+
Dependency(PackageSpec(name="Bzip2_jll", uuid="6e34b625-4abd-537c-b88f-471c36dfa7a0"); compat="1.0.9"),
82+
Dependency(PackageSpec(name="CompilerSupportLibraries_jll", uuid="e66e0078-7015-5450-92f7-15fbd957f2ae")),
83+
Dependency(PackageSpec(name="GMP_jll", uuid="781609d7-10c4-51f6-84f2-b8444358ff6d"), v"6.2.1"),
84+
Dependency(PackageSpec(name="Ipopt_jll", uuid="9cc047cb-c261-5740-88fc-0cf96f7bdcc7"); compat="300.1400.1400"),
85+
Dependency(PackageSpec(name="Readline_jll", uuid="05236dd9-4125-5232-aa7c-9ec0c9b2c25a")),
86+
Dependency(PackageSpec(name="Zlib_jll", uuid="83775a58-1f1d-513f-b197-d71354ab007a")),
87+
]
88+
89+
# Build the tarballs, and possibly a `build.jl` as well.
90+
build_tarballs(ARGS, name, version, sources, script, platforms, products, dependencies; preferred_gcc_version = v"6", julia_compat="1.6")
File renamed without changes.
File renamed without changes.
File renamed without changes.
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
name: Build on Linux, Run on Windows
2+
on:
3+
push:
4+
branches: [master]
5+
pull_request:
6+
types: [opened, synchronize, reopened]
7+
# needed to allow julia-actions/cache to delete old caches that it has created
8+
permissions:
9+
actions: write
10+
contents: read
11+
jobs:
12+
build-linux:
13+
name: Julia - ${{ github.event_name }}
14+
runs-on: ubuntu-latest
15+
outputs:
16+
sha1: ${{ steps.build.outputs.SHA1 }}
17+
steps:
18+
- uses: actions/checkout@v4
19+
# Install Julia 1.7 for BinaryBuilder. Note that this is an old version of
20+
# Julia, but it is required for compatibility with BinaryBuilder.
21+
- uses: julia-actions/setup-julia@v2
22+
with:
23+
version: "1.7"
24+
arch: x64
25+
- uses: julia-actions/cache@v2
26+
- name: build
27+
run: |
28+
julia --color=yes -e 'using Pkg; Pkg.add("BinaryBuilder")'
29+
julia --color=yes .github/julia/build_tarballs.jl x86_64-w64-mingw32-cxx11 --verbose --deploy=local
30+
file=/home/runner/.julia/dev/SCIP_jll/Artifacts.toml
31+
sha1=$(grep '^git-tree-sha1' "$file" | cut -d '"' -f2)
32+
echo "artifact_path=${sha1}" >> $GITHUB_ENV
33+
echo "SHA1=${sha1}" >> $GITHUB_OUTPUT
34+
- uses: actions/upload-artifact@v4
35+
with:
36+
name: scip-jll
37+
path: /home/runner/.julia/dev/SCIP_jll
38+
- uses: actions/upload-artifact@v4
39+
with:
40+
name: artifacts
41+
path: /home/runner/.julia/artifacts/${{ env.artifact_path }}
42+
run-windows:
43+
runs-on: windows-latest
44+
needs: build-linux
45+
steps:
46+
- uses: actions/checkout@v4
47+
- uses: julia-actions/setup-julia@v2
48+
with:
49+
version: "1"
50+
arch: x64
51+
- uses: julia-actions/cache@v2
52+
- uses: julia-actions/julia-buildpkg@v1
53+
- uses: actions/download-artifact@v4
54+
with:
55+
name: scip-jll
56+
path: /home/runner/.julia/dev/SCIP_jll
57+
- uses: actions/download-artifact@v4
58+
with:
59+
name: artifacts
60+
path: /home/runner/.julia/artifacts/${{ needs.build-linux.outputs.sha1 }}
61+
- shell: julia --color=yes --project=. {0}
62+
run: |
63+
using Pkg
64+
Pkg.develop(; path = "/home/runner/.julia/dev/SCIP_jll")
65+
Pkg.instantiate()
66+
Pkg.update()
67+
Pkg.test("SCIP")

deps/build.jl

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,10 @@
55

66
using Libdl
77

8-
if !haskey(ENV, "SCIPOPTDIR") && !Sys.iswindows()
8+
if !haskey(ENV, "SCIPOPTDIR")
99
# Skip build in favor of SCIP_jll
1010
exit()
1111
end
12-
if Sys.iswindows()
13-
@warn("SCIP_jll still doesn't work with windows, segfaults are likely!")
14-
end
1512

1613
depsfile = joinpath(dirname(@__FILE__), "deps.jl")
1714
if isfile(depsfile)

src/init.jl

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,13 @@ if isfile(depsjl_path)
1010
# User-provided SCIP library
1111
include(depsjl_path)
1212
else
13-
if Sys.iswindows()
14-
@warn(
15-
"SCIP_jll still doesn't work with Windows, segfaults are likely! See the README for instructions on how to manually install SCIP."
16-
)
17-
end
1813
# Artifact from BinaryBuilder package
19-
import SCIP_PaPILO_jll
20-
if SCIP_PaPILO_jll.is_available()
21-
using SCIP_PaPILO_jll: libscip
22-
else
23-
using SCIP_jll: libscip
24-
end
14+
using SCIP_jll: libscip
15+
# import SCIP_PaPILO_jll
16+
# if SCIP_PaPILO_jll.is_available()
17+
# using SCIP_PaPILO_jll: libscip
18+
# else
19+
# end
2520
end
2621

2722
function __init__()

0 commit comments

Comments
 (0)