aboutsummaryrefslogtreecommitdiffstats
path: root/src/libs/clangsupport/CMakeLists.txt
blob: 20af2c1b9d2597c2885ef5b162aedb8de18016c5 (plain)
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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
set(CLANG_VERSION ${LLVM_VERSION_MAJOR}.${LLVM_VERSION_MINOR}.${LLVM_VERSION_PATCH})

add_qtc_library(ClangSupport
  DEPENDS Threads::Threads
  PUBLIC_DEPENDS Utils Sqlite Qt5::Core Qt5::Network
  PUBLIC_DEFINES
    CLANG_VERSION="${CLANG_VERSION}"
    CLANG_RESOURCE_DIR="${IDE_LIBEXEC_PATH}/clang/lib/clang/${CLANG_VERSION}/include"
    CLANG_BINDIR="${IDE_LIBEXEC_PATH}/clang/bin"
  DEFINES CLANGSUPPORT_BUILD_LIB
  PUBLIC_INCLUDES
    "${CMAKE_CURRENT_LIST_DIR}"
  SOURCES
    alivemessage.cpp alivemessage.h
    annotationsmessage.cpp annotationsmessage.h
    baseserverproxy.cpp baseserverproxy.h
    cancelmessage.cpp cancelmessage.h
    clangcodemodelclientinterface.cpp clangcodemodelclientinterface.h
    clangcodemodelclientmessages.h
    clangcodemodelclientproxy.cpp clangcodemodelclientproxy.h
    clangcodemodelconnectionclient.cpp clangcodemodelconnectionclient.h
    clangcodemodelserverinterface.cpp clangcodemodelserverinterface.h
    clangcodemodelservermessages.h
    clangcodemodelserverproxy.cpp clangcodemodelserverproxy.h
    clangpathwatcher.h
    clangpathwatcherinterface.h
    clangpathwatchernotifier.h
    clangrefactoringclientmessages.h
    clangrefactoringmessages.h
    clangrefactoringservermessages.h
    clangsupport_global.h
    clangsupportdebugutils.cpp clangsupportdebugutils.h
    clangsupportexceptions.h
    codecompletion.cpp codecompletion.h
    codecompletionchunk.cpp codecompletionchunk.h
    commandlinebuilder.h
    compilermacro.h
    completionsmessage.cpp completionsmessage.h
    connectionclient.cpp connectionclient.h
    connectionserver.cpp connectionserver.h
    diagnosticcontainer.cpp diagnosticcontainer.h
    directoryandfilepathid.h
    directorypathid.h
    documentschangedmessage.cpp documentschangedmessage.h
    documentsclosedmessage.cpp documentsclosedmessage.h
    documentsopenedmessage.cpp documentsopenedmessage.h
    documentvisibilitychangedmessage.cpp documentvisibilitychangedmessage.h
    dynamicastmatcherdiagnosticcontainer.cpp dynamicastmatcherdiagnosticcontainer.h
    dynamicastmatcherdiagnosticcontextcontainer.cpp dynamicastmatcherdiagnosticcontextcontainer.h
    dynamicastmatcherdiagnosticmessagecontainer.cpp dynamicastmatcherdiagnosticmessagecontainer.h
    dynamicmatcherdiagnostics.h
    echomessage.cpp echomessage.h
    endmessage.cpp endmessage.h
    environment.h
    executeinloop.h
    filecontainer.cpp filecontainer.h
    filecontainerv2.cpp filecontainerv2.h
    filepath.cpp filepath.h
    filepathcache.h
    filepathcaching.cpp filepathcaching.h
    filepathcachingfwd.h
    filepathcachinginterface.h
    filepathexceptions.h
    filepathid.cpp filepathid.h
    filepathstorage.h
    filepathstoragesources.h
    filepathstoragesqlitestatementfactory.h
    filepathview.h
    filestatus.h
    filestatuscache.cpp filestatuscache.h
    filesystem.cpp filesystem.h
    filesysteminterface.h
    fixitcontainer.cpp fixitcontainer.h
    followsymbolmessage.cpp followsymbolmessage.h
    generatedfiles.cpp generatedfiles.h
    generatedfilesinterface.h
    idpaths.h
    includesearchpath.h
    ipcclientinterface.h
    ipcclientprovider.h
    ipcinterface.h
    ipcserverinterface.h
    lineprefixer.cpp lineprefixer.h
    messageenvelop.cpp messageenvelop.h
    modifiedtimechecker.h
    modifiedtimecheckerinterface.h
    nativefilepath.h
    pchmanagerclientinterface.cpp pchmanagerclientinterface.h
    pchmanagerclientproxy.cpp pchmanagerclientproxy.h
    pchmanagerserverinterface.cpp pchmanagerserverinterface.h
    pchmanagerserverproxy.cpp pchmanagerserverproxy.h
    pchpaths.h
    precompiledheadersupdatedmessage.cpp precompiledheadersupdatedmessage.h
    processcreator.cpp processcreator.h
    processexception.cpp processexception.h
    processhandle.h
    processstartedevent.cpp processstartedevent.h
    progresscounter.h
    progressmessage.h
    projectmanagementserverinterface.h
    projectpartartefact.cpp projectpartartefact.h
    projectpartcontainer.cpp projectpartcontainer.h
    projectpartid.h
    projectpartpch.cpp projectpartpch.h
    projectpartsstorage.h
    projectpartsstorageinterface.h
    readmessageblock.cpp readmessageblock.h
    refactoringclientinterface.cpp refactoringclientinterface.h
    refactoringclientproxy.cpp refactoringclientproxy.h
    refactoringdatabaseinitializer.h
    refactoringserverinterface.cpp refactoringserverinterface.h
    refactoringserverproxy.cpp refactoringserverproxy.h
    referencesmessage.cpp referencesmessage.h
    removegeneratedfilesmessage.cpp removegeneratedfilesmessage.h
    removeprojectpartsmessage.h
    requestannotationsmessage.cpp requestannotationsmessage.h
    requestcompletionsmessage.cpp requestcompletionsmessage.h
    requestfollowsymbolmessage.cpp requestfollowsymbolmessage.h
    requestreferencesmessage.cpp requestreferencesmessage.h
    requestsourcerangesanddiagnosticsforquerymessage.cpp requestsourcerangesanddiagnosticsforquerymessage.h
    requestsourcerangesforquerymessage.cpp requestsourcerangesforquerymessage.h
    requesttooltipmessage.cpp requesttooltipmessage.h
    sourceentry.h
    sourcelocationcontainer.cpp sourcelocationcontainer.h
    sourcelocationcontainerv2.cpp sourcelocationcontainerv2.h
    sourcelocationscontainer.cpp sourcelocationscontainer.h
    sourcerangecontainer.cpp sourcerangecontainer.h
    sourcerangecontainerv2.cpp sourcerangecontainerv2.h
    sourcerangesanddiagnosticsforquerymessage.cpp sourcerangesanddiagnosticsforquerymessage.h
    sourcerangescontainer.cpp sourcerangescontainer.h
    sourcerangesforquerymessage.cpp sourcerangesforquerymessage.h
    sourcerangewithtextcontainer.cpp sourcerangewithtextcontainer.h
    stringcache.h
    stringcachealgorithms.h
    stringcachefwd.h
    tokeninfocontainer.cpp tokeninfocontainer.h
    tooltipinfo.cpp tooltipinfo.h
    tooltipmessage.cpp tooltipmessage.h
    unsavedfilesremovedmessage.cpp unsavedfilesremovedmessage.h
    unsavedfilesupdatedmessage.cpp unsavedfilesupdatedmessage.h
    updategeneratedfilesmessage.cpp updategeneratedfilesmessage.h
    updateprojectpartsmessage.cpp updateprojectpartsmessage.h
    writemessageblock.cpp writemessageblock.h
)

if (NOT TARGET libclang)
  return()
endif()

add_custom_target(copy_clang_to_builddir ALL
  COMMENT Copy Clang files into build directory
)

# For the developer build directory
add_custom_command(TARGET copy_clang_to_builddir POST_BUILD
  COMMAND "${CMAKE_COMMAND}"
    -E copy_directory
      "${LLVM_LIBRARY_DIR}/clang/${CLANG_VERSION}/include"
      "${PROJECT_BINARY_DIR}/${IDE_LIBEXEC_PATH}/clang/lib/clang/${CLANG_VERSION}/include"
  VERBATIM
)

foreach(executable clang clang-cl clangd clang-tidy clazy-standalone)
  if (EXISTS "${LLVM_TOOLS_BINARY_DIR}/${executable}${CMAKE_EXECUTABLE_SUFFIX}")
    add_custom_command(TARGET copy_clang_to_builddir PRE_BUILD
      COMMAND "${CMAKE_COMMAND}"
        -E make_directory
          "${PROJECT_BINARY_DIR}/${IDE_LIBEXEC_PATH}/clang/bin/"
      COMMAND "${CMAKE_COMMAND}"
        -E copy
          "${LLVM_TOOLS_BINARY_DIR}/${executable}${CMAKE_EXECUTABLE_SUFFIX}"
          "${PROJECT_BINARY_DIR}/${IDE_LIBEXEC_PATH}/clang/bin/"
      VERBATIM
    )

    # For the install directory
    install(PROGRAMS
      "${LLVM_TOOLS_BINARY_DIR}/${executable}${CMAKE_EXECUTABLE_SUFFIX}"
      DESTINATION "${IDE_LIBEXEC_PATH}/clang/bin"
      COMPONENT Dependencies
      EXCLUDE_FROM_ALL
    )
    if (IS_SYMLINK "${LLVM_TOOLS_BINARY_DIR}/${executable}${CMAKE_EXECUTABLE_SUFFIX}")
      file(READ_SYMLINK
        "${LLVM_TOOLS_BINARY_DIR}/${executable}${CMAKE_EXECUTABLE_SUFFIX}" real_executable)
      install(PROGRAMS
        "${LLVM_TOOLS_BINARY_DIR}/${real_executable}${CMAKE_EXECUTABLE_SUFFIX}"
        DESTINATION "${IDE_LIBEXEC_PATH}/clang/bin"
        COMPONENT Dependencies
        EXCLUDE_FROM_ALL
      )
    endif()
  endif()
endforeach()

install(DIRECTORY ${LLVM_LIBRARY_DIR}/clang/${CLANG_VERSION}/include
  DESTINATION "${IDE_LIBEXEC_PATH}/clang/lib/clang/${CLANG_VERSION}"
  COMPONENT Dependencies
  EXCLUDE_FROM_ALL
)