From ea32025792d970fbe6207928c6fec99ced1391e8 Mon Sep 17 00:00:00 2001 From: Christoph Urlacher Date: Thu, 18 Jan 2024 20:14:55 +0100 Subject: [PATCH] Initial commit --- .gitignore | 5 ++ CMakeLists.txt | 14 ++++++ flake.lock | 130 +++++++++++++++++++++++++++++++++++++++++++++++++ flake.nix | 87 +++++++++++++++++++++++++++++++++ src/main.cpp | 5 ++ 5 files changed, 241 insertions(+) create mode 100644 .gitignore create mode 100644 CMakeLists.txt create mode 100644 flake.lock create mode 100644 flake.nix create mode 100644 src/main.cpp diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..f67eef3 --- /dev/null +++ b/.gitignore @@ -0,0 +1,5 @@ +.idea +.envrc +.direnv +cmake-build-debug +cmake-build-release diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..ba8fbc2 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,14 @@ +cmake_minimum_required(VERSION 3.25) +project(BrainfuckInterpreter) + +set(CMAKE_CXX_STANDARD 20) + +# find_package(Boost 1.81 COMPONENTS program_options REQUIRED) + +include_directories(include) + +add_executable(bfuck + src/main.cpp +) + +# target_link_libraries(lasm Boost::program_options) diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..b0c6725 --- /dev/null +++ b/flake.lock @@ -0,0 +1,130 @@ +{ + "nodes": { + "devshell": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs" + }, + "locked": { + "lastModified": 1705332421, + "narHash": "sha256-USpGLPme1IuqG78JNqSaRabilwkCyHmVWY0M9vYyqEA=", + "owner": "numtide", + "repo": "devshell", + "rev": "83cb93d6d063ad290beee669f4badf9914cc16ec", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "devshell", + "type": "github" + } + }, + "flake-utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1701680307, + "narHash": "sha256-kAuep2h5ajznlPMD9rnQyffWG8EM/C73lejGofXvdM8=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "4022d587cbbfd70fe950c1e2083a02621806a725", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "flake-utils_2": { + "inputs": { + "systems": "systems_2" + }, + "locked": { + "lastModified": 1705309234, + "narHash": "sha256-uNRRNRKmJyCRC/8y1RqBkqWBLM034y4qN7EprSdmgyA=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "1ef2e671c3b0c19053962c07dbda38332dcebf26", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1704161960, + "narHash": "sha256-QGua89Pmq+FBAro8NriTuoO/wNaUtugt29/qqA8zeeM=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "63143ac2c9186be6d9da6035fa22620018c85932", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_2": { + "locked": { + "lastModified": 1705566941, + "narHash": "sha256-CLNtVRDA8eUPk+bxsCCZtRO0Cp+SpHdn1nNOLoFypLs=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "b06ff4bf8f4ad900fe0c2a61fc2946edc3a84be7", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "devshell": "devshell", + "flake-utils": "flake-utils_2", + "nixpkgs": "nixpkgs_2" + } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, + "systems_2": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..c1a01e2 --- /dev/null +++ b/flake.nix @@ -0,0 +1,87 @@ +{ + description = "C/C++ Environment"; + + inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; + inputs.flake-utils.url = "github:numtide/flake-utils"; + inputs.devshell.url = "github:numtide/devshell"; + + outputs = { + self, + nixpkgs, + flake-utils, + devshell, + }: + flake-utils.lib.eachDefaultSystem (system: let + pkgs = import nixpkgs { + inherit system; + config.allowUnfree = true; # For clion + overlays = [devshell.overlays.default]; + }; + + # NOTE: Usual 64 bit compilers that don't collide + bintools = pkgs.wrapBintoolsWith { + bintools = pkgs.bintools.bintools; + libc = pkgs.glibc; + }; + gcc13 = pkgs.hiPrio (pkgs.wrapCCWith { + cc = pkgs.gcc13.cc; + libc = pkgs.glibc; + bintools = bintools; + }); + clang16 = pkgs.wrapCCWith { + cc = pkgs.clang_16.cc; + libc = pkgs.glibc; + bintools = bintools; + }; + + # NOTE: Multilib compilers that don't collide + bintools_multi = pkgs.wrapBintoolsWith { + bintools = pkgs.bintools.bintools; # Get the unwrapped bintools from the wrapper + libc = pkgs.glibc_multi; + }; + gcc13_multi = pkgs.hiPrio (pkgs.wrapCCWith { + cc = pkgs.gcc13.cc; # Get the unwrapped gcc from the wrapper + libc = pkgs.glibc_multi; + bintools = bintools_multi; + }); + clang16_multi = pkgs.wrapCCWith { + cc = pkgs.clang_16.cc; + libc = pkgs.glibc_multi; + bintools = bintools_multi; + }; + in { + # devShell = pkgs.devshell.mkShell ... + devShell = pkgs.devshell.mkShell { + name = "C/C++ Environment"; + + packages = with pkgs; [ + # Compilers + bintools + gcc13 + clang16 + # bintools_multi + # gcc13_multi + # clang15_multi + + # Native buildinputs + gnumake + cmake + # nasm + + # Development + # bear # To generate compilation database + gdb + cling # To try out my bullshit implementations + # doxygen # Generate docs + graphs + ]; + + commands = [ + # { + # name = "ide"; + # help = "Run clion for project"; + # command = "clion &>/dev/null ./ &"; + # } + ]; + }; + }); +} diff --git a/src/main.cpp b/src/main.cpp new file mode 100644 index 0000000..8df2028 --- /dev/null +++ b/src/main.cpp @@ -0,0 +1,5 @@ +#include + +int main() { + std::cout << "Hello, World!" << std::endl; +} \ No newline at end of file