Deploy your application
App deployment
MATLAB Compiler can be used to package code into standalone programs. PTB has not been tested for stand-alone use, and some changes to the PTB and Titta code was necessary for things to be properly compiled. These should now be merged, and it should be possible to build without any further problems.
Some of the files below are PLATFORM-DEPENDENT, and need to be changed depending on which OS is being built for. For example libptbdrawtext_ftg l64.dylib
for macOS must be replaced with libptbdrawtext_ftgl64.so.1
for 64bit Linux. One option is to include all of them using -a ~/Code/Psychtoolbox-3/Psychtoolbox/PsychBasic/PsychPlugins/
. In addition you must change the paths to the locations on the computer. Normally I always install all code into ~/Code/
so that is where PTB, opticka and Titta are installed.
The list of folders that needed to be added to compile properly, you can add them with the GUI App Bundle:
-a ~/Code/Psychtoolbox-3/Psychtoolbox/PsychBasic/PsychPlugins/
-a ~/Code/Psychtoolbox-3/Psychtoolbox/PsychOpenGL/MOGL/core
-a ~/Code/Psychtoolbox-3/Psychtoolbox/PsychOpenGL/PsychGLSLShaders
-a ~/Code/opticka/CoreProtocols
-a ~/Code/opticka/DefaultStateInfo.m
-a ~/Code/opticka/communication
-a ~/Code/opticka/tools
-a ~/Code/opticka/stimuli
-a ~/Code/opticka/ui/images
-a ~/Code/opticka/help
-a ~/Code/Titta/SDK_wrapper/TittaMex/
The runtime can be downloaded by the install packager or downloaded manually:
https://www.mathworks.com/help/compiler/install-the-matlab-runtime.html https://www.mathworks.com/help/compiler/mcr-path-settings-for-run-time-deployment.html
Docker
Deployment can also be to a docker image, we will need to test this out…
Command-line
Without starting MATLAB you can use the mcc
command to build from Terminal (replace ^ with \ if you are using bash
or zsh
), indeed this seems to work better than the GUI within MATLAB:
mcc -a ~/Code/Psychtoolbox-3/Psychtoolbox/PsychBasic/PsychPlugins/ ^
-a ~/Code/Psychtoolbox-3/Psychtoolbox/PsychOpenGL/MOGL/core ^
-a ~/Code/Psychtoolbox-3/Psychtoolbox/PsychOpenGL/PsychGLSLShaders ^
-a ~/Code/opticka/CoreProtocols ^
-a ~/Code/opticka/DefaultStateInfo.m ^
-a ~/Code/opticka/communication ^
-a ~/Code/opticka/tools ^
-a ~/Code/opticka/stimuli ^
-a ~/Code/opticka/ui/images ^
-a ~/Code/opticka/help ^
-a ~/Code/Titta/SDK_wrapper/TittaMex/ ^
-R -startmsg,'Runtime Init START' ^
-R -completemsg,'Runime Init FINISH' ^
-d ~/build ^
-m ~/Code/opticka/runOpticka.m