diff --git a/CMakeLists.txt b/CMakeLists.txt index 4d7fc7bf2f..4f8e33dfa8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -25,7 +25,8 @@ option(SHARED_V8 "use system shared V8 library") option(SHARED_LIBEV "use system shared libev library") option(SHARED_CARES "use system shared c-ares library") option(V8_SNAPSHOT "turn on snapshot when building stock v8") - +option(V8_OPROFILE "Add oprofile support") +option(V8_GDBJIT "add gdbjit support") # cmake policies to get rid of some warnings cmake_policy(SET CMP0009 NEW) # GLOB_RECURSE should no follow symlinks diff --git a/cmake/v8_build.cmake b/cmake/v8_build.cmake index b35caef2e6..b1ae43fe78 100644 --- a/cmake/v8_build.cmake +++ b/cmake/v8_build.cmake @@ -14,7 +14,15 @@ endif() if(NOT SHARED_V8) if(V8_SNAPSHOT) - set(v8snapshot snapshot=on) + set(v8_snapshot snapshot=on) + endif() + + if(V8_OPROFILE) + set(v8_oprofile prof=oprofile) + endif() + + if(V8_GDBJIT) + set(v8_gdbjit gdbjit=on) endif() if(${node_platform} MATCHES darwin) @@ -40,6 +48,9 @@ if(NOT SHARED_V8) set(compile_env_vars "CC=${CMAKE_C_COMPILER} CXX=${CMAKE_CXX_COMPILER} AR=${CMAKE_AR} RANLIB=${CMAKE_RANLIB} CFLAGS=\"${CMAKE_C_FLAGS}\" CXXFLAGS=\"${CMAKE_CXX_FLAGS}\" LDFLAGS=\"${CMAKE_EXE_LINKER_FLAGS}\"") + set(compile_cmd "${compile_env_vars} ${PYTHON_EXECUTABLE} ${PROJECT_BINARY_DIR}/tools/scons/scons.py -j ${parallel_jobs} visibility=default mode=${v8mode} arch=${v8arch} library=static ${v8_snapshot} ${v8_oprofile} ${v8_gdbjit} verbose=on") + + if(CMAKE_VERSION VERSION_GREATER 2.8 OR CMAKE_VERSION VERSION_EQUAL 2.8) # use ExternalProject for CMake >2.8 include(ExternalProject) @@ -48,8 +59,7 @@ if(NOT SHARED_V8) URL ${PROJECT_SOURCE_DIR}/deps/v8 BUILD_IN_SOURCE True - BUILD_COMMAND sh -c "${compile_env_vars} ${PYTHON_EXECUTABLE} ${PROJECT_BINARY_DIR}/tools/scons/scons.py library=static visibility=default ${v8snapshot} mode=${v8mode} verbose=on arch=${v8arch} -j ${parallel_jobs}" - + BUILD_COMMAND sh -c "${compile_cmd}" SOURCE_DIR ${PROJECT_BINARY_DIR}/deps/v8 # ignore this stuff, it's not needed for building v8 but ExternalProject # demands these steps @@ -79,7 +89,7 @@ if(NOT SHARED_V8) add_custom_command( OUTPUT ${PROJECT_BINARY_DIR}/deps/v8/${v8_fn} - COMMAND sh -c "${compile_env_vars} ${PYTHON_EXECUTABLE} ${PROJECT_BINARY_DIR}/tools/scons/scons.py library=static visibility=default ${v8snapshot} mode=${v8mode} verbose=on arch=${v8arch} -j ${parallel_jobs}" + COMMAND sh -c "${compile_cmd}" WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/deps/v8/ DEPENDS ${v8_sources_dest} )