Commit 1e1c3ef3 authored by Ghislain MARY's avatar Ghislain MARY

Add support for Android build.

parent 41d306b5
......@@ -48,6 +48,10 @@ if(LINPHONE_BUILDER_CHECK_LATEST)
else()
if(NOT DEFAULT_VALUE_CMAKE_PLUGIN_LINKING_TYPE)
set(DEFAULT_VALUE_CMAKE_PLUGIN_LINKING_TYPE ${DEFAULT_VALUE_CMAKE_LINKING_TYPE})
endif()
# Include builder options definitions according to the targets to be built
include(CMakeDependentOption)
include(FeatureSummary)
......@@ -87,7 +91,7 @@ else()
if( NOT DISABLE_BC_ANTLR)
linphone_builder_add_builder_to_target(TARGET_bellesip antlr3c)
endif()
if(NOT IOS AND NOT QNX)
if(NOT ANDROID AND NOT IOS AND NOT QNX)
linphone_builder_add_builder_to_target(TARGET_bellesip zlib)
endif()
endif()
......@@ -128,6 +132,9 @@ else()
endif()
if(ENABLE_FFMPEG)
linphone_builder_add_builder_to_target(TARGET_ms2 ffmpeg)
if(ANDROID)
linphone_builder_add_builder_to_target(TARGET_ms2 ffmpegandroid)
endif()
endif()
if(ENABLE_VPX)
linphone_builder_add_builder_to_target(TARGET_ms2 vpx)
......@@ -171,6 +178,10 @@ else()
if(ENABLE_AMRNB OR ENABLE_AMRWB)
linphone_builder_add_builder_to_target(TARGET_ms2plugins msamr)
endif()
if(ENABLE_CODEC2)
linphone_builder_add_builder_to_target(TARGET_ms2plugins codec2)
linphone_builder_add_builder_to_target(TARGET_ms2plugins mscodec2)
endif()
if(ENABLE_G729)
linphone_builder_add_builder_to_target(TARGET_ms2plugins bcg729)
endif()
......@@ -211,7 +222,7 @@ else()
# Do not build sqlite3, xml2 and zlib on IOS, they are provided by the system
linphone_builder_add_builder_to_target(TARGET_linphone sqlite3)
linphone_builder_add_builder_to_target(TARGET_linphone xml2)
if(NOT QNX)
if(NOT ANDROID AND NOT QNX)
linphone_builder_add_builder_to_target(TARGET_linphone zlib)
endif()
endif()
......@@ -226,6 +237,7 @@ else()
linphone_builder_add_builder_to_target(TARGET_linphone linphone)
endif()
# Build flexisip and its dependencies if it is in the targets list
list(FIND LINPHONE_BUILDER_TARGETS "flexisip" _target_found)
if(_target_found GREATER -1)
......
......@@ -26,5 +26,5 @@ set(EP_bcg729_GIT_TAG "1.0.1" CACHE STRING "bcg729 tag to use")
set(EP_bcg729_EXTERNAL_SOURCE_PATHS "bcg729")
set(EP_bcg729_GROUPABLE YES)
set(EP_bcg729_LINKING_TYPE ${DEFAULT_VALUE_CMAKE_LINKING_TYPE})
set(EP_bcg729_LINKING_TYPE ${DEFAULT_VALUE_CMAKE_PLUGIN_LINKING_TYPE})
set(EP_bcg729_DEPENDENCIES EP_ms2)
......@@ -22,7 +22,7 @@
set(EP_bv16_GIT_REPOSITORY "git://git.linphone.org/bv16-floatingpoint.git" CACHE STRING "bv16 repository URL")
set(EP_bv16_GIT_TAG_LATEST "linphone" CACHE STRING "bv16 tag to use when compiling latest version")
set(EP_bv16_GIT_TAG "f2c49dcdee0a1b7cea3751022c923672fa082984" CACHE STRING "bv16 tag to use")
set(EP_bv16_GIT_TAG "6899f2759c7b19d5402335d3a937c53020abfeca" CACHE STRING "bv16 tag to use")
set(EP_bv16_EXTERNAL_SOURCE_PATHS "externals/bv16-floatingpoint")
set(EP_bv16_LINKING_TYPE ${DEFAULT_VALUE_CMAKE_LINKING_TYPE})
......
############################################################################
# codec2.cmake
# Copyright (C) 2016 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.
#
############################################################################
set(EP_codec2_SVN_REPOSITORY "https://svn.code.sf.net/p/freetel/code/codec2/branches/0.3/" CACHE STRING "codec2 repository URL")
set(EP_codec2_CMAKE_OPTIONS "-DBUILD_SHARED_LIBS=NO")
set(EP_codec2_EXTRA_CFLAGS "-include ${CMAKE_CURRENT_LIST_DIR}/codec2/codec2_prefixed_symbols.h")
set(EP_codec2_PATCH_COMMAND "${PATCH_PROGRAM}" "-p1" "-i" "${CMAKE_CURRENT_LIST_DIR}/codec2/no-executables.patch")
/* This file was created extracting exported symbol of codec2 library
* The purpose is to avoid name collision with other libraries
* This was done by the following command
* nm libcodec2.so|grep " T "|sed 's/^.*\ T\ \(.*\)/#define\ \1 codec2_\1/'
* */
#define autocorrelate codec2_autocorrelate
#define de_emp codec2_de_emp
#define find_aks codec2_find_aks
#define hanning_window codec2_hanning_window
#define inverse_filter codec2_inverse_filter
#define levinson_durbin codec2_levinson_durbin
#define pre_emp codec2_pre_emp
#define synthesis_filter codec2_synthesis_filter
#define weight codec2_weight
#define nlp codec2_nlp
#define nlp_create codec2_nlp_create
#define nlp_destroy codec2_nlp_destroy
#define post_process_mbe codec2_post_process_mbe
#define post_process_sub_multiples codec2_post_process_sub_multiples
#define test_candidate_mbe codec2_test_candidate_mbe
#define postfilter codec2_postfilter
#define dft_speech codec2_dft_speech
#define estimate_amplitudes codec2_estimate_amplitudes
#define est_voicing_mbe codec2_est_voicing_mbe
#define hpf codec2_hpf
#define hs_pitch_refinement codec2_hs_pitch_refinement
#define make_analysis_window codec2_make_analysis_window
#define make_synthesis_window codec2_make_synthesis_window
#define synthesise codec2_synthesise
#define two_stage_pitch_refinement codec2_two_stage_pitch_refinement
#define analyse_one_frame codec2_analyse_one_frame
#define synthesise_one_frame codec2_synthesise_one_frame
#define fifo_create codec2_fifo_create
#define fifo_destroy codec2_fifo_destroy
#define fifo_read codec2_fifo_read
#define fifo_used codec2_fifo_used
#define fifo_write codec2_fifo_write
#define bits_to_dqpsk_symbols codec2_bits_to_dqpsk_symbols
#define calc_snr codec2_calc_snr
#define fdm_downconvert codec2_fdm_downconvert
#define fdmdv_48_to_8 codec2_fdmdv_48_to_8
#define fdmdv_8_to_48 codec2_fdmdv_8_to_48
#define fdmdv_bits_per_frame codec2_fdmdv_bits_per_frame
#define fdmdv_create codec2_fdmdv_create
#define fdmdv_demod codec2_fdmdv_demod
#define fdmdv_destroy codec2_fdmdv_destroy
#define fdmdv_dump_osc_mags codec2_fdmdv_dump_osc_mags
#define fdmdv_error_pattern_size codec2_fdmdv_error_pattern_size
#define fdmdv_freq_shift codec2_fdmdv_freq_shift
#define fdmdv_get_demod_stats codec2_fdmdv_get_demod_stats
#define fdmdv_get_fsep codec2_fdmdv_get_fsep
#define fdmdv_get_rx_spectrum codec2_fdmdv_get_rx_spectrum
#define fdmdv_get_test_bits codec2_fdmdv_get_test_bits
#define fdmdv_mod codec2_fdmdv_mod
#define fdmdv_put_test_bits codec2_fdmdv_put_test_bits
#define fdmdv_set_fsep codec2_fdmdv_set_fsep
#define fdmdv_use_old_qpsk_mapping codec2_fdmdv_use_old_qpsk_mapping
#define fdm_upconvert codec2_fdm_upconvert
#define freq_state codec2_freq_state
#define generate_pilot_fdm codec2_generate_pilot_fdm
#define generate_pilot_lut codec2_generate_pilot_lut
#define lpf_peak_pick codec2_lpf_peak_pick
#define qpsk_to_bits codec2_qpsk_to_bits
#define rx_est_freq_offset codec2_rx_est_freq_offset
#define rx_est_timing codec2_rx_est_timing
#define rx_filter codec2_rx_filter
#define snr_update codec2_snr_update
#define tx_filter codec2_tx_filter
#define kiss_fft codec2_kiss_fft
#define kiss_fft_alloc codec2_kiss_fft_alloc
#define kiss_fft_cleanup codec2_kiss_fft_cleanup
#define kiss_fft_next_fast_size codec2_kiss_fft_next_fast_size
#define kiss_fft_stride codec2_kiss_fft_stride
#define interp_energy codec2_interp_energy
#define interp_energy2 codec2_interp_energy2
#define interpolate codec2_interpolate
#define interpolate_lsp codec2_interpolate_lsp
#define interpolate_lsp_ver2 codec2_interpolate_lsp_ver2
#define interp_Wo codec2_interp_Wo
#define interp_Wo2 codec2_interp_Wo2
#define sample_log_amp codec2_sample_log_amp
#define lpc_to_lsp codec2_lpc_to_lsp
#define lsp_to_lpc codec2_lsp_to_lpc
#define aks_to_H codec2_aks_to_H
#define phase_synth_zero_order codec2_phase_synth_zero_order
#define aks_to_M2 codec2_aks_to_M2
#define apply_lpc_correction codec2_apply_lpc_correction
#define bw_expand_lsps codec2_bw_expand_lsps
#define bw_expand_lsps2 codec2_bw_expand_lsps2
#define check_lsp_order codec2_check_lsp_order
#define compute_weights codec2_compute_weights
#define compute_weights2 codec2_compute_weights2
#define compute_weights_anssi_mode2 codec2_compute_weights_anssi_mode2
#define decode_energy codec2_decode_energy
#define decode_lspds_scalar codec2_decode_lspds_scalar
#define decode_lsps_scalar codec2_decode_lsps_scalar
#define decode_lsps_vq codec2_decode_lsps_vq
#define decode_Wo codec2_decode_Wo
#define decode_Wo_dt codec2_decode_Wo_dt
#define decode_WoE codec2_decode_WoE
#define encode_energy codec2_encode_energy
#define encode_lspds_scalar codec2_encode_lspds_scalar
#define encode_lsps_scalar codec2_encode_lsps_scalar
#define encode_lsps_vq codec2_encode_lsps_vq
#define encode_Wo codec2_encode_Wo
#define encode_Wo_dt codec2_encode_Wo_dt
#define encode_WoE codec2_encode_WoE
#define find_nearest codec2_find_nearest
#define find_nearest_weighted codec2_find_nearest_weighted
#define force_min_lsp_dist codec2_force_min_lsp_dist
#define locate_lsps_jnd_steps codec2_locate_lsps_jnd_steps
#define lpc_post_filter codec2_lpc_post_filter
#define lsp_bits codec2_lsp_bits
#define lspd_bits codec2_lspd_bits
#define lspjvm_quantise codec2_lspjvm_quantise
#define lsp_pred_vq_bits codec2_lsp_pred_vq_bits
#define quantise codec2_quantise
#define quantise_init codec2_quantise_init
#define quantise_WoE codec2_quantise_WoE
#define speech_to_uq_lsps codec2_speech_to_uq_lsps
#define pack codec2_pack
#define pack_natural_or_gray codec2_pack_natural_or_gray
#define unpack codec2_unpack
#define unpack_natural_or_gray codec2_unpack_natural_or_gray
#define get_syndrome codec2_get_syndrome
#define golay23_count_errors codec2_golay23_count_errors
#define golay23_decode codec2_golay23_decode
#define golay23_encode codec2_golay23_encode
#define golay23_init codec2_golay23_init
#define nextcomb codec2_nextcomb
diff -urN codec2.orig/src/CMakeLists.txt codec2/src/CMakeLists.txt
--- codec2.orig/src/CMakeLists.txt 2016-03-03 14:38:06.682265907 +0100
+++ codec2/src/CMakeLists.txt 2016-03-03 14:38:29.575598823 +0100
@@ -80,6 +80,7 @@
set(CODEBOOKSGE ${D}/gecb.txt)
+if(FALSE)
# when crosscompiling import the executable targets from a file
if(CMAKE_CROSSCOMPILING)
set(IMPORT_EXECUTABLES "IMPORTFILE-NOTFOUND" CACHE FILEPATH "Point to the export file from a native build")
@@ -153,6 +154,7 @@
COMMAND generate_codebook ge_cb ${CODEBOOKSGE} > ${CMAKE_CURRENT_BINARY_DIR}/codebookge.c
DEPENDS generate_codebook ${CODEBOOKSGE}
)
+endif()
#
# codec2 library sources
@@ -203,6 +205,7 @@
PUBLIC_HEADER "${CODEC2_PUBLIC_HEADERS}"
)
+if(FALSE)
add_executable(c2demo c2demo.c)
target_link_libraries(c2demo ${CMAKE_REQUIRED_LIBRARIES} codec2)
@@ -238,6 +241,7 @@
add_executable(fec_dec fec_dec.c golay23.c)
target_link_libraries(fec_dec ${CMAKE_REQUIRED_LIBRARIES} codec2)
+endif()
install(TARGETS codec2 EXPORT codec2-config
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
@@ -250,6 +254,7 @@
# DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/codec2
#)
+if(FALSE)
install(TARGETS
c2demo
c2demo
@@ -265,3 +270,4 @@
fec_dec
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)
+endif()
......@@ -119,6 +119,22 @@ else()
)
set(EP_ffmpeg_PATCH_COMMAND ${EP_ffmpeg_PATCH_COMMAND} "COMMAND" "${PATCH_PROGRAM}" "-p1" "-i" "${CMAKE_CURRENT_SOURCE_DIR}/builders/ffmpeg/configure-osx.patch" ${EP_ffmpeg_PATCH_OPTIONS})
endif()
elseif(ANDROID)
list(APPEND EP_ffmpeg_CONFIGURE_OPTIONS
"--enable-decoder=h264"
"--disable-iconv"
"--enable-cross-compile"
"--cross-prefix=${ANDROID_TOOLCHAIN_PATH}/"
"--sysroot=${CMAKE_SYSROOT}"
)
set(EP_ffmpeg_TARGET_OS "linux")
set(EP_ffmpeg_ARCH "${CMAKE_SYSTEM_PROCESSOR}")
set(EP_ffmpeg_MAKE_OPTIONS "RANLIB=\"\$RANLIB\"")
if(CMAKE_SYSTEM_PROCESSOR STREQUAL "armeabi-v7a")
list(APPEND EP_ffmpeg_CONFIGURE_OPTIONS "--enable-neon" "--cpu=cortex-a8" "--disable-armv5te" "--enable-armv6" "--enable-armv6t2")
else()
list(APPEND EP_ffmpeg_CONFIGURE_OPTIONS "--disable-mmx" "--disable-sse2" "--disable-ssse3")
endif()
else()
set(EP_ffmpeg_TARGET_OS "linux")
set(EP_ffmpeg_PATCH_COMMAND "${PATCH_PROGRAM}" "-p1" "-i" "${CMAKE_CURRENT_SOURCE_DIR}/builders/ffmpeg/no-sdl.patch" ${EP_ffmpeg_PATCH_OPTIONS})
......
############################################################################
# ffmpegandroid.cmake
# Copyright (C) 2016 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.
#
############################################################################
set(EP_ffmpegandroid_EXTERNAL_SOURCE_PATHS "externals/build/ffmpeg")
set(EP_ffmpegandroid_DEPENDENCIES EP_ffmpeg)
\ No newline at end of file
......@@ -65,11 +65,11 @@ list(APPEND EP_ms2_CMAKE_OPTIONS "-DENABLE_VIDEO=${ENABLE_VIDEO}")
if(ENABLE_VIDEO)
list(APPEND EP_ms2_CMAKE_OPTIONS "-DENABLE_FFMPEG=${ENABLE_FFMPEG}")
if(ENABLE_FFMPEG AND LINPHONE_BUILDER_BUILD_DEPENDENCIES)
list(APPEND EP_ms2_DEPENDENCIES EP_ffmpeg)
endif()
list(APPEND EP_ms2_CMAKE_OPTIONS "-DENABLE_MKV=${ENABLE_MKV}")
if(ENABLE_MKV)
list(APPEND EP_ms2_DEPENDENCIES EP_matroska2)
if(ANDROID)
list(APPEND EP_ms2_DEPENDENCIES EP_ffmpegandroid)
else()
list(APPEND EP_ms2_DEPENDENCIES EP_ffmpeg)
endif()
endif()
list(APPEND EP_ms2_CMAKE_OPTIONS "-DENABLE_VPX=${ENABLE_VPX}")
if(ENABLE_VPX AND LINPHONE_BUILDER_BUILD_DEPENDENCIES)
......@@ -77,6 +77,11 @@ if(ENABLE_VIDEO)
endif()
endif()
list(APPEND EP_ms2_CMAKE_OPTIONS "-DENABLE_MKV=${ENABLE_MKV}")
if(ENABLE_MKV)
list(APPEND EP_ms2_DEPENDENCIES EP_matroska2)
endif()
list(APPEND EP_ms2_CMAKE_OPTIONS "-DENABLE_SRTP=${ENABLE_SRTP}")
if(ENABLE_SRTP AND LINPHONE_BUILDER_BUILD_DEPENDENCIES)
list(APPEND EP_ms2_DEPENDENCIES EP_srtp)
......
......@@ -26,7 +26,7 @@ set(EP_msamr_GIT_TAG "1.0.2" CACHE STRING "msamr tag to use")
set(EP_msamr_EXTERNAL_SOURCE_PATHS "msamr")
set(EP_msamr_GROUPABLE YES)
set(EP_msamr_LINKING_TYPE ${DEFAULT_VALUE_CMAKE_LINKING_TYPE})
set(EP_msamr_LINKING_TYPE ${DEFAULT_VALUE_CMAKE_PLUGIN_LINKING_TYPE})
set(EP_msamr_DEPENDENCIES EP_ms2 EP_opencoreamr)
set(EP_msamr_CMAKE_OPTIONS "-DENABLE_NARROWBAND=${ENABLE_AMRNB}")
......
############################################################################
# mscodec2.cmake
# Copyright (C) 2016 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.
#
############################################################################
set(EP_mscodec2_GIT_REPOSITORY "git://git.linphone.org/mscodec2.git" CACHE STRING "mscodec2 repository URL")
set(EP_mscodec2_GIT_TAG_LATEST "master" CACHE STRING "mscodec2 tag to use when compiling latest version")
set(EP_mscodec2_GIT_TAG "1.0.2" CACHE STRING "mscodec2 tag to use")
set(EP_mscodec2_EXTERNAL_SOURCE_PATHS "mscodec2")
set(EP_mscodec2_GROUPABLE YES)
set(EP_mscodec2_LINKING_TYPE ${DEFAULT_VALUE_CMAKE_PLUGIN_LINKING_TYPE})
set(EP_mscodec2_DEPENDENCIES EP_ms2 EP_codec2)
......@@ -26,7 +26,7 @@ set(EP_msopenh264_GIT_TAG "1.1.1" CACHE STRING "msopenh264 tag to use")
set(EP_msopenh264_EXTERNAL_SOURCE_PATHS "msopenh264")
set(EP_msopenh264_GROUPABLE YES)
set(EP_msopenh264_LINKING_TYPE ${DEFAULT_VALUE_CMAKE_LINKING_TYPE})
set(EP_msopenh264_LINKING_TYPE ${DEFAULT_VALUE_CMAKE_PLUGIN_LINKING_TYPE})
set(EP_msopenh264_DEPENDENCIES EP_ms2 EP_openh264)
if(MSVC)
set(EP_msopenh264_EXTRA_LDFLAGS "/SAFESEH:NO")
......
......@@ -26,5 +26,5 @@ set(EP_mssilk_GIT_TAG "1.0.2" CACHE STRING "mssilk tag to use")
set(EP_mssilk_EXTERNAL_SOURCE_PATHS "mssilk")
set(EP_mssilk_GROUPABLE YES)
set(EP_mssilk_LINKING_TYPE ${DEFAULT_VALUE_CMAKE_LINKING_TYPE})
set(EP_mssilk_LINKING_TYPE ${DEFAULT_VALUE_CMAKE_PLUGIN_LINKING_TYPE})
set(EP_mssilk_DEPENDENCIES EP_ms2)
......@@ -26,6 +26,6 @@ set(EP_mswasapi_GIT_TAG "1.0.0" CACHE STRING "mswasapi tag to use")
set(EP_mswasapi_EXTERNAL_SOURCE_PATHS "mswasapi")
set(EP_mswasapi_GROUPABLE YES)
set(EP_mswasapi_LINKING_TYPE ${DEFAULT_VALUE_CMAKE_LINKING_TYPE})
set(EP_mswasapi_LINKING_TYPE ${DEFAULT_VALUE_CMAKE_PLUGIN_LINKING_TYPE})
set(EP_mswasapi_EXTRA_LDFLAGS "/SAFESEH:NO")
set(EP_mswasapi_DEPENDENCIES EP_ms2)
......@@ -26,7 +26,7 @@ set(EP_mswebrtc_GIT_TAG "88c0fa6ae7ea35fa25eac5ce4b50898e85443ff0" CACHE STRING
set(EP_mswebrtc_EXTERNAL_SOURCE_PATHS "mswebrtc")
set(EP_mswebrtc_GROUPABLE YES)
set(EP_mswebrtc_LINKING_TYPE ${DEFAULT_VALUE_CMAKE_LINKING_TYPE})
set(EP_mswebrtc_LINKING_TYPE ${DEFAULT_VALUE_CMAKE_PLUGIN_LINKING_TYPE})
set(EP_mswebrtc_DEPENDENCIES EP_ms2)
set(EP_mswebrtc_CMAKE_OPTIONS
......
......@@ -26,5 +26,5 @@ set(EP_mswinrtvid_GIT_TAG "b067bca955dc170b54fffe019a6a7ce86c781c8a" CACHE STRIN
set(EP_mswinrtvid_EXTERNAL_SOURCE_PATHS "mswinrtvid")
set(EP_mswinrtvid_GROUPABLE YES)
set(EP_mswinrtvid_LINKING_TYPE ${DEFAULT_VALUE_CMAKE_LINKING_TYPE})
set(EP_mswinrtvid_LINKING_TYPE ${DEFAULT_VALUE_CMAKE_PLUGIN_LINKING_TYPE})
set(EP_mswinrtvid_DEPENDENCIES EP_ms2)
......@@ -25,5 +25,5 @@ set(EP_mswp8vid_GIT_TAG_LATEST "master" CACHE STRING "mswp8vid tag to use when c
set(EP_mswp8vid_GIT_TAG "0c28ede7baa26081ed13f93f5ede4ec61b5a263b" CACHE STRING "mswp8vid tag to use")
set(EP_mswp8vid_EXTERNAL_SOURCE_PATHS "mswp8vid")
set(EP_mswp8vid_LINKING_TYPE ${DEFAULT_VALUE_CMAKE_LINKING_TYPE})
set(EP_mswp8vid_LINKING_TYPE ${DEFAULT_VALUE_CMAKE_PLUGIN_LINKING_TYPE})
set(EP_mswp8vid_DEPENDENCIES EP_ms2)
......@@ -26,5 +26,5 @@ set(EP_msx264_GIT_TAG "3a9b5a9ff79ea45b9f8f03d03d4a4a9213dc2c5d" CACHE STRING "m
set(EP_msx264_EXTERNAL_SOURCE_PATHS "msx264")
set(EP_msx264_GROUPABLE YES)
set(EP_msx264_LINKING_TYPE ${DEFAULT_VALUE_CMAKE_LINKING_TYPE})
set(EP_msx264_LINKING_TYPE ${DEFAULT_VALUE_CMAKE_PLUGIN_LINKING_TYPE})
set(EP_msx264_DEPENDENCIES EP_ms2 EP_x264)
......@@ -47,10 +47,15 @@ else()
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)
if (MSVC)
if(MSVC)
set(EP_openh264_ADDITIONAL_OPTIONS "OS=\"msvc\"")
endif()
if (APPLE)
elseif(ANDROID)
if(CMAKE_SYSTEM_PROCESSOR STREQUAL "armeabi-v7a")
set(EP_openh264_ADDITIONAL_OPTIONS "OS=\"android\" NDKROOT=\"${ANDROID_NDK_PATH}\" TOOLCHAINPREFIX=\"${ANDROID_TOOLCHAIN_PREFIX}\" TARGET=\"android-${CMAKE_ANDROID_API}\" ARCH=\"arm\"")
else()
set(EP_openh264_ADDITIONAL_OPTIONS "OS=\"android\" NDKROOT=\"${ANDROID_NDK_PATH}\" TOOLCHAINPREFIX=\"${ANDROID_TOOLCHAIN_PREFIX}\" TARGET=\"android-${CMAKE_ANDROID_API}\" ARCH=\"x86\"")
endif()
elseif(APPLE)
if(IOS)
if(CMAKE_SYSTEM_PROCESSOR STREQUAL "aarch64")
set(EP_openh264_ADDITIONAL_OPTIONS "OS=\"ios\" ARCH=\"arm64\"")
......
......@@ -40,4 +40,8 @@ else()
set(EP_opus_PATCH_COMMAND "${CMAKE_COMMAND}" "-E" "copy" "${CMAKE_CURRENT_SOURCE_DIR}/builders/opus/CMakeLists.txt" "<SOURCE_DIR>")
list(APPEND EP_opus_PATCH_COMMAND "COMMAND" "${CMAKE_COMMAND}" "-E" "copy" "${CMAKE_CURRENT_SOURCE_DIR}/builders/opus/config.h.cmake" "<SOURCE_DIR>")
set(EP_opus_LINKING_TYPE ${DEFAULT_VALUE_CMAKE_LINKING_TYPE})
set(EP_opus_CMAKE_OPTIONS )
if(ANDROID AND CMAKE_SYSTEM_PROCESSOR STREQUAL "armeabi-v7a")
list(APPEND EP_opus_CMAKE_OPTIONS "-DENABLE_INTRINSICS=YES")
endif()
endif()
......@@ -33,6 +33,7 @@ option(ENABLE_FIXED_POINT_DEBUG "Debug fixed-point implementation." NO)
option(ENABLE_FLOAT_API "Compile with the floating point API (to disable for machines with no float library)." YES)
option(ENABLE_FLOAT_APPROX "Enable fast approximations for floating point." NO)
option(ENABLE_FUZZING "Causes the encoder to make random decisions." NO)
option(ENABLE_INTRINSICS "Enable intrinsics optimizations for ARM(float) X86(fixed)." NO)
option(ENABLE_RTCD "Enable run-time CPU capabilities detection." YES)
......@@ -65,7 +66,9 @@ if(ENABLE_ASM)
if(CMAKE_OSX_SYSROOT)
set(ARCH_OPTIONS "${ARCH_OPTIONS} -isysroot ${CMAKE_OSX_SYSROOT}")
endif()
set(CMAKE_ASM_COMPILE_OBJECT "<CMAKE_ASM_COMPILER> ${ARCH_OPTIONS} ${CMAKE_C_FLAGS} -o <OBJECT> -c <SOURCE>")
get_directory_property(DIRECTORY_PROPERTY_COMPILE_OPTIONS "COMPILE_OPTIONS")
string(REPLACE ";" " " DIRECTORY_PROPERTY_COMPILE_OPTIONS "${DIRECTORY_PROPERTY_COMPILE_OPTIONS}")
set(CMAKE_ASM_COMPILE_OBJECT "<CMAKE_ASM_COMPILER> ${CMAKE_CPP_FLAGS} ${CMAKE_C_FLAGS} ${DIRECTORY_PROPERTY_COMPILE_OPTIONS} ${ARCH_OPTIONS} -o <OBJECT> -c <SOURCE>")
enable_language(ASM)
string(TOLOWER ${CMAKE_SYSTEM_PROCESSOR} SYSTEM_PROCESSOR)
#No optimization available yet for arm64
......@@ -88,39 +91,46 @@ int main(int argc, char *argv[]) { __asm__ (\"\"); }
if(PERL_FOUND)
set(OPUS_ARM_EXTERNAL_ASM 1)
if(OPUS_ARM_INLINE_EDSP)
set(OPUS_ARM_PRESUME_EDSP 1)
set(OPUS_ARM_MAY_HAVE_EDSP 1)
endif()
if(OPUS_ARM_INLINE_MEDIA)
set(OPUS_ARM_PRESUME_MEDIA 1)
set(OPUS_ARM_MAY_HAVE_MEDIA 1)
endif()
if(OPUS_ARM_INLINE_NEON)
set(OPUS_ARM_PRESUME_NEON 1)
set(OPUS_ARM_MAY_HAVE_NEON 1)
endif()
if(ENABLE_RTCD)
if(NOT OPUS_ARM_MAY_HAVE_EDSP)
check_c_source_compiles("int main(int argc, char *argv[]) { __asm__(\".arch armv5te\\n.object_arch armv4t\\nqadd r3,r3,r3\"); }" OPUS_ARM_MAY_HAVE_EDSP)
check_c_source_compiles("int main(int argc, char *argv[]) { __asm__(\".arch armv5te\\\\n.object_arch armv4t\\\\nqadd r3,r3,r3\"); }" OPUS_ARM_MAY_HAVE_EDSP)
endif()
if(NOT OPUS_ARM_MAY_HAVE_MEDIA)
check_c_source_compiles("int main(int argc, char *argv[]) { __asm__(\".arch armv6\\n.object_arch armv4t\\nshadd8 r3,r3,r3\"); }" OPUS_ARM_MAY_HAVE_MEDIA)
check_c_source_compiles("int main(int argc, char *argv[]) { __asm__(\".arch armv6\\\\n.object_arch armv4t\\\\nshadd8 r3,r3,r3\"); }" OPUS_ARM_MAY_HAVE_MEDIA)
endif()
if(NOT OPUS_ARM_MAY_HAVE_NEON)
check_c_source_compiles("int main(int argc, char *argv[]) { __asm__(\".arch armv7-a\\n.fpu neon\\n.object_arch armv4t\\nvorr d0,d0,d0\"); }" OPUS_ARM_MAY_HAVE_NEON)
check_c_source_compiles("int main(int argc, char *argv[]) { __asm__(\".arch armv7-a\\\\n.fpu neon\\\\n.object_arch armv4t\\\\nvorr d0,d0,d0\"); }" OPUS_ARM_MAY_HAVE_NEON)
endif()
endif()
set(RTCD_SUPPORT "")
if(OPUS_ARM_MAY_HAVE_EDSP)
set(OPUS_ARM_PRESUME_EDSP 1)
else()
set(OPUS_ARM_MAY_HAVE_EDSP 0)
if(NOT OPUS_ARM_PRESUME_EDSP)
set(RTCD_SUPPORT "${RTCD_SUPPORT} (EDSP)")
endif()
endif()
if(OPUS_ARM_MAY_HAVE_MEDIA)
set(OPUS_ARM_PRESUME_MEDIA 1)
else()
set(OPUS_ARM_MAY_HAVE_MEDIA 0)
if(NOT OPUS_ARM_PRESUME_MEDIA)
set(RTCD_SUPPORT "${RTCD_SUPPORT} (Media)")
endif()
endif()
if(OPUS_ARM_MAY_HAVE_NEON)
set(OPUS_ARM_PRESUME_NEON 1)
else()
set(OPUS_ARM_MAY_HAVE_NEON 0)
if(NOT OPUS_ARM_PRESUME_NEON)
set(RTCD_SUPPORT "${RTCD_SUPPORT} (NEON)")
endif()
endif()
if(RTCD_SUPPORT)
set(RTCD_SUPPORT "ARM${RTCD_SUPPORT}")
endif()
endif()
endif()
......@@ -144,6 +154,9 @@ endif()
if(ENABLE_FUZZING)
set(FUZZING 1)
endif()
if(RTCD_SUPPORT)
set(OPUS_HAVE_RTCD 1)
endif()
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config.h)
......@@ -216,6 +229,14 @@ if(OPUS_ARM_EXTERNAL_ASM)
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/celt/arm/armopts-gnu.S
COMMAND "${PERL_EXECUTABLE}" "${CMAKE_CURRENT_SOURCE_DIR}/celt/arm/arm2gnu.pl" ${ARM2GNU_PARAMS} "<" "${CELT_AM_SOURCES_ARM_ASM}" ">" "${CELT_AM_SOURCES_EXTERNAL_ARM_ASM}")
endif()
if(OPUS_ARM_PRESUME_NEON AND ENABLE_INTRINSICS)
set(CELT_AM_SOURCES_NEON_INTRINSICS
celt/arm/celt_neon_intr.c
)
if(ANDROID)
set_source_files_properties(${CELT_AM_SOURCES_NEON_INTRINSICS} PROPERTIES COMPILE_FLAGS "-mfpu=neon")
endif()
endif()
set(SILK_SOURCES
silk/CNG.c
......@@ -389,6 +410,9 @@ if(OPUS_ARM_ASM)
if(OPUS_ARM_EXTERNAL_ASM)
list(APPEND CELT_SOURCES ${CELT_SOURCES_EXTERNAL_ARM_ASM} ${CELT_AM_SOURCES_EXTERNAL_ARM_ASM})
endif()
if(CELT_AM_SOURCES_NEON_INTRINSICS)
list(APPEND CELT_SOURCES ${CELT_AM_SOURCES_NEON_INTRINSICS})
endif()
endif()
if(MSVC AND CMAKE_GENERATOR MATCHES "^.* ARM")
add_definitions(-DNO_INLINE_ASM)
......
......@@ -38,6 +38,15 @@ else()
set(EP_voamrwbenc_EXTERNAL_SOURCE_PATHS "externals/vo-amrwbenc" "vo-amrwbenc")
set(EP_voamrwbenc_PATCH_COMMAND "${CMAKE_COMMAND}" "-E" "copy" "${CMAKE_CURRENT_SOURCE_DIR}/builders/voamrwbenc/CMakeLists.txt" "<SOURCE_DIR>")
set(EP_voamrwbenc_CMAKE_OPTIONS )
set(EP_voamrwbenc_LINKING_TYPE "-DENABLE_STATIC=YES")
set(EP_voamrwbenc_DEPENDENCIES EP_opencoreamr)
if(ANDROID)
if(CMAKE_SYSTEM_PROCESSOR STREQUAL "armeabi-v7a")
list(APPEND EP_voamrwbenc_CMAKE_OPTIONS "-DENABLE_ARMV7NEON=YES")
elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL "armeabi")
list(APPEND EP_voamrwbenc_CMAKE_OPTIONS "-DENABLE_ARMV5E=YES")
endif()
endif()
endif()
......@@ -116,6 +116,15 @@ if(WIN32)
list(APPEND SOURCE_FILES ${CMAKE_CURRENT_BINARY_DIR}/vo-amrwbenc.def)
endif()
if(ENABLE_ARMV5E OR ENABLE_ARMV7NEON)
if(ANDROID AND CMAKE_SYSTEM_PROCESSOR STREQUAL "armeabi-v7a")
set(ARCH_OPTIONS "-mfpu=neon")
endif()
get_directory_property(DIRECTORY_PROPERTY_COMPILE_OPTIONS "COMPILE_OPTIONS")
string(REPLACE ";" " " DIRECTORY_PROPERTY_COMPILE_OPTIONS "${DIRECTORY_PROPERTY_COMPILE_OPTIONS}")
set(CMAKE_ASM_COMPILE_OBJECT "<CMAKE_ASM_COMPILER> ${CMAKE_CPP_FLAGS} ${CMAKE_C_FLAGS} ${DIRECTORY_PROPERTY_COMPILE_OPTIONS} ${ARCH_OPTIONS} -o <OBJECT> -c <SOURCE>")
enable_language(ASM)
endif()
if(ENABLE_STATIC)
add_library(vo-amrwbenc STATIC ${SOURCE_FILES})
......@@ -139,10 +148,10 @@ endif()
target_include_directories(vo-amrwbenc PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/amrwbenc/inc ${CMAKE_CURRENT_SOURCE_DIR}/common/include)
if(ENABLE_ARMV5E)
target_compile_definitions("-DARM" "-DASM_OPT")
target_compile_definitions(vo-amrwbenc PRIVATE "-DARM" "-DASM_OPT")
endif()
if(ENABLE_ARMV7NEON)
target_compile_definitions("-DARM" "-DARMV7" "-DASM_OPT")
target_compile_definitions(vo-amrwbenc PRIVATE "-DARM" "-DARMV7" "-DASM_OPT")
endif()
install(TARGETS vo-amrwbenc
......
......@@ -114,6 +114,19 @@ else()
set(EP_vpx_BUILD_IN_SOURCE 1) # Build in source otherwise there are some compilation errors
endif()
set(EP_vpx_LINKING_TYPE "--enable-static" "--disable-shared" "--enable-pic")
elseif(ANDROID)
if(CMAKE_SYSTEM_PROCESSOR STREQUAL "armeabi-v7a")
set(EP_vpx_TARGET "armv7-android-gcc")
else()
set(EP_vpx_TARGET "x86-android-gcc")
set(EP_vpx_EXTRA_ASFLAGS "-D__ANDROID__")
endif()
set(EP_vpx_EXTRA_CFLAGS "--sysroot=${CMAKE_SYSROOT}")
set(EP_vpx_EXTRA_LDFLAGS "--sysroot=${CMAKE_SYSROOT}")
list(APPEND EP_vpx_CONFIGURE_OPTIONS
"--sdk-path=${ANDROID_NDK_PATH}"
)
set(EP_vpx_LINKING_TYPE "--enable-static" "--disable-shared" "--enable-pic")
elseif(QNX)
set(EP_vpx_TARGET "armv7-qnx-gcc")
list(REMOVE_ITEM EP_vpx_CONFIGURE_OPTIONS "--enable-multithread")
......@@ -136,5 +149,5 @@ else()
"--prefix=${CMAKE_INSTALL_PREFIX}"
"--target=${EP_vpx_TARGET}"
)
set(EP_vpx_CONFIGURE_ENV "CC=$CC_NO_LAUNCHER LD=$CC_NO_LAUNCHER")
set(EP_vpx_CONFIGURE_ENV "CC=$CC_NO_LAUNCHER LD=$CC_NO_LAUNCHER ASFLAGS=$ASFLAGS CFLAGS=$CFLAGS LDFLAGS=$LDFLAGS")
endif()
......@@ -36,9 +36,18 @@ set(EP_x264_CONFIGURE_OPTIONS
if(IOS)
list(APPEND EP_x264_CONFIGURE_OPTIONS "--sysroot=${CMAKE_OSX_SYSROOT}")
string(REGEX MATCH "^(arm*|aarch64)" ARM_ARCH "${CMAKE_SYSTEM_PROCESSOR}")
if (ARM_ARCH AND NOT ${XCODE_VERSION} VERSION_LESS 7)
if(ARM_ARCH AND NOT ${XCODE_VERSION} VERSION_LESS 7)
list(APPEND EP_x264_CONFIGURE_OPTIONS "--extra-asflags=-fembed-bitcode")
endif()
elseif(ANDROID)
list(APPEND EP_x264_CONFIGURE_OPTIONS "--sysroot=${CMAKE_SYSROOT}")
set(EP_x264_CROSS_COMPILATION_OPTIONS "--prefix=${CMAKE_INSTALL_PREFIX}")
if(CMAKE_SYSTEM_PROCESSOR MATCHES "^arm")
list(APPEND EP_x264_CROSS_COMPILATION_OPTIONS "--host=arm-none-linux-gnueabi")
else()
list(APPEND EP_x264_CROSS_COMPILATION_OPTIONS "--host=i686-linux-gnueabi")
endif()
set(EP_x264_USE_C_COMPILER_FOR_ASSEMBLER TRUE)
endif()
set(EP_x264_LINKING_TYPE "--enable-shared")
if(IOS)
......@@ -48,4 +57,3 @@ else()
endif()
set(EP_x264_INSTALL_TARGET "install-lib-shared")
set(EP_x264_DEPENDENCIES )
......@@ -494,6 +494,11 @@ macro(linphone_builder_add_external_project PROJNAME)
if(NOT EP_${PROJNAME}_DO_NOT_USE_CMAKE_FLAGS)
linphone_builder_apply_cmake_flags_to_autotools_project(${PROJNAME})
endif()
if(EP_${PROJNAME}_USE_C_COMPILER_FOR_ASSEMBLER)
set(ep_use_c_compiler_for_assembler TRUE)
else()
unset(ep_use_c_compiler_for_assembler)
endif()
linphone_builder_apply_extra_flags(${PROJNAME})
linphone_builder_expand_external_project_vars()
......@@ -657,8 +662,12 @@ macro(linphone_builder_add_external_project PROJNAME)
if(EP_${PROJNAME}_URL_HASH)
list(APPEND DOWNLOAD_SOURCE URL_HASH ${EP_${PROJNAME}_URL_HASH})
endif()
else()
elseif(EP_${PROJNAME}_GIT_REPOSITORY)
set(DOWNLOAD_SOURCE GIT_REPOSITORY ${EP_${PROJNAME}_GIT_REPOSITORY} GIT_TAG ${EP_${PROJNAME}_GIT_TAG})
elseif(EP_${PROJNAME}_SVN_REPOSITORY)
set(DOWNLOAD_SOURCE SVN_REPOSITORY ${EP_${PROJNAME}_SVN_REPOSITORY})
else()
message(FATAL_ERROR "No valid source defined for project '${PROJNAME}'")
endif()
linphone_builder_filter_out_inexistent_dependencies(${PROJNAME})
......
#!/bin/sh
if [ -n "@AUTOTOOLS_AS_COMPILER@" ]
if [ -n "@ep_use_c_compiler_for_assembler@" ]