From: Nick Holland Date: Fri, 13 Mar 2015 15:21:28 +0000 (+0000) Subject: Changed configure/makefile to work with v8 package config X-Git-Tag: accepted/tizen/mobile/20150419.232751~5 X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=commitdiff_plain;h=83f54f79a8fae215f1409dd9633a51ca24cabdf6 Changed configure/makefile to work with v8 package config Also updated v8 version to 3.32.7 (Jan 2015) can't update any further unless we start using c++11 compiler flags. Change-Id: Ibdfee429b97aa6b342d3527371c8d7947ae2e11b --- diff --git a/build/tizen/configure.ac b/build/tizen/configure.ac index a36e0a8..1e94aa3 100644 --- a/build/tizen/configure.ac +++ b/build/tizen/configure.ac @@ -46,25 +46,29 @@ AC_ARG_ENABLE([debug], [enable_debug=$enableval], [enable_debug=no]) -# option for JavaScript plugin -AC_ARG_ENABLE(javascript, +# option to build JavaScript plugin +# configure settings and output +# --enable-javascript // enable_javascript = yes +# --enable-javascript=yes // enable_javascript = yes +# --enable-javascript=no // enable_javascript = no +# --disable-javascript // enable_javascript = no +# no setting // enable_javascript = automatic ( enable if v8 present) +AC_ARG_ENABLE([javascript], [AC_HELP_STRING([--enable-javascript], - [Enable JavaScript plugin])] , - [enable_javascript=yes], - [enable_javascript=no]) + [Enable JavaScript plugin])] , + [enable_javascript=$enableval], + [enable_javascript=automatic]) + if test "x$enable_debug" = "xyes"; then DALI_TOOLKIT_CFLAGS="$DALI_TOOLKIT_CFLAGS -DDEBUG_ENABLED" - DALI_SCRIPTV8_CFLAGS="$DALI_TOOLKIT_CFLAGS -DDEBUG_ENABLED" fi if test "x$enable_debug" = "xno" -a "x$enable_exportall" = "xno"; then DALI_TOOLKIT_CFLAGS="$DALI_TOOLKIT_CFLAGS -fvisibility=hidden -DHIDE_DALI_INTERNALS" - DALI_SCRIPTV8_CFLAGS="$DALI_TOOLKIT_CFLAGS -fvisibility=hidden -DHIDE_DALI_INTERNALS" fi -#set a variable for the makefile to conditionally compile the plugin -AM_CONDITIONAL([ENABLE_JAVASCRIPT_PLUGIN], [test x$enable_javascript = xyes]) + # Tizen Profile options @@ -86,11 +90,37 @@ else dataReadOnlyDir=${prefix}/share/dali/ fi +# v8 version 4+ requires c++11 +PKG_CHECK_MODULES(V8, v8 = 3.32.7, [ pkg_check_v8=yes ], [ pkg_check_v8=no ] ) + +# Rules for building JavaScript plugin +# If enable_javascript=yes and v8 installed = build javascript +# If enable_javascript=automatic and v8 installed = build javascript +# If enable_javascript=yes and v8 not installed = throw an error +build_javascript_plugin=no +if test x$enable_javascript = xyes; then + if test x$pkg_check_v8 = xno; then + [build_javascript_plugin=no] + AC_MSG_ERROR("V8 not found or incorrect version installed") + AC_MSG_NOTICE("To disable building of JavaScript plugin use --disable-javascript") + else + [build_javascript_plugin=yes] + AC_MSG_NOTICE(V8 library found. Building DALi JavaScript plugin) + fi +fi +if test x$enable_javascript = xautomatic && test x$pkg_check_v8 = xyes; then + [build_javascript_plugin=yes] + AC_MSG_NOTICE( V8 library found. Automatic building of JavaScript plugin. Use use --disable-javascript to disable) +fi + + +#set a variable for the makefile to force compile the JAvaSplugin +AM_CONDITIONAL([ENABLE_JAVASCRIPT_PLUGIN], [test x$build_javascript_plugin = xyes]) + AC_SUBST(dataReadWriteDir) AC_SUBST(dataReadOnlyDir) AC_SUBST(DALI_TOOLKIT_CFLAGS) -AC_SUBST(DALI_SCRIPTV8_CFLAGS) -AC_SUBST(DALI_SCRIPTV8_LIBS) + # Specify the include directory for development headers #devincludepath=${includedir}/dali/internal @@ -119,7 +149,7 @@ Configuration ------------- Prefix: $prefix Debug Build: $enable_debug - JavaScript support (V8 required) $enable_javascript + JavaScript support (V8 required) $build_javascript_plugin Profile: $dali_profile Data Dir (Read/Write): $dataReadWriteDir Data Dir (Read Only): $dataReadOnlyDir diff --git a/build/tizen/plugins/Makefile.am b/build/tizen/plugins/Makefile.am index d80dd67..1ca51e4 100644 --- a/build/tizen/plugins/Makefile.am +++ b/build/tizen/plugins/Makefile.am @@ -20,7 +20,6 @@ plugin_src_dir = ../../../plugins include ../../../plugins/dali-script-v8/file.list -DALI_SCRIPTV8_LIBS="-lv8 -lpthread" lib_LTLIBRARIES = libdali-script-plugin-v8.la @@ -46,16 +45,16 @@ libdali_script_plugin_v8_la_CXXFLAGS = -DDALI_COMPILATION \ -DDALI_DATA_READ_ONLY_DIR="\"${dataReadOnlyDir}\"" \ $(DALI_CFLAGS) \ $(DLOG_CFLAGS) \ - $(DALI_SCRIPTV8_CFLAGS) \ -I../../.. \ $(script_plugin_v8_includes) \ + $(V8_CFLAGS) \ -Werror -Wall libdali_script_plugin_v8_la_LIBADD = \ $(DALICORE_LIBS) \ $(DALI_LIBS) \ $(DLOG_LIBS) \ - $(DALI_SCRIPTV8_LIBS) + $(V8_LIBS) libdali_script_plugin_v8_la_LDFLAGS = \ -rdynamic diff --git a/plugins/dali-script-v8/src/dali-wrapper.cpp b/plugins/dali-script-v8/src/dali-wrapper.cpp index 55df482..1bb2dfc 100644 --- a/plugins/dali-script-v8/src/dali-wrapper.cpp +++ b/plugins/dali-script-v8/src/dali-wrapper.cpp @@ -183,7 +183,7 @@ void DaliWrapper::CreateContext( ) // Context = multiple contexts can exist in a given Isolate, and share data between contexts v8::Handle context = v8::Context::New( mIsolate, NULL, global); - mGlobalObjectTemplate.Reset( mIsolate, global); + mGlobalObjectTemplate.Reset( mIsolate, global); mContext.Reset( mIsolate, context); } @@ -192,10 +192,16 @@ void DaliWrapper::Initialize() { if( !mIsolate ) { - v8::V8::Initialize(); v8::V8::InitializeICU(); + + v8::V8::Initialize(); + + // default isolate removed from V8 version 3.27.1 and beyond. + mIsolate = v8::Isolate::New(); + mIsolate->Enter(); + v8::V8::SetFatalErrorHandler( FatalErrorCallback ); - mIsolate = v8::Isolate::GetCurrent(); + } // if context is null, create it and add dali object to the global object. if( mContext.IsEmpty()) diff --git a/plugins/dali-script-v8/src/utils/v8-utils.cpp b/plugins/dali-script-v8/src/utils/v8-utils.cpp index 1d73b9c..d9fbc7e 100644 --- a/plugins/dali-script-v8/src/utils/v8-utils.cpp +++ b/plugins/dali-script-v8/src/utils/v8-utils.cpp @@ -332,7 +332,7 @@ bool GetBooleanValue( v8::Isolate* isolate, const v8::Local& value ) else if (value->IsBooleanObject() ) { const v8::Local object = v8::Local::Cast(value); - return object->ValueOf(); + return object->BooleanValue(); } DALI_SCRIPT_EXCEPTION(isolate, "no bool found"); return false;