From a14892773c3521f6c1e4852eec75f38f06663355 Mon Sep 17 00:00:00 2001 From: Armin Novak Date: Wed, 25 Jan 2017 09:05:27 +0100 Subject: [PATCH 1/3] Added CCACHE detection and option to disable. --- CMakeLists.txt | 6 ++++++ cmake/ConfigOptions.cmake | 1 + 2 files changed, 7 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 654aa5e26..8b65c735a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -107,6 +107,12 @@ if(CMAKE_CROSSCOMPILING) SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM BOTH) endif(CMAKE_CROSSCOMPILING) +find_program(CCACHE ccache) +if(CCACHE AND WITH_CCACHE) + set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ${CCACHE}) + set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK ${CCACHE}) +endif(CCACHE AND WITH_CCACHE) + include(GetGitRevisionDescription) git_get_exact_tag(GIT_REVISION --tags --always) diff --git a/cmake/ConfigOptions.cmake b/cmake/ConfigOptions.cmake index af181c845..905863eed 100644 --- a/cmake/ConfigOptions.cmake +++ b/cmake/ConfigOptions.cmake @@ -128,6 +128,7 @@ option(WITH_DEBUG_XV "Print XVideo debug messages" ${DEFAULT_DEBUG_OPTION}) option(WITH_DEBUG_RINGBUFFER "Enable Ringbuffer debug messages" ${DEFAULT_DEBUG_OPTION}) option(WITH_DEBUG_SYMBOLS "Pack debug symbols to installer" OFF) +option(WITH_CCACHE "Use ccache support if available" ON) if(ANDROID) include(ConfigOptionsAndroid) From 8b6b4961a6d91231fb6631631b324d0d97d313eb Mon Sep 17 00:00:00 2001 From: Armin Novak Date: Wed, 25 Jan 2017 15:19:31 +0100 Subject: [PATCH 2/3] Added CCACHE support for OpenSSL builds. --- scripts/android-build-common.sh | 4 ++++ scripts/android-build-openssl.sh | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/scripts/android-build-common.sh b/scripts/android-build-common.sh index 77313184a..b1f074ed7 100644 --- a/scripts/android-build-common.sh +++ b/scripts/android-build-common.sh @@ -11,6 +11,10 @@ if [ -z $NDK_TARGET ]; then NDK_TARGET=21 fi +if [ -z $CCACHE ]; then + CCACHE=$(which ccache) +fi + if [ -z $ANDROID_NDK ]; then ANDROID_NDK="missing" fi diff --git a/scripts/android-build-openssl.sh b/scripts/android-build-openssl.sh index de2c7474b..a0f443ffb 100755 --- a/scripts/android-build-openssl.sh +++ b/scripts/android-build-openssl.sh @@ -30,7 +30,7 @@ function build { common_run export CROSS_SYSROOT=$ANDROID_NDK/platforms/android-$NDK_TARGET/$PLATFORM_PREFIX common_run export ANDROID_DEV=$ANDROID_NDK/platforms/android-$NDK_TARGET/$PLATFORM_PREFIX/usr - common_run export CROSS_COMPILE=$ARCH_PREFIX + common_run export CROSS_COMPILE="$CCACHE $ARCH_PREFIX" common_run export PATH=$ANDROID_NDK/toolchains/$TOOLCHAIN_PREFIX$COMPILER/prebuilt/$HOST_PLATFORM/bin/:$ORG_PATH echo "CONFIG=$CONFIG" From 052e4bb5823087ee1c7720bf33068583a3b86a02 Mon Sep 17 00:00:00 2001 From: Armin Novak Date: Wed, 25 Jan 2017 16:00:29 +0100 Subject: [PATCH 3/3] Added CCACHE support for android OpenH264 build. --- scripts/android-build-openh264.sh | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/scripts/android-build-openh264.sh b/scripts/android-build-openh264.sh index 78a08ab2c..e8ce674c8 100755 --- a/scripts/android-build-openh264.sh +++ b/scripts/android-build-openh264.sh @@ -11,6 +11,12 @@ function build { PATH=$ANDROID_NDK:$PATH MAKE="make PATH=$PATH OS=android NDKROOT=$ANDROID_NDK TARGET=android-$2 NDKLEVEL=$2 ARCH=$1 -j libraries" common_run git clean -xdf + common_run export QUIET_AR="$CCACHE " + common_run export QUIET_ASM="$CCACHE " + common_run export QUIET_CC="$CCACHE " + common_run export QUIET_CCAR="$CCACHE " + common_run export QUIET_CXX="$CCACHE " + common_run $MAKE # Install creates a non optimal directory layout, fix that common_run $MAKE PREFIX=$BUILD_SRC/libs/$1 install