CMake configuration tweaks for wxWidgets bootstrap build option and update of README...
authorhobbes1069 <hobbes1069@01035d8c-6547-0410-b346-abe4f91aad63>
Wed, 8 May 2013 19:38:44 +0000 (19:38 +0000)
committerhobbes1069 <hobbes1069@01035d8c-6547-0410-b346-abe4f91aad63>
Wed, 8 May 2013 19:38:44 +0000 (19:38 +0000)
git-svn-id: https://svn.code.sf.net/p/freetel/code@1244 01035d8c-6547-0410-b346-abe4f91aad63

fdmdv2/CMakeLists.txt
fdmdv2/README.cmake
fdmdv2/cmake/BuildWxWidgets.cmake

index 284755d45b8c668dd6808a7ae4be6e539e2464a5..c36381ef8ef7d6c67695428172f492e9e252033f 100644 (file)
@@ -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)
index 26495c59c7e37e1be643e826c16d024edaeb469f..42e7ec00c05cba2d54e49b08eb2618eda07b99d2 100644 (file)
@@ -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 <path to source>
+$ make
+(wxWidgets is downloaded and built)
+$ cmake -DBOOTSTRAP_WXWIDGETS=FALSE .
+$ make
+(if all goes well, as root)
+$ make install
index 5bee2a56437027f2e0de5040cc2e096456a6f39c..74c34cc11f99fe14ddd056ab4aba443a586ac86c 100644 (file)
@@ -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)