@ -5,6 +5,21 @@ set(LLVM_CMAKE_FLAGS "" CACHE STRING "Extra cmake flags to pass to LLVM's build"
set ( RUST_TARGET "" CACHE STRING "Target to build Rust code for, if not the host" )
set ( WASI_SDK_ARTIFACT "" CACHE STRING "Name of the wasi-sdk artifact being produced" )
option ( WASI_SDK_LLDB "Include a build of LLDB" ON )
set ( LIBEDIT_DEFAULT ON )
# I d o n ' t w a n t t o d e a l w i t h r u n n i n g a ` . / c o n f i g u r e ` s c r i p t o n W i n d o w s , d i s a b l e
# i t b y d e f a u l t .
if ( WIN32 )
set ( LIBEDIT_DEFAULT OFF )
endif ( )
# I d o n ' t k n o w h o w t o r e s o l v e b u i l d f a i l u r e s w h e n b u i l d i n g l i b e d i t f o r x 8 6 _ 6 4
# f r o m a r m 6 4 o n m a c o s , s o d i s a b l e i t f o r n o w .
if ( CMAKE_SYSTEM_PROCESSOR MATCHES "arm64" AND LLVM_CMAKE_FLAGS MATCHES "x86_64" )
set ( LIBEDIT_DEFAULT OFF )
endif ( )
option ( WASI_SDK_LIBEDIT "Whether or not to build libedit for LLDB" ${ LIBEDIT_DEFAULT } )
string ( REGEX REPLACE "[ ]+" ";" llvm_cmake_flags_list "${LLVM_CMAKE_FLAGS}" )
set ( wasi_tmp_install ${ CMAKE_CURRENT_BINARY_DIR } /install )
@ -73,6 +88,66 @@ if(NOT WIN32)
list ( APPEND tools LLVM clang-cpp )
endif ( )
# C o n f i g u r e / a d d L L D B i f r e q u e s t e d .
#
# N o t e t h a t L L D B d e p e n d s o n ` l i b e d i t ` w h i c h i s m o r e - o r - l e s s r e q u i r e d t o g e t a
# r e a s o n a b l e c o m m a n d - l i n e e x p e r i e n c e , s o t h i s i s b u i l t c u s t o m h e r e t o e n s u r e
# t h a t i t ' s a v a i l a b l e f o r L L D B .
if ( WASI_SDK_LLDB )
list ( APPEND projects lldb )
list ( APPEND tools lldb liblldb )
list ( APPEND default_cmake_args
- D L L D B _ I N C L U D E _ T E S T S = O F F
- D L L D B _ I N C L U D E _ U N I T T E S T S = O F F
- D L L D B _ E N A B L E _ S W I G = O F F
- D L L D B _ E N A B L E _ C U R S E S = O F F
- D L L D B _ E N A B L E _ L Z M A = O F F
- D L L D B _ E N A B L E _ L U A = O F F
- D L L D B _ E N A B L E _ P Y T H O N = O F F
- D L L D B _ E N A B L E _ L I B X M L 2 = O F F
- D L L D B _ E N A B L E _ F B S D V M C O R E = O F F
- D L L D B _ E N A B L E _ L I N U X P T Y = O F F
)
if ( WASI_SDK_LIBEDIT )
include ( ProcessorCount )
ProcessorCount ( nproc )
find_program ( MAKE_EXECUTABLE make REQUIRED )
ExternalProject_Add ( libedit
U R L h t t p s : / / t h r y s o e e . d k / e d i t l i n e / l i b e d i t - 2 0 2 5 1 0 1 6 - 3 . 1 . t a r . g z
U R L _ H A S H S H A 2 5 6 = 2 1 3 6 2 b 0 0 6 5 3 b b f c 1 c 7 1 f 7 1 a 7 5 7 8 d a 6 6 b 5 b 5 2 0 3 5 5 9 d 4 3 1 3 4 d 2 d d 7 7 1 9 e 3 1 3 c e 0 4 1
# W i t h o u t t h i s t h e b u i l d s y s t e m t r i e s t o f i n d a n d u s e ` a c l o c a l - 1 . 1 8 ` w h e r e
# w i t h t h i s i t d o e s n ' t s o t u r n t h i s o n .
D O W N L O A D _ E X T R A C T _ T I M E S T A M P O N
C O N F I G U R E _ C O M M A N D
< S O U R C E _ D I R > / c o n f i g u r e
- - p r e f i x = $ { w a s i _ t m p _ i n s t a l l }
- - e n a b l e - p i c
- - d i s a b l e - e x a m p l e s
C C = $ { C M A K E _ C _ C O M P I L E R }
C F L A G S = $ { l i b e d i t _ c f l a g s }
L D F L A G S = $ { l i b e d i t _ c f l a g s }
B U I L D _ C O M M A N D
$ { M A K E _ E X E C U T A B L E } - j $ { n p r o c } V = 1
U S E S _ T E R M I N A L _ C O N F I G U R E O N
U S E S _ T E R M I N A L _ B U I L D O N
U S E S _ T E R M I N A L _ I N S T A L L O N
)
list ( APPEND default_cmake_args
- D L L D B _ E N A B L E _ L I B E D I T = O N
- D L i b E d i t _ R O O T = $ { w a s i _ t m p _ i n s t a l l }
)
else ( )
list ( APPEND default_cmake_args -DLLDB_ENABLE_LIBEDIT=OFF )
add_custom_target ( libedit )
endif ( )
else ( )
add_custom_target ( libedit )
endif ( )
list ( TRANSFORM tools PREPEND --target= OUTPUT_VARIABLE build_targets )
list ( TRANSFORM tools PREPEND --target=install- OUTPUT_VARIABLE install_targets )
@ -110,6 +185,7 @@ ExternalProject_Add(llvm-build
)
add_custom_target ( build ALL DEPENDS llvm-build )
ExternalProject_Add_StepDependencies ( llvm-build configure libedit )
# I n s t a l l a t i o n t a r g e t f o r t h i s o u t e r p r o j e c t f o r i n s t a l l i n g t h e t o o l c h a i n t o t h e
# s y s t e m .