Changeset View
Changeset View
Standalone View
Standalone View
find-modules/FindPythonModuleGeneration.cmake
Show First 20 Lines • Show All 174 Lines • ▼ Show 20 Line(s) | |||||
175 | endif() | 175 | endif() | ||
176 | 176 | | |||
177 | if (NOT GPB_PYTHON2_COMMAND) | 177 | if (NOT GPB_PYTHON2_COMMAND) | ||
178 | _report_NOT_FOUND("The python2 executable is required by clang-python for the ${CMAKE_FIND_PACKAGE_NAME} Module.") | 178 | _report_NOT_FOUND("The python2 executable is required by clang-python for the ${CMAKE_FIND_PACKAGE_NAME} Module.") | ||
179 | endif() | 179 | endif() | ||
180 | 180 | | |||
181 | if (NOT libclang_LIBRARY) | 181 | if (NOT libclang_LIBRARY) | ||
182 | set(_LIBCLANG_MAX_MAJOR_VERSION 7) | 182 | set(_LIBCLANG_MAX_MAJOR_VERSION 7) | ||
183 | set(_LIBCLANG_MIN_MAJOR_VERSION 4) | 183 | set(_LIBCLANG_MIN_MAJOR_VERSION 5) | ||
184 | 184 | | |||
185 | find_library(libclang_LIBRARY clang-${_LIBCLANG_MAX_MAJOR_VERSION}.0) | 185 | find_library(libclang_LIBRARY clang-${_LIBCLANG_MAX_MAJOR_VERSION}.0) | ||
186 | 186 | | |||
187 | if (libclang_LIBRARY) | 187 | if (libclang_LIBRARY) | ||
188 | message(FATAL_ERROR "The max libclang version in ${CMAKE_FIND_PACKAGE_NAME} must be updated.") | 188 | message(FATAL_ERROR "The max libclang version in ${CMAKE_FIND_PACKAGE_NAME} must be updated.") | ||
189 | endif() | 189 | endif() | ||
190 | 190 | | |||
191 | set(_LIBCLANG_FIND_VERSION ${_LIBCLANG_MAX_MAJOR_VERSION}) | 191 | set(_LIBCLANG_FIND_VERSION ${_LIBCLANG_MAX_MAJOR_VERSION}) | ||
192 | while(NOT libclang_LIBRARY AND NOT _LIBCLANG_FIND_VERSION EQUAL _LIBCLANG_MIN_MAJOR_VERSION) | 192 | while(NOT libclang_LIBRARY AND NOT _LIBCLANG_FIND_VERSION EQUAL _LIBCLANG_MIN_MAJOR_VERSION) | ||
193 | math(EXPR _LIBCLANG_FIND_VERSION "${_LIBCLANG_FIND_VERSION} - 1") | 193 | math(EXPR _LIBCLANG_FIND_VERSION "${_LIBCLANG_FIND_VERSION} - 1") | ||
194 | set(_GPB_CLANG_SUFFIX ${_LIBCLANG_FIND_VERSION}.0) | 194 | set(_GPB_CLANG_SUFFIX ${_LIBCLANG_FIND_VERSION}.0) | ||
195 | find_library(libclang_LIBRARY clang-${_LIBCLANG_FIND_VERSION}.0) | 195 | find_library(libclang_LIBRARY clang-${_LIBCLANG_FIND_VERSION}.0) | ||
196 | endwhile() | 196 | endwhile() | ||
197 | 197 | | |||
198 | if (NOT libclang_LIBRARY) | 198 | if (NOT libclang_LIBRARY) | ||
199 | find_library(libclang_LIBRARY clang-3.9) | | |||
200 | if (NOT libclang_LIBRARY) | | |||
201 | find_library(libclang_LIBRARY clang-3.8) | | |||
202 | endif() | | |||
203 | endif() | | |||
204 | if (NOT libclang_LIBRARY) | | |||
205 | find_library(libclang_LIBRARY clang) | 199 | find_library(libclang_LIBRARY clang) | ||
206 | endif() | 200 | endif() | ||
207 | else() | 201 | else() | ||
208 | string(REGEX MATCH ".*clang-([0-9]+\\.[0-9]+).*" _GPB_CLANG_SUFFIX ${libclang_LIBRARY}) | 202 | string(REGEX MATCH ".*clang-([0-9]+\\.[0-9]+).*" _GPB_CLANG_SUFFIX ${libclang_LIBRARY}) | ||
209 | set(_GPB_CLANG_SUFFIX ${CMAKE_MATCH_1}) | 203 | set(_GPB_CLANG_SUFFIX ${CMAKE_MATCH_1}) | ||
210 | endif() | 204 | endif() | ||
211 | 205 | | |||
212 | if (NOT libclang_LIBRARY) | 206 | if (NOT libclang_LIBRARY) | ||
213 | _report_NOT_FOUND("Could not find libclang version 3.8 or greater.") | 207 | _report_NOT_FOUND("Could not find libclang version 5.0 or greater.") | ||
214 | else() | 208 | else() | ||
215 | message(STATUS "Found ${libclang_LIBRARY}") | 209 | message(STATUS "Found ${libclang_LIBRARY}") | ||
216 | endif() | 210 | endif() | ||
217 | 211 | | |||
218 | execute_process( | 212 | execute_process( | ||
219 | COMMAND ${GPB_PYTHON2_COMMAND} ${CMAKE_CURRENT_LIST_DIR}/sip_generator.py --self-check ${libclang_LIBRARY} | 213 | COMMAND ${GPB_PYTHON2_COMMAND} ${CMAKE_CURRENT_LIST_DIR}/sip_generator.py --self-check ${libclang_LIBRARY} | ||
220 | RESULT_VARIABLE selfCheckErrors | 214 | RESULT_VARIABLE selfCheckErrors | ||
221 | ) | 215 | ) | ||
▲ Show 20 Lines • Show All 247 Lines • Show Last 20 Lines |