1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-12-23 01:55:48 -05:00

Build: fixed Windows build

This commit is contained in:
f4exb 2019-06-25 19:08:02 +02:00
parent a9db3c2381
commit 2876a17844
3 changed files with 37 additions and 10 deletions

View File

@ -187,8 +187,15 @@ elseif(APPLE)
"${CMAKE_BINARY_DIR}/Info.plist" @ONLY)
elseif (WIN32)
# check compiler version
if(MSVC_VERSION GREATER 1919 AND MSVC_VERSION LESS 1910)
message(FATAL_ERROR "You must use Microsoft Visual Studio 2017 as compiler, aka MSVC 14.1")
# check compiler version
if(MSVC_VERSION GREATER 1910 AND MSVC_VERSION LESS 1919)
set(VS2017 ON)
elseif(MSVC_VERSION GREATER 1899 AND MSVC_VERSION LESS 1910)
set(VS2015 ON)
endif()
if(NOT VS2015 AND NOT VS2017)
message(FATAL_ERROR "You must use Microsoft Visual Studio 2015 or 2017 as compiler")
endif()
# used on code but not defined on VS2017
@ -199,6 +206,9 @@ elseif (WIN32)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP")
# find Qt folder
if(DEFINED QT_PATH)
set (QT_MISSING False)
endif()
include(QtLocator)
# in alternative we can use ExternalProject
@ -214,7 +224,7 @@ elseif (WIN32)
# ffmpeg
set(FFMPEG_INCLUDE_DIRS "${EXTERNAL_LIBRARY_FOLDER}/ffmpeg/include" CACHE INTERNAL "")
#set(FFMPEG_LIBRARIES)
set(FFMPEG_LIBRARIES "${EXTERNAL_LIBRARY_FOLDER}/ffmpeg/bin" CACHE INTERNAL "")
set(AVCODEC_INCLUDE_DIRS "${EXTERNAL_LIBRARY_FOLDER}/ffmpeg/include" CACHE INTERNAL "")
set(AVCODEC_LIBRARIES "${EXTERNAL_LIBRARY_FOLDER}/ffmpeg/lib/avcodec.lib" CACHE INTERNAL "")
set(AVFORMAT_INCLUDE_DIRS "${EXTERNAL_LIBRARY_FOLDER}/ffmpeg/include" CACHE INTERNAL "")
@ -228,7 +238,7 @@ elseif (WIN32)
# used on fixup_bundle phase
set(WINDOWS_FIXUP_BUNDLE_LIB_DIRS
"${Qt5_DIR}/../../../bin"
"${Qt5_DIR}../../../bin"
"${EXTERNAL_LIBRARY_FOLDER}/fftw-3"
"${EXTERNAL_LIBRARY_FOLDER}/libusb/MS64/dll"
"${EXTERNAL_LIBRARY_FOLDER}/ffmpeg/bin"

View File

@ -54,7 +54,6 @@ if(APPLE AND BUNDLE AND BUILD_GUI)
PATTERN "*quick*${CMAKE_SHARED_LIBRARY_SUFFIX}" EXCLUDE
PATTERN "*_debug${CMAKE_SHARED_LIBRARY_SUFFIX}" EXCLUDE
)
# add plugins path for Mac Bundle
install (CODE "
get_filename_component (the_qt_conf \"\${CMAKE_INSTALL_PREFIX}/qt.conf\" REALPATH)
@ -141,7 +140,7 @@ elseif(LINUX AND BUNDLE)
set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS ON)
set(CPACK_DEBIAN_PACKAGE_MAINTAINER "${APPLICATION_MAINTAINER}")
set(CPACK_DEBIAN_PACKAGE_SECTION "hamradio")
set(CPACK_DEBIAN_PACKAGE_DEPENDS "libc6, libasound2, libfftw3-single3, libgcc1, libgl1-mesa-glx, libqt5core5a, libqt5gui5, libqt5multimedia5, libqt5network5, libqt5opengl5, libqt5widgets5, libqt5multimedia5-plugins, libstdc++6, libusb-1.0-0, pulseaudio, libxml2, ffmpeg, libopus0, codec2, libairspy0, libhackrf0, librtlsdr0, libbladerf1, libmirisdr0, libiio0")
set(CPACK_DEBIAN_PACKAGE_DEPENDS "libc6, libasound2, libfftw3-single3, libgcc1, libgl1-mesa-glx, libqt5core5a, libqt5gui5, libqt5websockets5, libqt5multimedia5, libqt5network5, libqt5opengl5, libqt5widgets5, libqt5multimedia5-plugins, libstdc++6, libusb-1.0-0, pulseaudio, libxml2, ffmpeg, libopus0, codec2, libairspy0, libhackrf0, librtlsdr0, libbladerf1, libmirisdr0, libiio0")
if ("${LSB_CODENAME}" STREQUAL "buster") # Debian 10
set(CPACK_DEBIAN_PACKAGE_DEPENDS "${CPACK_DEBIAN_PACKAGE_DEPENDS}, libavcodec58, libavformat58, libairspyhf1, libopencv-imgproc3.2, libopencv-highgui3.2, limesuite, soapysdr-tools")
@ -253,6 +252,8 @@ elseif(WIN32 OR MINGW)
# 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
# inputkiwisdr.dll
install(FILES "${Qt5_DIR}/../../../bin/Qt5WebSockets${CMAKE_SHARED_LIBRARY_SUFFIX}" DESTINATION "${INSTALL_LIB_DIR}")
# demoddatv.dll
install(DIRECTORY "${FFMPEG_LIBRARIES}/" DESTINATION "${INSTALL_LIB_DIR}"
FILES_MATCHING PATTERN "*${CMAKE_SHARED_LIBRARY_SUFFIX}")

View File

@ -102,12 +102,28 @@ else()
endif(LINUX)
if(WIN32)
if(VS2015)
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
set(VCREDIST_FILE "vcredist_msvc2015_x64${CMAKE_EXECUTABLE_SUFFIX}" CACHE INTERNAL "")
# maybe add arm architecture
else()
set(VCREDIST_FILE "vcredist_msvc2015_x86${CMAKE_EXECUTABLE_SUFFIX}" CACHE INTERNAL "")
endif()
elseif(VS2017)
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
set(VCREDIST_FILE "vcredist_msvc2017_x64${CMAKE_EXECUTABLE_SUFFIX}" CACHE INTERNAL "")
# maybe add arm architecture
else()
set(VCREDIST_FILE "vcredist_msvc2017_x86${CMAKE_EXECUTABLE_SUFFIX}" CACHE INTERNAL "")
endif()
else()
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()
endif()
install(FILES "${EXTERNAL_LIBRARY_FOLDER}/vcredist/${VCREDIST_FILE}" DESTINATION "${INSTALL_BIN_DIR}")
endif(WIN32)