Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/CleverRaven/Cataclysm-DDA
Browse files Browse the repository at this point in the history
…into artillery_potential
  • Loading branch information
GuardianDll committed Jan 16, 2025
2 parents 48ddef9 + d7b675d commit bcd7502
Show file tree
Hide file tree
Showing 836 changed files with 5,603 additions and 11,033 deletions.
2 changes: 1 addition & 1 deletion .devcontainer/cross-compile/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
RUN apt-get -y install qtbase5-dev qtchooser qt5-qmake qtbase5-dev-tools

# [Optional] comment out this section unless you want to cross-compile from Linux to Windows
# This section should align with doc/COMPILING/COMPILING.md#cross-compile-to-windows-from-linux
# This section should align with doc/c++/COMPILING.md#cross-compile-to-windows-from-linux
# With the exception of the installation of packages that are already installed earlier in the Dockerfile
# Like: astyle, cmake
RUN apt-get -y install autoconf automake autopoint bash bison bzip2 flex gettext git g++ \
Expand Down
7 changes: 6 additions & 1 deletion .github/workflows/CBA.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,16 @@ jobs:
- uses: ammaraskar/gcc-problem-matcher@master
- name: make
run: |
clang++ --version
ClangBuildAnalyzer --start .
CLANG=clang++-14 CXXFLAGS=-ftime-trace make
CLANG=clang++ CXXFLAGS=-ftime-trace make
ClangBuildAnalyzer --stop . buildAnalysis
- name: Analyze
run: ClangBuildAnalyzer --analyze buildAnalysis
- uses: actions/upload-artifact@v4
with:
name: ClangBuildAnalyzer-analysis
path: buildAnalysis
- uses: actions/upload-artifact@v4
with:
name: ClangBuildAnalyzer-traces
Expand Down
73 changes: 44 additions & 29 deletions .github/workflows/clang-tidy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,56 +27,71 @@ jobs:
uses: fkirc/skip-duplicate-actions@master
with:
cancel_others: 'true'
paths: '[ "**.cpp", "**.h", "**.c", "**/CMakeLists.txt", "**/Makefile", "**.hpp", "**.cmake", "build-scripts/clang-tidy.sh", "build-scripts/clang-tidy-wrapper.sh", "build-scripts/get_affected_files.py", ".github/workflows/clang-tidy.yml" ]'
build:
paths: '[ "**.cpp", "**.h", "**.c", "**/CMakeLists.txt", "**/Makefile", "**.hpp", "**.cmake", "build-scripts/clang-tidy-build.sh", "build-scripts/clang-tidy-run.sh", "build-scripts/clang-tidy-wrapper.sh", "build-scripts/get_affected_files.py", ".github/workflows/clang-tidy.yml" ]'


build-clang-tidy:
needs: skip-duplicates
strategy:
fail-fast: true
runs-on: ubuntu-24.04
env:
COMPILER: clang++-17
steps:
- name: install LLVM 17
if: ${{ needs.skip-duplicates.outputs.should_skip != 'true' && github.event_name != 'pull_request' || github.event.pull_request.draft == false }}
run: |
sudo apt install llvm-17 llvm-17-dev llvm-17-tools clang-17 clang-tidy-17 clang-tools-17 libclang-17-dev
sudo apt install python3-pip ninja-build cmake
pip3 install --user lit
- name: checkout repository
uses: actions/checkout@v4
- uses: ammaraskar/gcc-problem-matcher@master
- name: build clang-tidy plugin
if: ${{ needs.skip-duplicates.outputs.should_skip != 'true' && github.event_name != 'pull_request' || github.event.pull_request.draft == false }}
run: bash ./build-scripts/clang-tidy-build.sh
- name: upload plugin
uses: actions/upload-artifact@v4
with:
name: cata-analyzer-plugin
path: build/tools/clang-tidy-plugin/libCataAnalyzerPlugin.so
retention-days: 1


run-clang-tidy:
needs: build-clang-tidy
strategy:
fail-fast: false
matrix:
# To make the run finish in the run time limit, we split it up into two
# parts: the src directory and everything else
# To make the run finish in the run time limit, we split it up into three parts:
# the files explicitly changed in the pr, the src directory and everything else
subset: [
'directly-changed',
'indirectly-changed-src',
'indirectly-changed-other'
]

runs-on: ubuntu-22.04
runs-on: ubuntu-24.04
env:
CMAKE: 1
CLANG: clang++-17
COMPILER: clang++-17
CATA_CLANG_TIDY: plugin
CATA_CLANG_TIDY: clang-tidy-17
CATA_CLANG_TIDY_SUBSET: ${{ matrix.subset }}
TILES: 1
SOUND: 1
RELEASE: 1
LOCALIZE: 1
steps:
- name: install LLVM 17
if: ${{ needs.skip-duplicates.outputs.should_skip != 'true' && github.event_name != 'pull_request' || github.event.pull_request.draft == false }}
run: |
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
sudo apt-add-repository "deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-17 main"
sudo apt update
sudo apt install llvm-17 llvm-17-dev llvm-17-tools clang-17 clang-tidy-17 clang-tools-17 \
libclang-17-dev libflac-dev libsdl2-dev libsdl2-ttf-dev libsdl2-image-dev libsdl2-mixer-dev \
libpulse-dev ccache gettext jq
- name: install dependencies
run: |
sudo apt install python3-pip libncursesw5-dev ninja-build cmake gettext
pip3 install --user lit
- name: ensure clang-tidy and FileCheck commands point to LLVM 17
if: ${{ needs.skip-duplicates.outputs.should_skip != 'true' && github.event_name != 'pull_request' || github.event.pull_request.draft == false }}
run: |
mkdir ~/llvm-command-override
ln -s /usr/bin/clang-tidy-17 ~/llvm-command-override/clang-tidy
ln -s /usr/bin/FileCheck-17 ~/llvm-command-override/FileCheck
echo "$HOME/llvm-command-override" >> $GITHUB_PATH
sudo apt install clang-17 clang-tidy-17 cmake ccache jq
sudo apt install libflac-dev libsdl2-dev libsdl2-ttf-dev libsdl2-image-dev libsdl2-mixer-dev libpulse-dev gettext
- name: checkout repository
uses: actions/checkout@v4
- name: prepare
run: bash ./build-scripts/requirements.sh
- name: download plugin from the previous job in this workflow run
uses: actions/download-artifact@v4
with:
name: cata-analyzer-plugin
path: build/tools/clang-tidy-plugin/
- name: determine changed files
if: ${{ github.event_name == 'pull_request' }}
uses: actions/github-script@v7
Expand All @@ -98,7 +113,7 @@ jobs:
- uses: ammaraskar/gcc-problem-matcher@master
- name: run clang-tidy
if: ${{ needs.skip-duplicates.outputs.should_skip != 'true' && github.event_name != 'pull_request' || github.event.pull_request.draft == false }}
run: bash ./build-scripts/clang-tidy.sh
run: bash ./build-scripts/clang-tidy-run.sh
- name: show most time consuming checks
if: always()
run: | # the folder may not exist if there is no file to analyze
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/linter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,4 @@ jobs:
uses: reviewdog/action-suggester@v1
if: ${{ always() }}
with:
tool_name: '[JSON & C++ formatters](https://github.com/CleverRaven/Cataclysm-DDA/blob/master/doc/DEVELOPER_TOOLING.md)'
tool_name: '[JSON & C++ formatters](https://github.com/CleverRaven/Cataclysm-DDA/blob/master/doc/c++/DEVELOPER_TOOLING.md)'
8 changes: 4 additions & 4 deletions .github/workflows/toc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ on:
branches:
- master
paths:
- 'doc/JSON_INFO.md'
- 'doc/JSON/JSON_INFO.md'
name: TOC Generator
permissions:
contents: read
Expand All @@ -15,17 +15,17 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: npx doctoc doc/JSON_INFO.md --github
- run: npx doctoc doc/JSON/JSON_INFO.md --github
- name: Create Pull Request
uses: peter-evans/create-pull-request@v6
with:
commit-message: Update the table of contents
branch: update-toc
token: ${{ secrets.TX_PR_CREATOR }}
title: Update the table of contents in doc/JSON_INFO.md
title: Update the table of contents in doc/JSON/JSON_INFO.md
body: |
```sh
#### Summary
None
npx doctoc doc/JSON_INFO.md --github
npx doctoc doc/JSON/JSON_INFO.md --github
```
14 changes: 7 additions & 7 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ message(STATUS "LOCALIZE : ${LOCALIZE}")
message(STATUS "USE_XDG_DIR : ${USE_XDG_DIR}")
message(STATUS "USE_HOME_DIR : ${USE_HOME_DIR}")
message(STATUS "LANGUAGES : ${LANGUAGES}")
message(STATUS "See doc/COMPILING/COMPILING-CMAKE.md for details and more info --")
message(STATUS "See doc/c++/COMPILING-CMAKE.md for details and more info --")

if (NOT MSVC)
set(CATA_WARNINGS
Expand Down Expand Up @@ -255,7 +255,7 @@ if ("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}")
"This project requires an out of source build. \
Remove the file 'CMakeCache.txt' found in this directory before continuing; \
create a separate build directory and run 'cmake [options] <srcs>' from there. \
See doc/COMPILING/COMPILING-CMAKE.md for details and more info.")
See doc/c++/COMPILING-CMAKE.md for details and more info.")
endif ()

#set(THREADS_USE_PTHREADS_WIN32 True)
Expand Down Expand Up @@ -284,7 +284,7 @@ if (TILES)
"This project requires SDL2 to be installed to compile in graphical mode. \
Please install the SDL2 development libraries, \
or try compiling without -DTILES=1 for a text-only compilation. \
See doc/COMPILING/COMPILING-CMAKE.md for details and more info.")
See doc/c++/COMPILING-CMAKE.md for details and more info.")
endif ()

message(STATUS "Searching for SDL2_TTF library --")
Expand All @@ -294,7 +294,7 @@ if (TILES)
"This project requires SDL2_ttf to be installed to compile in graphical mode. \
Please install the SDL2_ttf development libraries, \
or try compiling without -DTILES=1 for a text-only compilation. \
See doc/COMPILING/COMPILING-CMAKE.md for details and more info.")
See doc/c++/COMPILING-CMAKE.md for details and more info.")
endif ()

message(STATUS "Searching for SDL2_image library --")
Expand All @@ -304,7 +304,7 @@ if (TILES)
"This project requires SDL2_image to be installed to compile in graphical mode. \
Please install the SDL2_image development libraries, \
or try compiling without -DTILES=1 for a text-only compilation. \
See doc/COMPILING/COMPILING-CMAKE.md for details and more info.")
See doc/c++/COMPILING-CMAKE.md for details and more info.")
endif ()
add_definitions(-DTILES)
endif ()
Expand Down Expand Up @@ -358,7 +358,7 @@ if (CURSES)
"This project requires ncurses to be installed to be compiled in text-only mode. \
Please install the ncurses development libraries, \
or try compiling with -DTILES=1 for a graphical compilation. \
See doc/COMPILING/COMPILING-CMAKE.md for details and more info")
See doc/c++/COMPILING-CMAKE.md for details and more info")
endif ()
if (NOT DYNAMIC_LINKING)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DNCURSES_STATIC")
Expand All @@ -374,7 +374,7 @@ if (SOUND)
message(FATAL_ERROR
"You need the SDL2_mixer development library \
to be able to compile with sound enabled. \
See doc/COMPILING/COMPILING-CMAKE.md for details and more info.")
See doc/c++/COMPILING-CMAKE.md for details and more info.")
endif()
endif ()

Expand Down
2 changes: 1 addition & 1 deletion ISSUES.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ You can update issues with labels using comment-commands. First, open a PR addin

### Questions

You should direct your questions to the forum or ask on IRC. You should also read the included documentation and additional text files, e.g. [COMPILING.md](doc/COMPILING/COMPILING.md) if you have problems building.
You should direct your questions to the forum or ask on IRC. You should also read the included documentation and additional text files, e.g. [COMPILING.md](doc/c++/COMPILING.md) if you have problems building.

## Bounties

Expand Down
2 changes: 0 additions & 2 deletions LICENSE.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ PLF List and PLF Colony (src/list.h, src/colony.h) are licensed under the zLib l

getpost (tools/json_tools/format/getpost.h) is licensed under the MIT license, see file for text of license.

gulrak filesystem (src/third-party/ghc/*) is licensed under the MIT license, see file for text of license.

libbacktrace is licensed under a BSD license (https://github.com/ianlancetaylor/libbacktrace/blob/master/LICENSE). The full license text is as follows:

# Copyright (C) 2012-2016 Free Software Foundation, Inc.
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,12 @@ Ncurses and tiles versions are available in the [official repos](https://tracker

## Compile

Please read [COMPILING.md](doc/COMPILING/COMPILING.md) - it covers general information and more specific recipes for Linux, OS X, Windows and BSD. See [COMPILER_SUPPORT.md](doc/COMPILING/COMPILER_SUPPORT.md) for details on which compilers we support. And you can always dig for more information in [doc/](https://github.com/CleverRaven/Cataclysm-DDA/tree/master/doc).
Please read [COMPILING.md](doc/c++/COMPILING.md) - it covers general information and more specific recipes for Linux, OS X, Windows and BSD. See [COMPILER_SUPPORT.md](doc/c++/COMPILER_SUPPORT.md) for details on which compilers we support. And you can always dig for more information in [doc/](https://github.com/CleverRaven/Cataclysm-DDA/tree/master/doc).

We also have the following build guides:
* Building on Windows with `MSYS2` at [COMPILING-MSYS.md](doc/COMPILING/COMPILING-MSYS.md)
* Building on Windows with `vcpkg` at [COMPILING-VS-VCPKG.md](doc/COMPILING/COMPILING-VS-VCPKG.md)
* Building with `cmake` at [COMPILING-CMAKE.md](doc/COMPILING/COMPILING-CMAKE.md) (*unofficial guide*)
* Building on Windows with `MSYS2` at [COMPILING-MSYS.md](doc/c++/COMPILING-MSYS.md)
* Building on Windows with `vcpkg` at [COMPILING-VS-VCPKG.md](doc/c++/COMPILING-VS-VCPKG.md)
* Building with `cmake` at [COMPILING-CMAKE.md](doc/c++/COMPILING-CMAKE.md) (*unofficial guide*)

## Contribute

Expand Down
56 changes: 56 additions & 0 deletions build-scripts/clang-tidy-build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
#!/bin/bash

# Shell script intended for clang-tidy check

echo "Using bash version $BASH_VERSION"
set -exo pipefail

num_jobs=3

# We might need binaries installed via pip, so ensure that our personal bin dir is on the PATH
#export PATH=$HOME/.local/bin:$PATH
build_type=MinSizeRel

cmake_extra_opts=()
cmake_extra_opts+=("-DCATA_CLANG_TIDY_PLUGIN=ON")
# Need to specify the particular LLVM / Clang versions to use, lest it
# use the older LLVM that comes by default on Ubuntu.
cmake_extra_opts+=("-DLLVM_DIR=/usr/lib/llvm-17/lib/cmake/llvm")
cmake_extra_opts+=("-DClang_DIR=/usr/lib/llvm-17/lib/cmake/clang")


mkdir -p build
cd build
cmake \
${COMPILER:+-DCMAKE_CXX_COMPILER=$COMPILER} \
-DCMAKE_BUILD_TYPE="$build_type" \
-DLOCALIZE=OFF \
"${cmake_extra_opts[@]}" \
..


echo "Compiling clang-tidy plugin"
make -j$num_jobs CataAnalyzerPlugin
#export PATH=$PWD/tools/clang-tidy-plugin/clang-tidy-plugin-support/bin:$PATH
# add FileCheck to the search path
export PATH=/usr/lib/llvm-17/bin:$PATH
if ! which FileCheck
then
echo "Missing FileCheck"
exit 1
fi
CATA_CLANG_TIDY=clang-tidy
# lit might be installed via pip, so ensure that our personal bin dir is on the PATH
export PATH=$HOME/.local/bin:$PATH
lit -v tools/clang-tidy-plugin/test
cd ..

# show that it works

echo "version:"
LD_PRELOAD=build/tools/clang-tidy-plugin/libCataAnalyzerPlugin.so clang-tidy --version
echo "all enabled checks:"
LD_PRELOAD=build/tools/clang-tidy-plugin/libCataAnalyzerPlugin.so clang-tidy --list-checks
echo "cata-specific checks:"
LD_PRELOAD=build/tools/clang-tidy-plugin/libCataAnalyzerPlugin.so clang-tidy --list-checks --checks="cata-*" | grep "cata"

Loading

0 comments on commit bcd7502

Please sign in to comment.