Skip to content

Commit

Permalink
Some CMake quality of life
Browse files Browse the repository at this point in the history
  • Loading branch information
roversch committed Sep 12, 2024
1 parent 1b0925d commit 9fcce11
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 13 deletions.
3 changes: 3 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ project(blast VERSION 0.1 LANGUAGES CXX)
# Enable modern C++
set(CMAKE_CXX_STANDARD 20)

# Allow for integration with other tools such as Intellisense
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)

# Don't use compiler's C++ extensions
set(CMAKE_CXX_EXTENSIONS False)

Expand Down
14 changes: 1 addition & 13 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -54,19 +54,7 @@ COPY CMakeLists.txt blast
COPY Makefile blast/Makefile
ENV PKG_CONFIG_PATH=/usr/local/lib
RUN mkdir -p blast/build && cd blast/build \
&& cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DCMAKE_CXX_COMPILER="clang++-15" \
-DCMAKE_CXX_FLAGS="-march=native -mfma -mavx -mavx2 -msse4 -fno-math-errno -DXSIMD_DEFAULT_ARCH='fma3<avx2>'" \
-DCMAKE_CXX_FLAGS_RELEASE="-O3 -g -DNDEBUG -ffast-math" .. \
-DBLAST_WITH_TEST=ON \
-DBLAST_WITH_BENCHMARK=ON \
-DBLAST_WITH_BLASFEO=ON \
-DBLAST_BUILD_BLAST_BENCHMARK=ON \
-DBLAST_BUILD_LIBXSMM_BENCHMARK=ON \
-DBLAST_BUILD_BLAS_BENCHMARK=ON \
-DBLAST_BUILD_BLAZE_BENCHMARK=ON \
-DBLAST_BUILD_EIGEN_BENCHMARK=ON \
-DBLAST_BUILD_BLASFEO_BENCHMARK=ON \
&& cmake -C ../cmake/InitialCache.cmake .. \
&& make -j `nproc` VERBOSE=1

# Run tests
Expand Down
12 changes: 12 additions & 0 deletions cmake/InitialCache.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING "Build type (Debug, Release, etc.)")
set(CMAKE_CXX_FLAGS "-march=native -mfma -mavx -mavx2 -msse4 -fno-math-errno -DXSIMD_DEFAULT_ARCH='fma3<avx2>'" CACHE STRING "Recommended compiler flags")
set(CMAKE_CXX_FLAGS_RELEASE "-O3 -g -DNDEBUG -ffast-math" CACHE STRING "Recommended compiler flags for a Release build")
set(BLAST_WITH_TEST ON CACHE BOOL "Build blast tests")
set(BLAST_WITH_BENCHMARK ON CACHE BOOL "Build blast benchmarks")
set(BLAST_WITH_BLASFEO ON CACHE BOOL "Build blasfeo C++ interface")
set(BLAST_BUILD_BLAST_BENCHMARK ON CACHE BOOL "Build BLAST benchmark")
set(BLAST_BUILD_LIBXSMM_BENCHMARK ON CACHE BOOL "Build LIBXSMM benchmark")
set(BLAST_BUILD_BLAS_BENCHMARK ON CACHE BOOL "Build benchmarks for all installed BLAS libraries")
set(BLAST_BUILD_BLAZE_BENCHMARK ON CACHE BOOL "Build Blaze benchmark")
set(BLAST_BUILD_EIGEN_BENCHMARK ON CACHE BOOL "Build Eigen benchmark")
set(BLAST_BUILD_BLASFEO_BENCHMARK ON CACHE BOOL "Build BLASFEO benchmark")

0 comments on commit 9fcce11

Please sign in to comment.