PageRenderTime 18ms CodeModel.GetById 15ms app.highlight 1ms RepoModel.GetById 1ms app.codeStats 1ms

/indra/cmake/Prebuilt.cmake

https://bitbucket.org/lindenlab/viewer-beta/
CMake | 53 lines | 39 code | 5 blank | 9 comment | 9 complexity | c06933a02bd1ffdf05cdf601454df10a MD5 | raw file
 1# -*- cmake -*-
 2
 3include(FindAutobuild)
 4if(INSTALL_PROPRIETARY)
 5  include(FindSCP)
 6endif(INSTALL_PROPRIETARY)
 7
 8# The use_prebuilt_binary macro handles automated installation of package
 9# dependencies using autobuild.  The goal is that 'autobuild install' should
10# only be run when we know we need to install a new package.  This should be
11# the case in a clean checkout, or if autobuild.xml has been updated since the
12# last run (encapsulated by the file ${CMAKE_BINARY_DIR}/temp/sentinel_installed),
13# or if a previous attempt to install the package has failed (the exit status
14# of previous attempts is serialized in the file
15# ${CMAKE_BINARY_DIR}/temp/${_binary}_installed)
16macro (use_prebuilt_binary _binary)
17  if (NOT DEFINED STANDALONE_${_binary})
18    set(STANDALONE_${_binary} ${STANDALONE})
19  endif (NOT DEFINED STANDALONE_${_binary})
20
21  if (NOT STANDALONE_${_binary})
22    if("${${_binary}_installed}" STREQUAL "" AND EXISTS "${CMAKE_BINARY_DIR}/temp/${_binary}_installed")
23      file(READ ${CMAKE_BINARY_DIR}/temp/${_binary}_installed "${_binary}_installed")
24      if(DEBUG_PREBUILT)
25        message(STATUS "${_binary}_installed: \"${${_binary}_installed}\"")
26      endif(DEBUG_PREBUILT)
27    endif("${${_binary}_installed}" STREQUAL "" AND EXISTS "${CMAKE_BINARY_DIR}/temp/${_binary}_installed")
28
29    if(${CMAKE_BINARY_DIR}/temp/sentinel_installed IS_NEWER_THAN ${CMAKE_BINARY_DIR}/temp/${_binary}_installed OR NOT ${${_binary}_installed} EQUAL 0)
30      if(DEBUG_PREBUILT)
31        message("cd ${CMAKE_SOURCE_DIR} && ${AUTOBUILD_EXECUTABLE} install
32        --install-dir=${AUTOBUILD_INSTALL_DIR}
33        --skip-license-check
34        ${_binary} ")
35      endif(DEBUG_PREBUILT)
36      execute_process(COMMAND "${AUTOBUILD_EXECUTABLE}"
37        install
38        --install-dir=${AUTOBUILD_INSTALL_DIR}
39        --skip-license-check
40        ${_binary}
41        WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
42        RESULT_VARIABLE ${_binary}_installed
43        )
44      file(WRITE ${CMAKE_BINARY_DIR}/temp/${_binary}_installed "${${_binary}_installed}")
45    endif(${CMAKE_BINARY_DIR}/temp/sentinel_installed IS_NEWER_THAN ${CMAKE_BINARY_DIR}/temp/${_binary}_installed OR NOT ${${_binary}_installed} EQUAL 0)
46
47    if(NOT ${_binary}_installed EQUAL 0)
48      message(FATAL_ERROR
49              "Failed to download or unpack prebuilt '${_binary}'."
50              " Process returned ${${_binary}_installed}.")
51    endif (NOT ${_binary}_installed EQUAL 0)
52  endif (NOT STANDALONE_${_binary})
53endmacro (use_prebuilt_binary _binary)