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

Pretty sure lab2 part 3 done #90

Open
wants to merge 1 commit 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.
File renamed without changes.
File renamed without changes.
File renamed without changes.
17 changes: 17 additions & 0 deletions milesK/milesKlab2/p3/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
cmake_minimum_required(VERSION 3.15...3.30)
project(hellolib_exe VERSION 0.1.0 LANGUAGES CXX)

# Find the hellolib library
find_package(hellolib REQUIRED)

# Create the executable
add_executable(hellolib_exe main.cpp)

# Link hellolib to the executable
target_link_libraries(hellolib_exe PRIVATE hellolib)

# Installation rules for the executable
install(TARGETS hellolib_exe
RUNTIME DESTINATION bin
)

9 changes: 9 additions & 0 deletions milesK/milesKlab2/p3/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{ stdenv, cmake, hellolib }:

stdenv.mkDerivation rec {
pname = "hellolib_exe";
version = "0.1.0";
src = ./.;
nativeBuildInputs = [ cmake ];
buildInputs = [ hellolib ];
}
62 changes: 62 additions & 0 deletions milesK/milesKlab2/p3/flake.lock

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

24 changes: 24 additions & 0 deletions milesK/milesKlab2/p3/flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
description = "Hello";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-23.05";
hellolib.url = "github:mileskent/hellolib";
};
outputs = {self, nixpkgs, hellolib}:
let
pkgs = import nixpkgs {
system = "x86_64-linux";
overlays = [ self.overlays.default hellolib.overlays.default ];
};

hellolib_overlay = final: prev: {
hellolib = final.callPackage ./default.nix { };
};
my_overlays = [ hellolib_overlay ];
in

{
packages.x86_64-linux.default = pkgs.hellolib;
overlays.default = nixpkgs.lib.composeManyExtensions my_overlays;
};
}
7 changes: 7 additions & 0 deletions milesK/milesKlab2/p3/main.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#include <hellolib.hpp>
#include <iostream>

int main (void) {
std::cout << hello() << std::endl;
return 0;
}