Creating a standalone app on different platforms

Apologies if this is slightly off-topic. I hope it’s relevant to more people in the community, and haven’t overlooked any obvious Julia documentation pages to achieve what I’m trying.

I’m currently developing some software for a client. I’ve designed it so that all the functionality is in a local package and I have a single function in a main.jl file that uses ArgParse.jl to handle command line options and file inputs/outputs.

My question is how to best distribute my software so the client can run it on multiple different computers? In an ideal world, I would instruct my client to download and install Julia from the official website, and then double-click on an install.bat (or similar) file to copy my software to the right place and set up a permanent alias to the executable.

I’ve looked into PackageCompiler.jl, and have successfully compiled my code into an app. But will this app run on Windows if I’ve compiled it on my mac? Or do I need to compile it on a PC with the same target architecture? Any pointers on setting up an ‘install script’ or similar would also be much appreciated.

I believe that with PackageCompiler you have to deploy to a machine with near-identical architecture. There are several talks scheduled at Juliacon that appear to be highly relevant to your question. This one, e.g…

1 Like

In lack of better answers, I think one alternative is to provide two scripts:

mysoftware_install.jl:

import Pkg
Pkg.activate("MySoftware", shared=true)
Pkg.add("MySoftware")
exit()

and make the user run: julia mysoftware_install.jl

Then, mysoftware.jl with:

import Pkg
Pkg.activate("MySoftware", shared=true)
using MySoftware
main(ARGS.... from command line)

and let the user run it with:

julia mysoftware.jl ARGS...

With good precompilation directives you may do most of the compilation work in the install phase, and using the script will be practical.

(You might be considering deploying a Pluto notebook, depending on the case)

And tell your users to use juliaup to install Julia.

6 Likes