Skip to content
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

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
File renamed without changes.
File renamed without changes.
9 changes: 9 additions & 0 deletions ShangEn/lab1/part2/CMakeLists.txt
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)
Copy link
Contributor

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

Empty file.
9 changes: 9 additions & 0 deletions ShangEn/lab1/part2/include/part2.hpp
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();
};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see comment about generated files

Empty file.
7 changes: 7 additions & 0 deletions ShangEn/lab1/part2/src/main.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#include <part2.hpp>

int main()
{
MyLib test;
test.hello();
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see comment about generated files

Empty file.
7 changes: 7 additions & 0 deletions ShangEn/lab1/part2/src/part2.cpp
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;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see comment about generated files

Empty file.
18 changes: 18 additions & 0 deletions ShangEn/lab2/part1/CMakeLists.txt
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*"
)
8 changes: 8 additions & 0 deletions ShangEn/lab2/part1/default.nix
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 ];
}
127 changes: 127 additions & 0 deletions ShangEn/lab2/part1/flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

52 changes: 52 additions & 0 deletions ShangEn/lab2/part1/flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
{
description = "vectornav c++ library";
Copy link
Contributor

Choose a reason for hiding this comment

The 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";
Copy link
Contributor

Choose a reason for hiding this comment

The 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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pls rename

my_overlays = [ easy_cmake.overlays.default vn_lib_overlay ];
Copy link
Contributor

Choose a reason for hiding this comment

The 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
Copy link
Contributor

Choose a reason for hiding this comment

The 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
Copy link
Contributor

Choose a reason for hiding this comment

The 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)\]"
'';
};

};
}
9 changes: 9 additions & 0 deletions ShangEn/lab2/part1/include/hellolib.hpp
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();
};
1 change: 1 addition & 0 deletions ShangEn/lab2/part1/result
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please do not include your result symlink

7 changes: 7 additions & 0 deletions ShangEn/lab2/part1/src/hellolib.cpp
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;
}
7 changes: 7 additions & 0 deletions ShangEn/lab2/part1/src/main.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#include <hellolib.hpp>

int main()
{
MyLib test;
test.hello();
}