Skip to content

Commit 98c4163

Browse files
committed
Add "--sysimage" flag
1 parent 071980d commit 98c4163

File tree

2 files changed

+15
-5
lines changed

2 files changed

+15
-5
lines changed

README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
Helper script to build libraries and executables from Julia code.
44

55
```
6-
usage: juliac.jl [-v] [-q] [-c] [-C <target>] [-O {0,1,2,3}]
7-
[-g {0,1,2}] [--inline {yes|no}]
6+
usage: juliac.jl [-v] [-q] [-c] [-J <file>] [-C <target>]
7+
[-O {0,1,2,3}] [-g {0,1,2}] [--inline {yes|no}]
88
[--check-bounds {yes|no}] [--math-mode {ieee,fast}]
99
[--depwarn {yes|no|error}] [-o] [-s] [-e] [-j]
1010
[--version] [-h] juliaprog [cprog] [builddir]
@@ -22,6 +22,8 @@ optional arguments:
2222
-v, --verbose increase verbosity
2323
-q, --quiet suppress non-error messages
2424
-c, --clean delete builddir
25+
-J, --sysimage <file>
26+
start up with the given system image file
2527
-C, --cpu-target <target>
2628
limit usage of CPU features up to <target>
2729
-O, --optimize {0,1,2,3}

juliac.jl

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,11 @@ function main(args)
3333
"--clean", "-c"
3434
action = :store_true
3535
help = "delete builddir"
36+
"--sysimage", "-J"
37+
arg_type = String
38+
default = nothing
39+
metavar = "<file>"
40+
help = "start up with the given system image file"
3641
"--cpu-target", "-C"
3742
arg_type = String
3843
default = nothing
@@ -111,6 +116,7 @@ function main(args)
111116
parsed_args["verbose"],
112117
parsed_args["quiet"],
113118
parsed_args["clean"],
119+
parsed_args["sysimage"],
114120
parsed_args["cpu-target"],
115121
parsed_args["optimize"],
116122
parsed_args["debug"],
@@ -125,8 +131,9 @@ function main(args)
125131
)
126132
end
127133

128-
function julia_compile(julia_program, c_program=nothing, build_dir="builddir", verbose=false, quiet=false, clean=false,
129-
cpu_target=nothing, optimize=nothing, debug=nothing, inline=nothing, check_bounds=nothing, math_mode=nothing, depwarn=nothing,
134+
function julia_compile(julia_program, c_program=nothing, build_dir="builddir", verbose=false, quiet=false,
135+
clean=false, sysimage = nothing, cpu_target=nothing, optimize=nothing, debug=nothing,
136+
inline=nothing, check_bounds=nothing, math_mode=nothing, depwarn=nothing,
130137
object=false, shared=false, executable=true, julialibs=true)
131138

132139
verbose && quiet && (verbose = false)
@@ -182,6 +189,7 @@ function julia_compile(julia_program, c_program=nothing, build_dir="builddir", v
182189
if length(julia_cmd.exec) != 5 || !all(startswith.(julia_cmd.exec[2:5], ["-C", "-J", "--compile", "--depwarn"]))
183190
error("Unexpected format of \"Base.julia_cmd()\", you may be using an incompatible version of Julia")
184191
end
192+
sysimage == nothing || (julia_cmd.exec[3] = "-J$sysimage")
185193
push!(julia_cmd.exec, "--startup-file=no")
186194
cpu_target == nothing || (julia_cmd.exec[2] = "-C$cpu_target")
187195
optimize == nothing || push!(julia_cmd.exec, "-O$optimize")
@@ -198,7 +206,7 @@ function julia_compile(julia_program, c_program=nothing, build_dir="builddir", v
198206
include($(repr(julia_program))) # include \"julia_program\" file
199207
empty!(Base.LOAD_CACHE_PATH) # reset / remove build-system-relative paths"
200208
command = `$julia_cmd -e $expr`
201-
verbose && println("Populate \".ji\" local cache:\n $command")
209+
verbose && println("Build \".ji\" files local cache:\n $command")
202210
run(command)
203211
command = `$julia_cmd --output-o $o_file -e $expr`
204212
verbose && println("Build object file \"$o_file\":\n $command")

0 commit comments

Comments
 (0)