Skip to content

Commit

Permalink
Add FindV8.cmake
Browse files Browse the repository at this point in the history
  • Loading branch information
jhanssen committed May 20, 2015
1 parent 9728cbc commit a8c183e
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 3 deletions.
45 changes: 45 additions & 0 deletions cmake/FindV8.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# Locate V8
# This module defines
# V8_LIBRARY
# V8_FOUND, if false, do not try to link to gdal
# V8_INCLUDE_DIR, where to find the headers
#
# $V8_DIR is an environment variable that would
# correspond to the ./configure --prefix=$V8_DIR
#
# Created by Robert Osfield (based on FindFLTK.cmake)

FIND_PATH(V8_INCLUDE_DIR v8.h
$ENV{V8_DIR}/include
$ENV{V8_DIR}
~/Library/Frameworks
/Library/Frameworks
/usr/local/include
/usr/include
/sw/include # Fink
/opt/local/include # DarwinPorts
/opt/csw/include # Blastwave
/opt/include
/usr/freeware/include
)

FIND_LIBRARY(V8_LIBRARY
NAMES v8 libv8
PATHS
$ENV{V8_DIR}/lib
$ENV{V8_DIR}
~/Library/Frameworks
/Library/Frameworks
/usr/local/lib
/usr/lib
/sw/lib
/opt/local/lib
/opt/csw/lib
/opt/lib
/usr/freeware/lib64
)

SET(V8_FOUND "NO")
IF(V8_LIBRARY AND V8_INCLUDE_DIR)
SET(V8_FOUND "YES")
ENDIF()
7 changes: 4 additions & 3 deletions rct.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -146,12 +146,13 @@ endif ()


if (RCT_BUILD_SCRIPTENGINE)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_LIST_DIR}/cmake/")
find_package(V8)
if (V8_FOUND EQUAL 1)
if (V8_FOUND STREQUAL "YES")
set(HAVE_SCRIPTENGINE 1)
message("Building ScriptEngine")
set(RCT_SOURCES ${RCT_SOURCES} ${CMAKE_CURRENT_LIST_DIR}/rct/ScriptEngine.cpp)
include_directories(${V8_INCLUDE})
include_directories(${V8_INCLUDE_DIR})
endif ()
endif ()

Expand Down Expand Up @@ -185,7 +186,7 @@ if (CMAKE_SYSTEM_NAME MATCHES "Darwin")
find_path(COREFOUNDATION_INCLUDE "CoreFoundation/CoreFoundation.h")
endif ()

set(RCT_LIBRARIES pthread ${ZLIB_LIBRARIES} ${V8_LIBS} ${DB_LIBS} ${OPENSSL_CRYPTO_LIBRARY})
set(RCT_LIBRARIES pthread ${ZLIB_LIBRARIES} ${V8_LIBRARY} ${DB_LIBS} ${OPENSSL_CRYPTO_LIBRARY})
if (CMAKE_SYSTEM_NAME MATCHES "Linux")
list(APPEND RCT_LIBRARIES dl rt)
endif ()
Expand Down

0 comments on commit a8c183e

Please sign in to comment.