diff --git a/CMakeLists.txt b/CMakeLists.txt index b836db0ab..a5fb71c78 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -27,6 +27,9 @@ project(iio-oscilloscope LANGUAGES C ) +############################### Options ####################################### +option(WITH_PLUGIN_SPECTRUM_ANALYZER "Build the Spectrum Analyzer plugin?" OFF) + if (${CMAKE_SYSTEM_NAME} MATCHES "Windows") string(TIMESTAMP BUILD_YEAR "%Y") endif() @@ -302,4 +305,9 @@ foreach(plib_dest xmls filters waveforms block_diagrams) install(DIRECTORY ${plib_dest} DESTINATION ${PLIB_DEST}) endforeach() +if (WITH_PLUGIN_SPECTRUM_ANALYZER) + add_definitions(-DPLUGIN_SPECTRUM_ANALYZER) +endif() + + add_subdirectory(plugins) diff --git a/plugins/CMakeLists.txt b/plugins/CMakeLists.txt index c0f371b34..f4331ba72 100644 --- a/plugins/CMakeLists.txt +++ b/plugins/CMakeLists.txt @@ -48,8 +48,9 @@ set(PLUGINS adrv9002 cf_axi_tdd ) - -if(${CMAKE_SYSTEM_NAME} MATCHES "Windows") +if (NOT WITH_PLUGIN_SPECTRUM_ANALYZER) + list(REMOVE_ITEM PLUGINS spectrum_analyzer) +elseif(${CMAKE_SYSTEM_NAME} MATCHES "Windows") list(REMOVE_ITEM PLUGINS spectrum_analyzer scpi) set(EXTRA_WIN_LIBRARIES winpthread) endif() diff --git a/plugins/spectrum_analyzer.c b/plugins/spectrum_analyzer.c index 655127da3..a7865c997 100644 --- a/plugins/spectrum_analyzer.c +++ b/plugins/spectrum_analyzer.c @@ -894,11 +894,15 @@ struct osc_plugin plugin; static bool analyzer_identify(const struct osc_plugin *plugin) { +#ifdef PLUGIN_SPECTRUM_ANALYZER /* Use the OSC's IIO context just to detect the devices */ struct iio_context *osc_ctx = get_context_from_osc(); return !!iio_context_find_device(osc_ctx, PHY_DEVICE) && !!iio_context_find_device(osc_ctx, CAP_DEVICE); +#else + return false; +#endif } struct osc_plugin plugin = {