From ef3efeb4b8b0a363dfe8bef2aab725de090eeecc Mon Sep 17 00:00:00 2001 From: drowe67 Date: Wed, 17 Jun 2015 00:58:55 +0000 Subject: [PATCH] modified ./configure to x-compile for windows on Unbuntu Linux. Just after first sucessful build of freedv.exe Not tested yet git-svn-id: https://svn.code.sf.net/p/freetel/code@2199 01035d8c-6547-0410-b346-abe4f91aad63 --- fdmdv2-dev/README.txt | 89 +++++++++++++++----------- fdmdv2-dev/cmake/BuildSamplerate.cmake | 8 ++- fdmdv2-dev/cmake/BuildSndfile.cmake | 8 ++- fdmdv2-dev/cmake/BuildSox.cmake | 8 ++- fdmdv2-dev/cmake/BuildSpeex.cmake | 8 ++- 5 files changed, 80 insertions(+), 41 deletions(-) diff --git a/fdmdv2-dev/README.txt b/fdmdv2-dev/README.txt index 18e6f378..db34eefa 100644 --- a/fdmdv2-dev/README.txt +++ b/fdmdv2-dev/README.txt @@ -8,65 +8,73 @@ Quickstart 1 Builds static versions of wxWidgets, portaudio, codec2-dev, which are commonly missing on many Linux systems, or of the wrong (older) version. -Assuming the freedv-dev sources is checked out into ~/fdmdv2-dev: +1/ Assuming the freedv-dev sources is checked out into ~/fdmdv2-dev: -$ sudo apt-get install libgtk2.0-dev libhamlib-dev libsamplerate-dev libasound2-dev libao-dev -$ cd fdmdv2-dev -$ mkdir build_linux -$ cd build_linux -$ cmake -DBOOTSTRAP_WXWIDGETS=TRUE ~/fdmdv2-dev -$ make -[wxWidgets builds] - -Then you can use your local codec-dev, something like: + $ sudo apt-get install libgtk2.0-dev libhamlib-dev libsamplerate-dev libasound2-dev libao-dev + $ cd fdmdv2-dev + $ mkdir build_linux + $ cd build_linux + $ cmake -DBOOTSTRAP_WXWIDGETS=TRUE ~/fdmdv2-dev + $ make -$ cmake -DCMAKE_BUILD_TYPE=Debug -DBOOTSTRAP_WXWIDGETS=TRUE -DCODEC2_INCLUDE_DIRS=/home/david/codec2-dev/src -DCODEC2_LIBRARY=/home/david/codec2-dev/build_linux/src/libcodec2.so -DUSE_STATIC_CODEC2=FALSE -DUSE_STATIC_PORTAUDIO=TRUE -DUSE_STATIC_SOX=TRUE ../ +2/ Then you can configure FreeDV using your local codec-dev, something like: -OR build a local copy of codec2-dev: + $ cmake -DCMAKE_BUILD_TYPE=Debug -DBOOTSTRAP_WXWIDGETS=TRUE -DCODEC2_INCLUDE_DIRS=/home/david/codec2-dev/src -DCODEC2_LIBRARY=/home/david/codec2-dev/build_linux/src/libcodec2.so -DUSE_STATIC_CODEC2=FALSE -DUSE_STATIC_PORTAUDIO=TRUE -DUSE_STATIC_SOX=TRUE ../ -$ cmake -DBOOTSTRAP_WXWIDGETS=TRUE -DUSE_STATIC_CODEC2=TRUE -DUSE_STATIC_PORTAUDIO=TRUE -DUSE_STATIC_SOX=TRUE ../ +3/ OR build a local copy of codec2-dev: -$ make -[FreeDV builds] -$ ./src/freedv + $ cmake -DBOOTSTRAP_WXWIDGETS=TRUE -DUSE_STATIC_CODEC2=TRUE -DUSE_STATIC_PORTAUDIO=TRUE -DUSE_STATIC_SOX=TRUE ../ + +4/ Build and run FreeDV: -Note: add "-DCMAKE_BUILD_TYPE=Debug" the list above for debug (gcc -g) buildthat include source line numbers and working asserts(). + $ make + $ ./src/freedv Quickstart 2 ------------ -Assuming you have all the dependant libraries: +1/ Assuming you have all the dependant libraries: -$ cd /path/to/fdmdv2 -$ mkdir build_linux -$ cd build_linux -$ cmake ../ (defaults to /usr/local, use CMAKE_INSTALL_PREFIX to override) -(if no errors) -$ make -(as root) -$ make install + $ cd /path/to/fdmdv2 + $ mkdir build_linux + $ cd build_linux + $ cmake ../ (defaults to /usr/local, use CMAKE_INSTALL_PREFIX to override) + (if no errors) + $ make + (as root) + $ make install ======================================================= Building for Windows on Ubuntu Linux (Cross compiling) ======================================================= -Patch cmake using: http://www.cmake.org/gitweb?p=stage/cmake.git;a=patch;h=33286235048495ceafb636d549d9a4e8891967ae +1/ Install the cross compiling toolchain: -$ sudo apt-get install mingw-w64 -$ cd /path/to/fdmdv2-dev -$ mkdir build_windows -$ cd build_windows -$ cmake -DBOOTSTRAP_WXWIDGETS=TRUE .. -DCMAKE_TOOLCHAIN_FILE=cmake/Toolchain-Ubuntu-mingw32.cmake -$ make + $ sudo apt-get install mingw-w64 + +2/ Patch cmake using: http://www.cmake.org/gitweb?p=stage/cmake.git;a=patch;h=33286235048495ceafb636d549d9a4e8891967ae + +3/ Checkout a fresh copy of codec2-dev and build for Windows, pointing to the generate_codebook built by a linux build of generate_codebook, using this cmake line + + $ cmake .. -DCMAKE_TOOLCHAIN_FILE=../fdmdv2-dev/cmake/Toolchain-Ubuntu-mingw32.cmake -DUNITTEST=FALSE -DGENERATE_CODEBOOK=/home/david/codec2-dev/build_linux/src/generate_codebook + +4/ Build WxWidgets + + $ cd /path/to/fdmdv2-dev + $ mkdir build_windows + $ cd build_windows + $ cmake -DBOOTSTRAP_WXWIDGETS=TRUE .. -DCMAKE_TOOLCHAIN_FILE=cmake/Toolchain-Ubuntu-mingw32.cmake + $ make -[wxWidgets builds] +5/ Download and install the Windows version of Hamlib: -$ wget http://internode.dl.sourceforge.net/project/hamlib/hamlib/1.2.15.3/hamlib-win32-1.2.15.3.zip -$ unzip hamlib-win32-1.2.15.3.zip + $ wget http://internode.dl.sourceforge.net/project/hamlib/hamlib/1.2.15.3/hamlib-win32-1.2.15.3.zip + $ unzip hamlib-win32-1.2.15.3.zip -$ cmake -DBOOTSTRAP_WXWIDGETS=TRUE -DCMAKE_TOOLCHAIN_FILE=cmake/Toolchain-Ubuntu-mingw32.cmake -DUSE_STATIC_DEPS=TRUE -DHAMLIB_INCLUDE_DIR=hamlib-win32-1.2.15.3/include -DHAMLIB_LIBRARY=hamlib-win32-1.2.15.3/lib .. +6/ Build All the libraries and FreeDV: + $ cmake -DBOOTSTRAP_WXWIDGETS=TRUE -DCMAKE_TOOLCHAIN_FILE=cmake/Toolchain-Ubuntu-mingw32.cmake -DUSE_STATIC_PORTAUDIO=TRUE -DUSE_STATIC_SNDFILE=TRUE -DUSE_STATIC_SAMPLERATE=TRUE -DUSE_STATIC_SOX=TRUE -DUSE_STATIC_CODEC2=FALSE -DCODEC2_INCLUDE_DIRS=/home/david/tmp/codec2-dev/src -DCODEC2_LIBRARY=/home/david/tmp/codec2-dev/build_windows/src/libcodec2.dll.a -DHAMLIB_INCLUDE_DIR=hamlib-win32-1.2.15.3/include -DHAMLIB_LIBRARY=hamlib-win32-1.2.15.3/lib/gcc/libhamlib.dll.a .. ==================================== Building and installing on Windows @@ -151,6 +159,13 @@ TODO [ ] tx works [ ] clipper a check box, so we can see difference in spectrum [ ] cohpsk snr est + [ ] squelch + [ ] from radio plot broken + [ ] freedv api + [ ] normalise output pwr across modes? + + or maybe peak output? + + option? + [X] support for both varicodes [ ] test mode [ ] get error patterns working again, both 700 and 1600 [ ] how to plot error histogram diff --git a/fdmdv2-dev/cmake/BuildSamplerate.cmake b/fdmdv2-dev/cmake/BuildSamplerate.cmake index 7d94e487..aa09f855 100644 --- a/fdmdv2-dev/cmake/BuildSamplerate.cmake +++ b/fdmdv2-dev/cmake/BuildSamplerate.cmake @@ -1,11 +1,17 @@ set(SAMPLERATE_TARBALL "libsamplerate-0.1.8") +if(MINGW AND CMAKE_CROSSCOMPILING) + set(CONFIGURE_COMMAND ./configure --build=${HOST} --host=${HOST} --target=${HOST} --prefix=${CMAKE_BINARY_DIR}/external/dist --disable-sndfile) +else() + set(CONFIGURE_COMMAND ./configure --prefix=${CMAKE_BINARY_DIR}/external/dist) +endif() + include(ExternalProject) ExternalProject_Add(samplerate URL http://www.mega-nerd.com/SRC/${SAMPLERATE_TARBALL}.tar.gz BUILD_IN_SOURCE 1 INSTALL_DIR external/dist - CONFIGURE_COMMAND ./configure --prefix=${CMAKE_BINARY_DIR}/external/dist + CONFIGURE_COMMAND ${CONFIGURE_COMMAND} BUILD_COMMAND $(MAKE) INSTALL_COMMAND $(MAKE) install ) diff --git a/fdmdv2-dev/cmake/BuildSndfile.cmake b/fdmdv2-dev/cmake/BuildSndfile.cmake index a3706ffa..43233fb7 100644 --- a/fdmdv2-dev/cmake/BuildSndfile.cmake +++ b/fdmdv2-dev/cmake/BuildSndfile.cmake @@ -1,11 +1,17 @@ set(SNDFILE_TARBALL "libsndfile-1.0.25") +if(MINGW AND CMAKE_CROSSCOMPILING) + set(CONFIGURE_COMMAND ./configure --host=${HOST} --prefix=${CMAKE_BINARY_DIR}/external/dist --disable-external-libs --disable-shared) +else() + set(CONFIGURE_COMMAND ./configure --prefix=${CMAKE_BINARY_DIR}/external/dist --disable-external-libs --disable-shared --disable-external-libs) +endif() + include(ExternalProject) ExternalProject_Add(sndfile URL http://www.mega-nerd.com/libsndfile/files/${SNDFILE_TARBALL}.tar.gz BUILD_IN_SOURCE 1 INSTALL_DIR external/dist - CONFIGURE_COMMAND ./configure --prefix=${CMAKE_BINARY_DIR}/external/dist --disable-external-libs --disable-shared + CONFIGURE_COMMAND ${CONFIGURE_COMMAND} BUILD_COMMAND $(MAKE) V=1 INSTALL_COMMAND $(MAKE) install ) diff --git a/fdmdv2-dev/cmake/BuildSox.cmake b/fdmdv2-dev/cmake/BuildSox.cmake index 635fc93d..e2529a63 100644 --- a/fdmdv2-dev/cmake/BuildSox.cmake +++ b/fdmdv2-dev/cmake/BuildSox.cmake @@ -20,12 +20,18 @@ On Linux systems try installing: ) endif(UNIX AND NOT AO_LIBRARIES) +if(MINGW AND CMAKE_CROSSCOMPILING) + set(CONFIGURE_COMMAND ./configure --build=${HOST} --host=${HOST} --target=${HOST} --enable-shared=no --without-id3tag --without-png --disable-gomp --with-oggvorbis=no --with-oss=no --with-flac=no --with-amrnb=no --with-amrwb=no --with-mp3=no --with-wavpack=no --disable-dl-sndfile --with-pulseaudio=no --without-magic --prefix=${CMAKE_BINARY_DIR}/external/dist) +else() + set(CONFIGURE_COMMAND ./configure --enable-shared=no --without-id3tag --without-png --disable-gomp --with-oggvorbis=no --with-oss=no --with-flac=no --with-amrnb=no --with-amrwb=no --with-mp3=no --with-wavpack=no --disable-dl-sndfile --with-pulseaudio=no --without-magic --prefix=${CMAKE_BINARY_DIR}/external/dist) +endif() + include(ExternalProject) ExternalProject_Add(sox URL http://downloads.sourceforge.net/sox/${SOX_TARBALL}.tar.gz BUILD_IN_SOURCE 1 INSTALL_DIR external/dist - CONFIGURE_COMMAND ./configure --enable-shared=no --without-id3tag --without-png --disable-gomp --with-oggvorbis=no --with-oss=no --with-flac=no --with-amrnb=no --with-amrwb=no --with-mp3=no --with-wavpack=no --disable-dl-sndfile --with-pulseaudio=no --without-magic --prefix=${CMAKE_BINARY_DIR}/external/dist + CONFIGURE_COMMAND ${CONFIGURE_COMMAND} BUILD_COMMAND $(MAKE) V=1 INSTALL_COMMAND $(MAKE) install ) diff --git a/fdmdv2-dev/cmake/BuildSpeex.cmake b/fdmdv2-dev/cmake/BuildSpeex.cmake index 17b53d6b..b46c6e17 100644 --- a/fdmdv2-dev/cmake/BuildSpeex.cmake +++ b/fdmdv2-dev/cmake/BuildSpeex.cmake @@ -1,11 +1,17 @@ set(SPEEXDSP_TARBALL "speexdsp-1.2rc3.tar.gz") +if(MINGW AND CMAKE_CROSSCOMPILING) + set(CONFIGURE_COMMAND ./configure --host=${HOST} --prefix=${CMAKE_BINARY_DIR}/external/dist --disable-examples) +else() + set(CONFIGURE_COMMAND ./configure --prefix=${CMAKE_BINARY_DIR}/external/dist --disable-examples) +endif() + include(ExternalProject) ExternalProject_Add(speex URL http://downloads.xiph.org/releases/speex/${SPEEXDSP_TARBALL} BUILD_IN_SOURCE 1 INSTALL_DIR external/dist - CONFIGURE_COMMAND ./configure --prefix=${CMAKE_BINARY_DIR}/external/dist --disable-examples + CONFIGURE_COMMAND ${CONFIGURE_COMMAND} BUILD_COMMAND $(MAKE) INSTALL_COMMAND $(MAKE) install ) -- 2.25.1