-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Lab 1 Part 2 #32
base: main
Are you sure you want to change the base?
Lab 1 Part 2 #32
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
cmake_minimum_required(VERSION 3.22) | ||
|
||
project(hello_world LANGUAGES CXX) | ||
|
||
add_library(hello_world_lib SHARED src/part2.cpp) | ||
target_include_directories(hello_world_lib PUBLIC include) | ||
|
||
add_executable(test src/main.cpp) | ||
target_link_libraries(test PUBLIC hello_world_lib) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#pragma once | ||
#include <iostream> | ||
|
||
class MyLib | ||
{ | ||
public: | ||
MyLib() = default; | ||
void hello(); | ||
}; |
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. see comment about generated files |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#include <part2.hpp> | ||
|
||
int main() | ||
{ | ||
MyLib test; | ||
test.hello(); | ||
} |
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. see comment about generated files |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#include <part2.hpp> | ||
#include <iostream> | ||
|
||
void MyLib::hello() | ||
{ | ||
std::cout << "Hello, World!!!" << std::endl; | ||
} |
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. see comment about generated files |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
cmake_minimum_required(VERSION 3.22) | ||
|
||
project(hello_world LANGUAGES CXX) | ||
|
||
add_library(hello_world_lib SHARED src/hellolib.cpp) | ||
target_include_directories(hello_world_lib PUBLIC include) | ||
|
||
add_executable(test src/main.cpp) | ||
target_link_libraries(test PUBLIC hello_world_lib) | ||
|
||
include(GNUInstallDirs) | ||
install(TARGETS test DESTINATION ${CMAKE_INSTALL_BINDIR}) | ||
install(TARGETS hello_world_lib DESTINATION ${CMAKE_INSTALL_LIBDIR}) | ||
install( | ||
DIRECTORY include/ | ||
DESTINATION ${CMAKE_INSTALL_PREFIX}/include | ||
FILES_MATCHING PATTERN "*.h*" | ||
) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ stdenv, cmake }: | ||
|
||
stdenv.mkDerivation rec { | ||
pname = "easy_cmake"; | ||
version = "0.1.0"; | ||
src = ./.; | ||
nativeBuildInputs = [ cmake ]; | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
{ | ||
description = "vectornav c++ library"; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. incorrect description 🥸 |
||
|
||
inputs = { | ||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-23.05"; | ||
utils.url = "github:numtide/flake-utils"; | ||
easy_cmake.url = "github:RCMast3r/easy_cmake"; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. easy_cmake is not required here |
||
}; | ||
outputs = { self, nixpkgs, utils, easy_cmake }: | ||
let | ||
vn_lib_overlay = final: prev: { | ||
vn_lib = final.callPackage ./default.nix { }; | ||
}; | ||
Comment on lines
+11
to
+13
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. pls rename |
||
my_overlays = [ easy_cmake.overlays.default vn_lib_overlay ]; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. see comment about unnecessary easy_cmake |
||
pkgs = import nixpkgs { | ||
system = "x86_64-linux"; | ||
overlays = [ self.overlays.default ]; | ||
}; | ||
in | ||
{ | ||
overlays.default = nixpkgs.lib.composeManyExtensions my_overlays; | ||
|
||
packages.x86_64-linux = | ||
rec { | ||
vn_lib = pkgs.vn_lib; | ||
py_vn_lib = pkgs.py_vn_lib; | ||
default = vn_lib; | ||
Comment on lines
+25
to
+27
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. pls rename |
||
}; | ||
|
||
devShells.x86_64-linux.default = | ||
pkgs.mkShell rec { | ||
# Update the name to something that suites your project. | ||
name = "nix-devshell"; | ||
packages = with pkgs; [ | ||
# Development Tools | ||
cmake | ||
vn_lib | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. rename |
||
]; | ||
|
||
# Setting up the environment variables you need during | ||
# development. | ||
shellHook = | ||
let | ||
icon = "f121"; | ||
in | ||
'' | ||
export PS1="$(echo -e '\u${icon}') {\[$(tput sgr0)\]\[\033[38;5;228m\]\w\[$(tput sgr0)\]\[\033[38;5;15m\]} (${name}) \\$ \[$(tput sgr0)\]" | ||
''; | ||
}; | ||
|
||
}; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#pragma once | ||
#include <iostream> | ||
|
||
class MyLib | ||
{ | ||
public: | ||
MyLib() = default; | ||
void hello(); | ||
}; |
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. please do not include your result symlink |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/nix/store/0mb3j4icyhpfvrmbfaa1hr9x0ga8mh2k-easy_cmake-0.1.0 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#include <hellolib.hpp> | ||
#include <iostream> | ||
|
||
void MyLib::hello() | ||
{ | ||
std::cout << "Hello, World!!!" << std::endl; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#include <hellolib.hpp> | ||
|
||
int main() | ||
{ | ||
MyLib test; | ||
test.hello(); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please do not include extraneous generated files