Setup the basic main function

This commit is contained in:
Sameer Rahmani 2024-03-25 20:56:53 +00:00
parent a829c30424
commit 1ffdf050e4
Signed by: lxsameer
GPG Key ID: 8741FACBF412FFA5
4 changed files with 48 additions and 13 deletions

View File

@ -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)

View File

@ -19,8 +19,15 @@
#include <argparse/argparse.hpp> // for ArgumentParser
#include <memory> // 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;
}

View File

@ -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 {

View File

@ -13,7 +13,7 @@
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
{ 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;
}