config-desktop.cmake 6.8 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
24
set(DEFAULT_VALUE_ENABLE_DTLS ON)
25 26
set(DEFAULT_VALUE_ENABLE_FFMPEG ON)
set(DEFAULT_VALUE_ENABLE_GPL_THIRD_PARTIES ON)
27 28 29
set(DEFAULT_VALUE_ENABLE_GSM ON)
set(DEFAULT_VALUE_ENABLE_ILBC ON)
set(DEFAULT_VALUE_ENABLE_ISAC ON)
30
set(DEFAULT_VALUE_ENABLE_MKV ON)
31
set(DEFAULT_VALUE_ENABLE_OPUS ON)
32 33 34 35 36
if(WIN32 OR APPLE)
	set(DEFAULT_VALUE_ENABLE_PACKAGING ON)
else()
	set(DEFAULT_VALUE_ENABLE_PACKAGING OFF)
endif()
37 38
set(DEFAULT_VALUE_ENABLE_SILK ON)
set(DEFAULT_VALUE_ENABLE_SPEEX ON)
39 40 41 42 43
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)
set(DEFAULT_VALUE_ENABLE_VPX ON)
Ghislain MARY's avatar
Ghislain MARY committed
44
set(DEFAULT_VALUE_ENABLE_WASAPI ON)
45
set(DEFAULT_VALUE_ENABLE_WEBRTC_AEC OFF)
46
set(DEFAULT_VALUE_ENABLE_ZRTP ON)
47

48
set(DEFAULT_VALUE_CMAKE_LINKING_TYPE "-DENABLE_STATIC=NO")
Ghislain MARY's avatar
Ghislain MARY committed
49

50

51 52 53
# Global configuration
set(LINPHONE_BUILDER_HOST "")
if(APPLE)
54 55 56 57 58
	#if (NOT CMAKE_OSX_DEPLOYMENT_TARGET) #is it still usefull ?
		#without instruction chose to target current machine
	#	execute_process(COMMAND sw_vers -productVersion  COMMAND awk -F \\. "{printf \"%i.%i\",$1,$2}"  RESULT_VARIABLE xcrun_sdk_version OUTPUT_VARIABLE CMAKE_OSX_DEPLOYMENT_TARGET OUTPUT_STRIP_TRAILING_WHITESPACE)
	#endif()

59 60 61 62 63 64 65
	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()
66 67 68
	set(LINPHONE_BUILDER_CPPFLAGS "-arch ${CMAKE_OSX_ARCHITECTURES}")
	set(LINPHONE_BUILDER_OBJCFLAGS "-arch ${CMAKE_OSX_ARCHITECTURES}")
	set(LINPHONE_BUILDER_LDFLAGS "-arch ${CMAKE_OSX_ARCHITECTURES}")
69
	set(CMAKE_MACOSX_RPATH 1)
70 71 72 73
endif()
if(WIN32)
	set(LINPHONE_BUILDER_CPPFLAGS "-D_WIN32_WINNT=0x0501 -D_ALLOW_KEYWORD_MACROS")
endif()
74 75

# Adjust PKG_CONFIG_PATH to include install directory
76 77
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/")
78 79 80
else() # Windows
	set(LINPHONE_BUILDER_PKG_CONFIG_PATH "${CMAKE_INSTALL_PREFIX}/lib/pkgconfig/")
endif()
81 82


83 84 85 86 87 88
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
89 90
# Include builders
include(builders/CMakeLists.txt)
91

92 93 94
# linphone
if(WIN32)
	list(APPEND EP_linphone_CMAKE_OPTIONS "-DENABLE_RELATIVE_PREFIX=YES")
95 96
else(APPLE)
	list(APPEND EP_linphone_CMAKE_OPTIONS "-DENABLE_RELATIVE_PREFIX=${ENABLE_RELATIVE_PREFIX}")
97 98
endif()

99 100 101
# ms2
if(WIN32)
	list(APPEND EP_ms2_CMAKE_OPTIONS "-DENABLE_RELATIVE_PREFIX=YES")
102 103
else(APPLE)
	list(APPEND EP_ms2_CMAKE_OPTIONS "-DENABLE_RELATIVE_PREFIX=${ENABLE_RELATIVE_PREFIX}")
104 105
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()