CMakeLists.txt
author Ryan C. Gordon <icculus@icculus.org>
Wed, 06 Mar 2019 03:08:45 -0500
changeset 103 685c0014eda1
parent 45 2c4484212926
permissions -rw-r--r--
Optimize dirty rectangle rendering.

Only push the video surface to a texture immediately when the app does
SDL_Flip() or SDL_UpdateRect(0,0,0,0). If it looks like dirty rectangle
rendering, only push when we're in a PumpEvents that's close to 60Hz, under
the assumption that the app isn't in the middle of rendering if they're
pumping the event queue, and that updates to the texture faster than the
refresh rate aren't seen anyhow.

This lets things that render a little in response to every mouse event, like
TuxPaint, run at reasonable speeds and still look correct.

This probably needs to not hardcode for 60Hz, but get the actual refresh rate
from SDL2.
     1 cmake_minimum_required(VERSION 3.0.0)
     2 project(sdl12_compat)
     3 
     4 add_library(SDL SHARED "src/SDL12_compat.c")
     5 
     6 target_include_directories(SDL PUBLIC "/usr/local/include/SDL2")  # !!! FIXME
     7 target_include_directories(SDL PUBLIC "/usr/X11/include")  # !!! FIXME
     8 add_definitions("-D_THREAD_SAFE")  # !!! FIXME
     9 
    10 if(APPLE)
    11     set_target_properties(SDL PROPERTIES
    12         MACOSX_RPATH 1
    13         OUTPUT_NAME "SDL-1.2.0"
    14     )
    15 elseif(UNIX AND NOT ANDROID)
    16     set_target_properties(SDL PROPERTIES
    17         VERSION "1.2.50"
    18         SOVERSION "0"
    19         OUTPUT_NAME "SDL-1.2")
    20 else()
    21     set_target_properties(SDL PROPERTIES
    22         VERSION "1.2.50"
    23         SOVERSION "0"
    24       OUTPUT_NAME "SDL")
    25 endif()
    26 
    27 if(MSVC)
    28     # Don't try to link with the default set of libraries.
    29     set_target_properties(SDL PROPERTIES LINK_FLAGS_RELEASE "/NODEFAULTLIB")
    30     set_target_properties(SDL PROPERTIES LINK_FLAGS_DEBUG "/NODEFAULTLIB")
    31     set_target_properties(SDL PROPERTIES STATIC_LIBRARY_FLAGS "/NODEFAULTLIB")
    32 endif()
    33 
    34 
    35 # test programs...
    36 macro(test_program _NAME _SRCS)
    37     add_executable(${_NAME} ${_SRCS})
    38     target_include_directories(${_NAME} PUBLIC "/usr/local/include/SDL")  # !!! FIXME
    39     target_include_directories(${_NAME} PUBLIC "/usr/X11/include")  # !!! FIXME
    40     target_link_libraries(${_NAME} SDL)
    41 endmacro()
    42 
    43 test_program(testsprite "test/testsprite.c")