Skip to content

Commit

Permalink
Add support for clang as the host complier
Browse files Browse the repository at this point in the history
Add clang to the CI build matrix
Add clang-specific warning suppressions
  • Loading branch information
ptheywood committed Jan 5, 2024
1 parent 75c6a5b commit 512de79
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
14 changes: 14 additions & 0 deletions .github/workflows/Ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ jobs:
cuda_arch: "35"
hostcxx: gcc-11
os: ubuntu-22.04
- cuda: "11.8"
cuda_arch: "35"
hostcxx: clang-14
os: ubuntu-22.04
- cuda: "11.0"
cuda_arch: "35"
hostcxx: gcc-8
Expand Down Expand Up @@ -113,6 +117,16 @@ 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: Select Python
if: ${{ env.PYTHON != '' && env.FLAMEGPU_BUILD_PYTHON == 'ON' }}
uses: actions/setup-python@v4
Expand Down
9 changes: 7 additions & 2 deletions cmake/warnings.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,13 @@ if(NOT COMMAND flamegpu_suppress_some_compiler_warnings)
if(CMAKE_CUDA_COMPILER_VERSION VERSION_GREATER_EQUAL 11.6.0)
target_compile_definitions(${SSCW_TARGET} PRIVATE "__CDPRT_SUPPRESS_SYNC_DEPRECATION_WARNING")
endif()
else()
# Linux specific warning suppressions
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
# 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.
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()
# Generic OS/host compiler warning suppressions
# Ensure NVCC outputs warning numbers
Expand Down

0 comments on commit 512de79

Please sign in to comment.