Build SaveOsc only on non-windows
[zynaddsubfx-code.git] / src / Tests / CMakeLists.txt
blobbe6b1e5685b989594c150f7c92980ea9b0dd44e3
1 function(cp_script script_name)
2         configure_file(${CMAKE_CURRENT_SOURCE_DIR}/${script_name}
3                 ${CMAKE_CURRENT_BINARY_DIR}/${script_name} COPYONLY)
4 endfunction()
6 function(quick_test test_name link)
7     add_executable(${test_name} "${test_name}.cpp")
8     add_test(NAME ${test_name}
9              COMMAND ${test_name})
10      target_link_libraries(${test_name} ${link} ${ARGN})
11 endfunction()
13 #for tests looking for files stored in the source dir
14 add_definitions(-DSOURCE_DIR="${CMAKE_CURRENT_SOURCE_DIR}")
16 #Extra libraries added to make test and full compilation use the same library
17 #links for quirky compilers
18 set(test_lib zynaddsubfx_core ${GUI_LIBRARIES} ${ZLIB_LIBRARY} ${FFTW_LIBRARIES}
19     ${MXML_LIBRARIES} pthread "-Wl,--no-as-needed -lpthread")
21 message(STATUS "Linking tests with: ${test_lib}")
23 quick_test(AdNoteTest       ${test_lib})
24 quick_test(AllocatorTest    ${test_lib})
25 quick_test(ControllerTest   ${test_lib})
26 quick_test(EchoTest         ${test_lib})
27 quick_test(EffectTest       ${test_lib})
28 quick_test(KitTest          ${test_lib})
29 quick_test(MemoryStressTest ${test_lib})
30 quick_test(MicrotonalTest   ${test_lib})
31 quick_test(MsgParseTest     ${test_lib})
32 quick_test(MqTest           ${test_lib})
33 quick_test(OscilGenTest     ${test_lib})
34 quick_test(PadNoteTest      ${test_lib})
35 quick_test(RandTest         ${test_lib})
36 quick_test(SubNoteTest      ${test_lib})
37 quick_test(TriggerTest      ${test_lib})
38 quick_test(UnisonTest       ${test_lib})
39 quick_test(WatchTest        ${test_lib})
40 quick_test(XMLwrapperTest   ${test_lib})
42 quick_test(PluginTest     zynaddsubfx_core zynaddsubfx_nio
43                           zynaddsubfx_gui_bridge
44                           ${GUI_LIBRARIES} ${NIO_LIBRARIES} ${AUDIO_LIBRARIES}
45                           ${PLATFORM_LIBRARIES})
46 quick_test(MiddlewareTest zynaddsubfx_core zynaddsubfx_nio
47                           zynaddsubfx_gui_bridge
48                           ${GUI_LIBRARIES} ${NIO_LIBRARIES} ${AUDIO_LIBRARIES}
49                           ${PLATFORM_LIBRARIES})
50 quick_test(MessageTest zynaddsubfx_core zynaddsubfx_nio
51                        zynaddsubfx_gui_bridge
52                        ${GUI_LIBRARIES} ${NIO_LIBRARIES} ${AUDIO_LIBRARIES}
53                        ${PLATFORM_LIBRARIES})
55 #Testbed app
57 if(NOT (${CMAKE_SYSTEM_NAME} STREQUAL "Windows"))
58     add_executable(ins-test InstrumentStats.cpp)
59     target_link_libraries(ins-test ${test_lib} rt)
61     if(LIBLO_FOUND)
62         cp_script(check-ports.rb)
63         add_test(PortChecker check-ports.rb)
64     endif()
65     add_executable(save-osc SaveOSC.cpp)
66     target_link_libraries(save-osc
67         zynaddsubfx_core zynaddsubfx_nio
68         zynaddsubfx_gui_bridge
69         ${GUI_LIBRARIES} ${NIO_LIBRARIES} ${AUDIO_LIBRARIES}
70         ${PLATFORM_LIBRARIES})
71     #this will be replaced with a for loop when the code will get more stable:
72     add_test(SaveOsc save-osc ${CMAKE_CURRENT_SOURCE_DIR}/../../instruments/examples/Arpeggio\ 1.xmz)
74 endif()