Added documentation for rename_symbols.py

This commit is contained in:
Sam Lantinga 2022-12-23 15:58:15 -08:00
parent 759f98085a
commit fd0631fd35
2 changed files with 12 additions and 2 deletions

View File

@ -2,10 +2,17 @@
This guide provides useful information for migrating applications from SDL 2.0 to SDL 3.0.
We have provided a handy Python script to automate some of this work for you [link to script], and details on the changes are organized by SDL 2.0 header below.
Details on API changes are organized by SDL 2.0 header below.
We have provided a handy Python script [rename_symbols.py](https://github.com/libsdl-org/SDL/blob/main/build-scripts/rename_symbols.py) to rename SDL2 functions to their SDL3 counterparts:
```sh
rename_symbols.py --all-symbols source_code_path
```
SDL headers should now be included as `#include <SDL3/SDL.h>`. Typically that's the only header you'll need in your application unless you are using OpenGL or Vulkan functionality.
The file with your main() function should also include <SDL3/SDL_main.h>, see below in the SDL_main.h section.
CMake users should use this snippet to include SDL support in their project:
```
find_package(SDL3 REQUIRED CONFIG REQUIRED COMPONENTS SDL3)
@ -26,7 +33,7 @@ LDFLAGS += $(shell pkg-config sdl3 --libs)
The SDL3test library has been renamed SDL3_test.
There is no static SDLmain library anymore, it's now header-only, see below in the SDL_main.h section.
There is no SDLmain library anymore, it's now header-only, see below in the SDL_main.h section.
begin_code.h and close_code.h in the public headers have been renamed to SDL_begin_code.h and SDL_close_code.h. These aren't meant to be included directly by applications, but if your application did, please update your `#include` lines.

View File

@ -31,6 +31,9 @@
/* The new function names are recommended, but if you want to have the
* old names available while you are in the process of migrating code
* to SDL3, you can define `SDL_ENABLE_OLD_NAMES` in your project.
*
* You can use https://github.com/libsdl-org/SDL/blob/main/build-scripts/rename_symbols.py to mass rename the symbols defined here in your codebase:
* rename_symbols.py --all-symbols source_code_path
*/
#ifdef SDL_ENABLE_OLD_NAMES