proton:linux_setup
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision | ||
proton:linux_setup [2012/02/26 11:59] – aki | proton:linux_setup [2023/06/08 07:42] – [Grabbing Proton SDK] seth | ||
---|---|---|---|
Line 3: | Line 3: | ||
In order to build the examples on Linux you first need some dependencies installed on your system. All of the needed dependencies are common in Linux distributions so you'll probably find everything needed through your distribution' | In order to build the examples on Linux you first need some dependencies installed on your system. All of the needed dependencies are common in Linux distributions so you'll probably find everything needed through your distribution' | ||
- | The build scripts available for Linux use [[http:// | + | The build scripts available for Linux use [[http:// |
- | === Compiling and running RTBareBones | + | ==== Grabbing Proton SDK ==== |
- | This is the process I follow when compiling the examples. You may vary this to your needs if you want since cmake is quite flexible in what it can do. But it' | + | Ok, this was tested on a Raspberry Pi with Stretch, |
- | + | ||
- | It's a good practice to do so called out-of-source builds. This way the compiled object and other files don't pollute the source directory | + | |
- | + | ||
- | So fire up your console and let's start typing. | + | |
- | + | ||
- | First let's make a directory where the building will happen. | + | |
<code bash> | <code bash> | ||
- | cd RTBareBones/ | + | sudo apt install git |
- | mkdir build | + | cd ~ |
+ | git clone https:// | ||
</ | </ | ||
- | Then enter that directory, | + | Projects you compile are put INTO the Proton |
+ | |||
+ | There is no lib/dll to make for Proton, the .cpp files are just used directly in the projects. | ||
+ | |||
+ | Let' | ||
<code bash> | <code bash> | ||
- | cd build | + | cd proton/ |
- | cmake .. | + | sh linux_compile.sh |
- | make | + | |
</ | </ | ||
- | The argument to cmake (..) tells where it's supposed to search for the CMakeLists.txt build file that tells it what to do. If you make your build directory somewhere else than shown above you would need to adjust this argument accordingly but other than that the process should be exactly the same as here. | + | Hopefully |
- | If the build finishes without errors you'll end up with a binary | + | **Note:** By default, RTPack is compiled |
- | In order to run the compiled program you'll need to change to the directory which contains the images and other resources and execute the binary from there. This way the program can find the resources and load them correctly. | ||
- | <code bash> | + | ==== Compiling and running RTBareBones ==== |
- | cd ../../bin | + | |
- | ../ | + | |
- | </ | + | |
- | Now you should see the application window. | + | This is the process I follow when compiling |
- | + | ||
- | === Compiling and running | + | |
- | The compilation process for the other examples | + | Generally with linux stuff, you make a " |
- | Compiling RTPack is a similar process | + | So to compile RTBareBones, |
<code bash> | <code bash> | ||
- | cd tools/RTPack | + | cd proton/RTBareBones/linux |
- | ./build.sh | + | sh linux_compile.sh |
</ | </ | ||
- | The resulting binary | + | (If you look at linux_compile.sh, |
- | Now let' | + | If the build finishes without errors you'll end up with a binary called '' |
+ | |||
+ | To try it: | ||
<code bash> | <code bash> | ||
- | cd RTSimpleApp/linux | + | cd ../bin |
- | mkdir build | + | ./ |
- | cd build | + | |
- | cmake .. | + | |
- | make | + | |
</ | </ | ||
- | Next we'll build the resources. There is a helper script available that can be used in Linux to do this. There are similar helper scripts for Windows as well. The difference is that while there is a separate Windows script called update_media.bat for each example there is only one script for Linux that tries to take care of all the examples. | + | On my Raspberry Pi I see a spinning triangle fullscreen. Under Gnome or something I assume it would open in a window due to SDL2 being smart? (Not sure, didn't test it. -Seth ) |
- | Run the script | + | ====Compiling |
- | <code bash> | + | The compilation process for the other examples is exactly the same that what was explained for RTBareBones above. |
- | cd ../../media | + | |
- | ../../tools/linux/update_media.sh | + | But in addition the other examples than RTBareBones need resources to be built as explained here: [[proton: |
- | </ | + | |
+ | To do this in linux using RTPack, you need to move into your projects | ||
- | This will convert the fonts and images to correct format and copy the converted resources to the '' | + | Let's build RTSimpleApp, |
<code bash> | <code bash> | ||
+ | cd RTSimpleApp/ | ||
+ | sh linux_compile.sh | ||
+ | cd ../media | ||
+ | sh build_media.sh | ||
cd ../bin | cd ../bin | ||
- | ../linux/ | + | ./RTSimpleApp |
</ | </ | ||
- | The rest of the examples can be compiled | + | If that worked, |
- | == How update_media.sh works == | + | ===How update_media.sh works=== |
The resource building script goes to the subdirectories of the '' | The resource building script goes to the subdirectories of the '' | ||
- | + | ==== Debug builds | |
- | === Debug builds | + | |
The process described above for building the examples produces a binary that can be called a release build. We didn't give any special instructions for cmake so it chose the default settings. Especially the binary doesn' | The process described above for building the examples produces a binary that can be called a release build. We didn't give any special instructions for cmake so it chose the default settings. Especially the binary doesn' | ||
Line 102: | Line 97: | ||
Now you have the debug and release builds in separate subdirectories and they don't mess with each other. You can off course have more subdirectories to different kinds of builds as you desire. | Now you have the debug and release builds in separate subdirectories and they don't mess with each other. You can off course have more subdirectories to different kinds of builds as you desire. | ||
- | == Building == | + | ==== Building |
You basically only have to run cmake manually once per build directory. After that you can just run make. If the CMakeLists.txt file has been changed it is noticed by the build scripts and cmake is run automatically with the same parameters as it was run the first time. | You basically only have to run cmake manually once per build directory. After that you can just run make. If the CMakeLists.txt file has been changed it is noticed by the build scripts and cmake is run automatically with the same parameters as it was run the first time. | ||
- | === IDEs === | + | ==== Command line arguments ==== |
+ | |||
+ | **Note 7/ | ||
+ | |||
+ | The Linux versions of the examples accept a few command line arguments. You can choose the video mode and emulated environment (e.g. iOS, Android, | ||
+ | |||
+ | <code bash> | ||
+ | [user@localhost]$ ./ | ||
+ | Available video modes: | ||
+ | |||
+ | Windows | ||
+ | Windows Wide | ||
+ | OSX | ||
+ | OSX Wide | ||
+ | Linux | ||
+ | Linux Wide | ||
+ | iPhone | ||
+ | iPhone Landscape | ||
+ | [...] | ||
+ | </ | ||
+ | |||
+ | You can choose any of these modes by giving the name of it as an argument to the program. For example testing how an application might look on an iPad you can command: | ||
+ | |||
+ | <code bash> | ||
+ | ./ | ||
+ | </ | ||
+ | |||
+ | Note that you need to enclose modes with spaces between quotes. | ||
+ | |||
+ | ==== IDEs ==== | ||
+ | |||
+ | All of the tools mentioned on this page work from the command line. It means that no IDE is chosen for you beforehand. You are free to use any editor or IDE you like, be it emacs or vi or something more sophisticated. | ||
+ | As a personal preference I'm using QtCreator. It has a nice built-in importer for cmake projects. Although QtCreator is mainly meant for Qt development it's a great IDE for any C++ development. You can open the CMakeLists.txt file with QtCreator and it automatically imports the project in to the IDE. You might need to set some paths or such in the project settings but it's relatively easy to get the building work with Ctrl+B and running with Ctrl+R. QtCreator also has a great UI for debugger. | ||
+ | You can set multiple run configurations so you can run the applications with different command line arguments for example - perhaps setting a different window resolution for each configuration. | ||
proton/linux_setup.txt · Last modified: 2023/06/08 13:21 by seth