Skip to content

Commit

Permalink
Clang warning suppressions, warning fixes and CI
Browse files Browse the repository at this point in the history
  • Loading branch information
ptheywood committed Jan 5, 2024
1 parent d41958f commit b6861fa
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 7 deletions.
26 changes: 22 additions & 4 deletions .github/workflows/Ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,20 @@ jobs:
# optional exclude: can be partial, include: must be specific
matrix:
cudacxx:
- cuda: "11.7"
- cuda: "11.8"
cuda_arch: "35"
hostcxx: gcc-8
os: ubuntu-20.04
hostcxx: gcc-10
os: ubuntu-22.04
- cuda: "11.8"
cuda_arch: "35"
hostcxx: clang-14
os: ubuntu-22.04
config:
- name: "Release"
config: "Release"

# Name the job based on matrix/env options
name: "build (${{ matrix.cudacxx.cuda }}, ${{ matrix.config.name }}, ${{ matrix.cudacxx.os }})"
name: "build (${{ matrix.cudacxx.cuda }}, ${{ matrix.cudacxx.hostcxx }}, ${{ matrix.config.name }}, ${{ matrix.cudacxx.os }})"

# Define job-wide env constants, and promote matrix elements to env constants for portable steps.
env:
Expand Down Expand Up @@ -66,9 +70,23 @@ jobs:
echo "CXX=/usr/bin/g++-${gcc_version}" >> $GITHUB_ENV
echo "CUDAHOSTCXX=/usr/bin/g++-${gcc_version}" >> $GITHUB_ENV
- name: Install/Select clang and clang++
if: ${{ startsWith(env.HOSTCXX, 'clang-')}}
run: |
clang=${{ env.HOSTCXX }}
clang_version=${clang/clang-/}
sudo apt-get install -y clang-${clang_version} clang-tools-${clang_version}
echo "CC=/usr/bin/clang-${clang_version}" >> $GITHUB_ENV
echo "CXX=/usr/bin/clang++-${clang_version}" >> $GITHUB_ENV
echo "CUDAHOSTCXX=/usr/bin/clang++-${clang_version}" >> $GITHUB_ENV
- name: Install Visualisation Dependencies
if: ${{ startswith(env.OS, 'ubuntu') && env.VISUALISATION == 'ON' }}
run: |
# Install ubuntu-22.04 packages
if [ "$OS" == 'ubuntu-22.04' ]; then
sudo apt-get install -y libglew-dev libfontconfig1-dev libsdl2-dev libdevil-dev libfreetype-dev
fi
# Install ubuntu-20.04 packages
if [ "$OS" == 'ubuntu-20.04' ]; then
sudo apt-get install -y libglew-dev libfontconfig1-dev libsdl2-dev libdevil-dev libfreetype-dev
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ It is unlikely to be useful independently.
+ [CUDA](https://developer.nvidia.com/cuda-downloads) `>= 11.0` and a Compute Capability `>= 3.5` NVIDIA GPU.
+ C++17 capable C++ compiler (host), compatible with the installed CUDA version
+ [Microsoft Visual Studio 2019](https://visualstudio.microsoft.com/) (Windows)
+ [make](https://www.gnu.org/software/make/) and [GCC](https://gcc.gnu.org/) `>= 8.1`
+ [make](https://www.gnu.org/software/make/) and [GCC](https://gcc.gnu.org/) `>= 8.1` or [Clang](https://clang.llvm.org/) `>= 9` (Linux)
+ [git](https://git-scm.com/)
+ [SDL](https://www.libsdl.org/)
+ [GLM](http://glm.g-truc.net/) *(consistent C++/GLSL vector maths functionality)*
Expand Down
14 changes: 12 additions & 2 deletions cmake/warnings.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,18 @@ if(NOT COMMAND flamegpu_visualiser_suppress_some_compiler_warnings)
if(CMAKE_CUDA_COMPILER_VERSION VERSION_GREATER_EQUAL 11.6.0)
target_compile_definitions(${SSCW_TARGET} PRIVATE "$<$<COMPILE_LANGUAGE:C,CXX,CUDA>:__CDPRT_SUPPRESS_SYNC_DEPRECATION_WARNING>")
endif()
else()
# Linux specific warning suppressions
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
# Suppress unused function warnigns raised by clang on some vis headers
target_compile_options(${SSCW_TARGET} PRIVATE "$<$<COMPILE_LANGUAGE:CUDA>:SHELL:-Xcompiler -Wno-unused-function>")
target_compile_options(${SSCW_TARGET} PRIVATE "$<$<COMPILE_LANGUAGE:C,CXX>:-Wno-unused-function>")
# Suppress unused-private-field warnings on Clang, which are falsely emitted in some cases where a private member is used in device code (i.e. ArrayMessage)
target_compile_options(${SSCW_TARGET} PRIVATE "$<$<COMPILE_LANGUAGE:CUDA>:SHELL:-Xcompiler -Wno-unused-private-field>")
target_compile_options(${SSCW_TARGET} PRIVATE "$<$<COMPILE_LANGUAGE:C,CXX>:-Wno-unused-private-field>")
# Suppress unused-but-set-variable which triggers on some device code, clang 13+
if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 13.0)
target_compile_options(${SSCW_TARGET} PRIVATE "$<$<COMPILE_LANGUAGE:CUDA>:SHELL:-Xcompiler -Wno-unused-but-set-variable>")
target_compile_options(${SSCW_TARGET} PRIVATE "$<$<COMPILE_LANGUAGE:C,CXX>:-Wno-unused-but-set-variable>")
endif()
endif()
# Generic OS/host compiler warning suppressions
# Ensure NVCC outputs warning numbers
Expand Down
2 changes: 2 additions & 0 deletions src/flamegpu/visualiser/texture/Texture2D_Multisample.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@ class Texture2D_Multisample : public Texture, public RenderTarget {
glm::uvec2 dimensions;
static const char *RAW_TEXTURE_FLAG;
unsigned int samples;
// Bring the non-overriden overloaded resize method into the private scope to resolve clang -Woverloaded-virtual
using RenderTarget::resize;
};

} // namespace visualiser
Expand Down
4 changes: 4 additions & 0 deletions src/flamegpu/visualiser/ui/Overlay.h
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,10 @@ class OverlayGroup {
* By default, if any overlay is visible true is returned
*/
virtual bool getVisible() const;
/**
* Virtual destructor to resolve Wdelete-non-abstract-non-virtual-dtor warning
*/
virtual ~OverlayGroup() { }
};

} // namespace visualiser
Expand Down

0 comments on commit b6861fa

Please sign in to comment.