File tree Expand file tree Collapse file tree 2 files changed +29
-11
lines changed 
tests/unit/custom-section Expand file tree Collapse file tree 2 files changed +29
-11
lines changed Original file line number Diff line number Diff line change 22# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 
33
44cmake_minimum_required (VERSION  3.14)
5- 
65project  (test -custom-section)
76
7+ set (WASI_SDK_DIR "/opt/wasi-sdk" )
8+ set (WASISDK_TOOLCHAIN "${WASI_SDK_DIR} /share/cmake/wasi-sdk.cmake" )
9+ 
10+ include (ExternalProject)
11+ ExternalProject_Add(
12+   custom-section-test -wasm-apps
13+   SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR} /wasm-apps
14+   BUILD_ALWAYS YES 
15+   CONFIGURE_COMMAND ${CMAKE_COMMAND}  -S ${CMAKE_CURRENT_SOURCE_DIR} /wasm-apps -B build 
16+                       -DWASI_SDK_PREFIX=${WASI_SDK_DIR} 
17+                       -DCMAKE_TOOLCHAIN_FILE=${WASISDK_TOOLCHAIN} 
18+   BUILD_COMMAND      ${CMAKE_COMMAND}  --build  build  --verbose
19+   INSTALL_COMMAND   ${CMAKE_COMMAND}  --install  build  --prefix  ${CMAKE_CURRENT_BINARY_DIR} /wasm-apps
20+ )
21+ 
822add_definitions  (-DRUN_ON_LINUX)
923
1024set  (WAMR_BUILD_LIBC_WASI 0)
@@ -37,9 +51,6 @@ set (unit_test_sources
3751  ${IWASM_COMPL_SOURCE} 
3852)
3953
40- # Automatically build wasm-apps for this test 
41- add_subdirectory (wasm-apps)
42- 
4354# Now simply link against gtest or gtest_main as needed. Eg 
4455add_executable  (custom_section_test ${unit_test_sources} )
4556
Original file line number Diff line number Diff line change 22# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 
33
44cmake_minimum_required (VERSION  3.14)
5+ project (wasm-apps)
56
6- project (wasm-apps-custom-section)
7+ add_executable (app.wasm app.c)
8+ target_compile_options (app.wasm PUBLIC  -g -nostdlib)
9+ target_link_options (app.wasm PRIVATE 
10+   -nostdlib
11+   LINKER:--allow-undefined
12+   LINKER:--export-all 
13+   LINKER:--no -entry
14+ )
715
8- # Add -g option so there will be debugger related custom sections 
9- add_custom_target (app.wasm ALL 
10-     COMMAND  /opt/wasi-sdk/bin/clang -g -nostdlib
11-             -Wl,--no -entry,--export-all 
12-             -o ${CMAKE_CURRENT_BINARY_DIR} /app.wasm
13-             ${CMAKE_CURRENT_LIST_DIR} /app.c
16+ # install .wasm 
17+ set (
18+   WASM_FILES
19+   ${CMAKE_CURRENT_BINARY_DIR} /app.wasm
1420)
21+ install (FILES  ${WASM_FILES}  DESTINATION  .)
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments