Fixed prebuilt fetching, Snowglobe style

This commit is contained in:
Siana Gearz
2011-05-08 23:25:21 +02:00
parent 1a099167ae
commit 8d2b56b1eb
5 changed files with 76 additions and 61 deletions

View File

@@ -132,27 +132,25 @@ endif (SERVER)
# Configure prebuilt binary download. This must be done last so that
# all subdirectories have a chance to list the packages they need.
if(NOT STANDALONE)
# We need scp for proprietary downloads.
if(INSTALL_PROPRIETARY)
include(FindSCP)
endif(INSTALL_PROPRIETARY)
# We need scp for proprietary downloads.
if(INSTALL_PROPRIETARY)
include(FindSCP)
endif(INSTALL_PROPRIETARY)
# The use_prebuilt_binary macro in cmake/Prebuilt.cmake records
# packages in the PREBUILT property of the 'prepare' target.
get_property(PREBUILT_PACKAGES TARGET prepare PROPERTY PREBUILT)
# The use_prebuilt_binary macro in cmake/Prebuilt.cmake records
# packages in the PREBUILT property of the 'prepare' target.
get_property(PREBUILT_PACKAGES TARGET prepare PROPERTY PREBUILT)
# Create a script to download the needed binaries.
configure_file(${CMAKE_SOURCE_DIR}/cmake/DownloadPrebuilt.cmake.in
${CMAKE_BINARY_DIR}/DownloadPrebuilt.cmake @ONLY)
# Create a script to download the needed binaries.
configure_file(${CMAKE_SOURCE_DIR}/cmake/DownloadPrebuilt.cmake.in
${CMAKE_BINARY_DIR}/DownloadPrebuilt.cmake @ONLY)
# Drive the download script at build time. Depend on 'install.xml'
# to aqcuire new binaries when needed.
add_custom_command(
COMMENT "Obtaining prebuilt binaries..."
OUTPUT ${CMAKE_BINARY_DIR}/prepare/prebuilt
COMMAND ${CMAKE_COMMAND} -P ${CMAKE_BINARY_DIR}/DownloadPrebuilt.cmake
DEPENDS ${CMAKE_SOURCE_DIR}/../install.xml
${CMAKE_BINARY_DIR}/DownloadPrebuilt.cmake
)
endif(NOT STANDALONE)
# Drive the download script at build time. Depend on 'install.xml'
# to aqcuire new binaries when needed.
add_custom_command(
COMMENT "Obtaining prebuilt binaries..."
OUTPUT ${CMAKE_BINARY_DIR}/prepare/prebuilt
COMMAND ${CMAKE_COMMAND} -P ${CMAKE_BINARY_DIR}/DownloadPrebuilt.cmake
DEPENDS ${CMAKE_SOURCE_DIR}/../install.xml
${CMAKE_BINARY_DIR}/DownloadPrebuilt.cmake
)

View File

@@ -0,0 +1,46 @@
# -*- cmake -*-
# - Find zlib
# Find the ZLIB includes and library
# This module defines
# ZLIB_INCLUDE_DIRS, where to find zlib.h, etc.
# ZLIB_LIBRARIES, the libraries needed to use zlib.
# ZLIB_FOUND, If false, do not try to use zlib.
#
# This FindZLIB is about 43 times as fast the one provided with cmake (2.8.x),
# because it doesn't look up the version of zlib, resulting in a dramatic
# speed up for configure (from 4 minutes 22 seconds to 6 seconds).
#
# Note: Since this file is only used for standalone, the windows
# specific parts were left out.
FIND_PATH(ZLIB_INCLUDE_DIR zlib.h
NO_SYSTEM_ENVIRONMENT_PATH
)
FIND_LIBRARY(ZLIB_LIBRARY z)
if (ZLIB_LIBRARY AND ZLIB_INCLUDE_DIR)
SET(ZLIB_INCLUDE_DIRS ${ZLIB_INCLUDE_DIR})
SET(ZLIB_LIBRARIES ${ZLIB_LIBRARY})
SET(ZLIB_FOUND "YES")
else (ZLIB_LIBRARY AND ZLIB_INCLUDE_DIR)
SET(ZLIB_FOUND "NO")
endif (ZLIB_LIBRARY AND ZLIB_INCLUDE_DIR)
if (ZLIB_FOUND)
if (NOT ZLIB_FIND_QUIETLY)
message(STATUS "Found ZLIB: ${ZLIB_LIBRARIES}")
SET(ZLIB_FIND_QUIETLY TRUE)
endif (NOT ZLIB_FIND_QUIETLY)
else (ZLIB_FOUND)
if (ZLIB_FIND_REQUIRED)
message(FATAL_ERROR "Could not find ZLIB library")
endif (ZLIB_FIND_REQUIRED)
endif (ZLIB_FOUND)
mark_as_advanced(
ZLIB_LIBRARY
ZLIB_INCLUDE_DIR
)

View File

@@ -1,44 +1,11 @@
# -*- cmake -*-
include(Python)
include(FindSCP)
macro (use_prebuilt_binary _binary)
if (NOT STANDALONE)
if(${CMAKE_BINARY_DIR}/temp/sentinel_installed IS_NEWER_THAN ${CMAKE_BINARY_DIR}/temp/${_binary}_installed)
if(INSTALL_PROPRIETARY)
include(FindSCP)
if(DEBUG_PREBUILT)
message("cd ${SCRIPTS_DIR} && ${PYTHON_EXECUTABLE} install.py --install-dir=${CMAKE_SOURCE_DIR}/.. --scp=${SCP_EXECUTABLE} ${_binary}")
endif(DEBUG_PREBUILT)
execute_process(COMMAND ${PYTHON_EXECUTABLE}
install.py
--install-dir=${CMAKE_SOURCE_DIR}/..
--scp=${SCP_EXECUTABLE}
${_binary}
WORKING_DIRECTORY ${SCRIPTS_DIR}
RESULT_VARIABLE ${_binary}_installed
)
else(INSTALL_PROPRIETARY)
if(DEBUG_PREBUILT)
message("cd ${SCRIPTS_DIR} && ${PYTHON_EXECUTABLE} install.py --install-dir=${CMAKE_SOURCE_DIR}/.. ${_binary}")
endif(DEBUG_PREBUILT)
execute_process(COMMAND ${PYTHON_EXECUTABLE}
install.py
--install-dir=${CMAKE_SOURCE_DIR}/..
${_binary}
WORKING_DIRECTORY ${SCRIPTS_DIR}
RESULT_VARIABLE ${_binary}_installed
)
endif(INSTALL_PROPRIETARY)
file(WRITE ${CMAKE_BINARY_DIR}/temp/${_binary}_installed "${${_binary}_installed}")
else(${CMAKE_BINARY_DIR}/temp/sentinel_installed IS_NEWER_THAN ${CMAKE_BINARY_DIR}/temp/${_binary}_installed)
set(${_binary}_installed 0)
endif(${CMAKE_BINARY_DIR}/temp/sentinel_installed IS_NEWER_THAN ${CMAKE_BINARY_DIR}/temp/${_binary}_installed)
if(NOT ${_binary}_installed EQUAL 0)
message(FATAL_ERROR
"Failed to download or unpack prebuilt '${_binary}'."
" Process returned ${${_binary}_installed}.")
endif (NOT ${_binary}_installed EQUAL 0)
endif (NOT STANDALONE)
if(NOT STANDALONE)
get_property(PREBUILT_PACKAGES TARGET prepare PROPERTY PREBUILT)
list(FIND PREBUILT_PACKAGES ${_binary} _index)
if(_index LESS 0)
set_property(TARGET prepare APPEND PROPERTY PREBUILT ${_binary})
endif(_index LESS 0)
endif(NOT STANDALONE)
endmacro (use_prebuilt_binary _binary)

View File

@@ -64,6 +64,8 @@ list(APPEND llplugin_SOURCE_FILES ${llplugin_HEADER_FILES})
add_library (llplugin ${llplugin_SOURCE_FILES})
add_dependencies(llplugin prepare)
add_subdirectory(slplugin)
# # Add tests

View File

@@ -47,3 +47,5 @@ add_library(media_plugin_base
${media_plugin_base_SOURCE_FILES}
)
add_dependencies(media_plugin_base prepare)