Skip to content

Instantly share code, notes, and snippets.

View neeraj9's full-sized avatar
🎯
Focusing

Neeraj neeraj9

🎯
Focusing
  • Microsoft
View GitHub Profile
@neeraj9
neeraj9 / effective_modern_cmake.md
Created June 4, 2023 18:38 — forked from mbinna/effective_modern_cmake.md
Effective Modern CMake

Effective Modern CMake

Getting Started

For a brief user-level introduction to CMake, watch C++ Weekly, Episode 78, Intro to CMake by Jason Turner. LLVM’s CMake Primer provides a good high-level introduction to the CMake syntax. Go read it now.

After that, watch Mathieu Ropert’s CppCon 2017 talk Using Modern CMake Patterns to Enforce a Good Modular Design (slides). It provides a thorough explanation of what modern CMake is and why it is so much better than “old school” CMake. The modular design ideas in this talk are based on the book [Large-Scale C++ Software Design](https://www.amazon.de/Large-Scale-Soft

@neeraj9
neeraj9 / building-zig-compiler-from-source-on-ubuntu-linux.sh
Last active October 24, 2023 06:40
Building zig compiler from source on Ubuntu Linux
# Building open source software from source code is always interesting
# although time consuming at times.
# Make sure that your system has CMake, Ninja, GCC (c, c++) compiler, Python 3 installed.
# see https://github.com/ziglang/zig-bootstrap#host-system-dependencies
cd $HOME
mkdir ziglang
cd ziglang
@neeraj9
neeraj9 / ubuntu-deps-for-zig-compiler-build-from-source.sh
Created October 24, 2023 06:45
Install Ubuntu dependencies for Zig compiler build from source
# see https://github.com/ziglang/zig-bootstrap#host-system-dependencies
sudo apt install build-essential cmake ninja-build make python3
@neeraj9
neeraj9 / ubuntu-deps-for-carbon-compiler.sh
Created October 24, 2023 13:14
Ubuntu installation dependencies for Carbon programming compiler
# see https://github.com/carbon-language/carbon-lang#getting-started
sudo apt install build-essential bazel-bootstrap llvm
@neeraj9
neeraj9 / building-carbon-explorer-on-ubuntu.sh
Created October 24, 2023 13:22
building carbon explorer from source on ubuntu
# see https://github.com/carbon-language/carbon-lang#getting-started
mkdir carbon-language
cd carbon-language
git clone https://github.com/carbon-language/carbon-lang
bazel run //explorer -- ./explorer/testdata/print/format_only.carbon
@neeraj9
neeraj9 / list-directory-recursively.zig
Created October 25, 2023 04:02
List directory recursively in Zig programming language
const std = @import("std");
pub fn main() !void {
var buf: [std.fs.MAX_PATH_BYTES]u8 = undefined;
const cwd = std.os.getcwd(&buf) catch |err| {
std.debug.print("> [error] detecting current working directory, err={}\n", .{err});
return;
};
var gpa = std.heap.GeneralPurposeAllocator(.{}){};
@neeraj9
neeraj9 / simple-meson-build-for-cpp-project.build
Created October 25, 2023 04:37
A simple build script in Meson for main.cpp and an include folder
project('myapp', 'cpp',
default_options : ['cpp_std=c++20', 'warning_level=2'])
main_target_name = 'myapp'
sources = ['src/main.cpp', 'src/common.cpp']
hdrs = include_directories('include')
executable(main_target_name, sources,
include_directories : hdrs,
install : true)