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

some tests on cpack; use cmake own FindIconv

This commit is contained in:
Davide Gerhard 2019-05-04 13:46:03 +02:00
parent 06b9baadee
commit f276051725
No known key found for this signature in database
GPG Key ID: 7CBEFA144857DC97
3 changed files with 23 additions and 95 deletions

View File

@ -23,7 +23,7 @@ set(COMPANY "f4exb")
add_definitions("-DCOMPANY=\"${COMPANY}\"") add_definitions("-DCOMPANY=\"${COMPANY}\"")
set(APPLICATION_NAME "SDRangel") set(APPLICATION_NAME "SDRangel")
add_definitions("-DAPPLICATION_NAME=\"${APPLICATION_NAME}\"") add_definitions("-DAPPLICATION_NAME=\"${APPLICATION_NAME}\"")
set(APPLICATION_MAINTAINER="Edouard Griffiths") set(APPLICATION_MAINTAINER="Edouard Griffiths, F4EXB <f4exb06@gmail.com>")
set(COPYRIGHT "Copyright (c) 2019 Edouard Griffiths. All rights reserved.") set(COPYRIGHT "Copyright (c) 2019 Edouard Griffiths. All rights reserved.")
add_definitions("-DCOPYRIGHT=\"${COPYRIGHT}\"") add_definitions("-DCOPYRIGHT=\"${COPYRIGHT}\"")
set(IDENTIFIER "com.${COMPANY}.${APPLICATION_NAME}") set(IDENTIFIER "com.${COMPANY}.${APPLICATION_NAME}")
@ -48,27 +48,24 @@ add_definitions("-DSDRANGEL_LIB_VERSION=\"${sdrangel_VERSION_MAJOR}.${sdrangel_V
add_definitions("-DSDRANGEL_VERSION=\"${sdrangel_VERSION}\"") add_definitions("-DSDRANGEL_VERSION=\"${sdrangel_VERSION}\"")
# configure CPACK infomation # configure CPACK infomation
set(CPACK_PACKAGE_NAME "${APPLICATION_NAME}") set(CPACK_PACKAGE_NAME "${CMAKE_PACKAGE_NAME}")
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "SDR Rx/Tx software for Airspy, Airspy HF+, BladeRF, HackRF, LimeSDR, PlutoSDR, RTL-SDR, SDRplay RSP1 and FunCube") set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "SDR Rx/Tx software for Airspy, Airspy HF+, BladeRF, HackRF, LimeSDR, PlutoSDR, RTL-SDR, SDRplay RSP1 and FunCube")
set(CPACK_PACKAGE_VENDOR "${COMPANY}") set(CPACK_PACKAGE_VENDOR "${COMPANY}")
set(CPACK_PACKAGE_CONTACT "https://github.com/f4exb/sdrangel") set(CPACK_PACKAGE_CONTACT "https://github.com/f4exb/sdrangel")
set(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_SOURCE_DIR}/Readme.md") set(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_SOURCE_DIR}/Readme.md")
set(CPACK_PACKAGE_FILE_NAME "${CMAKE_PROJECT_NAME}-${VERSION}")
set(CPACK_PACKAGE_VERSION "${sdrangel_VERSION}") set(CPACK_PACKAGE_VERSION "${sdrangel_VERSION}")
set(CPACK_PACKAGE_VERSION_MAJOR ${sdrangel_VERSION_MAJOR}) set(CPACK_PACKAGE_VERSION_MAJOR ${sdrangel_VERSION_MAJOR})
set(CPACK_PACKAGE_VERSION_MINOR ${sdrangel_VERSION_MINOR}) set(CPACK_PACKAGE_VERSION_MINOR ${sdrangel_VERSION_MINOR})
set(CPACK_PACKAGE_VERSION_PATCH ${sdrangel_VERSION_PATCH}) set(CPACK_PACKAGE_VERSION_PATCH ${sdrangel_VERSION_PATCH})
set(CPACK_SOURCE_STRIP_FILES true) set(CPACK_SOURCE_STRIP_FILES true)
set(CPACK_STRIP_FILES true) set(CPACK_STRIP_FILES true)
set(CPACK_PACKAGE_FILE_NAME "${CMAKE_PROJECT_NAME}-${sdrangel_VERSION}-${CMAKE_SYSTEM_PROCESSOR}")
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}/LICENSE") set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}/LICENSE")
set(CPACK_RESOURCE_FILE_README "${CMAKE_SOURCE_DIR}/Readme.md") set(CPACK_RESOURCE_FILE_README "${CMAKE_SOURCE_DIR}/Readme.md")
set(CPACK_SOURCE_IGNORE_FILES "${PROJECT_BINARY_DIR};/.git/;.gitignore;menu.yml;.travis.yml;.appveyor.yml;default.nix;.envrc;TODOs.org;/.scripts/") set(CPACK_SOURCE_IGNORE_FILES "${PROJECT_BINARY_DIR};/.git/;.gitignore;menu.yml;.travis.yml;.appveyor.yml;default.nix;.envrc;TODOs.org;/.scripts/")
set(CPACK_SOURCE_GENERATOR "ZIP;TGZ") set(CPACK_SOURCE_GENERATOR "ZIP;TGZ")
set(CPACK_GENERATOR "ZIP;TGZ") set(CPACK_GENERATOR "ZIP;TGZ")
# quite unfair with *BSD/... if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
if(UNIX AND NOT APPLE)
set(LINUX TRUE) set(LINUX TRUE)
endif() endif()
@ -130,7 +127,9 @@ set(EXTERNAL_BUILD_LIBRARIES "${CMAKE_BINARY_DIR}/external_build")
set(EXTERNAL_INSTALL_LIBRARIES "${CMAKE_BINARY_DIR}/external") set(EXTERNAL_INSTALL_LIBRARIES "${CMAKE_BINARY_DIR}/external")
if(APPLE) if(APPLE)
set(CMAKE_OSX_DEPLOYMENT_TARGET, "10.9") # check
set(CMAKE_OSX_DEPLOYMENT_TARGET "10.9")
message(STATUS "Build for macOS version: ${CMAKE_OSX_DEPLOYMENT_TARGET}")
set(CMAKE_MACOSX_RPATH ON) set(CMAKE_MACOSX_RPATH ON)
endif() endif()
@ -216,7 +215,7 @@ find_package(OpenCV) # channeltx/modatv
# macOS compatibility # macOS compatibility
if(APPLE) if(APPLE)
find_package(ICONV) find_package(Iconv)
endif() endif()
# include external cmake if needed # include external cmake if needed
@ -365,21 +364,16 @@ if (BUILD_SERVER)
endif() endif()
############ install/package targets ################ ############ install/package targets ################
if(APPLE AND BUNDLE AND BUILD_GUI) # https://cmake.org/cmake/help/v3.0/module/InstallRequiredSystemLibraries.html
#include(InstallRequiredSystemLibraries)
# https://cmake.org/cmake/help/v3.0/module/InstallRequiredSystemLibraries.html if(APPLE AND BUNDLE AND BUILD_GUI)
#CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS
install(TARGETS sdrangelbench) install(TARGETS sdrangelbench)
if (BUILD_SERVER) if (BUILD_SERVER)
install(TARGETS sdrangelsrv) install(TARGETS sdrangelsrv)
endif() endif()
#include(DeployQt)
#macdeployqt(sdrangel)
include(InstallRequiredSystemLibraries)
configure_file("${CMAKE_SOURCE_DIR}/custom/desktop/MacOSXBundleInfo.plist.in" configure_file("${CMAKE_SOURCE_DIR}/custom/desktop/MacOSXBundleInfo.plist.in"
"${CMAKE_BINARY_DIR}/Info.plist" @ONLY) "${CMAKE_BINARY_DIR}/Info.plist" @ONLY)
@ -390,9 +384,16 @@ if(APPLE AND BUNDLE AND BUILD_GUI)
set(CPACK_BUNDLE_ICON "${CMAKE_SOURCE_DIR}/custom/desktop/sdrangel_icon.icns") set(CPACK_BUNDLE_ICON "${CMAKE_SOURCE_DIR}/custom/desktop/sdrangel_icon.icns")
set(CPACK_BUNDLE_PLIST "${CMAKE_BINARY_DIR}/Info.plist") set(CPACK_BUNDLE_PLIST "${CMAKE_BINARY_DIR}/Info.plist")
set(CPACK_BUNDLE_STARTUP_COMMAND "${CMAKE_BINARY_DIR}/${CMAKE_PROJECT_NAME}") set(CPACK_BUNDLE_STARTUP_COMMAND "${CMAKE_BINARY_DIR}/${CMAKE_PROJECT_NAME}")
# CPACK_INSTALL_CMAKE_PROJECTS
#set(CPACK_INSTALL_CMAKE_PROJECTS "${CMAKE_BINARY_DIR};${CMAKE_PROJECT_NAME};lib;/") #set(CPACK_INSTALL_CMAKE_PROJECTS "${CMAKE_BINARY_DIR};${CMAKE_PROJECT_NAME};lib;/")
set(CPACK_PACKAGE_ICON "${CMAKE_SOURCE_DIR}/custom/desktop/sdrangel_icon.icns") # set(CPACK_APP_BUNDLE_DIR "${CPACK_PACKAGE_DIRECTORY}/_CPack_Packages/Darwin/Bundle/${CPACK_PACKAGE_FILE_NAME}/${APPLICATION_NAME}.app")
# install( CODE "
# INCLUDE(BundleUtilities)
# fixup_bundle( ${CPACK_APP_BUNDLE_DIR} \"\" \"\" )"
# COMPONENT Runtime )
elseif(LINUX AND BUNDLE) elseif(LINUX AND BUNDLE)
@ -400,7 +401,7 @@ elseif(LINUX AND BUNDLE)
list(APPEND CPACK_GENERATOR "DEB") list(APPEND CPACK_GENERATOR "DEB")
set(CPACK_DEBIAN_PACKAGE_MAINTAINER "${APPLICATION_MAINTAINER}") set(CPACK_DEBIAN_PACKAGE_MAINTAINER "${APPLICATION_MAINTAINER}")
set(CPACK_DEBIAN_PACKAGE_SECTION "hamradio") set(CPACK_DEBIAN_PACKAGE_SECTION "hamradio")
set(CPACK_DEBIAN_PACKAGE_DEPENDS "libc6 (>= 2.3.1-6), libgcc1 (>= 1:3.4.2-12)") 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, libopencv, pulseaudio, libxml2, ffmpeg, libavcodec, libavformat, libopus, libcodec2")
list(APPEND CPACK_GENERATOR "RPM") list(APPEND CPACK_GENERATOR "RPM")
set(CPACK_RPM_PACKAGE_RELEASE "1") set(CPACK_RPM_PACKAGE_RELEASE "1")
@ -409,7 +410,7 @@ elseif(LINUX AND BUNDLE)
elseif((WIN32 OR MINGW) AND BUNDLE) elseif((WIN32 OR MINGW) AND BUNDLE)
set(CMAKE_INSTALL_UCRT_LIBRARIES TRUE) #set(CMAKE_INSTALL_UCRT_LIBRARIES TRUE)
list(APPEND CPACK_GENERATOR "NSIS") list(APPEND CPACK_GENERATOR "NSIS")
set(CPACK_NSIS_PACKAGE_NAME "${APPLICATION_NAME}") set(CPACK_NSIS_PACKAGE_NAME "${APPLICATION_NAME}")

View File

@ -1,73 +0,0 @@
set(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS true)
include(CheckFunctionExists)
if (ICONV_INCLUDE_DIR)
# Already in cache, be silent
set(ICONV_FIND_QUIETLY TRUE)
endif()
find_path(ICONV_INCLUDE_DIR iconv.h
/usr/include
/usr/local/include
/opt/local/include)
set(POTENTIAL_ICONV_LIBS iconv libiconv libiconv2)
find_library(ICONV_LIBRARY NAMES ${POTENTIAL_ICONV_LIBS}
PATHS /usr/lib /usr/local/lib /opt/local/lib)
if(WIN32)
set(ICONV_DLL_NAMES iconv.dll libiconv.dll libiconv2.dll)
find_file(ICONV_DLL
NAMES ${ICONV_DLL_NAMES}
PATHS ENV PATH
NO_DEFAULT_PATH)
find_file(ICONV_DLL_HELP
NAMES ${ICONV_DLL_NAMES}
PATHS ENV PATH
${ICONV_INCLUDE_DIR}/../bin)
if(ICONV_FIND_REQUIRED)
if(NOT ICONV_DLL AND NOT ICONV_DLL_HELP)
message(FATAL_ERROR "Could not find iconv.dll, please add correct your PATH environment variable")
endif()
if(NOT ICONV_DLL AND ICONV_DLL_HELP)
get_filename_component(ICONV_DLL_HELP ${ICONV_DLL_HELP} PATH)
message(STATUS)
message(STATUS "Could not find iconv.dll in standard search path, please add ")
message(STATUS "${ICONV_DLL_HELP}")
message(STATUS "to your PATH environment variable.")
message(STATUS)
message(FATAL_ERROR "exit cmake")
endif()
endif()
if(ICONV_INCLUDE_DIR AND ICONV_LIBRARY AND ICONV_DLL)
set(ICONV_FOUND TRUE)
endif()
else()
check_function_exists(iconv HAVE_ICONV_IN_LIBC)
if(ICONV_INCLUDE_DIR AND HAVE_ICONV_IN_LIBC)
set(ICONV_FOUND TRUE)
set(ICONV_LIBRARY CACHE TYPE STRING FORCE)
endif()
if(ICONV_INCLUDE_DIR AND ICONV_LIBRARY)
set(ICONV_FOUND TRUE)
endif()
endif()
if(ICONV_FOUND)
if(NOT ICONV_FIND_QUIETLY)
message(STATUS "Found iconv library: ${ICONV_LIBRARY}")
#message(STATUS "Found iconv dll : ${ICONV_DLL}")
endif()
else()
if(ICONV_FIND_REQUIRED)
message(STATUS "Looked for iconv library named ${POTENTIAL_ICONV_LIBS}.")
message(STATUS "Found no acceptable iconv library. This is fatal.")
message(STATUS "iconv header: ${ICONV_INCLUDE_DIR}")
message(STATUS "iconv lib : ${ICONV_LIBRARY}")
message(FATAL_ERROR "Could NOT find iconv library")
endif()
endif()
mark_as_advanced(ICONV_LIBRARY ICONV_INCLUDE_DIR)

View File

@ -16,7 +16,7 @@ set(fcdhid_HEADERS
include_directories( include_directories(
${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_BINARY_DIR}
${LIBUSB_INCLUDE_DIR} ${LIBUSB_INCLUDE_DIR}
${ICONV_INCLUDE_DIR} ${Iconv_INCLUDE_DIR}
) )
add_library(fcdhid SHARED add_library(fcdhid SHARED
@ -25,7 +25,7 @@ add_library(fcdhid SHARED
target_link_libraries(fcdhid target_link_libraries(fcdhid
${LIBUSB_LIBRARIES} ${LIBUSB_LIBRARIES}
${ICONV_LIBRARY} ${Iconv_LIBRARY}
) )
install(TARGETS fcdhid DESTINATION ${INSTALL_LIB_DIR}) install(TARGETS fcdhid DESTINATION ${INSTALL_LIB_DIR})