Someone else did this before me, but I can't find the gist anymore so I'll make another one. I'm going to be using this for my personal projects in the future, including this one. This is going to be a Linux tutorial, and for now I've been using Fedora, but it should be cross-distro compatible. Actually this is for CLion, but looking at it once more, I think it is applicable to other IDEs, as well as just manually doing it on your own. But I won't help you with that!
You MUST install VitaSDK first, because that includes all of the community-made compiler and such that work to create PS Vita applications. You should be able to find this here.
You must also get the samples to follow this tutorial, as they are necessary to get you started with the libraries you'll need to work with the Vita.
I have it free with my uni, you must get a license and install it, I'm not going to explain how to do this part.
Create a new project or open one of the samples (I recommend the Hello World one). Now we'll be setting it up!
This is for users who, like me, use flatpak instead of compiling every release time :D
In order for it to work, you need to setup CLion like this in Flatseal:
- Go to filesystem section, and add
/usr/local
- In environment variables:
VITASDK=/run/host/usr/local/vitasdk
PATH=/run/host/usr/local/vitasdk/bin:/app/bin:/usr/bin
Now you should be able to continue with the tutorial. Restart CLion and wait before reopening it. It may need more than one restart.
Look at the picture below. What we need to do is create a new Toolchain for CLion to use, which is what VitaSDK is (duh).
- First, open the settings by pressing CTRL+ALT+S, or by going to the hamburger menu on the top left, then File, then Settings
- Go on Build Execution, Deployment
- Select Toolchain
Click on the + icon like on the picture:
Then, change the C compilers and debuggers like this:
- C:
/run/host/usr/local/vitasdk/bin/arm-vita-eabi-gcc
- C++:
/run/host/usr/local/vitasdk/bin/arm-vita-eabi-g++
- Debugger:
/run/host/usr/local/vitasdk/bin/arm-vita-eabi-gdb
It should now work. Click OK and Apply.
Go again into the menu from before, but this time select the option below Toolchain, which is CMake. Create a new profile there, that looks something like this:
- Change the name to PS Vita or whatever you want
- Setup the build type, I'm using Release
- Use the toolchain we created before
- The rest leave it blank, it shouldn't be needed anymore since some updates ago to CLion and Flatpak.
In the menu at the top right, you should be able to choose whatever for building, and in our case, we always want to build as a vpk so that we can test the changes by just reinstalling the file.
If you don't have this, then it means that u have to change the CMakeLists file, to one that matches what the Vita compile wants. I'd recommend copying the one that you find in the Hello World, as it has a small tutorial inside that tells you how to modify it. Also, remember to change the directories or just straight up copy the "common" folder from the samples folder onto your project, because it contains the things necessary to build a vpk!
This should do it. At least it did for me. You may comment on this gist to help others out if you find any problems!