From 9fcce119fe074142896568d951792107c2b4b7b8 Mon Sep 17 00:00:00 2001 From: Robin Verschueren Date: Thu, 12 Sep 2024 13:19:49 +0200 Subject: [PATCH] Some CMake quality of life --- CMakeLists.txt | 3 +++ Dockerfile | 14 +------------- cmake/InitialCache.cmake | 12 ++++++++++++ 3 files changed, 16 insertions(+), 13 deletions(-) create mode 100644 cmake/InitialCache.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index 3b0ad928..2828f75c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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) diff --git a/Dockerfile b/Dockerfile index fb47dea6..6c1b7204 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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'" \ - -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 diff --git a/cmake/InitialCache.cmake b/cmake/InitialCache.cmake new file mode 100644 index 00000000..b9f2823c --- /dev/null +++ b/cmake/InitialCache.cmake @@ -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'" 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")