File: GetDependencies.cmake.in

package info (click to toggle)
freedv 1.4.3~1gdc71a1c-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, sid
  • size: 19,356 kB
  • sloc: cpp: 9,333; ansic: 3,581; sh: 148; python: 42; makefile: 10
file content (88 lines) | stat: -rw-r--r-- 2,974 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
# As this script is run in a new cmake instance, it does not have access to
# the existing cache variables. Pass them in via the configure_file command.
set(CMAKE_BINARY_DIR @CMAKE_BINARY_DIR@)
set(CMAKE_SOURCE_DIR @CMAKE_SOURCE_DIR@)
set(USE_INTERNAL_CODEC2 @USE_INTERNAL_CODEC2@)
set(UNIX @UNIX@)
set(WIN32 @WIN32@)
set(CMAKE_CROSSCOMPILING @CMAKE_CROSSCOMPILING@)
set(CMAKE_FIND_LIBRARY_SUFFIXES @CMAKE_FIND_LIBRARY_SUFFIXES@)
set(CMAKE_FIND_LIBRARY_PREFIXES @CMAKE_FIND_LIBRARY_PREFIXES@)
set(CMAKE_SYSTEM_LIBRARY_PATH @CMAKE_SYSTEM_LIBRARY_PATH@)
set(CMAKE_FIND_ROOT_PATH @CMAKE_FIND_ROOT_PATH@)
if(USE_INTERNAL_CODEC2)
    set(CODEC2_BUILD_DIR ${CMAKE_BINARY_DIR}/codec2_build)
    set(LPCNET_BUILD_DIR ${CMAKE_BINARY_DIR}/LPCNet_build)
else()
    set(CODEC2_BUILD_DIR @CODEC2_BUILD_DIR@)
    set(LPCNET_BUILD_DIR @LPCNET_BUILD_DIR@)
endif()


set(FREEDV_EXE ${CMAKE_BINARY_DIR}/src/freedv.exe)

include(GetPrerequisites)
get_prerequisites("${FREEDV_EXE}" _deps 1 0 "" "")

# Filter libraries known to be provided by Windows
set( _windlls
    ADVAPI32.dll
    GDI32.dll
    KERNEL32.dll
    SHELL32.dll
    USER32.dll
    WS2_32.dll
    WSOCK32.dll
    WSOCK32.DLL
    WINMM.dll
    WINMM.DLL
    ole32.dll
    COMCTL32.dll
    COMCTL32.DLL
    OLEAUT32.dll
    RPCRT4.dll
    comdlg32.dll
    COMDLG32.DLL
)
list(REMOVE_ITEM _deps ${_windlls})

# Handle internal libraries separately.
if(CODEC2_BUILD_DIR)
    list(FIND _deps libcodec2.dll _loc)
    list(REMOVE_AT _deps ${_loc})
    find_library(CODEC2 codec2 NO_DEFAULT_PATH PATHS ${CODEC2_BUILD_DIR}/src)
    file(INSTALL DESTINATION "${CMAKE_INSTALL_PREFIX}/bin"
        TYPE EXECUTABLE FILES ${CODEC2})
endif()
if(LPCNET_BUILD_DIR)
    list(FIND _deps liblpcnetfreedv.dll _loc)
    list(REMOVE_AT _deps ${_loc})
    find_library(LPCNET lpcnetfreedv NO_DEFAULT_PATH PATHS ${LPCNET_BUILD_DIR}/src)
    file(INSTALL DESTINATION "${CMAKE_INSTALL_PREFIX}/bin"
        TYPE EXECUTABLE FILES ${LPCNET})
endif()

# Process remaining dependencies.
list(LENGTH _deps _dep_len)
message("There are ${_dep_len} dependencies to scan.")
while(_deps)
    foreach(_runtime ${_deps})
        message("Looking for ${_runtime}")
        find_library(RUNTIME_${_runtime} ${_runtime})
        if(RUNTIME_${_runtime})
            message("Found: ${RUNTIME_${_runtime}}")
            file(INSTALL DESTINATION "${CMAKE_INSTALL_PREFIX}/bin"
                TYPE EXECUTABLE FILES "${RUNTIME_${_runtime}}")
            get_prerequisites("${RUNTIME_${_runtime}}" _newdep 1 0 "" "")
            list(APPEND _newdeps ${_newdep})
            list(APPEND _good_deps ${_runtime})
        else()
            message("Warning: ${_runtime} not found.")
            list(APPEND _bad_deps ${_runtime})
        endif()
    endforeach()
    # Try to figure out if there are new dependencies or not.
    list(REMOVE_DUPLICATES _newdeps)
    list(REMOVE_ITEM _newdeps ${_deps};${_good_deps};${_bad_deps};${_windlls})
    set(_deps ${_newdeps})
endwhile()