From ac0b47fa4c07459503536e20ffbf37efa7b81e43 Mon Sep 17 00:00:00 2001 From: hobbes1069 Date: Thu, 13 Jun 2013 15:40:39 +0000 Subject: [PATCH] Update wxWidgets bootstrap process to be more simple and other tweaks to USE_STATIC_... options. git-svn-id: https://svn.code.sf.net/p/freetel/code@1317 01035d8c-6547-0410-b346-abe4f91aad63 --- fdmdv2/CMakeLists.txt | 35 +++++++++++++++++------------- fdmdv2/README.cmake | 36 ++++++++++++++++++++++--------- fdmdv2/README.txt | 1 + fdmdv2/cmake/BuildPortaudio.cmake | 12 +++++++++++ fdmdv2/cmake/BuildSndfile.cmake | 2 +- fdmdv2/cmake/BuildSox.cmake | 19 +++++++++++++++- 6 files changed, 78 insertions(+), 27 deletions(-) diff --git a/fdmdv2/CMakeLists.txt b/fdmdv2/CMakeLists.txt index 4bfa1751..81180a8f 100644 --- a/fdmdv2/CMakeLists.txt +++ b/fdmdv2/CMakeLists.txt @@ -38,8 +38,6 @@ endif(NOT CMAKE_BUILD_TYPE) message(STATUS "FreeDV version: ${FREEDV_VERSION}") -#set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake) - # Work around for not using a svn working copy. add_definitions(-DSVN_REVISION="Unversioned directory") add_definitions(-D_NO_AUTOTOOLS_) @@ -67,11 +65,13 @@ set(USE_STATIC_CODEC2 FALSE CACHE BOOL "Download and build static codec2 instead of the system library.") set(BOOTSTRAP_WXWIDGETS FALSE CACHE BOOL "Download and build static wxWidgets instead of the system library.") -set(USE_STATIC_WXWIDGETS FALSE CACHE BOOL - "Perform bootstrap build of wxWidgets, see README.cmake for more details.") # If we're bootstrapping wxWidgets then this must be set true. if(BOOTSTRAP_WXWIDGETS) - set(USE_STATIC_WXWIDGETS TRUE) + set(USE_STATIC_WXWIDGETS TRUE CACHE BOOL + "Perform bootstrap build of wxWidgets, see README.cmake for more details.") +else(BOOTSTRAP_WXWIDGETS) + set(USE_STATIC_WXWIDGETS FALSE CACHE BOOL + "Perform bootstrap build of wxWidgets, see README.cmake for more details.") endif(BOOTSTRAP_WXWIDGETS) if(USE_STATIC_DEPS) @@ -83,11 +83,23 @@ if(USE_STATIC_DEPS) set(USE_STATIC_CODEC2 TRUE FORCE) endif(USE_STATIC_DEPS) +# +# Pull in external wxWidgets target if performing static build. +# +if(BOOTSTRAP_WXWIDGETS) + include(cmake/BuildWxWidgets.cmake) +endif(BOOTSTRAP_WXWIDGETS) +# +# Perform bootstrap build of wxWidgets +# +if(BOOTSTRAP_WXWIDGETS AND NOT TARGET wxWidgets) + message(STATUS "Will perform bootstrap build of wxWidgets. + After make step completes, re-run cmake and make again to perform FreeDV build.") # # Continue normal build if not bootstrapping wxWidgets or already built it. # -if(NOT BOOTSTRAP_WXWIDGETS) +else(BOOTSTRAP_WXWIDGETS AND NOT TARGET wxWidgets) # Setup empty list to append to. set(FREEDV_LINK_LIBS "") @@ -326,7 +338,7 @@ set(WXRC "" CACHE FILEPATH "Location of wxrc binary.") if(USE_STATIC_WXWIDGETS) set(WXCONFIG "${CMAKE_BINARY_DIR}/external/dist/bin/wx-config") set(WXRC "${CMAKE_BINARY_DIR}/external/dist/bin/wxrc") - set(wxWidgets_CONFIG_OPTIONS --linkdeps) + #set(wxWidgets_CONFIG_OPTIONS --linkdeps) list(APPEND FREEDV_STATIC_DEPS wxWidgets) endif(USE_STATIC_WXWIDGETS) message(STATUS "Looking for wxWidgets...") @@ -459,11 +471,4 @@ if(WIN32) include(CPack) endif(WIN32) -# -# Perform bootstrap build of wxWidgets -# -else(NOT BOOTSTRAP_WXWIDGETS) - message(STATUS "Will perform bootstrap build of wxWidgets. -After make step completes, re-run cmake and make to perform FreeDV build.") - include(cmake/BuildWxWidgets.cmake) -endif(NOT BOOTSTRAP_WXWIDGETS) +endif(BOOTSTRAP_WXWIDGETS AND NOT TARGET wxWidgets) diff --git a/fdmdv2/README.cmake b/fdmdv2/README.cmake index 6b7fb97e..2848648c 100644 --- a/fdmdv2/README.cmake +++ b/fdmdv2/README.cmake @@ -4,16 +4,17 @@ well on most *nix systems and has many advanages over the autotools config. - Builds against system libraries (by default). - Or optionally download, build, and statically link with required libraries on - an individual basis. See USE_STATIC_??? options. + an individual basis. See USE_STATIC_??? options. + NOTE: We need test reports on mingw/Windows, not all dependencies will build. - Has experimental NSIS packaing support for Windows (WIN32) targets. *nix - systems should rely on 'make install' as the packages (RPM & DEB) created by - CPack are questionable. + systems should rely on 'make install' or tradional packaing methods as the + packages (RPM & DEB) created by CPack are questionable. -========================== - Building and installing -========================== +================================== + Building and installing on Linux +================================== - To test the cmake build make a directory anywhere underneath (or outside of) +To perform a cmake build create a directory anywhere underneath (or outside of) the source directory. Linux command line example: @@ -27,6 +28,20 @@ $ make (as root) $ make install +==================================== + Building and installing on Windows +==================================== + +The windows build is similar to linux and follows the same basic workflow. + +Only MinGW is supported. While it is likely possible to perform a pure MinGW +build, installing MSYS will make your life easier. + +CMake may not automatically detect that you're in the MSYS environment. If this +occurs you need to pass cmake the proper generator: + +cmake -G"MSYS Makefiles" [other options] + =============================== Bootstrapping wxWidgets build =============================== @@ -40,16 +55,17 @@ normally done at configure time, not during "make", it is not possible for CMake to have this information prior to building wxWidgets. In order to work around this issue you can "bootstrap" the wxWidgets build using -the CMake "BOOTSTRAP_WXWIDGETS" option. wxWidgets will be built using static +the CMake option, "BOOTSTRAP_WXWIDGETS". wxWidgets will be built using static libraries. -NOTE: This forces "USE_STATIC_WXWIDGETS" to be true. +NOTE: This forces "USE_STATIC_WXWIDGETS" to be true internally regarless of the +value set manually. (from any prefered directory outside of the source) $ cmake -DBOOTSTRAP_WXWIDGETS=TRUE $ make (wxWidgets is downloaded and built) -$ cmake -DBOOTSTRAP_WXWIDGETS=FALSE . +$ cmake . $ make (if all goes well, as root) $ make install diff --git a/fdmdv2/README.txt b/fdmdv2/README.txt index c75fef2d..89d11561 100644 --- a/fdmdv2/README.txt +++ b/fdmdv2/README.txt @@ -2,6 +2,7 @@ README.txt for FDMDV2 README.Win32 contains instructions for building on Windows. README.linux contains instructions for building on Linux. +README.cmake contains instructions for building on Windows or Linux using cmake. Editing ------- diff --git a/fdmdv2/cmake/BuildPortaudio.cmake b/fdmdv2/cmake/BuildPortaudio.cmake index c610168a..15aa7b2c 100644 --- a/fdmdv2/cmake/BuildPortaudio.cmake +++ b/fdmdv2/cmake/BuildPortaudio.cmake @@ -1,5 +1,16 @@ set(PORTAUDIO_TARBALL "pa_stable_v19_20111121") +# required linking libraries on linux. Not sure about windows. +find_library(ALSA_LIBRARIES asound) + +if(UNIX AND NOT ALSA_LIBRARIES) + message(ERROR "Could not find alsa library which is required for portaudio. +On Linux systems try installing: + alsa-lib-devel (RPM based systems) + libasound2-dev (DEB based systems)" + ) +endif(UNIX AND NOT ALSA_LIBRARIES) + include(ExternalProject) ExternalProject_Add(portaudio URL http://www.portaudio.com/archives/${PORTAUDIO_TARBALL}.tgz @@ -16,6 +27,7 @@ else(WIN32) find_library(ASOUND asound) set(PORTAUDIO_LIBRARIES ${CMAKE_BINARY_DIR}/external/dist/lib/libportaudio.a + ${CMAKE_BINARY_DIR}/external/dist/lib/libportaudiocpp.a ${RT} ${ASOUND} ) diff --git a/fdmdv2/cmake/BuildSndfile.cmake b/fdmdv2/cmake/BuildSndfile.cmake index 58265413..c5b13364 100644 --- a/fdmdv2/cmake/BuildSndfile.cmake +++ b/fdmdv2/cmake/BuildSndfile.cmake @@ -5,7 +5,7 @@ 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 + CONFIGURE_COMMAND ./configure --prefix=${CMAKE_BINARY_DIR}/external/dist --disable-external-libs BUILD_COMMAND $(MAKE) INSTALL_COMMAND $(MAKE) install ) diff --git a/fdmdv2/cmake/BuildSox.cmake b/fdmdv2/cmake/BuildSox.cmake index 535b5380..8dae3adf 100644 --- a/fdmdv2/cmake/BuildSox.cmake +++ b/fdmdv2/cmake/BuildSox.cmake @@ -4,12 +4,29 @@ set(SOX_TARBALL "sox-14.4.1") find_library(ALSA_LIBRARIES asound) find_library(AO_LIBRARIES ao) +if(UNIX AND NOT ALSA_LIBRARIES) + message(ERROR "Could not find alsa library. +On Linux systems try installing: + alsa-lib-devel (RPM based systems) + libasound2-dev (DEB based systems)" + ) +endif(UNIX AND NOT ALSA_LIBRARIES) + +if(UNIX AND NOT AO_LIBRARIES) + message(ERROR "Could not find libao. +On Linux systems try installing: + libao-devel (RPM based systems) + libao-dev (DEB based systems)" + ) +endif(UNIX AND NOT AO_LIBRARIES) + + 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 --disable-dl-sndfile --with-pulseaudio=no --without-magic --prefix=${CMAKE_BINARY_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 BUILD_COMMAND $(MAKE) INSTALL_COMMAND $(MAKE) install ) -- 2.25.1