Add build configuration for Mac (#110)
* Add build configuration for Mac This patch implements Mac build basically based on Linux platform implementations and configurations. The document to build it on Mac has been updated as well. * Update wasm_application.h * Update lib_export.h Add comments for the functions.
This commit is contained in:
@ -40,7 +40,13 @@ int
|
||||
get_base_lib_export_apis(NativeSymbol **p_base_lib_apis);
|
||||
|
||||
/**
|
||||
* Get the exported APIs of extend lib
|
||||
* Get the exported APIs of extended lib, this API isn't provided by WASM VM,
|
||||
* it must be provided by developer to register the extended native APIs,
|
||||
* for example, developer can register his native APIs to extended_native_symbol_defs,
|
||||
* array, and include file ext_lib_export.h which implements this API.
|
||||
* And if developer hasn't any native API to register, he can define an empty
|
||||
* extended_native_symbol_defs array, and then include file ext_lib_export.h to
|
||||
* implements this API.
|
||||
*
|
||||
* @param p_base_lib_apis return the exported API array of extend lib
|
||||
*
|
||||
|
||||
65
core/iwasm/runtime/include/wasm_application.h
Normal file
65
core/iwasm/runtime/include/wasm_application.h
Normal file
@ -0,0 +1,65 @@
|
||||
/*
|
||||
* Copyright (C) 2019 Taobao (China) Inc. All rights reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef _WASM_APPLICATION_H
|
||||
#define _WASM_APPLICATION_H
|
||||
|
||||
//#include "wasm_runtime.h"
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct WASMModuleInstance;
|
||||
|
||||
/**
|
||||
* Find the unique main function from a WASM module instance
|
||||
* and execute that function.
|
||||
*
|
||||
* @param module_inst the WASM module instance
|
||||
* @param argc the number of arguments
|
||||
* @param argv the arguments array
|
||||
*
|
||||
* @return true if the main function is called, false otherwise and exception will be thrown,
|
||||
* the caller can call wasm_runtime_get_exception to get exception info.
|
||||
*/
|
||||
bool
|
||||
wasm_application_execute_main(struct WASMModuleInstance *module_inst,
|
||||
int argc, char *argv[]);
|
||||
|
||||
/**
|
||||
* Find the specified function in argv[0] from a WASM module instance
|
||||
* and execute that function.
|
||||
*
|
||||
* @param module_inst the WASM module instance
|
||||
* @param name the name of the function to execute
|
||||
* @param argc the number of arguments
|
||||
* @param argv the arguments array
|
||||
*
|
||||
* @return true if the specified function is called, false otherwise and exception will be thrown,
|
||||
* the caller can call wasm_runtime_get_exception to get exception info.
|
||||
*/
|
||||
bool
|
||||
wasm_application_execute_func(struct WASMModuleInstance *module_inst,
|
||||
char *name, int argc, char *argv[]);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* end of _WASM_APPLICATION_H */
|
||||
|
||||
25
core/iwasm/runtime/platform/darwin/platform.cmake
Normal file
25
core/iwasm/runtime/platform/darwin/platform.cmake
Normal file
@ -0,0 +1,25 @@
|
||||
# Copyright (C) 2019 Intel Corporation. All rights reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
add_definitions (-D__POSIX__ -D_XOPEN_SOURCE=600 -D_POSIX_C_SOURCE=200809L)
|
||||
|
||||
set (PLATFORM_LIB_DIR ${CMAKE_CURRENT_LIST_DIR})
|
||||
|
||||
include_directories(${PLATFORM_LIB_DIR})
|
||||
include_directories(${PLATFORM_LIB_DIR}/../include)
|
||||
|
||||
file (GLOB_RECURSE source_all ${PLATFORM_LIB_DIR}/*.c)
|
||||
|
||||
set (WASM_PLATFORM_LIB_SOURCE ${source_all})
|
||||
|
||||
25
core/iwasm/runtime/platform/darwin/wasm_native.c
Normal file
25
core/iwasm/runtime/platform/darwin/wasm_native.c
Normal file
@ -0,0 +1,25 @@
|
||||
/*
|
||||
* Copyright (C) 2019 Intel Corporation. All rights reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "wasm_native.h"
|
||||
|
||||
void*
|
||||
wasm_platform_native_func_lookup(const char *module_name,
|
||||
const char *func_name)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -18,6 +18,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "wasm.h"
|
||||
#include "wasm_application.h"
|
||||
#include "wasm_interp.h"
|
||||
#include "wasm_runtime.h"
|
||||
#include "wasm_thread.h"
|
||||
|
||||
Reference in New Issue
Block a user