test/CMakeLists.txt
changeset 11901 e4d03d8733f3
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/test/CMakeLists.txt	Sat Feb 24 08:59:58 2018 -0800
     1.3 @@ -0,0 +1,122 @@
     1.4 +cmake_minimum_required(VERSION 2.8.11)
     1.5 +project(SDL2 C)
     1.6 +
     1.7 +# Global settings for all of the test targets
     1.8 +# FIXME: is this wrong?
     1.9 +remove_definitions(-DUSING_GENERATED_CONFIG_H)
    1.10 +link_libraries(SDL2_test SDL2-static)
    1.11 +
    1.12 +# FIXME: Parent directory CMakeLists.txt only sets these for mingw/cygwin,
    1.13 +# but we need them for VS as well.
    1.14 +if(WINDOWS)
    1.15 +    link_libraries(SDL2main)
    1.16 +    add_definitions(-Dmain=SDL_main)
    1.17 +endif()
    1.18 +
    1.19 +add_executable(checkkeys checkkeys.c)
    1.20 +add_executable(loopwave loopwave.c)
    1.21 +add_executable(loopwavequeue loopwavequeue.c)
    1.22 +add_executable(testresample testresample.c)
    1.23 +add_executable(testaudioinfo testaudioinfo.c)
    1.24 +
    1.25 +file(GLOB TESTAUTOMATION_SOURCE_FILES testautomation*.c)
    1.26 +add_executable(testautomation ${TESTAUTOMATION_SOURCE_FILES})
    1.27 +
    1.28 +add_executable(testmultiaudio testmultiaudio.c)
    1.29 +add_executable(testaudiohotplug testaudiohotplug.c)
    1.30 +add_executable(testaudiocapture testaudiocapture.c)
    1.31 +add_executable(testatomic testatomic.c)
    1.32 +add_executable(testintersections testintersections.c)
    1.33 +add_executable(testrelative testrelative.c)
    1.34 +add_executable(testhittesting testhittesting.c)
    1.35 +add_executable(testdraw2 testdraw2.c)
    1.36 +add_executable(testdrawchessboard testdrawchessboard.c)
    1.37 +add_executable(testdropfile testdropfile.c)
    1.38 +add_executable(testerror testerror.c)
    1.39 +add_executable(testfile testfile.c)
    1.40 +add_executable(testgamecontroller testgamecontroller.c)
    1.41 +add_executable(testgesture testgesture.c)
    1.42 +add_executable(testgl2 testgl2.c)
    1.43 +add_executable(testgles testgles.c)
    1.44 +add_executable(testgles2 testgles2.c)
    1.45 +add_executable(testhaptic testhaptic.c)
    1.46 +add_executable(testhotplug testhotplug.c)
    1.47 +add_executable(testrumble testrumble.c)
    1.48 +add_executable(testthread testthread.c)
    1.49 +add_executable(testiconv testiconv.c)
    1.50 +add_executable(testime testime.c)
    1.51 +add_executable(testjoystick testjoystick.c)
    1.52 +add_executable(testkeys testkeys.c)
    1.53 +add_executable(testloadso testloadso.c)
    1.54 +add_executable(testlock testlock.c)
    1.55 +
    1.56 +if(APPLE)
    1.57 +    add_executable(testnative testnative.c
    1.58 +                              testnativecocoa.m
    1.59 +                              testnativex11.c)
    1.60 +elseif(WINDOWS)
    1.61 +    add_executable(testnative testnative.c testnativew32.c)
    1.62 +elseif(UNIX)
    1.63 +    add_executable(testnative testnative.c testnativex11.c)
    1.64 +endif()
    1.65 +
    1.66 +add_executable(testoverlay2 testoverlay2.c testyuv_cvt.c)
    1.67 +add_executable(testplatform testplatform.c)
    1.68 +add_executable(testpower testpower.c)
    1.69 +add_executable(testfilesystem testfilesystem.c)
    1.70 +add_executable(testrendertarget testrendertarget.c)
    1.71 +add_executable(testscale testscale.c)
    1.72 +add_executable(testsem testsem.c)
    1.73 +add_executable(testshader testshader.c)
    1.74 +add_executable(testshape testshape.c)
    1.75 +add_executable(testsprite2 testsprite2.c)
    1.76 +add_executable(testspriteminimal testspriteminimal.c)
    1.77 +add_executable(teststreaming teststreaming.c)
    1.78 +add_executable(testtimer testtimer.c)
    1.79 +add_executable(testver testver.c)
    1.80 +add_executable(testviewport testviewport.c)
    1.81 +add_executable(testwm2 testwm2.c)
    1.82 +add_executable(testyuv testyuv.c testyuv_cvt.c)
    1.83 +add_executable(torturethread torturethread.c)
    1.84 +add_executable(testrendercopyex testrendercopyex.c)
    1.85 +add_executable(testmessage testmessage.c)
    1.86 +add_executable(testdisplayinfo testdisplayinfo.c)
    1.87 +add_executable(testqsort testqsort.c)
    1.88 +add_executable(testbounds testbounds.c)
    1.89 +add_executable(testcustomcursor testcustomcursor.c)
    1.90 +add_executable(controllermap controllermap.c)
    1.91 +add_executable(testvulkan testvulkan.c)
    1.92 +
    1.93 +# HACK: Dummy target to cause the resource files to be copied to the build directory.
    1.94 +# Need to make it an executable so we can use the TARGET_FILE_DIR generator expression.
    1.95 +# This is needed so they get copied to the correct Debug/Release subdirectory in Xcode.
    1.96 +file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/resources_dummy.c "int main(int argc, const char **argv){ return 1; }\n")
    1.97 +add_executable(SDL2_test_resoureces ${CMAKE_CURRENT_BINARY_DIR}/resources_dummy.c)
    1.98 +
    1.99 +file(GLOB RESOURCE_FILES *.bmp *.wav)
   1.100 +foreach(RESOURCE_FILE ${RESOURCE_FILES})
   1.101 +    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>)
   1.102 +endforeach(RESOURCE_FILE)
   1.103 +
   1.104 +file(COPY ${RESOURCE_FILES} DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
   1.105 +
   1.106 +# TODO: Might be easier to make all targets depend on the resources...?
   1.107 +add_dependencies(testscale SDL2_test_resoureces)
   1.108 +add_dependencies(testrendercopyex SDL2_test_resoureces)
   1.109 +add_dependencies(controllermap SDL2_test_resoureces)
   1.110 +add_dependencies(testyuv SDL2_test_resoureces)
   1.111 +add_dependencies(testgamecontroller SDL2_test_resoureces)
   1.112 +add_dependencies(testshape SDL2_test_resoureces)
   1.113 +add_dependencies(testshader SDL2_test_resoureces)
   1.114 +add_dependencies(testnative SDL2_test_resoureces)
   1.115 +add_dependencies(testspriteminimal SDL2_test_resoureces)
   1.116 +add_dependencies(testautomation SDL2_test_resoureces)
   1.117 +add_dependencies(testcustomcursor SDL2_test_resoureces)
   1.118 +add_dependencies(testrendertarget SDL2_test_resoureces)
   1.119 +add_dependencies(testsprite2 SDL2_test_resoureces)
   1.120 +
   1.121 +add_dependencies(loopwave SDL2_test_resoureces)
   1.122 +add_dependencies(loopwavequeue SDL2_test_resoureces)
   1.123 +add_dependencies(testresample SDL2_test_resoureces)
   1.124 +add_dependencies(testaudiohotplug SDL2_test_resoureces)
   1.125 +add_dependencies(testmultiaudio SDL2_test_resoureces)