compile.jl
1 using Pkg: Pkg 2 3 Pkg.activate(joinpath("user", "Load")) 4 Pkg.add("PackageCompiler") 5 using PackageCompiler 6 7 function compile(proj_path="user/Load"; comp_dir="Dist", cpu_target="generic", app=false, update=true, kwargs...) 8 @assert ispath(proj_path) 9 Pkg.activate(proj_path) 10 if update 11 Pkg.update() 12 end 13 ENV["JULIA_PROJECT"] = dirname(Base.active_project()) 14 @assert !isempty(get(ENV, "JULIA_FULL_PRECOMP", "")) 15 ENV["JULIA_PRECOMP"] = ENV["JULIA_FULL_PRECOMP"] 16 name = let dir = dirname(proj_path) 17 if endswith(dir, "src") 18 basename(dirname(dir)) 19 else 20 basename(proj_path) 21 end 22 end 23 if app 24 create_app( 25 proj_path, comp_dir; cpu_target, incremental=true, include_lazy_artifacts=true, kwargs... 26 ) 27 else 28 create_sysimage([name]; cpu_target, sysimage_path="./Planar.so", kwargs...) 29 end 30 end