mirror of
https://github.com/1dot13/source.git
synced 2026-09-02 14:36:06 +02:00
make sccache available for all cmake users, not only CI
if you have it in your path, the build will use Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
committed by
majcosta
co-authored by
Claude Opus 4.8
parent
f99786e195
commit
b6c79dbead
@@ -201,9 +201,7 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
# sccache can only cache MSVC objects when the debug information is embedded
|
# sccache can only cache MSVC objects when the debug information is embedded
|
||||||
# in them (/Z7) instead of collected in a shared PDB (/Zi, the CMake default)
|
# in them (/Z7) instead of collected in a shared PDB (/Zi, the CMake default)
|
||||||
cmake -S . -B build -GNinja -DCMAKE_BUILD_TYPE=RelWithDebInfo -DApplications="$Env:JA2Application" `
|
cmake -S . -B build -GNinja -DCMAKE_BUILD_TYPE=RelWithDebInfo -DApplications="$Env:JA2Application"
|
||||||
-DCMAKE_POLICY_DEFAULT_CMP0141=NEW -DCMAKE_MSVC_DEBUG_INFORMATION_FORMAT=Embedded `
|
|
||||||
-DCMAKE_C_COMPILER_LAUNCHER=sccache -DCMAKE_CXX_COMPILER_LAUNCHER=sccache
|
|
||||||
- name: Build
|
- name: Build
|
||||||
run: |
|
run: |
|
||||||
cmake --build build/ -- -v
|
cmake --build build/ -- -v
|
||||||
|
|||||||
@@ -1,7 +1,23 @@
|
|||||||
cmake_minimum_required(VERSION 3.20)
|
cmake_minimum_required(VERSION 3.20)
|
||||||
|
|
||||||
|
# /Z7 embedded debug info so objects are self-contained and sccache-able.
|
||||||
|
# CMP0141 is a 3.25 policy; our floor is 3.20, so opt in explicitly where known.
|
||||||
|
if(POLICY CMP0141)
|
||||||
|
cmake_policy(SET CMP0141 NEW)
|
||||||
|
endif()
|
||||||
|
|
||||||
project(ja2)
|
project(ja2)
|
||||||
|
|
||||||
|
option(USE_SCCACHE "Cache compiled objects with sccache if installed" ON)
|
||||||
|
if(USE_SCCACHE)
|
||||||
|
find_program(SCCACHE_PROGRAM sccache)
|
||||||
|
if(SCCACHE_PROGRAM)
|
||||||
|
message(STATUS "Using sccache: ${SCCACHE_PROGRAM}")
|
||||||
|
set(CMAKE_C_COMPILER_LAUNCHER "${SCCACHE_PROGRAM}")
|
||||||
|
set(CMAKE_CXX_COMPILER_LAUNCHER "${SCCACHE_PROGRAM}")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
include(cmake/CopyUserPresetTemplate.cmake)
|
include(cmake/CopyUserPresetTemplate.cmake)
|
||||||
CopyUserPresetTemplate()
|
CopyUserPresetTemplate()
|
||||||
|
|
||||||
@@ -40,6 +56,9 @@ set(usingMsBuild $<STREQUAL:${CMAKE_VS_PLATFORM_NAME},Win32>)
|
|||||||
# lua51.lib and lua51.vc9.lib have been built with /MTx, so we must as well
|
# lua51.lib and lua51.vc9.lib have been built with /MTx, so we must as well
|
||||||
# TODO: build our own Lua 5.1.2 from source so we can use whichever
|
# TODO: build our own Lua 5.1.2 from source so we can use whichever
|
||||||
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
|
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
|
||||||
|
# make Debug builds /Z7 instead of /Zi so they can be sccache'd
|
||||||
|
set(CMAKE_MSVC_DEBUG_INFORMATION_FORMAT
|
||||||
|
"$<$<CONFIG:Debug,RelWithDebInfo>:Embedded>")
|
||||||
|
|
||||||
add_compile_definitions(CINTERFACE XML_STATIC VFS_STATIC VFS_WITH_SLF VFS_WITH_7ZIP _CRT_SECURE_NO_DEPRECATE)
|
add_compile_definitions(CINTERFACE XML_STATIC VFS_STATIC VFS_WITH_SLF VFS_WITH_7ZIP _CRT_SECURE_NO_DEPRECATE)
|
||||||
include_directories(
|
include_directories(
|
||||||
|
|||||||
Reference in New Issue
Block a user