@@ -6,7 +6,7 @@ The CMake build system is supported on the following platforms:
6
6
7
7
* FreeBSD
8
8
* Linux
9
- * Microsoft Visual C
9
+ * Microsoft Visual Studio
10
10
* MinGW and Msys
11
11
* macOS, iOS, tvOS, and visionOS with support for XCode
12
12
* Android
@@ -20,42 +20,55 @@ The CMake build system is supported on the following platforms:
20
20
* QNX 7.x/8.x
21
21
* RiscOS
22
22
23
- ## Building SDL
23
+ ## Building SDL on Windows
24
24
25
- Assuming the source tree of SDL is located at ` ~/sdl ` ,
26
- this will configure and build SDL in the ` ~/build ` directory:
25
+ Assuming you're in the SDL source directory, building and installing to C:/SDL can be done with:
27
26
``` sh
28
- cmake -S ~ /sdl -B ~ /build
29
- cmake --build ~ /build
27
+ cmake -S . -B build
28
+ cmake --build build --config RelWithDebInfo
29
+ cmake --install build --config RelWithDebInfo --prefix C:/SDL
30
30
```
31
31
32
- Installation can be done using:
32
+ ## Building SDL on UNIX
33
+
34
+ SDL will build with very few dependencies, but for full functionality you should install the packages detailed in [ README-linux.md] ( README-linux.md ) .
35
+
36
+ Assuming you're in the SDL source directory, building and installing to /usr/local can be done with:
33
37
``` sh
34
- cmake --install ~ /build --prefix /usr/local # '--install' requires CMake 3.15, or newer
38
+ cmake -S . -B build
39
+ cmake --build build
40
+ sudo cmake --install build --prefix /usr/local
35
41
```
36
42
37
- This will install SDL to /usr/local.
43
+ ## Building SDL on macOS
44
+
45
+ Assuming you're in the SDL source directory, building and installing to ~ /SDL can be done with:
46
+ ``` sh
47
+ cmake -S . -B build -DSDL_FRAMEWORK=ON -DCMAKE_OSX_ARCHITECTURES=" arm64;x86_64"
48
+ cmake --build build
49
+ cmake --install build --prefix ~ /SDL
50
+ ```
38
51
39
- ### Building SDL tests
52
+ ## Building SDL tests
40
53
41
54
You can build the SDL test programs by adding ` -DSDL_TESTS=ON ` to the first cmake command above:
42
55
``` sh
43
- cmake -S ~ /sdl -B ~ / build -DSDL_TEST_LIBRARY=ON -DSDL_TESTS=ON
56
+ cmake -S . -B build -DSDL_TESTS=ON
44
57
```
45
- and then building normally. In this example, the test programs will be built and can be run from ` ~/ build/tests /` .
58
+ and then building normally. The test programs will be built and can be run from ` build/test / ` .
46
59
47
- ### Building SDL examples
60
+ ## Building SDL examples
48
61
49
62
You can build the SDL example programs by adding ` -DSDL_EXAMPLES=ON ` to the first cmake command above:
50
63
``` sh
51
- cmake -S ~ /sdl -B ~ / build -DSDL_EXAMPLES=ON
64
+ cmake -S . -B build -DSDL_EXAMPLES=ON
52
65
```
53
- and then building normally. In this example, the example programs will be built and can be run from ` ~/ build/examples/` .
66
+ and then building normally. The example programs will be built and can be run from ` build/examples/ ` .
54
67
55
68
## Including SDL in your project
56
69
57
70
SDL can be included in your project in 2 major ways:
58
- - using a system SDL library, provided by your (* nix ) distribution or a package manager
71
+ - using a system SDL library, provided by your (UNIX ) distribution or a package manager
59
72
- using a vendored SDL library: this is SDL copied or symlinked in a subfolder.
60
73
61
74
The following CMake script supports both, depending on the value of ` MYGAME_VENDORED ` .
@@ -181,7 +194,7 @@ Only shared frameworks are supported, no static ones.
181
194
182
195
# ### Platforms
183
196
184
- Use ` -DCMAKE_PLATFORM_NAME =< value> ` to configure the platform. CMake can target only one platform at a time.
197
+ Use ` -DCMAKE_SYSTEM_NAME =< value> ` to configure the platform. CMake can target only one platform at a time.
185
198
186
199
| Apple platform | ` CMAKE_SYSTEM_NAME` value |
187
200
| -----------------| ---------------------------|
0 commit comments