vpx.cmake 2.87 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
############################################################################
# vpx.cmake
# Copyright (C) 2014  Belledonne Communications, Grenoble France
#
############################################################################
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
#
############################################################################

23 24 25 26 27 28
if(LINPHONE_BUILDER_PREBUILT_URL)
	set(EP_vpx_FILENAME "vpx-v1.3.0-${LINPHONE_BUILDER_ARCHITECTURE}.zip")
	file(DOWNLOAD "${LINPHONE_BUILDER_PREBUILT_URL}/${EP_vpx_FILENAME}" "${CMAKE_CURRENT_BINARY_DIR}/${EP_vpx_FILENAME}" STATUS EP_vpx_FILENAME_STATUS)
	list(GET EP_vpx_FILENAME_STATUS 0 EP_vpx_DOWNLOAD_STATUS)
	if(NOT EP_vpx_DOWNLOAD_STATUS)
		set(EP_vpx_PREBUILT 1)
29
	endif()
30 31 32 33 34
endif()

if(EP_vpx_PREBUILT)
	set(EP_vpx_URL "${CMAKE_CURRENT_BINARY_DIR}/${EP_vpx_FILENAME}")
	set(EP_vpx_BUILD_METHOD "prebuilt")
35
else()
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65
	set(EP_vpx_URL "http://webm.googlecode.com/files/libvpx-v1.3.0.tar.bz2")
	set(EP_vpx_URL_HASH "MD5=14783a148872f2d08629ff7c694eb31f")
	set(EP_vpx_BUILD_METHOD "autotools")
	set(EP_vpx_CONFIG_H_FILE vpx_config.h)
	set(EP_vpx_CONFIGURE_OPTIONS
		"--enable-error-concealment"
		"--enable-realtime-only"
		"--enable-spatial-resampling"
		"--enable-vp8"
		"--disable-vp9"
		"--enable-libs"
		"--disable-install-docs"
		"--disable-debug-libs"
		"--disable-examples"
		"--disable-unit-tests"
		"--as=yasm"
	)

	if(WIN32)
		set(EP_vpx_PATCH_COMMAND "${PATCH_PROGRAM}" "-p1" "-i" "${CMAKE_CURRENT_SOURCE_DIR}/builders/vpx/enable-shared-on-windows.patch" "--binary")
		set(EP_vpx_TARGET "x86-win32-gcc")
		set(EP_vpx_LINKING_TYPE "--disable-static" "--enable-shared")
	elseif(APPLE)
		if(CMAKE_OSX_ARCHITECTURES STREQUAL "x86_64")
			set(EP_vpx_TARGET "x86_64-darwin10-gcc")
		else()
			set(EP_vpx_TARGET "x86-darwin10-gcc")
		endif()
		set(EP_vpx_LINKING_TYPE "--enable-static" "--disable-shared" "--enable-pic")
		set(EP_vpx_BUILD_IN_SOURCE "yes")
66
	else()
67 68 69 70 71 72
		if(CMAKE_SIZEOF_VOID_P EQUAL 8)
			set(EP_vpx_TARGET "x86_64-linux-gcc")
		else()
			set(EP_vpx_TARGET "x86-linux-gcc")
		endif()
		set(EP_vpx_LINKING_TYPE "--disable-static" "--enable-shared")
73
	endif()
74

75 76 77 78 79 80
	set(EP_vpx_CROSS_COMPILATION_OPTIONS
		"--prefix=${CMAKE_INSTALL_PREFIX}"
		"--target=${EP_vpx_TARGET}"
	)
	set(EP_vpx_CONFIGURE_ENV "LD=$CC")
endif()