From fc36d71ee582dea1d71155942622be9d6797d186 Mon Sep 17 00:00:00 2001 From: hobbes1069 Date: Tue, 30 Jun 2015 18:02:47 +0000 Subject: [PATCH] Better support for cross-compiling of dependencies. git-svn-id: https://svn.code.sf.net/p/freetel/code@2230 01035d8c-6547-0410-b346-abe4f91aad63 --- fdmdv2-dev/cmake/BuildCodec2.cmake | 6 +++++- fdmdv2-dev/cmake/BuildPortaudio.cmake | 1 + fdmdv2-dev/cmake/BuildSpeex.cmake | 1 + fdmdv2-dev/cmake/BuildWxWidgets.cmake | 6 +----- fdmdv2-dev/cmake/MinGW.cmake | 8 ++++++++ 5 files changed, 16 insertions(+), 6 deletions(-) create mode 100644 fdmdv2-dev/cmake/MinGW.cmake diff --git a/fdmdv2-dev/cmake/BuildCodec2.cmake b/fdmdv2-dev/cmake/BuildCodec2.cmake index a1cd95c2..471eef8d 100644 --- a/fdmdv2-dev/cmake/BuildCodec2.cmake +++ b/fdmdv2-dev/cmake/BuildCodec2.cmake @@ -6,10 +6,14 @@ if(USE_STATIC_SPEEXDSP) -DSPEEXDSP_INCLUDE_DIR=${CMAKE_BINARY_DIR}/external/dist/include) endif() +if(CMAKE_CROSSCOMPILING) + set(CODEC2_CMAKE_ARGS "-DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}") +endif() + include(ExternalProject) ExternalProject_Add(codec2 SVN_REPOSITORY https://svn.code.sf.net/p/freetel/code/codec2-dev - CMAKE_ARGS ${SPEEXDSP_CMAKE_ARGS} + CMAKE_ARGS ${CODEC2_CMAKE_ARGS} ${SPEEXDSP_CMAKE_ARGS} INSTALL_COMMAND "" ) set(CODEC2_LIBRARIES diff --git a/fdmdv2-dev/cmake/BuildPortaudio.cmake b/fdmdv2-dev/cmake/BuildPortaudio.cmake index 60e9660c..cc33d061 100644 --- a/fdmdv2-dev/cmake/BuildPortaudio.cmake +++ b/fdmdv2-dev/cmake/BuildPortaudio.cmake @@ -13,6 +13,7 @@ endif() # Make sure that configure knows what system we're using when cross-compiling. if(MINGW AND CMAKE_CROSSCOMPILING) + include(cmake/MinGW.cmake) set(CONFIGURE_COMMAND ./configure --build=${HOST} --host=${HOST} --target=${HOST} --enable-cxx --without-jack --disable-shared --prefix=${CMAKE_BINARY_DIR}/external/dist) else() set(CONFIGURE_COMMAND ./configure --enable-cxx --without-jack --disable-shared --prefix=${CMAKE_BINARY_DIR}/external/dist) diff --git a/fdmdv2-dev/cmake/BuildSpeex.cmake b/fdmdv2-dev/cmake/BuildSpeex.cmake index b46c6e17..262d558f 100644 --- a/fdmdv2-dev/cmake/BuildSpeex.cmake +++ b/fdmdv2-dev/cmake/BuildSpeex.cmake @@ -1,6 +1,7 @@ set(SPEEXDSP_TARBALL "speexdsp-1.2rc3.tar.gz") if(MINGW AND CMAKE_CROSSCOMPILING) + include(cmake/MinGW.cmake) 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) diff --git a/fdmdv2-dev/cmake/BuildWxWidgets.cmake b/fdmdv2-dev/cmake/BuildWxWidgets.cmake index 82b6a021..901d8062 100644 --- a/fdmdv2-dev/cmake/BuildWxWidgets.cmake +++ b/fdmdv2-dev/cmake/BuildWxWidgets.cmake @@ -2,11 +2,7 @@ set(WXWIDGETS_TARBALL "wxWidgets-3.0.2") # If we're cross-compiling then we need to set the target host manually. if(MINGW AND CMAKE_CROSSCOMPILING) - if(${CMAKE_SIZEOF_VOID_P} EQUAL 8) - set(HOST x86_64-w64-mingw32) - else() - set(HOST i686-w64-mingw32) - endif() + include(cmake/MinGW.cmake) endif() # If not cross-compiling then use the built-in makefile, otherwise use standard configure. diff --git a/fdmdv2-dev/cmake/MinGW.cmake b/fdmdv2-dev/cmake/MinGW.cmake new file mode 100644 index 00000000..333c1dc0 --- /dev/null +++ b/fdmdv2-dev/cmake/MinGW.cmake @@ -0,0 +1,8 @@ +# If we're cross-compiling then we need to set the target host manually. +if(MINGW AND CMAKE_CROSSCOMPILING) + if(${CMAKE_SIZEOF_VOID_P} EQUAL 8) + set(HOST x86_64-w64-mingw32) + else() + set(HOST i686-w64-mingw32) + endif() +endif() -- 2.25.1