mirror of
https://github.com/diasurgical/DevilutionX.git
synced 2026-10-12 02:13:06 +00:00
Add google-benchmark
This commit is contained in:
@@ -7,7 +7,7 @@ RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
|
||||
&& apt-get -y install tar curl zip unzip bash-completion build-essential ripgrep htop \
|
||||
ninja-build ccache g++ mold gdb clang-format clang-tidy \
|
||||
rpm pkg-config cmake git smpq gettext libsdl2-dev libsdl2-image-dev libsodium-dev \
|
||||
libpng-dev libbz2-dev libfmt-dev libgtest-dev libgmock-dev libsimpleini-dev zsh \
|
||||
libpng-dev libbz2-dev libfmt-dev libgtest-dev libgmock-dev libbenchmark-dev libsimpleini-dev zsh \
|
||||
qtbase5-dev qt6-base-dev ristretto \
|
||||
&& apt-get autoremove -y && apt-get clean -y && rm -rf /var/lib/apt/lists/*
|
||||
|
||||
|
||||
@@ -80,3 +80,6 @@ end_of_line = lf
|
||||
|
||||
[devilutionx.spec]
|
||||
end_of_line = lf
|
||||
|
||||
[Dockerfile]
|
||||
end_of_line = lf
|
||||
|
||||
@@ -30,7 +30,7 @@ jobs:
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
sudo apt-get update -y
|
||||
sudo apt-get install -y cmake curl g++ git lcov libgtest-dev libgmock-dev libfmt-dev libsdl2-dev libsodium-dev libpng-dev libbz2-dev wget
|
||||
sudo apt-get install -y cmake curl g++ git lcov libgtest-dev libgmock-dev libbenchmark-dev libfmt-dev libsdl2-dev libsodium-dev libpng-dev libbz2-dev wget
|
||||
- name: Cache CMake build folder
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
@@ -38,9 +38,11 @@ jobs:
|
||||
key: ${{ github.workflow }}-v1-${{ github.sha }}
|
||||
restore-keys: ${{ github.workflow }}-v1-
|
||||
|
||||
# We specify `-DDEVILUTIONX_SYSTEM_BENCHMARK=OFF` to work around the following error:
|
||||
# lto1: fatal error: bytecode stream in file ‘/usr/lib/x86_64-linux-gnu/libbenchmark_main.a’ generated with LTO version 11.2 instead of the expected 11.3
|
||||
- name: Build tests
|
||||
run: |
|
||||
cmake -S. -Bbuild -DENABLE_CODECOVERAGE=ON
|
||||
cmake -S. -Bbuild -DENABLE_CODECOVERAGE=ON -DDEVILUTIONX_SYSTEM_BENCHMARK=OFF
|
||||
wget -nc https://github.com/diasurgical/devilutionx-assets/releases/download/v2/spawn.mpq -P build
|
||||
cmake --build build -j $(nproc)
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ jobs:
|
||||
- name: Create Build Environment
|
||||
run: >
|
||||
sudo apt-get update &&
|
||||
sudo apt-get install -y cmake curl libsdl2-dev libsdl2-image-dev libfmt-dev libsodium-dev libbz2-dev libgtest-dev libgmock-dev git smpq gettext python-is-python3
|
||||
sudo apt-get install -y cmake curl libsdl2-dev libsdl2-image-dev libfmt-dev libsodium-dev libbz2-dev libgtest-dev libgmock-dev libbenchmark-dev git smpq gettext python-is-python3
|
||||
|
||||
- name: Build
|
||||
working-directory: ${{github.workspace}}
|
||||
@@ -55,7 +55,7 @@ jobs:
|
||||
- name: Create Build Environment
|
||||
run: >
|
||||
sudo apt-get update &&
|
||||
sudo apt-get install -y cmake curl libsdl2-dev libsdl2-image-dev libfmt-dev libsodium-dev libbz2-dev libgtest-dev libgmock-dev git smpq gettext python-is-python3
|
||||
sudo apt-get install -y cmake curl libsdl2-dev libsdl2-image-dev libfmt-dev libsodium-dev libbz2-dev libgtest-dev libgmock-dev libbenchmark-dev git smpq gettext python-is-python3
|
||||
|
||||
- name: Build
|
||||
working-directory: ${{github.workspace}}
|
||||
|
||||
Vendored
+16
@@ -0,0 +1,16 @@
|
||||
include(functions/FetchContent_MakeAvailableExcludeFromAll)
|
||||
|
||||
FetchContent_Declare(
|
||||
benchmark
|
||||
URL https://github.com/google/benchmark/archive/refs/tags/v1.8.5.tar.gz
|
||||
URL_HASH MD5=708d91ce255e8af4c1d7dfec50dff178
|
||||
)
|
||||
|
||||
set(INSTALL_GTEST OFF)
|
||||
|
||||
set(BENCHMARK_ENABLE_TESTING OFF)
|
||||
set(BENCHMARK_ENABLE_EXCEPTIONS OFF)
|
||||
set(BENCHMARK_ENABLE_WERROR OFF)
|
||||
set(BENCHMARK_ENABLE_INSTALL OFF)
|
||||
|
||||
FetchContent_MakeAvailable(benchmark)
|
||||
@@ -4,3 +4,4 @@ brew "sdl2"
|
||||
brew "libsodium"
|
||||
brew "pkg-config"
|
||||
brew "googletest"
|
||||
brew "google-benchmark"
|
||||
|
||||
@@ -271,6 +271,13 @@ if(BUILD_TESTING)
|
||||
else()
|
||||
add_subdirectory(3rdParty/googletest)
|
||||
endif()
|
||||
|
||||
dependency_options("benchmark" DEVILUTIONX_SYSTEM_BENCHMARK ON DEVILUTIONX_STATIC_BENCHMARK)
|
||||
if(DEVILUTIONX_SYSTEM_BENCHMARK)
|
||||
find_package(benchmark REQUIRED)
|
||||
else()
|
||||
add_subdirectory(3rdParty/benchmark)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(GPERF)
|
||||
|
||||
+2
-2
@@ -12,7 +12,7 @@ Note that ```pkg-config``` is an optional dependency for finding libsodium, alth
|
||||
### Installing dependencies on Debian and Ubuntu
|
||||
|
||||
```
|
||||
sudo apt-get install cmake g++ libsdl2-dev libsodium-dev libpng-dev libbz2-dev libgtest-dev libgmock-dev libsdl2-image-dev libfmt-dev
|
||||
sudo apt-get install cmake g++ libsdl2-dev libsodium-dev libpng-dev libbz2-dev libgtest-dev libgmock-dev libbenchmark-dev libsdl2-image-dev libfmt-dev
|
||||
```
|
||||
|
||||
### If you want to build the translations (optional)
|
||||
@@ -30,7 +30,7 @@ sudo apt-get install smpq
|
||||
### Installing dependencies on Fedora
|
||||
|
||||
```
|
||||
sudo dnf install cmake gcc-c++ glibc-devel libstdc++-static SDL2-devel SDL2_image-devel libsodium-devel libpng-devel bzip2-devel gmock-devel gtest-devel libasan libubsan fmt-devel
|
||||
sudo dnf install cmake gcc-c++ glibc-devel libstdc++-static SDL2-devel SDL2_image-devel libsodium-devel libpng-devel bzip2-devel gmock-devel gtest-devel google-benchmark-devel libasan libubsan fmt-devel
|
||||
```
|
||||
|
||||
### Compiling
|
||||
|
||||
@@ -41,7 +41,7 @@ _ALWAYS_VENDORED_DEPS = ['asio', 'libmpq', 'libsmackerdec', 'libzt']
|
||||
|
||||
# These dependencies are not vendored by default.
|
||||
# Run with `--fully_vendored` to include them.
|
||||
_DEPS_NOT_VENDORED_BY_DEFAULT = ['googletest', 'sdl2', 'sdl_image',
|
||||
_DEPS_NOT_VENDORED_BY_DEFAULT = ['googletest', 'benchmark', 'sdl2', 'sdl_image',
|
||||
'libpng', 'libfmt', 'bzip2', 'libsodium']
|
||||
|
||||
_ROOT_DIR = pathlib.Path(__file__).resolve().parent.parent
|
||||
@@ -101,7 +101,7 @@ def main():
|
||||
src = src_bytes.decode()
|
||||
dst_path = paths.archive_top_level_dir.joinpath(src)
|
||||
dst_path.parent.mkdir(parents=True, exist_ok=True)
|
||||
if re.search('(^|/)\.gitkeep$', src):
|
||||
if re.search(r'(^|/)\.gitkeep$', src):
|
||||
continue
|
||||
shutil.copy2(_ROOT_DIR.joinpath(src), dst_path, follow_symlinks=False)
|
||||
|
||||
|
||||
+1
-1
@@ -32,7 +32,7 @@
|
||||
},
|
||||
"tests": {
|
||||
"description": "Build tests",
|
||||
"dependencies": [ "gtest" ]
|
||||
"dependencies": [ "gtest", "benchmark" ]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user