openh264.cmake 2.78 KB
Newer Older
Ghislain MARY's avatar
Ghislain MARY committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
############################################################################
# openh264.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.
#
############################################################################

find_program(NASM_PROGRAM
	NAMES nasm nasm.exe
25
	HINTS "${LINPHONE_BUILDER_WORK_DIR}/windows_tools"
Ghislain MARY's avatar
Ghislain MARY committed
26 27 28 29 30 31 32 33 34 35
)
if(NOT NASM_PROGRAM)
	if(WIN32)
		message(FATAL_ERROR "Could not find the nasm.exe program. Please install it from http://www.nasm.us/")
	else()
		message(FATAL_ERROR "Could not find the nasm program.")
	endif()
endif()

set(EP_openh264_GIT_REPOSITORY "https://github.com/cisco/openh264")
36
set(EP_openh264_GIT_TAG "v1.4.0")
37 38
set(EP_openh264_EXTERNAL_SOURCE_PATHS "externals/openh264")

Ghislain MARY's avatar
Ghislain MARY committed
39
set(EP_openh264_BUILD_METHOD "custom")
40
set(EP_openh264_LINKING_TYPE "-static")
41
set(EP_openh264_BUILD_TYPE "Release")	# Always use Release build type, otherwise the codec is too slow...
42 43 44
set(EP_openh264_CONFIGURE_COMMAND_SOURCE ${CMAKE_CURRENT_SOURCE_DIR}/builders/openh264/configure.sh.cmake)
set(EP_openh264_BUILD_COMMAND_SOURCE ${CMAKE_CURRENT_SOURCE_DIR}/builders/openh264/build.sh.cmake)
set(EP_openh264_INSTALL_COMMAND_SOURCE ${CMAKE_CURRENT_SOURCE_DIR}/builders/openh264/install.sh.cmake)
45
set(EP_openh264_OUT_OF_TREE_BUILD_PATCH "${CMAKE_CURRENT_SOURCE_DIR}/builders/openh264/out-of-tree-build.patch")
46
if (MSVC)
47
	set(EP_openh264_ADDITIONAL_OPTIONS "OS=\"msvc\"")
48
endif()
49
if (APPLE)
50 51 52 53 54 55 56 57 58 59
	if(IOS)
		if(CMAKE_SYSTEM_PROCESSOR STREQUAL "aarch64")
			set(EP_openh264_ADDITIONAL_OPTIONS "OS=\"ios\" ARCH=\"arm64\"")
		elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL "armv7")
			set(EP_openh264_ADDITIONAL_OPTIONS "OS=\"ios\" ARCH=\"armv7\"")
		elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64")
			set(EP_openh264_ADDITIONAL_OPTIONS "OS=\"ios\" ARCH=\"x86_64\"")
		else()
			set(EP_openh264_ADDITIONAL_OPTIONS "OS=\"ios\" ARCH=\"i386\"")
		endif()
60
	else()
61 62 63 64 65
		if("${CMAKE_OSX_ARCHITECTURES}" STREQUAL "x86_64")
			set(EP_openh264_ADDITIONAL_OPTIONS "ARCH=\"x86_64\"")
		else()
			set(EP_openh264_ADDITIONAL_OPTIONS "ARCH=\"x86\"")
		endif()
66 67
	endif()
endif()