# Exercises hot_reload::Context (the C++ API) directly, including a real multi-threaded stress
# test -- see Main.cpp's own file comment. Reuses PluginV1/PluginV2 from
# source/examples/HotReloadDemo as fixtures, exactly as HotReloadTests does and for the same
# reason (see that CMakeLists.txt's own comment); requires BUILD_EXAMPLES as well as BUILD_TESTS
# for that reason.
add_test_module(context_tests OUTPUT_NAME "context_tests" DEPENDS hotreload_lib)

if(BUILD_EXAMPLES)
	add_dependencies(context_tests hotreload_demo_plugin_v1 hotreload_demo_plugin_v2)
	target_compile_definitions(context_tests PRIVATE
		"PLUGIN_V1_PATH=\"$<TARGET_FILE:hotreload_demo_plugin_v1>\""
		"PLUGIN_V2_PATH=\"$<TARGET_FILE:hotreload_demo_plugin_v2>\"")
else()
	message(WARNING "context_tests needs BUILD_EXAMPLES=ON too (it reuses the HotReloadDemo plugins as fixtures); skipping its checks.")
	target_compile_definitions(context_tests PRIVATE HOTRELOAD_TESTS_SKIP=1)
endif()
