docs/README-cmake.md
author Sam Lantinga
Sun, 05 Apr 2020 08:58:47 -0700
changeset 13689 c3055b205671
parent 13088 d55db8d27108
permissions -rw-r--r--
Fixed bug 5015 - SDL_RenderReadPixels on DirectX 11.1 backend seems to be broken

Konrad

It appears that I cannot use SDL_RenderReadPixels on a bound framebuffer (SDL_Texture set as render target) as it simply results in gibberish data. However, drawing that framebuffer into the default target (window surface) does render it correctly. Other backends (OpenGL, software, Direct3D) do work fine.

It looks to me like D3D11_RenderReadPixels just gets the general backbuffer and not the current render target and its backbuffer.

Here is the patch which actually fetches the current render target and its underlying ID3D11Resource which is ID3D11Texture2D.
slouken@10486
     1
CMake
gabomdq@9023
     2
================================================================================
slouken@10486
     3
(www.cmake.org)
gabomdq@9023
     4
gabomdq@9023
     5
SDL's build system was traditionally based on autotools. Over time, this
gabomdq@9023
     6
approach has suffered from several issues across the different supported 
gabomdq@9023
     7
platforms.
gabomdq@9023
     8
To solve these problems, a new build system based on CMake is under development.
gabomdq@9023
     9
It works in parallel to the legacy system, so users can experiment with it
gabomdq@9023
    10
without complication.
gabomdq@9023
    11
While still experimental, the build system should be usable on the following
gabomdq@9023
    12
platforms:
philipp@9066
    13
philipp@9066
    14
* FreeBSD
philipp@9066
    15
* Linux
philipp@9066
    16
* VS.NET 2010
philipp@9066
    17
* MinGW and Msys
dludwig@13087
    18
* macOS, iOS, and tvOS, with support for XCode
philipp@9066
    19
philipp@9066
    20
gabomdq@9023
    21
================================================================================
gabomdq@9023
    22
Usage
gabomdq@9023
    23
================================================================================
gabomdq@9023
    24
gabomdq@9023
    25
Assuming the source for SDL is located at ~/sdl
gabomdq@9023
    26
philipp@9066
    27
    cd ~
philipp@9066
    28
    mkdir build
philipp@9066
    29
    cd build
philipp@9066
    30
    cmake ../sdl
gabomdq@9023
    31
gabomdq@9023
    32
This will build the static and dynamic versions of SDL in the ~/build directory.
dludwig@13087
    33
dludwig@13087
    34
dludwig@13087
    35
================================================================================
dludwig@13087
    36
Usage, iOS/tvOS
dludwig@13087
    37
================================================================================
dludwig@13087
    38
dludwig@13087
    39
CMake 3.14+ natively includes support for iOS and tvOS.  SDL binaries may be built
dludwig@13087
    40
using Xcode or Make, possibly among other build-systems.
dludwig@13087
    41
dludwig@13087
    42
When using a recent version of CMake (3.14+), it should be possible to:
dludwig@13087
    43
dludwig@13087
    44
- build SDL for iOS, both static and dynamic
dludwig@13087
    45
- build SDL test apps (as iOS/tvOS .app bundles)
dludwig@13087
    46
- generate a working SDL_config.h for iOS (using SDL_config.h.cmake as a basis)
dludwig@13087
    47
dludwig@13087
    48
To use, set the following CMake variables when running CMake's configuration stage:
dludwig@13087
    49
dludwig@13087
    50
- `CMAKE_SYSTEM_NAME=<OS>`   (either `iOS` or `tvOS`)
dludwig@13087
    51
- `CMAKE_OSX_SYSROOT=<SDK>`  (examples: `iphoneos`, `iphonesimulator`, `iphoneos12.4`, `/full/path/to/iPhoneOS.sdk`,
dludwig@13087
    52
                              `appletvos`, `appletvsimulator`, `appletvos12.4`, `/full/path/to/AppleTVOS.sdk`, etc.)
dludwig@13087
    53
- `CMAKE_OSX_ARCHITECTURES=<semicolon-separated list of CPU architectures>` (example: "arm64;armv7s;x86_64")
dludwig@13087
    54
dludwig@13087
    55
dludwig@13087
    56
### Examples (for iOS/tvOS):
dludwig@13087
    57
dludwig@13087
    58
- for iOS-Simulator, using the latest, installed SDK:
dludwig@13087
    59
dludwig@13087
    60
    `cmake ~/sdl -DCMAKE_SYSTEM_NAME=iOS -DCMAKE_OSX_SYSROOT=iphonesimulator -DCMAKE_OSX_ARCHITECTURES=x86_64`
dludwig@13087
    61
dludwig@13087
    62
- for iOS-Device, using the latest, installed SDK, 64-bit only
dludwig@13087
    63
dludwig@13087
    64
    `cmake ~/sdl -DCMAKE_SYSTEM_NAME=iOS -DCMAKE_OSX_SYSROOT=iphoneos -DCMAKE_OSX_ARCHITECTURES=arm64`
dludwig@13087
    65
dludwig@13087
    66
- for iOS-Device, using the latest, installed SDK, mixed 32/64 bit
dludwig@13087
    67
dludwig@13087
    68
    `cmake ~/sdl -DCMAKE_SYSTEM_NAME=iOS -DCMAKE_OSX_SYSROOT=iphoneos -DCMAKE_OSX_ARCHITECTURES="arm64;armv7s"`
dludwig@13087
    69
dludwig@13087
    70
- for iOS-Device, using a specific SDK revision (iOS 12.4, in this example):
dludwig@13087
    71
dludwig@13087
    72
    `cmake ~/sdl -DCMAKE_SYSTEM_NAME=iOS -DCMAKE_OSX_SYSROOT=iphoneos12.4 -DCMAKE_OSX_ARCHITECTURES=arm64`
dludwig@13087
    73
dludwig@13087
    74
- for iOS-Simulator, using the latest, installed SDK, and building SDL test apps (as .app bundles):
dludwig@13087
    75
dludwig@13087
    76
    `cmake ~/sdl -DSDL_TEST=1 -DCMAKE_SYSTEM_NAME=iOS -DCMAKE_OSX_SYSROOT=iphonesimulator -DCMAKE_OSX_ARCHITECTURES=x86_64`
dludwig@13087
    77
dludwig@13087
    78
- for tvOS-Simulator, using the latest, installed SDK:
dludwig@13087
    79
dludwig@13088
    80
    `cmake ~/sdl -DCMAKE_SYSTEM_NAME=tvOS -DCMAKE_OSX_SYSROOT=appletvsimulator -DCMAKE_OSX_ARCHITECTURES=x86_64`
dludwig@13087
    81
dludwig@13087
    82
- for tvOS-Device, using the latest, installed SDK:
dludwig@13087
    83
dludwig@13088
    84
    `cmake ~/sdl -DCMAKE_SYSTEM_NAME=tvOS -DCMAKE_OSX_SYSROOT=appletvos -DCMAKE_OSX_ARCHITECTURES=arm64`