|
6 | 6 | using Clang.Generators
|
7 | 7 | using SCIP_jll
|
8 | 8 |
|
9 |
| -cd(@__DIR__) |
| 9 | +const HEADER_BASE = joinpath(SCIP_jll.artifact_dir, "include") |
10 | 10 |
|
11 |
| -const (HEADER_BASE, is_default) = if haskey(ENV, "SCIPDIR") |
12 |
| - (joinpath(ENV["SCIPDIR"], "src"), false) |
13 |
| -else |
14 |
| - (joinpath(SCIP_jll.artifact_dir, "include"), true) |
15 |
| -end |
16 |
| - |
17 |
| -const SCIP_TYPES_H = |
18 |
| - filter(readdir(joinpath(HEADER_BASE, "scip"); join=true)) do f |
19 |
| - occursin("type", f) && endswith(f, ".h") |
20 |
| - end |
21 |
| -push!(SCIP_TYPES_H, joinpath(HEADER_BASE, "scip/def.h")) |
22 |
| -push!(SCIP_TYPES_H, joinpath(HEADER_BASE, "scip/nlpi.h")) |
23 |
| -push!(SCIP_TYPES_H, joinpath(HEADER_BASE, "scip/scipdefplugins.h")) |
24 |
| - |
25 |
| -# add the generated config.h file, either from JLL or build dir |
26 |
| -if is_default |
27 |
| - push!(SCIP_TYPES_H, joinpath(HEADER_BASE, "scip/config.h")) |
28 |
| -end |
29 |
| - |
30 |
| -const SCIP_PUB_H = |
| 11 | +headers = vcat( |
31 | 12 | filter(readdir(joinpath(HEADER_BASE, "scip"); join=true)) do f
|
32 |
| - occursin("pub", f) && endswith(f, ".h") |
33 |
| - end |
34 |
| - |
35 |
| -const SCIP_MEM_H = |
36 |
| - filter(readdir(joinpath(HEADER_BASE, "blockmemshell"); join=true)) do f |
37 |
| - endswith(f, ".h") |
38 |
| - end |
39 |
| - |
40 |
| -const SCIP_LPI_H = filter(readdir(joinpath(HEADER_BASE, "lpi"); join=true)) do f |
41 |
| - endswith(f, ".h") |
42 |
| -end |
43 |
| - |
44 |
| -headers = append!(SCIP_TYPES_H, SCIP_PUB_H, SCIP_MEM_H, SCIP_LPI_H) |
45 |
| - |
46 |
| -options = load_options(joinpath(@__DIR__, "generator.toml")) |
47 |
| - |
48 |
| -args = get_default_args() |
49 |
| -push!(args, "-I$HEADER_BASE") |
50 |
| -if !is_default |
51 |
| - push!(args, "-I$SCIP_BUILD_DIR/scip") |
52 |
| -end |
53 |
| - |
54 |
| -ctx = create_context(headers, args, options) |
55 |
| - |
56 |
| -build!(ctx) |
| 13 | + return occursin("type", f) || occursin("pub", f) |
| 14 | + end, |
| 15 | + joinpath(HEADER_BASE, "scip/def.h"), |
| 16 | + joinpath(HEADER_BASE, "scip/nlpi.h"), |
| 17 | + joinpath(HEADER_BASE, "scip/scipdefplugins.h"), |
| 18 | + joinpath(HEADER_BASE, "scip/config.h"), |
| 19 | + readdir(joinpath(HEADER_BASE, "blockmemshell"); join=true), |
| 20 | + readdir(joinpath(HEADER_BASE, "lpi"); join=true), |
| 21 | +) |
| 22 | + |
| 23 | +build!( |
| 24 | + create_context( |
| 25 | + filter!(f -> endswith(f, ".h"), headers), |
| 26 | + vcat(get_default_args(), "-I$HEADER_BASE"), |
| 27 | + load_options(joinpath(@__DIR__, "generator.toml")), |
| 28 | + ), |
| 29 | +) |
0 commit comments