From 75fe602e1ae690f5f4124ef8b45690fef285aab6 Mon Sep 17 00:00:00 2001 From: hobbes1069 Date: Wed, 8 May 2013 19:38:44 +0000 Subject: [PATCH] CMake configuration tweaks for wxWidgets bootstrap build option and update of README.cmake. git-svn-id: https://svn.code.sf.net/p/freetel/code@1244 01035d8c-6547-0410-b346-abe4f91aad63 --- fdmdv2/CMakeLists.txt | 90 +++++++++++++++++++------------ fdmdv2/README.cmake | 31 +++++++++++ fdmdv2/cmake/BuildWxWidgets.cmake | 4 +- 3 files changed, 89 insertions(+), 36 deletions(-) diff --git a/fdmdv2/CMakeLists.txt b/fdmdv2/CMakeLists.txt index 284755d4..c36381ef 100644 --- a/fdmdv2/CMakeLists.txt +++ b/fdmdv2/CMakeLists.txt @@ -59,8 +59,17 @@ set(USE_STATIC_LIBCTB FALSE CACHE BOOL "Download and build static libctb instead of the system library.") set(USE_STATIC_CODEC2 FALSE CACHE BOOL "Download and build static codec2 instead of the system library.") -set(USE_STATIC_WXWIDGETS FALSE CACHE BOOL +set(BOOTSTRAP_WXWIDGETS FALSE CACHE BOOL "Download and build static wxWidgets instead of the system library.") +# If we're bootstrapping wxWidgets then this must be set true. +if(BOOTSTRAP_WXWIDGETS) + 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) set(USE_STATIC_PORTAUDIO TRUE FORCE) set(USE_STATIC_SNDFILE TRUE FORCE) @@ -68,10 +77,14 @@ if(USE_STATIC_DEPS) set(USE_STATIC_SOX TRUE FORCE) set(USE_STATIC_LIBCTB TRUE FORCE) set(USE_STATIC_CODEC2 TRUE FORCE) - #set(USE_STATIC_WXWIDGETS TRUE FORCE) endif(USE_STATIC_DEPS) +# +# Continue normal build if not bootstrapping wxWidgets or already built it. +# +if(NOT BOOTSTRAP_WXWIDGETS) + # Setup empty list to append to. set(FREEDV_LINK_LIBS "") set(FREEDV_STATIC_LIBS "") @@ -225,39 +238,39 @@ endif(NOT USE_STATIC_SOX) set(WXCONFIG "" CACHE FILEPATH "Location of wx-config binary.") set(WXRC "" CACHE FILEPATH "Location of wxrc binary.") if(USE_STATIC_WXWIDGETS) - include(cmake/BuildWxWidgets.cmake) -else(USE_STATIC_WXWIDGETS) - message(STATUS "Looking for wxWidgets...") - if(WXCONFIG) - message(STATUS "wx-config: ${WXCONFIG}") - set(wxWidgets_CONFIG_EXECUTABLE ${WXCONFIG}) - endif(WXCONFIG) - if(WXRC) - message(STATUS "wxrc: ${WXRC}") - set(wxWidgets_wxrc_EXECUTABLE ${WXRC}) - endif(WXRC) - set(WX_VERSION_MIN 2.9.0) - find_package(wxWidgets REQUIRED COMPONENTS core base aui html net adv REQUIRED) - execute_process(COMMAND sh "${wxWidgets_CONFIG_EXECUTABLE}" --version - OUTPUT_VARIABLE WX_VERSION) - if(WX_VERSION VERSION_EQUAL ${WX_VERSION_MIN} - OR WX_VERSION VERSION_GREATER ${WX_VERSION_MIN}) - message(STATUS "wxWidgets version: ${WX_VERSION}") - else() - message(FATAL_ERROR "wxWidgets must be installed on your system. - - Please check that wx-config is in path, the directory - where wxWidgets libraries are installed (returned by - 'wx-config --libs' or 'wx-config --static --libs' command) - is in LD_LIBRARY_PATH or equivalent variable and - wxWidgets version is ${WX_VERSION_MIN} or above." - ) - endif() - if(wxWidgets_FOUND) - include("${wxWidgets_USE_FILE}") - list(APPEND FREEDV_LINK_LIBS ${wxWidgets_LIBRARIES}) - endif(wxWidgets_FOUND) + set(WXCONFIG "${CMAKE_BINARY_DIR}/external/dist/bin/wx-config") + set(WXRC "${CMAKE_BINARY_DIR}/external/dist/bin/wxrc") + set(wxWidgets_CONFIG_OPTIONS --linkdeps) + list(APPEND FREEDV_STATIC_DEPS wxWidgets) endif(USE_STATIC_WXWIDGETS) +message(STATUS "Looking for wxWidgets...") +if(WXCONFIG) + message(STATUS "wx-config: ${WXCONFIG}") + set(wxWidgets_CONFIG_EXECUTABLE ${WXCONFIG}) +endif(WXCONFIG) +if(WXRC) + message(STATUS "wxrc: ${WXRC}") + set(wxWidgets_wxrc_EXECUTABLE ${WXRC}) +endif(WXRC) +set(WX_VERSION_MIN 2.9.0) +find_package(wxWidgets REQUIRED COMPONENTS core base aui html net adv REQUIRED) +execute_process(COMMAND sh "${wxWidgets_CONFIG_EXECUTABLE}" --version + OUTPUT_VARIABLE WX_VERSION) +if(WX_VERSION VERSION_EQUAL ${WX_VERSION_MIN} + OR WX_VERSION VERSION_GREATER ${WX_VERSION_MIN}) + message(STATUS "wxWidgets version: ${WX_VERSION}") +else() + message(FATAL_ERROR "wxWidgets must be installed on your system. +Please check that wx-config is in path, the directory +where wxWidgets libraries are installed (returned by +'wx-config --libs' or 'wx-config --static --libs' command) +is in LD_LIBRARY_PATH or equivalent variable and +wxWidgets version is ${WX_VERSION_MIN} or above.") +endif() +if(wxWidgets_FOUND) + include("${wxWidgets_USE_FILE}") + list(APPEND FREEDV_LINK_LIBS ${wxWidgets_LIBRARIES}) +endif(wxWidgets_FOUND) # # Find codec2 @@ -355,3 +368,12 @@ if(WIN32) set(CPACK_NSIS_MODIFY_PATH ON) 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) diff --git a/fdmdv2/README.cmake b/fdmdv2/README.cmake index 26495c59..42e7ec00 100644 --- a/fdmdv2/README.cmake +++ b/fdmdv2/README.cmake @@ -9,6 +9,10 @@ well on most *nix systems and has many advanages over the autotools config. systems should rely on 'make install' as the packages (RPM & DEB) created by CPack are questionable. +========================== + Building and installing +========================== + To test the cmake build make a directory anywhere underneath (or outside of) the source directory. @@ -22,3 +26,30 @@ $ cmake ../ (defaults to /usr/local, use CMAKE_INSTALL_PREFIX to override) $ make (as root) $ make install + +=============================== + Bootstrapping wxWidgets build +=============================== + +If wxWidgets (>= 2.9) is not available then one option is to have CMake boot- +strap the build for FreeDV. + +This is required because the tool wx-config is used to get the correct compiler +and linker flags of the wxWidgets components needed by FreeDV. Since this is +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 +libraries. + +NOTE: This forces "USE_STATIC_WXWIDGETS" to be true. + +(from any prefered directory outside of the source) +$ cmake -DBOOTSTRAP_WXWIDGETS=TRUE +$ make +(wxWidgets is downloaded and built) +$ cmake -DBOOTSTRAP_WXWIDGETS=FALSE . +$ make +(if all goes well, as root) +$ make install diff --git a/fdmdv2/cmake/BuildWxWidgets.cmake b/fdmdv2/cmake/BuildWxWidgets.cmake index 5bee2a56..74c34cc1 100644 --- a/fdmdv2/cmake/BuildWxWidgets.cmake +++ b/fdmdv2/cmake/BuildWxWidgets.cmake @@ -11,5 +11,5 @@ ExternalProject_Add(wxWidgets ) set(WXCONFIG "${CMAKE_BINARY_DIR}/external/dist/bin/wx-config") set(WXRC "${CMAKE_BINARY_DIR}/external/dist/bin/wxrc") -list(APPEND FREEDV_LINK_LIBS ${wxWidgets_LIBRARIES}) -list(APPEND FREEDV_STATIC_DEPS wxWidgets) +#list(APPEND FREEDV_LINK_LIBS ${wxWidgets_LIBRARIES}) +#list(APPEND FREEDV_STATIC_DEPS wxWidgets) -- 2.25.1