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 2 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)
PrimalSebman marked this conversation as resolved.
Show resolved Hide resolved
Empty file.
4 changes: 4 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,4 @@
class HelloWorld {
public:
void hello_world();
};
PrimalSebman marked this conversation as resolved.
Show resolved Hide resolved
Empty file.
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;
}
PrimalSebman marked this conversation as resolved.
Show resolved Hide resolved
Empty file.
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();
}
Empty file.
9 changes: 9 additions & 0 deletions Sebastian/Lab2_Part1/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
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)
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 ];
}
23 changes: 23 additions & 0 deletions Sebastian/Lab2_Part1/flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
description = "Lab 2 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 { };
#This line defines hello_lib as the derivation from default.nix
#Important stuff
};
my_overlays = [hello_lib_overlay];

pkgs = import nixpkgs {
system = "x86_64-linux";
overlays = [self.overlays.default];
};
in {
pachages.x86_64-linux.default = pkgs.hello_lib;
overlays.default = nixpkgs.lib.composeManyExtensions my_overlays;
};
}
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();
}