From: hobbes1069 Date: Thu, 5 Mar 2015 22:10:37 +0000 (+0000) Subject: Merge build system updates from fdmdv2 to fdmdv2-dev. X-Git-Url: http://git.whiteaudio.com/gitweb/?a=commitdiff_plain;h=f95c0f6654ac1dfaf240de071191ead10d5b1e80;p=freetel-svn-tracking.git Merge build system updates from fdmdv2 to fdmdv2-dev. git-svn-id: https://svn.code.sf.net/p/freetel/code@2056 01035d8c-6547-0410-b346-abe4f91aad63 --- diff --git a/fdmdv2-dev/CMakeLists.txt b/fdmdv2-dev/CMakeLists.txt index 85cad8cc..8c3789b6 100644 --- a/fdmdv2-dev/CMakeLists.txt +++ b/fdmdv2-dev/CMakeLists.txt @@ -39,12 +39,14 @@ if(FREEDV_VERSION_PATCH) set(FREEDV_VERSION ${FREEDV_VERSION}.${FREEDV_VERSION_PATCH}) endif(FREEDV_VERSION_PATCH) +message(STATUS "FreeDV version: ${FREEDV_VERSION}") + # Set default build type if(NOT CMAKE_BUILD_TYPE) set(CMAKE_BUILD_TYPE "Release") + message(STATUS "Build type not specified, defaulting to ${CMAKE_BUILD_TYPE}") endif(NOT CMAKE_BUILD_TYPE) -message(STATUS "FreeDV version: ${FREEDV_VERSION}") # Work around for not using a svn working copy. add_definitions(-D_NO_AUTOTOOLS_) @@ -65,7 +67,6 @@ add_definitions(-DSVN_REVISION="${SVN_REVISION}") else() add_definitions(-DSVN_REVISION="Unversioned directory") endif() - # Set default build flags. @@ -74,6 +75,7 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall") # # Setup cmake options # +set(CMAKE_VERBOSE_MAKEFILE TRUE CACHE BOOL "Verbose makefile.") set(USE_STATIC_DEPS FALSE CACHE BOOL "Download and build static libraries instead of system libraries.") set(USE_STATIC_PORTAUDIO FALSE CACHE BOOL @@ -112,23 +114,16 @@ 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. +# Continue normal build if not bootstrapping wxWidgets or is already built. # else(BOOTSTRAP_WXWIDGETS AND NOT EXISTS ${WXCONFIG}) -# Setup empty list to append to. -set(FREEDV_LINK_LIBS "") -set(FREEDV_STATIC_LIBS "") - # # Various hacks and work arounds for building under MinGW. # if(MINGW) message(STATUS "System is MinGW.") - # For some reason "Release" causes an error on exit. Force build type to be - # Debug for MINGW builds. - set(CMAKE_BUILD_TYPE Debug) # This sets up the exe icon for windows under mingw. set(RES_FILES "") set(RES_FILES "${CMAKE_SOURCE_DIR}/contrib/freedv.rc") @@ -136,25 +131,8 @@ if(MINGW) enable_language(RC) set(CMAKE_RC_COMPILE_OBJECT " -O coff -i -o ") - # Even using msys, cmake doesn't know it can use unix style paths... - set(CMAKE_LIBRARY_PATH C:/MinGW/lib;C:/MinGW/msys/1.0/lib;C:/MinGW/msys/1.0/local/lib) - # Try to build in libgcc and libstdc++ but it doesn't appear to work. - #add_definitions(-static-libgcc -static-libstdc++) - # Try to grab all the runtime dlls for the windows installer. - # This will break if the dll names change! + # These are DLOPEN'ed and can't be automatically pulled in by dependency. foreach(RUNTIME - libgcc_s_sjlj-1.dll - libstdc++-6.dll - libsndfile-1.dll - libsamplerate-0.dll - libcodec2.dll - libpng16-16.dll - libportaudio-2.dll - libportaudiocpp-0.dll - libsox-2.dll - zlib1.dll - libusb0.dll - libhamlib-2.dll hamlib-adat.dll hamlib-alinco.dll hamlib-amsat.dll @@ -178,12 +156,27 @@ if(MINGW) hamlib-pcr.dll hamlib-prm80.dll hamlib-racal.dll - hamlib-rft.dll) + hamlib-rft.dll + hamlib-rotorez.dll + hamlib-rs.dll + hamlib-sartek.dll + hamlib-skanti.dll + hamlib-spid.dll + hamlib-tapr.dll + hamlib-tentec.dll + hamlib-ts7400.dll + hamlib-tuner.dll + hamlib-uniden.dll + hamlib-winradio.dll + hamlib-wj.dll + hamlib-yaesu.dll) message(STATUS "Checking for ${RUNTIME}") - find_library(${RUNTIME}_LIB ${RUNTIME}) + find_library(${RUNTIME}_LIB ${RUNTIME} + PATH_SUFFIXES hamlib) message(STATUS "runtime found: ${${RUNTIME}_LIB}") list(APPEND CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS ${${RUNTIME}_LIB}) endforeach() + include(InstallRequiredSystemLibraries) endif(MINGW) # Math library is automatic on MinGW @@ -225,39 +218,26 @@ message(STATUS "Threads library flags: ${CMAKE_THREAD_LIBS_INIT}") if(NOT USE_STATIC_PORTAUDIO) message(STATUS "Looking for portaudio...") find_package(Portaudio REQUIRED) - if(PORTAUDIO_FOUND AND ${PORTAUDIO_VERSION} EQUAL 19) + if(PORTAUDIO_FOUND) + message(STATUS " portaudio library: ${PORTAUDIO_LIBRARIES}") + message(STATUS " portaudio headers: ${PORTAUDIO_INCLUDE_DIRS}") list(APPEND FREEDV_LINK_LIBS ${PORTAUDIO_LIBRARIES}) include_directories(${PORTAUDIO_INCLUDE_DIRS}) else() + message(FATAL_ERROR "portaudio library not found. +On Linux systems try installing: + portaudio-devel (RPM based systems) + libportaudio-dev (DEB based systems) +On Windows it's easiest to use the cmake option: USE_STATIC_PORTAUDIO" + ) + endif() + if(NOT ${PORTAUDIO_VERSION} EQUAL 19) message(WARNING "Portaudio versions other than 19 are known to have issues. You have been warned!") - list(APPEND FREEDV_LINK_LIBS ${PORTAUDIO_LIBRARIES}) - include_directories(${PORTAUDIO_INCLUDE_DIRS}) endif() -# find_library(PORTAUDIO_LIBS NAMES libportaudio-2.dll portaudio HINTS /usr/local/lib/portaudio2) -# find_path(PORTAUDIO_INCLUDE_DIR portaudio.h HINTS /usr/local/include/portaudio2) -# message(STATUS " portaudio library: ${PORTAUDIO_LIBS}") -# message(STATUS " portaudio headers: ${PORTAUDIO_INCLUDE_DIR}") -# if(PORTAUDIO_LIBS AND PORTAUDIO_INCLUDE_DIR) -# list(APPEND FREEDV_LINK_LIBS ${PORTAUDIO_LIBS}) -# include_directories(${PORTAUDIO_INCLUDE_DIR}) -# else(PORTAUDIO_LIBS AND PORTAUDIO_INCLUDE_DIR) -# message(FATAL_ERROR "portaudio library not found. -#On Linux systems try installing: -# portaudio-devel (RPM based systems) -# libportaudio-dev (DEB based systems) -#On Windows it's easiest to use the cmake option: USE_STATIC_PORTAUDIO" -# ) -# endif(PORTAUDIO_LIBS AND PORTAUDIO_INCLUDE_DIR) else(NOT USE_STATIC_PORTAUDIO) message(STATUS "Will attempt static build of portaudio.") include(cmake/BuildPortaudio.cmake) endif(NOT USE_STATIC_PORTAUDIO) -# Do we need this? -#find_library(PORTAUDIOCPP portaudiocpp) -#if(PORTAUDIOCPP) -# message(STATUS "portaudiocpp library: ${PORTAUDIOCPP}") -# list(APPEND FREEDV_LINK_LIBS ${PORTAUDIOCPP}) -#endif(PORTAUDIOCPP) # # Hamlib library @@ -305,30 +285,6 @@ else(NOT USE_STATIC_SAMPLERATE) include(cmake/BuildSamplerate.cmake) endif(NOT USE_STATIC_SAMPLERATE) -# -# sndfile Library -# -if(NOT USE_STATIC_SNDFILE) - message(STATUS "Looking for sndfile...") - find_library(LIBSNDFILE sndfile) - find_path(LIBSNDFILE_INCLUDE_DIR sndfile.h) - message(STATUS " sndfile library: ${LIBSNDFILE}") - message(STATUS " sndfile headers: ${LIBSNDFILE_INCLUDE_DIR}") - if(LIBSNDFILE AND LIBSNDFILE_INCLUDE_DIR) - list(APPEND FREEDV_LINK_LIBS ${LIBSNDFILE}) - else(LIBSNDFILE AND LIBSNDFILE_INCLUDE_DIR) - message(FATAL_ERROR "sndfile library not found. -On Linux systems try installing: - libsndfile-devel (RPM based systems) - libsndfile-dev (DEB based systems) -On Windows it's easiest to use the cmake option: USE_STATIC_SNDFILE" - ) - endif(LIBSNDFILE AND LIBSNDFILE_INCLUDE_DIR) -else(NOT USE_STATIC_SNDFILE) - message(STATUS "Will attempt static build of sndfile.") - include(cmake/BuildSndfile.cmake) -endif(NOT USE_STATIC_SNDFILE) - # # Find sox library # @@ -354,6 +310,30 @@ else(NOT USE_STATIC_SOX) include(cmake/BuildSox.cmake) endif(NOT USE_STATIC_SOX) +# +# sndfile Library +# +if(NOT USE_STATIC_SNDFILE) + message(STATUS "Looking for sndfile...") + find_library(LIBSNDFILE sndfile) + find_path(LIBSNDFILE_INCLUDE_DIR sndfile.h) + message(STATUS " sndfile library: ${LIBSNDFILE}") + message(STATUS " sndfile headers: ${LIBSNDFILE_INCLUDE_DIR}") + if(LIBSNDFILE AND LIBSNDFILE_INCLUDE_DIR) + list(APPEND FREEDV_LINK_LIBS ${LIBSNDFILE}) + else(LIBSNDFILE AND LIBSNDFILE_INCLUDE_DIR) + message(FATAL_ERROR "sndfile library not found. +On Linux systems try installing: + libsndfile-devel (RPM based systems) + libsndfile-dev (DEB based systems) +On Windows it's easiest to use the cmake option: USE_STATIC_SNDFILE" + ) + endif(LIBSNDFILE AND LIBSNDFILE_INCLUDE_DIR) +else(NOT USE_STATIC_SNDFILE) + message(STATUS "Will attempt static build of sndfile.") + include(cmake/BuildSndfile.cmake) +endif(NOT USE_STATIC_SNDFILE) + # # Find wxWidgets # @@ -379,6 +359,7 @@ 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) +string(STRIP ${WX_VERSION} WX_VERSION) if(WX_VERSION VERSION_EQUAL ${WX_VERSION_MIN} OR WX_VERSION VERSION_GREATER ${WX_VERSION_MIN}) message(STATUS "wxWidgets version: ${WX_VERSION}") @@ -400,22 +381,30 @@ endif(wxWidgets_FOUND) # if(NOT USE_STATIC_CODEC2) message(STATUS "Looking for codec2...") - find_path(CODEC2_INCLUDE_DIR codec2.h - PATH_SUFFIXES codec2) - find_library(CODEC2_LIBRARY NAMES codec2) - message(STATUS " codec2 library: ${CODEC2_LIBRARY}") - message(STATUS " codec2 headers: ${CODEC2_INCLUDE_DIR}") - if(CODEC2_INCLUDE_DIR AND CODEC2_LIBRARY) - include_directories(${CODEC2_INCLUDE_DIR}) - list(APPEND FREEDV_LINK_LIBS ${CODEC2_LIBRARY}) - else(CODEC2_INCLUDE_DIR AND CODEC2_LIBRARY) - message(FATAL_ERROR "codec2 library not found. + find_package(codec2 CONFIG QUIET) + if(codec2_FOUND) + get_target_property(CODEC2_BRARY codec2 LOCATION) + message(STATUS " codec2 library: ${CODEC2_LIBRARY}") + message(STATUS " codec2 headers: ${codec2_INCLUDE_DIRS}") + else() + # Try to find manually + find_path(CODEC2_INCLUDE_DIRS codec2.h + PATH_SUFFIXES codec2) + find_library(CODEC2_LIBRARY NAMES codec2) + if(CODEC2_LIBRARY AND CODEC2_INCLUDE_DIRS) + message(STATUS " codec2 library: ${CODEC2_LIBRARY}") + message(STATUS " codec2 headers: ${CODEC2_INCLUDE_DIRS}") + list(APPEND FREEDV_LINK_LIBS ${CODEC2_LIBRARY}) + include_directories(${CODEC2_INCLUDE_DIRS}) + else() + message(FATAL_ERROR "codec2 library not found. Linux: Codec2 may not be in your distribution so build yourself or use the cmake option to build statically into FreeDV. Windws: It's easiest to use the cmake option: USE_STATIC_CODEC2" ) - endif(CODEC2_INCLUDE_DIR AND CODEC2_LIBRARY) + endif() + endif() else(NOT USE_STATIC_CODEC2) message(STATUS "Will attempt static build of codec2.") include(cmake/BuildCodec2.cmake) @@ -445,28 +434,40 @@ add_subdirectory(contrib) message(STATUS "Build type will be: ${CMAKE_BUILD_TYPE}") # -# Cpack NSIS configuration for Windows. EXPERIMENTAL!!! +# Cpack NSIS configuration for Windows. # if(WIN32) - include(InstallRequiredSystemLibraries) + # Detect if we're doing a 32-bit or 64-bit windows build. + if(${CMAKE_SIZEOF_VOID_P} EQUAL 8) + set(CMAKE_CL_64 TRUE) + endif() + if(NOT ${CMAKE_BUILD_TYPE} STREQUAL "Debug") + set(CPACK_STRIP_FILES TRUE) + endif() + configure_file(cmake/GetDependencies.cmake.in cmake/GetDependencies.cmake + @ONLY + ) + install(SCRIPT ${CMAKE_BINARY_DIR}/cmake/GetDependencies.cmake) set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "HF Digital Voice for Radio Amateurs") set(CPACK_PACKAGE_VENDOR "CMake") - set(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/README") + #set(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/README") set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/COPYING") set(CPACK_PACKAGE_VERSION_MAJOR ${FREEDV_VERSION_MAJOR}) set(CPACK_PACKAGE_VERSION_MINOR ${FREEDV_VERSION_MINOR}) if(FREEDV_VERSION_PATCH) set(CPACK_PACKAGE_VERSION_PATCH ${FREEDV_VERSION_PATCH}) - endif(FREEDV_VERSION_PATCH) - set(CPACK_PACKAGE_INSTALL_DIRECTORY "FreeDV") + else() + set(CPACK_PACKAGE_VERSION_PATCH "0") + endif() set(CPACK_PACKAGE_EXECUTABLES freedv;FreeDV) # There is a bug in NSI that does not handle full unix paths properly. Make # sure there is at least one set of four (4) backlasshes. #set(CPACK_PACKAGE_ICON "${CMake_SOURCE_DIR}/Utilities/Release\\\\InstallIcon.bmp") set(CPACK_NSIS_INSTALLED_ICON_NAME "bin\\\\freedv.exe") set(CPACK_NSIS_DISPLAY_NAME "${CPACK_PACKAGE_INSTALL_DIRECTORY}") - set(CPACK_NSIS_URL_INFO_ABOUT "http:\\\\\\\\freedv.org") + set(CPACK_NSIS_URL_INFO_ABOUT "http://freedv.org") set(CPACK_NSIS_MODIFY_PATH OFF) + set(CPACK_NSIS_MENU_LINKS "http://freedv.org" "FreeDV Homepage") include(CPack) endif(WIN32) diff --git a/fdmdv2-dev/cmake/BuildCodec2.cmake b/fdmdv2-dev/cmake/BuildCodec2.cmake index d7ddcf93..4c135778 100644 --- a/fdmdv2-dev/cmake/BuildCodec2.cmake +++ b/fdmdv2-dev/cmake/BuildCodec2.cmake @@ -4,13 +4,8 @@ ExternalProject_Add(codec2 CMAKE_ARGS -DBUILD_SHARED_LIBS=FALSE INSTALL_COMMAND "" ) -if(WIN32) - set(CODEC2_LIBRARIES - ${CMAKE_BINARY_DIR}/codec2-prefix/src/codec2-build/src/codec2.lib) -else(WIN32) - set(CODEC2_LIBRARIES - ${CMAKE_BINARY_DIR}/codec2-prefix/src/codec2-build/src/libcodec2.a) -endif(WIN32) +set(CODEC2_LIBRARIES + ${CMAKE_BINARY_DIR}/codec2-prefix/src/codec2-build/src/libcodec2.a) include_directories(${CMAKE_BINARY_DIR}/codec2-prefix/src/codec2/src) list(APPEND FREEDV_LINK_LIBS ${CODEC2_LIBRARIES}) list(APPEND FREEDV_STATIC_DEPS codec2) diff --git a/fdmdv2-dev/cmake/BuildLibctb.cmake b/fdmdv2-dev/cmake/BuildLibctb.cmake deleted file mode 100644 index bb98bd2e..00000000 --- a/fdmdv2-dev/cmake/BuildLibctb.cmake +++ /dev/null @@ -1,19 +0,0 @@ -set(LIBCTB_TARBALL "libctb-0.16") - -include(ExternalProject) -ExternalProject_Add(libctb - URL https://iftools.com/download/ctb/0.16/${LIBCTB_TARBALL}.tar.gz - PATCH_COMMAND patch -p1 < ${CMAKE_SOURCE_DIR}/cmake/libctb.patch - CMAKE_ARGS -DBUILD_SHARED_LIBS=FALSE - INSTALL_COMMAND "" -) -if(WIN32) - set(LIBCTB_LIBRARY - ${CMAKE_BINARY_DIR}/libctb-prefix/src/libctb-build/src/ctb-0.16.lib) -else(WIN32) - set(LIBCTB_LIBRARY - ${CMAKE_BINARY_DIR}/libctb-prefix/src/libctb-build/src/libctb-0.16.a) -endif(WIN32) -include_directories(${CMAKE_BINARY_DIR}/libctb-prefix/src/libctb/include) -list(APPEND FREEDV_LINK_LIBS ${LIBCTB_LIBRARY}) -list(APPEND FREEDV_STATIC_DEPS libctb) diff --git a/fdmdv2-dev/cmake/BuildPortaudio.cmake b/fdmdv2-dev/cmake/BuildPortaudio.cmake index 15aa7b2c..445b1e1a 100644 --- a/fdmdv2-dev/cmake/BuildPortaudio.cmake +++ b/fdmdv2-dev/cmake/BuildPortaudio.cmake @@ -9,7 +9,7 @@ On Linux systems try installing: alsa-lib-devel (RPM based systems) libasound2-dev (DEB based systems)" ) -endif(UNIX AND NOT ALSA_LIBRARIES) +endif() include(ExternalProject) ExternalProject_Add(portaudio @@ -33,5 +33,9 @@ else(WIN32) ) endif(WIN32) include_directories(${CMAKE_BINARY_DIR}/external/dist/include) + +# Add the portaudio library to the list of libraries that must be linked. list(APPEND FREEDV_LINK_LIBS ${PORTAUDIO_LIBRARIES}) + +# Setup a dependency so that this gets built before linking to freedv. list(APPEND FREEDV_STATIC_DEPS portaudio) diff --git a/fdmdv2-dev/cmake/BuildSndfile.cmake b/fdmdv2-dev/cmake/BuildSndfile.cmake index c5b13364..2375c479 100644 --- a/fdmdv2-dev/cmake/BuildSndfile.cmake +++ b/fdmdv2-dev/cmake/BuildSndfile.cmake @@ -5,17 +5,16 @@ 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 --disable-external-libs - BUILD_COMMAND $(MAKE) + CONFIGURE_COMMAND ./configure --prefix=${CMAKE_BINARY_DIR}/external/dist --disable-external-libs --disable-shared + BUILD_COMMAND $(MAKE) V=1 INSTALL_COMMAND $(MAKE) install ) -if(WIN32) - set(SNDFILE_LIBRARIES - ${CMAKE_BINARY_DIR}/external/dist/lib/sndfile.lib) -else(WIN32) - set(SNDFILE_LIBRARIES - ${CMAKE_BINARY_DIR}/external/dist/lib/libsndfile.a) -endif(WIN32) +if(MINGW) + set(SNDFILE_LIBRARIES ${CMAKE_BINARY_DIR}/external/dist/bin/libsndfile-1.dll) +else() + set(SNDFILE_LIBRARIES ${CMAKE_BINARY_DIR}/external/dist/lib/libsndfile.a) +endif() + include_directories(${CMAKE_BINARY_DIR}/external/dist/include) list(APPEND FREEDV_LINK_LIBS ${SNDFILE_LIBRARIES}) list(APPEND FREEDV_STATIC_DEPS sndfile) diff --git a/fdmdv2-dev/cmake/BuildSox.cmake b/fdmdv2-dev/cmake/BuildSox.cmake index 8dae3adf..635fc93d 100644 --- a/fdmdv2-dev/cmake/BuildSox.cmake +++ b/fdmdv2-dev/cmake/BuildSox.cmake @@ -20,30 +20,22 @@ On Linux systems try installing: ) 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 --with-wavpack=no --disable-dl-sndfile --with-pulseaudio=no --without-magic --prefix=${CMAKE_BINARY_DIR}/external/dist - BUILD_COMMAND $(MAKE) + BUILD_COMMAND $(MAKE) V=1 INSTALL_COMMAND $(MAKE) install ) -if(WIN32) - set(SOX_LIBRARIES - ${CMAKE_BINARY_DIR}/external/dist/lib/sox.lib) -else(WIN32) - set(SOX_LIBRARIES - ${CMAKE_BINARY_DIR}/external/dist/lib/libsox.a - ${ALSA_LIBRARIES} - ${AO_LIBRARIES} - ) -endif(WIN32) +set(SOX_LIBRARIES ${CMAKE_BINARY_DIR}/external/dist/lib/libsox.a) +if(UNIX) + list(APPEND SOX_LIBRARIES ${ALSA_LIBRARIES} ${AO_LIBRARIES}) +endif() +if(MINGW) + list(APPEND SOX_LIBRARIES winmm) +endif() include_directories(${CMAKE_BINARY_DIR}/external/dist/include) list(APPEND FREEDV_LINK_LIBS ${SOX_LIBRARIES}) -list(APPEND FREEDV_STATIC_DEPS sox) - -if(USE_STATIC_SNDFILE) - add_dependencies(sox sndfile) -endif(USE_STATIC_SNDFILE) +list(APPEND FREEDV_STATIC_DEPS sox) \ No newline at end of file diff --git a/fdmdv2-dev/cmake/BuildWxWidgets.cmake b/fdmdv2-dev/cmake/BuildWxWidgets.cmake index 1a1c4104..68114038 100644 --- a/fdmdv2-dev/cmake/BuildWxWidgets.cmake +++ b/fdmdv2-dev/cmake/BuildWxWidgets.cmake @@ -1,17 +1,38 @@ -set(WXWIDGETS_TARBALL "wxWidgets-3.0.0") +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() +endif() + +# If not cross-compiling then use the built-in makefile, otherwise use standard configure. +if(MINGW AND NOT CMAKE_CROSSCOMPILING) +# set(CONFIGURE_COMMAND "true") +# set(MAKE_COMMAND $(MAKE) -C build/msw -f makefile.gcc SHARED=0 UNICODE=1 BUILD=release PREFIX=${CMAKE_BINARY_DIR}/external/dist) + set(CONFIGURE_COMMAND ./configure --disable-shared --prefix=${CMAKE_BINARY_DIR}/external/dist) + set(MAKE_COMMAND $(MAKE)) +else() + set(CONFIGURE_COMMAND ./configure --host=${HOST} --target=${HOST} --disable-shared --prefix=${CMAKE_BINARY_DIR}/external/dist) + set(MAKE_COMMAND $(MAKE)) +endif() include(ExternalProject) ExternalProject_Add(wxWidgets URL http://downloads.sourceforge.net/wxwindows/${WXWIDGETS_TARBALL}.tar.bz2 BUILD_IN_SOURCE 1 INSTALL_DIR external/dist - CONFIGURE_COMMAND ./configure --disable-shared --prefix=${CMAKE_BINARY_DIR}/external/dist - BUILD_COMMAND $(MAKE) + CONFIGURE_COMMAND ${CONFIGURE_COMMAND} + BUILD_COMMAND ${MAKE_COMMAND} INSTALL_COMMAND $(MAKE) install ) ExternalProject_Get_Property(wxWidgets install_dir) +message(STATUS "wxWidgets install dir: ${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) +if(EXISTS ${WXCONFIG}) + set(BS_WX_DONE TRUE) +endif() diff --git a/fdmdv2-dev/cmake/GetDependencies.cmake.in b/fdmdv2-dev/cmake/GetDependencies.cmake.in new file mode 100644 index 00000000..93204dd7 --- /dev/null +++ b/fdmdv2-dev/cmake/GetDependencies.cmake.in @@ -0,0 +1,25 @@ +# As this script is run in a new cmake instance, it does not have access to +# the existing cache variables. Pass them in via the configure_file command. +set(CMAKE_BINARY_DIR @CMAKE_BINARY_DIR@) +set(CMAKE_SOURCE_DIR @CMAKE_SOURCE_DIR@) +set(UNIX @UNIX@) +set(WIN32 @WIN32@) +set(CMAKE_CROSSCOMPILING @CMAKE_CROSSCOMPILING@) +set(CMAKE_FIND_LIBRARY_SUFFIXES @CMAKE_FIND_LIBRARY_SUFFIXES@) +set(CMAKE_FIND_LIBRARY_PREFIXES @CMAKE_FIND_LIBRARY_PREFIXES@) +set(CMAKE_SYSTEM_LIBRARY_PATH @CMAKE_SYSTEM_LIBRARY_PATH@) +set(CMAKE_FIND_ROOT_PATH @CMAKE_FIND_ROOT_PATH@) + +set(FREEDV_EXE ${CMAKE_BINARY_DIR}/src/freedv.exe) + +include(GetPrerequisites) +get_prerequisites("${FREEDV_EXE}" _deps 1 1 "" "${CMAKE_SYSTEM_LIBRARY_PATH}") +foreach(_runtime ${_deps}) + message("Looking for ${_runtime}") + find_library(RUNTIME_${_runtime} ${_runtime}) + message("${RUNTIME_${_runtime}}") + if(RUNTIME_${_runtime}) + file(INSTALL DESTINATION "${CMAKE_INSTALL_PREFIX}/bin" + TYPE EXECUTABLE FILES "${RUNTIME_${_runtime}}") + endif() +endforeach() diff --git a/fdmdv2-dev/src/CMakeLists.txt b/fdmdv2-dev/src/CMakeLists.txt index 88622c91..4eaa27b6 100644 --- a/fdmdv2-dev/src/CMakeLists.txt +++ b/fdmdv2-dev/src/CMakeLists.txt @@ -30,8 +30,8 @@ set(FREEDV_SOURCES sox_biquad.h sox.h topFrame.h - varicode.h - varicode_table.h + #varicode.h + #varicode_table.h version.h )