mirror of
https://github.com/rtlsdrblog/rtl-sdr-blog.git
synced 2025-02-28 01:44:07 +01:00
fix windows build
We really should not have pkgconfig as a build requirement on windows.
This commit is contained in:
parent
ed0317e6a5
commit
0847e93e08
@ -66,14 +66,25 @@ endif()
|
|||||||
########################################################################
|
########################################################################
|
||||||
# Find build dependencies
|
# Find build dependencies
|
||||||
########################################################################
|
########################################################################
|
||||||
if(WIN32 AND NOT MINGW)
|
|
||||||
set(THREADS_USE_PTHREADS_WIN32 true)
|
|
||||||
endif()
|
|
||||||
find_package(Threads)
|
find_package(Threads)
|
||||||
find_package(PkgConfig)
|
find_package(PkgConfig)
|
||||||
pkg_check_modules(LIBUSB libusb-1.0 IMPORTED_TARGET)
|
|
||||||
|
|
||||||
if(NOT LIBUSB_FOUND)
|
if(PKG_CONFIG_FOUND)
|
||||||
|
pkg_check_modules(LIBUSB libusb-1.0 IMPORTED_TARGET)
|
||||||
|
else()
|
||||||
|
set(LIBUSB_LIBRARIES "" CACHE STRING "manual libusb path")
|
||||||
|
set(LIBUSB_INCLUDE_DIRS "" CACHE STRING "manual libusb includepath")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(MSVC)
|
||||||
|
set(THREADS_PTHREADS_LIBRARY "" CACHE STRING "manual pthread-win32 path")
|
||||||
|
set(THREADS_PTHREADS_INCLUDE_DIR "" CACHE STRING "manual pthread-win32 includepath")
|
||||||
|
else()
|
||||||
|
set(THREADS_PTHREADS_LIBRARY "" CACHE INTERNAL "manual pthread-win32 path")
|
||||||
|
set(THREADS_PTHREADS_INCLUDE_DIR "" CACHE INTERNAL "manual pthread-win32 includepath")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(PKG_CONFIG_FOUND AND NOT LIBUSB_FOUND)
|
||||||
message(FATAL_ERROR "LibUSB 1.0 required to compile rtl-sdr")
|
message(FATAL_ERROR "LibUSB 1.0 required to compile rtl-sdr")
|
||||||
endif()
|
endif()
|
||||||
if(NOT THREADS_FOUND)
|
if(NOT THREADS_FOUND)
|
||||||
@ -139,7 +150,7 @@ add_subdirectory(src)
|
|||||||
########################################################################
|
########################################################################
|
||||||
# Create Pkg Config File
|
# Create Pkg Config File
|
||||||
########################################################################
|
########################################################################
|
||||||
FOREACH(inc ${LIBUSB_INCLUDE_DIR})
|
FOREACH(inc ${LIBUSB_INCLUDEDIR})
|
||||||
LIST(APPEND RTLSDR_PC_CFLAGS "-I${inc}")
|
LIST(APPEND RTLSDR_PC_CFLAGS "-I${inc}")
|
||||||
ENDFOREACH(inc)
|
ENDFOREACH(inc)
|
||||||
|
|
||||||
|
@ -20,10 +20,12 @@
|
|||||||
########################################################################
|
########################################################################
|
||||||
add_library(rtlsdr SHARED librtlsdr.c
|
add_library(rtlsdr SHARED librtlsdr.c
|
||||||
tuner_e4k.c tuner_fc0012.c tuner_fc0013.c tuner_fc2580.c tuner_r82xx.c)
|
tuner_e4k.c tuner_fc0012.c tuner_fc0013.c tuner_fc2580.c tuner_r82xx.c)
|
||||||
target_link_libraries(rtlsdr PkgConfig::LIBUSB)
|
target_link_libraries(rtlsdr ${LIBUSB_LIBRARIES} ${THREADS_PTHREADS_LIBRARY})
|
||||||
target_include_directories(rtlsdr PUBLIC
|
target_include_directories(rtlsdr PUBLIC
|
||||||
$<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/include>
|
$<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/include>
|
||||||
$<INSTALL_INTERFACE:include> # <prefix>/include
|
$<INSTALL_INTERFACE:include> # <prefix>/include
|
||||||
|
${LIBUSB_INCLUDE_DIRS}
|
||||||
|
${THREADS_PTHREADS_INCLUDE_DIR}
|
||||||
)
|
)
|
||||||
set_target_properties(rtlsdr PROPERTIES DEFINE_SYMBOL "rtlsdr_EXPORTS")
|
set_target_properties(rtlsdr PROPERTIES DEFINE_SYMBOL "rtlsdr_EXPORTS")
|
||||||
set_target_properties(rtlsdr PROPERTIES OUTPUT_NAME rtlsdr)
|
set_target_properties(rtlsdr PROPERTIES OUTPUT_NAME rtlsdr)
|
||||||
@ -36,10 +38,12 @@ generate_export_header(rtlsdr)
|
|||||||
########################################################################
|
########################################################################
|
||||||
add_library(rtlsdr_static STATIC librtlsdr.c
|
add_library(rtlsdr_static STATIC librtlsdr.c
|
||||||
tuner_e4k.c tuner_fc0012.c tuner_fc0013.c tuner_fc2580.c tuner_r82xx.c)
|
tuner_e4k.c tuner_fc0012.c tuner_fc0013.c tuner_fc2580.c tuner_r82xx.c)
|
||||||
target_link_libraries(rtlsdr_static PkgConfig::LIBUSB)
|
target_link_libraries(rtlsdr ${LIBUSB_LIBRARIES} ${THREADS_PTHREADS_LIBRARY})
|
||||||
target_include_directories(rtlsdr_static PUBLIC
|
target_include_directories(rtlsdr_static PUBLIC
|
||||||
$<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/include>
|
$<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/include>
|
||||||
$<INSTALL_INTERFACE:include> # <prefix>/include
|
$<INSTALL_INTERFACE:include> # <prefix>/include
|
||||||
|
${LIBUSB_INCLUDE_DIRS}
|
||||||
|
${THREADS_PTHREADS_INCLUDE_DIR}
|
||||||
)
|
)
|
||||||
set_property(TARGET rtlsdr_static APPEND PROPERTY COMPILE_DEFINITIONS "rtlsdr_STATIC" )
|
set_property(TARGET rtlsdr_static APPEND PROPERTY COMPILE_DEFINITIONS "rtlsdr_STATIC" )
|
||||||
if(NOT WIN32)
|
if(NOT WIN32)
|
||||||
@ -58,8 +62,8 @@ IF(MSVC)
|
|||||||
${CMAKE_CURRENT_SOURCE_DIR}/rtlsdr.rc.in
|
${CMAKE_CURRENT_SOURCE_DIR}/rtlsdr.rc.in
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/rtlsdr.rc
|
${CMAKE_CURRENT_BINARY_DIR}/rtlsdr.rc
|
||||||
@ONLY)
|
@ONLY)
|
||||||
target_sources(rtlsdr ${CMAKE_CURRENT_BINARY_DIR}/rtlsdr.rc)
|
target_sources(rtlsdr PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/rtlsdr.rc)
|
||||||
target_sources(rtlsdr_static ${CMAKE_CURRENT_BINARY_DIR}/rtlsdr.rc)
|
target_sources(rtlsdr_static PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/rtlsdr.rc)
|
||||||
ENDIF(MSVC)
|
ENDIF(MSVC)
|
||||||
|
|
||||||
########################################################################
|
########################################################################
|
||||||
|
@ -35,6 +35,7 @@
|
|||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#else
|
#else
|
||||||
#include <winsock2.h>
|
#include <winsock2.h>
|
||||||
|
#include <WS2tcpip.h>
|
||||||
#include "getopt/getopt.h"
|
#include "getopt/getopt.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user