added ccache for build Linux on CI

This commit is contained in:
Igor Korsukov 2020-10-27 16:18:50 +02:00
parent af5a4e283c
commit 722c2fcc00
12 changed files with 136 additions and 13 deletions

View File

@ -33,6 +33,28 @@ jobs:
uses: actions/checkout@v2
with:
ref: 3.x
- name: Prepare ccache timestamp
id: ccache_cache_timestamp
run: |
NOW=$(date -u +"%F-%T")
echo "::set-output name=timestamp::${NOW}"
- name: Сcache cache files
uses: actions/cache@v2
with:
path: ~/.ccache
key: ${{github.workflow}}-ccache-${{steps.ccache_cache_timestamp.outputs.timestamp}}
restore-keys: ${{github.workflow}}-ccache- # restore ccache from either previous build on this branch or on master
- name: Setup ccache
run: |
sudo apt install ccache
mkdir -p ~/.ccache
echo "base_dir = ${GITHUB_WORKSPACE}" > ~/.ccache/ccache.conf
echo "compression = true" >> ~/.ccache/ccache.conf
echo "compression_level = 6" >> ~/.ccache/ccache.conf
echo "max_size = 2G" >> ~/.ccache/ccache.conf
cat ~/.ccache/ccache.conf
ccache -s
ccache -z
- name: "Configure workflow"
run: |
sudo bash ./build/ci/tools/make_build_mode_env.sh -e ${{ github.event_name }} -m ${{ github.event.inputs.build_mode }}

View File

@ -27,8 +27,28 @@ jobs:
access_token: ${{ github.token }}
- name: Clone repository
uses: actions/checkout@v2
- name: Prepare ccache timestamp
id: ccache_cache_timestamp
run: |
NOW=$(date -u +"%F-%T")
echo "::set-output name=timestamp::${NOW}"
- name: Сcache cache files
uses: actions/cache@v2
with:
fetch-depth: 3
path: ~/.ccache
key: ${{github.workflow}}-ccache-${{steps.ccache_cache_timestamp.outputs.timestamp}}
restore-keys: ${{github.workflow}}-ccache- # restore ccache from either previous build on this branch or on master
- name: Setup ccache
run: |
sudo apt install ccache
mkdir -p ~/.ccache
echo "base_dir = ${GITHUB_WORKSPACE}" > ~/.ccache/ccache.conf
echo "compression = true" >> ~/.ccache/ccache.conf
echo "compression_level = 6" >> ~/.ccache/ccache.conf
echo "max_size = 2G" >> ~/.ccache/ccache.conf
cat ~/.ccache/ccache.conf
ccache -s
ccache -z
- name: "Configure workflow"
run: |
sudo bash ./build/ci/tools/make_build_mode_env.sh -e ${{ github.event_name }} -m ${{ github.event.inputs.build_mode }}
@ -53,6 +73,8 @@ jobs:
run: |
T_ID=${{ secrets.TELEMETRY_TRACK_ID }}; if [ -z "$T_ID" ]; then T_ID="''"; fi
sudo bash ./build/ci/linux/build.sh -n ${{ github.run_id }} --telemetry $T_ID --build_mu4 ON
echo "============== ccache ==============="
ccache -s
- name: "Run unit tests"
run: |
sudo bash ./build/ci/linux/runutests.sh

View File

@ -30,8 +30,17 @@ jobs:
access_token: ${{ github.token }}
- name: Clone repository
uses: actions/checkout@v2
- name: Prepare ccache timestamp
id: ccache_cache_timestamp
run: |
NOW=$(date -u +"%F-%T")
echo "::set-output name=timestamp::${NOW}"
- name: Сcache cache files
uses: actions/cache@v2
with:
fetch-depth: 3
path: ~/.ccache
key: ${{github.workflow}}-ccache-${{steps.ccache_cache_timestamp.outputs.timestamp}}
restore-keys: ${{github.workflow}}-ccache- # restore ccache from either previous build on this branch or on master
- name: "Configure workflow"
run: |
bash ./build/ci/tools/make_build_mode_env.sh -e ${{ github.event_name }} -m ${{ github.event.inputs.build_mode }}
@ -70,10 +79,23 @@ jobs:
- name: Setup environment
run: |
bash ./build/ci/macos/setup.sh
- name: Setup ccache
run: |
brew install ccache
mkdir -p ~/.ccache
echo "base_dir = ${GITHUB_WORKSPACE}" > ~/.ccache/ccache.conf
echo "compression = true" >> ~/.ccache/ccache.conf
echo "compression_level = 6" >> ~/.ccache/ccache.conf
echo "max_size = 2G" >> ~/.ccache/ccache.conf
cat ~/.ccache/ccache.conf
ccache -s
ccache -z
- name: Build
run: |
T_ID=${{ secrets.TELEMETRY_TRACK_ID }}; if [ -z "$T_ID" ]; then T_ID="''"; fi
bash ./build/ci/macos/build.sh -n ${{ github.run_id }} --telemetry $T_ID --build_mu4 ON
echo "============== ccache ==============="
ccache -s
- name: Package
run: |
S_S="${{ secrets.MAC_SIGN_CERTIFICATE_ENCRYPT_SECRET }}"; if [ -z "$S_S" ]; then S_S="''"; fi

View File

@ -20,7 +20,34 @@
project(mscore)
# Minimum tested, report if it works with older
CMAKE_MINIMUM_REQUIRED(VERSION 3.3.0)
CMAKE_MINIMUM_REQUIRED(VERSION 3.4.0)
find_program(CCACHE_PROGRAM ccache)
if(CCACHE_PROGRAM)
message(STATUS "Using ccache")
# Set up wrapper scripts
set(C_LAUNCHER "${CCACHE_PROGRAM}")
set(CXX_LAUNCHER "${CCACHE_PROGRAM}")
configure_file(build/launch-c.in launch-c)
configure_file(build/launch-cxx.in launch-cxx)
execute_process(COMMAND chmod a+rx
"${CMAKE_BINARY_DIR}/launch-c"
"${CMAKE_BINARY_DIR}/launch-cxx"
)
if(CMAKE_GENERATOR STREQUAL "Xcode")
# Set Xcode project attributes to route compilation and linking
# through our scripts
set(CMAKE_XCODE_ATTRIBUTE_CC "${CMAKE_BINARY_DIR}/launch-c")
set(CMAKE_XCODE_ATTRIBUTE_CXX "${CMAKE_BINARY_DIR}/launch-cxx")
set(CMAKE_XCODE_ATTRIBUTE_LD "${CMAKE_BINARY_DIR}/launch-c")
set(CMAKE_XCODE_ATTRIBUTE_LDPLUSPLUS "${CMAKE_BINARY_DIR}/launch-cxx")
else()
# Support Unix Makefiles and Ninja
set(CMAKE_C_COMPILER_LAUNCHER "${CMAKE_BINARY_DIR}/launch-c")
set(CMAKE_CXX_COMPILER_LAUNCHER "${CMAKE_BINARY_DIR}/launch-cxx")
endif()
endif()
include(build/functions.cmake) # library of CMake functions ("fn__" namespace)
@ -168,6 +195,7 @@ set(TELEMETRY_TRACK_ID "" CACHE STRING "Telemetry track id")
option(BUILD_PORTABLEAPPS "Windows build for PortableApps.com" OFF)
option(BUILD_UI_MU4_WITH_MU3 "Build Modern UI MuseScore 4 and MU3 source code" OFF)
option(BUILD_UNIT_TESTS "Build gtest unit test" OFF)
option(MODULE_BUILD_PCH "Build using precompiled headers in MU4 modules" ON)
option(QML_LOAD_FROM_SOURCE "Load qml files from source (not resource)" OFF)
option(PACKAGE_FILE_ASSOCIATION "File types association" OFF)

View File

@ -47,6 +47,7 @@ BUILD_UI_MU4="OFF"
BUILD_UNIT_TESTS="OFF"
BUILD_VST="OFF"
VST3_SDK_PATH=""
MODULE_BUILD_PCH="ON"
#
# change path to include your Qt5 installation
@ -76,6 +77,7 @@ release:
-DBUILD_UI_MU4="${BUILD_UI_MU4}" \
-DBUILD_VST="${BUILD_VST}" \
-DVST3_SDK_PATH="${VST3_SDK_PATH}" \
-DMODULE_BUILD_PCH="${MODULE_BUILD_PCH}" \
-DBUILD_UNIT_TESTS="${BUILD_UNIT_TESTS}" \
-DCMAKE_SKIP_RPATH="${NO_RPATH}" ..; \
make lrelease; \

View File

@ -24,6 +24,7 @@ TELEMETRY_TRACK_ID=""
BUILD_UI_MU4="OFF"
BUILD_VST="OFF"
VST3_SDK_PATH=""
MODULE_BUILD_PCH="ON"
XCODEPROJ = mscore.xcodeproj
@ -43,6 +44,7 @@ release:
-DBUILD_UI_MU4="${BUILD_UI_MU4}" \
-DBUILD_VST="${BUILD_VST}" \
-DVST3_SDK_PATH="${VST3_SDK_PATH}" \
-DMODULE_BUILD_PCH="${MODULE_BUILD_PCH}" \
.. -G Xcode; \
xcodebuild -project ${XCODEPROJ} -target lrelease; \
$(FORMATTER_START) xcodebuild -project ${XCODEPROJ} -configuration Release -target ALL_BUILD $(FORMATTER_END); \

View File

@ -56,7 +56,7 @@ else
BUILD_VST=ON
fi
echo "=== BUILD === "
echo "=== BUILD ==="
make revision
make -j2 MUSESCORE_BUILD_CONFIG=$MUSESCORE_BUILD_CONFIG \
@ -66,6 +66,7 @@ make -j2 MUSESCORE_BUILD_CONFIG=$MUSESCORE_BUILD_CONFIG \
BUILD_VST=$BUILD_VST \
VST3_SDK_PATH=$VST3_SDK_PATH \
BUILD_UNIT_TESTS=ON \
MODULE_BUILD_PCH=OFF \
portable

View File

@ -115,7 +115,6 @@ update-alternatives \
--install /usr/bin/gcc gcc "/usr/bin/gcc-${gcc_version}" 40 \
--slave /usr/bin/g++ g++ "/usr/bin/g++-${gcc_version}"
#apt-get install -y --no-install-recommends g++
echo export CC="/usr/bin/gcc-${gcc_version}" >> ${ENV_FILE}
echo export CXX="/usr/bin/g++-${gcc_version}" >> ${ENV_FILE}

View File

@ -47,8 +47,8 @@ make -f Makefile.osx ci MUSESCORE_BUILD_CONFIG=$MUSESCORE_BUILD_CONFIG \
TELEMETRY_TRACK_ID=$TELEMETRY_TRACK_ID \
BUILD_UI_MU4=$BUILD_UI_MU4 \
BUILD_VST=$BUILD_VST \
VST3_SDK_PATH=$VST3_SDK_PATH
VST3_SDK_PATH=$VST3_SDK_PATH \
MODULE_BUILD_PCH=OFF
bash ./build/ci/tools/make_release_channel_env.sh -c $MUSESCORE_BUILD_CONFIG

10
build/launch-c.in Normal file
View File

@ -0,0 +1,10 @@
#!/bin/sh
# Xcode generator doesn't include the compiler as the
# first argument, Ninja and Makefiles do. Handle both cases.
if [ "$1" = "${CMAKE_C_COMPILER}" ] ; then
shift
fi
export CCACHE_CPP2=true
exec "${C_LAUNCHER}" "${CMAKE_C_COMPILER}" "$@"

10
build/launch-cxx.in Normal file
View File

@ -0,0 +1,10 @@
#!/bin/sh
# Xcode generator doesn't include the compiler as the
# first argument, Ninja and Makefiles do. Handle both cases.
if [ "$1" = "${CMAKE_CXX_COMPILER}" ] ; then
shift
fi
export CCACHE_CPP2=true
exec "${CXX_LAUNCHER}" "${CMAKE_CXX_COMPILER}" "$@"

View File

@ -84,18 +84,22 @@ endif()
set(MODULE_LINK ${QT_LIBRARIES} ${MODULE_LINK})
target_link_libraries(${MODULE}
${MODULE_LINK}
)
target_link_libraries(${MODULE} ${MODULE_LINK} )
set(LOCAL_MODULE_BUILD_PCH ${MODULE_BUILD_PCH})
if (MODULE_HAS_C_CODE)
set(LOCAL_MODULE_BUILD_PCH OFF)
if (NOT MSVC)
set_target_properties( ${MODULE} PROPERTIES COMPILE_FLAGS "-fPIC")
endif (NOT MSVC)
else(MODULE_HAS_C_CODE)
endif(MODULE_HAS_C_CODE)
if (LOCAL_MODULE_BUILD_PCH)
if (NOT MSVC)
set_target_properties (${MODULE} PROPERTIES COMPILE_FLAGS "${PCH_INCLUDE} -g -Wall -Wextra -Winvalid-pch")
else (NOT MSVC)
@ -112,7 +116,8 @@ else(MODULE_HAS_C_CODE)
ADD_DEPENDENCIES(${MODULE} mops1)
ADD_DEPENDENCIES(${MODULE} mops2)
endif (NOT MSVC)
endif()
else (LOCAL_MODULE_BUILD_PCH)
set_target_properties(${MODULE} PROPERTIES COMPILE_FLAGS "-include ${PROJECT_SOURCE_DIR}/all.h")
endif (LOCAL_MODULE_BUILD_PCH)