User Tools

Site Tools


proton:linux_setup

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
proton:linux_setup [2018/07/28 09:08] – [Compiling and running RTBareBones] sethproton:linux_setup [2023/06/08 13:21] (current) – [IDEs] seth
Line 1: Line 1:
 ==== Compiling the examples for Linux ==== ==== Compiling the examples for Linux ====
  
-In order to build the examples on Linux you first need some dependencies installed on your systemAll of the needed dependencies are common in Linux distributions so you'll probably find everything needed through your distribution's package manager. The name of the packages vary slightly from distribution to another so you'll might need to search for the specific names a little.+This page will tell you how to get some examples compiling under Linux.  I'm using the latest Ubuntu as of June 8th, 2023 for this test The binaries should run both under the desktop, or from bash without the desktop environment running.
  
-The build scripts available for Linux use [[http://www.cmake.org/|cmake]] so you have to have that installed. In addition you need a bunch of other usual build tools like gcc, libc, make and possibly others. The Linux version uses SDL so you'll also need some development packages for SDL2. It's usually called SDL2-devel and in order to hear sounds you'll also need SDL2_mixer-devel. This is not a complete list of the dependencies so you might need to try if the building succeeds and if not then install some more dependencies. Sometimes the build process outputs a sane error message that tells what is missing, sometimes it doesn't. Good luck :-P+The examples may have weird window sizes and in non-desktop environments things like mouse cursor movement won'work.
  
 ==== Grabbing Proton SDK ==== ==== Grabbing Proton SDK ====
  
-Okthis was tested on a Raspberry Pi with Stretch, but normal linux distributions should be roughly the same.+Firstlet's install some tools and libraries we need in case you don't have them. 
 +<code bash> 
 +sudo apt install git build-essential libffi-dev zlib1g-dev libssl-dev 
 +</code> 
 + 
 +Now we'll grab the ProtonSDK source tree from git.
  
 <code bash> <code bash>
Line 14: Line 19:
 </code> </code>
  
-Projects you compile are put INTO the Proton directory.  Sort of weird, but the end result is all paths and dependencies are relative when possible which make compiled for many platforms easier.  Nothing to setup.+Projects you compile are put INTO the Proton directory.  Sort of weird, but the end result is all paths and dependencies are relative when possible which make compiling for many platforms easier.  Nothing to setup.
  
 There is no lib/dll to make for Proton, the .cpp files are just used directly in the projects.  There is however a tool called RTPack that is used to build fonts (.rtfont files), images (.rttex files, don't have to use them though), and general purpose compression. (one gotcha: compressed files use the .rtpack extension EXCEPT .rtfont/.rttex, those keep the same extension.  Proton's file handling automatically decompresses things when needed) There is no lib/dll to make for Proton, the .cpp files are just used directly in the projects.  There is however a tool called RTPack that is used to build fonts (.rtfont files), images (.rttex files, don't have to use them though), and general purpose compression. (one gotcha: compressed files use the .rtpack extension EXCEPT .rtfont/.rttex, those keep the same extension.  Proton's file handling automatically decompresses things when needed)
Line 36: Line 41:
 Generally with linux stuff, you make a "build" directory and do your stuff there.  We do that too, but we do it from the <project name>/linux/build which is slightly different.  This is a side effect of linux related things being relegated to the linux dir due to the originally window-centric approach of Proton. Generally with linux stuff, you make a "build" directory and do your stuff there.  We do that too, but we do it from the <project name>/linux/build which is slightly different.  This is a side effect of linux related things being relegated to the linux dir due to the originally window-centric approach of Proton.
  
-So to compile RTBareBones, just do:+Before building RTBareBones, your system will need some sdl2 libs, this helps with video and graphics, something RTPack didn't need.  Do this:
  
 <code bash> <code bash>
-cd proton/RTBareBones/linux+sudo apt-get install libsdl2-dev libsdl2-image-dev libsdl2-mixer-dev 
 +</code> 
 + 
 + 
 +Before we compile it, we need to build the media.  This is where we build fonts, and convert jpg/pngs etc into more optimized formats.  (this doesn't stop you from loading jpgs/pngs directly if you want, but that's just how these examples were built) 
 + 
 +<code bash> 
 +cd ~/proton/RTBareBones/media 
 +sh update_media.sh 
 +</code> 
 + 
 +Now we need to compile RTBareBones, just do: 
 + 
 +<code bash> 
 +cd ~/proton/RTBareBones/linux
 sh linux_compile.sh sh linux_compile.sh
 </code> </code>
Line 52: Line 71:
 cd ../bin cd ../bin
 ./RTBareBones ./RTBareBones
-</bash> +</code>
- +
-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 )+
  
 +You should see a spinning triangle and some font stretching effects.
 ====Compiling and running the other examples==== ====Compiling and running the other examples====
  
-The compilation process for the other examples is exactly the same that what was explained for RTBareBones above. But in addition the other examples than RTBareBones need resources to be built as explained here: [[proton:win_setup2|Compiling RTSimpleApp]]. You can do this resource building in Linux as well. The difference is that you need to compile the RTPack tool before it can be done.+The compilation process for the other examples is exactly the same that what was explained for RTBareBones above. 
  
-For instructions how to compile RTPack in Linux see [[proton:rtpack|instructions from here]].+But in addition the other examples than RTBareBones need resources to be built as explained here: [[proton:win_setup2|Compiling RTSimpleApp]]. 
  
-The resulting binary called ''RTPack'' will appear to a subdirectory called ''build''Let it stay there.+To do this in linux using RTPack, you need to move into your projects media directory and run build_media.sh, which itself runs RTPack/linux/build_media.sh to do the work.
  
-Now let's build RTSimpleApp just like RTBareBones:+Let's build RTSimpleApp, then build its media:
  
 <code bash> <code bash>
 cd RTSimpleApp/linux cd RTSimpleApp/linux
-mkdir build +sh linux_compile.sh 
-cd build +cd ../media 
-cmake .. +sh build_media.sh
-make +
-</code> +
- +
-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. +
- +
-Run the script and see it do its job: +
- +
-<code bash> +
-cd ../../media +
-../../tools/linux/update_media.sh +
-</code> +
- +
-This will convert the fonts and images to correct format and copy the converted resources to the ''bin'' directory of the example. Next you can run the example: +
- +
-<code bash>+
 cd ../bin cd ../bin
-../linux/build/rtsimpleapp+./RTSimpleApp
 </code> </code>
  
-The rest of the examples can be compiled and run in a similar way.+If that worked, the final stuff (.rtfont and .rttex and .rtpack files probably) will be copied into ../bin/interface, and you'll run the app.
  
 ===How update_media.sh works=== ===How update_media.sh works===
  
 The resource building script goes to the subdirectories of the ''media'' directory and converts fonts and images to the Proton format. It uses a configuration file called ''texture_conversion_flags.txt'' that contains options for converting the images. The examples' ''media'' directories already contain these configuration files but if you'll build your own applications and want to use this system make sure you have these files in place. The resource building script goes to the subdirectories of the ''media'' directory and converts fonts and images to the Proton format. It uses a configuration file called ''texture_conversion_flags.txt'' that contains options for converting the images. The examples' ''media'' directories already contain these configuration files but if you'll build your own applications and want to use this system make sure you have these files in place.
- 
 ==== Debug builds  ==== ==== Debug builds  ====
  
Line 116: Line 118:
 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.
  
-==== Command line arguments ==== 
- 
-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,...) from a predefined set of presets. You can get a list of the available modes by running any of the examples with option ''-l''. 
- 
-<code bash> 
-[user@localhost]$ ./rtsimpleapp -l 
-Available video modes: 
- 
-Windows 
-Windows Wide 
-OSX 
-OSX Wide 
-Linux 
-Linux Wide 
-iPhone 
-iPhone Landscape 
-[...] 
-</code> 
- 
-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> 
-./rtsimpleapp "iPad Landscape" 
-</code> 
- 
-Note that you need to enclose modes with spaces between quotes. 
  
 ==== IDEs ==== ==== IDEs ====
  
-All of the tools mentioned on this page work from the command lineIt means that no IDE is chosen for you beforehand. You are free to use any editor or IDE you likebe it emacs or vi or something more sophisticated. +I've gotten things to work ok with VScode, I use it remotely on my Windows machine and ssh into the linux box I set the project dir to "proton/RTBareBones" for exampleand with the CMake Tools active I can specify the linux/CMakeLists.txt file to build and debug with.
- +
-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.+The only problem is I can't get breakpoints in ../proton/shared files to hit, even though I've added the folder to the project and played with source mapping, hrmph.
  
proton/linux_setup.1532768918.txt.gz · Last modified: 2018/07/28 09:08 by seth