generated from McMassiveNZ/blank-slate
build: modernize repo-lens skeleton and cross-platform configuration
CI / build (debug, map[compiler:appleclang os:macos-latest]) (push) Canceled after 0s
CI / build (debug, map[compiler:clang os:ubuntu-latest]) (push) Canceled after 0s
CI / build (debug, map[compiler:gcc os:ubuntu-latest]) (push) Canceled after 0s
CI / build (debug, map[compiler:msvc os:windows-latest]) (push) Canceled after 0s
CI / build (release, map[compiler:appleclang os:macos-latest]) (push) Canceled after 0s
CI / build (release, map[compiler:clang os:ubuntu-latest]) (push) Canceled after 0s
CI / build (release, map[compiler:gcc os:ubuntu-latest]) (push) Canceled after 0s
CI / build (release, map[compiler:msvc os:windows-latest]) (push) Canceled after 0s
CI / build (sanitizers, map[compiler:appleclang os:macos-latest]) (push) Canceled after 0s
CI / build (sanitizers, map[compiler:clang os:ubuntu-latest]) (push) Canceled after 0s
CI / build (sanitizers, map[compiler:gcc os:ubuntu-latest]) (push) Canceled after 0s
CI / build (sanitizers, map[compiler:msvc os:windows-latest]) (push) Canceled after 0s
CI / build (debug, map[compiler:appleclang os:macos-latest]) (push) Canceled after 0s
CI / build (debug, map[compiler:clang os:ubuntu-latest]) (push) Canceled after 0s
CI / build (debug, map[compiler:gcc os:ubuntu-latest]) (push) Canceled after 0s
CI / build (debug, map[compiler:msvc os:windows-latest]) (push) Canceled after 0s
CI / build (release, map[compiler:appleclang os:macos-latest]) (push) Canceled after 0s
CI / build (release, map[compiler:clang os:ubuntu-latest]) (push) Canceled after 0s
CI / build (release, map[compiler:gcc os:ubuntu-latest]) (push) Canceled after 0s
CI / build (release, map[compiler:msvc os:windows-latest]) (push) Canceled after 0s
CI / build (sanitizers, map[compiler:appleclang os:macos-latest]) (push) Canceled after 0s
CI / build (sanitizers, map[compiler:clang os:ubuntu-latest]) (push) Canceled after 0s
CI / build (sanitizers, map[compiler:gcc os:ubuntu-latest]) (push) Canceled after 0s
CI / build (sanitizers, map[compiler:msvc os:windows-latest]) (push) Canceled after 0s
Replace CPM with FetchContent and update GoogleTest to v1.18.0. Add compiler toolchains and Debug, Release, and sanitizer presets. Require CMake 4.0, use target properties for compiler settings, and enable compilation database export. Fix skeleton compilation errors and adopt trailing return types, nodiscard execute methods, and noexcept signatures. Update CI and project documentation without implementing any TODOs. Validated Windows builds and tests in all three configurations.
This commit is contained in:
1 parent
dd9f0a4c3a
commit
70c43b6a68
25 files changed
+510
-176
No files matched your search
+29
-15
@@ -1,20 +1,34 @@
|
||||
include_guard()
|
||||
|
||||
function( target_enable_sanitizers _target )
|
||||
if( MSVC )
|
||||
string(FIND "$ENV{PATH}" "$ENV{VSINSTALLDIR}" index_of_vs_install_dir)
|
||||
include(CheckCXXSourceCompiles)
|
||||
include(CMakePushCheckState)
|
||||
|
||||
if("${index_of_vs_install_dir}" STREQUAL "-1")
|
||||
message(
|
||||
SEND_ERROR
|
||||
"Using MSVC sanitizers requires setting the MSVC environment before building the project. Please manually open the MSVC command prompt and rebuild the project."
|
||||
)
|
||||
endif()
|
||||
|
||||
target_compile_options(${_target} PUBLIC /fsanitize=address /Zi /INCREMENTAL:NO)
|
||||
target_link_options(${_target} PUBLIC /INCREMENTAL:NO)
|
||||
function(target_enable_sanitizers _target)
|
||||
if(MSVC)
|
||||
set(_compile_options /fsanitize=address)
|
||||
set(_link_options /INCREMENTAL:NO)
|
||||
# Use the same settings for this target and the capability check.
|
||||
set_property(TARGET ${_target} PROPERTY MSVC_RUNTIME_CHECKS "")
|
||||
set_property(TARGET ${_target} PROPERTY MSVC_DEBUG_INFORMATION_FORMAT ProgramDatabase)
|
||||
set(CMAKE_MSVC_RUNTIME_CHECKS "")
|
||||
set(CMAKE_MSVC_DEBUG_INFORMATION_FORMAT ProgramDatabase)
|
||||
elseif(CMAKE_CXX_COMPILER_ID MATCHES "^(GNU|Clang|AppleClang)$")
|
||||
set(_compile_options -fsanitize=address,undefined -fno-sanitize-recover=undefined -fno-omit-frame-pointer)
|
||||
set(_link_options -fsanitize=address,undefined)
|
||||
else()
|
||||
target_compile_options(${_target} INTERFACE -fsanitize=address,leak,undefined)
|
||||
target_link_options(${_target} INTERFACE -fsanitize=address,leak,undefined)
|
||||
message(FATAL_ERROR "Sanitizers are not configured for ${CMAKE_CXX_COMPILER_ID}")
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
cmake_push_check_state(RESET)
|
||||
string(JOIN " " CMAKE_REQUIRED_FLAGS ${_compile_options})
|
||||
set(CMAKE_REQUIRED_LINK_OPTIONS ${_link_options})
|
||||
set(CMAKE_TRY_COMPILE_TARGET_TYPE EXECUTABLE)
|
||||
check_cxx_source_compiles("int main() { return 0; }" REPO_LENS_SANITIZERS_SUPPORTED)
|
||||
cmake_pop_check_state()
|
||||
if(NOT REPO_LENS_SANITIZERS_SUPPORTED)
|
||||
message(FATAL_ERROR "The requested sanitizer configuration cannot compile and link. Check compiler/runtime installation or configure with ENABLE_SANITIZERS=OFF.")
|
||||
endif()
|
||||
|
||||
target_compile_options(${_target} PRIVATE ${_compile_options})
|
||||
target_link_options(${_target} PRIVATE ${_link_options})
|
||||
endfunction()
|
||||
Reference in new issue
Block a user