quickjs msvc

This commit is contained in:
ekibun
2020-08-20 12:55:22 +08:00
parent e5a4411fa7
commit b3c9f5b23f
38 changed files with 66454 additions and 299 deletions

View File

@@ -1,4 +1,17 @@
cmake_minimum_required(VERSION 3.15)
# quickjs
set(QUICK_JS_LIB_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../cxx/quickjs)
file (STRINGS "${QUICK_JS_LIB_DIR}/VERSION" QUICKJS_VERSION)
add_library(libquickjs STATIC
${QUICK_JS_LIB_DIR}/cutils.c
${QUICK_JS_LIB_DIR}/libregexp.c
${QUICK_JS_LIB_DIR}/libunicode.c
${QUICK_JS_LIB_DIR}/quickjs.c
)
project(libquickjs LANGUAGES C)
target_compile_options(libquickjs PRIVATE "-DCONFIG_VERSION=\"${QUICKJS_VERSION}\"")
set(PROJECT_NAME "flutter_qjs")
project(${PROJECT_NAME} LANGUAGES CXX)
add_compile_options("$<$<CXX_COMPILER_ID:MSVC>:/utf-8>")
@@ -14,12 +27,10 @@ set_target_properties(${PLUGIN_NAME} PROPERTIES
target_compile_definitions(${PLUGIN_NAME} PRIVATE FLUTTER_PLUGIN_IMPL)
target_include_directories(${PLUGIN_NAME} INTERFACE
"${CMAKE_CURRENT_SOURCE_DIR}/include")
target_link_libraries(${PLUGIN_NAME} PRIVATE flutter flutter_wrapper_plugin
"${CMAKE_CURRENT_SOURCE_DIR}/quickjs/libquickjs64.a"
)
target_link_libraries(${PLUGIN_NAME} PRIVATE flutter flutter_wrapper_plugin libquickjs)
# List of absolute paths to libraries that should be bundled with the plugin
set(flutter_qjs_bundled_libraries
"${CMAKE_CURRENT_SOURCE_DIR}/quickjs/libquickjs64.dll"
""
PARENT_SCOPE
)

View File

@@ -151,7 +151,7 @@ namespace
{
callargs[i] = qjs::dartToJs(ctx.ctx, arguments[i]);
}
qjs::JSValue ret = JS_Call(ctx.ctx, *function, qjs::JSValue{qjs::JSValueUnion{0}, qjs::JS_TAG_UNDEFINED}, (int)argscount, callargs);
qjs::JSValue ret = JS_Call(ctx.ctx, *function, ctx.global().v, (int)argscount, callargs);
qjs::JS_FreeValue(ctx.ctx, *function);
if (qjs::JS_IsException(ret))
throw qjs::exception{};

View File

@@ -1,195 +0,0 @@
EXPORTS
JS_AddIntrinsicAtomics
JS_AddIntrinsicBaseObjects
JS_AddIntrinsicBigDecimal
JS_AddIntrinsicBigFloat
JS_AddIntrinsicBigInt
JS_AddIntrinsicDate
JS_AddIntrinsicEval
JS_AddIntrinsicJSON
JS_AddIntrinsicMapSet
JS_AddIntrinsicOperators
JS_AddIntrinsicPromise
JS_AddIntrinsicProxy
JS_AddIntrinsicRegExp
JS_AddIntrinsicRegExpCompiler
JS_AddIntrinsicStringNormalize
JS_AddIntrinsicTypedArrays
JS_AddModuleExport
JS_AddModuleExportList
JS_AtomToCString
JS_AtomToString
JS_AtomToValue
JS_Call
JS_CallConstructor
JS_CallConstructor2
JS_ComputeMemoryUsage
JS_DefineProperty
JS_DefinePropertyGetSet
JS_DefinePropertyValue
JS_DefinePropertyValueInt64
JS_DefinePropertyValueStr
JS_DefinePropertyValueUint32
JS_DefinePropertyValueValue
JS_DeleteProperty
JS_DeletePropertyInt64
JS_DetachArrayBuffer
JS_DetectModule
JS_DumpMemoryUsage
JS_DupAtom
JS_DupContext
JS_EnableBignumExt
JS_EnqueueJob
JS_Eval
JS_EvalFunction
JS_ExecutePendingJob
JS_FreeAtom
JS_FreeAtomRT
JS_FreeCString
JS_FreeContext
JS_FreeRuntime
JS_GetArrayBuffer
JS_GetClassProto
JS_GetContextOpaque
JS_GetException
JS_GetGlobalObject
JS_GetImportMeta
JS_GetModuleName
JS_GetOpaque
JS_GetOpaque2
JS_GetOwnProperty
JS_GetOwnPropertyNames
JS_GetPropertyInternal
JS_GetPropertyStr
JS_GetPropertyUint32
JS_GetPrototype
JS_GetRuntime
JS_GetRuntimeOpaque
JS_GetTypedArrayBuffer
JS_HasProperty
JS_Invoke
JS_IsArray
JS_IsCFunction
JS_IsConstructor
JS_IsError
JS_IsExtensible
JS_IsFunction
JS_IsInstanceOf
JS_IsJobPending
JS_IsLiveObject
JS_IsRegisteredClass
JS_IsUncatchableError
JS_JSONStringify
JS_MarkValue
JS_NewArray
JS_NewArrayBuffer
JS_NewArrayBufferCopy
JS_NewAtom
JS_NewAtomLen
JS_NewAtomString
JS_NewAtomUInt32
JS_NewBigInt64
JS_NewBigInt64_1
JS_NewBigUint64
JS_NewCFunction2
JS_NewCFunctionData
JS_NewCModule
JS_NewClass
JS_NewClassID
JS_NewContext
JS_NewContextRaw
JS_NewError
JS_NewObject
JS_NewObjectClass
JS_NewObjectProto
JS_NewObjectProtoClass
JS_NewPromiseCapability
JS_NewRuntime
JS_NewRuntime2
JS_NewString
JS_NewStringLen
JS_ParseJSON
JS_ParseJSON2
JS_PreventExtensions
JS_ReadObject
JS_ResetUncatchableError
JS_ResolveModule
JS_RunGC
JS_SetCanBlock
JS_SetClassProto
JS_SetConstructor
JS_SetConstructorBit
JS_SetContextOpaque
JS_SetGCThreshold
JS_SetHostPromiseRejectionTracker
JS_SetInterruptHandler
JS_SetMaxStackSize
JS_SetMemoryLimit
JS_SetModuleExport
JS_SetModuleExportList
JS_SetModuleLoaderFunc
JS_SetOpaque
JS_SetPropertyFunctionList
JS_SetPropertyInt64
JS_SetPropertyInternal
JS_SetPropertyStr
JS_SetPropertyUint32
JS_SetPrototype
JS_SetRuntimeInfo
JS_SetRuntimeOpaque
JS_SetSharedArrayBufferFunctions
JS_SetUncatchableError
JS_Throw
JS_ThrowInternalError
JS_ThrowOutOfMemory
JS_ThrowRangeError
JS_ThrowReferenceError
JS_ThrowSyntaxError
JS_ThrowTypeError
JS_ToBigInt64
JS_ToBool
JS_ToCStringLen2
JS_ToFloat64
JS_ToIndex
JS_ToInt32
JS_ToInt32Clamp
JS_ToInt32Sat
JS_ToInt64
JS_ToInt64Clamp
JS_ToInt64Ext
JS_ToInt64Sat
JS_ToPropertyKey
JS_ToString
JS_ToStringInternal
JS_ValueToAtom
JS_WriteObject
JS_WriteObject2
__JS_FreeValue
__JS_FreeValueRT
js_free
js_free_rt
js_init_module_os
js_init_module_std
js_load_file
js_malloc
js_malloc_rt
js_malloc_usable_size
js_malloc_usable_size_rt
js_mallocz
js_mallocz_rt
js_module_loader
js_module_set_import_meta
js_parse_error
js_realloc
js_realloc2
js_realloc_rt
js_std_add_helpers
js_std_dump_error
js_std_eval_binary
js_std_free_handlers
js_std_init_handlers
js_std_loop
js_std_promise_rejection_tracker
js_strdup
js_string_codePointRange
js_strndup

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.