This means it is possible to build an SDL that has support for all sorts of targets built in, and it will examine the system at runtime to decide what should be used (for example, if Xlib isn't available, it might try to load Wayland support, etc). Every thing else it needs will be dynamically loaded at runtime: X11, ALSA, d-bus, etc. SDL on Unix should only link against the C runtime (glibc). Gcc -o myprogram myprogram.c ` sdl2-config -cflags -libs ` There is also ccmake for the console aficionados. CMake does not provide you with a -help option to show all available configuration options, but it provides a GUI to change configuration options: cmake-gui. It works on similar principles to the configure script. A good rule of thumb for Linux is the number of cores plus two, so you use all the processing resources possible, and if a process or two is competing for the disk, those two extra jobs might be able to put the otherwise-idle CPU cores to work in the meantime (so on a four-core system? Try "make -j6".)Īn alternative to the configure script is the CMake project file. "make" could be "make -j4" or whatever if you have more than one CPU SDL can safely be built in parallel across all the CPU cores you have available to you. SDL tries to do the right thing by default, though, so you can usually get away with no options at all. In fact, there are a LOT of good options you can use with configure! Be sure to check out its -help option for details. You can change this to a different location with the -prefix option to the configure script. The last command says "sudo" so we can write it to /usr/local (by default). Git clone -b SDL2 cd SDL mkdir build cd build. Run "make install" to install your new SDL build on the system. Run the configure script to set things up.Make a separate build directory (SDL will refuse to build in the base of the source tree).Get a copy of the source code, either from Mercurial or an official tarball or whatever.If you're compiling SDL yourself, here's what we refer to as "the Unix way" of building: Gentoo users can sudo emerge libsdl2 to get everything they need. Red Hat-based systems (including Fedora) can simply do sudo dnf install SDL2 to get the library installed system-wide, or "sudo dnf install SDL2-devel" to get headers and other build requirements ready for compiling your own SDL programs. Please see docs/README-linux.md for a more complete discussion of packages involved. sudo apt-get install libsdl2-dev will install everything necessary to build programs that use SDL. SDL supports most popular flavors of Unix: Linux 2.6+, the various BSDs (FreeBSD, NetBSD, OpenBSD), Solaris, and other things like them.įirst! Do you need to compile SDL yourself? It's possible your distribution's package manager already did it for you!ĭebian-based systems (including Ubuntu) can simply do sudo apt-get install libsdl2-2.0-0 to get the library installed system-wide, and all sorts of other useful dependencies, too. Several other platforms will be built "the Unix way," so we'll describe this platform first. You may not statically link SDL 1.2 in most cases due to its LGPL licensing, but you should really stop using SDL 1.2 anyhow. However, we encourage you to not do this for various technical and moral reasons (see docs/README-dynapi.md), and won't cover the details of how to in this document. SDL 2.0, unlike 1.2, uses the zlib license, which means you can build a static library linked directly to your program, or just compile SDL's C code directly as part of your project. Some of these installation instructions happen to work with 1.2, however, on the platforms we cover. It can be installed on legacy platforms that SDL2 doesn't support, such as Mac OS 9 or Windows 95, but settling for 1.2 would not be a drop-in replacement for 2.0. You will need to download the source code first for most of them, unless prebuilt binaries are available. How to install SDL varies depending on your platform.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |