Skip to content

Commit 3c64ffc

Browse files
author
Arvo Järve
committed
2 parents 4dd3959 + 1c47500 commit 3c64ffc

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+41763
-38410
lines changed

CMake/Modules/FindHamlib.cmake

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
#
2+
# Find the hamlib library
3+
#
4+
# This will define the following variables::
5+
#
6+
# Hamlib_FOUND - True if the system has the usb library
7+
# Hamlib_VERSION - The verion of the usb library which was found
8+
#
9+
# and the following imported targets::
10+
#
11+
# Hamlib::Hamlib - The hamlib library
12+
#
13+
14+
include (LibFindMacros)
15+
16+
libfind_pkg_detect (Hamlib hamlib
17+
FIND_PATH hamlib/rig.h PATH_SUFFIXES hamlib
18+
FIND_LIBRARY hamlib
19+
)
20+
21+
libfind_package (Hamlib Usb)
22+
23+
libfind_process (Hamlib)
24+
25+
if (NOT Hamlib_PKGCONF_FOUND)
26+
if (WIN32)
27+
set (Hamlib_LIBRARIES ${Hamlib_LIBRARIES};${Usb_LIBRARY};ws2_32)
28+
else ()
29+
set (Hamlib_LIBRARIES ${Hamlib_LIBRARIES};m;dl)
30+
endif ()
31+
elseif (UNIX AND NOT APPLE)
32+
set (Hamlib_LIBRARIES ${Hamlib_PKGCONF_STATIC_LDFLAGS})
33+
endif ()
34+
35+
# fix up extra link libraries for macOS as target_link_libraries gets
36+
# it wrong for frameworks
37+
unset (_next_is_framework)
38+
unset (_Hamlib_EXTRA_LIBS)
39+
foreach (_lib IN LISTS Hamlib_LIBRARIES Hamlib_PKGCONF_LDFLAGS)
40+
if (_next_is_framework)
41+
list (APPEND _Hamlib_EXTRA_LIBS "-framework ${_lib}")
42+
unset (_next_is_framework)
43+
elseif (${_lib} STREQUAL "-framework")
44+
set (_next_is_framework TRUE)
45+
else ()
46+
list (APPEND _Hamlib_EXTRA_LIBS ${_lib})
47+
endif ()
48+
endforeach ()
49+
50+
if (Hamlib_FOUND AND NOT TARGET Hamlib::Hamlib)
51+
add_library (Hamlib::Hamlib UNKNOWN IMPORTED)
52+
set_target_properties (Hamlib::Hamlib PROPERTIES
53+
IMPORTED_LOCATION "${Hamlib_LIBRARY}"
54+
INTERFACE_COMPILE_OPTIONS "${Hamlib_PKGCONF_STATIC_OTHER}"
55+
INTERFACE_INCLUDE_DIRECTORIES "${Hamlib_INCLUDE_DIR}"
56+
INTERFACE_LINK_LIBRARIES "${_Hamlib_EXTRA_LIBS}"
57+
)
58+
endif ()
59+
60+
mark_as_advanced (
61+
Hamlib_INCLUDE_DIR
62+
Hamlib_LIBRARY
63+
Hamlib_LIBRARIES
64+
)

CMake/Modules/FindUsb.cmake

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# Findlibusb
2+
# ==========
3+
#
4+
# Find the usb library
5+
#
6+
# This will define the following variables::
7+
#
8+
# Usb_FOUND - True if the system has the usb library
9+
# Usb_VERSION - The verion of the usb library which was found
10+
#
11+
# and the following imported targets::
12+
#
13+
# Usb::Usb - The libusb library
14+
#
15+
16+
include (LibFindMacros)
17+
18+
if (WIN32)
19+
# Use path suffixes on MS Windows as we probably shouldn't
20+
# trust the PATH envvar. PATH will still be searched to find the
21+
# library as last resort.
22+
if (CMAKE_SIZEOF_VOID_P MATCHES "8")
23+
set (_library_options PATH_SUFFIXES MinGW64/dll MinGW64/static)
24+
else ()
25+
set (_library_options PATH_SUFFIXES MinGW32/dll MinGW32/static)
26+
endif ()
27+
endif ()
28+
libfind_pkg_detect (Usb usb-1.0
29+
FIND_PATH libusb.h PATH_SUFFIXES libusb-1.0
30+
FIND_LIBRARY usb-1.0 ${_library_options}
31+
)
32+
33+
libfind_process (Usb)
34+
35+
if (Usb_FOUND AND NOT TARGET Usb::Usb)
36+
add_library (Usb::Usb UNKNOWN IMPORTED)
37+
set_target_properties (Usb::Usb PROPERTIES
38+
IMPORTED_LOCATION "${Usb_LIBRARY}"
39+
INTERFACE_COMPILE_OPTIONS "${Usb_PKGCONF_CFLAGS_OTHER}"
40+
INTERFACE_INCLUDE_DIRECTORIES "${Usb_INCLUDE_DIRS}"
41+
INTERFACE_LINK_LIBRARIES "${Usb_LIBRARIES}"
42+
)
43+
endif ()
44+
45+
mark_as_advanced (
46+
Usb_INCLUDE_DIR
47+
Usb_LIBRARY
48+
Usb_LIBRARIES
49+
)

CMake/Modules/Findhamlib.cmake

Lines changed: 0 additions & 100 deletions
This file was deleted.

CMake/Modules/GetPrerequisites.cmake

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -340,13 +340,30 @@ function(gp_resolve_item context item exepath dirs resolved_item_var)
340340
else()
341341
set(rpaths "")
342342
endif()
343+
## message (STATUS "'${context}' '${item}' '${exepath}' '${dirs}' '${resolved_item_var}' '${rpaths}'")
343344

344345
# Is it already resolved?
345346
#
346347
if(IS_ABSOLUTE "${resolved_item}" AND EXISTS "${resolved_item}")
347348
set(resolved 1)
348349
endif()
349350

351+
if(NOT resolved AND APPLE)
352+
if(item MATCHES "^@rpath")
353+
#
354+
# @rpath references are relative to the paths built into the binaries with -rpath
355+
# We handle this case like we do for other Unixes
356+
#
357+
string(REPLACE "@rpath/" "/opt/local/lib/gcc-devel/" norpath_item "${item}")
358+
set(resolved_item "${norpath_item}")
359+
if(IS_ABSOLUTE "${norpath_item}" AND EXISTS "${resolved_item}")
360+
set(resolved 1)
361+
else()
362+
set(resolved_item "${item}")
363+
endif()
364+
endif()
365+
endif()
366+
350367
if(NOT resolved)
351368
if(item MATCHES "^@executable_path")
352369
#

0 commit comments

Comments
 (0)