# FeynmanDB # # Copyright (c) 2023-2024 Sameer Rahmani # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, version 2. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. #A git plugin to manage journal entries in git # You should have received a copy of the GNU General Public License # along with this program. If not, see . cmake_minimum_required(VERSION 3.19) project(Feynman VERSION 0.1.0 DESCRIPTION "A single user and local graph database" LANGUAGES CXX) # Clangd command file set(CMAKE_EXPORT_COMPILE_COMMANDS 1) if(CMAKE_EXPORT_COMPILE_COMMANDS) # We need this setup for clangd to work inside of a Nix shell. # https://cmake.org/cmake/help/latest/variable/CMAKE_LANG_IMPLICIT_INCLUDE_DIRECTORIES.html set(CMAKE_CXX_STANDARD_INCLUDE_DIRECTORIES ${CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES}) endif() # ============================================================================= # Policies # ============================================================================= cmake_policy(SET CMP0116 OLD) # ============================================================================= # User Options # ============================================================================= option(CPP_20_SUPPORT "C++20 Support" ON) option(ENABLE_CCACHE "Enable ccache support" ON) option(ENABLE_DOCS "Enable docs" OFF) option(ENABLE_TESTS "Enable testing" OFF) option(ENABLE_LIBCXX "Enable libcxx" ON) option(ENABLE_COMPILER_RT "Enable compiler-rt" ON) # Let's ensure -std=c++xx instead of -std=g++xx set(CMAKE_CXX_EXTENSIONS OFF) set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake") set(MemoryCheckCommand "valgrind") # Let's nicely support folders in IDEs set_property(GLOBAL PROPERTY USE_FOLDERS ON) # Setup the basic compiler flags add_compile_options( -Wall -Wextra -Werror -Wpedantic -Wabstract-final-class -Walloca -Warray-bounds-pointer-arithmetic -Warray-parameter -Wassign-enum -Wsign-conversion -Wnon-virtual-dtor -Wold-style-cast -Wcast-align -Wunused -Woverloaded-virtual -Wdouble-promotion -Wno-error=unused-command-line-argument -Wformat=2) add_link_options(-Wl,-Map=output.map) # CCache support ============================== if(ENABLE_CCACHE) find_program(CCACHE_PROGRAM ccache) if(CCACHE_PROGRAM) message(STATUS "Found CCache") set(CCACHE_MAXSIZE "" CACHE STRING "Size of ccache") set(CCACHE_DIR "" CACHE STRING "Directory to keep ccached data") set(CCACHE_PARAMS "CCACHE_CPP2=yes CCACHE_HASHDIR=yes" CACHE STRING "Parameters to pass through to ccache") set(CCACHE_PROGRAM "${CCACHE_PARAMS} ${CCACHE_PROGRAM}") if (CCACHE_MAXSIZE) set(CCACHE_PROGRAM "CCACHE_MAXSIZE=${CCACHE_MAXSIZE} ${CCACHE_PROGRAM}") endif() if (CCACHE_DIR) set(CCACHE_PROGRAM "CCACHE_DIR=${CCACHE_DIR} ${CCACHE_PROGRAM}") endif() message(STATUS "Using CCACHE: ${CCACHE_PROGRAM}") set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ${CCACHE_PROGRAM}) else() message(FATAL_ERROR "Unable to find the program ccache. Set ENABLE_CCACHE to OFF") endif() endif() if (ENABLE_DOCS) add_subdirectory(docs) endif() add_subdirectory(feynman)