CMakeLists: Add runtime tests flag

This commit is contained in:
tt2468 2021-12-15 02:06:31 -08:00
parent 8fbcbad9ec
commit b490e4409b
2 changed files with 9 additions and 3 deletions

View File

@ -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)

View File

@ -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)
{