From 1ffdf050e492978af9b6d2eb0ed3e83801233e18 Mon Sep 17 00:00:00 2001 From: Sameer Rahmani Date: Mon, 25 Mar 2024 20:56:53 +0000 Subject: [PATCH] Setup the basic main function --- feynman/CMakeLists.txt | 27 +++++++++++++++++++++------ feynman/src/main.cpp | 13 ++++++++++--- flake.nix | 16 ++++++++++++++-- nix/utils.nix | 5 +++-- 4 files changed, 48 insertions(+), 13 deletions(-) diff --git a/feynman/CMakeLists.txt b/feynman/CMakeLists.txt index c5c1487..dad6e5d 100644 --- a/feynman/CMakeLists.txt +++ b/feynman/CMakeLists.txt @@ -19,7 +19,13 @@ set(iwyu_path ${iwyu}) find_program(lld NAMES lld REQUIRED) -add_executable(feynman) + +find_package(argparse REQUIRED) +find_package(fmt REQUIRED) +find_package(RocksDB REQUIRED) + +add_executable(feynman +) set_target_properties(feynman PROPERTIES VERSION ${PROJECT_VERSION} @@ -39,15 +45,24 @@ target_include_directories(feynman ${CMAKE_CURRENT_SOURCE_DIR}/src/janet ) + +add_dependencies(feynman + argparse::argparse + fmt::fmt + RocksDB::rocksdb +) + target_include_directories(feynman SYSTEM PUBLIC # We don't want the generated files from table gen # to be treated as local since the contain warnings - ${PROJECT_BINARY_DIR}/include) + ${PROJECT_BINARY_DIR}/feynman/include - -# target_link_libraries(feynman PRIVATE - -# ) +) +target_link_libraries(feynman PRIVATE + argparse::argparse + fmt::fmt + RocksDB::rocksdb +) # Autogenerate the `config.h` file configure_file(${CMAKE_CURRENT_SOURCE_DIR}/src/config.h.in include/config.h) diff --git a/feynman/src/main.cpp b/feynman/src/main.cpp index ab4249f..e2223b3 100644 --- a/feynman/src/main.cpp +++ b/feynman/src/main.cpp @@ -19,8 +19,15 @@ #include // for ArgumentParser #include // for allocator -//int argc, char *argv[] -int main() { - argparse::ArgumentParser program("git-journal"); +#include "config.h" + +int main(int argc, char *argv[]) { + argparse::ArgumentParser program("feynman", FEYNMAN_VERSION); + + program.add_argument("-f"); + + program.parse_args(argc, argv); + + std::cout << program << std::endl; return 0; } diff --git a/flake.nix b/flake.nix index 7eb76ae..0a8667a 100644 --- a/flake.nix +++ b/flake.nix @@ -131,6 +131,8 @@ inherit system overlays; }; + nativePkgs = import nixpkgs { inherit system; }; + pkgs = get_pkgs overlays; # Just disabling the tests that fails under musl git' = pkgs.git.overrideAttrs (old: { @@ -157,9 +159,10 @@ valgrind gtest bashInteractive + nativePkgs.fish ]); - deps = (with pkgs; [ + deps = (with pkgs.pkgsStatic; [ fmt rocksdb gtest @@ -172,11 +175,20 @@ build run compile + blah ]); + shell = args: (pkgs.mkShell.override { inherit stdenv; }) { - nativeBuildInputs = buildToolsDeps ++ devCommands; + name = "feynman"; + nativeBuildInputs = buildToolsDeps ++ devCommands ++ deps; buildInputs = deps; + + + CPP_LS = "clangd -j 30 --query-driver=${pkgs.clang_17}/bin/clang++-*"; + shellHook = '' + fish && exit + ''; } // args; in { diff --git a/nix/utils.nix b/nix/utils.nix index 2bb2d2d..5849491 100644 --- a/nix/utils.nix +++ b/nix/utils.nix @@ -13,7 +13,7 @@ # # You should have received a copy of the GNU General Public License # along with this program. If not, see . -{ deps, writeShellApplication, cmake, ninja, ...}: +{ deps, writeShellApplication, cmake, ninja, clang_17, ...}: let compile = writeShellApplication { name = "compile"; @@ -42,6 +42,7 @@ let ${compile}/bin/compile "$@" ''; }; + in { - inherit compile run build; + inherit compile run build blah; }