Skip to content

Instantly share code, notes, and snippets.

@mortie
Last active February 20, 2025 13:16
Show Gist options
  • Save mortie/2eeec1f6e75b79a3d6ebe7700f1c769d to your computer and use it in GitHub Desktop.
Save mortie/2eeec1f6e75b79a3d6ebe7700f1c769d to your computer and use it in GitHub Desktop.
Meson C++
OUT ?= build
PROGRAM = example
.PHONY: build
build: $(OUT)/build.ninja
ninja -C $(OUT) $(PROGRAM)
.PHONY: setup
setup: $(OUT)/build.ninja
$(OUT)/build.ninja:
meson setup $(OUT)
.PHONY: run
run: build
cd $(OUT) && $(CMD) ./$(PROGRAM)
.PHONY: clean
clean:
ninja -C $(OUT) clean
.PHONY: cleanall
cleanall:
rm -rf $(OUT)
project(
'example', 'cpp',
default_options: ['cpp_std=c++20'],
)
executable(
'example',
'src/main.cc',
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment