Skip to content

Commit

Permalink
refactor llvm for conan2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
staskau committed Jul 5, 2024
1 parent 302564b commit b094ed8
Showing 1 changed file with 10 additions and 11 deletions.
21 changes: 10 additions & 11 deletions recipes/llvm-core/all/conanfile.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
from conan.errors import ConanInvalidConfiguration
from conan import ConanFile
from conan.tools.build import cross_building
from conan.tools.files import apply_conandata_patches, chdir, collect_libs, get, load, rename, replace_in_file, rm, rmdir, save
from conan.tools.files import copy, apply_conandata_patches, export_conandata_patches, chdir, collect_libs, get, load, rename, replace_in_file, rm, rmdir, save
from conan.tools.scm import Version
from conans import CMake
from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout
from collections import defaultdict
import json
import re
Expand Down Expand Up @@ -57,8 +57,8 @@ class LLVMCoreConan(ConanFile):
default_options = {
'shared': False,
'fPIC': True,
'components': 'all',
'targets': 'all',
'components': 'A',
'targets': 'A',
'exceptions': True,
'rtti': True,
'threads': True,
Expand All @@ -77,7 +77,7 @@ class LLVMCoreConan(ConanFile):
# Older cmake versions may have issues generating the graphviz output used
# to model the components
build_requires = [
'cmake/3.20.5'
'cmake/3.29.0'
]

generators = 'cmake', 'cmake_find_package'
Expand Down Expand Up @@ -189,9 +189,8 @@ def _configure_cmake(self):
return cmake

def export_sources(self):
self.copy("CMakeLists.txt")
for patch in self.conan_data.get("patches", {}).get(self.version, []):
self.copy(patch["patch_file"])
copy(self, "CMakeLists.txt", src=self.recipe_folder, dst=self.export_sources_folder)
export_conandata_patches(self)

def config_options(self):
if self.settings.os == 'Windows':
Expand Down Expand Up @@ -259,7 +258,7 @@ def _create_cmake_module_alias_targets(self, module_file, targets):
save(self, module_file, content)

def package(self):
self.copy('LICENSE.TXT', dst='licenses', src=self._source_subfolder)
copy(self, 'LICENSE.TXT', dst='licenses', src=self._source_subfolder)
lib_path = os.path.join(self.package_folder, 'lib')

cmake = self._configure_cmake()
Expand All @@ -268,9 +267,9 @@ def package(self):
if not self.options.shared:
for ext in ['.a', '.lib']:
lib = '**/lib/*LLVMTableGenGlobalISel{}'.format(ext)
self.copy(lib, dst='lib', keep_path=False)
copy(self, lib, dst='lib', keep_path=False)
lib = '*LLVMTableGenGlobalISel{}'.format(ext)
self.copy(lib, dst='lib', src='lib')
copy(self, lib, dst='lib', src='lib')

CMake(self).configure(args=['--graphviz=graph/llvm.dot'], source_dir='.', build_dir='.')
with chdir(self, 'graph'):
Expand Down

0 comments on commit b094ed8

Please sign in to comment.