Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions cmake/NodeDeps.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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)
49 changes: 25 additions & 24 deletions cmake/V8Deps.cmake
Original file line number Diff line number Diff line change
@@ -1,34 +1,36 @@
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/")
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_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_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/)
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
${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
Expand All @@ -37,13 +39,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
Expand Down
6 changes: 3 additions & 3 deletions examples/pxScene2d/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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.

Expand All @@ -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)
Expand Down
3 changes: 3 additions & 0 deletions examples/pxScene2d/external/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,9 @@ then

fi

# v8
bash buildV8.sh

#-------- BREAKPAD (Non -macOS)

if [ "$(uname)" != "Darwin" ]; then
Expand Down
22 changes: 22 additions & 0 deletions examples/pxScene2d/external/buildV8.bat
Original file line number Diff line number Diff line change
@@ -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 ..
15 changes: 15 additions & 0 deletions examples/pxScene2d/external/buildV8.sh
Original file line number Diff line number Diff line change
@@ -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 ..
2 changes: 2 additions & 0 deletions examples/pxScene2d/external/buildWindows.bat
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 6 additions & 3 deletions examples/pxScene2d/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand All @@ -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}
)
Expand Down Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions examples/pxScene2d/src/mkapp.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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...
#
Expand Down
4 changes: 4 additions & 0 deletions examples/pxScene2d/src/pxscene.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
10 changes: 3 additions & 7 deletions src/rtScriptV8/rtScriptV8.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -867,17 +865,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
Expand Down