Merge branch 'momo5502:main' into main

This commit is contained in:
Hacksign
2025-05-30 13:58:12 +08:00
committed by GitHub
20 changed files with 163 additions and 73 deletions

View File

@@ -160,10 +160,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
@@ -214,24 +210,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()

14
cmake/sccache.cmake Normal file
View File

@@ -0,0 +1,14 @@
include_guard()
find_program(SCCACHE sccache)
if (SCCACHE)
file(TO_CMAKE_PATH "${SCCACHE}" 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()