Skip to content
Snippets Groups Projects
Commit 01c027ec authored by Tobias Hunger's avatar Tobias Hunger
Browse files

Initial commit

parents
No related branches found
No related tags found
No related merge requests found
Pipeline #7657 failed
tmp/
*/test_package/build/
versions:
8.0.0:
folder: v8.x.x
branches:
8.0.0: "release_80-based"
from conans import ConanFile, CMake, tools
class LlvmConan(ConanFile):
name = "llvm"
license = "LLVM Release License"
author = "Tobias Hunger <tobias.hunger@qt.io>"
url = "https://llvm.org/"
description = "LLVM compiler suite"
topics = ("compiler", "clang", "toolchain")
settings = "os", "compiler", "build_type", "arch"
options = {
# No "shared": Not supported by LLVM!
"clang": [True, False],
"clang_tools_extra": [True, False],
"compiler_rt": [True, False],
"debug_info_tests": [True, False],
"libclc": [True, False],
"libcxx": [True, False],
"libcxxabi": [True, False],
"libunwind": [True, False],
"lld": [True, False],
"lldb": [True, False],
"llgo": [True, False],
"openmp": [True, False],
"parallel_libs": [True, False],
"polly": [True, False],
"pstl": [True, False],
}
default_options = {
"clang": True,
"clang_tools_extra": True,
"compiler_rt": False,
"debug_info_tests": False,
"libclc": False,
"libcxx": False,
"libcxxabi": False,
"libunwind": False,
"lld": False,
"lldb": False,
"llgo": False,
"openmp": False,
"parallel_libs": False,
"polly": False,
"pstl": False,
}
generators = "cmake_paths"
def requirements(self):
if self.options.lldb:
# self.requires("SWIG") ## Lldb depends on SWIG
pass
# self.requires("Z3") ## The Z3 analyzer depends on the Z3 library
def source(self):
git = tools.Git(folder="checkout")
git.clone("https://code.qt.io/clang/llvm-project.git")
branch = self.conan_data["branches"][self.version]
git.checkout(branch, submodule="recursive")
def build(self):
cmake = CMake(self)
projects = []
if self.options.clang:
projects.append("clang")
if self.options.clang_tools_extra:
projects.append("clang-tools-extra")
if self.options.compiler_rt:
projects.append("compiler-rt")
if self.options.debug_info_tests:
projects.append("debug-info-tests")
if self.options.libclc:
projects.append("libclc")
if self.options.libcxx:
projects.append("libcxx")
if self.options.libcxxabi:
projects.append("libcxxabi")
if self.options.libunwind:
projects.append("libunwind")
if self.options.lld:
projects.append("lld")
if self.options.lldb:
projects.append("lldb")
if self.options.llgo:
projects.append("llgo")
if self.options.openmp:
projects.append("openmp")
if self.options.parallel_libs:
projects.append("parallel-libs")
if self.options.polly:
projects.append("polly")
if self.options.pstl:
projects.append("pstd")
cmake.definitions["LLVM_ENABLE_PROJECTS"] = ";".join(projects)
cmake.definitions["CMAKE_TOOLCHAIN_FILE"] = "conan_paths.cmake"
cmake.definitions["LLVM_ENABLE_RTTI"] = "ON"
cmake.configure(source_folder="checkout/llvm")
cmake.build()
def package(self):
cmake = CMake(self)
cmake.install()
cmake_minimum_required(VERSION 2.8.12)
project(PackageTest CXX)
include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
conan_basic_setup()
find_package(LLVM REQUIRED)
add_executable(example example.cpp)
target_link_libraries(example LLVM)
# CTest is a testing tool that can be used to test your project.
# enable_testing()
# add_test(NAME example
# WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/bin
# COMMAND example)
import os
from conans import ConanFile, CMake, tools
class LlvmTestConan(ConanFile):
settings = "os", "compiler", "build_type", "arch"
generators = "cmake"
def build(self):
cmake = CMake(self)
# Current dir is "test_package/build/<build_id>" and CMakeLists.txt is
# in "test_package"
cmake.configure()
cmake.build()
def imports(self):
self.copy("*.dll", dst="bin", src="bin")
self.copy("*.dylib*", dst="bin", src="lib")
self.copy('*.so*', dst='bin', src='lib')
def test(self):
if not tools.cross_building(self.settings):
os.chdir("bin")
self.run(".%sexample" % os.sep)
#include <iostream>
#include <llvm/Bitcode/BitcodeReader.h>
int main() {
llvm::BitcodeLTOInfo info;
int result = info.IsThinLTO ? 0 : 1;
return 0;
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment