From b490e4409bdfb956e0d2f6b2bc3384721101dd35 Mon Sep 17 00:00:00 2001 From: tt2468 Date: Wed, 15 Dec 2021 02:06:31 -0800 Subject: [PATCH] CMakeLists: Add runtime tests flag --- CMakeLists.txt | 8 ++++++++ src/obs-websocket.cpp | 4 +--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9b7b4adc..f65f0ea0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -36,6 +36,10 @@ if(NOT CMAKE_BUILD_TYPE) endif() +# Plugin tests flag +option(PLUGIN_TESTS "Enable plugin runtime tests" OFF) + + # Qt build stuff set(CMAKE_PREFIX_PATH "${QTDIR}") set(CMAKE_INCLUDE_CURRENT_DIR ON) @@ -177,6 +181,10 @@ target_link_libraries(obs-websocket Qt5::Network nlohmann_json::nlohmann_json) +if(PLUGIN_TESTS) + target_compile_definitions(obs-websocket PRIVATE PLUGIN_TESTS) +endif() + # Windows-specific build settings and tasks if(WIN32) diff --git a/src/obs-websocket.cpp b/src/obs-websocket.cpp index 71d6b8c4..4f48e2b6 100644 --- a/src/obs-websocket.cpp +++ b/src/obs-websocket.cpp @@ -170,9 +170,7 @@ void WebSocketApiEventCallback(std::string vendorName, std::string eventType, ob _webSocketServer->BroadcastEvent(EventSubscription::Vendors, "VendorEvent", broadcastEventData); } - -#define PLUGIN_API_TEST -#ifdef PLUGIN_API_TEST +#ifdef PLUGIN_TESTS static void test_vendor_request_cb(obs_data_t *requestData, obs_data_t *responseData, void *priv_data) {