CMake 3.25+, C++20, avertissements stricts, règles de déterminisme (pas de fast-math ni de contraction FMA), sanitizers et clang-tidy optionnels, doctest. Presets Windows/Linux/macOS, scripts build.ps1, build.sh et check.ps1 (pas de CI serveur). README de core, 3d et schema.
50 lines
2.0 KiB
CMake
50 lines
2.0 KiB
CMake
# SPDX-License-Identifier: MPL-2.0
|
|
#
|
|
# Options de compilation communes à toutes les cibles SEQUA.
|
|
# Les règles de déterminisme suivent docs/SEQUA_Engine_resume_complet_v2.md §10.1 :
|
|
# pas de fast-math, pas de contraction multiplication-addition.
|
|
|
|
if(SEQUA_CLANG_TIDY)
|
|
find_program(SEQUA_CLANG_TIDY_EXE NAMES clang-tidy REQUIRED)
|
|
endif()
|
|
|
|
function(sequa_target_defaults target)
|
|
if(MSVC)
|
|
target_compile_options(${target} PRIVATE
|
|
/W4 /permissive- /utf-8 /Zc:__cplusplus /Zc:preprocessor
|
|
# Depuis VS 2022, /fp:precise ne contracte plus a*b+c en FMA (seul /fp:contract le fait).
|
|
/fp:precise)
|
|
if(SEQUA_WARNINGS_AS_ERRORS)
|
|
target_compile_options(${target} PRIVATE /WX)
|
|
endif()
|
|
else()
|
|
target_compile_options(${target} PRIVATE
|
|
-Wall -Wextra -Wpedantic -Wshadow -Wconversion -Wsign-conversion
|
|
-Wnon-virtual-dtor -Wold-style-cast -Woverloaded-virtual
|
|
-ffp-contract=off -fno-fast-math)
|
|
if(SEQUA_WARNINGS_AS_ERRORS)
|
|
target_compile_options(${target} PRIVATE -Werror)
|
|
endif()
|
|
endif()
|
|
|
|
if(SEQUA_SANITIZERS)
|
|
if(MSVC)
|
|
if("address" IN_LIST SEQUA_SANITIZERS)
|
|
target_compile_options(${target} PRIVATE /fsanitize=address /Zi)
|
|
target_link_options(${target} PRIVATE /INCREMENTAL:NO)
|
|
endif()
|
|
if("undefined" IN_LIST SEQUA_SANITIZERS)
|
|
message(STATUS "UBSan n'existe pas sous MSVC : ignoré pour ${target}")
|
|
endif()
|
|
else()
|
|
list(JOIN SEQUA_SANITIZERS "," _sanitizers)
|
|
target_compile_options(${target} PRIVATE -fsanitize=${_sanitizers} -fno-omit-frame-pointer -fno-sanitize-recover=all)
|
|
target_link_options(${target} PRIVATE -fsanitize=${_sanitizers})
|
|
endif()
|
|
endif()
|
|
|
|
if(SEQUA_CLANG_TIDY)
|
|
set_target_properties(${target} PROPERTIES CXX_CLANG_TIDY "${SEQUA_CLANG_TIDY_EXE}")
|
|
endif()
|
|
endfunction()
|