diff --git a/CMakeLists.txt b/CMakeLists.txt index 8645992a..dcf1b0af 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -136,15 +136,39 @@ if ((NOT LIBAD9166_LIBRARIES) AND (NOT LIBAD9166_INCLUDE_DIRS)) set(LIBAD9166_INCLUDE_DIRS "") endif() -find_library(LIBADRV9001_LIBRARIES adrv9001-iio NO_CACHE) -find_path(LIBADRV9001_INCLUDE_DIRS adrv9002_iio.h) -if ((NOT LIBADRV9001_LIBRARIES) OR (NOT LIBADRV9001_INCLUDE_DIRS)) - set(LIBADRV9001_LIBRARIES "") - set(LIBADRV9001_INCLUDE_DIRS "") - set(LIBADRV9001_FOUND FALSE) +find_library(LIBADRV9001_IIO_LIBRARIES adrv9001-iio NO_CACHE) +find_path(LIBADRV9001_IIO_INCLUDE_DIRS adrv9002_iio.h) + +if ((NOT LIBADRV9001_IIO_LIBRARIES) OR (NOT LIBADRV9001_IIO_INCLUDE_DIRS)) + set(LIBADRV9001_IIO_LIBRARIES "") + set(LIBADRV9001_IIO_INCLUDE_DIRS "") + set(LIBADRV9001_FOUND FALSE) else() - set(LIBADRV9001_FOUND TRUE) - set(ENABLE_IIO TRUE) + find_library(LIBADRV9001_FILTER_LIBRARIES adrv9001-filter-designer NO_CACHE) + find_library(LIBADRV9001_PROFILE_GEN_LIBRARIES adrv9001-profile-gen NO_CACHE) + find_library(LIBADRV9001_STREAM_GEN_LIBRARIES adrv9001-stream-gen NO_CACHE) + set(LIBADRV9001_FOUND TRUE) + set(ENABLE_IIO TRUE) + + add_library(libadrv9002_iio STATIC IMPORTED) + set_target_properties(libadrv9002_iio PROPERTIES IMPORTED_LOCATION ${LIBADRV9001_IIO_LIBRARIES}) + set_target_properties(libadrv9002_iio PROPERTIES INTERFACE_INCLUDE_DIRECTORIES ${LIBADRV9001_IIO_INCLUDE_DIRS}) + + add_library(libadrv9002_filter STATIC IMPORTED) + set_target_properties(libadrv9002_filter PROPERTIES IMPORTED_LOCATION ${LIBADRV9001_FILTER_LIBRARIES}) + + add_library(libadrv9002_profile_gen STATIC IMPORTED) + set_target_properties(libadrv9002_profile_gen PROPERTIES IMPORTED_LOCATION ${LIBADRV9001_PROFILE_GEN_LIBRARIES}) + + add_library(libadrv9002_stream_gen STATIC IMPORTED) + set_target_properties(libadrv9002_stream_gen PROPERTIES IMPORTED_LOCATION ${LIBADRV9001_STREAM_GEN_LIBRARIES}) + + add_library(libadrv9002 INTERFACE) + + target_link_libraries(libadrv9002_iio INTERFACE stdc++) + target_link_libraries(libadrv9002_stream_gen INTERFACE stdc++) + target_link_libraries(libadrv9002_profile_gen INTERFACE stdc++ libadrv9002_filter) + target_link_libraries(libadrv9002 INTERFACE libadrv9002_iio libadrv9002_filter libadrv9002_profile_gen libadrv9002_stream_gen) endif() find_library(LIBSERIALPORT_LIBRARIES serialport) @@ -177,7 +201,7 @@ set(LIBOSC_LIBS ${MATIO_LIBRARIES} ${LIBAD9361_LIBRARIES} ${LIBAD9166_LIBRARIES} - ${LIBADRV9001_LIBRARIES} + libadrv9002 dl ) @@ -240,7 +264,6 @@ target_include_directories(osc PRIVATE ${HDF5_INCLUDE_DIRS} ${LIBAD9361_INCLUDE_DIRS} ${LIBAD9166_INCLUDE_DIRS} - ${LIBADRV9001_INCLUDE_DIRS} ) target_link_libraries(osc PRIVATE ${LIBOSC_LIBS}) set_target_properties(osc PROPERTIES diff --git a/plugins/CMakeLists.txt b/plugins/CMakeLists.txt index e7343ba3..1337c021 100644 --- a/plugins/CMakeLists.txt +++ b/plugins/CMakeLists.txt @@ -68,9 +68,8 @@ if(${CMAKE_SYSTEM_NAME} MATCHES "Windows") set(EXTRA_WIN_LIBRARIES winpthread) endif() -if("${LIBADRV9001_LIBRARIES}" STREQUAL "") - message(WARNING "libadrv9001-iio not found. The following plugins will not be installed: ${LIBADRV9001_PLUGINS}") - list(REMOVE_ITEM PLUGINS ${LIBADRV9002_PLUGINS}) +if(NOT LIBADRV9001_FOUND) + message(WARNING "libadrv9001-iio not found. The ${LIBADRV9001_PLUGINS} plugin will not contain profile generation") endif() if("${LIBAD9166_LIBRARIES}" STREQUAL "") @@ -96,7 +95,6 @@ foreach(plugin ${PLUGINS}) ${LIBXML2_INCLUDE_DIRS} ${LIBAD9361_INCLUDE_DIRS} ${LIBAD9166_INCLUDE_DIRS} - ${LIBADRV9001_INCLUDE_DIRS} ) target_link_libraries(${plugin} PRIVATE ${GTK_LIBRARIES} @@ -104,7 +102,6 @@ foreach(plugin ${PLUGINS}) ${LIBXML2_LIBRARIES} ${LIBAD9361_LIBRARIES} ${LIBAD9166_LIBRARIES} - ${LIBADRV9001_LIBRARIES} ${EXTRA_WIN_LIBRARIES} osc m @@ -116,6 +113,10 @@ foreach(plugin ${PLUGINS}) endforeach() +if(LIBADRV9001_FOUND) + target_link_libraries(adrv9002 PRIVATE libadrv9002) +endif() + install(TARGETS ${PLUGINS} LIBRARY DESTINATION ${PLIB_DEST} RUNTIME DESTINATION ${PLIB_DEST}