-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #112 from ModiaSim/mo_startup_up
create_Modia3D_sysimage.jl added (to generate a Modia3D sysimage)
- Loading branch information
Showing
3 changed files
with
92 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
# License for this file: MIT (expat) | ||
# Copyright 2022, DLR Institute of System Dynamics and Control | ||
# Author: Martin Otter (DLR) | ||
# | ||
# Execute this script via | ||
# | ||
# include("create_Modia3D_sysimage.jl") | ||
# | ||
# to generate a sysimage of your current project and store it in your current working directory. | ||
# Before generating the sysimage, the following packages are added to your current project (if not yet included): | ||
# | ||
# Modia, Modia3D, ModiaPlot_PyPlot, PackageCompiler, Revise | ||
# | ||
module Create_Modia3D_sysimage | ||
|
||
path = dirname(@__FILE__) | ||
file = joinpath(path, "create_Modia3D_sysimage.jl") | ||
Modia3D_sysimage_path = joinpath(pwd(), Sys.iswindows() ? "Modia3D_sysimage.dll" : "Modia3D_sysimage.so") | ||
|
||
import Pkg | ||
project = Pkg.project() | ||
projectPath = project.path | ||
availablePackages = keys(project.dependencies) | ||
addPackages = setdiff!(["Modia", "Modia3D", "ModiaPlot_PyPlot", "PackageCompiler", "Revise"], availablePackages) | ||
println("!!! Creating sysimage for Modia3D from $file") | ||
println("!!! This will include all packages from project $projectPath") | ||
if length(addPackages) > 0 | ||
println("!!! Additionally, it will include the following packages") | ||
println("!!! $addPackages") | ||
println("!!! that are now added to the project ...") | ||
Pkg.add(addPackages) | ||
end | ||
|
||
using PackageCompiler | ||
create_sysimage(sysimage_path = Modia3D_sysimage_path) | ||
|
||
println("!!! Modia3D sysimage created. Use sysimage by starting julia with:") | ||
println(" julia -J$Modia3D_sysimage_path") | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters