diff options
author | Ray Molenkamp <github@lazydodo.com> | 2021-02-24 17:13:37 +0300 |
---|---|---|
committer | Ray Molenkamp <github@lazydodo.com> | 2021-02-24 17:13:37 +0300 |
commit | 4fb0c83c1c8529b61d38d8a409caf58d05a53bd9 (patch) | |
tree | 18ce99c74a8305a63f93b4ef57a5648818d3352c /build_files/cmake/Modules/FindClang.cmake | |
parent | 5be72125bf4dfddf5dfe720caa12b3163f540faf (diff) |
Cmake/deps: Update OSL to 1.11.10.0
This bumps OSL to 1.11.10.0. OSL Has a new build time
dependency: Clang, and more importantly it expects
clang and llvm to share a library folder, which it
previously for us did not.
This patch changes:
-OSL Update to 1.11.10.0
-refactor the llvm/clang/clang-tools-extra builds into the llvm
build using the llvm-project tarball for building that has all
of the subprojects in it.
-update ispc/openmp builds since clang no longer its own dependency
and they have to depend on the llvm build now.
-Update the windows builder to use the 64 bit host tools since it
ran out of ram linking clang
-Since OSL now needs clang to link successfully a findclang.cmake
has been provided for linux/OSX
Differential Revision: https://developer.blender.org/D10212
Reviewed By: brecht, sebbas, sybren
Diffstat (limited to 'build_files/cmake/Modules/FindClang.cmake')
-rw-r--r-- | build_files/cmake/Modules/FindClang.cmake | 111 |
1 files changed, 111 insertions, 0 deletions
diff --git a/build_files/cmake/Modules/FindClang.cmake b/build_files/cmake/Modules/FindClang.cmake new file mode 100644 index 00000000000..b5c2cfbc28d --- /dev/null +++ b/build_files/cmake/Modules/FindClang.cmake @@ -0,0 +1,111 @@ +# - Find Clang library +# Find the native Clang includes and library +# This module defines +# CLANG_INCLUDE_DIRS, where to find AST/AST.h, Set when +# CLANG_INCLUDE_DIR is found. +# CLANG_LIBRARIES, libraries to link against to use Clang. +# CLANG_ROOT_DIR, The base directory to search for Clang. +# This can also be an environment variable. +# CLANG_FOUND, If false, do not try to use Clang. + +#============================================================================= +# Copyright 2021 Blender Foundation. +# +# Distributed under the OSI-approved BSD 3-Clause License, +# see accompanying file BSD-3-Clause-license.txt for details. +#============================================================================= + +# If CLANG_ROOT_DIR was defined in the environment, use it. +if(NOT CLANG_ROOT_DIR AND NOT $ENV{CLANG_ROOT_DIR} STREQUAL "") + set(CLANG_ROOT_DIR $ENV{CLANG_ROOT_DIR}) +endif() + +set(_CLANG_SEARCH_DIRS + ${CLANG_ROOT_DIR} + /opt/lib/clang +) + +find_path(CLANG_INCLUDE_DIR + NAMES + AST/AST.h + HINTS + ${_CLANG_SEARCH_DIRS} + PATH_SUFFIXES + include + include/clang +) + + +set(_CLANG_FIND_COMPONENTS + clangDependencyScanning + clangDynamicASTMatchers + clangFrontendTool + clangStaticAnalyzerFrontend + clangHandleCXX + clangStaticAnalyzerCheckers + clangStaticAnalyzerCore + clangToolingASTDiff + clangToolingRefactoring + clangToolingSyntax + clangARCMigrate + clangCodeGen + clangCrossTU + clangIndex + clangTooling + clangFormat + clangToolingInclusions + clangRewriteFrontend + clangFrontend + clangSerialization + clangDriver + clangToolingCore + clangParse + clangRewrite + clangSema + clangEdit + clangAnalysis + clangASTMatchers + clangAST + clangLex + clangBasic +) + +set(_CLANG_LIBRARIES) +foreach(COMPONENT ${_CLANG_FIND_COMPONENTS}) + string(TOUPPER ${COMPONENT} UPPERCOMPONENT) + + find_library(CLANG_${UPPERCOMPONENT}_LIBRARY + NAMES + ${COMPONENT} + HINTS + ${_CLANG_SEARCH_DIRS} + PATH_SUFFIXES + lib64 lib + ) + list(APPEND _CLANG_LIBRARIES "${CLANG_${UPPERCOMPONENT}_LIBRARY}") +endforeach() + + +# Handle the QUIETLY and REQUIRED arguments and set CLANG_FOUND to TRUE if +# all listed variables are TRUE. +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(Clang DEFAULT_MSG + _CLANG_LIBRARIES CLANG_INCLUDE_DIR) + +if(CLANG_FOUND) + set(CLANG_LIBRARIES ${_CLANG_LIBRARIES}) + set(CLANG_INCLUDE_DIRS ${CLANG_INCLUDE_DIR}) +endif() + +mark_as_advanced( + CLANG_INCLUDE_DIR +) + +foreach(COMPONENT ${_CLANG_FIND_COMPONENTS}) + string(TOUPPER ${COMPONENT} UPPERCOMPONENT) + mark_as_advanced(CLANG_${UPPERCOMPONENT}_LIBRARY) +endforeach() + +unset(_CLANG_SEARCH_DIRS) +unset(_CLANG_FIND_COMPONENTS) +unset(_CLANG_LIBRARIES) |