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

Clang warning suppressions, warning fixes and CI #107

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
4 changes: 2 additions & 2 deletions cmake/dependencies/sdl2.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@ if(UNIX)
# Tested on ubuntu 20.04 / libsdl2-dev 2.0.10+dfsg1-3
if (NOT TARGET SDL2::SDL2)
# If we have a ${libdir} from the above find_package sdl2, use that.
if(${libdir})
if(libdir)
set(SDL2_LIBDIR ${libdir})
endif()
add_library(SDL2::SDL2 SHARED IMPORTED)
set_target_properties(SDL2::SDL2 PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${SDL2_INCLUDE_DIRS}"
IMPORTED_LINK_INTERFACE_LANGUAGES "C"
IMPORTED_LOCATION "${SDL2_LIBDIR}/${CMAKE_SHARED_LIBRARY_PREFIX}SDL2${CMAKE_SHARED_LIBRARY_SUFFIX}")
endif()
endif()
endif()
elseif(WIN32)
# On windows, always download manually. There are issues with find_package and multi-config generators where a release library will be found, but no debug library, which can break things.
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