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 #64

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 5 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
9 changes: 9 additions & 0 deletions Sebastian/Lab1Hard/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
cmake_minimum_required(VERSION 3.24)
project(hello_world LANGUAGES CXX)

add_library(Lab1_lib SHARED src/HelloWorld.cpp)
target_include_directories(Lab1_lib PUBLIC include)
target_compile_features(Lab1_lib PUBLIC cxx_std_11)

add_executable(newTest src/main.cpp)
target_link_libraries(newTest PUBLIC Lab1_lib)
8 changes: 8 additions & 0 deletions Sebastian/Lab1Hard/include/HelloWorld.h
PrimalSebman marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#ifndef HELLOWORLD_H
#define HELLOWORLD_H

class HelloWorld {
public:
void hello_world();
};
#endif
6 changes: 6 additions & 0 deletions Sebastian/Lab1Hard/src/HelloWorld.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#include <iostream>
#include "HelloWorld.h"

void HelloWorld::hello_world() {
std::cout << "Hello World!" << std::endl;
}
7 changes: 7 additions & 0 deletions Sebastian/Lab1Hard/src/main.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#include <iostream>
#include "HelloWorld.h"

int main() {
HelloWorld hiiii;
hiiii.hello_world();
}
1 change: 1 addition & 0 deletions Sebastian/Lab2_Part1/.gitignore
PrimalSebman marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build/
10 changes: 10 additions & 0 deletions Sebastian/Lab2_Part1/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
cmake_minimum_required(VERSION 3.24)
project (nix_stuff LANGUAGES CXX)

add_library(Lab2_lib SHARED src/HelloWorld.cpp)
target_include_directories(Lab2_lib PUBLIC include)
target_compile_features(Lab2_lib PUBLIC cxx_std_11)

add_executable(nixTest src/main.cpp)
target_link_libraries(nixTest PUBLIC Lab2_lib)
install(TARGETS nixTest)
8 changes: 8 additions & 0 deletions Sebastian/Lab2_Part1/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{ stdenv, cmake }:

stdenv.mkDerivation rec {
pname = "Lab 2 Part 1";
version = "0.1.0";
src = ./.;
nativeBuildInputs = [ cmake ];
}
27 changes: 27 additions & 0 deletions Sebastian/Lab2_Part1/flake.lock

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

30 changes: 30 additions & 0 deletions Sebastian/Lab2_Part1/flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
description = "part 1 flake";

inputs = {
nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable";
};

outputs = { self, nixpkgs }:
let
hello_lib_overlay = final: prev: {
hello_lib = final.callPackage ./default.nix { };
};

# Define overlays as a list
my_overlays = [ hello_lib_overlay ];

# Import nixpkgs with overlays applied
pkgs = import nixpkgs {
system = "x86_64-linux";
overlays = my_overlays;
};
in
{
# Define the default package for x86_64-linux
packages.x86_64-linux.default = pkgs.hello_lib;

# Expose the overlays for reuse if necessary
overlays.default = hello_lib_overlay;
};
}
9 changes: 9 additions & 0 deletions Sebastian/Lab2_Part1/include/HelloWorld.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#ifndef HELLOWORLD_HPP
#define HELLOWORLD_HPP

class HelloWorld {
public:
void hello_world();
};

#endif
6 changes: 6 additions & 0 deletions Sebastian/Lab2_Part1/src/HelloWorld.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#include <iostream>
#include "HelloWorld.hpp"

void HelloWorld::hello_world() {
std::cout << "Hello, World!" << std::endl;
}
7 changes: 7 additions & 0 deletions Sebastian/Lab2_Part1/src/main.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#include <iostream>
#include "HelloWorld.hpp"

int main() {
HelloWorld heyo;
heyo.hello_world();
}