Skip to content

Commit 602189b

Browse files
committed
added: sources
1 parent 23f5040 commit 602189b

113 files changed

Lines changed: 204605 additions & 2 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/linux_rel.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: Linux OS(Ubuntu) compilation-
2+
3+
on:
4+
push:
5+
branches: [ "main" ]
6+
pull_request:
7+
branches: [ "main" ]
8+
9+
jobs:
10+
linux_release:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v4
14+
with:
15+
submodules: 'recursive'
16+
- name: make
17+
run: |
18+
sudo apt install lib{opengl-dev,gl1-mesa-dev,glfw3,glfw3-dev}
19+
make

.github/workflows/win_rel.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: Windows OS compilation-
2+
3+
on:
4+
push:
5+
branches: [ "main" ]
6+
pull_request:
7+
branches: [ "main" ]
8+
9+
jobs:
10+
win_release:
11+
runs-on: windows-latest
12+
steps:
13+
- uses: actions/checkout@v4
14+
with:
15+
submodules: 'recursive'
16+
- name: make
17+
run: |
18+
pacman -S mingw-w64-x86_64-{gcc,glfw} make
19+
make

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
.build/
2+
GPATH
3+
GRTAGS
4+
GTAGS
15
save/
26
temp.*
37
*.d

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
all:
2-
$(MAKE) -C demo/c
2+
#$(MAKE) -C demo/c
33
$(MAKE) -C demo/cpp
44

55
clean:
6-
@-$(MAKE) -C demo/c $@
6+
#@-$(MAKE) -C demo/c $@
77
@-$(MAKE) -C demo/cpp $@

demo/cpp/.clang-format

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
# Generated from CLion C/C++ Code Style settings
2+
BasedOnStyle: LLVM
3+
AccessModifierOffset: -4
4+
AlignAfterOpenBracket: Align
5+
AlignConsecutiveAssignments: false
6+
AlignOperands: true
7+
AllowAllArgumentsOnNextLine: false
8+
AllowAllConstructorInitializersOnNextLine: false
9+
AllowAllParametersOfDeclarationOnNextLine: false
10+
AllowShortBlocksOnASingleLine: Always
11+
AllowShortCaseLabelsOnASingleLine: false
12+
AllowShortFunctionsOnASingleLine: All
13+
AllowShortIfStatementsOnASingleLine: Always
14+
AllowShortLambdasOnASingleLine: All
15+
AllowShortLoopsOnASingleLine: true
16+
AlwaysBreakAfterReturnType: None
17+
AlwaysBreakTemplateDeclarations: Yes
18+
BreakBeforeBraces: Custom
19+
BraceWrapping:
20+
AfterCaseLabel: false
21+
AfterClass: false
22+
AfterControlStatement: Never
23+
AfterEnum: false
24+
AfterFunction: false
25+
AfterNamespace: false
26+
AfterUnion: false
27+
BeforeCatch: false
28+
BeforeElse: false
29+
IndentBraces: false
30+
SplitEmptyFunction: false
31+
SplitEmptyRecord: true
32+
BreakBeforeBinaryOperators: None
33+
BreakBeforeTernaryOperators: true
34+
BreakConstructorInitializers: BeforeColon
35+
BreakInheritanceList: BeforeColon
36+
ColumnLimit: 0
37+
CompactNamespaces: false
38+
ContinuationIndentWidth: 8
39+
IndentCaseLabels: true
40+
IndentPPDirectives: None
41+
IndentWidth: 4
42+
KeepEmptyLinesAtTheStartOfBlocks: true
43+
MaxEmptyLinesToKeep: 2
44+
NamespaceIndentation: All
45+
ObjCSpaceAfterProperty: false
46+
ObjCSpaceBeforeProtocolList: true
47+
PointerAlignment: Right
48+
ReflowComments: false
49+
SpaceAfterCStyleCast: true
50+
SpaceAfterLogicalNot: false
51+
SpaceAfterTemplateKeyword: false
52+
SpaceBeforeAssignmentOperators: true
53+
SpaceBeforeCpp11BracedList: false
54+
SpaceBeforeCtorInitializerColon: true
55+
SpaceBeforeInheritanceColon: true
56+
SpaceBeforeParens: ControlStatements
57+
SpaceBeforeRangeBasedForLoopColon: true
58+
SpaceInEmptyParentheses: false
59+
SpacesBeforeTrailingComments: 0
60+
SpacesInAngles: false
61+
SpacesInCStyleCastParentheses: false
62+
SpacesInContainerLiterals: false
63+
SpacesInParentheses: false
64+
SpacesInSquareBrackets: false
65+
TabWidth: 4
66+
UseTab: Never
67+
BinPackArguments: false
68+
BinPackParameters: false

demo/cpp/Makefile

Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
#
2+
# Cross Platform Makefile
3+
# Compatible with MSYS2/MINGW, Ubuntu 14.04.1 and Mac OS X
4+
#
5+
# You will need GLFW (http://www.glfw.org):
6+
# Linux:
7+
# apt-get install libglfw-dev
8+
# Mac OS X:
9+
# brew install glfw
10+
# MSYS2:
11+
# pacman -S --noconfirm --needed mingw-w64-x86_64-toolchain mingw-w64-x86_64-glfw
12+
#
13+
14+
#CXX = g++
15+
#CXX = clang++
16+
17+
EXE = example_glfw_opengl3
18+
19+
LIBS_DIR = ../../libs
20+
CIMGUI_DIR = $(LIBS_DIR)/cimgui
21+
IMGUI_DIR = $(CIMGUI_DIR)/imgui
22+
IM_MARKDOWN_DIR = $(LIBS_DIR)/imgui_markdown
23+
UTILS_DIR = ../utils
24+
BUILD_DIR = .build
25+
STB_DIR = $(LIBS_DIR)/stb
26+
27+
VPATH = $(IM_MARKDOWN_DIR) : $(IMGUI_DIR) : $(IMGUI_DIR)/backends : $(UTILS_DIR)
28+
29+
SOURCES += main.cpp
30+
CSOURCES += $(UTILS_DIR)/loadImage.c $(UTILS_DIR)/utils.c
31+
SOURCES += $(wildcard $(IMGUI_DIR)/*.cpp) $(wildcard $(UTILS_DIR)/*.cpp)
32+
SOURCES += $(IMGUI_DIR)/backends/imgui_impl_glfw.cpp \
33+
$(IMGUI_DIR)/backends/imgui_impl_opengl3.cpp
34+
SOURCES += $(wildcard $(IM_MARKDOWN_DIR)/*.cpp)
35+
36+
OBJS = $(addprefix $(BUILD_DIR)/,$(notdir $(SOURCES:.cpp=.o))) $(addprefix $(BUILD_DIR)/,$(notdir $(CSOURCES:.c=.o)))
37+
UNAME_S := $(shell uname -s)
38+
LINUX_GL_LIBS = -lGL
39+
40+
CXXFLAGS += -MMD -MP
41+
CXXFLAGS += -O1 -Wl,-s -mwindows
42+
CXXFLAGS += -I$(IMGUI_DIR) -I$(IMGUI_DIR)/backends -I$(UTILS_DIR) -I$(UTILS_DIR)/fonticon -I$(STB_DIR)
43+
CXXFLAGS += -g -Wall -Wformat -static
44+
CXXFLAGS += -I$(IM_MARKDOWN_DIR)
45+
LIBS =
46+
47+
##---------------------------------------------------------------------
48+
## OPENGL ES
49+
##---------------------------------------------------------------------
50+
51+
## This assumes a GL ES library available in the system, e.g. libGLESv2.so
52+
# CXXFLAGS += -DIMGUI_IMPL_OPENGL_ES2
53+
# LINUX_GL_LIBS = -lGLESv2
54+
55+
##---------------------------------------------------------------------
56+
## BUILD FLAGS PER PLATFORM
57+
##---------------------------------------------------------------------
58+
59+
ifeq ($(UNAME_S), Linux) #LINUX
60+
ECHO_MESSAGE = "Linux"
61+
LIBS += $(LINUX_GL_LIBS) `pkg-config --static --libs glfw3`
62+
63+
CXXFLAGS += `pkg-config --cflags glfw3`
64+
CFLAGS = $(CXXFLAGS)
65+
endif
66+
67+
ifeq ($(UNAME_S), Darwin) #APPLE
68+
ECHO_MESSAGE = "Mac OS X"
69+
LIBS += -framework OpenGL -framework Cocoa -framework IOKit -framework CoreVideo
70+
LIBS += -L/usr/local/lib -L/opt/local/lib -L/opt/homebrew/lib
71+
#LIBS += -lglfw3
72+
LIBS += -lglfw
73+
74+
CXXFLAGS += -I/usr/local/include -I/opt/local/include -I/opt/homebrew/include
75+
CFLAGS = $(CXXFLAGS)
76+
endif
77+
78+
ifeq ($(OS), Windows_NT)
79+
ECHO_MESSAGE = "MinGW"
80+
LIBS += -lglfw3 -lgdi32 -lopengl32 -limm32
81+
82+
CXXFLAGS += $(shell pkg-config --cflags glfw3)
83+
CFLAGS = $(CXXFLAGS)
84+
endif
85+
86+
##---------------------------------------------------------------------
87+
## BUILD RULES
88+
##---------------------------------------------------------------------
89+
90+
all: $(BUILD_DIR) $(EXE)
91+
@echo Build complete for $(ECHO_MESSAGE)
92+
$(BUILD_DIR):
93+
@-mkdir -p $@
94+
95+
$(BUILD_DIR)/%.o:%.c Makefile
96+
@echo [$(CC)]: $(notdir $<)
97+
@$(CC) $(CFLAGS) -c -o $@ $<
98+
99+
$(BUILD_DIR)/%.o:%.cpp Makefile
100+
@echo [$(CXX)]: $(notdir $<)
101+
@$(CXX) $(CXXFLAGS) -std=c++14 -c -o $@ $<
102+
103+
$(EXE): $(OBJS)
104+
@$(CXX) -o $@ $^ $(CXXFLAGS) $(LIBS)
105+
106+
clean:
107+
@rm -f $(EXE) $(OBJS)
108+
@rm -f *.o
109+
110+
run: all
111+
./$(EXE)
112+
113+
format:
114+
cp -f main.cpp main.cpp.org
115+
clang-format main.cpp.org > main.cpp
116+
117+
118+
include $(wildcard $(BUILD_DIR)/*.d)

demo/cpp/imgui.ini

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
[Window][Debug##Default]
2+
Pos=60,60
3+
Size=400,400
4+
5+
[Window][Dear ImGui Demo]
6+
Pos=744,260
7+
Size=550,617
8+
9+
[Window][Hello, world!]
10+
Pos=747,9
11+
Size=528,237
12+
13+
[Window][ImGui_Toggle demo]
14+
Pos=17,11
15+
Size=699,825
16+
17+
[Window][Dear ImGui Style Editor]
18+
Pos=829,117
19+
Size=353,714
20+
21+
[Window][ImGui_Markdown demo]
22+
Pos=12,7
23+
Size=549,787
24+

0 commit comments

Comments
 (0)