Skip to content
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 13 and 14 #7613

Closed
wants to merge 48 commits into from
Closed
Show file tree
Hide file tree
Changes from 32 commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
3014ca9
llvm 10.0.0 recipe (wip)
Manu343726 Apr 24, 2020
2a451ed
Restrict Vistual Studio version
Manu343726 Apr 25, 2020
fd29495
Add fPIC option
Manu343726 Apr 25, 2020
dfd97bd
Ignore share folder
Manu343726 Apr 25, 2020
fc045e4
Fix enabling of llvm subprojects
Manu343726 Apr 26, 2020
da0137f
Add llvm license file to package
Manu343726 Apr 26, 2020
4f90fa0
Fix license copy and package ignore logic
Manu343726 Apr 26, 2020
b66d601
update package to llvm 12.0.1 from 10.0.0
tcanabrava Aug 1, 2021
7ded9cc
Check for MSVC 2019
tcanabrava Aug 1, 2021
b73d686
Remove verbose makefile for test project
tcanabrava Aug 1, 2021
553b3e4
Bump minimal cmake version on test project
tcanabrava Aug 1, 2021
c79dfb0
Extract cmake_configure into a method, and call it on install and pac…
tcanabrava Aug 1, 2021
54e52ea
Default to no bindings as those are not userful on a c++ project
tcanabrava Aug 1, 2021
d5519cd
Check that the compiler version is compatible with the software
tcanabrava Aug 2, 2021
87191fc
Move the MSVC check to the validate method.
tcanabrava Aug 3, 2021
905ad61
Update to LLVM 13.0.0
rdeterre Oct 8, 2021
5ff0e66
Dummy change to trigger re-build
rdeterre Oct 11, 2021
472991a
Restart build
rdeterre Oct 12, 2021
e7ee57f
Remove GCC 6 for now, which was giving an internal compiler error
rdeterre Oct 12, 2021
abfdd5b
Restart build
rdeterre Oct 13, 2021
621cafb
Limit GCC to 8+
rdeterre Oct 14, 2021
e823f0d
Limit GCC to 10+
rdeterre Oct 15, 2021
e4aaebb
Dummy change to trigger re-build
rdeterre Oct 18, 2021
480071d
Limit parallel linking jobs
alazartech Oct 20, 2021
cbb9b2d
Use Ninja generator
rdeterre Oct 22, 2021
ee6ed18
Limit compile jobs to 4
rdeterre Oct 25, 2021
e1b2ca8
Limit compile jobs to 2
rdeterre Oct 26, 2021
0e6afc1
Limit compile jobs to 1...
rdeterre Oct 26, 2021
bef8d08
Dummy change to trigger re-build
rdeterre Oct 28, 2021
677b7ce
Non-parallel make build
rdeterre Nov 2, 2021
a766609
Remove ninja dependency
rdeterre Nov 2, 2021
482c481
Dummy change to trigger re-build
rdeterre Jan 23, 2022
ec35370
Update recipes/llvm/all/conanfile.py
rdeterre Jan 25, 2022
86d4e0f
Update recipes/llvm/all/conanfile.py
rdeterre Jan 25, 2022
216716f
Support both libstdc++ ABIs
rdeterre Feb 1, 2022
0df22f5
That didn't work
rdeterre Feb 2, 2022
2432fb7
Use LLD linker
rdeterre Mar 4, 2022
d591ac8
Disable debug builds
rdeterre Mar 14, 2022
8d5c88a
Add RTTI option
rdeterre Apr 7, 2022
8098d82
Add enable_debug option
rdeterre Apr 7, 2022
854302b
Add LLVM 13.0.1 and 14.0.0
rdeterre Apr 7, 2022
400a878
Separate projects and runtimes
rdeterre Apr 7, 2022
d3e185a
Visual Studio or msvc
rdeterre Apr 7, 2022
e3c739a
Add libcxxabi
alazartech Apr 7, 2022
2644d15
Use options from llvm-core
alazartech Apr 19, 2022
45b2705
Fixes
alazartech Apr 20, 2022
397f154
fPIC management
alazartech Apr 20, 2022
0759946
short_paths = True
alazartech Apr 20, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions recipes/llvm/all/conandata.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
sources:
13.0.0:
rdeterre marked this conversation as resolved.
Show resolved Hide resolved
url: https://github.com/llvm/llvm-project/archive/refs/tags/llvmorg-13.0.0.tar.gz
sha256: a1131358f1f9f819df73fa6bff505f2c49d176e9eef0a3aedd1fdbce3b4630e8
125 changes: 125 additions & 0 deletions recipes/llvm/all/conanfile.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
from conans import ConanFile, tools, CMake
from conans.tools import Version
from conans.errors import ConanInvalidConfiguration
import os, shutil, glob

projects = [
rdeterre marked this conversation as resolved.
Show resolved Hide resolved
'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'
]
rdeterre marked this conversation as resolved.
Show resolved Hide resolved

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'
rdeterre marked this conversation as resolved.
Show resolved Hide resolved
topics = 'conan', 'c++', 'compiler', 'tooling'
rdeterre 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
}}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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
}}
options = {
**{"with_project_" + project: [True, False] for project in projects},
**{"with_runtime_" + runtime: [True, False] for runtime in runtimes},
**{"fPIC": [True, False]},
}
default_options = {
**{"with_project_" + project: project in default_projects for project in projects},
**{"with_project_" + runtime: runtime in default_runtimes for runtime in runtimes},
**{"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 build_requirements(self):
self.build_requires("cmake/3.21.3")

def configure(self):
if self.settings.compiler.get_safe("cppstd"):
tools.check_min_cppstd(self, '14')

def _cmake_configure(self):
enabled_projects = [project for project in projects if getattr(self.options, 'with_' + project)]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
enabled_projects = [project for project in projects if getattr(self.options, 'with_' + project)]
enabled_projects = [project for project in projects if getattr(self.options, 'with_project_' + project)]
enabled_runtimes = [runtime for runtime in projects if getattr(self.options, 'with_runtime_' + project)]

self.output.info('Enabled LLVM subprojects: {}'.format(', '.join(enabled_projects)))
rdeterre marked this conversation as resolved.
Show resolved Hide resolved

cmake = CMake(self, parallel=False);
cmake.configure(
defs = {
'LLVM_ENABLE_PROJECTS': ';'.join(enabled_projects),
rdeterre marked this conversation as resolved.
Show resolved Hide resolved
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
'LLVM_ENABLE_PROJECTS': ';'.join(enabled_projects),
'LLVM_ENABLE_PROJECTS': ';'.join(enabled_projects),
'LLVM_ENABLE_RUNTIMES': ';'.join(enabled_runtimes),

'LLVM_ENABLE_BINDINGS': False,
},
source_folder = os.path.join(self._source_subfolder, 'llvm')
)
return cmake

def build(self):
cmake = self._cmake_configure()
cmake.build()

def package(self):
cmake = self._cmake_configure()
cmake.install()

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 validate(self):
if self.settings.compiler == "gcc" and tools.Version(self.settings.compiler.version) < "10":
raise ConanInvalidConfiguration("Compiler version too low for this package.")

if self.settings.compiler == "Visual Studio" and Version(self.settings.compiler.version) < "16.4":
rdeterre marked this conversation as resolved.
Show resolved Hide resolved
raise ConanInvalidConfiguration("An up to date version of Microsoft Visual Studio 2019 or newer is required.")

def package_info(self):
self.cpp_info.libs = tools.collect_libs(self)
self.cpp_info.builddirs = ['lib/cmake']
rdeterre marked this conversation as resolved.
Show resolved Hide resolved
10 changes: 10 additions & 0 deletions recipes/llvm/all/test_package/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
cmake_minimum_required(VERSION 3.1)
project(test_package)

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})
17 changes: 17 additions & 0 deletions recipes/llvm/all/test_package/conanfile.py
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)
Loading