Add SoapySDR to MinGW-w64 build
This commit is contained in:
parent
6f91cb99fa
commit
b6b93870cf
4 changed files with 39 additions and 13 deletions
|
@ -237,7 +237,7 @@ matrix:
|
||||||
- gcc-mingw-w64-x86-64
|
- gcc-mingw-w64-x86-64
|
||||||
- mingw-w64-x86-64-dev
|
- mingw-w64-x86-64-dev
|
||||||
- gcc-mingw-w64
|
- gcc-mingw-w64
|
||||||
- p7zip
|
- p7zip-full
|
||||||
before_deploy: ./do_sysroot.sh
|
before_deploy: ./do_sysroot.sh
|
||||||
deploy:
|
deploy:
|
||||||
provider: bintray
|
provider: bintray
|
||||||
|
|
|
@ -1,3 +1,6 @@
|
||||||
|
# CMAKE_SYSROOT and CMAKE_STAGING_PREFIX need 3.0
|
||||||
|
cmake_minimum_required(VERSION 3.0)
|
||||||
|
|
||||||
# Linux, Windows, or Darwin
|
# Linux, Windows, or Darwin
|
||||||
SET(CMAKE_SYSTEM_NAME Windows)
|
SET(CMAKE_SYSTEM_NAME Windows)
|
||||||
|
|
||||||
|
@ -14,15 +17,18 @@ ENDIF()
|
||||||
# specify the cross compiler, choose 32/64
|
# specify the cross compiler, choose 32/64
|
||||||
SET(CMAKE_C_COMPILER ${tools}/bin/i686-w64-mingw32-gcc)
|
SET(CMAKE_C_COMPILER ${tools}/bin/i686-w64-mingw32-gcc)
|
||||||
#SET(CMAKE_C_COMPILER ${tools}/bin/x86_64-w64-mingw32-gcc)
|
#SET(CMAKE_C_COMPILER ${tools}/bin/x86_64-w64-mingw32-gcc)
|
||||||
|
#SET(CMAKE_RC_COMPILER ${tools}/bin/i686-w64-mingw32-windres)
|
||||||
|
|
||||||
# where is the target environment, choose 32/64
|
# where is the target environment, choose 32/64
|
||||||
SET(CMAKE_FIND_ROOT_PATH ${tools}/lib/gcc/i686-w64-mingw32/4.8)
|
#SET(CMAKE_FIND_ROOT_PATH ${tools}/lib/gcc/i686-w64-mingw32/4.8)
|
||||||
#SET(CMAKE_FIND_ROOT_PATH ${tools}/lib/gcc/x86_64-w64-mingw32/4.8)
|
#SET(CMAKE_FIND_ROOT_PATH ${tools}/lib/gcc/x86_64-w64-mingw32/4.8)
|
||||||
|
|
||||||
# NOTE: use a sysroot with libusb and rtl-sdr if available
|
# NOTE: use a sysroot with libusb and rtl-sdr if available
|
||||||
IF(DEFINED ENV{CMAKE_SYSROOT})
|
IF(DEFINED ENV{CMAKE_SYSROOT})
|
||||||
SET(CMAKE_SYSROOT $ENV{CMAKE_SYSROOT})
|
SET(CMAKE_SYSROOT $ENV{CMAKE_SYSROOT})
|
||||||
SET(CMAKE_STAGING_PREFIX $ENV{CMAKE_SYSROOT}/usr)
|
SET(CMAKE_STAGING_PREFIX $ENV{CMAKE_SYSROOT}/usr)
|
||||||
|
#SET(CMAKE_INSTALL_PREFIX /usr)
|
||||||
|
#list(INSERT CMAKE_FIND_ROOT_PATH 0 $ENV{CMAKE_SYSROOT})
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
# search for programs in the build host directories
|
# search for programs in the build host directories
|
||||||
|
|
|
@ -1,3 +1,6 @@
|
||||||
|
# CMAKE_SYSROOT and CMAKE_STAGING_PREFIX need 3.0
|
||||||
|
cmake_minimum_required(VERSION 3.0)
|
||||||
|
|
||||||
# Linux, Windows, or Darwin
|
# Linux, Windows, or Darwin
|
||||||
SET(CMAKE_SYSTEM_NAME Windows)
|
SET(CMAKE_SYSTEM_NAME Windows)
|
||||||
|
|
||||||
|
@ -14,15 +17,18 @@ ENDIF()
|
||||||
# specify the cross compiler, choose 32/64
|
# specify the cross compiler, choose 32/64
|
||||||
#SET(CMAKE_C_COMPILER ${tools}/bin/i686-w64-mingw32-gcc)
|
#SET(CMAKE_C_COMPILER ${tools}/bin/i686-w64-mingw32-gcc)
|
||||||
SET(CMAKE_C_COMPILER ${tools}/bin/x86_64-w64-mingw32-gcc)
|
SET(CMAKE_C_COMPILER ${tools}/bin/x86_64-w64-mingw32-gcc)
|
||||||
|
#SET(CMAKE_RC_COMPILER ${tools}/bin/x86_64-w64-mingw32-windres)
|
||||||
|
|
||||||
# where is the target environment, choose 32/64
|
# where is the target environment, choose 32/64
|
||||||
#SET(CMAKE_FIND_ROOT_PATH ${tools}/lib/gcc/i686-w64-mingw32/4.8)
|
#SET(CMAKE_FIND_ROOT_PATH ${tools}/lib/gcc/i686-w64-mingw32/4.8)
|
||||||
SET(CMAKE_FIND_ROOT_PATH ${tools}/lib/gcc/x86_64-w64-mingw32/4.8)
|
#SET(CMAKE_FIND_ROOT_PATH ${tools}/lib/gcc/x86_64-w64-mingw32/4.8)
|
||||||
|
|
||||||
# NOTE: use a sysroot with libusb and rtl-sdr if available
|
# NOTE: use a sysroot with libusb and rtl-sdr if available
|
||||||
IF(DEFINED ENV{CMAKE_SYSROOT})
|
IF(DEFINED ENV{CMAKE_SYSROOT})
|
||||||
SET(CMAKE_SYSROOT $ENV{CMAKE_SYSROOT})
|
SET(CMAKE_SYSROOT $ENV{CMAKE_SYSROOT})
|
||||||
SET(CMAKE_STAGING_PREFIX $ENV{CMAKE_SYSROOT}/usr)
|
SET(CMAKE_STAGING_PREFIX $ENV{CMAKE_SYSROOT}/usr)
|
||||||
|
#SET(CMAKE_INSTALL_PREFIX /usr)
|
||||||
|
#list(INSERT CMAKE_FIND_ROOT_PATH 0 $ENV{CMAKE_SYSROOT})
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
# search for programs in the build host directories
|
# search for programs in the build host directories
|
||||||
|
|
|
@ -4,12 +4,14 @@ set -e
|
||||||
|
|
||||||
libusb_ver=1.0.22
|
libusb_ver=1.0.22
|
||||||
rtlsdr_ver=0.6.0
|
rtlsdr_ver=0.6.0
|
||||||
|
pothos_ver=2020.01.26-vc14
|
||||||
|
|
||||||
# from https://libusb.info/
|
# from https://libusb.info/
|
||||||
[ -e libusb-${libusb_ver}.7z ] || curl -L -O https://github.com/libusb/libusb/releases/download/v${libusb_ver}/libusb-${libusb_ver}.7z
|
[ -e libusb-${libusb_ver}.7z ] || curl -L -O https://github.com/libusb/libusb/releases/download/v${libusb_ver}/libusb-${libusb_ver}.7z
|
||||||
mkdir libusb
|
mkdir -p libusb
|
||||||
7zr x -olibusb -y libusb-${libusb_ver}.7z
|
7z x -olibusb -y libusb-${libusb_ver}.7z
|
||||||
|
|
||||||
|
source_dir=$(dirname $(realpath -s $0))
|
||||||
sysroot32=$(pwd)/sysroot32
|
sysroot32=$(pwd)/sysroot32
|
||||||
sysroot64=$(pwd)/sysroot64
|
sysroot64=$(pwd)/sysroot64
|
||||||
sysroot32static=$(pwd)/sysroot32static
|
sysroot32static=$(pwd)/sysroot32static
|
||||||
|
@ -38,24 +40,24 @@ cd rtl-sdr-${rtlsdr_ver}
|
||||||
[ "$(uname)" = "Darwin" ] && export tools=/opt/local
|
[ "$(uname)" = "Darwin" ] && export tools=/opt/local
|
||||||
|
|
||||||
export CMAKE_SYSROOT=$sysroot32 ; echo $CMAKE_SYSROOT
|
export CMAKE_SYSROOT=$sysroot32 ; echo $CMAKE_SYSROOT
|
||||||
mkdir build-tmp ; cd build-tmp ; cmake -DCMAKE_TOOLCHAIN_FILE=../../cmake/Toolchain-gcc-mingw-w64-i686.cmake .. && make && make install ; cd ..
|
mkdir build-tmp ; cd build-tmp ; cmake -DCMAKE_TOOLCHAIN_FILE=$source_dir/cmake/Toolchain-gcc-mingw-w64-i686.cmake .. && make && make install ; cd ..
|
||||||
rm -rf build-tmp
|
rm -rf build-tmp
|
||||||
mv $sysroot32/usr/lib/librtlsdr_static.a $sysroot32/usr/lib/librtlsdr.a
|
mv $sysroot32/usr/lib/librtlsdr_static.a $sysroot32/usr/lib/librtlsdr.a
|
||||||
|
|
||||||
export CMAKE_SYSROOT=$sysroot32static ; echo $CMAKE_SYSROOT
|
export CMAKE_SYSROOT=$sysroot32static ; echo $CMAKE_SYSROOT
|
||||||
mkdir build-tmp ; cd build-tmp ; cmake -DCMAKE_TOOLCHAIN_FILE=../../cmake/Toolchain-gcc-mingw-w64-i686.cmake -DBUILD_SHARED_LIBS:BOOL=OFF .. && make && make install ; cd ..
|
mkdir build-tmp ; cd build-tmp ; cmake -DCMAKE_TOOLCHAIN_FILE=$source_dir/cmake/Toolchain-gcc-mingw-w64-i686.cmake -DBUILD_SHARED_LIBS:BOOL=OFF .. && make && make install ; cd ..
|
||||||
rm -rf build-tmp
|
rm -rf build-tmp
|
||||||
mv $sysroot32static/usr/lib/librtlsdr_static.a $sysroot32static/usr/lib/librtlsdr.a
|
mv $sysroot32static/usr/lib/librtlsdr_static.a $sysroot32static/usr/lib/librtlsdr.a
|
||||||
rm $sysroot32static/usr/lib/librtlsdr.dll.a
|
rm $sysroot32static/usr/lib/librtlsdr.dll.a
|
||||||
rm $sysroot32static/usr/bin/librtlsdr.dll
|
rm $sysroot32static/usr/bin/librtlsdr.dll
|
||||||
|
|
||||||
export CMAKE_SYSROOT=$sysroot64 ; echo $CMAKE_SYSROOT
|
export CMAKE_SYSROOT=$sysroot64 ; echo $CMAKE_SYSROOT
|
||||||
mkdir build-tmp ; cd build-tmp ; cmake -DCMAKE_TOOLCHAIN_FILE=../../cmake/Toolchain-gcc-mingw-w64-x86-64.cmake .. && make && make install ; cd ..
|
mkdir build-tmp ; cd build-tmp ; cmake -DCMAKE_TOOLCHAIN_FILE=$source_dir/cmake/Toolchain-gcc-mingw-w64-x86-64.cmake .. && make && make install ; cd ..
|
||||||
rm -rf build-tmp
|
rm -rf build-tmp
|
||||||
mv $sysroot64/usr/lib/librtlsdr_static.a $sysroot64/usr/lib/librtlsdr.a
|
mv $sysroot64/usr/lib/librtlsdr_static.a $sysroot64/usr/lib/librtlsdr.a
|
||||||
|
|
||||||
export CMAKE_SYSROOT=$sysroot64static ; echo $CMAKE_SYSROOT
|
export CMAKE_SYSROOT=$sysroot64static ; echo $CMAKE_SYSROOT
|
||||||
mkdir build-tmp ; cd build-tmp ; cmake -DCMAKE_TOOLCHAIN_FILE=../../cmake/Toolchain-gcc-mingw-w64-x86-64.cmake -DBUILD_SHARED_LIBS:BOOL=OFF .. && make && make install ; cd ..
|
mkdir build-tmp ; cd build-tmp ; cmake -DCMAKE_TOOLCHAIN_FILE=$source_dir/cmake/Toolchain-gcc-mingw-w64-x86-64.cmake -DBUILD_SHARED_LIBS:BOOL=OFF .. && make && make install ; cd ..
|
||||||
rm -rf build-tmp
|
rm -rf build-tmp
|
||||||
mv $sysroot64static/usr/lib/librtlsdr_static.a $sysroot64static/usr/lib/librtlsdr.a
|
mv $sysroot64static/usr/lib/librtlsdr_static.a $sysroot64static/usr/lib/librtlsdr.a
|
||||||
rm $sysroot64static/usr/lib/librtlsdr.dll.a
|
rm $sysroot64static/usr/lib/librtlsdr.dll.a
|
||||||
|
@ -63,10 +65,22 @@ rm $sysroot64static/usr/bin/librtlsdr.dll
|
||||||
|
|
||||||
cd ..
|
cd ..
|
||||||
|
|
||||||
|
# from https://downloads.myriadrf.org/builds/PothosSDR/
|
||||||
|
[ -e PothosSDR-${pothos_ver}-x64.exe ] || curl -L -O https://downloads.myriadrf.org/builds/PothosSDR/PothosSDR-${pothos_ver}-x64.exe
|
||||||
|
mkdir -p pothos
|
||||||
|
7z x -opothos -y PothosSDR-${pothos_ver}-x64.exe
|
||||||
|
# workaround: 7-Zip 9.20 creates strange root directories
|
||||||
|
[ -e pothos/bin ] || mv pothos/*/* pothos/ || :
|
||||||
|
cp pothos/bin/SoapySDR.dll $sysroot64/usr/bin
|
||||||
|
cp -R pothos/include/SoapySDR $sysroot64/usr/include
|
||||||
|
cp pothos/lib/SoapySDR.lib $sysroot64/usr/lib
|
||||||
|
cp -R pothos/cmake $sysroot64/usr
|
||||||
|
sed -i 's/.*INTERFACE_COMPILE_OPTIONS.*//g' $sysroot64/usr/cmake/SoapySDRExport.cmake
|
||||||
|
|
||||||
# build rtl_433
|
# build rtl_433
|
||||||
|
|
||||||
export CMAKE_SYSROOT=$sysroot32 ; echo $CMAKE_SYSROOT
|
export CMAKE_SYSROOT=$sysroot32 ; echo $CMAKE_SYSROOT
|
||||||
mkdir build-tmp ; cd build-tmp ; cmake -DCMAKE_TOOLCHAIN_FILE=../cmake/Toolchain-gcc-mingw-w64-i686.cmake .. && make && make install ; cd ..
|
mkdir build-tmp ; cd build-tmp ; cmake -DCMAKE_TOOLCHAIN_FILE=$source_dir/cmake/Toolchain-gcc-mingw-w64-i686.cmake $source_dir && make && make install ; cd ..
|
||||||
rm -rf build-tmp
|
rm -rf build-tmp
|
||||||
# Non-static 32-bit binary from w64 compiler is broken with
|
# Non-static 32-bit binary from w64 compiler is broken with
|
||||||
# missing libgcc_s_sjlj-1.dll, libwinpthread-1.dll
|
# missing libgcc_s_sjlj-1.dll, libwinpthread-1.dll
|
||||||
|
@ -76,16 +90,16 @@ rm -rf build-tmp
|
||||||
mv $sysroot32/usr/bin/rtl_433.exe $sysroot32/usr/bin/rtl_433_32bit_nonstatic_broken.exe
|
mv $sysroot32/usr/bin/rtl_433.exe $sysroot32/usr/bin/rtl_433_32bit_nonstatic_broken.exe
|
||||||
|
|
||||||
export CMAKE_SYSROOT=$sysroot32static ; echo $CMAKE_SYSROOT
|
export CMAKE_SYSROOT=$sysroot32static ; echo $CMAKE_SYSROOT
|
||||||
mkdir build-tmp ; cd build-tmp ; cmake -DCMAKE_TOOLCHAIN_FILE=../cmake/Toolchain-gcc-mingw-w64-i686.cmake .. && make && make install ; cd ..
|
mkdir build-tmp ; cd build-tmp ; cmake -DCMAKE_TOOLCHAIN_FILE=$source_dir/cmake/Toolchain-gcc-mingw-w64-i686.cmake $source_dir && make && make install ; cd ..
|
||||||
rm -rf build-tmp
|
rm -rf build-tmp
|
||||||
mv $sysroot32static/usr/bin/rtl_433.exe $sysroot32static/usr/bin/rtl_433_32bit_static.exe
|
mv $sysroot32static/usr/bin/rtl_433.exe $sysroot32static/usr/bin/rtl_433_32bit_static.exe
|
||||||
|
|
||||||
export CMAKE_SYSROOT=$sysroot64 ; echo $CMAKE_SYSROOT
|
export CMAKE_SYSROOT=$sysroot64 ; echo $CMAKE_SYSROOT
|
||||||
mkdir build-tmp ; cd build-tmp ; cmake -DCMAKE_TOOLCHAIN_FILE=../cmake/Toolchain-gcc-mingw-w64-x86-64.cmake .. && make && make install ; cd ..
|
mkdir build-tmp ; cd build-tmp ; cmake -DENABLE_SOAPYSDR=ON -DCMAKE_TOOLCHAIN_FILE=$source_dir/cmake/Toolchain-gcc-mingw-w64-x86-64.cmake $source_dir && make && make install ; cd ..
|
||||||
rm -rf build-tmp
|
rm -rf build-tmp
|
||||||
|
|
||||||
export CMAKE_SYSROOT=$sysroot64static ; echo $CMAKE_SYSROOT
|
export CMAKE_SYSROOT=$sysroot64static ; echo $CMAKE_SYSROOT
|
||||||
mkdir build-tmp ; cd build-tmp ; cmake -DCMAKE_TOOLCHAIN_FILE=../cmake/Toolchain-gcc-mingw-w64-x86-64.cmake .. && make && make install ; cd ..
|
mkdir build-tmp ; cd build-tmp ; cmake -DCMAKE_TOOLCHAIN_FILE=$source_dir/cmake/Toolchain-gcc-mingw-w64-x86-64.cmake $source_dir && make && make install ; cd ..
|
||||||
rm -rf build-tmp
|
rm -rf build-tmp
|
||||||
mv $sysroot64static/usr/bin/rtl_433.exe $sysroot64static/usr/bin/rtl_433_64bit_static.exe
|
mv $sysroot64static/usr/bin/rtl_433.exe $sysroot64static/usr/bin/rtl_433_64bit_static.exe
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue