mirror of
				https://github.com/bytecodealliance/wasm-micro-runtime.git
				synced 2025-10-20 16:01:24 +00:00 
			
		
		
		
	 3698f2279b
			
		
	
	
		3698f2279b
		
			
		
	
	
	
	
		
			
			Add APIs to help prepare the imports for the wasm-c-api `wasm_instance_new`: - wasm_importtype_is_linked - wasm_runtime_is_import_func_linked - wasm_runtime_is_import_global_linked - wasm_extern_new_empty For wasm-c-api, developer may use `wasm_module_imports` to get the import types info, check whether an import func/global is linked with the above API, and ignore the linking of an import func/global with `wasm_extern_new_empty`. Sample `wasm-c-api-import` is added and document is updated.
		
			
				
	
	
		
			48 lines
		
	
	
		
			1.3 KiB
		
	
	
	
		
			CMake
		
	
	
	
	
	
			
		
		
	
	
			48 lines
		
	
	
		
			1.3 KiB
		
	
	
	
		
			CMake
		
	
	
	
	
	
| # Copyright (C) 2019 Intel Corporation.  All rights reserved.
 | |
| # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 | |
| 
 | |
| cmake_minimum_required (VERSION 3.14)
 | |
| project(wasm_modules)
 | |
| 
 | |
| if(NOT SOCKET_WASI_CMAKE)
 | |
|   message(FATAL_ERROR "Require SOCKET_WASI_CMAKE")
 | |
| endif()
 | |
| 
 | |
| option(WASM_TO_AOT "transfer wasm to aot" OFF)
 | |
| if(WASM_TO_AOT AND NOT WAMRC_PATH)
 | |
|   message(FATAL_ERROR "Require WAMRC_PATH when WASM_TO_AOT is ON")
 | |
| endif()
 | |
| 
 | |
| #
 | |
| # c -> wasm
 | |
| include(${SOCKET_WASI_CMAKE})
 | |
| add_executable(send_recv ${CMAKE_CURRENT_LIST_DIR}/send_recv.c)
 | |
| set_target_properties(send_recv PROPERTIES SUFFIX .wasm)
 | |
| target_include_directories(send_recv PUBLIC ${CMAKE_CURRENT_LIST_DIR}/inc)
 | |
| target_link_libraries(send_recv socket_wasi_ext)
 | |
| target_link_options(send_recv PRIVATE
 | |
|   LINKER:--export=__heap_base
 | |
|   LINKER:--export=__data_end
 | |
|   LINKER:--shared-memory,--max-memory=196608
 | |
|   LINKER:--no-check-features
 | |
|   LINKER:--allow-undefined
 | |
| )
 | |
| 
 | |
| if(WASM_TO_AOT)
 | |
|   # wasm -> aot
 | |
|   add_custom_target(send_recv_aot ALL
 | |
|     COMMAND pwd && ${WAMRC_PATH} --enable-multi-thread -o ./send_recv.aot ./send_recv.wasm
 | |
|     DEPENDS send_recv
 | |
|     WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
 | |
|   )
 | |
| endif()
 | |
| 
 | |
| #
 | |
| # install
 | |
| if(WASM_TO_AOT)
 | |
|   install(FILES ${CMAKE_CURRENT_BINARY_DIR}/send_recv.aot DESTINATION . )
 | |
| else()
 | |
|   install(FILES ${CMAKE_CURRENT_BINARY_DIR}/send_recv.wasm DESTINATION . )
 | |
| endif()
 | |
| 
 |