diff --git a/host/README.md b/host/README.md index 5efd28f6..a0af41e8 100644 --- a/host/README.md +++ b/host/README.md @@ -63,11 +63,16 @@ make install ###For Visual Studio 2015 x64 ``` c:\hackrf\host\build> cmake ../ -G "Visual Studio 14 2015 Win64" \ --DLIBUSB_INCLUDE_DIR=c:\libusb-1.0.18-win\include\libusb-1.0 \ --DLIBUSB_LIBRARIES=c:\libusb-1.0.18-win\MS64\static\libusb-1.0.lib \ +-DLIBUSB_INCLUDE_DIR=c:\libusb-1.0.21\libusb \ +-DLIBUSB_LIBRARIES=c:\libusb-1.0.21\x64\Release\lib\libusb-1.0.lib \ -DTHREADS_PTHREADS_INCLUDE_DIR=c:\pthreads-w32-2-9-1-release\Pre-built.2\include \ --DTHREADS_PTHREADS_WIN32_LIBRARY=c:\pthreads-w32-2-9-1-release\Pre-built.2\lib\x64\pthreadVC2.lib +-DTHREADS_PTHREADS_WIN32_LIBRARY=c:\pthreads-w32-2-9-1-release\Pre-built.2\lib\x64\pthreadVC2.lib \ +-DFFTW_INCLUDES=C:\hackrf-2017.02.1\host\hackrf-tools\fftw-3.3.5-dll64 \ +-DFFTW_LIBRARIES=C:\hackrf-2017.02.1\host\hackrf-tools\fftw-3.3.5-dll64\libfftw3f-3.lib ``` +unpack precompiled fftw-3.3.5-dll64.zip from http://www.fftw.org/install/windows.html to C:\hackrf-2017.02.1\host\hackrf-tools\fftw-3.3.5-dll64 +Create library from VS command shell +C:\hackrf-2017.02.1\host\hackrf-tools\fftw-3.3.5-dll6> lib /machine:x64 /def:libfftw3f-3.def Cmake will produce a solution file named `hackrf_all.sln` and a series of project files which can be used with msbuild as follows: diff --git a/host/cmake/modules/FindFFTW.cmake b/host/cmake/modules/FindFFTW.cmake index 00c3401c..b9f3bfb8 100644 --- a/host/cmake/modules/FindFFTW.cmake +++ b/host/cmake/modules/FindFFTW.cmake @@ -12,7 +12,15 @@ endif (FFTW_INCLUDES) find_path (FFTW_INCLUDES fftw3.h) +IF (WIN32) +include_directories(${FFTW_INCLUDES}) +find_library (FFTW_LIBRARIES NAMES ${FFTW_LIBRARIES}) +ELSE(WIN32) find_library (FFTW_LIBRARIES NAMES fftw3) +ENDIF(WIN32) + + + # handle the QUIETLY and REQUIRED arguments and set FFTW_FOUND to TRUE if # all listed variables are TRUE diff --git a/host/hackrf-tools/src/CMakeLists.txt b/host/hackrf-tools/src/CMakeLists.txt index d9938846..c2e27c0a 100644 --- a/host/hackrf-tools/src/CMakeLists.txt +++ b/host/hackrf-tools/src/CMakeLists.txt @@ -31,12 +31,15 @@ SET(TOOLS hackrf_cpldjtag hackrf_info hackrf_debug + hackrf_sweep ) if(MSVC) add_library(libgetopt_static STATIC ../getopt/getopt.c ) + LIST(APPEND TOOLS_LINK_LIBS ${FFTW_LIBRARIES}) + include_directories(${FFTW_INCLUDES}) else() pkg_check_modules(FFTW REQUIRED fftw3f) LIST(APPEND TOOLS hackrf_sweep) diff --git a/host/hackrf-tools/src/hackrf_sweep.c b/host/hackrf-tools/src/hackrf_sweep.c index 5f7fd823..f788925e 100644 --- a/host/hackrf-tools/src/hackrf_sweep.c +++ b/host/hackrf-tools/src/hackrf_sweep.c @@ -47,7 +47,7 @@ typedef int bool; #ifdef _WIN32 #include - +#define M_PI 3.14159265358979323846264338327950288 #ifdef _MSC_VER #ifdef _WIN64 @@ -517,6 +517,9 @@ int main(int argc, char** argv) { } fd = fopen(path, "wb"); + if (fd == NULL) { + fd = fopen("nul", "wb"); + } if( fd == NULL ) { fprintf(stderr, "Failed to open file: %s\n", path); return EXIT_FAILURE;