add ccache
This commit is contained in:
@@ -5,3 +5,4 @@ Horizon OC Compilation Instructions
|
|||||||
3. Clone the Horizon OC develop branch (``git clone https://github.com/Horizon-OC/Horizon-OC.git --recurse-submodules``)
|
3. Clone the Horizon OC develop branch (``git clone https://github.com/Horizon-OC/Horizon-OC.git --recurse-submodules``)
|
||||||
4. Run ``./build.sh`` in the root directory
|
4. Run ``./build.sh`` in the root directory
|
||||||
- If you want to compile with extensions, append ``--ext``
|
- If you want to compile with extensions, append ``--ext``
|
||||||
|
- Installing ``ccache`` is optional; if it is on your PATH it is used automatically to speed up rebuilds
|
||||||
|
|||||||
38
build.sh
38
build.sh
@@ -64,6 +64,16 @@ echo "CORES: $CORES"
|
|||||||
JOBS="${JOBS:-$CORES}"
|
JOBS="${JOBS:-$CORES}"
|
||||||
echo "JOBS: $JOBS"
|
echo "JOBS: $JOBS"
|
||||||
|
|
||||||
|
if command -v ccache >/dev/null 2>&1; then
|
||||||
|
export ATMOSPHERE_CCACHE="ccache"
|
||||||
|
export CCACHE_BASEDIR="$ROOT_DIR"
|
||||||
|
export CCACHE_SLOPPINESS="time_macros,include_file_mtime,include_file_ctime,pch_defines,locale"
|
||||||
|
export CCACHE_MAXSIZE="10G"
|
||||||
|
echo "CCACHE: enabled ($(ccache --version | head -n1))"
|
||||||
|
else
|
||||||
|
echo "CCACHE: not found, building without it"
|
||||||
|
fi
|
||||||
|
|
||||||
SRC="Source/Atmosphere/stratosphere/loader/"
|
SRC="Source/Atmosphere/stratosphere/loader/"
|
||||||
|
|
||||||
mkdir -p "build"
|
mkdir -p "build"
|
||||||
@@ -109,6 +119,28 @@ if [ "$NO_EXO" -eq 0 ]; then
|
|||||||
cp -v "$EXO_SRC/secmon_memory_layout.hpp" "$LIBEXO_DEST/"
|
cp -v "$EXO_SRC/secmon_memory_layout.hpp" "$LIBEXO_DEST/"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
CCACHE_MKS="build/atmosphere/libraries/config/common.mk
|
||||||
|
build/atmosphere/libraries/config/templates/stratosphere.mk
|
||||||
|
build/atmosphere/libraries/libstratosphere/libstratosphere.mk"
|
||||||
|
|
||||||
|
for CCACHE_MK in $CCACHE_MKS; do
|
||||||
|
if ! grep -q "ATMOSPHERE_CCACHE" "$CCACHE_MK"; then
|
||||||
|
echo
|
||||||
|
echo "*** Patching $CCACHE_MK for ccache ***"
|
||||||
|
cat >> "$CCACHE_MK" <<'EOF'
|
||||||
|
|
||||||
|
ifneq ($(strip $(ATMOSPHERE_CCACHE)),)
|
||||||
|
ifneq ($(firstword $(CC)),$(ATMOSPHERE_CCACHE))
|
||||||
|
export CC := $(ATMOSPHERE_CCACHE) $(CC)
|
||||||
|
endif
|
||||||
|
ifneq ($(firstword $(CXX)),$(ATMOSPHERE_CCACHE))
|
||||||
|
export CXX := $(ATMOSPHERE_CCACHE) $(CXX)
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
EOF
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
echo
|
echo
|
||||||
echo "*** Compiling loader ***"
|
echo "*** Compiling loader ***"
|
||||||
cd build/atmosphere/stratosphere/loader || exit 1
|
cd build/atmosphere/stratosphere/loader || exit 1
|
||||||
@@ -126,6 +158,12 @@ if [ "$NO_EXO" -eq 0 ]; then
|
|||||||
cp -v build/atmosphere/exosphere/out/nintendo_nx_arm64_armv8a/release/exosphere.bin dist/atmosphere/exosphere.bin
|
cp -v build/atmosphere/exosphere/out/nintendo_nx_arm64_armv8a/release/exosphere.bin dist/atmosphere/exosphere.bin
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ -n "$ATMOSPHERE_CCACHE" ]; then
|
||||||
|
echo
|
||||||
|
echo "*** ccache stats ***"
|
||||||
|
ccache --show-stats
|
||||||
|
fi
|
||||||
|
|
||||||
cd Source/hoc-clk/
|
cd Source/hoc-clk/
|
||||||
./build.sh
|
./build.sh
|
||||||
cp -r dist/ ../../
|
cp -r dist/ ../../
|
||||||
|
|||||||
Reference in New Issue
Block a user