Skip to content

Commit

Permalink
Initial structure
Browse files Browse the repository at this point in the history
  • Loading branch information
drhelius committed Jun 19, 2024
1 parent 5f451a5 commit e9ca965
Show file tree
Hide file tree
Showing 46 changed files with 68,347 additions and 109 deletions.
16 changes: 8 additions & 8 deletions .github/workflows/geargrafx.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ jobs:
- name: Prepare artifact directory
run: |
mkdir -p artifact
cp platforms/README.txt artifact
cp platforms/gamecontrollerdb.txt artifact
cp platforms/shared/README.txt artifact
cp platforms/shared/gamecontrollerdb.txt artifact
cp platforms/linux/${{ env.NAME_LOWER }} artifact
- name: Archive binary
uses: actions/upload-artifact@v4
Expand Down Expand Up @@ -101,8 +101,8 @@ jobs:
# - name: Prepare artifact directory
# run: |
# mkdir -p artifact
# cp platforms/README.txt artifact
# cp platforms/gamecontrollerdb.txt artifact
# cp platforms/shared/README.txt artifact
# cp platforms/shared/gamecontrollerdb.txt artifact
# cp -R platforms/macos/${{ env.NAME_UPPER }}.app artifact
# - name: Archive binary
# uses: actions/upload-artifact@v4
Expand Down Expand Up @@ -135,8 +135,8 @@ jobs:
# - name: Prepare artifact directory
# run: |
# mkdir -p artifact
# cp platforms/README.txt artifact
# cp platforms/gamecontrollerdb.txt artifact
# cp platforms/shared/README.txt artifact
# cp platforms/shared/gamecontrollerdb.txt artifact
# cp platforms/windows/dependencies/glew-2.2.0/bin/Release/${{ matrix.architecture }}/glew32.dll artifact
# cp platforms/windows/dependencies/SDL2-2.28.5/lib/${{ matrix.architecture }}/SDL2.dll artifact
# cp platforms/windows/release/${{ env.NAME_UPPER }}.exe artifact
Expand Down Expand Up @@ -171,8 +171,8 @@ jobs:
# - name: Prepare artifact directory
# run: |
# mkdir -p artifact
# cp platforms/README.txt artifact
# cp platforms/gamecontrollerdb.txt artifact
# cp platforms/shared/README.txt artifact
# cp platforms/shared/gamecontrollerdb.txt artifact
# cp platforms/bsd/${{ env.NAME_LOWER }} artifact
# - name: Archive binary
# uses: actions/upload-artifact@v4
Expand Down
3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
{
"files.exclude": {
"**/*.o": true,
"**/*.so": true
"**/*.so": true,
"**/geargrafx": true
},
"cmake.configureOnOpen": false,
"files.associations": {
Expand Down
8 changes: 7 additions & 1 deletion platforms/linux/Makefile
Original file line number Diff line number Diff line change
@@ -1 +1,7 @@
include ../shared/desktop/Makefile.shared
include ../shared/desktop/Makefile.sources

#SOURCES_CXX += $(DESKTOP_SRC_DIR)/nfd/nfd_gtk.cpp
CPPFLAGS += `pkg-config --cflags gtk+-3.0`
LDFLAGS += `pkg-config --libs gtk+-3.0`

include ../shared/desktop/Makefile.common
17 changes: 17 additions & 0 deletions platforms/shared/README.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
.:: Geargrafx ::.
-----------------------------------------------------
Instructions and tips at:
https://github.com/drhelius/Geargrafx
-----------------------------------------------------
Geargrafx is in development.
Please, consider sponsoring (https://github.com/sponsors/drhelius) and following me on Twitter (http://twitter.com/drhelius) for updates.
-----------------------------------------------------
Features:

-----------------------------------------------------
Geargrafx is licensed under the GNU General Public License v3.0 License:

Copyright (C) 2024 Ignacio Sanchez
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/
89 changes: 89 additions & 0 deletions platforms/shared/desktop/Makefile.common
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
define HEADER
____ __
/ ___| ___ __ _ _ __ __ _ _ __ __ _ / _|_ __
| | _ / _ \\/ _` | '__/ _` | '__/ _` | |_\\ \\/ /
| |_| | __/ (_| | | | (_| | | | (_| | _|> <
\____|\\___|\\__,_|_| \\__, |_| \__,_|_| /_/\\_\\
|___/

endef
export HEADER

CXX = g++
CC = gcc
#CXX = clang++
#CC = clang

TARGET_NAME = geargrafx
GIT_VERSION := "$(shell git describe --abbrev=7 --dirty --always --tags)"
UNAME_S := $(shell uname -s)
PLATFORM = "undefined"

OBJECTS += $(SOURCES_C:.c=.o) $(SOURCES_CXX:.cpp=.o)

CPPFLAGS += -I../ -I../../
CPPFLAGS += -Wall -Wextra -Wformat -DEMULATOR_BUILD=\"$(GIT_VERSION)\"
CXXFLAGS += -std=c++11
CFLAGS += -std=c99

DEBUG ?= 0
ifeq ($(DEBUG), 1)
CPPFLAGS +=-DDEBUG -g3
else
CPPFLAGS +=-DNDEBUG -O3 -flto
LDFLAGS += -flto
endif

SANITIZE ?= 0
ifeq ($(SANITIZE), 1)
CPPFLAGS +=-fsanitize=address
LDFLAGS += -lasan
endif

ifeq ($(UNAME_S), Linux) #LINUX
PLATFORM = "Linux"
LDFLAGS += -lGL -lGLEW -ldl `sdl2-config --libs`
CPPFLAGS += `sdl2-config --cflags`
TARGET := $(TARGET_NAME)
else ifeq ($(UNAME_S), Darwin) #APPLE
PLATFORM = "macOS"
LDFLAGS += -framework OpenGL -framework Cocoa -framework IOKit -framework CoreVideo `sdl2-config --libs`
LDFLAGS += -L/usr/local/lib
CPPFLAGS += `sdl2-config --cflags`
CPPFLAGS += -I/usr/local/include -I/opt/local/include
TARGET := $(TARGET_NAME)
else ifeq ($(findstring MINGW,$(UNAME_S)),MINGW)
PLATFORM = "MinGW"
LDFLAGS += -lgdi32 -lopengl32 -lglew32 -limm32 `pkg-config --static --libs sdl2`
CPPFLAGS += `pkg-config --cflags sdl2`
TARGET := $(TARGET_NAME).exe
else
PLATFORM = "Generic Unix-like/BSD"
LDFLAGS += `sdl2-config --libs` -lSDL2
LDFLAGS += `pkg-config --libs glew` -lGLEW
CXXFLAGS += -std=gnu++11
CPPFLAGS += `sdl2-config --cflags`
CPPFLAGS += `pkg-config --cflags glew`
TARGET := $(TARGET_NAME)
endif

all: header $(TARGET)
@echo Build complete for $(PLATFORM)

$(TARGET): $(OBJECTS)
$(CXX) -o $@ $(OBJECTS) $(LDFLAGS)

%.o: %.mm
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -c -o $@ $<

%.o: %.cpp
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -c -o $@ $<

%.o: %.c
$(CC) $(CPPFLAGS) $(CFLAGS) -c -o $@ $<

clean:
rm -f $(OBJECTS) $(TARGET)

header:
@echo "$$HEADER"
88 changes: 0 additions & 88 deletions platforms/shared/desktop/Makefile.shared

This file was deleted.

20 changes: 20 additions & 0 deletions platforms/shared/desktop/Makefile.sources
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
SRC_DIR = ../../src
DESKTOP_SRC_DIR=../shared/desktop
AUDIO_SRC_DIR=../shared/audio

SOURCES_C :=

SOURCES_CXX := \
$(DESKTOP_SRC_DIR)/main.cpp \
$(DESKTOP_SRC_DIR)/application.cpp \
$(DESKTOP_SRC_DIR)/imgui/imgui_impl_sdl2.cpp \
$(DESKTOP_SRC_DIR)/imgui/imgui_impl_opengl2.cpp \
$(DESKTOP_SRC_DIR)/imgui/imgui.cpp \
$(DESKTOP_SRC_DIR)/imgui/imgui_draw.cpp \
$(DESKTOP_SRC_DIR)/imgui/imgui_widgets.cpp \
$(DESKTOP_SRC_DIR)/imgui/imgui_tables.cpp \
$(DESKTOP_SRC_DIR)/imgui/imgui_demo.cpp \
$(DESKTOP_SRC_DIR)/imgui/memory_editor.cpp \
$(SRC_DIR)/geargrafx_core.cpp \


Loading

0 comments on commit e9ca965

Please sign in to comment.