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..0d223ead 100644 --- a/host/hackrf-tools/src/CMakeLists.txt +++ b/host/hackrf-tools/src/CMakeLists.txt @@ -31,15 +31,17 @@ 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) LIST(APPEND TOOLS_LINK_LIBS m fftw3f) endif() diff --git a/host/hackrf-tools/src/hackrf_sweep.c b/host/hackrf-tools/src/hackrf_sweep.c index 5f7fd823..97f66408 100644 --- a/host/hackrf-tools/src/hackrf_sweep.c +++ b/host/hackrf-tools/src/hackrf_sweep.c @@ -20,6 +20,7 @@ * the Free Software Foundation, Inc., 51 Franklin Street, * Boston, MA 02110-1301, USA. */ +#define _USE_MATH_DEFINES #include @@ -47,7 +48,6 @@ typedef int bool; #ifdef _WIN32 #include - #ifdef _MSC_VER #ifdef _WIN64 @@ -334,7 +334,11 @@ void sigint_callback_handler(int signum) { int main(int argc, char** argv) { int opt, i, result = 0; +#ifdef _WIN32 + const char* path = "nul"; +#else const char* path = "/dev/null"; +#endif const char* serial_number = NULL; int exit_code = EXIT_SUCCESS; struct timeval t_end;