mirror of
				https://github.com/rtlsdrblog/rtl-sdr-blog.git
				synced 2025-10-31 00:48:08 +01:00 
			
		
		
		
	fix windows build
We really should not have pkgconfig as a build requirement on windows.
This commit is contained in:
		| @@ -66,14 +66,25 @@ endif() | ||||
| ######################################################################## | ||||
| # Find build dependencies | ||||
| ######################################################################## | ||||
| if(WIN32 AND NOT MINGW) | ||||
|     set(THREADS_USE_PTHREADS_WIN32 true) | ||||
| endif() | ||||
| find_package(Threads) | ||||
| 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") | ||||
| endif() | ||||
| if(NOT THREADS_FOUND) | ||||
| @@ -139,7 +150,7 @@ add_subdirectory(src) | ||||
| ######################################################################## | ||||
| # Create Pkg Config File | ||||
| ######################################################################## | ||||
| FOREACH(inc ${LIBUSB_INCLUDE_DIR}) | ||||
| FOREACH(inc ${LIBUSB_INCLUDEDIR}) | ||||
|     LIST(APPEND RTLSDR_PC_CFLAGS "-I${inc}") | ||||
| ENDFOREACH(inc) | ||||
|  | ||||
|   | ||||
| @@ -20,10 +20,12 @@ | ||||
| ######################################################################## | ||||
| add_library(rtlsdr SHARED librtlsdr.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 | ||||
|   $<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/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 OUTPUT_NAME rtlsdr) | ||||
| @@ -36,10 +38,12 @@ generate_export_header(rtlsdr) | ||||
| ######################################################################## | ||||
| add_library(rtlsdr_static STATIC librtlsdr.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 | ||||
|   $<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/include> | ||||
|   $<INSTALL_INTERFACE:include>  # <prefix>/include | ||||
|   ${LIBUSB_INCLUDE_DIRS} | ||||
|   ${THREADS_PTHREADS_INCLUDE_DIR} | ||||
|   ) | ||||
| set_property(TARGET rtlsdr_static APPEND PROPERTY COMPILE_DEFINITIONS "rtlsdr_STATIC" ) | ||||
| if(NOT WIN32) | ||||
| @@ -58,8 +62,8 @@ IF(MSVC) | ||||
|         ${CMAKE_CURRENT_SOURCE_DIR}/rtlsdr.rc.in | ||||
|         ${CMAKE_CURRENT_BINARY_DIR}/rtlsdr.rc | ||||
|     @ONLY) | ||||
|   target_sources(rtlsdr ${CMAKE_CURRENT_BINARY_DIR}/rtlsdr.rc) | ||||
|   target_sources(rtlsdr_static ${CMAKE_CURRENT_BINARY_DIR}/rtlsdr.rc) | ||||
|   target_sources(rtlsdr PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/rtlsdr.rc) | ||||
|   target_sources(rtlsdr_static PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/rtlsdr.rc) | ||||
| ENDIF(MSVC) | ||||
|  | ||||
| ######################################################################## | ||||
|   | ||||
| @@ -35,6 +35,7 @@ | ||||
| #include <fcntl.h> | ||||
| #else | ||||
| #include <winsock2.h> | ||||
| #include <WS2tcpip.h> | ||||
| #include "getopt/getopt.h" | ||||
| #endif | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user