test/CMakeLists.txt
author Sam Lantinga <slouken@libsdl.org>
Sun, 07 Jul 2019 09:10:56 -0700
changeset 12928 3c4a4b1077cd
parent 11901 e4d03d8733f3
child 13083 6d31d5218c2c
permissions -rw-r--r--
Fixed bug 4710 - audio/alsa: avoid configuring hardware parameters with only a single period

Anthony Pesch

The previous code first configured the period size using snd_pcm_hw_par-
ams_set_period_size_near. Then, it further narrowed the configuration
space by calling snd_pcm_hw_params_set_buffer_size_near using a buffer
size of 2 times the _requested_ period size in order to try and get a
configuration with only 2 periods. If the configured period size was
larger than the requested size, the second call could inadvertently
narrow the configuration space to contain only a single period.

Rather than fixing the call to snd_pcm_hw_params_set_buffer_size_near
to use a size of 2 times the configured period size, the code has been
changed to use snd_pcm_hw_params_set_periods_min in order to more
clearly explain the intent.
slouken@11901
     1
cmake_minimum_required(VERSION 2.8.11)
slouken@11901
     2
project(SDL2 C)
slouken@11901
     3
slouken@11901
     4
# Global settings for all of the test targets
slouken@11901
     5
# FIXME: is this wrong?
slouken@11901
     6
remove_definitions(-DUSING_GENERATED_CONFIG_H)
slouken@11901
     7
link_libraries(SDL2_test SDL2-static)
slouken@11901
     8
slouken@11901
     9
# FIXME: Parent directory CMakeLists.txt only sets these for mingw/cygwin,
slouken@11901
    10
# but we need them for VS as well.
slouken@11901
    11
if(WINDOWS)
slouken@11901
    12
    link_libraries(SDL2main)
slouken@11901
    13
    add_definitions(-Dmain=SDL_main)
slouken@11901
    14
endif()
slouken@11901
    15
slouken@11901
    16
add_executable(checkkeys checkkeys.c)
slouken@11901
    17
add_executable(loopwave loopwave.c)
slouken@11901
    18
add_executable(loopwavequeue loopwavequeue.c)
slouken@11901
    19
add_executable(testresample testresample.c)
slouken@11901
    20
add_executable(testaudioinfo testaudioinfo.c)
slouken@11901
    21
slouken@11901
    22
file(GLOB TESTAUTOMATION_SOURCE_FILES testautomation*.c)
slouken@11901
    23
add_executable(testautomation ${TESTAUTOMATION_SOURCE_FILES})
slouken@11901
    24
slouken@11901
    25
add_executable(testmultiaudio testmultiaudio.c)
slouken@11901
    26
add_executable(testaudiohotplug testaudiohotplug.c)
slouken@11901
    27
add_executable(testaudiocapture testaudiocapture.c)
slouken@11901
    28
add_executable(testatomic testatomic.c)
slouken@11901
    29
add_executable(testintersections testintersections.c)
slouken@11901
    30
add_executable(testrelative testrelative.c)
slouken@11901
    31
add_executable(testhittesting testhittesting.c)
slouken@11901
    32
add_executable(testdraw2 testdraw2.c)
slouken@11901
    33
add_executable(testdrawchessboard testdrawchessboard.c)
slouken@11901
    34
add_executable(testdropfile testdropfile.c)
slouken@11901
    35
add_executable(testerror testerror.c)
slouken@11901
    36
add_executable(testfile testfile.c)
slouken@11901
    37
add_executable(testgamecontroller testgamecontroller.c)
slouken@11901
    38
add_executable(testgesture testgesture.c)
slouken@11901
    39
add_executable(testgl2 testgl2.c)
slouken@11901
    40
add_executable(testgles testgles.c)
slouken@11901
    41
add_executable(testgles2 testgles2.c)
slouken@11901
    42
add_executable(testhaptic testhaptic.c)
slouken@11901
    43
add_executable(testhotplug testhotplug.c)
slouken@11901
    44
add_executable(testrumble testrumble.c)
slouken@11901
    45
add_executable(testthread testthread.c)
slouken@11901
    46
add_executable(testiconv testiconv.c)
slouken@11901
    47
add_executable(testime testime.c)
slouken@11901
    48
add_executable(testjoystick testjoystick.c)
slouken@11901
    49
add_executable(testkeys testkeys.c)
slouken@11901
    50
add_executable(testloadso testloadso.c)
slouken@11901
    51
add_executable(testlock testlock.c)
slouken@11901
    52
slouken@11901
    53
if(APPLE)
slouken@11901
    54
    add_executable(testnative testnative.c
slouken@11901
    55
                              testnativecocoa.m
slouken@11901
    56
                              testnativex11.c)
slouken@11901
    57
elseif(WINDOWS)
slouken@11901
    58
    add_executable(testnative testnative.c testnativew32.c)
slouken@11901
    59
elseif(UNIX)
slouken@11901
    60
    add_executable(testnative testnative.c testnativex11.c)
slouken@11901
    61
endif()
slouken@11901
    62
slouken@11901
    63
add_executable(testoverlay2 testoverlay2.c testyuv_cvt.c)
slouken@11901
    64
add_executable(testplatform testplatform.c)
slouken@11901
    65
add_executable(testpower testpower.c)
slouken@11901
    66
add_executable(testfilesystem testfilesystem.c)
slouken@11901
    67
add_executable(testrendertarget testrendertarget.c)
slouken@11901
    68
add_executable(testscale testscale.c)
slouken@11901
    69
add_executable(testsem testsem.c)
slouken@11901
    70
add_executable(testshader testshader.c)
slouken@11901
    71
add_executable(testshape testshape.c)
slouken@11901
    72
add_executable(testsprite2 testsprite2.c)
slouken@11901
    73
add_executable(testspriteminimal testspriteminimal.c)
slouken@11901
    74
add_executable(teststreaming teststreaming.c)
slouken@11901
    75
add_executable(testtimer testtimer.c)
slouken@11901
    76
add_executable(testver testver.c)
slouken@11901
    77
add_executable(testviewport testviewport.c)
slouken@11901
    78
add_executable(testwm2 testwm2.c)
slouken@11901
    79
add_executable(testyuv testyuv.c testyuv_cvt.c)
slouken@11901
    80
add_executable(torturethread torturethread.c)
slouken@11901
    81
add_executable(testrendercopyex testrendercopyex.c)
slouken@11901
    82
add_executable(testmessage testmessage.c)
slouken@11901
    83
add_executable(testdisplayinfo testdisplayinfo.c)
slouken@11901
    84
add_executable(testqsort testqsort.c)
slouken@11901
    85
add_executable(testbounds testbounds.c)
slouken@11901
    86
add_executable(testcustomcursor testcustomcursor.c)
slouken@11901
    87
add_executable(controllermap controllermap.c)
slouken@11901
    88
add_executable(testvulkan testvulkan.c)
slouken@11901
    89
slouken@11901
    90
# HACK: Dummy target to cause the resource files to be copied to the build directory.
slouken@11901
    91
# Need to make it an executable so we can use the TARGET_FILE_DIR generator expression.
slouken@11901
    92
# This is needed so they get copied to the correct Debug/Release subdirectory in Xcode.
slouken@11901
    93
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/resources_dummy.c "int main(int argc, const char **argv){ return 1; }\n")
slouken@11901
    94
add_executable(SDL2_test_resoureces ${CMAKE_CURRENT_BINARY_DIR}/resources_dummy.c)
slouken@11901
    95
slouken@11901
    96
file(GLOB RESOURCE_FILES *.bmp *.wav)
slouken@11901
    97
foreach(RESOURCE_FILE ${RESOURCE_FILES})
slouken@11901
    98
    add_custom_command(TARGET SDL2_test_resoureces POST_BUILD COMMAND ${CMAKE_COMMAND} ARGS -E copy_if_different ${RESOURCE_FILE} $<TARGET_FILE_DIR:SDL2_test_resoureces>)
slouken@11901
    99
endforeach(RESOURCE_FILE)
slouken@11901
   100
slouken@11901
   101
file(COPY ${RESOURCE_FILES} DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
slouken@11901
   102
slouken@11901
   103
# TODO: Might be easier to make all targets depend on the resources...?
slouken@11901
   104
add_dependencies(testscale SDL2_test_resoureces)
slouken@11901
   105
add_dependencies(testrendercopyex SDL2_test_resoureces)
slouken@11901
   106
add_dependencies(controllermap SDL2_test_resoureces)
slouken@11901
   107
add_dependencies(testyuv SDL2_test_resoureces)
slouken@11901
   108
add_dependencies(testgamecontroller SDL2_test_resoureces)
slouken@11901
   109
add_dependencies(testshape SDL2_test_resoureces)
slouken@11901
   110
add_dependencies(testshader SDL2_test_resoureces)
slouken@11901
   111
add_dependencies(testnative SDL2_test_resoureces)
slouken@11901
   112
add_dependencies(testspriteminimal SDL2_test_resoureces)
slouken@11901
   113
add_dependencies(testautomation SDL2_test_resoureces)
slouken@11901
   114
add_dependencies(testcustomcursor SDL2_test_resoureces)
slouken@11901
   115
add_dependencies(testrendertarget SDL2_test_resoureces)
slouken@11901
   116
add_dependencies(testsprite2 SDL2_test_resoureces)
slouken@11901
   117
slouken@11901
   118
add_dependencies(loopwave SDL2_test_resoureces)
slouken@11901
   119
add_dependencies(loopwavequeue SDL2_test_resoureces)
slouken@11901
   120
add_dependencies(testresample SDL2_test_resoureces)
slouken@11901
   121
add_dependencies(testaudiohotplug SDL2_test_resoureces)
slouken@11901
   122
add_dependencies(testmultiaudio SDL2_test_resoureces)