diff options
author | dundargoc <gocdundar@gmail.com> | 2023-11-07 09:52:20 +0100 |
---|---|---|
committer | dundargoc <33953936+dundargoc@users.noreply.github.com> | 2023-11-18 18:38:45 +0100 |
commit | bec2ebebdacd494117ce41b31e208577ddeef510 (patch) | |
tree | 6f76f0d5e25c4c94f5b4af081a39601ede5f496f /src | |
parent | df87266b23b32b96d1e3d4d26eb721a9dd63c2a4 (diff) | |
download | rneovim-bec2ebebdacd494117ce41b31e208577ddeef510.tar.gz rneovim-bec2ebebdacd494117ce41b31e208577ddeef510.tar.bz2 rneovim-bec2ebebdacd494117ce41b31e208577ddeef510.zip |
build: various cmake fixes
- Correct MSVC warning suppression. The C4003 warning is issued during
file generation and not for the actual source files.
- Remove non-existent "scripts/pvscheck.sh" file from `lintsh` target.
- Remove spaces inside for loops with uncrustify.
- Point dependencies to use a git tag rather than releases, as releases
might have changes that deviate from the actual source code.
- Automatically update uncrustify config before formatting or linting.
Diffstat (limited to 'src')
-rw-r--r-- | src/nvim/CMakeLists.txt | 26 | ||||
-rw-r--r-- | src/uncrustify.cfg | 4 |
2 files changed, 20 insertions, 10 deletions
diff --git a/src/nvim/CMakeLists.txt b/src/nvim/CMakeLists.txt index cc5fb25b1e..792cfb894b 100644 --- a/src/nvim/CMakeLists.txt +++ b/src/nvim/CMakeLists.txt @@ -91,7 +91,7 @@ if(MSVC) target_compile_options(main_lib INTERFACE -W3) # Disable warnings that give too many false positives. - target_compile_options(main_lib INTERFACE -wd4311 -wd4146 -wd4003 -wd4715 -wd4003) + target_compile_options(main_lib INTERFACE -wd4311 -wd4146 -wd4003 -wd4715) target_compile_definitions(main_lib INTERFACE _CRT_SECURE_NO_WARNINGS _CRT_NONSTDC_NO_DEPRECATE) target_sources(main_lib INTERFACE ${CMAKE_CURRENT_LIST_DIR}/os/nvim.manifest) @@ -420,7 +420,10 @@ if(APPLE AND CMAKE_OSX_SYSROOT) list(APPEND gen_cflags "-isysroot") list(APPEND gen_cflags "${CMAKE_OSX_SYSROOT}") endif() -set(gen_cflags ${gen_cflags} -O2) +if(MSVC) + list(APPEND gen_cflags -wd4003) +endif() +list(APPEND gen_cflags -O2) set(NVIM_VERSION_GIT_H ${PROJECT_BINARY_DIR}/cmake.config/auto/versiondef_git.h) add_custom_target(update_version_stamp @@ -857,15 +860,16 @@ add_glob_target( tui/terminfo_defs.h) set(UNCRUSTIFY_PRG ${DEPS_BIN_DIR}/uncrustify) +set(UNCRUSTIFY_CONFIG ${PROJECT_SOURCE_DIR}/src/uncrustify.cfg) + +add_custom_target(uncrustify_update_config + ${UNCRUSTIFY_PRG} -c ${UNCRUSTIFY_CONFIG} --update-config-with-doc -o ${UNCRUSTIFY_CONFIG}) + add_glob_target( TARGET lintc-uncrustify COMMAND ${UNCRUSTIFY_PRG} - FLAGS -c "${PROJECT_SOURCE_DIR}/src/uncrustify.cfg" -q --check + FLAGS -c ${UNCRUSTIFY_CONFIG} -q --check FILES ${LINT_NVIM_SOURCES}) -add_dependencies(lintc-uncrustify uncrustify) - -add_custom_target(lintc) -add_dependencies(lintc lintc-clint lintc-uncrustify lintc-clang-tidy) add_custom_target(formatc COMMAND ${CMAKE_COMMAND} @@ -873,7 +877,13 @@ add_custom_target(formatc -D LANG=c -P ${PROJECT_SOURCE_DIR}/cmake/Format.cmake WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}) -add_dependencies(formatc uncrustify) + +add_dependencies(lintc-uncrustify uncrustify_update_config) +add_dependencies(formatc uncrustify_update_config) +add_dependencies(uncrustify_update_config uncrustify) + +add_custom_target(lintc) +add_dependencies(lintc lintc-clint lintc-uncrustify lintc-clang-tidy) add_custom_target(generated-sources DEPENDS ${NVIM_GENERATED_FOR_SOURCES} diff --git a/src/uncrustify.cfg b/src/uncrustify.cfg index cd61531ba2..8a2df5f1d9 100644 --- a/src/uncrustify.cfg +++ b/src/uncrustify.cfg @@ -359,7 +359,7 @@ sp_inside_sparen_open = ignore # ignore/add/remove/force/not_defined sp_inside_sparen_close = ignore # ignore/add/remove/force/not_defined # Add or remove space inside '(' and ')' of 'for' statements. -sp_inside_for = ignore # ignore/add/remove/force/not_defined +sp_inside_for = remove # ignore/add/remove/force/not_defined # Add or remove space after '(' of 'for' statements. # @@ -3663,5 +3663,5 @@ set CLASS_COLON REAL_FATTR_CONST set CLASS_COLON REAL_FATTR_NONNULL_ALL set CLASS_COLON REAL_FATTR_PURE set CLASS_COLON REAL_FATTR_WARN_UNUSED_RESULT -# option(s) with 'not default' value: 131 +# option(s) with 'not default' value: 132 # |