Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build(cmake): error build on warning #2165

Merged
merged 1 commit into from
Feb 25, 2024

Conversation

ReenigneArcher
Copy link
Member

@ReenigneArcher ReenigneArcher commented Feb 23, 2024

Description

This PR will error cmake on warning, causing CI to fail.

Todo:

  • Fix existing warnings
  • Add CMake option to disable -Werror

Screenshot

Issues Fixed or Closed

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Dependency update (updates to dependencies)
  • Documentation update (changes to documentation)
  • Repository update (changes to repository files, e.g. .github/...)

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have added or updated the in code docstring/documentation-blocks for new or existing methods/components

Branch Updates

LizardByte requires that branches be up-to-date before merging. This means that after any PR is merged, this branch
must be updated before it can be merged. You must also
Allow edits from maintainers.

  • I want maintainers to keep my branch updated

@ReenigneArcher ReenigneArcher added the help wanted Extra attention is needed label Feb 23, 2024
@ReenigneArcher

This comment was marked as resolved.

@ReenigneArcher ReenigneArcher force-pushed the build(cmake)-error-build-on-warning branch 4 times, most recently from 95c72d8 to 912f6c0 Compare February 23, 2024 20:18
@ReenigneArcher
Copy link
Member Author

ReenigneArcher commented Feb 23, 2024

Windows issues:

D:\a\Sunshine\Sunshine\src\platform\windows\input.cpp: In member function 'int platf::vigem_t::alloc_gamepad_internal(const platf::gamepad_id_t&, platf::feedback_queue_t&, VIGEM_TARGET_TYPE)':
D:\a\Sunshine\Sunshine\src\platform\windows\input.cpp:277:56: error: 'VIGEM_ERROR vigem_target_ds4_register_notification(PVIGEM_CLIENT, PVIGEM_TARGET, PFN_VIGEM_DS4_NOTIFICATION, LPVOID)' is deprecated [-Werror=deprecated-declarations]
  277 |         status = vigem_target_ds4_register_notification(client.get(), gamepad.gp.get(), ds4_notify, this);
      |                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from D:\a\Sunshine\Sunshine\src\platform\windows\input.cpp:11:
D:/a/Sunshine/Sunshine/third-party/ViGEmClient/include/ViGEm/Client.h:360:48: note: declared here
  360 |         VIGEM_API VIGEM_DEPRECATED VIGEM_ERROR vigem_target_ds4_register_notification(
      |                                                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  • system headers
In file included from D:/a/_temp/msys64/mingw64/include/comdef.h:19,
                 from D:/a/Sunshine/Sunshine/src/nvenc/nvenc_d3d11.h:4,
                 from D:\a\Sunshine\Sunshine\src\platform\windows\display_vram.cpp:20:
D:/a/_temp/msys64/mingw64/include/comutil.h: In member function 'int _bstr_t::_Compare(const _bstr_t&) const':
D:/a/_temp/msys64/mingw64/include/comutil.h:272: note: '-Wmisleading-indentation' is disabled from this point onwards, since column-tracking was disabled due to the size of the code/headers
  272 |   if(m_Data==str.m_Data) return 0;
      | 
D:/a/_temp/msys64/mingw64/include/comutil.h:272: note: adding '-flarge-source-files' will allow for more column-tracking support, at the expense of compilation time and memory
In file included from D:/a/_temp/msys64/mingw64/include/boost/container_hash/hash.hpp:33,
                 from D:/a/_temp/msys64/mingw64/include/boost/functional/hash.hpp:6,
                 from D:/a/_temp/msys64/mingw64/include/boost/thread/detail/thread.hpp:41,
                 from D:/a/_temp/msys64/mingw64/include/boost/thread/thread_only.hpp:22,
                 from D:/a/_temp/msys64/mingw64/include/boost/thread/thread.hpp:12,
                 from D:/a/_temp/msys64/mingw64/include/boost/log/sinks/async_frontend.hpp:37,
                 from D:/a/_temp/msys64/mingw64/include/boost/log/sinks.hpp:25,
                 from D:/a/Sunshine/Sunshine/src/logging.h:11,
                 from D:/a/Sunshine/Sunshine/src/platform/common.h:13,
                 from D:\a\Sunshine\Sunshine\src\platform\windows\display.h:14,
                 from D:\a\Sunshine\Sunshine\src\platform\windows\display_base.cpp:15:
D:/a/_temp/msys64/mingw64/include/c++/13.2.0/complex: In function 'std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, complex<_Tp>&)':
D:/a/_temp/msys64/mingw64/include/c++/13.2.0/complex:550: note: '-Wmisleading-indentation' is disabled from this point onwards, since column-tracking was disabled due to the size of the code/headers
  550 |       if (__fail)
      | 
D:/a/_temp/msys64/mingw64/include/c++/13.2.0/complex:550: note: adding '-flarge-source-files' will allow for more column-tracking support, at the expense of compilation time and memory

I tried this to resolve the system header warnings, no luck.

# ensure mingw headers are added as system headers
# Find the gcc executable
find_program(GCC_EXECUTABLE gcc)

# If found, derive the include directory
if(GCC_EXECUTABLE)
    # Assume the include directory is two levels up from the gcc binary and then in the include folder
    get_filename_component(GCC_DIR "${GCC_EXECUTABLE}" DIRECTORY)
    get_filename_component(GCC_DIR "${GCC_DIR}" DIRECTORY)
    set(GCC_INCLUDE_DIR "${GCC_DIR}/include")
    message(STATUS "GCC include directory: ${GCC_INCLUDE_DIR}")

    # Add gcc include directory as a system include directory
    include_directories(BEFORE SYSTEM "${GCC_INCLUDE_DIR}")
else()
    message(FATAL_ERROR "GCC not found")
endif()

@ReenigneArcher ReenigneArcher force-pushed the build(cmake)-error-build-on-warning branch from 912f6c0 to e830ec5 Compare February 24, 2024 00:01
@ReenigneArcher ReenigneArcher force-pushed the build(cmake)-error-build-on-warning branch from e830ec5 to 7600de0 Compare February 24, 2024 00:16
@@ -6,6 +6,9 @@ enable_language(RC)
set(CMAKE_RC_COMPILER windres)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static")

# gcc complains about misleading indentation in some mingw includes
list(APPEND SUNSHINE_COMPILE_OPTIONS -Wno-misleading-indentation)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any better ways to solve the mingw warnings?

@ReenigneArcher
Copy link
Member Author

See #2168

@ReenigneArcher ReenigneArcher force-pushed the build(cmake)-error-build-on-warning branch from 7600de0 to 82d2a5a Compare February 24, 2024 02:48
@ReenigneArcher ReenigneArcher marked this pull request as ready for review February 24, 2024 02:53
@ReenigneArcher ReenigneArcher removed the help wanted Extra attention is needed label Feb 24, 2024
@ReenigneArcher ReenigneArcher force-pushed the build(cmake)-error-build-on-warning branch from 82d2a5a to fd4c6f1 Compare February 25, 2024 03:05
@ReenigneArcher ReenigneArcher merged commit c6f94e9 into nightly Feb 25, 2024
44 checks passed
@ReenigneArcher ReenigneArcher deleted the build(cmake)-error-build-on-warning branch February 25, 2024 03:34
KuleRucket pushed a commit to KuleRucket/Sunshine that referenced this pull request Jun 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants