@ -7,6 +7,8 @@ set(WASI_SDK_ARTIFACT "" CACHE STRING "Name of the wasi-sdk artifact being produ
string ( REGEX REPLACE "[ ]+" ";" llvm_cmake_flags_list "${LLVM_CMAKE_FLAGS}" )
set ( wasi_tmp_install ${ CMAKE_CURRENT_BINARY_DIR } /install )
if ( NOT CMAKE_BUILD_TYPE )
set ( CMAKE_BUILD_TYPE MinSizeRel )
endif ( )
@ -16,7 +18,7 @@ set(default_cmake_args
- D C M A K E _ A R = $ { C M A K E _ A R }
- D C M A K E _ C _ C O M P I L E R = $ { C M A K E _ C _ C O M P I L E R }
- D C M A K E _ C X X _ C O M P I L E R = $ { C M A K E _ C X X _ C O M P I L E R }
- D C M A K E _ I N S T A L L _ P R E F I X = $ { CM A K E _ I N S T A L L _ P R E F I X } )
- D C M A K E _ I N S T A L L _ P R E F I X = $ { wa s i _ t m p _ i n s t a l l } )
if ( CMAKE_C_COMPILER_LAUNCHER )
list ( APPEND default_cmake_args -DCMAKE_C_COMPILER_LAUNCHER= ${ CMAKE_C_COMPILER_LAUNCHER } )
@ -106,6 +108,14 @@ ExternalProject_Add(llvm-build
U S E S _ T E R M I N A L _ I N S T A L L O N
)
add_custom_target ( build ALL DEPENDS llvm-build )
# 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 .
install ( DIRECTORY ${ wasi_tmp_install } /bin ${ wasi_tmp_install } /lib ${ wasi_tmp_install } /share
U S E _ S O U R C E _ P E R M I S S I O N S
D E S T I N A T I O N $ { C M A K E _ I N S T A L L _ P R E F I X } )
# B u i l d l o g i c f o r ` w a s m - c o m p o n e n t - l d ` i n s t a l l e d f r o m R u s t c o d e .
set ( wasm_component_ld_root ${ CMAKE_CURRENT_BINARY_DIR } /wasm-component-ld )
set ( wasm_component_ld ${ wasm_component_ld_root } /bin/wasm-component-ld ${ CMAKE_EXECUTABLE_SUFFIX } )
@ -118,24 +128,34 @@ add_custom_command(
C O M M A N D
c a r g o i n s t a l l - - r o o t $ { w a s m _ c o m p o n e n t _ l d _ r o o t } $ { r u s t _ t a r g e t _ f l a g }
w a s m - c o m p o n e n t - l d @ $ { w a s m _ c o m p o n e n t _ l d _ v e r s i o n }
C O M M A N D
c m a k e - E m a k e _ d i r e c t o r y $ { w a s i _ t m p _ i n s t a l l } / b i n
C O M M A N D
c m a k e - E c o p y $ { w a s m _ c o m p o n e n t _ l d } $ { w a s i _ t m p _ i n s t a l l } / b i n
C O M M E N T " B u i l d i n g ` w a s m - c o m p o n e n t - l d ` . . . " )
add_custom_target ( wasm-component-ld ALL DEPENDS ${ wasm_component_ld } )
install (
P R O G R A M S $ { w a s m _ c o m p o n e n t _ l d }
D E S T I N A T I O N $ { C M A K E _ I N S T A L L _ P R E F I X } / b i n )
add_custom_target ( wasm-component-ld DEPENDS ${ wasm_component_ld } )
add_dependencies ( build wasm-component-ld )
# S e t u p i n s t a l l a t i o n l o g i c f o r C M a k e s u p p o r t f i l e s .
install (
P R O G R A M S s r c / c o n f i g / c o n f i g . s u b s r c / c o n f i g / c o n f i g . g u e s s
D E S T I N A T I O N $ { C M A K E _ I N S T A L L _ P R E F I X } / s h a r e / m i s c )
install (
F I L E S w a s i - s d k . c m a k e w a s i - s d k - p t h r e a d . c m a k e w a s i - s d k - p 2 . c m a k e
D E S T I N A T I O N $ { C M A K E _ I N S T A L L _ P R E F I X } / s h a r e / c m a k e )
install (
D I R E C T O R Y c m a k e / P l a t f o r m
D E S T I N A T I O N $ { C M A K E _ I N S T A L L _ P R E F I X } / s h a r e / c m a k e )
add_custom_target ( misc-files )
add_dependencies ( build misc-files )
function ( copy_misc_file src dst_folder )
cmake_path ( GET src FILENAME src_filename )
set ( dst ${ wasi_tmp_install } /share/ ${ dst_folder } / ${ src_filename } )
add_custom_command (
O U T P U T $ { d s t }
C O M M A N D c m a k e - E c o p y $ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } / $ { s r c } $ { d s t } )
add_custom_target ( copy- ${ src_filename } DEPENDS ${ dst } )
add_dependencies ( misc-files copy- ${ src_filename } )
endfunction ( )
copy_misc_file ( src/config/config.sub misc )
copy_misc_file ( src/config/config.guess misc )
copy_misc_file ( wasi-sdk.cmake cmake )
copy_misc_file ( wasi-sdk-pthread.cmake cmake )
copy_misc_file ( wasi-sdk-p2.cmake cmake )
copy_misc_file ( cmake/Platform/WASI.cmake cmake/Platform )
include ( wasi-sdk-dist )
@ -156,6 +176,6 @@ endif()
set ( dist_dir ${ CMAKE_CURRENT_BINARY_DIR } /dist )
wasi_sdk_add_tarball ( dist-toolchain
$ { d i s t _ d i r } / w a s i - t o o l c h a i n - $ { w a s i _ s d k _ v e r s i o n } - $ { w a s i _ s d k _ a r t i f a c t } . t a r . g z
$ { CM A K E _ I N S T A L L _ P R E F I X } )
add_dependencies ( dist-toolchain llvm- build install )
$ { wa s i _ t m p _ i n s t a l l } )
add_dependencies ( dist-toolchain build)
add_custom_target ( dist DEPENDS dist-toolchain )