From bd9c7a5785138e066293dc11642df0aa7c7381ee Mon Sep 17 00:00:00 2001 From: Bill Somerville Date: Thu, 15 Apr 2021 02:56:00 +0100 Subject: [PATCH 1/3] Switch to recommended package finder naming conventions --- CMake/Modules/FindHamlib.cmake | 64 +++++++++++++++++++ .../{Findlibusb.cmake => FindUsb.cmake} | 30 ++++----- CMake/Modules/Findhamlib.cmake | 49 -------------- CMakeLists.txt | 12 ++-- map65/CMakeLists.txt | 4 +- 5 files changed, 87 insertions(+), 72 deletions(-) create mode 100644 CMake/Modules/FindHamlib.cmake rename CMake/Modules/{Findlibusb.cmake => FindUsb.cmake} (51%) delete mode 100644 CMake/Modules/Findhamlib.cmake diff --git a/CMake/Modules/FindHamlib.cmake b/CMake/Modules/FindHamlib.cmake new file mode 100644 index 000000000..6417723b9 --- /dev/null +++ b/CMake/Modules/FindHamlib.cmake @@ -0,0 +1,64 @@ +# +# Find the hamlib library +# +# This will define the following variables:: +# +# Hamlib_FOUND - True if the system has the usb library +# Hamlib_VERSION - The verion of the usb library which was found +# +# and the following imported targets:: +# +# Hamlib::Hamlib - The hamlib library +# + +include (LibFindMacros) + +libfind_pkg_detect (Hamlib hamlib + FIND_PATH hamlib/rig.h PATH_SUFFIXES hamlib + FIND_LIBRARY hamlib + ) + +libfind_package (Hamlib Usb) + +libfind_process (Hamlib) + +if (NOT Hamlib_PKGCONF_FOUND) + if (WIN32) + set (Hamlib_LIBRARIES ${Hamlib_LIBRARIES};ws2_32) + else () + set (Hamlib_LIBRARIES ${Hamlib_LIBRARIES};m;dl) + endif () +elseif (UNIX AND NOT APPLE) + set (Hamlib_LIBRARIES ${Hamlib_PKGCONF_STATIC_LDFLAGS}) +endif () + +# fix up extra link libraries for macOS as target_link_libraries gets +# it wrong for frameworks +unset (_next_is_framework) +unset (_Hamlib_EXTRA_LIBS) +foreach (_lib IN LISTS Hamlib_PKGCONF_LDFLAGS) + if (_next_is_framework) + list (APPEND _Hamlib_EXTRA_LIBS "-framework ${_lib}") + unset (_next_is_framework) + elseif (${_lib} STREQUAL "-framework") + set (_next_is_framework TRUE) + else () + list (APPEND _Hamlib_EXTRA_LIBS ${_lib}) + endif () +endforeach () + +if (Hamlib_FOUND AND NOT TARGET Hamlib::Hamlib) + add_library (Hamlib::Hamlib UNKNOWN IMPORTED) + set_target_properties (Hamlib::Hamlib PROPERTIES + IMPORTED_LOCATION "${Hamlib_LIBRARY}" + INTERFACE_COMPILE_OPTIONS "${Hamlib_PKGCONF_STATIC_OTHER}" + INTERFACE_INCLUDE_DIRECTORIES "${Hamlib_INCLUDE_DIR}" + INTERFACE_LINK_LIBRARIES "${_Hamlib_EXTRA_LIBS}" + ) +endif () + +mark_as_advanced ( + Hamlib_INCLUDE_DIR + Hamlib_LIBRARY + Hamlib_LIBRARIES + ) diff --git a/CMake/Modules/Findlibusb.cmake b/CMake/Modules/FindUsb.cmake similarity index 51% rename from CMake/Modules/Findlibusb.cmake rename to CMake/Modules/FindUsb.cmake index d3a55cdb7..9e76f2448 100644 --- a/CMake/Modules/Findlibusb.cmake +++ b/CMake/Modules/FindUsb.cmake @@ -5,12 +5,12 @@ # # This will define the following variables:: # -# libusb_FOUND - True if the system has the usb library -# libusb_VERSION - The verion of the usb library which was found +# Usb_FOUND - True if the system has the usb library +# Usb_VERSION - The verion of the usb library which was found # # and the following imported targets:: # -# libusb::libusb - The libusb library +# Usb::Usb - The libusb library # include (LibFindMacros) @@ -25,25 +25,25 @@ if (WIN32) set (_library_options PATH_SUFFIXES MinGW32/dll MinGW32/static) endif () endif () -libfind_pkg_detect (libusb libusb-1.0 +libfind_pkg_detect (Usb usb-1.0 FIND_PATH libusb.h PATH_SUFFIXES libusb-1.0 FIND_LIBRARY usb-1.0 ${_library_options} ) -libfind_process (libusb) +libfind_process (Usb) -if (libusb_FOUND AND NOT TARGET libusb::libusb) - add_library (libusb::libusb UNKNOWN IMPORTED) - set_target_properties (libusb::libusb PROPERTIES - IMPORTED_LOCATION "${libusb_LIBRARY}" - INTERFACE_COMPILE_OPTIONS "${libusb_PKGCONF_CFLAGS_OTHER}" - INTERFACE_INCLUDE_DIRECTORIES "${libusb_INCLUDE_DIRS}" - INTERFACE_LINK_LIBRARIES "${libusb_LIBRARIES}" +if (Usb_FOUND AND NOT TARGET Usb::Usb) + add_library (Usb::Usb UNKNOWN IMPORTED) + set_target_properties (Usb::Usb PROPERTIES + IMPORTED_LOCATION "${Usb_LIBRARY}" + INTERFACE_COMPILE_OPTIONS "${Usb_PKGCONF_CFLAGS_OTHER}" + INTERFACE_INCLUDE_DIRECTORIES "${Usb_INCLUDE_DIRS}" + INTERFACE_LINK_LIBRARIES "${Usb_LIBRARIES}" ) endif () mark_as_advanced ( - libusb_INCLUDE_DIR - libusb_LIBRARY - libusb_LIBRARIES + Usb_INCLUDE_DIR + Usb_LIBRARY + Usb_LIBRARIES ) diff --git a/CMake/Modules/Findhamlib.cmake b/CMake/Modules/Findhamlib.cmake deleted file mode 100644 index 0bac5c126..000000000 --- a/CMake/Modules/Findhamlib.cmake +++ /dev/null @@ -1,49 +0,0 @@ -# -# Find the hamlib library -# -# This will define the following variables:: -# -# hamlib_FOUND - True if the system has the usb library -# hamlib_VERSION - The verion of the usb library which was found -# -# and the following imported targets:: -# -# hamlib::hamlib - The hamlib library -# - -include (LibFindMacros) - -libfind_pkg_detect (hamlib hamlib - FIND_PATH hamlib/rig.h PATH_SUFFIXES hamlib - FIND_LIBRARY hamlib - ) - -libfind_package (hamlib libusb) - -libfind_process (hamlib) - -if (NOT hamlib_PKGCONF_FOUND) - if (WIN32) - set (hamlib_LIBRARIES ${hamlib_LIBRARIES};ws2_32) - else () - set (hamlib_LIBRARIES ${hamlib_LIBRARIES};m;dl) - endif () -elseif (UNIX AND NOT APPLE) - set (hamlib_LIBRARIES ${hamlib_PKGCONF_STATIC_LDFLAGS}) -endif () - -if (hamlib_FOUND AND NOT TARGET hamlib::hamlib) - add_library (hamlib::hamlib UNKNOWN IMPORTED) - set_target_properties (hamlib::hamlib PROPERTIES - IMPORTED_LOCATION "${hamlib_LIBRARY}" - INTERFACE_COMPILE_OPTIONS "${hamlib_PKGCONF_STATIC_CFLAGS_OTHER}" - INTERFACE_INCLUDE_DIRECTORIES "${hamlib_INCLUDE_DIR}" - INTERFACE_LINK_LIBRARIES "${hamlib_LIBRARIES}" - ) -endif () - -mark_as_advanced ( - hamlib_INCLUDE_DIR - hamlib_LIBRARY - hamlib_LIBRARIES - ) diff --git a/CMakeLists.txt b/CMakeLists.txt index 05f03a6bc..72e99fbe5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -870,9 +870,9 @@ find_package (OpenMP) find_package (FFTW3 COMPONENTS single threads REQUIRED) # -# libhamlib setup +# hamlib setup # -find_package (hamlib REQUIRED) +find_package (Hamlib REQUIRED) find_program (RIGCTL_EXE rigctl) find_program (RIGCTLD_EXE rigctld) find_program (RIGCTLCOM_EXE rigctlcom) @@ -1324,7 +1324,7 @@ target_link_libraries (qcp Qt5::Widgets Qt5::PrintSupport) add_library (wsjt_qt STATIC ${wsjt_qt_CXXSRCS} ${wsjt_qt_GENUISRCS} ${GENAXSRCS}) # set wsjtx_udp exports to static variants target_compile_definitions (wsjt_qt PUBLIC UDP_STATIC_DEFINE) -target_link_libraries (wsjt_qt hamlib::hamlib Boost::log qcp Qt5::Widgets Qt5::Network Qt5::Sql) +target_link_libraries (wsjt_qt Hamlib::Hamlib Boost::log qcp Qt5::Widgets Qt5::Network Qt5::Sql) if (WIN32) target_link_libraries (wsjt_qt Qt5::AxContainer Qt5::AxBase) endif (WIN32) @@ -1709,7 +1709,7 @@ if (NOT is_debug_build) # if a system Qt is used (e.g. installed in /usr/lib/), it will not be included in the installation set (fixup_exe "\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_BINDIR}/${CMAKE_PROJECT_NAME}${CMAKE_EXECUTABLE_SUFFIX}") - #get_filename_component (hamlib_lib_dir ${hamlib_LIBRARIES} PATH) + #get_filename_component (hamlib_lib_dir ${Hamlib_LIBRARIES} PATH) if (APPLE) # install required Qt plugins @@ -1823,9 +1823,9 @@ if (NOT is_debug_build) endif (WIN32) #list (APPEND fixup_library_dirs ${hamlib_lib_dir}) - list (APPEND fixup_library_dirs ${hamlib_LIBRARY_DIRS}) + list (APPEND fixup_library_dirs ${Hamlib_LIBRARY_DIRS}) - install (CODE " + INSTALL (CODE " get_filename_component (the_path \"\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/${WSJT_PLUGIN_DESTINATION}\" REALPATH) file (GLOB_RECURSE QTPLUGINS \"\${the_path}/*${CMAKE_SHARED_LIBRARY_SUFFIX}\") set (CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/CMake/Modules ${CMAKE_MODULE_PATH}) diff --git a/map65/CMakeLists.txt b/map65/CMakeLists.txt index 4c8107eee..8114532b8 100644 --- a/map65/CMakeLists.txt +++ b/map65/CMakeLists.txt @@ -1,6 +1,6 @@ find_package (Portaudio REQUIRED) -find_package (libusb REQUIRED) +find_package (Usb REQUIRED) set (map65_CXXSRCS about.cpp @@ -52,7 +52,7 @@ add_subdirectory (libm65) qt5_wrap_ui (map65_GENUISRCS ${map65_UISRCS}) add_executable (map65 ${map65_CXXSRCS} ${map65_CSRCS} ${map65_GENUISRCS} map65.rc) -target_link_libraries (map65 m65impl ${FFTW3_LIBRARIES} Qt5::Widgets Qt5::Network Portaudio::Portaudio libusb::libusb) +target_link_libraries (map65 m65impl ${FFTW3_LIBRARIES} Qt5::Widgets Qt5::Network Portaudio::Portaudio Usb::Usb) install ( TARGETS map65 From 84f193c5a915c6d163da9a0b3ec27a1f28cce0df Mon Sep 17 00:00:00 2001 From: Bill Somerville Date: Thu, 15 Apr 2021 02:57:02 +0100 Subject: [PATCH 2/3] Repair argument type mismatch --- map65/libm65/ccf65.f90 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/map65/libm65/ccf65.f90 b/map65/libm65/ccf65.f90 index 1bebb8d73..f82d0fd06 100644 --- a/map65/libm65/ccf65.f90 +++ b/map65/libm65/ccf65.f90 @@ -44,8 +44,8 @@ subroutine ccf65(ss,nhsym,ssmax,sync1,ipol1,jpz,dt1,flipk, & ! Not sure why, but it works significantly better without the following line: ! pr(j-1)=pr(j) enddo - call four2a(pr,NFFT,1,-1,0) - call four2a(pr2,NFFT,1,-1,0) + call four2a(cpr,NFFT,1,-1,0) + call four2a(cpr2,NFFT,1,-1,0) first=.false. endif From 25baa705de5103f16cdc3ec25231490f859be445 Mon Sep 17 00:00:00 2001 From: Bill Somerville Date: Thu, 15 Apr 2021 03:04:52 +0100 Subject: [PATCH 3/3] Repair another argument type issue --- map65/libm65/ccf65.f90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/map65/libm65/ccf65.f90 b/map65/libm65/ccf65.f90 index f82d0fd06..07e829920 100644 --- a/map65/libm65/ccf65.f90 +++ b/map65/libm65/ccf65.f90 @@ -62,7 +62,7 @@ subroutine ccf65(ss,nhsym,ssmax,sync1,ipol1,jpz,dt1,flipk, & call pctile(s,nhsym-1,50,base) s(1:nhsym-1)=s(1:nhsym-1)-base s(nhsym:NFFT)=0. - call four2a(s,NFFT,1,-1,0) !Real-to-complex FFT + call four2a(cs,NFFT,1,-1,0) !Real-to-complex FFT do i=0,NH cs2(i)=cs(i)*conjg(cpr2(i)) !Mult by complex FFT of pr2 cs(i)=cs(i)*conjg(cpr(i)) !Mult by complex FFT of pr