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_)
else()
add_definitions(-DSVN_REVISION="Unversioned directory")
endif()
-
# Set default build flags.
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")
enable_language(RC)
set(CMAKE_RC_COMPILE_OBJECT
"<CMAKE_RC_COMPILER> <FLAGS> -O coff <DEFINES> -i <SOURCE> -o <OBJECT>")
- # Even using msys, cmake doesn't know it can use unix style paths...
- set(CMAKE_LIBRARY_PATH ${CMAKE_LIBRARY_PATH};C:/MinGW/lib;C:/MinGW/msys/1.0/lib;C:/MinGW/msys/1.0/local/lib)
- message("Library path: ${CMAKE_LIBRARY_PATH}")
- # 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
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
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
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}")
#
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)
message(STATUS "Build type will be: ${CMAKE_BUILD_TYPE}")
#
-# Cpack NSIS configuration for Windows. EXPERIMENTAL!!!
+# Cpack NSIS configuration for Windows.
#
if(WIN32)
- include(InstallRequiredSystemLibraries)
+ 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_VERSION_MINOR ${FREEDV_VERSION_MINOR})
if(FREEDV_VERSION_PATCH)
set(CPACK_PACKAGE_VERSION_PATCH ${FREEDV_VERSION_PATCH})
- endif(FREEDV_VERSION_PATCH)
+ else()
+ set(CPACK_PACKAGE_VERSION_PATCH "0")
+ endif()
set(CPACK_PACKAGE_INSTALL_DIRECTORY "FreeDV")
set(CPACK_PACKAGE_EXECUTABLES freedv;FreeDV)
# There is a bug in NSI that does not handle full unix paths properly. Make
#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)