commit 562e73a947c31b0f4c4dd38cd59cb16b89104eb8
parent 73babcb2fac771176b4178b7e515d387dfe7b7e1
Author: fundamental <mark.d.mccurry@gmail.com>
Date: Fri, 30 Apr 2021 20:50:21 -0400
Fix unit test build on windows (via mingw)
Diffstat:
3 files changed, 23 insertions(+), 9 deletions(-)
diff --git a/src/Tests/CMakeLists.txt b/src/Tests/CMakeLists.txt
@@ -41,27 +41,34 @@ quick_test(XMLwrapperTest ${test_lib})
quick_test(PluginTest zynaddsubfx_core zynaddsubfx_nio
zynaddsubfx_gui_bridge
- ${GUI_LIBRARIES} ${NIO_LIBRARIES} ${AUDIO_LIBRARIES})
+ ${GUI_LIBRARIES} ${NIO_LIBRARIES} ${AUDIO_LIBRARIES}
+ ${PLATFORM_LIBRARIES})
quick_test(MiddlewareTest zynaddsubfx_core zynaddsubfx_nio
zynaddsubfx_gui_bridge
- ${GUI_LIBRARIES} ${NIO_LIBRARIES} ${AUDIO_LIBRARIES})
+ ${GUI_LIBRARIES} ${NIO_LIBRARIES} ${AUDIO_LIBRARIES}
+ ${PLATFORM_LIBRARIES})
quick_test(MessageTest zynaddsubfx_core zynaddsubfx_nio
zynaddsubfx_gui_bridge
- ${GUI_LIBRARIES} ${NIO_LIBRARIES} ${AUDIO_LIBRARIES})
+ ${GUI_LIBRARIES} ${NIO_LIBRARIES} ${AUDIO_LIBRARIES}
+ ${PLATFORM_LIBRARIES})
#Testbed app
-add_executable(ins-test InstrumentStats.cpp)
-target_link_libraries(ins-test ${test_lib} rt)
-if(LIBLO_FOUND)
- cp_script(check-ports.rb)
- add_test(PortChecker check-ports.rb)
+if(NOT (${CMAKE_SYSTEM_NAME} STREQUAL "Windows"))
+ add_executable(ins-test InstrumentStats.cpp)
+ target_link_libraries(ins-test ${test_lib} rt)
+
+ if(LIBLO_FOUND)
+ cp_script(check-ports.rb)
+ add_test(PortChecker check-ports.rb)
+ endif()
endif()
add_executable(save-osc SaveOSC.cpp)
target_link_libraries(save-osc
zynaddsubfx_core zynaddsubfx_nio
zynaddsubfx_gui_bridge
- ${GUI_LIBRARIES} ${NIO_LIBRARIES} ${AUDIO_LIBRARIES})
+ ${GUI_LIBRARIES} ${NIO_LIBRARIES} ${AUDIO_LIBRARIES}
+ ${PLATFORM_LIBRARIES})
#this will be replaced with a for loop when the code will get more stable:
add_test(SaveOsc save-osc ${CMAKE_CURRENT_SOURCE_DIR}/../../instruments/examples/Arpeggio\ 1.xmz)
diff --git a/src/Tests/OscilGenTest.cpp b/src/Tests/OscilGenTest.cpp
@@ -106,6 +106,7 @@ class OscilGenTest
}
//performance testing
+#ifdef __linux__
void testSpeed() {
const int samps = 15000;
@@ -125,6 +126,7 @@ class OscilGenTest
printf("OscilGenTest: %f seconds for %d gets.\n",
(static_cast<float>(t_off - t_on)) / CLOCKS_PER_SEC, samps);
}
+#endif
};
int main()
@@ -133,6 +135,8 @@ int main()
RUN_TEST(testInit);
RUN_TEST(testOutput);
RUN_TEST(testSpectrum);
+#ifdef __linux__
RUN_TEST(testSpeed);
+#endif
return test_summary();
}
diff --git a/src/Tests/TriggerTest.cpp b/src/Tests/TriggerTest.cpp
@@ -104,6 +104,9 @@ class TriggerTest
//for(int i=0; i<synth->buffersize; ++i)
// printf("%d->%f\n", i, w->prebuffer[1][i]);
}
+#ifndef M_PI
+#define M_PI (3.14159265358979323846)
+#endif
void testSine(void) {
//Generate a sine table