Skip to content

Commit d7cb9d9

Browse files
committed
build: drop submodules
1 parent b9366fc commit d7cb9d9

12 files changed

Lines changed: 35 additions & 221 deletions

‎.github/workflows/cmake-ci.yml‎

Lines changed: 13 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -9,32 +9,27 @@ on:
99

1010
jobs:
1111
build:
12-
name: CMake on ${{ matrix.os }} with ${{ matrix.dependencies }}
12+
name: CMake on ${{ matrix.os }}
1313
runs-on: ${{ matrix.os }}
1414
strategy:
1515
fail-fast: false
1616
matrix:
1717
os: [macos-14, ubuntu-22.04, windows-2022]
18-
dependencies: [submodule, vcpkg]
1918
steps:
2019
- name: Checkout source
2120
uses: actions/checkout@v7
22-
with:
23-
submodules: ${{ matrix.dependencies == 'submodule' }}
2421

2522
- name: Mount vcpkg cache
26-
if: matrix.dependencies == 'vcpkg'
2723
uses: actions/cache@v5
2824
with:
2925
path: "~/.cache/vcpkg/archives"
3026
key: vcpkg-${{ matrix.os }}
3127

3228
- name: Default to x64-windows vcpkg triplet
33-
if: matrix.dependencies == 'vcpkg' && runner.os == 'Windows'
29+
if: runner.os == 'Windows'
3430
run: echo "VCPKG_DEFAULT_TRIPLET=x64-windows" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf-8 -Append
3531

3632
- name: Install vcpkg dependencies
37-
if: matrix.dependencies == 'vcpkg'
3833
run: vcpkg install benchmark civetweb curl[core] gtest zlib
3934

4035
- name: Generate German locale on Ubuntu
@@ -54,20 +49,12 @@ jobs:
5449
if: runner.os == 'macOS'
5550
run: brew install ninja
5651

57-
- name: "Configure for Unix with internal dependencies"
58-
if: matrix.dependencies == 'submodule' && runner.os != 'Windows'
59-
run: cmake -DUSE_THIRDPARTY_LIBRARIES=ON -DCMAKE_INSTALL_PREFIX=${{ github.workspace }}/_install -DENABLE_WARNINGS_AS_ERRORS=ON -DENABLE_COMPRESSION=OFF -DENABLE_PUSH=OFF -DCMAKE_DEBUG_POSTFIX=_d -DCMAKE_CONFIGURATION_TYPES='Release;Debug' -G"Ninja Multi-Config" -S ${{ github.workspace }} -B ${{ github.workspace }}/_build -DBUILD_SHARED_LIBS=ON
60-
61-
- name: "Configure for Windows with internal dependencies"
62-
if: matrix.dependencies == 'submodule' && runner.os == 'Windows'
63-
run: cmake -DUSE_THIRDPARTY_LIBRARIES=ON -DCMAKE_INSTALL_PREFIX=${{ github.workspace }}/_install -DENABLE_WARNINGS_AS_ERRORS=ON -DENABLE_COMPRESSION=OFF -DENABLE_PUSH=OFF -DCMAKE_DEBUG_POSTFIX=_d -S ${{ github.workspace }} -B ${{ github.workspace }}/_build -DBUILD_SHARED_LIBS=ON
64-
6552
- name: "Configure for Unix with vcpkg dependencies"
66-
if: matrix.dependencies == 'vcpkg' && runner.os != 'Windows'
53+
if: runner.os != 'Windows'
6754
run: cmake -DUSE_THIRDPARTY_LIBRARIES=OFF -DCMAKE_INSTALL_PREFIX=${{ github.workspace }}/_install "-DCMAKE_TOOLCHAIN_FILE=${VCPKG_INSTALLATION_ROOT}/scripts/buildsystems/vcpkg.cmake" -DCMAKE_DEBUG_POSTFIX=_d -DCMAKE_CONFIGURATION_TYPES='Release;Debug' -G"Ninja Multi-Config" -S ${{ github.workspace }} -B ${{ github.workspace }}/_build
6855

6956
- name: "Configure for Windows with vcpkg dependencies"
70-
if: matrix.dependencies == 'vcpkg' && runner.os == 'Windows'
57+
if: runner.os == 'Windows'
7158
run: cmake -DUSE_THIRDPARTY_LIBRARIES=OFF -DCMAKE_INSTALL_PREFIX=${{ github.workspace }}/_install "-DCMAKE_TOOLCHAIN_FILE=${Env:VCPKG_INSTALLATION_ROOT}\scripts\buildsystems\vcpkg.cmake" -DCMAKE_DEBUG_POSTFIX=_d -S ${{ github.workspace }} -B ${{ github.workspace }}/_build
7259

7360
- name: "Build Debug"
@@ -94,20 +81,12 @@ jobs:
9481
- name: "Install Release"
9582
run: cmake --install ${{ github.workspace }}/_build --config Release
9683

97-
- name: "Configure CMake import for Unix with internal dependencies"
98-
if: matrix.dependencies == 'submodule' && runner.os != 'Windows'
99-
run: cmake -Dprometheus-cpp_DIR=${{ github.workspace }}/_install/lib/cmake/prometheus-cpp -DCMAKE_CONFIGURATION_TYPES='Release;Debug' -G"Ninja Multi-Config" -S ${{ github.workspace }}/cmake/project-import-cmake -B ${{ github.workspace }}/_import_cmake
100-
101-
- name: "Configure CMake import for Windows with internal dependencies"
102-
if: matrix.dependencies == 'submodule' && runner.os == 'Windows'
103-
run: cmake -Dprometheus-cpp_DIR=${{ github.workspace }}/_install/lib/cmake/prometheus-cpp -S ${{ github.workspace }}/cmake/project-import-cmake -B ${{ github.workspace }}/_import_cmake
104-
10584
- name: "Configure CMake import for Unix with vcpkg dependencies"
106-
if: matrix.dependencies == 'vcpkg' && runner.os != 'Windows'
85+
if: runner.os != 'Windows'
10786
run: cmake -Dprometheus-cpp_DIR=${{ github.workspace }}/_install/lib/cmake/prometheus-cpp "-DCMAKE_TOOLCHAIN_FILE=${VCPKG_INSTALLATION_ROOT}/scripts/buildsystems/vcpkg.cmake" -DCMAKE_CONFIGURATION_TYPES='Release;Debug' -G"Ninja Multi-Config" -S ${{ github.workspace }}/cmake/project-import-cmake -B ${{ github.workspace }}/_import_cmake
10887

10988
- name: "Configure CMake import for Windows with vcpkg dependencies"
110-
if: matrix.dependencies == 'vcpkg' && runner.os == 'Windows'
89+
if: runner.os == 'Windows'
11190
run: cmake -Dprometheus-cpp_DIR=${{ github.workspace }}/_install/lib/cmake/prometheus-cpp "-DCMAKE_TOOLCHAIN_FILE=${Env:VCPKG_INSTALLATION_ROOT}\scripts\buildsystems\vcpkg.cmake" -S ${{ github.workspace }}/cmake/project-import-cmake -B ${{ github.workspace }}/_import_cmake
11291

11392
- name: "Build CMake import Debug"
@@ -117,21 +96,21 @@ jobs:
11796
run: cmake --build ${{ github.workspace }}/_import_cmake --config Release
11897

11998
- name: "Configure for Unix Shared Libs with internal dependencies"
120-
if: matrix.dependencies == 'submodule' && runner.os != 'Windows'
121-
run: cmake -DUSE_THIRDPARTY_LIBRARIES=ON -DBUILD_SHARED_LIBS=ON -DCMAKE_INSTALL_PREFIX=${{ github.workspace }}/_install_shared -DENABLE_WARNINGS_AS_ERRORS=ON -DENABLE_COMPRESSION=OFF -DENABLE_PUSH=OFF -DCMAKE_DEBUG_POSTFIX=_d -GNinja -S ${{ github.workspace }} -B ${{ github.workspace }}/_build_shared
99+
if: runner.os != 'Windows'
100+
run: cmake "-DCMAKE_TOOLCHAIN_FILE=${VCPKG_INSTALLATION_ROOT}/scripts/buildsystems/vcpkg.cmake" -DBUILD_SHARED_LIBS=ON -DCMAKE_INSTALL_PREFIX=${{ github.workspace }}/_install_shared -DENABLE_WARNINGS_AS_ERRORS=ON -DENABLE_COMPRESSION=OFF -DENABLE_PUSH=OFF -DCMAKE_DEBUG_POSTFIX=_d -GNinja -S ${{ github.workspace }} -B ${{ github.workspace }}/_build_shared
122101

123102
- name: "Build for Unix Shared Libs"
124-
if: matrix.dependencies == 'submodule' && runner.os != 'Windows'
103+
if: runner.os != 'Windows'
125104
run: cmake --build ${{ github.workspace }}/_build_shared
126105

127106
- name: "Install for Unix Shared Libs"
128-
if: matrix.dependencies == 'submodule' && runner.os != 'Windows'
107+
if: runner.os != 'Windows'
129108
run: cmake --install ${{ github.workspace }}/_build_shared
130109

131110
- name: "Configure pkg-config import for Unix"
132-
if: matrix.dependencies == 'submodule' && runner.os != 'Windows'
133-
run: cmake -DCMAKE_PREFIX_PATH=${{ github.workspace }}/_install_shared -GNinja -S ${{ github.workspace }}/cmake/project-import-pkgconfig -B ${{ github.workspace }}/_import_pkgconfig
111+
if: runner.os != 'Windows'
112+
run: cmake "-DCMAKE_TOOLCHAIN_FILE=${VCPKG_INSTALLATION_ROOT}/scripts/buildsystems/vcpkg.cmake" -DCMAKE_PREFIX_PATH=${{ github.workspace }}/_install_shared -GNinja -S ${{ github.workspace }}/cmake/project-import-pkgconfig -B ${{ github.workspace }}/_import_pkgconfig
134113

135114
- name: "Build pkg-config import for Unix"
136-
if: matrix.dependencies == 'submodule' && runner.os != 'Windows'
115+
if: runner.os != 'Windows'
137116
run: cmake --build ${{ github.workspace }}/_import_pkgconfig

‎.github/workflows/linting.yml‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,10 @@ jobs:
1717
- name: Install dependencies
1818
run: |
1919
apt-get update
20-
apt-get install -y --no-install-recommends ca-certificates clang-19 cmake git iwyu libbenchmark-dev libcurl4-openssl-dev ninja-build zlib1g-dev
20+
apt-get install -y --no-install-recommends ca-certificates clang-19 cmake git iwyu libbenchmark-dev libcivetweb-dev libcurl4-openssl-dev ninja-build zlib1g-dev
2121
2222
- name: Checkout source
2323
uses: actions/checkout@v7
24-
with:
25-
submodules: true
2624

2725
- name: "CMake Configure"
2826
run: cmake -GNinja -DRUN_IWYU=ON -DCMAKE_C_COMPILER=clang-19 -DCMAKE_CXX_COMPILER=clang++-19 -S ${GITHUB_WORKSPACE} -B ${GITHUB_WORKSPACE}/_build

‎.github/workflows/release.yml‎

Lines changed: 0 additions & 27 deletions
This file was deleted.

‎.gitmodules‎

Lines changed: 0 additions & 6 deletions
This file was deleted.

‎3rdparty/civetweb‎

Lines changed: 0 additions & 1 deletion
This file was deleted.

‎3rdparty/googletest‎

Lines changed: 0 additions & 1 deletion
This file was deleted.

‎CMakeLists.txt‎

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,6 @@ option(ENABLE_PULL "Build prometheus-cpp pull library" ON)
2121
option(ENABLE_PUSH "Build prometheus-cpp push library" ON)
2222
option(ENABLE_COMPRESSION "Enable gzip compression" ON)
2323
option(ENABLE_TESTING "Build tests" ON)
24-
option(USE_THIRDPARTY_LIBRARIES "Use 3rdParty submodules" ON)
25-
option(THIRDPARTY_CIVETWEB_WITH_SSL "Enable SSL support for embedded civetweb source code")
2624
option(OVERRIDE_CXX_STANDARD_FLAGS "Force building with -std=c++17 even if the CXXFLAGS are configured differently" ON)
2725
option(GENERATE_PKGCONFIG "Generate and install pkg-config files" ${UNIX})
2826
option(RUN_IWYU "Run include-what-you-use" OFF)
@@ -82,11 +80,7 @@ endif()
8280
include(CheckAtomic)
8381

8482
if(ENABLE_TESTING)
85-
if(USE_THIRDPARTY_LIBRARIES)
86-
find_package(googlemock-3rdparty CONFIG REQUIRED)
87-
else()
88-
find_package(GTest 1.8.1 CONFIG REQUIRED)
89-
endif()
83+
find_package(GTest 1.8.1 CONFIG REQUIRED)
9084
find_package(benchmark CONFIG)
9185
enable_testing()
9286
endif()

‎README.md‎

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -105,17 +105,21 @@ the [GitHub Workflows](.github/workflows) might help.
105105

106106
### With CMake
107107

108-
For CMake builds don't forget to fetch the submodules first. Please note that
109-
[zlib](https://zlib.net/) and [libcurl](https://curl.se/) are not provided by
110-
the included submodules. In the example below their usage is disabled.
108+
`prometheus-cpp` does not vendor its dependencies. It expects the following
109+
libraries to already be installed and discoverable via `find_package()`:
111110

112-
Then build as usual.
111+
- [civetweb](https://github.com/civetweb/civetweb)
112+
- [googletest](https://github.com/google/googletest) (optional, needed for `ENABLE_TESTING`)
113+
- [benchmark](https://github.com/google/benchmark) (optional, needed for benchmarks)
114+
- [zlib](https://zlib.net/) (optional, needed for `ENABLE_COMPRESSION`)
115+
- [libcurl](https://curl.se/) (optional, needed for `ENABLE_PUSH`)
113116

114-
``` shell
115-
# fetch third-party dependencies
116-
git submodule init
117-
git submodule update
117+
Use whichever package manager you prefer to provide them, e.g.
118+
[vcpkg](#vcpkg), [Conan](#conan), your system's package manager, or a
119+
manually installed copy. In the example below push support and compression
120+
are disabled to keep the dependency list minimal.
118121

122+
``` shell
119123
mkdir _build
120124
cd _build
121125

@@ -155,9 +159,6 @@ configuration options.
155159
To generate a Debian package you could follow these steps:
156160

157161
``` shell
158-
# fetch third-party dependencies
159-
git submodule update --init
160-
161162
# run cmake
162163
cmake -B_build -DCPACK_GENERATOR=DEB -DBUILD_SHARED_LIBS=ON # or OFF for static libraries
163164

‎cmake/civetweb-3rdparty-config.cmake‎

Lines changed: 0 additions & 73 deletions
This file was deleted.

‎cmake/googlemock-3rdparty-config.cmake‎

Lines changed: 0 additions & 29 deletions
This file was deleted.

0 commit comments

Comments
 (0)