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

23
# Define default values for the linphone builder options
Ghislain MARY's avatar
Ghislain MARY committed
24 25
set(DEFAULT_VALUE_ENABLE_AMRNB ON)
set(DEFAULT_VALUE_ENABLE_AMRWB ON)
26
set(DEFAULT_VALUE_ENABLE_DTLS ON)
27
set(DEFAULT_VALUE_ENABLE_FFMPEG ON)
28
set(DEFAULT_VALUE_ENABLE_G729 ON)
29
set(DEFAULT_VALUE_ENABLE_GPL_THIRD_PARTIES ON)
30
set(DEFAULT_VALUE_ENABLE_GSM ON)
31 32
set(DEFAULT_VALUE_ENABLE_H263 ON)
set(DEFAULT_VALUE_ENABLE_H263P ON)
33 34
set(DEFAULT_VALUE_ENABLE_ILBC ON)
set(DEFAULT_VALUE_ENABLE_ISAC ON)
35
set(DEFAULT_VALUE_ENABLE_MKV ON)
36 37
set(DEFAULT_VALUE_ENABLE_MPEG4 ON)
set(DEFAULT_VALUE_ENABLE_OPENH264 ON)
38
set(DEFAULT_VALUE_ENABLE_OPUS ON)
39
set(DEFAULT_VALUE_ENABLE_PACKAGING ON)
40 41
set(DEFAULT_VALUE_ENABLE_SILK ON)
set(DEFAULT_VALUE_ENABLE_SPEEX ON)
42 43 44 45
set(DEFAULT_VALUE_ENABLE_SRTP ON)
set(DEFAULT_VALUE_ENABLE_TUNNEL OFF)
set(DEFAULT_VALUE_ENABLE_UNIT_TESTS ON)
set(DEFAULT_VALUE_ENABLE_VIDEO ON)
46
set(DEFAULT_VALUE_ENABLE_V4L ON)
47
set(DEFAULT_VALUE_ENABLE_VPX ON)
Ghislain MARY's avatar
Ghislain MARY committed
48
set(DEFAULT_VALUE_ENABLE_WASAPI ON)
49
set(DEFAULT_VALUE_ENABLE_WEBRTC_AEC OFF)
50
set(DEFAULT_VALUE_ENABLE_X264 OFF)
51
set(DEFAULT_VALUE_ENABLE_ZRTP ON)
52

53
set(DEFAULT_VALUE_CMAKE_LINKING_TYPE "-DENABLE_STATIC=NO")
Ghislain MARY's avatar
Ghislain MARY committed
54

55

56 57 58
# Global configuration
set(LINPHONE_BUILDER_HOST "")
if(APPLE)
59 60 61 62
	if (NOT CMAKE_OSX_DEPLOYMENT_TARGET)
		set(CMAKE_OSX_DEPLOYMENT_TARGET "10.6")
	endif()

63 64 65 66 67 68 69
	if(CMAKE_SIZEOF_VOID_P EQUAL 8)
		set(CMAKE_OSX_ARCHITECTURES "x86_64")
		set(LINPHONE_BUILDER_HOST "x86_64-apple-darwin")
	else()
		set(CMAKE_OSX_ARCHITECTURES "i386")
		set(LINPHONE_BUILDER_HOST "i686-apple-darwin")
	endif()
70
	set(LINPHONE_BUILDER_CPPFLAGS "-mmacosx-version-min=${CMAKE_OSX_DEPLOYMENT_TARGET} -arch ${CMAKE_OSX_ARCHITECTURES}")
Ghislain MARY's avatar
Ghislain MARY committed
71
	set(LINPHONE_BUILDER_OBJCFLAGS "-mmacosx-version-min=${CMAKE_OSX_DEPLOYMENT_TARGET} -arch ${CMAKE_OSX_ARCHITECTURES}")
72
	set(LINPHONE_BUILDER_LDFLAGS "-mmacosx-version-min=${CMAKE_OSX_DEPLOYMENT_TARGET} -arch ${CMAKE_OSX_ARCHITECTURES}")
73
	set(CMAKE_MACOSX_RPATH 1)
74 75 76 77
endif()
if(WIN32)
	set(LINPHONE_BUILDER_CPPFLAGS "-D_WIN32_WINNT=0x0501 -D_ALLOW_KEYWORD_MACROS")
endif()
78 79

# Adjust PKG_CONFIG_PATH to include install directory
80 81
if(UNIX)
	set(LINPHONE_BUILDER_PKG_CONFIG_PATH "${CMAKE_INSTALL_PREFIX}/lib/pkgconfig/:$ENV{PKG_CONFIG_PATH}:/usr/lib/pkgconfig/:/usr/lib/x86_64-linux-gnu/pkgconfig/:/usr/share/pkgconfig/:/usr/local/lib/pkgconfig/:/opt/local/lib/pkgconfig/")
82 83 84
else() # Windows
	set(LINPHONE_BUILDER_PKG_CONFIG_PATH "${CMAKE_INSTALL_PREFIX}/lib/pkgconfig/")
endif()
85 86


87 88 89 90 91 92
list(FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES "${CMAKE_INSTALL_PREFIX}/lib" _IS_SYSTEM_DIR)
if("${_IS_SYSTEM_DIR}" STREQUAL "-1")
   set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
endif()


Ghislain MARY's avatar
Ghislain MARY committed
93 94
# Include builders
include(builders/CMakeLists.txt)
95

96 97 98 99 100
# linphone
if(WIN32)
	list(APPEND EP_linphone_CMAKE_OPTIONS "-DENABLE_RELATIVE_PREFIX=YES")
endif()

101 102 103 104 105
# ms2
if(WIN32)
	list(APPEND EP_ms2_CMAKE_OPTIONS "-DENABLE_RELATIVE_PREFIX=YES")
endif()

Ghislain MARY's avatar
Ghislain MARY committed
106 107 108 109 110 111 112
# opencoreamr
if(NOT WIN32)
	set(EP_opencoreamr_EXTRA_CFLAGS "${EP_opencoreamr_EXTRA_CFLAGS} -fPIC")
	set(EP_opencoreamr_EXTRA_CXXFLAGS "${EP_opencoreamr_EXTRA_CXXFLAGS} -fPIC")
	set(EP_opencoreamr_EXTRA_LDFLAGS "${EP_opencoreamr_EXTRA_LDFLAGS} -fPIC")
endif()

113
# openh264
114
set(EP_openh264_LINKING_TYPE "-shared")
115

Ghislain MARY's avatar
Ghislain MARY committed
116 117 118 119 120 121 122
# voamrwbenc
if(NOT WIN32)
	set(EP_voamrwbenc_EXTRA_CFLAGS "${EP_voamrwbenc_EXTRA_CFLAGS} -fPIC")
	set(EP_voamrwbenc_EXTRA_CXXFLAGS "${EP_voamrwbenc_EXTRA_CXXFLAGS} -fPIC")
	set(EP_voamrwbenc_EXTRA_LDFLAGS "${EP_voamrwbenc_EXTRA_LDFLAGS} -fPIC")
endif()

123 124 125 126
# vpx
if(WIN32)
	set(EP_vpx_LINKING_TYPE "--enable-static" "--disable-shared" "--enable-pic")
endif()
127 128

# Create a shortcut to linphone.exe in install prefix
129
if(LINPHONE_BUILDER_TARGET STREQUAL linphone AND WIN32)
130 131 132
	set(SHORTCUT_PATH "${CMAKE_INSTALL_PREFIX}/linphone.lnk")
	set(SHORTCUT_TARGET_PATH "${CMAKE_INSTALL_PREFIX}/bin/linphone.exe")
	set(SHORTCUT_WORKING_DIRECTORY "${CMAKE_INSTALL_PREFIX}")
133
	configure_file("${CMAKE_CURRENT_SOURCE_DIR}/configs/desktop/linphone_package/winshortcut.vbs.in" "${CMAKE_CURRENT_BINARY_DIR}/winshortcut.vbs" @ONLY)
134 135 136 137 138
	add_custom_command(OUTPUT "${SHORTCUT_PATH}"
		COMMAND "cscript" "${CMAKE_CURRENT_BINARY_DIR}/winshortcut.vbs"
	)
	add_custom_target(linphone_winshortcut ALL DEPENDS "${SHORTCUT_PATH}" TARGET_linphone)
endif()
139 140 141


# Packaging
142
if (ENABLE_PACKAGING)
143 144 145 146 147 148 149 150 151 152
	# Linphone and linphone SDK packages
	if(LINPHONE_BUILDER_TARGET STREQUAL linphone)
		linphone_builder_apply_flags()
		linphone_builder_set_ep_directories(linphone_package)
		linphone_builder_expand_external_project_vars()
		ExternalProject_Add(TARGET_linphone_package
			DEPENDS TARGET_linphone_builder
			TMP_DIR ${ep_tmp}
			BINARY_DIR ${ep_build}
			DOWNLOAD_COMMAND ""
153 154 155 156 157
			PATCH_COMMAND "${CMAKE_COMMAND}" "-E" "copy_directory" "${CMAKE_CURRENT_LIST_DIR}/desktop/linphone_package" "<SOURCE_DIR>"
			CMAKE_GENERATOR ${CMAKE_GENERATOR}
			CMAKE_ARGS ${LINPHONE_BUILDER_EP_ARGS} -DCMAKE_INSTALL_PREFIX=${LINPHONE_BUILDER_WORK_DIR}/PACKAGE -DLINPHONE_OUTPUT_DIR=${CMAKE_INSTALL_PREFIX} -DENABLE_ZRTP:BOOL=${ENABLE_ZRTP}
		)
	endif()
158

159 160
	# Mediastreamer SDK packages
	if(LINPHONE_BUILDER_TARGET STREQUAL ms2
161
			OR LINPHONE_BUILDER_TARGET STREQUAL ms2-plugins)
162

163 164 165 166 167 168 169 170 171 172 173 174 175 176
		if(LINPHONE_BUILDER_TARGET STREQUAL ms2)
			set(MS2_PACKAGE_DEPEND_TARGET TARGET_ms2)
		else()
			set(MS2_PACKAGE_DEPEND_TARGET TARGET_ms2plugins)
		endif()
		linphone_builder_apply_flags()
		linphone_builder_set_ep_directories(ms2_package)
		linphone_builder_expand_external_project_vars()
		ExternalProject_Add(TARGET_ms2_package
			DEPENDS ${MS2_PACKAGE_DEPEND_TARGET}
			TMP_DIR ${ep_tmp}
			BINARY_DIR ${ep_build}
			DOWNLOAD_COMMAND ""
			PATCH_COMMAND "${CMAKE_COMMAND}" "-E" "copy_directory" "${CMAKE_CURRENT_LIST_DIR}/desktop/ms2_package" "<SOURCE_DIR>"
177 178 179 180
			CMAKE_GENERATOR ${CMAKE_GENERATOR}
			CMAKE_ARGS ${LINPHONE_BUILDER_EP_ARGS} -DCMAKE_INSTALL_PREFIX=${LINPHONE_BUILDER_WORK_DIR}/PACKAGE -DLINPHONE_OUTPUT_DIR=${CMAKE_INSTALL_PREFIX} -DENABLE_ZRTP:BOOL=${ENABLE_ZRTP}
		)
	endif()
181
endif()