From 9e9241b7cbe8650b7d2f696a39aedfd774f48e40 Mon Sep 17 00:00:00 2001 From: Kuts Alexey Date: Sun, 15 Jul 2018 08:46:05 +0100 Subject: [PATCH 1/5] v8 separate external windows part --- cmake/V8Deps.cmake | 28 ++++++++------------ examples/pxScene2d/README.md | 2 +- examples/pxScene2d/external/buildV8.bat | 22 +++++++++++++++ examples/pxScene2d/external/buildWindows.bat | 2 ++ examples/pxScene2d/src/CMakeLists.txt | 5 +++- src/rtScriptV8/rtScriptV8.cpp | 8 +++--- 6 files changed, 43 insertions(+), 24 deletions(-) create mode 100644 examples/pxScene2d/external/buildV8.bat diff --git a/cmake/V8Deps.cmake b/cmake/V8Deps.cmake index 75e4a50dab..3e2340f3fc 100644 --- a/cmake/V8Deps.cmake +++ b/cmake/V8Deps.cmake @@ -1,25 +1,19 @@ set(NODEDIR "${EXTDIR}/libnode-v6.9.0/") -set(V8_INCLUDE_DIRS ${NODEDIR}/src ${NODEDIR}/deps/uv/include ${NODEDIR}/deps/v8/include ${NODEDIR}/deps/cares/include) +set(V8DIR "${EXTDIR}/v8/") if (WIN32) - set(V8_INCLUDE_DIRS ${V8_INCLUDE_DIRS} - ${NODEDIR}/deps/openssl/openssl/include ${NODEDIR}/deps/http_parser - ${NODEDIR}/deps/v8_inspector/third_party/v8_inspector/ - ${NODEDIR}/deps/icu-small/source/common/unicode - ${NODEDIR}/Release/obj/global_intermediate/blink - ${NODEDIR}/Release/obj/global_intermediate - ${NODEDIR}/Release/obj/gen/blink - ${NODEDIR}/deps/icu-small/source/common - ${NODEDIR}/tools/msvs/genfiles - ) - set(V8_LIBRARY_DIRS ${NODEDIR}build/Release/lib ${NODEDIR}Release/lib ${NODEDIR}Release) + set(V8_INCLUDE_DIRS ${V8DIR}/include + ${NODEDIR}/deps/uv/include + ${NODEDIR}/deps/cares/include + ${NODEDIR}/deps/openssl/openssl/include + ${NODEDIR}/deps/icu-small/source/common/unicode + ${NODEDIR}/deps/icu-small/source/common) + set(V8_LIBRARY_DIRS ${V8DIR}/out.gn/ia32.release ${NODEDIR}build/Release/lib ${NODEDIR}Release/lib ${NODEDIR}Release) set(V8_LIBRARIES - v8_libplatform.lib v8_libbase.lib v8_nosnapshot.lib v8_snapshot.lib v8_base_0.lib - v8_base_1.lib v8_base_2.lib v8_base_3.lib - gtest.lib cares.lib http_parser.lib + v8.dll.lib v8_libbase.dll.lib v8_libplatform.dll.lib icutools.lib icustubdata.lib icudata.lib icuucx.lib icui18n.lib - libuv.lib openssl.lib v8_inspector_stl.lib cctest.lib - ) + winmm.lib dbghelp.lib shlwapi.lib + libuv.lib openssl.lib) elseif (APPLE) set(V8_LIBRARY_DIRS ${NODEDIR}) set (V8_INCLUDE_DIRS ${V8_INCLUDE_DIRS} ${NODEDIR}/deps/icu-small/source/common/) diff --git a/examples/pxScene2d/README.md b/examples/pxScene2d/README.md index 31d55799df..43a5e60df5 100644 --- a/examples/pxScene2d/README.md +++ b/examples/pxScene2d/README.md @@ -44,7 +44,7 @@ >Setup Windows 10 > * Windows 10 > * Visual Studio 2017 community with `Desktop development with C++` workload -> * [windows sdk 10.0.16299.0](https://developer.microsoft.com/en-us/windows/downloads/windows-10-sdk),it is included in VS2017 with above workload and only necessary if you have issue to install with VS2017) +> * [windows sdk 10.0.16299 and windows sdk 10.0.17134(aka 1803)] (https://developer.microsoft.com/en-us/windows/downloads/sdk-archive) > * python 2.7.x , make sure python can work in cmd (setup environment variables depending on install location) > * git for windows , make sure git can work in cmd (setup environment variables depending on install location) > * patch utility for windows (this comes with git. setup environment variables depending on install location of patch.exe) diff --git a/examples/pxScene2d/external/buildV8.bat b/examples/pxScene2d/external/buildV8.bat new file mode 100644 index 0000000000..34a989ba91 --- /dev/null +++ b/examples/pxScene2d/external/buildV8.bat @@ -0,0 +1,22 @@ +@where msbuild 2> nul +@if %errorlevel% neq 0 ( + @echo. + @echo Please execute this file from inside Visual Studio's Developer Command Prompt + @echo. + pause + goto :eof +) + +cmd /c git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git depot_tools +set PATH=%cd%\depot_tools;%PATH% + +cmd.exe /c gclient + +cmd /c fetch v8 +cd v8 + +cmd /c gclient sync --no-history --with_tags -r 6.9.351 +cmd /c python tools/dev/v8gen.py ia32.release -- is_debug=false v8_enable_i18n_support=false target_cpu=\"x86\" is_component_build=true v8_static_library=true + +cmd /c ninja -C out.gn/ia32.release +cd .. diff --git a/examples/pxScene2d/external/buildWindows.bat b/examples/pxScene2d/external/buildWindows.bat index 84d9989e04..128e8ed6e9 100644 --- a/examples/pxScene2d/external/buildWindows.bat +++ b/examples/pxScene2d/external/buildWindows.bat @@ -16,6 +16,8 @@ cd vc.build\ msbuild external.sln /p:Configuration=Release /p:Platform=Win32 /m cd .. +CALL buildV8.bat + cd breakpad-chrome_55 CALL gyp\gyp.bat src\client\windows\breakpad_client.gyp --no-circular-check cd src\client\windows diff --git a/examples/pxScene2d/src/CMakeLists.txt b/examples/pxScene2d/src/CMakeLists.txt index e5aeb6f080..b01406237e 100644 --- a/examples/pxScene2d/src/CMakeLists.txt +++ b/examples/pxScene2d/src/CMakeLists.txt @@ -475,7 +475,10 @@ if (BUILD_PXSCENE_APP) file(GLOB PXSCENE_INSTALL_FILES "${CMAKE_CURRENT_SOURCE_DIR}/FreeSans.ttf" "${CMAKE_CURRENT_SOURCE_DIR}/*.json" "${CMAKE_CURRENT_SOURCE_DIR}/*.conf" - "${CMAKE_CURRENT_SOURCE_DIR}/../external/vc.build/builds/*.dll" "${CMAKE_CURRENT_SOURCE_DIR}/Release/") + "${CMAKE_CURRENT_SOURCE_DIR}/../external/vc.build/builds/*.dll" + "${CMAKE_CURRENT_SOURCE_DIR}/../external/v8/out.gn/ia32.release/v8*.dll" + "${CMAKE_CURRENT_SOURCE_DIR}/../external/v8/out.gn/ia32.release/*.bin" + "${CMAKE_CURRENT_SOURCE_DIR}/Release/") if (SUPPORT_DUKTAPE) message("installing additional duktape files") install(FILES ${PXSCENE_INSTALL_FILES_JS2} DESTINATION . COMPONENT pxscene) diff --git a/src/rtScriptV8/rtScriptV8.cpp b/src/rtScriptV8/rtScriptV8.cpp index e250bfa363..8570fc089b 100755 --- a/src/rtScriptV8/rtScriptV8.cpp +++ b/src/rtScriptV8/rtScriptV8.cpp @@ -867,17 +867,15 @@ rtError rtScriptV8::init() udata_setCommonData(&SMALL_ICUDATA_ENTRY_POINT, &status); v8::V8::InitializeICU(); + v8::V8::InitializeExternalStartupData(""); mUvLoop = uv_default_loop(); Platform* platform = platform::CreateDefaultPlatform(); mPlatform = platform; V8::InitializePlatform(platform); V8::Initialize(); + Isolate::CreateParams params; - array_buffer_allocator = new V8ArrayBufferAllocator(); - const char* source1 = "function pxSceneFooFunction(){ return 0;}"; - static v8::StartupData data = v8::V8::CreateSnapshotDataBlob(source1); - params.snapshot_blob = &data; - params.array_buffer_allocator = array_buffer_allocator; + params.array_buffer_allocator = v8::ArrayBuffer::Allocator::NewDefaultAllocator(); mIsolate = Isolate::New(params); #if 0 From 71b47dd791b1edc54cb42d6ee25741db6aaf568c Mon Sep 17 00:00:00 2001 From: Alexey Kuts Date: Sun, 15 Jul 2018 12:30:15 +0300 Subject: [PATCH 2/5] v8 external linux part --- cmake/NodeDeps.cmake | 2 ++ cmake/V8Deps.cmake | 15 +++++++-------- examples/pxScene2d/external/build.sh | 3 +++ examples/pxScene2d/external/buildV8.sh | 15 +++++++++++++++ examples/pxScene2d/src/CMakeLists.txt | 4 ++-- examples/pxScene2d/src/pxscene.sh | 4 ++++ src/CMakeLists.txt | 2 +- src/rtScriptV8/rtScriptV8.cpp | 2 -- 8 files changed, 34 insertions(+), 13 deletions(-) create mode 100644 examples/pxScene2d/external/buildV8.sh diff --git a/cmake/NodeDeps.cmake b/cmake/NodeDeps.cmake index 21d5972180..cd23c89c5d 100644 --- a/cmake/NodeDeps.cmake +++ b/cmake/NodeDeps.cmake @@ -94,4 +94,6 @@ if (SUPPORT_NODE) add_definitions(-DRTSCRIPT_SUPPORT_NODE) else (SUPPORT_NODE) unset(NODE_LIBRARIES) + unset(NODE_INCLUDE_DIRS) + unset(NODE_LIBRARY_DIRS) endif (SUPPORT_NODE) diff --git a/cmake/V8Deps.cmake b/cmake/V8Deps.cmake index 3e2340f3fc..1cd7e06dd1 100644 --- a/cmake/V8Deps.cmake +++ b/cmake/V8Deps.cmake @@ -1,13 +1,13 @@ set(NODEDIR "${EXTDIR}/libnode-v6.9.0/") set(V8DIR "${EXTDIR}/v8/") - -if (WIN32) - set(V8_INCLUDE_DIRS ${V8DIR}/include +set(V8_INCLUDE_DIRS ${V8DIR}/include ${NODEDIR}/deps/uv/include ${NODEDIR}/deps/cares/include ${NODEDIR}/deps/openssl/openssl/include ${NODEDIR}/deps/icu-small/source/common/unicode ${NODEDIR}/deps/icu-small/source/common) + +if (WIN32) set(V8_LIBRARY_DIRS ${V8DIR}/out.gn/ia32.release ${NODEDIR}build/Release/lib ${NODEDIR}Release/lib ${NODEDIR}Release) set(V8_LIBRARIES v8.dll.lib v8_libbase.dll.lib v8_libplatform.dll.lib @@ -21,8 +21,8 @@ elseif (APPLE) else () set (V8_INCLUDE_DIRS ${V8_INCLUDE_DIRS} ${NODEDIR}/deps/icu-small/source/common/) set(V8_LIBRARY_DIRS + ${V8DIR}/out.gn/x64.release/obj ${NODEDIR}/out/Release/obj.target - ${NODEDIR}/out/Release/obj.target/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector ${NODEDIR}/out/Release/obj.target/deps/uv ${NODEDIR}/out/Release/obj.target/deps/v8/tools/gyp ${NODEDIR}/out/Release/obj.target/deps/cares @@ -31,13 +31,12 @@ else () ${NODEDIR}out/Release/obj.target/tools/icu ) set(V8_LIBRARIES - v8_inspector_stl - uv - v8_snapshot v8_base - v8_nosnapshot + v8_external_snapshot v8_libplatform + v8_libsampler v8_libbase + uv cares zlib http_parser diff --git a/examples/pxScene2d/external/build.sh b/examples/pxScene2d/external/build.sh index 41f755ab52..816f2d93c7 100755 --- a/examples/pxScene2d/external/build.sh +++ b/examples/pxScene2d/external/build.sh @@ -139,6 +139,9 @@ then fi +# v8 +bash buildV8.sh + #-------- BREAKPAD (Non -macOS) if [ "$(uname)" != "Darwin" ]; then diff --git a/examples/pxScene2d/external/buildV8.sh b/examples/pxScene2d/external/buildV8.sh new file mode 100644 index 0000000000..621eff3332 --- /dev/null +++ b/examples/pxScene2d/external/buildV8.sh @@ -0,0 +1,15 @@ +#!/bin/bash + +git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git depot_tools +export PATH=$PWD/depot_tools/:$PATH + +gclient + +fetch v8 +cd v8 + +gclient sync --no-history --with_tags -r 6.9.351 +python tools/dev/v8gen.py x64.release -- is_debug=false v8_enable_i18n_support=false target_cpu=\"x64\" is_component_build=false v8_static_library=true use_custom_libcxx = false use_custom_libcxx_for_host = false + +ninja -C out.gn/x64.release v8 +cd .. diff --git a/examples/pxScene2d/src/CMakeLists.txt b/examples/pxScene2d/src/CMakeLists.txt index b01406237e..788feb86dc 100644 --- a/examples/pxScene2d/src/CMakeLists.txt +++ b/examples/pxScene2d/src/CMakeLists.txt @@ -94,7 +94,7 @@ if (APPLE) set(PXSCENE_LINK_LIBRARIES) set(PXSCENE_LINK_DIRECTORIES ${PXSCENE_LINK_DIRECTORIES} ${NODE_LIBRARY_DIRS} ${V8_LIBRARY_DIRS} ${DUKE_LIBRARY_DIRS} ${COMM_DEPS_LIBRARY_DIRS}) set(PLATFORM_LIBRARIES pxCore rtCore_s pthread ${NODE_LIBRARIES} ${V8_LIBRARIES} ${DUKE_LIBRARIES} ${COMM_DEPS_LIBRARIES}) - include_directories(AFTER ${NODE_INCLUDE_DIRS} ${V8_INCLUDE_DIRS} ${DUKE_INCLUDE_DIRS} ${COMM_DEPS_INCLUDE_DIRS}) + include_directories(AFTER ${NODE_INCLUDE_DIRS} ${DUKE_INCLUDE_DIRS} ${COMM_DEPS_INCLUDE_DIRS}) if (DEFINED ENV{CODE_COVERAGE}) message("enabling code coverage support") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fprofile-arcs -ftest-coverage -fno-inline") @@ -116,8 +116,8 @@ elseif (CMAKE_HOST_SYSTEM_NAME STREQUAL "Linux") add_definitions(${COMM_DEPS_DEFINITIONS}) include_directories(AFTER - ${NODE_INCLUDE_DIRS} ${V8_INCLUDE_DIRS} + ${NODE_INCLUDE_DIRS} ${DUKE_INCLUDE_DIRS} ${COMM_DEPS_INCLUDE_DIRS} ) diff --git a/examples/pxScene2d/src/pxscene.sh b/examples/pxScene2d/src/pxscene.sh index f20df00ff9..042ddef377 100755 --- a/examples/pxScene2d/src/pxscene.sh +++ b/examples/pxScene2d/src/pxscene.sh @@ -17,6 +17,10 @@ export LD_LIBRARY_PATH=$PathR export NODE_PATH=. +# bin files +ln -fs $externalDir/v8/out.gn/x64.release/natives_blob.bin +ln -fs $externalDir/v8/out.gn/x64.release/snapshot_blob.bin + #export RT_LOG_LEVEL=info #valgrind integration diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 9197a7a826..9a92a497ff 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -63,7 +63,7 @@ if (APPLE) endif () elseif (CMAKE_HOST_SYSTEM_NAME STREQUAL "Linux") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC -g") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-deprecated -fPIC -g") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-deprecated-declarations -Wno-deprecated -fPIC -g") execute_process(COMMAND "hostname" OUTPUT_VARIABLE HOSTNAME) string(STRIP ${HOSTNAME} HOSTNAME) diff --git a/src/rtScriptV8/rtScriptV8.cpp b/src/rtScriptV8/rtScriptV8.cpp index 8570fc089b..e8a3f47198 100755 --- a/src/rtScriptV8/rtScriptV8.cpp +++ b/src/rtScriptV8/rtScriptV8.cpp @@ -74,8 +74,6 @@ extern "C" const char U_DATA_API SMALL_ICUDATA_ENTRY_POINT[]; #include "rtScriptV8.h" -#include "node.h" - #include "rtCore.h" #include "rtObject.h" #include "rtValue.h" From fa135a5700d081566fd6142913bc6114b7a559e0 Mon Sep 17 00:00:00 2001 From: Admin Date: Sun, 15 Jul 2018 17:32:52 +0300 Subject: [PATCH 3/5] macos v8 external --- cmake/V8Deps.cmake | 12 ++++++++++-- examples/pxScene2d/external/build.sh | 2 +- examples/pxScene2d/src/mkapp.sh | 1 + 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/cmake/V8Deps.cmake b/cmake/V8Deps.cmake index 1cd7e06dd1..fc9f0eefcd 100644 --- a/cmake/V8Deps.cmake +++ b/cmake/V8Deps.cmake @@ -15,9 +15,17 @@ if (WIN32) winmm.lib dbghelp.lib shlwapi.lib libuv.lib openssl.lib) elseif (APPLE) - set(V8_LIBRARY_DIRS ${NODEDIR}) set (V8_INCLUDE_DIRS ${V8_INCLUDE_DIRS} ${NODEDIR}/deps/icu-small/source/common/) - set(V8_LIBRARIES node) + set(V8_LIBRARY_DIRS + ${V8DIR}/out.gn/x64.release/obj + ${NODEDIR}) + set(V8_LIBRARIES + v8_base + v8_external_snapshot + v8_libplatform + v8_libsampler + v8_libbase + node) else () set (V8_INCLUDE_DIRS ${V8_INCLUDE_DIRS} ${NODEDIR}/deps/icu-small/source/common/) set(V8_LIBRARY_DIRS diff --git a/examples/pxScene2d/external/build.sh b/examples/pxScene2d/external/build.sh index 816f2d93c7..afb0002b9f 100755 --- a/examples/pxScene2d/external/build.sh +++ b/examples/pxScene2d/external/build.sh @@ -140,7 +140,7 @@ then fi # v8 -bash buildV8.sh +# bash buildV8.sh #-------- BREAKPAD (Non -macOS) diff --git a/examples/pxScene2d/src/mkapp.sh b/examples/pxScene2d/src/mkapp.sh index c225934a38..ee4d7037f7 100755 --- a/examples/pxScene2d/src/mkapp.sh +++ b/examples/pxScene2d/src/mkapp.sh @@ -29,6 +29,7 @@ cp $externalDir/curl/lib/.libs/libcurl.4.dylib $bundleLib cp $externalDir/libnode-v6.9.0/out/Release/libnode*.dylib $bundleLib cp $externalDir/ft/objs/.libs/libfreetype.6.dylib $bundleLib cp $externalDir/jpg/.libs/libjpeg.9.dylib $bundleLib +cp $externalDir/v8/out.gn/x64.release/*.bin $bundleBin # Copy OTHER to Bundle... # From afaa8d12e731cb57c68d1476e6895a01334ec0e5 Mon Sep 17 00:00:00 2001 From: Admin Date: Sun, 15 Jul 2018 17:35:07 +0300 Subject: [PATCH 4/5] macos added docs --- examples/pxScene2d/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/pxScene2d/README.md b/examples/pxScene2d/README.md index 43a5e60df5..59fa048bc9 100644 --- a/examples/pxScene2d/README.md +++ b/examples/pxScene2d/README.md @@ -6,7 +6,7 @@ ## Minimum requirements >macOS -> * OS : Macbook Pro (macOS Sierra) +> * OS : Macbook Pro (macOS Sierra >=10.12) > * RAM Size : 256 MB > * Disk space : 24 MB > * Processor speed : 1 GHz @@ -32,7 +32,7 @@ ## macOS Setup >Install Xcode, CMake and quilt -> * Download the latest version of Xcode from https://developer.apple.com/xcode/download/ +> * Download the latest version of Xcode (>=9.2) from https://developer.apple.com/xcode/download/ > * Download and install the latest version of brew from https://brew.sh/ > * From terminal install dependencies: cmake, pkg-config, quilt, java. From 8868d74cdd1817f5c10007676ea2415b7534190b Mon Sep 17 00:00:00 2001 From: Kuts Alexey Date: Sun, 15 Jul 2018 17:36:34 +0300 Subject: [PATCH 5/5] Update build.sh --- examples/pxScene2d/external/build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/pxScene2d/external/build.sh b/examples/pxScene2d/external/build.sh index afb0002b9f..816f2d93c7 100755 --- a/examples/pxScene2d/external/build.sh +++ b/examples/pxScene2d/external/build.sh @@ -140,7 +140,7 @@ then fi # v8 -# bash buildV8.sh +bash buildV8.sh #-------- BREAKPAD (Non -macOS)