@ -9,10 +9,11 @@ find_program(MAKE make REQUIRED)
option ( WASI_SDK_DEBUG_PREFIX_MAP "Pass `-fdebug-prefix-map` for built artifacts" ON )
option ( WASI_SDK_DEBUG_PREFIX_MAP "Pass `-fdebug-prefix-map` for built artifacts" ON )
option ( WASI_SDK_INCLUDE_TESTS "Whether or not to build tests by default" OFF )
option ( WASI_SDK_INCLUDE_TESTS "Whether or not to build tests by default" OFF )
option ( WASI_SDK_INSTALL_TO_CLANG_RESOURCE_DIR "Whether or not to modify the compiler's resource directory" OFF )
set ( wasi_tmp_install ${ CMAKE_CURRENT_BINARY_DIR } /install )
set ( wasi_tmp_install ${ CMAKE_CURRENT_BINARY_DIR } /install )
set ( wasi_sysroot ${ wasi_tmp_install } /share/wasi-sysroot )
set ( wasi_sysroot ${ wasi_tmp_install } /share/wasi-sysroot )
set ( wasi_resource_dir ${ wasi_tmp_install } / lib/clang/${ clang_version } )
set ( wasi_resource_dir ${ wasi_tmp_install } / wasi-resource-dir )
if ( WASI_SDK_DEBUG_PREFIX_MAP )
if ( WASI_SDK_DEBUG_PREFIX_MAP )
add_compile_options (
add_compile_options (
@ -246,9 +247,18 @@ endforeach()
# m i s c b u i l d l o g i c
# m i s c b u i l d l o g i c
# = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
# = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
install ( DIRECTORY ${ wasi_tmp_install } / lib ${ wasi_tmp_install } / share
install ( DIRECTORY ${ wasi_tmp_install } / share
U S E _ S O U R C E _ P E R M I S S I O N S
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 } )
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 } )
if ( WASI_SDK_INSTALL_TO_CLANG_RESOURCE_DIR )
install ( DIRECTORY ${ wasi_resource_dir } /lib
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 l a n g _ r e s o u r c e _ d i r } )
else ( )
install ( DIRECTORY ${ wasi_resource_dir } /lib
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 } / c l a n g - r e s o u r c e - d i r )
endif ( )
# A d d a t o p - l e v e l ` b u i l d ` t a r g e t a s w e l l a s ` b u i l d - $ t a r g e t ` t a r g e t s .
# A d d a t o p - l e v e l ` b u i l d ` t a r g e t a s w e l l a s ` b u i l d - $ t a r g e t ` t a r g e t s .
add_custom_target ( build ALL )
add_custom_target ( build ALL )
@ -282,7 +292,7 @@ set(dist_dir ${CMAKE_CURRENT_BINARY_DIR}/dist)
# T a r b a l l w i t h j u s t ` c o m p i l e r - r t ` b u i l t i n s w i t h i n i t
# T a r b a l l w i t h j u s t ` c o m p i l e r - r t ` b u i l t i n s w i t h i n i t
wasi_sdk_add_tarball ( dist-compiler-rt
wasi_sdk_add_tarball ( dist-compiler-rt
$ { d i s t _ d i r } / l i b c l a n g _ r t . b u i l t i n s - w a s m 3 2 - w a s i - $ { w a s i _ s d k _ v e r s i o n } . t a r . g z
$ { d i s t _ d i r } / l i b c l a n g _ r t . b u i l t i n s - w a s m 3 2 - w a s i - $ { w a s i _ s d k _ v e r s i o n } . t a r . g z
$ { w a s i _ tm p _ i n s t a l l } / l i b / c l a n g / $ { c l a n g _ v e r s i o n } / l i b / w a s i )
$ { w a s i _ re s o u r c e _ d i r } / l i b / w a s i )
add_dependencies ( dist-compiler-rt compiler-rt )
add_dependencies ( dist-compiler-rt compiler-rt )
# T a r b a l l w i t h t h e w h o l e s y s r o o t
# T a r b a l l w i t h t h e w h o l e s y s r o o t