From 76befbfdc8063b71190d025eb5de910cde74dbf5 Mon Sep 17 00:00:00 2001 From: Benjamin Palko Date: Sat, 3 Aug 2024 22:58:07 -0400 Subject: [PATCH] HELLO WORLD!!! --- CMakeLists.txt | 14 ++++++++++++++ build.sh | 3 +++ cmake.sh | 3 +++ compile-commands.sh | 3 +++ main.cpp | 6 ++++++ shell.nix | 21 +++++++++++++++++++++ vcpkg.json | 3 +++ 7 files changed, 53 insertions(+) create mode 100644 CMakeLists.txt create mode 100755 build.sh create mode 100755 cmake.sh create mode 100755 compile-commands.sh create mode 100644 main.cpp create mode 100644 shell.nix create mode 100644 vcpkg.json diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..f31c315 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,14 @@ +cmake_minimum_required(VERSION 3.29.6) + +set(CMAKE_TOOLCHAIN_FILE "$ENV{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake") +set(CMAKE_CXX_COMPILER clang++) +set(CMAKE_CXX_STANDARD 20) +set(CMAKE_EXPORT_COMPILE_COMMANDS ON) + +project(HelloWorld CXX) + +find_package(fmt CONFIG REQUIRED) + +add_executable(HelloWorld main.cpp) + +target_link_libraries(HelloWorld PRIVATE fmt::fmt) diff --git a/build.sh b/build.sh new file mode 100755 index 0000000..0555b27 --- /dev/null +++ b/build.sh @@ -0,0 +1,3 @@ +#!/bin/sh + +cmake --build build diff --git a/cmake.sh b/cmake.sh new file mode 100755 index 0000000..1ad927d --- /dev/null +++ b/cmake.sh @@ -0,0 +1,3 @@ +#!/bin/sh + +cmake -B build -S . diff --git a/compile-commands.sh b/compile-commands.sh new file mode 100755 index 0000000..5a519b2 --- /dev/null +++ b/compile-commands.sh @@ -0,0 +1,3 @@ +#!/bin/sh + +cmake . -DCMAKE_EXPORT_COMPILE_COMMANDS=1 diff --git a/main.cpp b/main.cpp new file mode 100644 index 0000000..6c64ddf --- /dev/null +++ b/main.cpp @@ -0,0 +1,6 @@ +#include + +int main() { + fmt::print("Hello world!\n"); + return 0; +} diff --git a/shell.nix b/shell.nix new file mode 100644 index 0000000..18b1822 --- /dev/null +++ b/shell.nix @@ -0,0 +1,21 @@ +{ + pkgs ? import { }, +}: +pkgs.mkShell { + # nativeBuildInputs is usually what you want -- tools you need to run + nativeBuildInputs = with pkgs.buildPackages; [ + bear + gnumake + cmake + vcpkg + clang + clang-tools + pkg-config + ]; + + shellHook = '' + export VCPKG_ROOT="${pkgs.vcpkg.outPath}/share/vcpkg"; + export CC="${pkgs.clang.outPath}/bin/clang"; + export CXX="${pkgs.clang.outPath}/bin/clang++"; + ''; +} diff --git a/vcpkg.json b/vcpkg.json new file mode 100644 index 0000000..80e6b42 --- /dev/null +++ b/vcpkg.json @@ -0,0 +1,3 @@ +{ + "dependencies": ["fmt"] +}