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 done #42

Open
wants to merge 5 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
3 changes: 3 additions & 0 deletions AnujNaik/.vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"cmake.sourceDirectory": "/Users/anujnaik/Desktop/HyTech/Software-Onboarding-2025/AnujNaik/lab1/part1"
}
4 changes: 4 additions & 0 deletions AnujNaik/lab1/part1/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
project(hello_world LANGUAGES CXX)
cmake_minimum_required(VERSION 3.24)

add_executable(test main.cpp)
6 changes: 6 additions & 0 deletions AnujNaik/lab1/part1/main.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#include <iostream>

int main()
{
std::cout << "Hello, World!\n";
}
9 changes: 9 additions & 0 deletions AnujNaik/lab1/part2/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
cmake_minimum_required(VERSION 3.24)
project(lab1_part2 LANGUAGES CXX)
add_library(part2lib SHARED src/part2.cpp)

target_include_directories(part2lib PUBLIC include)

add_executable(part2 app/main.cpp)

target_link_libraries(part2 PUBLIC part2lib)
7 changes: 7 additions & 0 deletions AnujNaik/lab1/part2/app/main.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#include <part2.h>

int main() {
HelloWorldLib impl;
impl.hello();
return 0;
}
8 changes: 8 additions & 0 deletions AnujNaik/lab1/part2/include/part2.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#pragma once
#include <iostream>

class HelloWorldLib {
public:
HelloWorldLib() =default;
void hello();
};
9 changes: 9 additions & 0 deletions AnujNaik/lab1/part2/src/part2.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#include <part2.h>
// #include "../include/part2.h"
Copy link
Contributor

Choose a reason for hiding this comment

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

please dont push commented code

#include <iostream>

using namespace std;

void HelloWorldLib::hello() {
cout << "Hello World! (pt2)\n";
}
18 changes: 18 additions & 0 deletions AnujNaik/lab2/part1/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
cmake_minimum_required(VERSION 3.1)
project(
ccp_playground VERSION 1.0
DESCRIPTION "Playing around with cmake"
)

add_library(hellolib STATIC src/hellolib.cpp)

target_include_directories(hellolib PUBLIC include)
add_executable(target src/main.cpp)

target_link_libraries(target PUBLIC hellolib)

set_target_properties(target PROPERTIES CXX_STANDARD 17)
target_compile_features(target PRIVATE cxx_std_17)

# Install the executable to bin directory
install(TARGETS target DESTINATION ${CMAKE_INSTALL_PREFIX}/bin)
8 changes: 8 additions & 0 deletions AnujNaik/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";
Copy link
Contributor

Choose a reason for hiding this comment

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

please change the name of this

version = "0.1.0";
src = ./.;
nativeBuildInputs = [ cmake ];
}
127 changes: 127 additions & 0 deletions AnujNaik/lab2/part1/flake.lock

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

55 changes: 55 additions & 0 deletions AnujNaik/lab2/part1/flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
{
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.

please change the name


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.

no need for easy cmake

};
outputs = { self, nixpkgs, utils, easy_cmake }:
let
vn_lib_overlay = final: prev: {
vn_lib = final.callPackage ./default.nix { };
};
py_vn_lib_overlay = final: prev: {
py_vn_lib = final.callPackage ./python.nix { };
};
Comment on lines +11 to +16
Copy link
Contributor

Choose a reason for hiding this comment

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

please change names to what you are creating

my_overlays = [ easy_cmake.overlays.default vn_lib_overlay py_vn_lib_overlay ];
pkgs = import nixpkgs {
system = "aarch64-darwin";
overlays = [ self.overlays.default ];
};
in
{
overlays.default = nixpkgs.lib.composeManyExtensions my_overlays;

packages.aarch64-darwin =
rec {
vn_lib = pkgs.vn_lib;
py_vn_lib = pkgs.py_vn_lib;
default = vn_lib;
};

devShells.aarch64-darwin.default =
pkgs.mkShell rec {
# Update the name to something that suites your project.
name = "nix-devshell";
packages = with pkgs; [
# Development Tools
cmake
vn_lib
];

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

};
}
8 changes: 8 additions & 0 deletions AnujNaik/lab2/part1/include/hellolib.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#pragma once
#include <iostream>

class HelloWorldLib {
public:
HelloWorldLib() = default;
void hello();
};
1 change: 1 addition & 0 deletions AnujNaik/lab2/part1/result
8 changes: 8 additions & 0 deletions AnujNaik/lab2/part1/src/hellolib.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#include <hellolib.hpp>
#include <iostream>

using namespace std;

void HelloWorldLib::hello() {
cout << "Hello World! (pt2)\n";
}
9 changes: 9 additions & 0 deletions AnujNaik/lab2/part1/src/main.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#include <hellolib.hpp>
#include <iostream>

using namespace std;

int main() {
HelloWorldLib lib;
lib.hello();
}
14 changes: 14 additions & 0 deletions AnujNaik/lab2/part2/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@

{ stdenv, cmake, hellolib }:

#make Derivation
stdenv.mkDerivation {
pname = "helloapp";
version = "0.1.0";
src = ./helloapp;

#make install
nativeBuildInputs = [ cmake ];
buildInputs = [ hellolib ];

}
61 changes: 61 additions & 0 deletions AnujNaik/lab2/part2/flake.lock

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

Loading