-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
llvm 10.0.0 #1450
llvm 10.0.0 #1450
Changes from 7 commits
b60d6cf
e15eadf
745dfa2
bed1a91
36a94dd
9637a54
935ea22
7ba2ca0
086a061
258c6fb
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
sources: | ||
10.0.0: | ||
url: https://github.com/llvm/llvm-project/archive/llvmorg-10.0.0.zip | ||
sha256: d2fadc9962ccceab2b9b0d806352db690c9040f24f4a4bdef37b72dcc82fc07a |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,113 @@ | ||
from conans import ConanFile, tools, CMake | ||
from conans.tools import Version | ||
from conans.errors import ConanInvalidConfiguration | ||
import os, shutil, glob | ||
|
||
projects = [ | ||
'clang', | ||
'clang-tools-extra', | ||
'compiler-rt', | ||
'debuginfo-tests', | ||
'libc', | ||
'libclc', | ||
'libcxx', | ||
'libcxxabi', | ||
'libunwind', | ||
'lld', | ||
'lldb', | ||
'mlir', | ||
'openmp', | ||
'parallel-libs', | ||
'polly', | ||
'pstl' | ||
] | ||
|
||
default_projects = [ | ||
'clang', | ||
'compiler-rt' | ||
] | ||
|
||
class Llvm(ConanFile): | ||
name = 'llvm' | ||
description = 'The LLVM Project is a collection of modular and reusable compiler and toolchain technologies' | ||
url = 'https://github.com/conan-io/conan-center-index' | ||
homepage = 'https://github.com/llvm/llvm-project' | ||
license = 'Apache 2.0' | ||
topics = 'conan', 'c++', 'compiler', 'tooling' | ||
SSE4 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
settings = 'os', 'arch', 'compiler', 'build_type' | ||
|
||
no_copy_source = True | ||
_source_subfolder = 'source_subfolder' | ||
|
||
options = {**{ 'with_' + project : [True, False] for project in projects }, **{ | ||
'fPIC': [True, False] | ||
}} | ||
default_options = {**{ 'with_' + project : project in default_projects for project in projects }, **{ | ||
'fPIC': True | ||
}} | ||
generators = 'cmake_find_package' | ||
|
||
@property | ||
def repo_folder(self): | ||
return os.path.join(self.source_folder, self._source_subfolder) | ||
|
||
def project_folder(self, project): | ||
return os.path.join(self.repo_folder, project) | ||
|
||
def source(self): | ||
tools.get(**self.conan_data["sources"][self.version]) | ||
extracted_dir = 'llvm-project-llvmorg-' + self.version | ||
os.rename(extracted_dir, self._source_subfolder) | ||
|
||
def configure(self): | ||
if self.settings.compiler.get_safe("cppstd"): | ||
tools.check_min_cppstd(self, '14') | ||
|
||
if self.settings.compiler == "Visual Studio" and Version(self.settings.compiler.version) < "19.1": | ||
raise ConanInvalidConfiguration("Need MSVC >= 19.1") | ||
Comment on lines
+67
to
+68
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think you're too restrictive. Visual Studio 2017 is version 15. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nope, see the previous build error:
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 19.0.24215.1 is the version of the C compiler, not the version of visual studio. Look at personal your conan settings file: There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So host Visual Studio version 16.4 and lower is known to miscompile part of LLVM.
|
||
|
||
def build(self): | ||
enabled_projects = [project for project in projects if getattr(self.options, 'with_' + project)] | ||
self.output.info('Enabled LLVM subprojects: {}'.format(', '.join(enabled_projects))) | ||
|
||
cmake = CMake(self); | ||
cmake.configure( | ||
defs = { | ||
'LLVM_ENABLE_PROJECTS': ';'.join(enabled_projects) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe also add |
||
}, | ||
source_folder = os.path.join(self._source_subfolder, 'llvm') | ||
) | ||
cmake.build() | ||
|
||
def package(self): | ||
cmake = CMake(self) | ||
cmake.install() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
|
||
self.copy( | ||
'LICENSE.TXT', | ||
src=self.project_folder('clang'), | ||
dst='licenses', | ||
keep_path=False) | ||
|
||
ignore = [ | ||
'share', | ||
'libexec', | ||
'**/Find*.cmake', | ||
'**/*Config.cmake' | ||
] | ||
|
||
for ignore_entry in ignore: | ||
ignore_glob = os.path.join(self.package_folder, ignore_entry) | ||
|
||
for ignore_path in glob.glob(ignore_glob, recursive=True): | ||
self.output.info('Remove ignored file/directory "{}" from package'.format(ignore_path)) | ||
|
||
if os.path.isfile(ignore_path): | ||
os.remove(ignore_path) | ||
else: | ||
shutil.rmtree(ignore_path) | ||
|
||
def package_info(self): | ||
self.cpp_info.libs = tools.collect_libs(self) | ||
self.cpp_info.builddirs = ['lib/cmake'] |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
cmake_minimum_required(VERSION 2.8.12) | ||
SSE4 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
project(test_package) | ||
|
||
set(CMAKE_VERBOSE_MAKEFILE TRUE) | ||
SSE4 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
set(CMAKE_CXX_STANDARD 14) | ||
|
||
include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) | ||
conan_basic_setup() | ||
|
||
add_executable(${PROJECT_NAME} test_package.cpp) | ||
target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
from conans import ConanFile, CMake, tools | ||
import os | ||
|
||
|
||
class TestPackageConan(ConanFile): | ||
settings = "os", "compiler", "build_type", "arch" | ||
generators = "cmake" | ||
|
||
def build(self): | ||
cmake = CMake(self) | ||
cmake.configure() | ||
cmake.build() | ||
|
||
def test(self): | ||
if not tools.cross_building(self.settings): | ||
bin_path = os.path.join("bin", "test_package") | ||
self.run(bin_path, run_environment=True) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Prefer
https://github.com/llvm/llvm-project/releases/download/llvmorg-10.0.0/llvm-project-10.0.0.tar.xz
which is 80Mb in size compared to the zip archive which is ~150Mb.Also it may be worth updating to 10.0.1 which contains a number of bugfixes.