Skip to content

Commit

Permalink
Use googletest attached in V8
Browse files Browse the repository at this point in the history
  • Loading branch information
YoshiyukiMineo committed Oct 2, 2018
1 parent 13c4273 commit f6dfbc6
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 36 deletions.
6 changes: 4 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,19 @@ include_directories(
v8
v8/include
src
test/googletest/googletest/include
v8/third_party/googletest/src/googletest/include
)

set(v8eval-linkdirs
v8/out.gn/x64.release/obj
v8/out.gn/x64.release/obj/third_party/googletest
)

if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
set(v8eval-linkdirs
${v8eval-linkdirs}
v8/out.gn/x64.release/obj/buildtools/third_party
v8/out.gn/x64.release/obj/buildtools/third_party/libc++
v8/out.gn/x64.release/obj/buildtools/third_party/libc++abi
)
endif(CMAKE_SYSTEM_NAME STREQUAL "Linux")

Expand Down
49 changes: 20 additions & 29 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,6 @@ install_depot_tools() {
git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git
}

install_googletest() {
if [ -d ${V8EVAL_ROOT}/test/googletest ]; then
return 0
fi

cd ${V8EVAL_ROOT}/test
git clone https://github.com/google/googletest.git
git checkout release-1.7.0
}

install_v8() {
if [ -d ${V8EVAL_ROOT}/v8 ]; then
return 0
Expand All @@ -52,44 +42,45 @@ install_v8() {
ninja -v -C out.gn/x64.release
}

archive_v8_lib() {
archive_lib() {
if [ -f ${1}/lib${2}.a ]; then
return 0
fi

ar cr ${1}/lib${2}.a ${1}/${2}/*.o
}

V8_OUT=${V8EVAL_ROOT}/v8/out.gn/x64.release/obj

archive_v8() {
V8_OUT=${V8EVAL_ROOT}/v8/out.gn/x64.release/obj
archive_v8_lib ${V8_OUT} v8_base
archive_v8_lib ${V8_OUT} v8_libsampler
archive_v8_lib ${V8_OUT} v8_init
archive_v8_lib ${V8_OUT} v8_initializers
archive_v8_lib ${V8_OUT} v8_nosnapshot
archive_v8_lib ${V8_OUT} torque_generated_initializers
archive_lib ${V8_OUT} v8_base
archive_lib ${V8_OUT} v8_libsampler
archive_lib ${V8_OUT} v8_init
archive_lib ${V8_OUT} v8_initializers
archive_lib ${V8_OUT} v8_nosnapshot
archive_lib ${V8_OUT} torque_generated_initializers
}

archive_stdlib() {
if [ -f ${1}/${2}.a ]; then
return 0
fi
archive_libcxx() {
archive_lib ${V8_OUT}/buildtools/third_party/libc++ libc++
}

ar cr ${1}/${2}.a ${1}/${2}/${2}/*.o
archive_libcxxabi() {
archive_lib ${V8_OUT}/buildtools/third_party/libc++abi libc++abi
}

archive_stdlibs() {
STDLIB_OUT=${V8EVAL_ROOT}/v8/out.gn/x64.release/obj/buildtools/third_party
archive_stdlib ${STDLIB_OUT} libc++
archive_stdlib ${STDLIB_OUT} libc++abi
archive_googletest() {
archive_lib ${V8_OUT}/third_party/googletest gtest
archive_lib ${V8_OUT}/third_party/googletest gtest_main
}

build() {
install_depot_tools
install_v8
archive_v8
if [ ${PLATFORM} = "Linux" ]; then
archive_stdlibs
archive_libcxx
archive_libcxxabi
fi

cd ${V8EVAL_ROOT}
Expand All @@ -110,7 +101,7 @@ docs() {

test() {
build
install_googletest
archive_googletest

cd ${V8EVAL_ROOT}/build
cmake -DCMAKE_BUILD_TYPE=Release -DV8EVAL_TEST=ON ..
Expand Down
1 change: 0 additions & 1 deletion test/.gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
/googletest
/v8eval_test
6 changes: 2 additions & 4 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,11 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
dl
rt
pthread
c++
c++abi
libc++
libc++abi
)
endif(CMAKE_SYSTEM_NAME STREQUAL "Linux")

target_link_libraries(v8eval-test
${v8eval-linklibs}
)

add_subdirectory(googletest/googletest)

0 comments on commit f6dfbc6

Please sign in to comment.