Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build system fixes: use include/library paths from pkg-config, and strip leading 'v' from librtlsdr version #138

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions src/goesproc/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,8 @@ target_link_libraries(goesproc timer)
target_link_libraries(goesproc version)

if(OPENCV_FOUND)
target_link_libraries(goesproc opencv_core opencv_highgui opencv_imgproc)
target_link_libraries(goesproc ${OPENCV_LINK_LIBRARIES})
target_include_directories(goesproc PRIVATE ${OPENCV_INCLUDE_DIRS})
if(${OPENCV_VERSION} VERSION_GREATER 3.0)
target_link_libraries(goesproc opencv_imgcodecs)
endif()
endif()

if(PROJ_FOUND)
Expand All @@ -60,5 +57,6 @@ if(PROJ_FOUND)
PROJ_VERSION_MINOR=${PROJ_VERSION_MINOR}
PROJ_VERSION_PATCH=${PROJ_VERSION_PATCH})
target_compile_definitions(goesproc PRIVATE HAS_PROJ)
target_link_libraries(goesproc proj)
target_include_directories(goesproc PRIVATE ${PROJ_INCLUDE_DIRS})
target_link_libraries(goesproc ${PROJ_LINK_LIBRARIES})
endif()
16 changes: 14 additions & 2 deletions src/goesrecv/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,31 @@ if(NOT AIRSPY_FOUND)
message(WARNING "Unable to find libairspy")
else()
add_library(airspy_source airspy_source.cc)
target_link_libraries(airspy_source ${AIRSPY_LIBRARIES} publisher stdc++)
target_include_directories(airspy_source PUBLIC ${AIRSPY_INCLUDE_DIRS})
target_link_libraries(airspy_source ${AIRSPY_LINK_LIBRARIES} publisher stdc++)
endif()

pkg_check_modules(RTLSDR librtlsdr)
if(NOT RTLSDR_FOUND)
message(WARNING "Unable to find librtlsdr")
else()
add_library(rtlsdr_source rtlsdr_source.cc)

# Some rtlsdr versions begin with an extraneous 'v', such as older
# versions (<= 0.5.4) built from source, or the version provided by MacPorts.
# Newer versions built from source, as well as Debian packages, have
# versions that do not begin with this 'v'.
# Remove prefix 'v' here to handle all versions consistently.
if(RTLSDR_VERSION MATCHES "^v")
string(SUBSTRING ${RTLSDR_VERSION} 1 -1 RTLSDR_VERSION)
endif()

if((RTLSDR_VERSION VERSION_EQUAL 0.5.4) OR
(RTLSDR_VERSION VERSION_GREATER 0.5.4))
target_compile_definitions(rtlsdr_source PRIVATE RTLSDR_HAS_BIAS_TEE)
endif()
target_link_libraries(rtlsdr_source ${RTLSDR_LIBRARIES} publisher stdc++)
target_include_directories(rtlsdr_source PUBLIC ${RTLSDR_INCLUDE_DIRS})
target_link_libraries(rtlsdr_source ${RTLSDR_LINK_LIBRARIES} publisher stdc++)
endif()

add_library(nanomsg_source nanomsg_source.cc)
Expand Down
2 changes: 1 addition & 1 deletion src/goesrecv/airspy_source.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#include <thread>
#include <vector>

#include <libairspy/airspy.h>
#include <airspy.h>

#include "source.h"

Expand Down