commit 1c7bb3912167ef9dad0a7bdfd9e5d87c66b547cd Author: Sebastien Bourdeauducq Date: Tue Aug 22 23:24:17 2023 +0800 imgui compilation diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..6812c5b --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +*.o +microsa diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..3e1981e --- /dev/null +++ b/Makefile @@ -0,0 +1,35 @@ +EXE = microsa +SOURCES = main.cpp +SOURCES += $(IMGUI_DIR)/imgui.cpp $(IMGUI_DIR)/imgui_demo.cpp $(IMGUI_DIR)/imgui_draw.cpp $(IMGUI_DIR)/imgui_tables.cpp $(IMGUI_DIR)/imgui_widgets.cpp +SOURCES += $(IMGUI_DIR)/backends/imgui_impl_glfw.cpp $(IMGUI_DIR)/backends/imgui_impl_opengl3.cpp +OBJS = $(addsuffix .o, $(basename $(notdir $(SOURCES)))) + +CXXFLAGS = -std=c++11 -I$(IMGUI_DIR) -I$(IMGUI_DIR)/backends +CXXFLAGS += -g -Wall -Wformat -O2 +LIBS = + +LIBS += -lGL `pkg-config --static --libs glfw3` + +CXXFLAGS += `pkg-config --cflags glfw3` +CFLAGS = $(CXXFLAGS) + +##--------------------------------------------------------------------- +## BUILD RULES +##--------------------------------------------------------------------- + +%.o:%.cpp + $(CXX) $(CXXFLAGS) -c -o $@ $< + +%.o:$(IMGUI_DIR)/%.cpp + $(CXX) $(CXXFLAGS) -c -o $@ $< + +%.o:$(IMGUI_DIR)/backends/%.cpp + $(CXX) $(CXXFLAGS) -c -o $@ $< + +all: $(EXE) + +$(EXE): $(OBJS) + $(CXX) -o $@ $^ $(CXXFLAGS) $(LIBS) + +clean: + rm -f $(EXE) $(OBJS) diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..9705763 --- /dev/null +++ b/flake.lock @@ -0,0 +1,27 @@ +{ + "nodes": { + "nixpkgs": { + "locked": { + "lastModified": 1692525914, + "narHash": "sha256-MUgZ9/9mE/EbEQA6JPdcQHkjoR5fgvaKhpy6UO67uEc=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "475d5ae2c4cb87b904545bdb547af05681198fcc", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-23.05", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..a35ee4a --- /dev/null +++ b/flake.nix @@ -0,0 +1,25 @@ +{ + description = "Micro Optical Spectrum Analyzer"; + + inputs.nixpkgs.url = github:NixOS/nixpkgs/nixos-23.05; + + outputs = { self, nixpkgs }: + let + pkgs = import nixpkgs { system = "x86_64-linux"; }; + in { + devShell.x86_64-linux = pkgs.mkShell { + name = "microsa-dev-shell"; + buildInputs = [ + pkgs.gnumake + pkgs.gcc + pkgs.pkg-config + pkgs.wayland + pkgs.glfw-wayland + pkgs.libffi + ]; + shellHook = '' + export IMGUI_DIR=${pkgs.imgui}/include/imgui + ''; + }; + }; +} diff --git a/main.cpp b/main.cpp new file mode 100644 index 0000000..fcfbd6f --- /dev/null +++ b/main.cpp @@ -0,0 +1,6 @@ +#include + +int main(int, char**) { + printf("hello\n"); + return 0; +}