Merge pull request #343 from mrbubble62/master

build hackrf_sweep on Windows
This commit is contained in:
Michael Ossmann
2017-02-15 14:47:44 -07:00
committed by GitHub
4 changed files with 24 additions and 5 deletions

View File

@ -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:

View File

@ -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

View File

@ -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()

View File

@ -20,6 +20,7 @@
* the Free Software Foundation, Inc., 51 Franklin Street,
* Boston, MA 02110-1301, USA.
*/
#define _USE_MATH_DEFINES
#include <hackrf.h>
@ -47,7 +48,6 @@ typedef int bool;
#ifdef _WIN32
#include <windows.h>
#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;