-
Notifications
You must be signed in to change notification settings - Fork 221
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
cross build for win32 and win64(amd64) using mingw-gcc and github act…
…ions Signed-off-by: hayati ayguen <[email protected]>
- Loading branch information
Showing
6 changed files
with
225 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
#!/bin/bash | ||
|
||
# requires debian/ubuntu packages: zip gcc-mingw-w64 | ||
|
||
REPO_DIR=$(pwd) | ||
|
||
if [ -z "$1" ]; then | ||
echo "usage: $0 <zip-post> <any other cmake options>" | ||
exit 1 | ||
fi | ||
|
||
ZIP_POST="$1" | ||
shift | ||
|
||
CROSS="i686-w64-mingw32" | ||
WN="w32" | ||
TOOLCHAIN="mingw-w32-i686.cmake" | ||
|
||
# libusb | ||
if /bin/true; then | ||
cd ${REPO_DIR} && rm -rf libusb_${WN} | ||
cd ${REPO_DIR} && git clone --branch v1.0.23 https://github.com/libusb/libusb.git libusb_${WN} | ||
echo -e "\n\n********************************************************" | ||
echo "start build of libusb_${WN}" | ||
cd ${REPO_DIR}/libusb_${WN} && ./bootstrap.sh && \ | ||
CC=${CROSS}-gcc \ | ||
AR=${CROSS}-ar \ | ||
RANLIB=${CROSS}-ranlib \ | ||
./configure --prefix=${REPO_DIR}/mingw_libusb_${WN} --host=${CROSS} --disable-shared && \ | ||
make && make install | ||
echo -e "\n\nlisting of ${REPO_DIR}/mingw_libusb_${WN}" | ||
ls -alh ${REPO_DIR}/mingw_libusb_${WN} | ||
echo -e "\nlisting of ${REPO_DIR}/mingw_libusb_${WN}/include" | ||
ls -alh ${REPO_DIR}/mingw_libusb_${WN}/include | ||
echo -e "\nlisting of ${REPO_DIR}/mingw_libusb_${WN}/lib" | ||
ls -alh ${REPO_DIR}/mingw_libusb_${WN}/lib | ||
echo -e "\n" | ||
fi | ||
|
||
# librtlsdr | ||
if /bin/true; then | ||
cd ${REPO_DIR} && rm -rf build_${WN} | ||
echo -e "\n\n********************************************************" | ||
echo "start build of librtlsdr_${WN}" | ||
mkdir ${REPO_DIR}/build_${WN} && cd ${REPO_DIR}/build_${WN} && \ | ||
cmake -DCMAKE_TOOLCHAIN_FILE=${REPO_DIR}/${TOOLCHAIN} \ | ||
-DCMAKE_INSTALL_PREFIX=${REPO_DIR}/rtlsdr-bin-${WN}_${ZIP_POST} \ | ||
-DRTL_STATIC_BUILD=ON "$@" \ | ||
-DLIBUSB_INCLUDE_DIR=${REPO_DIR}/mingw_libusb_${WN}/include/libusb-1.0 \ | ||
-DLIBUSB_LIBRARIES=${REPO_DIR}/mingw_libusb_${WN}/lib/libusb-1.0.a \ | ||
../ && \ | ||
make && make install | ||
fi | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
#!/bin/bash | ||
|
||
# requires debian/ubuntu packages: zip gcc-mingw-w64 | ||
|
||
REPO_DIR=$(pwd) | ||
|
||
if [ -z "$1" ]; then | ||
echo "usage: $0 <zip-post> <any other cmake options>" | ||
exit 1 | ||
fi | ||
|
||
ZIP_POST="$1" | ||
shift | ||
|
||
CROSS="x86_64-w64-mingw32" | ||
WN="w64" | ||
TOOLCHAIN="mingw-w64-x64_64.cmake" | ||
|
||
# libusb | ||
if /bin/true; then | ||
cd ${REPO_DIR} && rm -rf libusb_${WN} | ||
cd ${REPO_DIR} && git clone --branch v1.0.23 https://github.com/libusb/libusb.git libusb_${WN} | ||
echo -e "\n\n********************************************************" | ||
echo "start build of libusb_${WN}" | ||
cd ${REPO_DIR}/libusb_${WN} && ./bootstrap.sh && \ | ||
CC=${CROSS}-gcc \ | ||
AR=${CROSS}-ar \ | ||
RANLIB=${CROSS}-ranlib \ | ||
./configure --prefix=${REPO_DIR}/mingw_libusb_${WN} --host=${CROSS} --disable-shared && \ | ||
make && make install | ||
echo -e "\n\nlisting of ${REPO_DIR}/mingw_libusb_${WN}" | ||
ls -alh ${REPO_DIR}/mingw_libusb_${WN} | ||
echo -e "\nlisting of ${REPO_DIR}/mingw_libusb_${WN}/include" | ||
ls -alh ${REPO_DIR}/mingw_libusb_${WN}/include | ||
echo -e "\nlisting of ${REPO_DIR}/mingw_libusb_${WN}/lib" | ||
ls -alh ${REPO_DIR}/mingw_libusb_${WN}/lib | ||
echo -e "\n" | ||
fi | ||
|
||
# librtlsdr | ||
if /bin/true; then | ||
cd ${REPO_DIR} && rm -rf build_${WN} | ||
echo -e "\n\n********************************************************" | ||
echo "start build of librtlsdr_${WN}" | ||
mkdir ${REPO_DIR}/build_${WN} && cd ${REPO_DIR}/build_${WN} && \ | ||
cmake -DCMAKE_TOOLCHAIN_FILE=${REPO_DIR}/${TOOLCHAIN} \ | ||
-DCMAKE_INSTALL_PREFIX=${REPO_DIR}/rtlsdr-bin-${WN}_${ZIP_POST} \ | ||
-DRTL_STATIC_BUILD=ON "$@" \ | ||
-DLIBUSB_INCLUDE_DIR=${REPO_DIR}/mingw_libusb_${WN}/include/libusb-1.0 \ | ||
-DLIBUSB_LIBRARIES=${REPO_DIR}/mingw_libusb_${WN}/lib/libusb-1.0.a \ | ||
../ && \ | ||
make && make install | ||
fi | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# Sample toolchain file for building for Windows from an Ubuntu Linux system. | ||
# | ||
# Typical usage: | ||
# *) install cross compiler: `sudo apt-get install mingw-w64` | ||
# *) cd build | ||
# *) cmake -DCMAKE_TOOLCHAIN_FILE=~/mingw-w32-i686.cmake .. | ||
# | ||
# build for Windows' 32 bit architecture | ||
|
||
set(CMAKE_SYSTEM_NAME Windows) | ||
set(TOOLCHAIN_PREFIX i686-w64-mingw32) | ||
|
||
# cross compilers to use for C, C++ and Fortran | ||
set(CMAKE_C_COMPILER ${TOOLCHAIN_PREFIX}-gcc) | ||
set(CMAKE_CXX_COMPILER ${TOOLCHAIN_PREFIX}-g++) | ||
set(CMAKE_RC_COMPILER ${TOOLCHAIN_PREFIX}-windres) | ||
|
||
# target environment on the build host system | ||
set(CMAKE_FIND_ROOT_PATH /usr/${TOOLCHAIN_PREFIX}) | ||
|
||
# modify default behavior of FIND_XXX() commands | ||
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) | ||
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) | ||
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# Sample toolchain file for building for Windows from an Ubuntu Linux system. | ||
# | ||
# Typical usage: | ||
# *) install cross compiler: `sudo apt-get install mingw-w64` | ||
# *) cd build | ||
# *) cmake -DCMAKE_TOOLCHAIN_FILE=~/mingw-w64-x86_64.cmake .. | ||
# | ||
# build for Windows' 64 bit architecture | ||
|
||
set(CMAKE_SYSTEM_NAME Windows) | ||
set(TOOLCHAIN_PREFIX x86_64-w64-mingw32) | ||
|
||
# cross compilers to use for C, C++ and Fortran | ||
set(CMAKE_C_COMPILER ${TOOLCHAIN_PREFIX}-gcc) | ||
set(CMAKE_CXX_COMPILER ${TOOLCHAIN_PREFIX}-g++) | ||
set(CMAKE_RC_COMPILER ${TOOLCHAIN_PREFIX}-windres) | ||
|
||
# target environment on the build host system | ||
set(CMAKE_FIND_ROOT_PATH /usr/${TOOLCHAIN_PREFIX}) | ||
|
||
# modify default behavior of FIND_XXX() commands | ||
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) | ||
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) | ||
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters