-
Notifications
You must be signed in to change notification settings - Fork 56
/
Copy pathgenerator.jl
47 lines (33 loc) · 1.2 KB
/
generator.jl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#! /bin/bash julia --project generator.jl
using Pkg
using Pkg.Artifacts
using Clang.Generators
using Clang.Generators.JLLEnvs
using SuiteSparse_jll
cd(@__DIR__)
# headers
include_dir = joinpath(SuiteSparse_jll.artifact_dir, "include") |> normpath
cholmod_h = joinpath(include_dir, "cholmod.h")
@assert isfile(cholmod_h)
SuiteSparseQR_C_h = joinpath(include_dir, "SuiteSparseQR_C.h")
@assert isfile(SuiteSparseQR_C_h)
umfpack_h = joinpath(include_dir, "umfpack.h")
@assert isfile(umfpack_h)
amd_h = joinpath(include_dir, "amd.h")
@assert isfile(amd_h)
colamd_h = joinpath(include_dir, "colamd.h")
@assert isfile(colamd_h)
ccolamd_h = joinpath(include_dir, "ccolamd.h")
@assert isfile(ccolamd_h)
# load common option
options = load_options(joinpath(@__DIR__, "generator.toml"))
# run generator for all platforms
for target in JLLEnvs.JLL_ENV_TRIPLES
@info "processing $target"
options["general"]["output_file_path"] = joinpath(@__DIR__, "..", "src/solvers/lib", "$target.jl")
args = get_default_args(target)
push!(args, "-I$include_dir")
header_files = [cholmod_h, SuiteSparseQR_C_h, amd_h, colamd_h, ccolamd_h, umfpack_h]
ctx = create_context(header_files, args, options)
build!(ctx)
end