Skip to content
This repository has been archived by the owner on Oct 23, 2022. It is now read-only.

Commit

Permalink
Move sysimage code (#36)
Browse files Browse the repository at this point in the history
* remove Sysimage submodule, move code to deps/

* rm include(Sysimage.jl)
  • Loading branch information
alfredclwong committed Mar 23, 2021
1 parent 0529188 commit d38004a
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 8 deletions.
2 changes: 1 addition & 1 deletion Precompile.jl → deps/precompile.jl
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE

using OpticSim
using OpticSim # this will only work after the main build steps are completed
@info "Running representative workload"
# add stuff here #
Examples.autodrawrays()
Expand Down
7 changes: 2 additions & 5 deletions src/Sysimage.jl → deps/sysimage.jl
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,16 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE

module Sysimage
import Pkg, Libdl, PackageCompiler

function compile(sysimage_path = "JuliaSysimage.$(Libdl.dlext)")
env_to_precompile = joinpath(@__DIR__, "..")
precompile_execution_file = joinpath(env_to_precompile, "Precompile.jl")
precompile_execution_file = joinpath(@__DIR__, "precompile.jl")
project_filename = joinpath(env_to_precompile, "Project.toml")
project = Pkg.API.read_project(project_filename)
used_packages = Symbol.(collect(keys(project.deps)))
# don't need these ever after building this so no need to have them in the sysimage
used_packages = filter(x -> x [:Libdl, :PackageCompiler, :Pkg], used_packages)
filter!(x -> x [:Libdl, :PackageCompiler, :Pkg], used_packages)
if Libdl.dlext == "dll"
@warn "Ignoring packages which use gl dlls on Windows as these cause build errors"
# see https://github.com/JuliaLang/PackageCompiler.jl/issues/365
Expand All @@ -40,5 +39,3 @@ function compile(sysimage_path = "JuliaSysimage.$(Libdl.dlext)")
@info "Building a custom sysimage for OpticSim.jl."
PackageCompiler.create_sysimage(used_packages, sysimage_path = sysimage_path, project = env_to_precompile, precompile_execution_file = precompile_execution_file)
end

end # module Sysimage
2 changes: 0 additions & 2 deletions src/OpticSim.jl
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,6 @@ include("Visualization.jl")
include("Examples.jl")
include("Optimization/Optimizable.jl")

include("Sysimage.jl")

################################################

# This can be used to track NaN, particularly in ForwardDiff gradients, causing problems
Expand Down

0 comments on commit d38004a

Please sign in to comment.