Merge pull request #310 from dominicgs/Windows_build
Windows CI builds with Appveyor, Support compiling with Visual Studio
This commit is contained in:
27
appveyor.yml
Normal file
27
appveyor.yml
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
os: Visual Studio 2015
|
||||||
|
clone_depth: 1
|
||||||
|
|
||||||
|
configuration:
|
||||||
|
- Release
|
||||||
|
- Debug
|
||||||
|
|
||||||
|
install:
|
||||||
|
- appveyor DownloadFile "https://downloads.sourceforge.net/project/libusb/libusb-1.0/libusb-1.0.21/libusb-1.0.21.7z?r=https%3A%2F%2Fsourceforge.net%2Fprojects%2Flibusb%2Ffiles%2Flibusb-1.0%2Flibusb-1.0.21%2F&ts=1485478643&use_mirror=cytranet" -FileName "C:\libusb.7z"
|
||||||
|
- 7z x -y "C:\libusb.7z" -o"C:\libusb"
|
||||||
|
- appveyor DownloadFile "http://mirrors.kernel.org/sourceware/pthreads-win32/pthreads-w32-2-9-1-release.zip" -FileName "C:\pthreads-w32-release.zip"
|
||||||
|
- 7z x -y "C:\pthreads-w32-release.zip" -o"C:\pthreads"
|
||||||
|
- appveyor DownloadFile "http://ftp.gnome.org/pub/gnome/binaries/win32/dependencies/pkg-config_0.26-1_win32.zip" -FileName "C:\pkg-config_win32.zip"
|
||||||
|
- 7z x -y "C:\pkg-config_win32.zip" -o"C:\pkg-config"
|
||||||
|
|
||||||
|
|
||||||
|
build_script:
|
||||||
|
- mkdir c:\projects\hackrf\host\build
|
||||||
|
- cd c:\projects\hackrf\host\build
|
||||||
|
- cmake -G "Visual Studio 14 2015 Win64" \
|
||||||
|
-DLIBUSB_LIBRARIES="C:\libusb\MS64\dll\libusb-1.0.lib" \
|
||||||
|
-DLIBUSB_INCLUDE_DIR="C:\libusb\include\libusb-1.0" \
|
||||||
|
-DTHREADS_PTHREADS_INCLUDE_DIR=c:\pthreads\Pre-built.2\include \
|
||||||
|
-DTHREADS_PTHREADS_WIN32_LIBRARY=c:\pthreads\Pre-built.2\lib\x64\pthreadVC2.lib \
|
||||||
|
-DPKG_CONFIG_EXECUTABLE="C:\pkg-config\bin\pkg-config.exe" \
|
||||||
|
..
|
||||||
|
- msbuild .\ALL_BUILD.vcxproj /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll"
|
@ -24,12 +24,15 @@
|
|||||||
set(INSTALL_DEFAULT_BINDIR "bin" CACHE STRING "Appended to CMAKE_INSTALL_PREFIX")
|
set(INSTALL_DEFAULT_BINDIR "bin" CACHE STRING "Appended to CMAKE_INSTALL_PREFIX")
|
||||||
|
|
||||||
INCLUDE(FindPkgConfig)
|
INCLUDE(FindPkgConfig)
|
||||||
pkg_check_modules(FFTW REQUIRED fftw3f)
|
|
||||||
|
|
||||||
if(MSVC)
|
if(MSVC)
|
||||||
add_library(libgetopt_static STATIC
|
add_library(libgetopt_static STATIC
|
||||||
../getopt/getopt.c
|
../getopt/getopt.c
|
||||||
)
|
)
|
||||||
|
else()
|
||||||
|
pkg_check_modules(FFTW REQUIRED fftw3f)
|
||||||
|
LIST(APPEND TOOLS hackrf_sweep)
|
||||||
|
LIST(APPEND TOOLS_LINK_LIBS m fftw3f)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
SET(TOOLS
|
SET(TOOLS
|
||||||
@ -41,7 +44,6 @@ SET(TOOLS
|
|||||||
hackrf_cpldjtag
|
hackrf_cpldjtag
|
||||||
hackrf_info
|
hackrf_info
|
||||||
hackrf_operacake
|
hackrf_operacake
|
||||||
hackrf_sweep
|
|
||||||
)
|
)
|
||||||
|
|
||||||
if(NOT libhackrf_SOURCE_DIR)
|
if(NOT libhackrf_SOURCE_DIR)
|
||||||
@ -55,8 +57,6 @@ if(MSVC)
|
|||||||
LIST(APPEND TOOLS_LINK_LIBS libgetopt_static)
|
LIST(APPEND TOOLS_LINK_LIBS libgetopt_static)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
LIST(APPEND TOOLS_LINK_LIBS m fftw3f)
|
|
||||||
|
|
||||||
foreach(tool ${TOOLS})
|
foreach(tool ${TOOLS})
|
||||||
add_executable(${tool} ${tool}.c)
|
add_executable(${tool} ${tool}.c)
|
||||||
target_link_libraries(${tool} ${TOOLS_LINK_LIBS})
|
target_link_libraries(${tool} ${TOOLS_LINK_LIBS})
|
||||||
|
@ -379,6 +379,7 @@ int rx_callback(hackrf_transfer* transfer) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (stream_size>0){
|
if (stream_size>0){
|
||||||
|
#ifndef _WIN32
|
||||||
if ((stream_size-1+stream_head-stream_tail)%stream_size <bytes_to_write) {
|
if ((stream_size-1+stream_head-stream_tail)%stream_size <bytes_to_write) {
|
||||||
stream_drop++;
|
stream_drop++;
|
||||||
} else {
|
} else {
|
||||||
@ -390,6 +391,7 @@ int rx_callback(hackrf_transfer* transfer) {
|
|||||||
};
|
};
|
||||||
__atomic_store_n(&stream_tail,(stream_tail+bytes_to_write)%stream_size,__ATOMIC_RELEASE);
|
__atomic_store_n(&stream_tail,(stream_tail+bytes_to_write)%stream_size,__ATOMIC_RELEASE);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
return 0;
|
return 0;
|
||||||
} else {
|
} else {
|
||||||
bytes_written = fwrite(transfer->buffer, 1, bytes_to_write, fd);
|
bytes_written = fwrite(transfer->buffer, 1, bytes_to_write, fd);
|
||||||
@ -490,7 +492,10 @@ static void usage() {
|
|||||||
printf("\t[-s sample_rate_hz] # Sample rate in Hz (4/8/10/12.5/16/20MHz, default %sMHz).\n",
|
printf("\t[-s sample_rate_hz] # Sample rate in Hz (4/8/10/12.5/16/20MHz, default %sMHz).\n",
|
||||||
u64toa((DEFAULT_SAMPLE_RATE_HZ/FREQ_ONE_MHZ),&ascii_u64_data1));
|
u64toa((DEFAULT_SAMPLE_RATE_HZ/FREQ_ONE_MHZ),&ascii_u64_data1));
|
||||||
printf("\t[-n num_samples] # Number of samples to transfer (default is unlimited).\n");
|
printf("\t[-n num_samples] # Number of samples to transfer (default is unlimited).\n");
|
||||||
|
#ifndef _WIN32
|
||||||
|
/* The required atomic load/store functions aren't available when using C with MSVC */
|
||||||
printf("\t[-S buf_size] # Enable receive streaming with buffer size buf_size.\n");
|
printf("\t[-S buf_size] # Enable receive streaming with buffer size buf_size.\n");
|
||||||
|
#endif
|
||||||
printf("\t[-c amplitude] # CW signal source mode, amplitude 0-127 (DC value to DAC).\n");
|
printf("\t[-c amplitude] # CW signal source mode, amplitude 0-127 (DC value to DAC).\n");
|
||||||
printf("\t[-R] # Repeat TX mode (default is off) \n");
|
printf("\t[-R] # Repeat TX mode (default is off) \n");
|
||||||
printf("\t[-b baseband_filter_bw_hz] # Set baseband filter bandwidth in Hz.\n\tPossible values: 1.75/2.5/3.5/5/5.5/6/7/8/9/10/12/14/15/20/24/28MHz, default < sample_rate_hz.\n" );
|
printf("\t[-b baseband_filter_bw_hz] # Set baseband filter bandwidth in Hz.\n\tPossible values: 1.75/2.5/3.5/5/5.5/6/7/8/9/10/12/14/15/20/24/28MHz, default < sample_rate_hz.\n" );
|
||||||
@ -1042,6 +1047,7 @@ int main(int argc, char** argv) {
|
|||||||
struct timeval time_now;
|
struct timeval time_now;
|
||||||
float time_difference, rate;
|
float time_difference, rate;
|
||||||
if (stream_size>0) {
|
if (stream_size>0) {
|
||||||
|
#ifndef _WIN32
|
||||||
if(stream_head==stream_tail) {
|
if(stream_head==stream_tail) {
|
||||||
usleep(10000); // queue empty
|
usleep(10000); // queue empty
|
||||||
} else {
|
} else {
|
||||||
@ -1063,9 +1069,9 @@ int main(int argc, char** argv) {
|
|||||||
uint32_t drops= __atomic_exchange_n (&stream_drop,0,__ATOMIC_SEQ_CST);
|
uint32_t drops= __atomic_exchange_n (&stream_drop,0,__ATOMIC_SEQ_CST);
|
||||||
printf("dropped frames: [%d]\n",drops);
|
printf("dropped frames: [%d]\n",drops);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
} else {
|
} else {
|
||||||
sleep(1);
|
sleep(1);
|
||||||
|
|
||||||
gettimeofday(&time_now, NULL);
|
gettimeofday(&time_now, NULL);
|
||||||
|
|
||||||
byte_count_now = byte_count;
|
byte_count_now = byte_count;
|
||||||
|
@ -26,6 +26,11 @@ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSI
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
#include <libusb.h>
|
#include <libusb.h>
|
||||||
|
|
||||||
|
#ifdef _WIN32
|
||||||
|
/* Avoid redefinition of timespec from time.h (included by libusb.h) */
|
||||||
|
#define HAVE_STRUCT_TIMESPEC 1
|
||||||
|
#endif
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
|
|
||||||
#ifndef bool
|
#ifndef bool
|
||||||
@ -396,7 +401,7 @@ hackrf_device_list_t* ADDCALL hackrf_device_list()
|
|||||||
serial_number_length = libusb_get_string_descriptor_ascii(usb_device, serial_descriptor_index, (unsigned char*)serial_number, sizeof(serial_number));
|
serial_number_length = libusb_get_string_descriptor_ascii(usb_device, serial_descriptor_index, (unsigned char*)serial_number, sizeof(serial_number));
|
||||||
if( serial_number_length == 32 ) {
|
if( serial_number_length == 32 ) {
|
||||||
serial_number[32] = 0;
|
serial_number[32] = 0;
|
||||||
list->serial_numbers[idx] = strndup(serial_number, serial_number_length);
|
list->serial_numbers[idx] = strdup(serial_number);
|
||||||
}
|
}
|
||||||
|
|
||||||
libusb_close(usb_device);
|
libusb_close(usb_device);
|
||||||
|
@ -216,8 +216,8 @@ extern ADDAPI int ADDCALL hackrf_init_sweep(hackrf_device* device,
|
|||||||
int length, uint32_t dwell_time);
|
int length, uint32_t dwell_time);
|
||||||
|
|
||||||
/* Operacake functions */
|
/* Operacake functions */
|
||||||
int ADDCALL hackrf_get_operacake_boards(hackrf_device* device, uint8_t* boards);
|
extern ADDAPI int ADDCALL hackrf_get_operacake_boards(hackrf_device* device, uint8_t* boards);
|
||||||
int ADDCALL hackrf_set_operacake_ports(hackrf_device* device,
|
extern ADDAPI int ADDCALL hackrf_set_operacake_ports(hackrf_device* device,
|
||||||
uint8_t address,
|
uint8_t address,
|
||||||
uint8_t port_a,
|
uint8_t port_a,
|
||||||
uint8_t port_b);
|
uint8_t port_b);
|
||||||
|
Reference in New Issue
Block a user