answered
2014-02-01 13:50:34 +0200
Kontio 4995 ●58 ●54 ●63 moderator
SDL 2.0 is available on the device. No need to wrap it into a Qt5 app, but you have to do all by hand (cross compiling, rpm packaging etc). I can't give you here a step by step how to, but some pointers which hopefully help.
The Mer Platform SDKwith a Sailfish OS target provides easy tools, to cross compile your application. You don't need to set up and configure that your self, you can get that in a Virtual Box environment for free from the Sailfish OS SDK. So go to https://sailfishos.org/ and download the the Sailfish SDK and install it.
Just to test that all is working you could go through these steps (optional).
You don't need the Qt Creator any longer. Just ensure the "MerSDK" Virtual Box machine is running, since the cross compilation is done inside the Virtual Box. You can start it from the Oracle VM VirtualBox Manager.
You can run the compile commands through the Virtual Box window. Or what I would recommend, you log in via ssh to the build engine to run the compile commands. See the question How do I login into the emulator or build engine? resp. the answer to how to login to the Build Engine. Login as user mersdk
.
The sb2
command and it's helper tools sb2-*
are the tool used to do the cross compilation. The Mer wiki has a nice introduction to sb2
. In the Build Engine the available sb2
targets are:
$ sb2-config -l
SailfishOS-armv7hl
SailfishOS-i486-x86
The SailfishOS-armv7hl
target is used to build binaries for the device, the SailfishOS-i486-x86
target can be used for Sailfish OS Emulator Virtual Boxes. So for any sb2
commands you run, use the option -t
to tell sb2
with which target you want to operate.
sb2 -t SailfishOS-armv7hl .....
With sb2-config -d SailfishOS-armv7hl
you can configure SailfishOS-armv7hl
to be the default target. So you don't need to provide the -t
option.
The SailfishOS-armv7hl
target has the SDL headers or cmake
not pre installed. Search for the SDL2 devel packages:
sb2 -t SailfishOS-armv7hl -m sdk-install -R zypper search sdl cmake
And install the needed packages:
sb2 -t SailfishOS-armv7hl -m sdk-install -R zypper install SDL2-devel cmake
Your project might need other SDL2-*-devel
packages or headers files. Search and install them the same way.
Now you can start compiling, use the cmake
command as usual, just put sb2 -t SailfishOS-armv7hl
always in front of it.
To create an RPM package, you need a .spec
file. If you have done these steps, you get a good base to start from. Replace the qmake
commands with your cmake
commands. To build the RPM you can use the mb2
tool (it needs the same -t
option as sb2
):
mb2 -t SailfishOS-armv7hl -s path/to/my_sdl_project.spec build
If all goes well you have an RPM package. If you want to submit it to Harbour, you have to ensure it's packaged correctly (see also the Harbour FAQs). Use the rpmvalidation.sh
command to verify, if the RPM can be accepted.
Update: 03. March 2015 SDL2 apps are now allowed in Harbour, updated the text accordingly.