File: InstallDll.cmake

package info (click to toggle)
bornagain 23.0-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 103,936 kB
  • sloc: cpp: 423,131; python: 40,997; javascript: 11,167; awk: 630; sh: 318; ruby: 173; xml: 130; makefile: 51; ansic: 24
file content (109 lines) | stat: -rw-r--r-- 4,564 bytes parent folder | download | duplicates (2)
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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
##  ************************************************************************************************
##
##  BornAgain: simulate and fit reflection and scattering
##
##! @file      cmake/BornAgain/InstallDll.cmake
##! @brief     Create install targets for library dependencies under Windows.
##!
##! @homepage  http://www.bornagainproject.org
##! @license   GNU General Public License v3 or higher (see COPYING)
##! @copyright Forschungszentrum Jülich GmbH 2024
##! @authors   Scientific Computing Group at MLZ (see CITATION, AUTHORS)
##
##  ************************************************************************************************

# list of Windows extra dependencies (needed for a self-contained package)
set(BA_Dependencies_WIN32 "")

## GSL library
message(STATUS "Installation of GSL library:")
foreach(lib ${GSL_LIBRARIES})
    get_filename_component(UTF_BASE_NAME ${lib} NAME_WE)
    get_filename_component(UTF_PATH ${lib} PATH)
    list(APPEND BA_Dependencies_WIN32 "${UTF_PATH}/${UTF_BASE_NAME}.dll")
    install(FILES ${UTF_PATH}/${UTF_BASE_NAME}.dll
        DESTINATION ${destination_lib} COMPONENT WinLibraries
        CONFIGURATIONS [Release|MinSizeRel|RelWithDebInfo])
    message("    ${UTF_PATH}/${UTF_BASE_NAME}.dll - will be installed in ${destination_lib}")
endforeach()

## CERF library
message(STATUS "Installation of Cerf library:")
install(FILES ${Cerf_LIBRARIES} DESTINATION ${destination_lib} COMPONENT WinLibraries)
message(STATUS "Cerf dll: ${Cerf_LIBRARIES} - will be installed in ${destination_lib}")
list(APPEND BA_Dependencies_WIN32 "${Cerf_LIBRARIES}")

## FFTW3
message(STATUS "Installation of FFTW3:")
foreach(lib ${FFTW3_LIBRARIES})
    get_filename_component(UTF_BASE_NAME ${lib} NAME_WE)
    get_filename_component(UTF_PATH ${lib} PATH)
    list(APPEND BA_Dependencies_WIN32 "${UTF_PATH}/${UTF_BASE_NAME}.dll")
    install(FILES ${UTF_PATH}/${UTF_BASE_NAME}.dll
        DESTINATION ${destination_lib} COMPONENT WinLibraries
        CONFIGURATIONS [Release|MinSizeRel|RelWithDebInfo])
    message("    ${UTF_PATH}/${UTF_BASE_NAME}.dll - will be installed in ${destination_lib}")
endforeach()

## compression libraries
message(STATUS "Installation of compression libraries:")
foreach(lib ${ZLIB_LIBRARIES} ${BZIP2_LIBRARIES})
    get_filename_component(UTF_BASE_NAME ${lib} NAME_WE)
    get_filename_component(UTF_PATH ${lib} PATH)
    list(APPEND BA_Dependencies_WIN32 "${UTF_PATH}/${UTF_BASE_NAME}.dll")
    install(FILES ${UTF_PATH}/${UTF_BASE_NAME}.dll
        DESTINATION ${destination_lib} COMPONENT WinLibraries
        CONFIGURATIONS [Release|MinSizeRel|RelWithDebInfo])
    message("    ${UTF_PATH}/${UTF_BASE_NAME}.dll - will be installed in ${destination_lib}")
endforeach()

## TIFF
if(BA_TIFF_SUPPORT)
    ## Same as for Boost above: list may contain mix of debug/optimized libs
    message(STATUS "Installation of TIFF:")
    set(entryShallBeSkipped false)
    foreach(LIB ${TIFF_LIBRARIES})
        if(entryShallBeSkipped)
            set(entryShallBeSkipped false)
            continue()
        endif()

        if(${LIB} STREQUAL "debug")
            set(entryShallBeSkipped true)
            continue()
        endif()

        if(${LIB} STREQUAL "optimized")
            set(entryShallBeSkipped false)
            continue()
        endif()

        get_filename_component(UTF_NAME ${LIB} NAME)
        if(${UTF_NAME} STREQUAL "tiff.lib")
            message("    No installation for ${UTF_NAME}: This is the static TIFF library")
            continue()
        endif()
        string(REPLACE ".lib" ".dll" DLL "${LIB}")
        if(NOT EXISTS ${DLL})
            message(FATAL_ERROR
                "Dynamic link library ${DLL} (derived from ${LIB}) does not exist")
        endif()
        list(APPEND BA_Dependencies_WIN32 "${DLL}")
        install(FILES ${DLL} COMPONENT WinLibraries
            DESTINATION ${destination_lib}
            CONFIGURATIONS [Release|MinSizeRel|RelWithDebInfo])
        message("    ${DLL} - will be installed in ${destination_lib}")
    endforeach()
endif()

## formfactor library
message(STATUS "Installation of formfactor library:")
set(formfactor_DLL ${formfactor_LIBRARIES})

if(NOT EXISTS ${formfactor_DLL})
    message(FATAL_ERROR
        "Dynamic link library ${formfactor_DLL} (need for formfactor) does not exist")
endif()
list(APPEND BA_Dependencies_WIN32 "${formfactor_DLL}")
install(FILES ${formfactor_DLL} DESTINATION ${destination_lib} COMPONENT WinLibraries)
message(STATUS "formfactor dll: ${formfactor_DLL} - will be installed in ${destination_lib}")