Commit a9dac92e authored by Ghislain MARY's avatar Ghislain MARY

Handle optimized build for Raspberry PI 2 and 3.

parent b7951752
......@@ -38,6 +38,8 @@ set(DEFAULT_VALUE_ENABLE_VPX ON)
set(DEFAULT_VALUE_ENABLE_WASAPI OFF)
set(DEFAULT_VALUE_ENABLE_ZRTP ON)
message(STATUS "Buiding for Raspberry PI ${RASPBERRY_VERSION}")
get_filename_component(COMPILER_NAME ${CMAKE_C_COMPILER} NAME)
string(REGEX REPLACE "-gcc$" "" LINPHONE_BUILDER_HOST ${COMPILER_NAME})
unset(COMPILER_NAME)
......@@ -58,11 +60,25 @@ set(EP_ffmpeg_CROSS_COMPILATION_OPTIONS
# opus
linphone_builder_add_cmake_option(opus "-DENABLE_FIXED_POINT=YES")
# speex
linphone_builder_add_cmake_option(speex "-DENABLE_FLOAT_API=NO")
linphone_builder_add_cmake_option(speex "-DENABLE_FIXED_POINT=YES")
if(CMAKE_SYSTEM_PROCESSOR STREQUAL "armv7")
linphone_builder_add_cmake_option(speex "-DENABLE_ARM_NEON_INTRINSICS=YES")
endif()
# vpx
set(EP_vpx_CROSS_COMPILATION_OPTIONS
"--prefix=${CMAKE_INSTALL_PREFIX}"
"--target=armv6-linux-gcc"
)
if(CMAKE_SYSTEM_PROCESSOR STREQUAL "armv7")
set(EP_vpx_CROSS_COMPILATION_OPTIONS
"--prefix=${CMAKE_INSTALL_PREFIX}"
"--target=armv7-linux-gcc"
)
else()
set(EP_vpx_CROSS_COMPILATION_OPTIONS
"--prefix=${CMAKE_INSTALL_PREFIX}"
"--target=armv6-linux-gcc"
)
endif()
# Add config step for packaging
set(LINPHONE_BUILDER_ADDITIONAL_CONFIG_STEPS "${CMAKE_CURRENT_LIST_DIR}/desktop-raspberry/additional_steps.cmake")
......
......@@ -20,6 +20,8 @@
#
############################################################################
message(STATUS "Buiding for Raspberry PI ${RASPBERRY_VERSION}")
get_filename_component(COMPILER_NAME ${CMAKE_C_COMPILER} NAME)
string(REGEX REPLACE "-gcc$" "" LINPHONE_BUILDER_HOST ${COMPILER_NAME})
unset(COMPILER_NAME)
......@@ -42,8 +44,23 @@ set(EP_ffmpeg_CROSS_COMPILATION_OPTIONS
# opus
linphone_builder_add_cmake_option(opus "-DENABLE_FIXED_POINT=YES")
# speex
linphone_builder_add_cmake_option(speex "-DENABLE_FLOAT_API=NO")
linphone_builder_add_cmake_option(speex "-DENABLE_FIXED_POINT=YES")
if(CMAKE_SYSTEM_PROCESSOR STREQUAL "armv7")
linphone_builder_add_cmake_option(speex "-DENABLE_ARM_NEON_INTRINSICS=YES")
endif()
# vpx
set(EP_vpx_CROSS_COMPILATION_OPTIONS
"--prefix=${CMAKE_INSTALL_PREFIX}"
"--target=armv6-linux-gcc"
)
if(CMAKE_SYSTEM_PROCESSOR STREQUAL "armv7")
set(EP_vpx_CROSS_COMPILATION_OPTIONS
"--prefix=${CMAKE_INSTALL_PREFIX}"
"--target=armv7-linux-gcc"
)
else()
set(EP_vpx_CROSS_COMPILATION_OPTIONS
"--prefix=${CMAKE_INSTALL_PREFIX}"
"--target=armv6-linux-gcc"
)
endif()
......@@ -40,6 +40,6 @@ if(ENABLE_PACKAGING)
SOURCE_DIR "${CMAKE_CURRENT_LIST_DIR}/package"
DOWNLOAD_COMMAND ""
CMAKE_GENERATOR ${CMAKE_GENERATOR}
CMAKE_ARGS ${LINPHONE_BUILDER_EP_ARGS} -DLINPHONE_OUTPUT_DIR=${CMAKE_INSTALL_PREFIX} -DLINPHONE_SOURCE_DIR=${EP_linphone_SOURCE_DIR} ${ENABLE_VARIABLES}
CMAKE_ARGS ${LINPHONE_BUILDER_EP_ARGS} -DLINPHONE_OUTPUT_DIR=${CMAKE_INSTALL_PREFIX} -DLINPHONE_SOURCE_DIR=${EP_linphone_SOURCE_DIR} ${ENABLE_VARIABLES} -DRASPBERRY_VERSION=${RASPBERRY_VERSION}
)
endif()
......@@ -66,7 +66,7 @@ file(REMOVE ${FILES_TO_DELETE})
# Generate the tarball containing the output of the build
add_custom_target(create_tar ALL COMMAND
${CMAKE_COMMAND} -E tar "cvjf" "linphone-raspberry-${LINPHONE_GIT_REVISION}.tar.bz2" "${LINPHONE_SDK_TMP}"
${CMAKE_COMMAND} -E tar "cvjf" "linphone-raspberry-pi${RASPBERRY_VERSION}-${LINPHONE_GIT_REVISION}.tar.bz2" "${LINPHONE_SDK_TMP}"
)
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/linphone-raspberry-${LINPHONE_GIT_REVISION}.tar.bz2" DESTINATION .)
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/linphone-raspberry-pi${RASPBERRY_VERSION}-${LINPHONE_GIT_REVISION}.tar.bz2" DESTINATION .)
......@@ -20,6 +20,16 @@
#
############################################################################
if("$ENV{RASPBERRY_VERSION}" STREQUAL "")
set(RASPBERRY_VERSION 1)
else()
if($ENV{RASPBERRY_VERSION} VERSION_GREATER 3)
set(RASPBERRY_VERSION 3)
else()
set(RASPBERRY_VERSION $ENV{RASPBERRY_VERSION})
endif()
endif()
if("$ENV{RASPBIAN_ROOTFS}" STREQUAL "")
message(FATAL_ERROR "Define the RASPBIAN_ROOTFS environment variable to point to the raspbian rootfs.")
else()
......@@ -42,11 +52,25 @@ set(CMAKE_SYSROOT "${SYSROOT_PATH}")
# Define name of the target system
set(CMAKE_SYSTEM_NAME "Linux")
set(CMAKE_SYSTEM_PROCESSOR "arm")
if(RASPBERRY_VERSION VERSION_GREATER 1)
set(CMAKE_SYSTEM_PROCESSOR "armv7")
else()
set(CMAKE_SYSTEM_PROCESSOR "arm")
endif()
# Define the compiler
set(CMAKE_C_COMPILER ${TOOLCHAIN_CC})
set(CMAKE_CXX_COMPILER ${TOOLCHAIN_CXX})
if(RASPBERRY_VERSION VERSION_GREATER 2)
set(CMAKE_C_FLAGS "-mcpu=cortex-a53 -mfpu=neon-fp-armv8 -mfloat-abi=hard" CACHE STRING "Flags for Raspberry PI 3")
set(CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS}" CACHE STRING "Flags for Raspberry PI 3")
elseif(RASPBERRY_VERSION VERSION_GREATER 1)
set(CMAKE_C_FLAGS "-mcpu=cortex-a7 -mfpu=neon-vfpv4 -mfloat-abi=hard" CACHE STRING "Flags for Raspberry PI 2")
set(CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS}" CACHE STRING "Flags for Raspberry PI 2")
else()
set(CMAKE_C_FLAGS "-mcpu=arm1176jzf-s -mfpu=vfp -mfloat-abi=hard" CACHE STRING "Flags for Raspberry PI 1 B+")
set(CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS}" CACHE STRING "Flags for Raspberry PI 1 B+")
endif()
set(CMAKE_FIND_ROOT_PATH "${CMAKE_INSTALL_PREFIX}" "${CMAKE_SYSROOT}")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment