From 05d125efbfb1350cd0b92beee263f99ea6e110f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Janiszewski?= Date: Fri, 18 Oct 2024 23:07:56 +0200 Subject: [PATCH] Add option to skip headers check In some configuration, such as our docker build, there's no need to perform headers check, as it is handled by a different job already. --- CMakeLists.txt | 3 ++- src/openrct2-ui/CMakeLists.txt | 2 +- src/openrct2/CMakeLists.txt | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f28655de68..c0dd6b38d6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -113,9 +113,10 @@ option(DISABLE_TTF "Disable support for TTF provided by freetype2.") option(ENABLE_SCRIPTING "Enable script / plugin support." ON) option(ENABLE_ASAN "Enable the AddressSanitizer.") option(ENABLE_UBSAN "Enable the UndefinedBehaviourSanitizer.") - +option(ENABLE_HEADERS_CHECK "Check if include directives in header files are correct. Only works with clang" ON) option(DISABLE_GUI "Don't build GUI. (Headless only.)") + if (FORCE32) set(TARGET_M "-m32") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${TARGET_M}") diff --git a/src/openrct2-ui/CMakeLists.txt b/src/openrct2-ui/CMakeLists.txt index 64c2378bfb..b321a5dedb 100644 --- a/src/openrct2-ui/CMakeLists.txt +++ b/src/openrct2-ui/CMakeLists.txt @@ -158,7 +158,7 @@ endif () # Only valid for Clang for now: # - GCC 8 does not support -Wno-pragma-once-outside-header # - Other compilers status unknown -if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") +if (ENABLE_HEADERS_CHECK AND "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") set(OPENRCT2_HEADERS_CHECK ${OPENRCT2_UI_HEADERS}) # OpenGLAPIProc.h is not meant to be included directly. list(REMOVE_ITEM OPENRCT2_HEADERS_CHECK "${CMAKE_CURRENT_LIST_DIR}/drawing/engines/opengl/OpenGLAPIProc.h") diff --git a/src/openrct2/CMakeLists.txt b/src/openrct2/CMakeLists.txt index 6ad152ac03..81afc79674 100644 --- a/src/openrct2/CMakeLists.txt +++ b/src/openrct2/CMakeLists.txt @@ -262,7 +262,7 @@ endif() # Only valid for Clang for now: # - GCC 8 does not support -Wno-pragma-once-outside-header # - Other compilers status unknown -if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") +if (ENABLE_HEADERS_CHECK AND "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") add_library(${PROJECT_NAME}-headers-check OBJECT ${OPENRCT2_CORE_HEADERS}) set_target_properties(${PROJECT_NAME}-headers-check PROPERTIES LINKER_LANGUAGE CXX) set_source_files_properties(${OPENRCT2_CORE_HEADERS} PROPERTIES LANGUAGE CXX)