From 7f2b1ced8075c140c85d56af94fe3a83906194d0 Mon Sep 17 00:00:00 2001 From: Sara Golemon Date: Fri, 27 Dec 2013 02:26:06 -0800 Subject: [PATCH] Remove the need to export HPHP_HOME when building "Detect" HPHP_HOME as the location of the main CMakeLists.txt file and plumb it through to child scripts from there. --- CMakeLists.txt | 20 ++++++++------------ configure_ubuntu_12.04.sh | 3 +-- hphp/runtime/ext_hhvm/CMakeLists.txt | 3 ++- hphp/tools/generated_files.sh | 4 +++- hphp/util/CMakeLists.txt | 2 +- 5 files changed, 15 insertions(+), 17 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ea6881ba7..aae6497d7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,18 +5,14 @@ IF(NOT CMAKE_SIZEOF_VOID_P EQUAL 8) message(FATAL_ERROR "HHVM requires a 64bit OS") ENDIF() -IF("$ENV{HPHP_HOME}" STREQUAL "") - message(FATAL_ERROR "You should set the HPHP_HOME environmental") -ENDIF() +set(HPHP_HOME "$ENV{HPHP_HOME}") +if (NOT HPHP_HOME) + set(HPHP_HOME "${CMAKE_CURRENT_SOURCE_DIR}") +endif() +message("Using HPHP_HOME == ${HPHP_HOME}") -file(TO_CMAKE_PATH "$ENV{HPHP_HOME}" HPHP_HOME) - -IF(NOT IS_DIRECTORY ${HPHP_HOME}) - message(FATAL_ERROR "The value of HPHP_HOME does not exist") -ENDIF() - -IF(NOT EXISTS "${HPHP_HOME}/LICENSE.PHP") - message(FATAL_ERROR "The value of HPHP_HOME in incorrect") +IF(NOT EXISTS "${HPHP_HOME}/CMake/HPHPSetup.cmake") + message(FATAL_ERROR "Invalid HPHP_HOME. Set it to the root of your hhvm tree, or run `cmake .` from there.") ENDIF() SET(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/CMake" ${CMAKE_MODULE_PATH}) @@ -24,5 +20,5 @@ SET(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/CMake" ${CMAKE_MODULE_PATH}) include("${CMAKE_CURRENT_SOURCE_DIR}/CMake/HPHPFunctions.cmake") include(CheckFunctionExists) -add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/hphp) +add_subdirectory(hphp) diff --git a/configure_ubuntu_12.04.sh b/configure_ubuntu_12.04.sh index 041274027..21fa1243d 100755 --- a/configure_ubuntu_12.04.sh +++ b/configure_ubuntu_12.04.sh @@ -20,7 +20,6 @@ if [ "x${TRAVIS}" != "x" ]; then fi export CMAKE_PREFIX_PATH=`/bin/pwd`/.. -export HPHP_HOME=`/bin/pwd` # install python-software-properties before trying to add a PPA sudo apt-get -y update @@ -124,4 +123,4 @@ cmake . echo "-------------------------------------------------------------------------" echo "Done. Now run:" -echo " CMAKE_PREFIX_PATH=\`pwd\`/.. HPHP_HOME=\`pwd\` make" +echo " CMAKE_PREFIX_PATH=\`pwd\`/.. make" diff --git a/hphp/runtime/ext_hhvm/CMakeLists.txt b/hphp/runtime/ext_hhvm/CMakeLists.txt index 40b0ab3f8..8930ec4fe 100644 --- a/hphp/runtime/ext_hhvm/CMakeLists.txt +++ b/hphp/runtime/ext_hhvm/CMakeLists.txt @@ -21,7 +21,8 @@ macro(EXT_HHVM_FILE SOURCES HEADERS REL EHHVM_OS EHHVM_ARCH) list(APPEND ${HEADERS} "${f_SRC}.ext_hhvm.h") add_custom_command(OUTPUT "${f_SRC}.ext_hhvm.cpp" "${f_SRC}.ext_hhvm.h" DEPENDS ${f_SRC} gen-ext-hhvm - COMMAND "${HPHP_HOME}/hphp/tools/bootstrap/gen-ext-hhvm.sh" + COMMAND "HPHP_HOME=${HPHP_HOME}" + "${HPHP_HOME}/hphp/tools/bootstrap/gen-ext-hhvm.sh" ARGS ${EHHVM_OS} ${EHHVM_ARCH} ${f_OBJ} "${f_SRC}.ext_hhvm.cpp" "${f_SRC}.ext_hhvm.h" WORKING_DIRECTORY "${HPHP_HOME}/hphp/tools/bootstrap" diff --git a/hphp/tools/generated_files.sh b/hphp/tools/generated_files.sh index 3592de4bb..80446add1 100755 --- a/hphp/tools/generated_files.sh +++ b/hphp/tools/generated_files.sh @@ -8,7 +8,9 @@ check_err() fi } -[ -z "$HPHP_HOME" ] && check_err 1 "HPHP_HOME environment variable not set" +if [ -z "$HPHP_HOME" ]; then + HPHP_HOME="`dirname $0`/../../" +fi VERBOSE=1 diff --git a/hphp/util/CMakeLists.txt b/hphp/util/CMakeLists.txt index ae86a1ace..80e84c5ca 100644 --- a/hphp/util/CMakeLists.txt +++ b/hphp/util/CMakeLists.txt @@ -11,7 +11,7 @@ endforeach() add_custom_command( OUTPUT "${HPHP_HOME}/hphp/hphp-repo-schema.h" "${HPHP_HOME}/hphp/hphp-build-info.cpp" - COMMAND "hphp/util/generate-buildinfo.sh" + COMMAND "HPHP_HOME=${HPHP_HOME}" "hphp/util/generate-buildinfo.sh" DEPENDS ${CXX_SOURCES} WORKING_DIRECTORY ${HPHP_HOME} COMMENT "Generating Repo Schema ID and Compiler ID"