1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-21 23:55:13 -05:00

Build: MSVC build introduction

This commit is contained in:
f4exb 2019-06-24 18:25:53 +02:00
parent 634723ae2c
commit 4e1bee09e3
10 changed files with 604 additions and 154 deletions

View File

@ -2,9 +2,9 @@ cmake_minimum_required(VERSION 3.1.0)
# force 64bit on windows because we have only that library
# TODO discuss because, at this days, a dsp software should be 64bit
if(WIN32 AND NOT CMAKE_GENERATOR_PLATFORM AND NOT CMAKE_C_COMPILER AND NOT CMAKE_CXX_COMPILER)
set(CMAKE_GENERATOR_PLATFORM "x64" CACHE INTERNAL "")
endif()
# if(WIN32 AND NOT CMAKE_GENERATOR_PLATFORM AND NOT CMAKE_C_COMPILER AND NOT CMAKE_CXX_COMPILER)
# set(CMAKE_GENERATOR_PLATFORM "x64" CACHE INTERNAL "")
# endif()
project(sdrangel)
@ -46,8 +46,11 @@ option(ENABLE_PACK_MIRSDRAPI "Enable inclusion of the mirsdr-api library - for p
# on windows always build external libraries
if(WIN32)
option(ENABLE_EXTERNAL_LIBRARIES "Build external libraries" ON)
# to run fixup_bundle()
option(BUNDLE "Enable distribution bundle" ON)
else()
option(ENABLE_EXTERNAL_LIBRARIES "Build external libraries" OFF)
option(BUNDLE "Enable distribution bundle" OFF)
endif()
# Set additional project information
@ -136,6 +139,11 @@ if(APPLE AND BUNDLE AND BUILD_GUI)
set(INSTALL_BIN_DIR ".")
set(INSTALL_LIB_DIR "lib")
set(INSTALL_DOC_DIR "doc")
elseif(WIN32)
# used to create package
set(INSTALL_BIN_DIR ".")
set(INSTALL_LIB_DIR ".")
set(INSTALL_DOC_DIR ".")
else()
set(INSTALL_BIN_DIR "bin")
set(INSTALL_LIB_DIR "lib/${CMAKE_PROJECT_NAME}")
@ -308,26 +316,38 @@ find_package(FFTW3F REQUIRED)
find_package(LibUSB REQUIRED) # used by so many packages
find_package(OpenCV REQUIRED core highgui imgproc imgcodecs videoio) # channeltx/modatv
# macOS compatibility
if(APPLE)
find_package(ICONV)
endif()
# unfortunately OpenCV library from windows doesn't set the cache option
if(WIN32)
set(OpenCV_INCLUDE_DIRS "${OpenCV_INCLUDE_DIRS}" CACHE INTERNAL "")
set(OpenCV_LIBS "${OpenCV_LIBS}" CACHE INTERNAL "")
# add libs folder for fixup_bundle()
get_filename_component(GFN_Boost_LIBS_DIR Boost_LIBS DIRECTORY)
get_filename_component(GFN_OpenCV_LIBS_DIR OpenCV_LIBS DIRECTORY)
get_filename_component(GFN_Boost_LIBS_DIR "${Boost_LIBS}" DIRECTORY)
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
set(OpenCV_ARCH "64")
elseif(CMAKE_SIZEOF_VOID_P EQUAL 4)
set(OpenCV_ARCH "86")
endif()
if(VS2015)
set(OpenCV_LIBS_BIN_DIR "${OpenCV_DIR}/x${OpenCV_ARCH}/vc14/bin" CACHE INTERNAL "")
elseif(VS2017)
set(OpenCV_LIBS_BIN_DIR "${OpenCV_DIR}/x${OpenCV_ARCH}/vc15/bin" CACHE INTERNAL "")
endif()
set(WINDOWS_FIXUP_BUNDLE_LIB_DIRS
"${WINDOWS_FIXUP_BUNDLE_LIB_DIRS}"
"${GFN_Boost_LIBS_DIR}"
"${GFN_OpenCV_LIBS_DIR}"
"${OpenCV_LIBS_BIN_DIR}"
)
endif()
# macOS compatibility
if(APPLE)
find_package(ICONV)
endif()
# include external cmake if needed
if(ENABLE_EXTERNAL_LIBRARIES)
add_subdirectory(external)
@ -492,11 +512,9 @@ endif()
# install documentation
# TODO maybe install readme for every plugins
if (LINUX OR APPLE)
install(FILES ${CMAKE_SOURCE_DIR}/Readme.md DESTINATION ${INSTALL_DOC_DIR})
endif()
install(FILES ${CMAKE_SOURCE_DIR}/Readme.md DESTINATION ${INSTALL_DOC_DIR})
if(APPLE)
if(APPLE OR WIN32)
install(FILES ${CMAKE_SOURCE_DIR}/CHANGELOG DESTINATION ${INSTALL_DOC_DIR})
install(FILES ${CMAKE_SOURCE_DIR}/LICENSE DESTINATION ${INSTALL_DOC_DIR})
endif()

View File

@ -0,0 +1,4 @@
mkdir build
cd build
cmake ..\ -G "%CMAKE_GENERATOR%" %CMAKE_CUSTOM_OPTIONS%
cmake --build . --config Release --target PACKAGE

View File

@ -89,7 +89,7 @@ Plugins = ../PlugIns
set(BU_CHMOD_BUNDLE_ITEMS ON)
include(BundleUtilities)
fixup_bundle(\"\${CMAKE_INSTALL_PREFIX}/${CMAKE_PROJECT_NAME}\" \"\${SDRANGEL_PLUGINS};\${SDRANGEL_PLUGINSSRV};\${QTPLUGINS};\${SOAPYSDR_PLUGINS}\" \"${CMAKE_LIBRARY_OUTPUT_DIRECTORY}\")
fixup_bundle(\"\${CMAKE_INSTALL_PREFIX}/${CMAKE_PROJECT_NAME}\" \"\${SDRANGEL_PLUGINS};\${SDRANGEL_PLUGINSSRV};\${QTPLUGINS};\${SOAPYSDR_PLUGINS}\" \"${CMAKE_LIBRARY_OUTPUT_DIRECTORY};${MACOS_EXTERNAL_LIBS_FIXUP}\")
# remove non distribuitable file
if(ENABLE_MIRSDRAPI AND OFF)
@ -173,41 +173,134 @@ elseif(LINUX AND BUNDLE)
elseif(WIN32 OR MINGW)
# Copy Qt Plugins; fixup_bundle doesn't do that
install (
DIRECTORY
set(QT_PLUGINS_DIR_SET
"${QT_PLUGINS_DIR}/platforms"
"${QT_PLUGINS_DIR}/audio"
"${QT_PLUGINS_DIR}/accessible"
"${QT_PLUGINS_DIR}/imageformats"
"${QT_PLUGINS_DIR}/mediaservice"
"${QT_PLUGINS_DIR}/playlistformats"
"${QT_PLUGINS_DIR}/styles"
"${QT_PLUGINS_DIR}/renderplugins"
"${QT_PLUGINS_DIR}/iconengines"
DESTINATION "${SDRANGEL_BINARY_BIN_DIR}"
CONFIGURATIONS Release MinSizeRel
COMPONENT runtime
FILES_MATCHING PATTERN "*${CMAKE_SHARED_LIBRARY_SUFFIX}"
PATTERN "*minimal*${CMAKE_SHARED_LIBRARY_SUFFIX}" EXCLUDE
PATTERN "*offscreen*${CMAKE_SHARED_LIBRARY_SUFFIX}" EXCLUDE
PATTERN "*quick*${CMAKE_SHARED_LIBRARY_SUFFIX}" EXCLUDE
PATTERN "*_debug${CMAKE_SHARED_LIBRARY_SUFFIX}" EXCLUDE
)
)
install(CODE "
include(BundleUtilities)
fixup_bundle("${SDRANGEL_BINARY_BIN_DIR}" "" "${WINDOWS_FIXUP_BUNDLE_LIB_DIRS}")
" COMPONENT Runtime)
# Copy Qt Plugins; fixup_bundle doesn't do that
foreach(qt_plugin ${QT_PLUGINS_DIR_SET})
get_filename_component(qt_plugin_name "${qt_plugin}" NAME)
add_custom_target(copy_qt_plugin_${qt_plugin_name} ALL
COMMAND ${CMAKE_COMMAND} -E copy_directory "${qt_plugin}" "${SDRANGEL_BINARY_BIN_DIR}/${qt_plugin_name}"
)
endforeach(qt_plugins)
# unfortunately some libraries are dependencies of dll so we copy by hand
# TODO check if we can use fixup_bundle() and have libraries on root path
# demoddatv.dll
file(GLOB FFMPEG_DLLS "${FFMPEG_LIBRARIES}/*${CMAKE_SHARED_LIBRARY_SUFFIX}")
foreach(ffmpeg_dll ${FFMPEG_DLLS})
get_filename_component(ffmpeg_dll_name "${ffmpeg_dll}" NAME)
add_custom_target(copy_ffmpeg_${ffmpeg_dll_name} ALL
COMMAND ${CMAKE_COMMAND} -E copy_if_different "${ffmpeg_dll}" "${SDRANGEL_BINARY_BIN_DIR}/"
)
endforeach(ffmpeg_dll)
# modatv.dll
file(GLOB OPENCV_DLLS "${OpenCV_LIBS_BIN_DIR}/opencv_world*${CMAKE_SHARED_LIBRARY_SUFFIX}")
foreach(opencv_dll ${OPENCV_DLLS})
get_filename_component(opencv_dll_name "${opencv_dll}" NAME)
add_custom_target(copy_ffmpeg_${opencv_dll_name} ALL
COMMAND ${CMAKE_COMMAND} -E copy_if_different "${opencv_dll}" "${SDRANGEL_BINARY_BIN_DIR}/"
)
endforeach(opencv_dll)
# TODO we need a way to fixup_bundle() on the build bin/ directory without call install
if(BUILD_GUI)
install(CODE "
include(BundleUtilities)
fixup_bundle(\"${SDRANGEL_BINARY_BIN_DIR}/sdrangel${CMAKE_EXECUTABLE_SUFFIX}\" \"\" \"${WINDOWS_FIXUP_BUNDLE_LIB_DIRS}\")
" COMPONENT Runtime)
elseif(BUILD_SERVER)
install(CODE "
include(BundleUtilities)
fixup_bundle(\"${SDRANGEL_BINARY_BIN_DIR}/sdrangelsrv${CMAKE_EXECUTABLE_SUFFIX}\" \"\" \"${WINDOWS_FIXUP_BUNDLE_LIB_DIRS}\")
" COMPONENT Runtime)
endif(BUILD_GUI)
if(BUNDLE)
if(BUILD_GUI)
install(CODE "
include(BundleUtilities)
fixup_bundle(\"\${CMAKE_INSTALL_PREFIX}/sdrangel${CMAKE_EXECUTABLE_SUFFIX}\" \"\" \"${WINDOWS_FIXUP_BUNDLE_LIB_DIRS}\")
" COMPONENT Runtime)
elseif(BUILD_SERVER)
install(CODE "
include(BundleUtilities)
fixup_bundle(\"\${CMAKE_INSTALL_PREFIX}/sdrangelsrv${CMAKE_EXECUTABLE_SUFFIX}\" \"\" \"${WINDOWS_FIXUP_BUNDLE_LIB_DIRS}\")
" COMPONENT Runtime)
endif(BUILD_GUI)
set(CMAKE_INSTALL_UCRT_LIBRARIES TRUE)
# Copy Qt Plugins; fixup_bundle doesn't do that
install (
DIRECTORY ${QT_PLUGINS_DIR_SET}
DESTINATION "${INSTALL_BIN_DIR}"
CONFIGURATIONS Release MinSizeRel
COMPONENT runtime
FILES_MATCHING PATTERN "*${CMAKE_SHARED_LIBRARY_SUFFIX}"
PATTERN "*minimal*${CMAKE_SHARED_LIBRARY_SUFFIX}" EXCLUDE
PATTERN "*offscreen*${CMAKE_SHARED_LIBRARY_SUFFIX}" EXCLUDE
PATTERN "*quick*${CMAKE_SHARED_LIBRARY_SUFFIX}" EXCLUDE
PATTERN "*_debug${CMAKE_SHARED_LIBRARY_SUFFIX}" EXCLUDE
)
# unfortunately some libraries are dependencies of dll so we copy by hand
# TODO check if we can use fixup_bundle() and have libraries on root path
# demoddatv.dll
install(DIRECTORY "${FFMPEG_LIBRARIES}/" DESTINATION "${INSTALL_LIB_DIR}"
FILES_MATCHING PATTERN "*${CMAKE_SHARED_LIBRARY_SUFFIX}")
# modatv.dll
install(DIRECTORY "${OpenCV_LIBS_BIN_DIR}/" DESTINATION "${INSTALL_LIB_DIR}"
FILES_MATCHING PATTERN "opencv_world*${CMAKE_SHARED_LIBRARY_SUFFIX}")
# libusb
get_filename_component(GFN_LIBUSB_DIR "${LIBUSB_LIBRARIES}" DIRECTORY)
install(FILES "${GFN_LIBUSB_DIR}/libusb-1.0${CMAKE_SHARED_LIBRARY_SUFFIX}" DESTINATION "${INSTALL_LIB_DIR}")
install(CODE "
# remove *.lib files
# TODO find a better way
file(GLOB NSIS_REMOVE_LIB \"\${CMAKE_INSTALL_PREFIX}/*.lib\")
foreach(file \${NSIS_REMOVE_LIB})
file(REMOVE \"\${file}\")
endforeach()
file(GLOB NSIS_REMOVE_LIB \"\${CMAKE_INSTALL_PREFIX}/${INSTALL_PLUGINS_DIR}/*.lib\")
foreach(file \${NSIS_REMOVE_LIB})
file(REMOVE \"\${file}\")
endforeach()
file(GLOB NSIS_REMOVE_LIB \"\${CMAKE_INSTALL_PREFIX}/${INSTALL_PLUGINSSRV_DIR}/*.lib\")
foreach(file \${NSIS_REMOVE_LIB})
file(REMOVE \"\${file}\")
endforeach()
" COMPONENT Runtime)
list(APPEND CPACK_GENERATOR "ZIP;NSIS")
set(CPACK_MONOLITHIC_INSTALL ON)
set(CPACK_NSIS_HELP_LINK ${CPACK_PACKAGE_CONTACT})
set(CPACK_NSIS_URL_INFO_ABOUT ${CPACK_PACKAGE_CONTACT})
set(CPACK_NSIS_CONTACT ${APPLICATION_MAINTAINER})
set(CPACK_NSIS_MUI_ICON "${CMAKE_SOURCE_DIR}/cmake/cpack/sdrangel_icon.ico")
set(CPACK_NSIS_MUI_UNIICON "${CMAKE_SOURCE_DIR}/cmake/cpack/sdrangel_icon.ico")
set(CPACK_NSIS_PACKAGE_NAME "${APPLICATION_NAME}")
set(CPACK_NSIS_CONTACT "${APPLICATION_MAINTAINER}")
set(CPACK_NSIS_ENABLE_UNINSTALL_BEFORE_INSTALL ON)
set(CPACK_NSIS_MODIFY_PATH ON)
set(CPACK_PACKAGE_INSTALL_DIRECTORY ${APPLICATION_NAME})
set(CPACK_PACKAGE_INSTALL_REGISTRY_KEY ${APPLICATION_NAME})
list(APPEND CPACK_NSIS_EXTRA_INSTALL_COMMANDS "
ExecWait '$INSTDIR\\\\${VCREDIST_FILE} /passive /norestart'
Delete '$INSTDIR\\\\${VCREDIST_FILE}'
")
set(CPACK_NSIS_CREATE_ICONS_EXTRA
"CreateShortCut '$SMPROGRAMS\\\\$STARTMENU_FOLDER\\\\SDRangel.lnk' '$INSTDIR\\\\sdrangel.exe'")
set(CPACK_NSIS_DELETE_ICONS_EXTRA
"Delete '$SMPROGRAMS\\\\$START_MENU\\\\SDRangel.lnk'")
endif()
endif(APPLE AND BUNDLE AND BUILD_GUI)

View File

@ -29,4 +29,8 @@ target_link_libraries(hackrfdevice
sdrbase
)
if(ENABLE_EXTERNAL_LIBRARIES AND NOT LINUX)
add_dependencies(hackrfdevice hackrf)
endif()
install(TARGETS hackrfdevice DESTINATION ${INSTALL_LIB_DIR})

View File

@ -20,10 +20,6 @@ add_library(limesdrdevice SHARED
${limesdrdevice_SOURCES}
)
if(ENABLE_EXTERNAL_LIBRARIES)
add_dependencies(limesdrdevice limesuite)
endif()
set_target_properties(limesdrdevice
PROPERTIES DEFINE_SYMBOL "devices_EXPORTS")
@ -32,4 +28,8 @@ target_link_libraries(limesdrdevice
sdrbase
)
if(ENABLE_EXTERNAL_LIBRARIES)
add_dependencies(limesdrdevice limesuite)
endif()
install(TARGETS limesdrdevice DESTINATION ${INSTALL_LIB_DIR})

View File

@ -19,16 +19,13 @@ set(plutosdrdevice_HEADERS
include_directories(
${LIBIIO_INCLUDE_DIR}
${ICONV_INCLUDE_DIR}
${Boost_INCLUDE_DIRS}
)
add_library(plutosdrdevice SHARED
${plutosdrdevice_SOURCES}
)
if(ENABLE_EXTERNAL_LIBRARIES)
add_dependencies(plutosdrdevice libiio)
endif()
set_target_properties(plutosdrdevice
PROPERTIES DEFINE_SYMBOL "devices_EXPORTS")
@ -38,4 +35,8 @@ target_link_libraries(plutosdrdevice
${ICONV_LIBRARY}
)
if(ENABLE_EXTERNAL_LIBRARIES)
add_dependencies(plutosdrdevice libiio)
endif()
install(TARGETS plutosdrdevice DESTINATION ${INSTALL_LIB_DIR})

View File

@ -30,4 +30,8 @@ target_link_libraries(soapysdrdevice
sdrbase
)
if(ENABLE_EXTERNAL_LIBRARIES)
add_dependencies(soapysdrdevice soapysdr)
endif()
install(TARGETS soapysdrdevice DESTINATION ${INSTALL_LIB_DIR})

View File

@ -10,7 +10,7 @@
# which version/tag/checkout to use
set(CODEC2_TAG 76a20416d715ee06f8b36a9953506876689a3bd2)
set(CM256CC_TAG f21e8bc1e9afdb0b28672743dcec111aec1d32d9)
set(MBELIB_TAG "debian/1.3.0")
set(MBELIB_TAG 9a04ed5c78176a9965f3d43f7aa1b1f5330e771f)
set(SERIALDV_TAG abd65a0fc2d5339808194862d14119b0cba70424)
set(DSDCC_TAG a0f46941383120904c7211cf0fd94f04e2abfe73)
set(LIMESUITE_TAG "v19.01.0")
@ -19,6 +19,16 @@ set(LIBIIO_TAG 826563e41b5ce9890b75506f672017de8d76d52d)
set(AIRSPYHF_TAG "1.1.5")
set(PERSEUS_TAG afefa23e3140ac79d845acb68cf0beeb86d09028)
set(PTHREADS4W_TAG "Version-2-11-0-release")
set(RTLSDR_TAG f68bb2fa772ad94f58c59babd78353667570630b)
set(RTLSDR_UDEV OFF)
set(SOAPYSDR_TAG "soapy-sdr-0.7.1")
set(SOAPYSDR_SDRPLAY_TAG "soapy-sdrplay-0.2.0")
set(SOAPYSDR_AUDIO_TAG "soapy-audio-0.1.1")
set(SOAPYSDR_REMOTE_TAG "soapy-remote-0.5.1")
set(AIRSPY_TAG bfb667080936ca5c2d23b3282f5893931ec38d3f)
set(HACKRF_TAG "v2018.01.1")
set(LIBXML2_TAG "v2.9.9")
# For some external project macros
include(ExternalProject)
@ -26,7 +36,7 @@ include(ExternalProject)
# default build destination in windows to avoid Release/Debug folder
if(WIN32)
# the build will be output on the same folder of sdrangel
set(DEFAULT_OUTPUT_DIRECTORY
set(DEFAULT_OUTPUT_DIRECTORIES
-DCMAKE_RUNTIME_OUTPUT_DIRECTORY=${SDRANGEL_BINARY_BIN_DIR}
-DCMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG=${SDRANGEL_BINARY_BIN_DIR}
-DCMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE=${SDRANGEL_BINARY_BIN_DIR}
@ -35,9 +45,10 @@ if(WIN32)
-DCMAKE_ARCHIVE_OUTPUT_DIRECTORY_RELEASE=${SDRANGEL_BINARY_LIB_DIR}
-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=${SDRANGEL_BINARY_LIB_DIR}
-DCMAKE_LIBRARY_OUTPUT_DIRECTORY_DEBUG=${SDRANGEL_BINARY_LIB_DIR}
-DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE=${SDRANGEL_BINARY_LIB_DIR})
-DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE=${SDRANGEL_BINARY_LIB_DIR}
)
elseif(LINUX)
set(DEFAULT_OUTPUT_DIRECTORY
set(DEFAULT_OUTPUT_DIRECTORIES
-DCMAKE_RUNTIME_OUTPUT_DIRECTORY=${EXTERNAL_BUILD_LIBRARIES}/bin
-DCMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG=${EXTERNAL_BUILD_LIBRARIES}/bin
-DCMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE=${EXTERNAL_BUILD_LIBRARIES}/bin
@ -49,29 +60,64 @@ set(DEFAULT_OUTPUT_DIRECTORY
-DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE=${EXTERNAL_BUILD_LIBRARIES}/lib)
endif()
if(LINUX)
# macro that create symbolic links
macro(makeLink src dest target)
if(NOT EXISTS ${dest})
add_custom_command(TARGET ${target} PRE_BUILD
COMMAND ${CMAKE_COMMAND} -E create_symlink ${src} ${dest} DEPENDS ${dest} COMMENT "mklink ${src} -> ${dest}")
endif()
endmacro()
# macro that copy folder
macro(makeCopy src dest target)
if(NOT EXISTS ${dest})
add_custom_command(TARGET ${target} PRE_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_directory ${src} ${dest} DEPENDS ${dest} COMMENT "copy ${src} -> ${dest}")
endif()
endmacro()
else()
# macro that create symbolic links
macro(makeLink src dest target)
if(NOT EXISTS ${dest})
add_custom_command(TARGET ${target} PRE_BUILD
COMMAND ${CMAKE_COMMAND} -E create_symlink ${src} ${dest} DEPENDS ${dest} COMMENT "mklink ${src} -> ${dest}")
endif()
endmacro()
# macro that copy folder
macro(makeCopy src dest target)
if(NOT EXISTS ${dest})
add_custom_command(TARGET ${target} PRE_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_directory ${src} ${dest} DEPENDS ${dest} COMMENT "copy ${src} -> ${dest}")
endif()
endmacro()
macro(makeLink src dest target)
if(NOT EXISTS ${dest})
add_custom_command(TARGET ${target} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E create_symlink ${src} ${dest} DEPENDS ${dest} COMMENT "mklink ${src} -> ${dest}")
endif()
endmacro()
# macro that copy folder
macro(makeCopyDir src dest target)
if(NOT EXISTS ${dest})
add_custom_command(TARGET ${target} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_directory ${src} ${dest} DEPENDS ${dest} COMMENT "copy ${src} -> ${dest}")
endif()
endmacro()
# macro that copy folder
macro(makeCopy src dest target)
if(NOT EXISTS ${dest})
add_custom_command(TARGET ${target} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy ${src} ${dest} DEPENDS ${dest} COMMENT "copy ${src} -> ${dest}")
endif()
endmacro()
endif(LINUX)
if(WIN32)
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
set(VCREDIST_FILE "vc_redist.x64${CMAKE_EXECUTABLE_SUFFIX}" CACHE INTERNAL "")
# maybe add arm architecture
else()
set(VCREDIST_FILE "vc_redist.x86${CMAKE_EXECUTABLE_SUFFIX}" CACHE INTERNAL "")
endif()
install(FILES "${EXTERNAL_LIBRARY_FOLDER}/vcredist/${VCREDIST_FILE}" DESTINATION "${INSTALL_BIN_DIR}")
endif(WIN32)
# probably build with mingw64 on windows
if(NOT WIN32)
# needs boost
# needs speexdsp
ExternalProject_Add(codec2
GIT_REPOSITORY https://github.com/drowe67/codec2.git
GIT_TAG ${CODEC2_TAG}
PREFIX "${EXTERNAL_BUILD_LIBRARIES}/codec2"
CMAKE_ARGS ${DEFAULT_OUTPUT_DIRECTORY}
CMAKE_ARGS ${DEFAULT_OUTPUT_DIRECTORIES}
INSTALL_COMMAND ""
TEST_COMMAND ""
)
@ -96,7 +142,12 @@ ExternalProject_Add(cm256cc
GIT_REPOSITORY https://github.com/f4exb/cm256cc.git
GIT_TAG ${CM256CC_TAG}
PREFIX "${EXTERNAL_BUILD_LIBRARIES}/cm256cc"
CMAKE_ARGS -DBUILD_TOOLS=OFF -DBOOST_ROOT="${BOOST_ROOT}" -DENABLE_DISTRIBUTION=ON ${DEFAULT_OUTPUT_DIRECTORY}
CMAKE_ARGS ${DEFAULT_OUTPUT_DIRECTORIES}
-DBUILD_TOOLS=OFF
-DBOOST_ROOT="${BOOST_ROOT}"
-DBoost_INCLUDE_DIR=${Boost_INCLUDE_DIRS}
-DBoost_INCLUDE_DIRS=${Boost_INCLUDE_DIRS}
-DENABLE_DISTRIBUTION=ON
INSTALL_COMMAND ""
TEST_COMMAND ""
)
@ -106,19 +157,22 @@ set(CM256CC_FOUND ON CACHE INTERNAL "")
set(CM256CC_INCLUDE_DIR "${EXTERNAL_BUILD_LIBRARIES}/cm256cc/src" CACHE INTERNAL "")
if(WIN32)
set(CM256CC_LIBRARIES "${SDRANGEL_BINARY_LIB_DIR}/cm256cc.lib" CACHE INTERNAL "")
install(FILES "${SDRANGEL_BINARY_BIN_DIR}/cm256cc${CMAKE_SHARED_LIBRARY_SUFFIX}" DESTINATION "${INSTALL_LIB_DIR}")
elseif(LINUX)
set(CM256CC_LIBRARIES "${EXTERNAL_BUILD_LIBRARIES}/lib/libcm256cc${CMAKE_SHARED_LIBRARY_SUFFIX}" CACHE INTERNAL "")
else()
elseif(APPLE)
set(CM256CC_LIBRARIES "${binary_dir}/libcm256cc${CMAKE_SHARED_LIBRARY_SUFFIX}" CACHE INTERNAL "")
install(DIRECTORY "${binary_dir}/" DESTINATION "${INSTALL_LIB_DIR}"
FILES_MATCHING PATTERN "libcm256cc*${CMAKE_SHARED_LIBRARY_SUFFIX}")
set(MACOS_EXTERNAL_LIBS_FIXUP "${MACOS_EXTERNAL_LIBS_FIXUP};${binary_dir}")
endif()
set(USE_MBELIB OFF)
if(NOT WIN32)
ExternalProject_Add(mbelib
GIT_REPOSITORY https://github.com/szechyjs/mbelib.git
GIT_TAG ${MBELIB_TAG}
PREFIX "${EXTERNAL_BUILD_LIBRARIES}/mbelib"
CMAKE_ARGS -DDISABLE_TEST=ON ${DEFAULT_OUTPUT_DIRECTORY}
CMAKE_ARGS -DDISABLE_TEST=ON ${DEFAULT_OUTPUT_DIRECTORIES}
INSTALL_COMMAND ""
TEST_COMMAND ""
)
@ -129,19 +183,22 @@ set(LIBMBE_FOUND ON CACHE INTERNAL "")
set(LIBMBE_INCLUDE_DIR "${source_dir}")
if(WIN32)
set(LIBMBE_LIBRARIES "${SDRANGEL_BINARY_LIB_DIR}/mbe.lib")
install(FILES "${SDRANGEL_BINARY_BIN_DIR}/mbe${CMAKE_SHARED_LIBRARY_SUFFIX}" DESTINATION "${INSTALL_LIB_DIR}")
elseif(LINUX)
set(LIBMBE_LIBRARIES "${EXTERNAL_BUILD_LIBRARIES}/lib/libmbe${CMAKE_SHARED_LIBRARY_SUFFIX}")
else()
elseif(APPLE)
set(LIBMBE_LIBRARIES "${binary_dir}/libmbe${CMAKE_SHARED_LIBRARY_SUFFIX}")
install(DIRECTORY "${binary_dir}/" DESTINATION "${INSTALL_LIB_DIR}"
FILES_MATCHING PATTERN "libmbe*${CMAKE_SHARED_LIBRARY_SUFFIX}")
set(MACOS_EXTERNAL_LIBS_FIXUP "${MACOS_EXTERNAL_LIBS_FIXUP};${binary_dir}")
endif()
endif(NOT WIN32)
if(WIN32 OR LINUX)
ExternalProject_Add(serialdv
GIT_REPOSITORY https://github.com/f4exb/serialDV.git
GIT_TAG ${SERIALDV_TAG}
PREFIX "${EXTERNAL_BUILD_LIBRARIES}/serialdv"
CMAKE_ARGS -DBUILD_TOOL=OFF ${DEFAULT_OUTPUT_DIRECTORY}
CMAKE_ARGS -DBUILD_TOOL=OFF ${DEFAULT_OUTPUT_DIRECTORIES}
INSTALL_COMMAND ""
TEST_COMMAND ""
)
@ -151,17 +208,21 @@ if(WIN32 OR LINUX)
set(LIBSERIALDV_INCLUDE_DIR "${source_dir}" CACHE INTERNAL "")
if(WIN32)
set(LIBSERIALDV_LIBRARY "${SDRANGEL_BINARY_LIB_DIR}/serialdv.lib" CACHE INTERNAL "")
makeCopy("${source_dir}" "${source_dir}/dsp" serialdv)
makeCopyDir("${source_dir}" "${source_dir}/dsp" serialdv)
install(FILES "${SDRANGEL_BINARY_BIN_DIR}/serialdv${CMAKE_SHARED_LIBRARY_SUFFIX}" DESTINATION "${INSTALL_LIB_DIR}")
elseif(LINUX)
set(LIBSERIALDV_LIBRARY "${EXTERNAL_BUILD_LIBRARIES}/lib/libserialdv${CMAKE_SHARED_LIBRARY_SUFFIX}" CACHE INTERNAL "")
# because sdrbase/dsp/dvserialworker.h use dsp/dvcontroller.h
# so we need a link
makeLink("${source_dir}" "${source_dir}/dsp" serialdv)
else()
set(LIBSERIALDV_LIBRARY "${binary_dir}/libserialdv${CMAKE_SHARED_LIBRARY_SUFFIX}" CACHE INTERNAL "")
# because sdrbase/dsp/dvserialworker.h use dsp/dvcontroller.h
# so we need a link
makeLink("${source_dir}" "${source_dir}/dsp" serialdv)
elseif(APPLE)
set(LIBSERIALDV_LIBRARY "${binary_dir}/libserialdv${CMAKE_SHARED_LIBRARY_SUFFIX}" CACHE INTERNAL "")
# because sdrbase/dsp/dvserialworker.h use dsp/dvcontroller.h
# so we need a link
makeLink("${source_dir}" "${source_dir}/dsp" serialdv)
install(DIRECTORY "${binary_dir}/" DESTINATION "${INSTALL_LIB_DIR}"
FILES_MATCHING PATTERN "libserialdv*${CMAKE_SHARED_LIBRARY_SUFFIX}")
set(MACOS_EXTERNAL_LIBS_FIXUP "${MACOS_EXTERNAL_LIBS_FIXUP};${binary_dir}")
endif()
endif()
@ -170,7 +231,12 @@ ExternalProject_Add(dsdcc
GIT_TAG ${DSDCC_TAG}
DEPENDS ${DSDCC_DEPENDS}
PREFIX "${EXTERNAL_BUILD_LIBRARIES}/dsdcc"
CMAKE_ARGS ${DEFAULT_OUTPUT_DIRECTORY} -DBUILD_TOOL=OFF -DUSE_MBELIB=${USE_MBELIB} -DLIBMBE_INCLUDE_DIR=${LIBMBE_INCLUDE_DIR} -DLIBMBE_LIBRARY=${LIBMBE_LIBRARIES} -DLIBSERIALDV_INCLUDE_DIR=${LIBSERIALDV_INCLUDE_DIR} -DLIBSERIALDV_LIBRARY=${LIBSERIALDV_LIBRARY}
CMAKE_ARGS ${DEFAULT_OUTPUT_DIRECTORIES}
-DBUILD_TOOL=OFF -DUSE_MBELIB=${USE_MBELIB}
-DLIBMBE_INCLUDE_DIR=${LIBMBE_INCLUDE_DIR}
-DLIBMBE_LIBRARY=${LIBMBE_LIBRARIES}
-DLIBSERIALDV_INCLUDE_DIR=${LIBSERIALDV_INCLUDE_DIR}
-DLIBSERIALDV_LIBRARY=${LIBSERIALDV_LIBRARY}
INSTALL_COMMAND ""
TEST_COMMAND ""
)
@ -179,12 +245,40 @@ set(LIBDSDCC_FOUND ON CACHE INTERNAL "")
set(LIBDSDCC_INCLUDE_DIR "${EXTERNAL_BUILD_LIBRARIES}/dsdcc/src" CACHE INTERNAL "")
if(WIN32)
set(LIBDSDCC_LIBRARIES "${SDRANGEL_BINARY_LIB_DIR}/dsdcc.lib" CACHE INTERNAL "")
install(FILES "${SDRANGEL_BINARY_BIN_DIR}/dsdcc${CMAKE_SHARED_LIBRARY_SUFFIX}" DESTINATION "${INSTALL_LIB_DIR}")
elseif(LINUX)
set(LIBDSDCC_LIBRARIES "${EXTERNAL_BUILD_LIBRARIES}/lib/libdsdcc${CMAKE_SHARED_LIBRARY_SUFFIX}" CACHE INTERNAL "")
else()
elseif(APPLE)
set(LIBDSDCC_LIBRARIES "${binary_dir}/libdsdcc${CMAKE_SHARED_LIBRARY_SUFFIX}" CACHE INTERNAL "")
install(DIRECTORY "${binary_dir}/" DESTINATION "${INSTALL_LIB_DIR}"
FILES_MATCHING PATTERN "libdsdcc*${CMAKE_SHARED_LIBRARY_SUFFIX}")
set(MACOS_EXTERNAL_LIBS_FIXUP "${MACOS_EXTERNAL_LIBS_FIXUP};${binary_dir}/")
endif()
# requirements needed by many packages on windows
if(WIN32)
ExternalProject_Add(pthreads4w
GIT_REPOSITORY https://git.code.sf.net/p/pthreads4w/code
GIT_TAG ${PTHREADS4W_TAG}
PREFIX "${EXTERNAL_BUILD_LIBRARIES}/pthreads4w"
PATCH_COMMAND ${CMAKE_COMMAND} -E touch "<SOURCE_DIR>/COPYING.LIB"
BUILD_IN_SOURCE 1
CONFIGURE_COMMAND ""
BUILD_COMMAND nmake VC
INSTALL_COMMAND ""
TEST_COMMAND ""
)
ExternalProject_Get_Property(pthreads4w source_dir binary_dir)
set(PTHREADS4W_DEPENDS pthreads4w)
set(PTHREADS4W_FOUND ON CACHE INTERNAL "")
set(PTHREADS4W_INCLUDE_DIR "${source_dir}" CACHE INTERNAL "")
set(PTHREADS4W_LIBRARIES "${source_dir}/pthreadVC2.lib" CACHE INTERNAL "")
makeCopy("${source_dir}/pthreadVC2${CMAKE_SHARED_LIBRARY_SUFFIX}" "${SDRANGEL_BINARY_BIN_DIR}/pthreadVC2${CMAKE_SHARED_LIBRARY_SUFFIX}" pthreads4w)
# needed by bladerf
makeCopy("${source_dir}/pthreadVC2${CMAKE_SHARED_LIBRARY_SUFFIX}" "${source_dir}/dll/x64/pthreadVC2${CMAKE_SHARED_LIBRARY_SUFFIX}" pthreads4w)
install(FILES "${source_dir}/pthreadVC2${CMAKE_SHARED_LIBRARY_SUFFIX}" DESTINATION "${INSTALL_LIB_DIR}")
endif(WIN32)
# Device interface libraries. Use external libraries build for these. Only Linux for now.
if (LINUX)
# apt install liblimesuite-dev (only on ubuntu 18.04). Can be picky on version though so let's build it.
@ -193,7 +287,7 @@ if (LINUX)
GIT_REPOSITORY https://github.com/myriadrf/LimeSuite.git
GIT_TAG ${LIMESUITE_TAG}
PREFIX "${EXTERNAL_BUILD_LIBRARIES}/limesuite"
CMAKE_ARGS ${DEFAULT_OUTPUT_DIRECTORY} -DLIME_SUITE_EXTVER=release -DENABLE_GUI=OFF -DENABLE_NOVENARF7=OFF -DENABLE_SOAPY_LMS7=OFF -DENABLE_OCTAVE=OFF -DENABLE_SIMD_FLAGS=SSE3
CMAKE_ARGS ${DEFAULT_OUTPUT_DIRECTORIES} -DLIME_SUITE_EXTVER=release -DENABLE_GUI=OFF -DENABLE_NOVENARF7=OFF -DENABLE_SOAPY_LMS7=OFF -DENABLE_OCTAVE=OFF -DENABLE_SIMD_FLAGS=SSE3
INSTALL_COMMAND ""
TEST_COMMAND ""
)
@ -208,7 +302,7 @@ if (LINUX)
GIT_TAG ${BLADERF_TAG}
GIT_SUBMODULES
PREFIX "${EXTERNAL_BUILD_LIBRARIES}/bladerf"
CMAKE_ARGS ${DEFAULT_OUTPUT_DIRECTORY}
CMAKE_ARGS ${DEFAULT_OUTPUT_DIRECTORIES}
SOURCE_SUBDIR host/
INSTALL_COMMAND ""
TEST_COMMAND ""
@ -223,7 +317,7 @@ if (LINUX)
GIT_REPOSITORY https://github.com/analogdevicesinc/libiio.git
GIT_TAG ${LIBIIO_TAG}
PREFIX "${EXTERNAL_BUILD_LIBRARIES}/libiio"
CMAKE_ARGS ${DEFAULT_OUTPUT_DIRECTORY} -DOSX_PACKAGE=OFF -DWITH_DOC=OFF
CMAKE_ARGS ${DEFAULT_OUTPUT_DIRECTORIES} -DOSX_PACKAGE=OFF -DWITH_DOC=OFF
INSTALL_COMMAND ""
TEST_COMMAND ""
)
@ -237,7 +331,7 @@ if (LINUX)
GIT_REPOSITORY https://github.com/airspy/airspyhf.git
GIT_TAG ${AIRSPYHF_TAG}
PREFIX "${EXTERNAL_BUILD_LIBRARIES}/airspyhf"
CMAKE_ARGS ${DEFAULT_OUTPUT_DIRECTORY}
CMAKE_ARGS ${DEFAULT_OUTPUT_DIRECTORIES}
INSTALL_COMMAND ""
TEST_COMMAND ""
)
@ -252,81 +346,309 @@ if (LINUX)
GIT_REPOSITORY https://github.com/f4exb/libperseus-sdr.git
GIT_TAG ${PERSEUS_TAG}
PREFIX "${EXTERNAL_BUILD_LIBRARIES}/perseus"
CMAKE_ARGS ${DEFAULT_OUTPUT_DIRECTORY}
CMAKE_ARGS ${DEFAULT_OUTPUT_DIRECTORIES}
INSTALL_COMMAND ""
TEST_COMMAND ""
)
set(LIBPERSEUS_FOUND ON CACHE INTERNAL "")
set(LIBPERSEUS_INCLUDE_DIR "${EXTERNAL_BUILD_LIBRARIES}/perseus/src/perseus" CACHE INTERNAL "")
set(LIBPERSEUS_LIBRARIES "${EXTERNAL_BUILD_LIBRARIES}/lib/libperseus-sdr.so" CACHE INTERNAL "")
endif()
endif(LINUX)
# already on the respository
# TODO decide what to do
if(OFF)
# apt install libcodec2-dev
# needs speexdsp
ExternalProject_Add(codec2
GIT_REPOSITORY https://github.com/drowe67/codec2.git
GIT_TAG ff5841a18bfd9df0e8a250dc57fb7388cabccda1
PREFIX "${EXTERNAL_BUILD_LIBRARIES}/codec2"
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${EXTERNAL_INSTALL_LIBRARIES} -DCMAKE_BUILD_TYPE=Release -DUNITTEST=OFF
)
# apt install libairspy-dev
# needs libusb and pkgconfig
ExternalProject_Add(airspy
GIT_REPOSITORY https://github.com/airspy/airspyone_host.git
GIT_TAG bfb667080936ca5c2d23b3282f5893931ec38d3f
PREFIX "${EXTERNAL_BUILD_LIBRARIES}/airspy"
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${EXTERNAL_INSTALL_LIBRARIES}
)
# apt install libhackrf-dev
# needs pkgconfig, libusb and fftw-3
ExternalProject_Add(hackrf
GIT_REPOSITORY https://github.com/mossmann/hackrf.git
GIT_TAG v2018.01.1
PREFIX "${EXTERNAL_BUILD_LIBRARIES}/hackrf"
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${EXTERNAL_INSTALL_LIBRARIES}
SOURCE_SUBDIR host/
)
# apt install librtlsdr-dev
# needs pkgconfig and libusb
ExternalProject_Add(rtlsdr
GIT_REPOSITORY https://github.com/osmocom/rtl-sdr.git
GIT_TAG f68bb2fa772ad94f58c59babd78353667570630b
PREFIX "${EXTERNAL_BUILD_LIBRARIES}/rtlsdr"
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${EXTERNAL_INSTALL_LIBRARIES}
)
# apt install libmirisdr-dev
# needs pkgconfig and libusb
ExternalProject_Add(mirisdr
GIT_REPOSITORY https://github.com/f4exb/libmirisdr-4.git
GIT_TAG v1.1.2
PREFIX "${EXTERNAL_BUILD_LIBRARIES}/mirisdr"
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${EXTERNAL_INSTALL_LIBRARIES}
)
# apt install libiio-dev
# needs pkgconfig, libusb, libxml2, lzma, xz, libiconv
ExternalProject_Add(libiio
GIT_REPOSITORY https://github.com/analogdevicesinc/libiio.git
GIT_TAG 826563e41b5ce9890b75506f672017de8d76d52d
PREFIX "${EXTERNAL_BUILD_LIBRARIES}/libiio"
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${EXTERNAL_INSTALL_LIBRARIES} -DOSX_PACKAGE=OFF -DWITH_DOC=OFF
)
# apt install libsoapysdr-dev (only on ubuntu 18.04)
ExternalProject_Add(soapysdr
GIT_REPOSITORY https://github.com/pothosware/SoapySDR.git
GIT_TAG soapy-sdr-0.7.1
PREFIX "${EXTERNAL_BUILD_LIBRARIES}/soapysdr"
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${EXTERNAL_INSTALL_LIBRARIES} -DENABLE_PYTHON=OFF -DENABLE_PYTHON3=OFF
)
# TODO: sdrplay is binary only!
# needs soapysdr, sdrplay
ExternalProject_Add(soapysdrplay
GIT_REPOSITORY https://github.com/pothosware/SoapySDRPlay.git
GIT_TAG soapy-sdrplay-0.2.0
DEPENDS soapysdr
PREFIX "${EXTERNAL_BUILD_LIBRARIES}/soapysdrplay"
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${EXTERNAL_INSTALL_LIBRARIES} -DCMAKE_BUILD_TYPE=Release
)
endif(OFF)
if(WIN32 OR APPLE)
if(ENABLE_LIMESUITE)
# needs pkgconfig, libusb
ExternalProject_Add(limesuite
GIT_REPOSITORY https://github.com/myriadrf/LimeSuite.git
GIT_TAG ${LIMESUITE_TAG}
PREFIX "${EXTERNAL_BUILD_LIBRARIES}/limesuite"
CMAKE_ARGS ${DEFAULT_OUTPUT_DIRECTORIES}
-DLIME_SUITE_EXTVER=release
-DENABLE_GUI=OFF
-DENABLE_NOVENARF7=OFF
-DENABLE_SOAPY_LMS7=OFF
-DENABLE_OCTAVE=OFF
-DENABLE_QUICKTEST=OFF
-DENABLE_EXAMPLES=OFF
-DENABLE_SIMD_FLAGS=SSE3
INSTALL_COMMAND ""
TEST_COMMAND ""
)
ExternalProject_Get_Property(limesuite source_dir binary_dir)
set(LIMESUITE_FOUND ON CACHE INTERNAL "")
set(LIMESUITE_INCLUDE_DIR "${source_dir}/src" CACHE INTERNAL "")
if(WIN32)
set(LIMESUITE_LIBRARY "${SDRANGEL_BINARY_LIB_DIR}/LimeSuite.lib" CACHE INTERNAL "")
install(FILES "${SDRANGEL_BINARY_BIN_DIR}/LimeSuite${CMAKE_SHARED_LIBRARY_SUFFIX}" DESTINATION "${INSTALL_LIB_DIR}")
elseif(APPLE)
set(LIMESUITE_LIBRARY "${binary_dir}/src/libLimeSuite${CMAKE_SHARED_LIBRARY_SUFFIX}" CACHE INTERNAL "")
install(DIRECTORY "${binary_dir}/src/" DESTINATION "${INSTALL_LIB_DIR}"
FILES_MATCHING PATTERN "libLimeSuite*${CMAKE_SHARED_LIBRARY_SUFFIX}")
set(MACOS_EXTERNAL_LIBS_FIXUP "${MACOS_EXTERNAL_LIBS_FIXUP};${binary_dir}/src/")
endif()
endif(ENABLE_LIMESUITE)
if(ENABLE_SOAPYSDR)
ExternalProject_Add(soapysdr
GIT_REPOSITORY https://github.com/pothosware/SoapySDR.git
GIT_TAG ${SOAPYSDR_TAG}
PREFIX "${EXTERNAL_BUILD_LIBRARIES}/soapysdr"
CMAKE_ARGS ${DEFAULT_OUTPUT_DIRECTORIES}
-DENABLE_PYTHON=OFF
-DENABLE_PYTHON3=OFF
-DENABLE_TESTS=OFF
INSTALL_COMMAND ""
TEST_COMMAND ""
)
ExternalProject_Get_Property(soapysdr source_dir binary_dir)
set(SOAPYSDR_FOUND ON CACHE INTERNAL "")
set(SOAPYSDR_INCLUDE_DIR "${source_dir}/include" CACHE INTERNAL "")
if(WIN32)
set(SOAPYSDR_LIBRARY "${SDRANGEL_BINARY_LIB_DIR}/SoapySDR.lib" CACHE INTERNAL "")
install(FILES "${SDRANGEL_BINARY_BIN_DIR}/SoapySDR${CMAKE_SHARED_LIBRARY_SUFFIX}" DESTINATION "${INSTALL_LIB_DIR}")
elseif(APPLE)
set(SOAPYSDR_LIBRARY "${binary_dir}/lib/libSoapySDR${CMAKE_SHARED_LIBRARY_SUFFIX}" CACHE INTERNAL "")
install(DIRECTORY "${binary_dir}/lib/" DESTINATION "${INSTALL_LIB_DIR}"
FILES_MATCHING PATTERN "libSoapySDR*${CMAKE_SHARED_LIBRARY_SUFFIX}")
set(MACOS_EXTERNAL_LIBS_FIXUP "${MACOS_EXTERNAL_LIBS_FIXUP};${binary_dir}/lib/")
endif()
endif(ENABLE_SOAPYSDR)
if(ENABLE_AIRSPY)
if(WIN32)
set(AIRSPY_LIBUSB_INCLUDE_DIR ${LIBUSB_INCLUDE_DIR}/libusb-1.0)
else()
set(AIRSPY_LIBUSB_INCLUDE_DIR ${LIBUSB_INCLUDE_DIR})
endif()
# needs libusb, pthreads
ExternalProject_Add(airspy
GIT_REPOSITORY https://github.com/airspy/airspyone_host
GIT_TAG ${AIRSPY_TAG}
DEPENDS ${PTHREADS4W_DEPENDS}
PREFIX "${EXTERNAL_BUILD_LIBRARIES}/airspy"
CMAKE_ARGS ${DEFAULT_OUTPUT_DIRECTORIES}
-DLIBUSB_LIBRARIES=${LIBUSB_LIBRARIES}
-DLIBUSB_INCLUDE_DIR=${AIRSPY_LIBUSB_INCLUDE_DIR}
-DTHREADS_PTHREADS_INCLUDE_DIR=${PTHREADS4W_INCLUDE_DIR}
-DTHREADS_PTHREADS_WIN32_LIBRARY=${PTHREADS4W_LIBRARIES}
INSTALL_COMMAND ""
TEST_COMMAND ""
)
add_dependencies(airspy pthreads4w)
ExternalProject_Get_Property(airspy source_dir binary_dir)
set(LIBAIRSPY_FOUND ON CACHE INTERNAL "")
set(LIBAIRSPY_INCLUDE_DIR "${source_dir}/libairspy/src" CACHE INTERNAL "")
if(WIN32)
set(LIBAIRSPY_LIBRARIES "${SDRANGEL_BINARY_LIB_DIR}/airspy.lib" CACHE INTERNAL "")
makeCopyDir("${source_dir}/libairspy/src" "${source_dir}/libairspy/src/libairspy" airspy)
makeCopy("${binary_dir}/airspy-tools/src/airspy${CMAKE_SHARED_LIBRARY_SUFFIX}" "${SDRANGEL_BINARY_BIN_DIR}/airspy${CMAKE_SHARED_LIBRARY_SUFFIX}" airspy)
install(FILES "${SDRANGEL_BINARY_BIN_DIR}/airspy${CMAKE_SHARED_LIBRARY_SUFFIX}" DESTINATION "${INSTALL_LIB_DIR}")
elseif(APPLE)
set(LIBAIRSPY_LIBRARIES "${binary_dir}/libairspy/src/libairspy${CMAKE_SHARED_LIBRARY_SUFFIX}" CACHE INTERNAL "")
makeLink("${source_dir}/libairspy/src" "${source_dir}/libairspy/src/libairspy" airspy)
install(DIRECTORY "${binary_dir}/libairspy/src/" DESTINATION "${INSTALL_LIB_DIR}"
FILES_MATCHING PATTERN "libairspy*${CMAKE_SHARED_LIBRARY_SUFFIX}")
set(MACOS_EXTERNAL_LIBS_FIXUP "${MACOS_EXTERNAL_LIBS_FIXUP};${binary_dir}/libairspy/src")
endif()
endif(ENABLE_AIRSPY)
if(ENABLE_AIRSPYHF)
if(WIN32)
set(AIRSPYHF_LIBUSB_INCLUDE_DIR ${LIBUSB_INCLUDE_DIR}/libusb-1.0)
else()
set(AIRSPYHF_LIBUSB_INCLUDE_DIR ${LIBUSB_INCLUDE_DIR})
endif()
# needs pkgconfig, libusb, pthreads
ExternalProject_Add(airspyhf
GIT_REPOSITORY https://github.com/airspy/airspyhf.git
GIT_TAG ${AIRSPYHF_TAG}
DEPENDS ${PTHREADS4W_DEPENDS}
PREFIX "${EXTERNAL_BUILD_LIBRARIES}/airspyhf"
CMAKE_ARGS ${DEFAULT_OUTPUT_DIRECTORIES}
-DLIBUSB_LIBRARIES=${LIBUSB_LIBRARIES}
-DLIBUSB_INCLUDE_DIR=${AIRSPYHF_LIBUSB_INCLUDE_DIR}
-DTHREADS_PTHREADS_INCLUDE_DIR=${PTHREADS4W_INCLUDE_DIR}
-DTHREADS_PTHREADS_WIN32_LIBRARY=${PTHREADS4W_LIBRARIES}
INSTALL_COMMAND ""
TEST_COMMAND ""
)
add_dependencies(airspyhf pthreads4w)
ExternalProject_Get_Property(airspyhf source_dir binary_dir)
set(LIBAIRSPYHF_FOUND ON CACHE INTERNAL "")
set(LIBAIRSPYHF_INCLUDE_DIR "${source_dir}/libairspyhf/src" CACHE INTERNAL "")
if(WIN32)
set(LIBAIRSPYHF_LIBRARIES "${SDRANGEL_BINARY_LIB_DIR}/airspyhf.lib" CACHE INTERNAL "")
makeCopyDir("${source_dir}/libairspyhf/src" "${source_dir}/libairspyhf/src/libairspyhf" airspyhf)
install(FILES "${SDRANGEL_BINARY_BIN_DIR}/airspyhf${CMAKE_SHARED_LIBRARY_SUFFIX}" DESTINATION "${INSTALL_LIB_DIR}")
elseif(APPLE)
set(LIBAIRSPYHF_LIBRARIES "${binary_dir}/libairspyhf/src/libairspyhf${CMAKE_SHARED_LIBRARY_SUFFIX}" CACHE INTERNAL "")
makeLink("${source_dir}/libairspyhf/src" "${source_dir}/libairspyhf/src/libairspyhf" airspyhf)
install(DIRECTORY "${binary_dir}/libairspyhf/src/" DESTINATION "${INSTALL_LIB_DIR}"
FILES_MATCHING PATTERN "libairspyhf*${CMAKE_SHARED_LIBRARY_SUFFIX}")
set(MACOS_EXTERNAL_LIBS_FIXUP "${MACOS_EXTERNAL_LIBS_FIXUP};${binary_dir}/libairspyhf/src")
endif()
endif(ENABLE_AIRSPYHF)
if(ENABLE_HACKRF)
# SOURCE_SUBDIR require cmake 3.7.0
# otherwise use CONFIGURE_COMMAND
cmake_minimum_required(VERSION 3.7.0)
# needs pkgconfig, libusb, fftw, pthreads
if(WIN32)
set(HACKRF_LIBUSB_INCLUDE_DIR ${LIBUSB_INCLUDE_DIR}/libusb-1.0)
else()
set(HACKRF_LIBUSB_INCLUDE_DIR ${LIBUSB_INCLUDE_DIR})
endif()
ExternalProject_Add(hackrf
GIT_REPOSITORY https://github.com/mossmann/hackrf.git
GIT_TAG ${HACKRF_TAG}
GIT_SUBMODULES ""
DEPENDS ${PTHREADS4W_DEPENDS}
PREFIX "${EXTERNAL_BUILD_LIBRARIES}/hackrf"
SOURCE_SUBDIR "host/libhackrf"
CMAKE_ARGS ${DEFAULT_OUTPUT_DIRECTORIES}
-DLIBUSB_LIBRARIES=${LIBUSB_LIBRARIES}
-DLIBUSB_INCLUDE_DIR=${HACKRF_LIBUSB_INCLUDE_DIR}
-DTHREADS_PTHREADS_INCLUDE_DIR=${PTHREADS4W_INCLUDE_DIR}
-DTHREADS_PTHREADS_WIN32_LIBRARY=${PTHREADS4W_LIBRARIES}
-DFFTW_INCLUDES=${FFTW3F_INCLUDE_DIRS}
-DFFTW_LIBRARIES=${FFTW3F_LIBRARIES}
INSTALL_COMMAND ""
TEST_COMMAND ""
)
add_dependencies(hackrf pthreads4w)
ExternalProject_Get_Property(hackrf source_dir binary_dir)
set(LIBHACKRF_FOUND ON CACHE INTERNAL "")
set(LIBHACKRF_INCLUDE_DIR "${source_dir}/host/libhackrf" CACHE INTERNAL "")
if(WIN32)
set(LIBHACKRF_LIBRARIES "${SDRANGEL_BINARY_LIB_DIR}/hackrf.lib" CACHE INTERNAL "")
# include "libhackrf/hackrf.h"
makeCopyDir("${source_dir}/host/libhackrf/src" "${source_dir}/host/libhackrf/libhackrf" hackrf)
install(FILES "${SDRANGEL_BINARY_BIN_DIR}/hackrf${CMAKE_SHARED_LIBRARY_SUFFIX}" DESTINATION "${INSTALL_LIB_DIR}")
elseif(APPLE)
set(LIBHACKRF_LIBRARIES "${binary_dir}/src/libhackrf${CMAKE_SHARED_LIBRARY_SUFFIX}" CACHE INTERNAL "")
# include "libhackrf/hackrf.h"
makeLink("${source_dir}/host/libhackrf/src" "${source_dir}/host/libhackrf/libhackrf" hackrf)
set(MACOS_EXTERNAL_LIBS_FIXUP "${MACOS_EXTERNAL_LIBS_FIXUP};${binary_dir}/")
install(DIRECTORY "${binary_dir}/src/" DESTINATION "${INSTALL_LIB_DIR}"
FILES_MATCHING PATTERN "libhackrf*${CMAKE_SHARED_LIBRARY_SUFFIX}")
endif()
endif(ENABLE_HACKRF)
if(ENABLE_IIO)
if(WIN32)
ExternalProject_Add(libxml2
GIT_REPOSITORY https://github.com/GNOME/libxml2.git
GIT_TAG ${LIBXML2_TAG}
PREFIX "${EXTERNAL_BUILD_LIBRARIES}/libxml2"
BUILD_IN_SOURCE 1
CONFIGURE_COMMAND cd <SOURCE_DIR>/win32 && cscript configure.js compiler=msvc iconv=no
BUILD_COMMAND cd <SOURCE_DIR>/win32 && nmake -f Makefile.msvc
INSTALL_COMMAND ""
TEST_COMMAND ""
)
elseif(APPLE)
set(LIBXML2_PATCH_COMMAND /usr/bin/sed -i '' "s/libtoolize/glibtoolize/g" autogen.sh)
ExternalProject_Add(libxml2
GIT_REPOSITORY https://github.com/GNOME/libxml2.git
GIT_TAG ${LIBXML2_TAG}
PREFIX "${EXTERNAL_BUILD_LIBRARIES}/libxml2"
BUILD_IN_SOURCE 1
PATCH_COMMAND ${LIBXML2_PATCH_COMMAND}
CONFIGURE_COMMAND ./autogen.sh
BUILD_COMMAND make
INSTALL_COMMAND ""
TEST_COMMAND ""
)
endif()
ExternalProject_Get_Property(libxml2 source_dir binary_dir)
set(LIBXML2_DEPENDS libxml2)
set(LIBXML2_FOUND ON CACHE INTERNAL "")
set(LIBXML2_INCLUDE_DIR "${source_dir}/include" CACHE INTERNAL "")
if(WIN32)
set(LIBXML2_LIBRARIES "${source_dir}/win32/bin.msvc/libxml2.lib" CACHE INTERNAL "")
makeCopy("${source_dir}/win32/bin.msvc/libxml2${CMAKE_SHARED_LIBRARY_SUFFIX}" "${SDRANGEL_BINARY_BIN_DIR}/libxml2${CMAKE_SHARED_LIBRARY_SUFFIX}" libxml2)
install(FILES "${source_dir}/win32/bin.msvc/libxml2${CMAKE_SHARED_LIBRARY_SUFFIX}" DESTINATION "${INSTALL_LIB_DIR}")
elseif(APPLE)
set(LIBXML2_LIBRARIES "${source_dir}/.libs/libxml2${CMAKE_SHARED_LIBRARY_SUFFIX}" CACHE INTERNAL "")
install(DIRECTORY "${source_dir}/.libs/" DESTINATION "${INSTALL_LIB_DIR}"
FILES_MATCHING PATTERN "libxml2*${CMAKE_SHARED_LIBRARY_SUFFIX}")
set(MACOS_EXTERNAL_LIBS_FIXUP "${MACOS_EXTERNAL_LIBS_FIXUP};${source_dir}/.libs")
endif()
# needs pkgconfig, libusb, pthreads, libxml2
ExternalProject_Add(libiio
GIT_REPOSITORY https://github.com/analogdevicesinc/libiio.git
GIT_TAG ${LIBIIO_TAG}
DEPENDS ${PTHREADS4W_DEPENDS} ${LIBXML2_DEPENDS}
PREFIX "${EXTERNAL_BUILD_LIBRARIES}/libiio"
CMAKE_ARGS ${DEFAULT_OUTPUT_DIRECTORIES}
-DLIBUSB_LIBRARIES=${LIBUSB_LIBRARIES}
-DLIBUSB_INCLUDE_DIR=${LIBUSB_INCLUDE_DIR}
-DTHREADS_PTHREADS_INCLUDE_DIR=${PTHREADS4W_INCLUDE_DIR}
-DTHREADS_PTHREADS_WIN32_LIBRARY=${PTHREADS4W_LIBRARIES}
-DLIBXML2_INCLUDE_DIR=${LIBXML2_INCLUDE_DIR}
-DLIBXML2_LIBRARIES=${LIBXML2_LIBRARIES}
-DCSHARP_BINDINGS=OFF
-DPYTHON_BINDINGS=OFF
-DWITH_MATLAB_BINDINGS_API=OFF
-DOSX_PACKAGE=OFF
INSTALL_COMMAND ""
TEST_COMMAND ""
)
add_dependencies(libiio pthreads4w)
ExternalProject_Get_Property(libiio source_dir binary_dir)
set(LIBIIO_FOUND ON CACHE INTERNAL "")
set(LIBIIO_INCLUDE_DIR "${source_dir}" CACHE INTERNAL "")
if(WIN32)
set(LIBIIO_LIBRARIES "${SDRANGEL_BINARY_LIB_DIR}/libiio.lib" CACHE INTERNAL "")
install(FILES "${SDRANGEL_BINARY_BIN_DIR}/libiio${CMAKE_SHARED_LIBRARY_SUFFIX}" DESTINATION "${INSTALL_LIB_DIR}")
elseif(APPLE)
set(LIBIIO_LIBRARIES "${binary_dir}/libiio${CMAKE_SHARED_LIBRARY_SUFFIX}" CACHE INTERNAL "")
install(DIRECTORY "${binary_dir}/" DESTINATION "${INSTALL_LIB_DIR}"
FILES_MATCHING PATTERN "libiio*${CMAKE_SHARED_LIBRARY_SUFFIX}")
string(REPLACE "v" "" IIO_VERSION ${IIO_TAG})
makeCopy("${binary_dir}/libiio.framework/Versions/${IIO_VERSION}/libiio" "${binary_dir}/libiio${CMAKE_SHARED_LIBRARY_SUFFIX}" libiio)
add_custom_command(TARGET libiio POST_BUILD COMMAND install_name_tool -id "${binary_dir}/libiio${CMAKE_SHARED_LIBRARY_SUFFIX}" "${binary_dir}/libiio${CMAKE_SHARED_LIBRARY_SUFFIX}")
set(MACOS_EXTERNAL_LIBS_FIXUP "${MACOS_EXTERNAL_LIBS_FIXUP};${binary_dir}")
endif()
endif(ENABLE_IIO)
if(ENABLE_BLADERF)
# needs pkgconfig, libusb, pthreads
ExternalProject_Add(bladerf
GIT_REPOSITORY https://github.com/Nuand/bladeRF.git
GIT_TAG ${BLADERF_TAG}
DEPENDS ${PTHREADS4W_DEPENDS}
PREFIX "${EXTERNAL_BUILD_LIBRARIES}/bladerf"
CMAKE_ARGS ${DEFAULT_OUTPUT_DIRECTORIES}
-DPKG_CONFIG_EXECUTABLE=${PKG_CONFIG_EXECUTABLE}
-DENABLE_BACKEND_USB=ON
-DENABLE_BACKEND_LIBUSB=ON
-DLIBUSB_HEADER_FILE=${LIBUSB_INCLUDE_DIR}/libusb-1.0/libusb.h
-Dusb_LIBRARY=${LIBUSB_LIBRARIES}
-DLIBUSB_PATH=${EXTERNAL_LIBRARY_FOLDER}/libusb
-DTHREADS_PTHREADS_INCLUDE_DIR=${PTHREADS4W_INCLUDE_DIR}
-DTHREADS_PTHREADS_WIN32_LIBRARY=${PTHREADS4W_LIBRARIES}
-DLIBPTHREADSWIN32_PATH=${PTHREADS4W_INCLUDE_DIR}
-DENABLE_FX3_BUILD=OFF
-DENABLE_HOST_BUILD=ON
-DENABLE_BACKEND_CYAPI=OFF
-DTREAT_WARNINGS_AS_ERRORS=OFF
INSTALL_COMMAND ""
TEST_COMMAND ""
)
add_dependencies(bladerf pthreads4w)
ExternalProject_Get_Property(bladerf source_dir binary_dir)
set(LIBBLADERF_FOUND ON CACHE INTERNAL "")
set(LIBBLADERF_INCLUDE_DIRS "${source_dir}/host/libraries/libbladeRF/include" CACHE INTERNAL "")
if(WIN32)
set(LIBBLADERF_LIBRARIES "${SDRANGEL_BINARY_LIB_DIR}/bladeRF.lib" CACHE INTERNAL "")
install(FILES "${SDRANGEL_BINARY_BIN_DIR}/bladeRF${CMAKE_SHARED_LIBRARY_SUFFIX}" DESTINATION "${INSTALL_LIB_DIR}")
elseif(APPLE)
set(LIBBLADERF_LIBRARIES "${binary_dir}/host/output/libbladeRF${CMAKE_SHARED_LIBRARY_SUFFIX}" CACHE INTERNAL "")
install(DIRECTORY "${binary_dir}/host/output/" DESTINATION "${INSTALL_LIB_DIR}"
FILES_MATCHING PATTERN "libbladeRF*${CMAKE_SHARED_LIBRARY_SUFFIX}")
set(MACOS_EXTERNAL_LIBS_FIXUP "${MACOS_EXTERNAL_LIBS_FIXUP};${binary_dir}/host/output")
endif()
endif(ENABLE_BLADERF)
endif(WIN32 OR APPLE)

2
external/windows vendored

@ -1 +1 @@
Subproject commit efa84ff291820aa476e9f67286e0162ecab9f806
Subproject commit d45cc7e9fa3745b729b4ce1759e76db746e2f121

View File

@ -46,6 +46,10 @@ add_library(${TARGET_NAME} SHARED
${airspy_SOURCES}
)
if(ENABLE_EXTERNAL_LIBRARIES AND NOT LINUX)
add_dependencies(${TARGET_NAME} airspy)
endif()
target_link_libraries(${TARGET_NAME}
Qt5::Core
${TARGET_LIB}