diff --git a/Build-Windows.md b/Build-Windows.md index 0c97dd5..f3f19db 100644 --- a/Build-Windows.md +++ b/Build-Windows.md @@ -8,7 +8,7 @@ Visual Studio 2017 also has a better optimizing compiler which may result a fast Interesting point, VS2017 produces binaries compatible with VS2015 ones, so there is no point of not using VS2017. -Alternatively if you don't want to compile anything and install pre-built binaries instead of an almost up to date CubicSDR (typically a month-old), you can install the amazing [PothosSDR distribution](https://github.com/pothosware/PothosSDR/wiki/Tutorial) (Rsources / Download installer) +Alternatively if you don't want to compile anything and install pre-built binaries instead of an almost up to date CubicSDR (typically a month-old), you can install the amazing [PothosSDR distribution](https://github.com/pothosware/PothosSDR/wiki/Tutorial) (Resources / Download installer) # Install Visual Studio Community 2017 @@ -94,6 +94,7 @@ Configure variables to indicate CubicSDR that modules files will be searched in Easiest way: use a pre-compiled `librtlsdr` binary which also package `libusb` from the [librtlsdr Releases](https://github.com/librtlsdr/librtlsdr/releases) page and choose the "x64" version. Or re-compile both libraries : (not complete) + * Clone or download https://github.com/libusb/libusb to C:\MSVCDev\libusb and build it using `C:\MSVCDev\libusb\msvc\libusb_2017.sln` choosing the `Release` and `x64` configuration. * Clone or download https://github.com/librtlsdr/librtlsdr to C:\MSVCDev\librtlsdr * Launch CMake, set source path to C:/MSVCDev/librtlsdr/ @@ -101,8 +102,8 @@ Or re-compile both libraries : (not complete) * Click "Configure" and choose "Visual Studio 15 2017 Win64" and Finish * Set LIBUSB_INCLUDE_DIR to C:/MSVCDev/libusb/ * Set LIBUSB_LIBRARIES to C:/MSVCDev/libusb/x64/Release/dll/libusb-1.0.lib -* Set THREADS_PTHREADS_INCLUDE_DIR to (TBD) -* Set THREADS_PTHREADS_WIN32_LIBRARY to (TBD) +* Set THREADS_PTHREADS_INCLUDE_DIR to (TODO, decribe pthreads-win32 installation) +* Set THREADS_PTHREADS_WIN32_LIBRARY to (TODO, decribe pthreads-win32 installation) * Click "Configure" again and then click "Generate" Open "Developer Command Prompt for VS2017" by right-clicking and "Run as Administrator". @@ -125,7 +126,7 @@ Either way, copy the files `rtlsdr.dll` and `libusb-1.0.dll` in the `C:\MSVCDev\ * Set destination to C:/MSVCDev/SoapyRTLSDR_win64/ * Click "Configure" and choose "Visual Studio 15 2017 Win64" and Finish * Set RTLSDR_INCLUDE_DIR to C:/MSVCDev/librtlsdr/include -* Set RTLSDR_LIBRARY to C:/MSVCDev/librtlsdr_win64/x64/rtlsdr.lib +* Set RTLSDR_LIBRARY to C:/MSVCDev/librtlsdr_win64/src/Release/rtlsdr.lib * Click "Configure" again and then click "Generate" Open "Developer Command Prompt for VS2017" by right-clicking and "Run as Administrator". @@ -143,57 +144,17 @@ Copy the generated module file `rtlsdrSupport.dll` in the C:\MSVCDev\CubicSDR_wi ## SoapySDRPlay * Clone or download ZIP from https://github.com/pothosware/SoapySDRPlay to C:\MSVCDev\SoapySDRPlay -* Download "Windows API & Hardware Driver Installer" from http://sdrplay.com/windows.html and install it with defaults. -* Copy C:\Program Files\MiricsSDR\API\x64\mir_sdr_api.dll to C:\Program Files\SoapySDR\bin - - -Open "Developer Command Prompt for VS2015" by right-clicking and "Run as Administrator". - -From the prompt: - -``` -C:\> cd "C:\Program Files\MiricsSDR\API\x64" -C:\Program Files\MiricsSDR\API\x64>dumpbin /exports mir_sdr_api.dll > mir_sdr_api.def -``` - -Leave prompt open and edit the .def file down so it looks like this; remove some lines and prefixes and add "EXPORTS" at the top. - -(reference only, these are the functions at the time of this instruction) -``` -EXPORTS -mir_sdr_ApiVersion -mir_sdr_DownConvert -mir_sdr_Init -mir_sdr_ReadPacket -mir_sdr_ResetUpdateFlags -mir_sdr_SetDcMode -mir_sdr_SetDcTrackTime -mir_sdr_SetFs -mir_sdr_SetGr -mir_sdr_SetGrParams -mir_sdr_SetParam -mir_sdr_SetRf -mir_sdr_SetSyncUpdatePeriod -mir_sdr_SetSyncUpdateSampleNum -mir_sdr_SetTransferMode -mir_sdr_Uninit -``` - -From the prompt: - -``` -C:\Program Files\MiricsSDR\API\x64>lib /MACHINE:x64 /def:mir_sdr_api.def /OUT:mir_sdr_api.lib -Microsoft (R) Library Manager Version 14.00.23026.0 -Copyright (C) Microsoft Corporation. All rights reserved. - - Creating library mir_sdr_api.lib and object mir_sdr_api.exp -C:\Program Files\MiricsSDR\API\x64> -``` - -* Launch CMake, set source path to C:/MSVCDev/SoapySDRPlay/ +* Download "API/HW Driver" from https://www.sdrplay.com/downloads/ and install it with defaults. +* Launch CMake, set source path to C:/MSVCDev/SoapySDRPlay / * Set destination to C:/MSVCDev/SoapySDRPlay_win64/ -* Click "Configure" and choose "Visual Studio 14 2015 Win64" and Finish -* Click "Generate" +* Click "Configure" and choose "Visual Studio 15 2017 Win64" and Finish +* Set LIBSDRPLAY_INCLUDE_DIRS to C:/Program Files/SDRplay/API/inc +* Set LIBSDRPLAY_LIBRARIES to C:/Program Files/SDRplay/API/x64/mir_sdr_api.lib +* Set SOAPY_SDR_INCLUDE_DIR to C:/MSVCDev/SoapySDR/include +* Set SOAPY_SDR_LIBRARY to C:/MSVCDev/SoapySDR_win64/lib/Release/SoapySDR.lib +* Click "Configure" again and then click "Generate" + +Open "Developer Command Prompt for VS2017" by right-clicking and "Run as Administrator". From the prompt: @@ -203,4 +164,15 @@ C:\MSVCDEV> cmake --build SoapySDRPlay_win64 --config Release --target install ... Bunch of building ... 0 Error(s) ``` + Copy the generated module file `sdrPlaySupport.dll` in the C:\MSVCDev\CubicSDR_win64\x64\modules directory where CubicSDR can find it. + +# Debugging CubicSDR + +Although all binaries are compiled in `Release`, it doesn't prevent debugging with it. + +In Visual Studio, select the `RelWithDebInfo` configuration. Then go to CubicSDR subproject Configuration Properties => C++ => Optimization and modify the following options: +* Optimization: Disabled (/Od) +* Inline Function Expansion: Disabled (/Ob0) + +This particular binary is generated in C:\MSVCDev\CubicSDR_win64\x64\RelWithDbInfo\, so take care of copying all the Cubic resources (`modules`, `fonts` and additional libraries) in this directory so it can execute properly. \ No newline at end of file