Skip to content

Commit

Permalink
Generalize build script to be used in CMake based builds.
Browse files Browse the repository at this point in the history
  • Loading branch information
oliver7654 committed Mar 24, 2013
1 parent 7b8e365 commit 78ca185
Show file tree
Hide file tree
Showing 13 changed files with 163 additions and 302 deletions.
14 changes: 3 additions & 11 deletions CMakeLists.txt
Expand Up @@ -4,27 +4,19 @@ cmake_minimum_required(VERSION 2.8.4)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR}/config)

set(EXTERNALS_DIR ${PROJECT_SOURCE_DIR}/build/ext CACHE STRING "Directory where external projects should be downloaded to")
set(EXTERNALS_ONLY OFF CACHE BOOL "Set this if you want to build externals only. (ON|OFF)")
set(ENABLE_JSC ON CACHE BOOL "Build JSC extension. (ON|OFF)")
set(ENABLE_V8 OFF CACHE BOOL "Build V8 extension. Note: node extensions are built using node-gyp.")
set(ENABLE_TESTS OFF CACHE BOOL "Enable test suite. (ON|OFF)")
set(SWIG_COMMAND "" CACHE PATH "Path to swig executable. REQUIRED")

# Configure external projects
# ===========================
if (EXTERNALS_ONLY OR IMPORT)
set (DOWNLOAD_EXTERNALS ON)
endif()

include(Externals)

# Process subdirectories
# ======================
if (NOT EXTERNALS_ONLY OR IMPORT)

include(ExportTarget)
include(ConfigureVariables)

add_subdirectory(src/native)
include(ExportTarget)
include(ConfigureVariables)

endif () # EXTERNALS_ONLY
add_subdirectory(src/native)
40 changes: 0 additions & 40 deletions config/BoostMinimal.cmake

This file was deleted.

30 changes: 22 additions & 8 deletions config/Externals.cmake
@@ -1,12 +1,12 @@
include(ExternalProject)

FIND_PACKAGE(Boost)
if(NOT Boost_FOUND)
include(BoostMinimal)
endif()
FIND_PACKAGE(Boost REQUIRED)

if(ENABLE_TESTS)
include(GTest-1.6)
set (GTEST_DIR ${EXTERNALS_DIR}/gtest)
set(GTEST_INCLUDE_DIRS ${GTEST_DIR}/gtest/include)
set(GTEST_LIB_DIRS ${GTEST_DIR}/bin)
set(GTEST_LIBS gtest gtest_main)
endif()

if(ENABLE_JSC)
Expand All @@ -20,9 +20,23 @@ endif()
if(NOT EXISTS ${SWIG_COMMAND})
FIND_PROGRAM(SWIG_COMMAND NAMES preinst-swig)
if(NOT EXISTS ${SWIG_COMMAND})
include(SwigJS)
FIND_PROGRAM(SWIG_COMMAND NAMES swig)
if(NOT EXISTS ${SWIG_COMMAND})
message(FATAL_ERROR "SWIG_COMMAND required: swig or preinst-swig")
endif()
endif()
endif()

include(JSObjects)
include(Hiredis)
# jsobjects
set(JSOBJECTS_DIR ${EXTERNALS_DIR}/jsobjects)
if(NOT EXISTS ${JSOBJECTS_DIR})
message(FATAL_ERROR "JSOBJECTS_DIR does not exist: ${JSOBJECTS_DIR}.")
endif()
set(jsobjects_INCLUDE_DIRS ${JSOBJECTS_DIR}/include)
set(jsobjects_SWIG_INCLUDE_DIRS ${JSOBJECTS_DIR}/swig)

# hiredis
set (HIREDIS_DIR ${EXTERNALS_DIR}/hiredis)
set(HIREDIS_INCLUDE_DIRS ${HIREDIS_DIR})
set(HIREDIS_LIB_DIRS "${HIREDIS_DIR}")
set(HIREDIS_LIBS libhiredis.a)
29 changes: 0 additions & 29 deletions config/GTest-1.6.cmake

This file was deleted.

26 changes: 0 additions & 26 deletions config/Hiredis.cmake

This file was deleted.

26 changes: 0 additions & 26 deletions config/JSObjects.cmake

This file was deleted.

1 change: 0 additions & 1 deletion config/JavaScriptCore.cmake
@@ -1,4 +1,3 @@

if(APPLE)
find_library(JSC JavaScriptCore)

Expand Down
24 changes: 0 additions & 24 deletions config/Redis.cmake

This file was deleted.

56 changes: 0 additions & 56 deletions config/SwigJS.cmake

This file was deleted.

1 change: 0 additions & 1 deletion config/V8.cmake
@@ -1,6 +1,5 @@
find_path(V8_INCLUDE_DIR v8.h)
find_library(V8 v8)

if (V8_INCLUDE_DIR-NOTFOUND OR V8-NOTFOUND )
message(FATAL_ERROR "Could not find v8.")
endif()
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -15,7 +15,7 @@
"underscore": "1.4.x"
},
"scripts": {
"preinstall" : "./update_dependencies.sh && node-gyp configure build"
"preinstall" : "./update.sh && node-gyp configure build"
},
"main": "./src/store.js",
"directories": {
Expand Down

0 comments on commit 78ca185

Please sign in to comment.