...
 
Commits (3)
......@@ -131,19 +131,21 @@ else()
"--disable-mmx"
"--enable-cross-compile"
"--cross-prefix=${TOOLCHAIN_PATH}/"
"--sysroot=${CMAKE_SYSROOT}"
"--sysroot=${ANDROID_SYSTEM_LIBRARY_PATH}"
)
set(FFMPEG_TARGET_OS "linux")
set(FFMPEG_TARGET_OS "android")
set(FFMPEG_ARCH "${CMAKE_SYSTEM_PROCESSOR}")
lcb_make_options("RANLIB=\"\$RANLIB\"")
if(CMAKE_SYSTEM_PROCESSOR STREQUAL "armv7-a")
if(CMAKE_SYSTEM_PROCESSOR STREQUAL "aarch64")
set(FFMPEG_ARCH "arm64")
elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL "armv7-a")
lcb_configure_options("--enable-neon" "--cpu=cortex-a8" "--disable-armv5te" "--enable-armv6" "--enable-armv6t2")
else()
lcb_configure_options("--disable-mmx" "--disable-sse2" "--disable-ssse3" "--disable-asm")
endif()
if(CMAKE_C_COMPILER_TARGET) # When building with clang
lcb_configure_options("--extra-cflags=--target=${CMAKE_C_COMPILER_TARGET} --gcc-toolchain=${_ANDROID_TOOL_C_COMPILER_EXTERNAL_TOOLCHAIN}")
lcb_configure_options("--extra-ldflags=--target=${CMAKE_C_COMPILER_TARGET} --gcc-toolchain=${_ANDROID_TOOL_C_COMPILER_EXTERNAL_TOOLCHAIN}")
lcb_configure_options("--extra-cflags=-isystem ${CMAKE_SYSROOT}/usr/include/ ${ANDROID_COMPILER_FLAGS} --target=${CMAKE_C_COMPILER_TARGET} --gcc-toolchain=${ANDROID_TOOLCHAIN_ROOT}")
lcb_configure_options("--extra-ldflags=${ANDROID_LINKER_FLAGS} --target=${CMAKE_C_COMPILER_TARGET} --gcc-toolchain=${ANDROID_TOOLCHAIN_ROOT}")
endif()
else()
set(FFMPEG_TARGET_OS "linux")
......
......@@ -20,37 +20,44 @@
#
############################################################################
if(EXISTS ${INSTALL_PREFIX}/lib/avcodec-53.def)
execute_process(COMMAND "lib" "/def:${INSTALL_PREFIX}/lib/avcodec-53.def" "/out:${INSTALL_PREFIX}/lib/avcodec.lib" "/machine:X86")
file(GLOB AVCODEC_DEF "${INSTALL_PREFIX}/lib/avcodec-*.def")
if(AVCODEC_DEF)
execute_process(COMMAND "lib" "/def:${AVCODEC_DEF}" "/out:${INSTALL_PREFIX}/lib/avcodec.lib" "/machine:X86")
endif()
if(EXISTS ${INSTALL_PREFIX}/lib/avutil-51.def)
execute_process(COMMAND "lib" "/def:${INSTALL_PREFIX}/lib/avutil-51.def" "/out:${INSTALL_PREFIX}/lib/avutil.lib" "/machine:X86")
file(GLOB AVUTIL_DEF "${INSTALL_PREFIX}/lib/avutil-*.def")
if(AVUTIL_DEF)
execute_process(COMMAND "lib" "/def:${AVUTIL_DEF}" "/out:${INSTALL_PREFIX}/lib/avutil.lib" "/machine:X86")
endif()
if(EXISTS ${INSTALL_PREFIX}/lib/swresample-0.def)
execute_process(COMMAND "lib" "/def:${INSTALL_PREFIX}/lib/swresample-0.def" "/out:${INSTALL_PREFIX}/lib/swresample.lib" "/machine:X86")
file(GLOB SWRESAMPLE_DEF "${INSTALL_PREFIX}/lib/swresample-*.def")
if(SWRESAMPLE_DEF)
execute_process(COMMAND "lib" "/def:${SWRESAMPLE_DEF}" "/out:${INSTALL_PREFIX}/lib/swresample.lib" "/machine:X86")
endif()
if(EXISTS ${INSTALL_PREFIX}/lib/swscale-2.def)
execute_process(COMMAND "lib" "/def:${INSTALL_PREFIX}/lib/swscale-2.def" "/out:${INSTALL_PREFIX}/lib/swscale.lib" "/machine:X86")
file(GLOB SWSCALE_DEF "${INSTALL_PREFIX}/lib/swscale-*.def")
if(SWSCALE_DEF)
execute_process(COMMAND "lib" "/def:${SWSCALE_DEF}" "/out:${INSTALL_PREFIX}/lib/swscale.lib" "/machine:X86")
endif()
if(APPLE AND NOT IOS)
execute_process(COMMAND install_name_tool
-id @rpath/libavcodec.53.61.100.dylib
-change ${INSTALL_PREFIX}/lib/libavutil.51.35.100.dylib @rpath/libavutil.51.35.100.dylib
${INSTALL_PREFIX}/lib/libavcodec.53.61.100.dylib
)
file(GLOB AVUTIL_DYLIB RELATIVE "${INSTALL_PREFIX}/lib" "${INSTALL_PREFIX}/lib/libavutil.*.*.*.dylib")
file(GLOB AVCODEC_DYLIB RELATIVE "${INSTALL_PREFIX}/lib" "${INSTALL_PREFIX}/lib/libavcodec.*.*.*.dylib")
file(GLOB SWRESAMPLE_DYLIB RELATIVE "${INSTALL_PREFIX}/lib" "${INSTALL_PREFIX}/lib/libswresample.*.*.*.dylib")
file(GLOB SWSCALE_DYLIB RELATIVE "${INSTALL_PREFIX}/lib" "${INSTALL_PREFIX}/lib/libswscale.*.*.*.dylib")
if(AVUTIL_DYLIB)
execute_process(COMMAND install_name_tool -id @rpath/${AVUTIL_DYLIB} ${INSTALL_PREFIX}/lib/${AVUTIL_DYLIB})
execute_process(COMMAND install_name_tool
-id @rpath/libavutil.51.35.100.dylib
${INSTALL_PREFIX}/lib/libavutil.51.35.100.dylib
-id @rpath/${AVCODEC_DYLIB}
-change ${INSTALL_PREFIX}/lib/${AVUTIL_DYLIB} @rpath/${AVUTIL_DYLIB}
${INSTALL_PREFIX}/lib/${AVCODEC_DYLIB}
)
execute_process(COMMAND install_name_tool
-id @rpath/libswresample.0.6.100.dylib
-change ${INSTALL_PREFIX}/lib/libavutil.51.35.100.dylib @rpath/libavutil.51.35.100.dylib
${INSTALL_PREFIX}/lib/libswresample.0.6.100.dylib
-id @rpath/${SWRESAMPLE_DYLIB}
-change ${INSTALL_PREFIX}/lib/${AVUTIL_DYLIB} @rpath/${AVUTIL_DYLIB}
${INSTALL_PREFIX}/lib/${SWRESAMPLE_DYLIB}
)
execute_process(COMMAND install_name_tool
-id @rpath/libswscale.2.1.100.dylib
-change ${INSTALL_PREFIX}/lib/libavutil.51.35.100.dylib @rpath/libavutil.51.35.100.dylib
${INSTALL_PREFIX}/lib/libswscale.2.1.100.dylib
-id @rpath/${SWSCALE_DYLIB}
-change ${INSTALL_PREFIX}/lib/${AVUTIL_DYLIB} @rpath/${AVUTIL_DYLIB}
${INSTALL_PREFIX}/lib/${SWSCALE_DYLIB}
)
endif()
......@@ -20,5 +20,5 @@
#
############################################################################
lcb_external_source_paths("externals/build/ffmpeg")
lcb_external_source_paths("cmake-builder/builders/ffmpegandroid")
lcb_dependencies("ffmpeg")
############################################################################
# config-ios-i386.cmake
# Copyright (C) 2014 Belledonne Communications, Grenoble France
# CMakeLists.txt
# Copyright (C) 2016 Belledonne Communications, Grenoble France
#
############################################################################
#
......@@ -20,6 +20,26 @@
#
############################################################################
set(PLATFORM "Simulator")
include(configs/config-ios.cmake)
cmake_minimum_required(VERSION 3.0)
project(ffmpegandroid LANGUAGES C)
include(GNUInstallDirs)
find_library(AVCODEC_LIBRARY avcodec)
find_library(AVUTIL_LIBRARY avutil)
find_library(SWRESAMPLE_LIBRARY swresample)
find_library(SWSCALE_LIBRARY swscale)
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/dummy.c" "")
add_library(ffmpeg-linphone SHARED "${CMAKE_CURRENT_BINARY_DIR}/dummy.c")
target_link_libraries(ffmpeg-linphone LINK_PRIVATE "m" "-Wl,-whole-archive" ${AVCODEC_LIBRARY} ${AVUTIL_LIBRARY} ${SWRESAMPLE_LIBRARY} ${SWSCALE_LIBRARY} "-Wl,-no-whole-archive")
set_target_properties(ffmpeg-linphone PROPERTIES LINKER_LANGUAGE C)
install(TARGETS ffmpeg-linphone
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
)
......@@ -76,8 +76,6 @@ else()
endif()
elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64")
lcb_additional_options("OS=\"ios\" ARCH=\"x86_64\"")
else()
lcb_additional_options("OS=\"ios\" ARCH=\"i386\"")
endif()
else()
if(CMAKE_OSX_ARCHITECTURES STREQUAL "x86_64")
......
############################################################################
# toolchain-ios-i386.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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
############################################################################
set(CMAKE_SYSTEM_PROCESSOR "i386")
set(LINPHONE_BUILDER_OSX_ARCHITECTURES "i386")
set(COMPILER_PREFIX "i386-apple-darwin")
set(CLANG_TARGET "i386-apple-darwin")
set(PLATFORM "Simulator")
include("${CMAKE_CURRENT_LIST_DIR}/ios/toolchain-ios.cmake")