From 0038f459b2e890412e1d0cbd8aa2fad2daaf2135 Mon Sep 17 00:00:00 2001 From: hobbes1069 Date: Mon, 16 Dec 2013 20:41:56 +0000 Subject: [PATCH] Add better error message when an in-source build is attempted. Add workaround for bootstrap build of wxWidgets due to cmake bug. Update minimum wxWidgets version to 3.0.0. git-svn-id: https://svn.code.sf.net/p/freetel/code@1345 01035d8c-6547-0410-b346-abe4f91aad63 --- codec2-dev/CMakeLists.txt | 5 ++++ fdmdv2/CMakeLists.txt | 42 ++++++++++++++----------------- fdmdv2/cmake/BuildWxWidgets.cmake | 8 +++--- 3 files changed, 29 insertions(+), 26 deletions(-) diff --git a/codec2-dev/CMakeLists.txt b/codec2-dev/CMakeLists.txt index a8ad3665..e9ef2262 100644 --- a/codec2-dev/CMakeLists.txt +++ b/codec2-dev/CMakeLists.txt @@ -15,6 +15,11 @@ cmake_minimum_required(VERSION 2.8) # set(CMAKE_DISABLE_SOURCE_CHANGES ON) set(CMAKE_DISABLE_IN_SOURCE_BUILD ON) +if("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}") + message(FATAL_ERROR "In-source builds in ${CMAKE_BINARY_DIR} are not " + "allowed, please remove ./CMakeCache.txt and ./CMakeFiles/, create a " + "separate build directory and run cmake from there.") +endif("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}") project(codec2) diff --git a/fdmdv2/CMakeLists.txt b/fdmdv2/CMakeLists.txt index f879470e..3a0031d6 100644 --- a/fdmdv2/CMakeLists.txt +++ b/fdmdv2/CMakeLists.txt @@ -13,9 +13,11 @@ cmake_minimum_required(VERSION 2.8) # files manually. set(CMAKE_DISABLE_SOURCE_CHANGES ON) set(CMAKE_DISABLE_IN_SOURCE_BUILD ON) -if("${PROJECT_SOURCE_DIR}" STREQUAL "${PROJECT_BINARY_DIR}") - message(FATAL_ERROR "In-source builds are not allowed.") -endif("${PROJECT_SOURCE_DIR}" STREQUAL "${PROJECT_BINARY_DIR}") +if("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}") + message(FATAL_ERROR "In-source builds in ${CMAKE_BINARY_DIR} are not " + "allowed, please remove ./CMakeCache.txt and ./CMakeFiles/, create a " + "separate build directory and run cmake from there.") +endif("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}") project(FreeDV) @@ -68,14 +70,6 @@ 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.") -# 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) @@ -90,19 +84,20 @@ endif(USE_STATIC_DEPS) # Pull in external wxWidgets target if performing static build. # if(BOOTSTRAP_WXWIDGETS) + message(STATUS "Adding wxWidgets build target...") include(cmake/BuildWxWidgets.cmake) endif(BOOTSTRAP_WXWIDGETS) # # Perform bootstrap build of wxWidgets # -if(BOOTSTRAP_WXWIDGETS AND NOT TARGET wxWidgets) +if(BOOTSTRAP_WXWIDGETS AND NOT EXISTS ${WXCONFIG}) 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. # -else(BOOTSTRAP_WXWIDGETS AND NOT TARGET wxWidgets) +else(BOOTSTRAP_WXWIDGETS AND NOT EXISTS ${WXCONFIG}) # Setup empty list to append to. set(FREEDV_LINK_LIBS "") @@ -336,14 +331,15 @@ endif(NOT USE_STATIC_SOX) # # Find wxWidgets # -set(WXCONFIG "" CACHE FILEPATH "Location of wx-config binary.") -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) - list(APPEND FREEDV_STATIC_DEPS wxWidgets) -endif(USE_STATIC_WXWIDGETS) +if(NOT BOOTSTRAP_WXWIDGETS) + set(WXCONFIG "" CACHE FILEPATH "Location of wx-config binary.") + set(WXRC "" CACHE FILEPATH "Location of wxrc binary.") +endif(NOT BOOTSTRAP_WXWIDGETS) +#if(BOOTSTRAP_WXWIDGETS) +# set(WXCONFIG "${CMAKE_BINARY_DIR}/external/dist/bin/wx-config") +# set(WXRC "${CMAKE_BINARY_DIR}/external/dist/bin/wxrc") +# list(APPEND FREEDV_STATIC_DEPS wxWidgets) +#endif(BOOTSTRAP_WXWIDGETS) message(STATUS "Looking for wxWidgets...") if(WXCONFIG) message(STATUS "wx-config: ${WXCONFIG}") @@ -353,7 +349,7 @@ if(WXRC) message(STATUS "wxrc: ${WXRC}") set(wxWidgets_wxrc_EXECUTABLE ${WXRC}) endif(WXRC) -set(WX_VERSION_MIN 2.9.0) +set(WX_VERSION_MIN 3.0.0) find_package(wxWidgets REQUIRED core base aui html net adv) execute_process(COMMAND sh "${wxWidgets_CONFIG_EXECUTABLE}" --version OUTPUT_VARIABLE WX_VERSION) @@ -474,4 +470,4 @@ if(WIN32) include(CPack) endif(WIN32) -endif(BOOTSTRAP_WXWIDGETS AND NOT TARGET wxWidgets) +endif(BOOTSTRAP_WXWIDGETS AND NOT EXISTS ${WXCONFIG}) diff --git a/fdmdv2/cmake/BuildWxWidgets.cmake b/fdmdv2/cmake/BuildWxWidgets.cmake index 74c34cc1..1a1c4104 100644 --- a/fdmdv2/cmake/BuildWxWidgets.cmake +++ b/fdmdv2/cmake/BuildWxWidgets.cmake @@ -1,4 +1,4 @@ -set(WXWIDGETS_TARBALL "wxWidgets-2.9.4") +set(WXWIDGETS_TARBALL "wxWidgets-3.0.0") include(ExternalProject) ExternalProject_Add(wxWidgets @@ -9,7 +9,9 @@ ExternalProject_Add(wxWidgets BUILD_COMMAND $(MAKE) INSTALL_COMMAND $(MAKE) install ) -set(WXCONFIG "${CMAKE_BINARY_DIR}/external/dist/bin/wx-config") -set(WXRC "${CMAKE_BINARY_DIR}/external/dist/bin/wxrc") + +ExternalProject_Get_Property(wxWidgets install_dir) +set(WXCONFIG "${install_dir}/bin/wx-config") +set(WXRC "${install_dir}/bin/wxrc") #list(APPEND FREEDV_LINK_LIBS ${wxWidgets_LIBRARIES}) #list(APPEND FREEDV_STATIC_DEPS wxWidgets) -- 2.25.1