Skip to content

Commit

Permalink
Use CPM and simplify CMake. (#2267)
Browse files Browse the repository at this point in the history
There. I finally cracked. While trying to get CMake to play ball with
Tracy I had to devise the next
bespoke solution for adding a dependency. Now, we are just using CPM
https://github.com/cpm-cmake/CPM.cmake
which makes things significantly less painful, if not painless, it's
still CMake after all.

This means:
- No more submodules. Everything is pulled in via CPM.
- No more toggling between system packages and submodules. System is
preferred, if compatible.
- No more ten ways of adding a dependency. It's two now. (I'd prefer
one, but what can we do?)
- Significantly less code in our build system.
  • Loading branch information
thorstenhater authored Sep 11, 2024
1 parent a292557 commit 660804e
Show file tree
Hide file tree
Showing 43 changed files with 218 additions and 2,176 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/benchmarks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ jobs:
run: |
mkdir build
cd build
cmake .. -GNinja -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_COMPILER=$CXX -DCMAKE_C_COMPILER=$CC -DARB_WITH_MPI=OFF -DARB_USE_BUNDLED_LIBS=ON
cmake .. -GNinja -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_COMPILER=$CXX -DCMAKE_C_COMPILER=$CC -DARB_WITH_MPI=OFF
ninja -j4 ubenches
cd -
- name: Run benchmarks
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ jobs:
run: |
mkdir build
cd build
cmake .. -DCMAKE_CXX_COMPILER=g++ -DCMAKE_C_COMPILER=gcc -DARB_WITH_PYTHON=ON -DARB_VECTORIZE=ON -DPython3_EXECUTABLE=`which python` -DARB_WITH_MPI=OFF -DARB_USE_BUNDLED_LIBS=ON -DARB_WITH_ASSERTIONS=ON -DARB_WITH_PROFILING=ON
cmake .. -DCMAKE_CXX_COMPILER=g++ -DCMAKE_C_COMPILER=gcc -DARB_WITH_PYTHON=ON -DARB_VECTORIZE=ON -DPython3_EXECUTABLE=`which python` -DARB_WITH_MPI=OFF -DARB_WITH_ASSERTIONS=ON -DARB_WITH_PROFILING=ON
make -j4 tests examples pyarb
cd -
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/sanitize.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ jobs:
mkdir build
cd build
export SAN="-fsanitize=${{ matrix.sanitizer }} -fno-omit-frame-pointer"
cmake .. -GNinja -DCMAKE_BUILD_TYPE=debug -DCMAKE_CXX_FLAGS="$SAN" -DCMAKE_C_FLAGS="$SAN" -DCMAKE_EXE_LINKER_FLAGS="$SAN" -DCMAKE_MODULE_LINKER_FLAGS="$SAN" -DCMAKE_CXX_COMPILER=$CXX -DCMAKE_C_COMPILER=$CC -DARB_VECTORIZE=${{ matrix.simd }} -DARB_WITH_MPI=OFF -DARB_USE_BUNDLED_LIBS=ON -DARB_WITH_PYTHON=ON -DPython3_EXECUTABLE=`which python`
cmake .. -GNinja -DCMAKE_BUILD_TYPE=debug -DCMAKE_CXX_FLAGS="$SAN" -DCMAKE_C_FLAGS="$SAN" -DCMAKE_EXE_LINKER_FLAGS="$SAN" -DCMAKE_MODULE_LINKER_FLAGS="$SAN" -DCMAKE_CXX_COMPILER=$CXX -DCMAKE_C_COMPILER=$CC -DARB_VECTORIZE=${{ matrix.simd }} -DARB_WITH_MPI=OFF -DARB_WITH_PYTHON=ON -DPython3_EXECUTABLE=`which python`
ninja -j4 -v tests examples pyarb
cd -
- name: Run unit tests
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test-docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,5 @@ jobs:
run: |
mkdir build
cd build
cmake .. -DARB_WITH_PYTHON=ON -DPython3_EXECUTABLE=`which python` -DARB_USE_BUNDLED_LIBS=ON
cmake .. -DARB_WITH_PYTHON=ON -DPython3_EXECUTABLE=`which python`
make html
4 changes: 2 additions & 2 deletions .github/workflows/test-matrix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ jobs:
export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH"
mkdir build
cd build
cmake .. -GNinja -DCMAKE_CXX_COMPILER=$CXX -DCMAKE_C_COMPILER=$CC -DARB_WITH_PYTHON=ON -DARB_VECTORIZE=${{ matrix.config.simd }} -DPython3_EXECUTABLE=`which python` -DARB_WITH_MPI=${{ matrix.config.mpi }} -DARB_USE_BUNDLED_LIBS=ON -DARB_WITH_ASSERTIONS=ON -DARB_WITH_PROFILING=ON
cmake .. -GNinja -DCMAKE_CXX_COMPILER=$CXX -DCMAKE_C_COMPILER=$CC -DARB_WITH_PYTHON=ON -DARB_VECTORIZE=${{ matrix.config.simd }} -DPython3_EXECUTABLE=`which python` -DARB_WITH_MPI=${{ matrix.config.mpi }} -DARB_WITH_ASSERTIONS=ON -DARB_WITH_PROFILING=ON
ninja -j4 tests examples pyarb
cd -
- if: ${{ matrix.variant == 'shared' }}
Expand All @@ -162,7 +162,7 @@ jobs:
export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH"
mkdir build
cd build
cmake .. -GNinja -DCMAKE_CXX_COMPILER=$CXX -DCMAKE_C_COMPILER=$CC -DARB_WITH_PYTHON=ON -DARB_VECTORIZE=${{ matrix.config.simd }} -DPython3_EXECUTABLE=`which python` -DARB_WITH_MPI=${{ matrix.config.mpi }} -DARB_USE_BUNDLED_LIBS=ON -DARB_WITH_ASSERTIONS=ON -DBUILD_SHARED_LIBS=ON -DARB_WITH_PROFILING=ON
cmake .. -GNinja -DCMAKE_CXX_COMPILER=$CXX -DCMAKE_C_COMPILER=$CC -DARB_WITH_PYTHON=ON -DARB_VECTORIZE=${{ matrix.config.simd }} -DPython3_EXECUTABLE=`which python` -DARB_WITH_MPI=${{ matrix.config.mpi }} -DARB_WITH_ASSERTIONS=ON -DBUILD_SHARED_LIBS=ON -DARB_WITH_PROFILING=ON
ninja -j4 tests examples pyarb
cd -
- name: Install arbor
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test-pip.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
- name: Build and install Arbor using pip + build flags
run: |
source ~/env/bin/activate
CMAKE_ARGS="-DARB_VECTORIZE=ON -DARB_ARCH=native" pip install .
CMAKE_ARGS="-DARB_VECTORIZE=ON -DARB_ARCH=native" pip -vvv install .
- name: Check that build flags match
run: |
source ~/env/bin/activate
Expand Down
31 changes: 0 additions & 31 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,31 +0,0 @@
[submodule "google-benchmark"]
path = ext/google-benchmark
url = https://github.com/google/benchmark.git
branch = main
[submodule "ext/fmt"]
path = ext/fmt
url = https://github.com/fmtlib/fmt.git
branch = master
[submodule "ext/random123"]
path = ext/random123
url = https://github.com/DEShawResearch/random123.git
branch = main
[submodule "ext/json"]
path = ext/json
url = https://github.com/nlohmann/json.git
branch = master
[submodule "ext/pybind11"]
path = ext/pybind11
url = https://github.com/pybind/pybind11.git
branch = master
[submodule "ext/googletest"]
path = ext/googletest
url = https://github.com/google/googletest.git
branch = main
[submodule "ext/pugixml"]
path = ext/pugixml
url = https://github.com/zeux/pugixml.git
branch = master
[submodule "ext/units"]
path = ext/units
url = https://github.com/LLNL/units.git
2 changes: 1 addition & 1 deletion .gitpod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ tasks:
mkdir build
cmake -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE -H/workspace/arbor -B/workspace/arbor/build \
-DCMAKE_INSTALL_PREFIX:STRING=/workspace/arbor/install -DCMAKE_BUILD_TYPE:STRING=Debug -G "Unix Makefiles" \
-DARB_WITH_PYTHON:BOOL=ON -DARB_USE_BUNDLED_LIBS:BOOL=ON
-DARB_WITH_PYTHON:BOOL=ON
ln -s /workspace/arbor/build/compile_commands.json /workspace/arbor
export PYTHONPATH=/workspace/arbor/install/lib/python3.7/site-packages
prebuild: |
Expand Down
Loading

0 comments on commit 660804e

Please sign in to comment.