Skip to content

Commit 1cedf5d

Browse files
committed
Add "--compile" flag
1 parent 05a3345 commit 1cedf5d

File tree

2 files changed

+22
-8
lines changed

2 files changed

+22
-8
lines changed

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ optional arguments:
2424
-c, --clean delete builddir
2525
-J, --sysimage <file>
2626
start up with the given system image file
27+
--compile {yes|no|all|min}
28+
enable or disable JIT compiler, or request
29+
exhaustive compilation
2730
-C, --cpu-target <target>
2831
limit usage of CPU features up to <target>
2932
-O, --optimize {0,1,2,3}
@@ -103,3 +106,6 @@ sections in the Julia manual.
103106
With Julia 0.7, a single large binary can be created, which does not
104107
require the driver program to load the shared library. An example of
105108
that is in `program2.c`, where the image file is the binary itself.
109+
110+
For more information on embedding Julia see:\
111+
https://github.com/JuliaLang/julia/blob/master/doc/src/manual/embedding.md

juliac.jl

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,12 @@ function main(args)
3838
default = nothing
3939
metavar = "<file>"
4040
help = "start up with the given system image file"
41+
"--compile"
42+
arg_type = String
43+
default = nothing
44+
metavar = "{yes|no|all|min}"
45+
range_tester = (x -> x == "yes" || x == "no" || x == "all" || x == "min")
46+
help = "enable or disable JIT compiler, or request exhaustive compilation"
4147
"--cpu-target", "-C"
4248
arg_type = String
4349
default = nothing
@@ -46,39 +52,39 @@ function main(args)
4652
"--optimize", "-O"
4753
arg_type = Int
4854
default = nothing
49-
range_tester = (x -> 0 <= x <= 3)
5055
metavar = "{0,1,2,3}"
56+
range_tester = (x -> 0 <= x <= 3)
5157
help = "set optimization level"
5258
"-g"
5359
arg_type = Int
5460
default = nothing
55-
range_tester = (x -> 0 <= x <= 2)
5661
dest_name = "debug"
5762
metavar = "{0,1,2}"
63+
range_tester = (x -> 0 <= x <= 2)
5864
help = "set debugging information level"
5965
"--inline"
6066
arg_type = String
6167
default = nothing
62-
range_tester = (x -> x == "yes" || x == "no")
6368
metavar = "{yes|no}"
69+
range_tester = (x -> x == "yes" || x == "no")
6470
help = "control whether inlining is permitted"
6571
"--check-bounds"
6672
arg_type = String
6773
default = nothing
68-
range_tester = (x -> x == "yes" || x == "no")
6974
metavar = "{yes|no}"
75+
range_tester = (x -> x == "yes" || x == "no")
7076
help = "emit bounds checks always or never"
7177
"--math-mode"
7278
arg_type = String
7379
default = nothing
74-
range_tester = (x -> x == "ieee" || x == "fast")
7580
metavar = "{ieee,fast}"
81+
range_tester = (x -> x == "ieee" || x == "fast")
7682
help = "set floating point optimizations"
7783
"--depwarn"
7884
arg_type = String
7985
default = nothing
80-
range_tester = (x -> x == "yes" || x == "no" || x == "error")
8186
metavar = "{yes|no|error}"
87+
range_tester = (x -> x == "yes" || x == "no" || x == "error")
8288
help = "set syntax and method deprecation warnings"
8389
"--object", "-o"
8490
action = :store_true
@@ -117,6 +123,7 @@ function main(args)
117123
parsed_args["quiet"],
118124
parsed_args["clean"],
119125
parsed_args["sysimage"],
126+
parsed_args["compile"],
120127
parsed_args["cpu-target"],
121128
parsed_args["optimize"],
122129
parsed_args["debug"],
@@ -132,8 +139,8 @@ function main(args)
132139
end
133140

134141
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,
142+
clean=false, sysimage = nothing, compile=nothing, cpu_target=nothing, optimize=nothing,
143+
debug=nothing, inline=nothing, check_bounds=nothing, math_mode=nothing, depwarn=nothing,
137144
object=false, shared=false, executable=true, julialibs=true)
138145

139146
verbose && quiet && (verbose = false)
@@ -191,6 +198,7 @@ function julia_compile(julia_program, c_program=nothing, build_dir="builddir", v
191198
end
192199
sysimage == nothing || (julia_cmd.exec[3] = "-J$sysimage")
193200
push!(julia_cmd.exec, "--startup-file=no")
201+
compile == nothing || (julia_cmd.exec[4] = "--compile=$compile")
194202
cpu_target == nothing || (julia_cmd.exec[2] = "-C$cpu_target")
195203
optimize == nothing || push!(julia_cmd.exec, "-O$optimize")
196204
debug == nothing || push!(julia_cmd.exec, "-g$debug")

0 commit comments

Comments
 (0)