mirror of
https://github.com/momo5502/emulator.git
synced 2026-01-19 03:33:56 +00:00
Add sccache to CI (#338)
This commit is contained in:
24
.github/workflows/build.yml
vendored
24
.github/workflows/build.yml
vendored
@@ -52,6 +52,14 @@ jobs:
|
||||
sudo update-alternatives --set cc /usr/bin/clang-${{ env.LLVM_VERSION }}
|
||||
sudo update-alternatives --set c++ /usr/bin/clang++-${{ env.LLVM_VERSION }}
|
||||
|
||||
- name: Run sccache-cache
|
||||
uses: mozilla-actions/sccache-action@v0.0.9
|
||||
|
||||
- name: Setup Environment Variables
|
||||
shell: bash
|
||||
run: |
|
||||
echo "SCCACHE_GHA_ENABLED=true" >> $GITHUB_ENV
|
||||
|
||||
- name: CMake Build
|
||||
run: cmake --preset=release -DMOMO_ENABLE_CLANG_TIDY=On && cmake --build --preset=release
|
||||
|
||||
@@ -86,6 +94,14 @@ jobs:
|
||||
- name: Enable Developer Command Prompt
|
||||
uses: ilammy/msvc-dev-cmd@v1.13.0
|
||||
|
||||
- name: Run sccache-cache
|
||||
uses: mozilla-actions/sccache-action@v0.0.9
|
||||
|
||||
- name: Setup Environment Variables
|
||||
shell: bash
|
||||
run: |
|
||||
echo "SCCACHE_GHA_ENABLED=true" >> $GITHUB_ENV
|
||||
|
||||
- name: CMake Build
|
||||
run: cmake --preset=release && cmake --build --preset=release -t dump-apiset
|
||||
|
||||
@@ -255,7 +271,15 @@ jobs:
|
||||
ndk-version: r26d
|
||||
add-to-path: false
|
||||
|
||||
- name: Run sccache-cache
|
||||
uses: mozilla-actions/sccache-action@v0.0.9
|
||||
|
||||
- name: Setup Environment Variables
|
||||
shell: bash
|
||||
run: |
|
||||
echo "SCCACHE_GHA_ENABLED=true" >> $GITHUB_ENV
|
||||
|
||||
- name: Setup Android Environment Variables
|
||||
shell: bash
|
||||
if: ${{ startsWith(matrix.platform, 'Android') }}
|
||||
run: |
|
||||
|
||||
@@ -29,6 +29,9 @@ endif()
|
||||
# It doesn't support it, even if it thinks it does...
|
||||
set(ENV{ARCHFLAGS} "nope")
|
||||
|
||||
##########################################
|
||||
|
||||
include(cmake/sccache.cmake)
|
||||
|
||||
##########################################
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
"build"
|
||||
],
|
||||
"cacheVariables": {
|
||||
"CMAKE_BUILD_TYPE": "Release"
|
||||
"CMAKE_BUILD_TYPE": "RelWithDebInfo"
|
||||
}
|
||||
},
|
||||
{
|
||||
|
||||
@@ -145,10 +145,6 @@ if(MSVC)
|
||||
/INCREMENTAL:NO
|
||||
)
|
||||
|
||||
momo_add_c_and_cxx_release_compile_options(
|
||||
/Ob2
|
||||
)
|
||||
|
||||
add_compile_definitions(
|
||||
_CRT_SECURE_NO_WARNINGS
|
||||
_CRT_NONSTDC_NO_WARNINGS
|
||||
@@ -199,24 +195,6 @@ endif()
|
||||
|
||||
##########################################
|
||||
|
||||
set(OPT_DEBUG "-O0 -g")
|
||||
set(OPT_RELEASE "-O3 -g")
|
||||
|
||||
if(MSVC)
|
||||
set(OPT_DEBUG "/Od /Ob0 /Zi")
|
||||
set(OPT_RELEASE "/O2 /Ob2 /Zi")
|
||||
|
||||
add_link_options(/DEBUG)
|
||||
endif()
|
||||
|
||||
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} ${OPT_DEBUG}")
|
||||
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} ${OPT_DEBUG}")
|
||||
|
||||
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} ${OPT_RELEASE}")
|
||||
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} ${OPT_RELEASE}")
|
||||
|
||||
##########################################
|
||||
|
||||
if(CMAKE_GENERATOR MATCHES "Visual Studio")
|
||||
momo_add_c_and_cxx_compile_options(/MP)
|
||||
endif()
|
||||
|
||||
13
cmake/sccache.cmake
Normal file
13
cmake/sccache.cmake
Normal file
@@ -0,0 +1,13 @@
|
||||
include_guard()
|
||||
|
||||
find_program(SCCACHE sccache)
|
||||
|
||||
if (SCCACHE)
|
||||
set(CMAKE_C_COMPILER_LAUNCHER ${SCCACHE})
|
||||
set(CMAKE_CXX_COMPILER_LAUNCHER ${SCCACHE})
|
||||
set(CMAKE_MSVC_DEBUG_INFORMATION_FORMAT Embedded)
|
||||
|
||||
if(POLICY CMP0141)
|
||||
cmake_policy(SET CMP0141 NEW)
|
||||
endif()
|
||||
endif()
|
||||
@@ -35,13 +35,18 @@ endif()
|
||||
|
||||
set(ICICLE_RUST_LIB ${ICICLE_ARTIFACT_DIR}/${ICICLE_RUST_LIBNAME})
|
||||
|
||||
set(SCCACHE_ENV "MOMO_DUMMY_ENV=1")
|
||||
if (SCCACHE)
|
||||
set(SCCACHE_ENV "RUSTC_WRAPPER=${SCCACHE}")
|
||||
endif()
|
||||
|
||||
ExternalProject_Add(
|
||||
icicle-rust-project
|
||||
PREFIX ${CMAKE_CURRENT_BINARY_DIR}
|
||||
SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}
|
||||
BINARY_DIR ${CMAKE_CURRENT_LIST_DIR}
|
||||
CONFIGURE_COMMAND ""
|
||||
BUILD_COMMAND ${CMAKE_COMMAND} -E env "CARGO_TARGET_DIR=${ICICLE_BUILD_DIR}" cargo build ${CARGO_OPTIONS} --lib --profile $<IF:$<CONFIG:Debug>,dev,release>
|
||||
BUILD_COMMAND ${CMAKE_COMMAND} -E env "CARGO_TARGET_DIR=${ICICLE_BUILD_DIR}" "${SCCACHE_ENV}" -- cargo build ${CARGO_OPTIONS} --lib --profile $<IF:$<CONFIG:Debug>,dev,release>
|
||||
INSTALL_COMMAND ""
|
||||
USES_TERMINAL_CONFIGURE 1
|
||||
USES_TERMINAL_BUILD 1
|
||||
|
||||
Reference in New Issue
Block a user