4040 "BPF" ,
4141 "Hexagon" ,
4242 "Lanai" ,
43- "Mips" ,
4443 "MSP430" ,
44+ "Mips" ,
4545 "NVPTX" ,
4646 "PowerPC" ,
4747 "RISCV" ,
@@ -94,6 +94,8 @@ class LLVMCoreConan(ConanFile):
9494 "with_zlib" : [True , False ],
9595 "with_xml2" : [True , False ],
9696 "with_z3" : [True , False ],
97+ 'with_zstd' : [True , False ],
98+ 'with_httplib' : [True , False ],
9799 }
98100 default_options = {
99101 "shared" : False ,
@@ -116,6 +118,8 @@ class LLVMCoreConan(ConanFile):
116118 "with_xml2" : True ,
117119 "with_z3" : True , # not default
118120 "with_zlib" : True ,
121+ 'with_zstd' : True ,
122+ 'with_httplib' : False ,
119123 }
120124
121125 @property
@@ -143,6 +147,9 @@ def config_options(self):
143147 release = Version (self .version ).major
144148 if release < 14 :
145149 del self .options .with_curl
150+ if release < 15 :
151+ del self .options .with_zstd
152+ del self .options .with_httplib
146153
147154 def configure (self ):
148155 if self .options .shared :
@@ -167,6 +174,9 @@ def requirements(self):
167174 self .requires ('libcurl/[>=7.78.0 <9]' ) # no version requirement in llvm 14-19
168175 if self .options .get_safe ("with_zstd" ):
169176 self .requires ("zstd/[>=1.4.3 <2]" ) # no version required llvm 15-19, <1.4.3 doesn't work
177+ if self .options .get_safe ('with_httplib' ):
178+ # no version number in llvm 15-17
179+ self .requires ('cpp-httplib/[>=0.5.4 <1.0.0]' )
170180
171181 def build_requirements (self ):
172182 self .tool_requires ("ninja/[>=1.10.2 <2]" )
@@ -202,6 +212,9 @@ def validate(self):
202212 # see also https://llvm.org/docs/HowToCrossCompileLLVM.html
203213 raise ConanInvalidConfiguration ("Cross compilation is not supported. Contributions are welcome!" )
204214
215+ if self .options .get_safe ("with_libedit" ) and self .options .use_sanitizer != 'None' :
216+ raise ConanInvalidConfiguration ("libedit can't be used with sanitizers" )
217+
205218 def validate_build (self ):
206219 if getenv ("CONAN_CENTER_BUILD_SERVICE" ) and self .settings .build_type == "Debug" :
207220 if self .settings .os == "Linux" :
@@ -210,12 +223,17 @@ def validate_build(self):
210223 raise ConanInvalidConfiguration ("Shared Debug build is not supported on CCI due to resource limitations" )
211224
212225 def source (self ):
213- get (self , ** self .conan_data ["sources" ][self .version ])
214-
215- llvm_folder = f"llvm-{ self .version } .src"
216- rename (self , "cmake/Modules" , "cmake/modules" )
217- copy (self , pattern = "*" , src = llvm_folder , dst = "." )
218- rmdir (self , llvm_folder )
226+ if Version (self .version ) >= 15 :
227+ sources = self .conan_data ["sources" ][self .version ]
228+ get (self , ** sources ["llvm" ], destination = 'llvm-main' , strip_root = True )
229+ get (self , ** sources ["cmake" ], destination = 'cmake' , strip_root = True )
230+ else :
231+ get (self , ** self .conan_data ["sources" ][self .version ])
232+ llvm_folder = f"llvm-{ self .version } .src"
233+ if Path ("cmake/Modules" ).exists ():
234+ rename (self , "cmake/Modules" , "cmake/modules" )
235+ copy (self , pattern = "*" , src = llvm_folder , dst = "." )
236+ rmdir (self , llvm_folder )
219237
220238 def _apply_resource_limits (self , cmake_definitions ):
221239 if getenv ("CONAN_CENTER_BUILD_SERVICE" ):
@@ -244,12 +262,17 @@ def _all_targets(self):
244262 ver = Version (self .version ).major
245263 if ver >= 14 :
246264 targets .add ("VE" )
247- if ver >= 15 :
265+ if ver >= 16 : # its available in 15 but not by default with "all"
248266 targets .add ("LoongArch" )
249267 return ";" .join (targets )
250268
251269 def generate (self ):
252270 tc = CMakeToolchain (self , generator = "Ninja" )
271+
272+ is_zstd_static = False
273+ if self .options .get_safe ('with_zstd' , False ):
274+ is_zstd_static = not self .dependencies ["zstd" ].options .shared
275+
253276 # https://releases.llvm.org/12.0.0/docs/CMake.html
254277 # https://releases.llvm.org/13.0.0/docs/CMake.html
255278 # https://releases.llvm.org/14.0.0/docs/CMake.html
@@ -285,7 +308,10 @@ def generate(self):
285308 "LLVM_ENABLE_FFI" : self .options .with_ffi ,
286309 "LLVM_ENABLE_ZLIB" : "FORCE_ON" if self .options .with_zlib else False ,
287310 "LLVM_ENABLE_LIBXML2" : "FORCE_ON" if self .options .with_xml2 else False ,
288- "LLVM_ENABLE_TERMINFO" : self .options .with_terminfo
311+ "LLVM_ENABLE_TERMINFO" : self .options .with_terminfo ,
312+ 'LLVM_ENABLE_ZSTD' : 'FORCE_ON' if self .options .get_safe ('with_zstd' , False ) else False ,
313+ 'LLVM_USE_STATIC_ZSTD' : is_zstd_static ,
314+ 'LLVM_ENABLE_HTTPLIB' : 'FORCE_ON' if self .options .get_safe ('with_httplib' , False ) else False ,
289315 }
290316 if self .options .targets != "all" :
291317 cmake_variables ["LLVM_TARGETS_TO_BUILD" ] = self .options .targets
@@ -316,12 +342,17 @@ def generate(self):
316342 tc .generate ()
317343
318344 tc = CMakeDeps (self )
345+ tc .set_property ("editline" , "cmake_file_name" , "LibEdit" )
346+ tc .set_property ("editline" , "cmake_target_name" , "LibEdit::LibEdit" )
319347 tc .generate ()
320348
321349 def build (self ):
322350 apply_conandata_patches (self )
323351 cmake = CMake (self )
324- cmake .configure ()
352+ if Version (self .version ) >= 15 :
353+ cmake .configure (build_script_folder = "llvm-main" )
354+ else :
355+ cmake .configure ()
325356 cmake .build ()
326357
327358 @property
@@ -335,7 +366,10 @@ def _sanitized_components(deps_list):
335366 replacements = {
336367 "LibXml2::LibXml2" : "libxml2::libxml2" ,
337368 "ZLIB::ZLIB" : "zlib::zlib" ,
338- "CURL::libcurl" : "libcurl::libcurl"
369+ "CURL::libcurl" : "libcurl::libcurl" ,
370+ "LibEdit::LibEdit" : "editline::editline" ,
371+ "httplib::httplib" : "cpp-httplib::cpp-httplib" ,
372+ "zstd::libzstd_static" : "zstd::zstd" ,
339373 }
340374 for dep in deps_list .split (";" ):
341375 match = match_genex .search (dep )
0 commit comments