Skip to content

Commit

Permalink
Remove nfd and set up support for linux
Browse files Browse the repository at this point in the history
  • Loading branch information
DerekYang2 committed Aug 30, 2023
1 parent 610e590 commit 5c03acb
Show file tree
Hide file tree
Showing 20 changed files with 69 additions and 2,291 deletions.
69 changes: 54 additions & 15 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,14 +1,36 @@
#default:
# g++ ../main.cpp -o main.exe -O2 -Wall -Wno-missing-braces -Wno-narrowing -std=c++20 -I ../ -I ../include/ -L ../lib/ -I ../include/nfd_src -lnfd -lole32 -luuid -lraylib -lopengl32 -lgdi32 -lwinmm && ../build/main.exe

#debug:
# g++ -g3 ../main.cpp -o main.exe -O2 -Wall -Wno-missing-braces -Wno-narrowing -std=c++20 -I ../ -I ../include/ -L ../lib/ -lraylib -lopengl32 -lgdi32 -lwinmm

#final:
# g++ ../main.cpp -o main.exe -Ofast -Wall -Wno-missing-braces -Wno-narrowing -std=c++20 -I ../ -I ../include/ -L ../lib/ -I ../include/nfd_src -lnfd -lole32 -luuid -lraylib -lopengl32 -lgdi32 -lwinmm -static -static-libgcc -static-libstdc++ -Wl,--subsystem,windows && ../build/main.exe

# NFD just add -I ../include/nfd_src -lnfd -lole32 -luuid
# nfd_src contains the .h files and remember to add nfd.lib into lib folder, contains implementations for nfd.h files

# Get OS
PLATFORM_OS ?= WINDOWS
ifeq ($(PLATFORM),PLATFORM_DESKTOP)
# No uname.exe on MinGW!, but OS=Windows_NT on Windows!
# ifeq ($(UNAME),Msys) -> Windows
ifeq ($(OS),Windows_NT)
PLATFORM_OS = WINDOWS
else
UNAMEOS = $(shell uname)
ifeq ($(UNAMEOS),Linux)
PLATFORM_OS = LINUX
endif
ifeq ($(UNAMEOS),FreeBSD)
PLATFORM_OS = BSD
endif
ifeq ($(UNAMEOS),OpenBSD)
PLATFORM_OS = BSD
endif
ifeq ($(UNAMEOS),NetBSD)
PLATFORM_OS = BSD
endif
ifeq ($(UNAMEOS),DragonFly)
PLATFORM_OS = BSD
endif
ifeq ($(UNAMEOS),Darwin)
PLATFORM_OS = OSX
endif
endif
endif

SRCEXTS := cpp c
HDREXTS := hpp h

Expand All @@ -17,30 +39,47 @@ REMOVE := - rm
CC := g++
BIN := ./build
OBJ := ./build/obj
INCLUDE := ./src ./include ./include/nfd_src ./src/ui ./export/assets
INCLUDE := ./src ./include ./src/ui ./export/assets
SRC := ./src
SRCS := $(wildcard $(SRC)/*.cpp) $(wildcard $(SRC)/ui/*.cpp)
OBJS := $(patsubst $(SRC)/%.cpp,$(OBJ)/%.o,$(SRCS))

ifeq ($(PLATFORM_OS),WINDOWS)
EXE := main.exe
else
EXE := main
endif

WARNINGS := -Wno-missing-braces -Wno-narrowing -Wno-sign-compare -Wno-char-subscripts
CFLAGS := -O2 -Wall -std=c++20 $(WARNINGS)
LDFLAGS := -std=c++20 -L ./lib
LDLIBS := -licon -lnfd -lole32 -luuid -lraylib -lopengl32 -lgdi32 -lwinmm

ifeq ($(PLATFORM_OS),WINDOWS)
LDLIBS := -licon -lraylib -lopengl32 -lgdi32 -lwinmm
endif
ifeq ($(PLATFORM_OS),LINUX)
LDLIBS := -lraylib -lGL -lc -lm -lpthread -ldl -lrt -lX11
endif

IFLAGS := $(foreach dir,$(INCLUDE),-I $(dir)/)

.PHONY: all run clean debug default info export
.PHONY: all run clean debug release default info export


all: $(EXE)

default: all run

debug: CFLAGS+=-g3

debug: clean

debug: all

release: LDLIBS+=-static -static-libgcc -static-libstdc++
ifeq ($(PLATFORM_OS),WINDOWS) # how to remove console for linux?
release: LDLIBS+=-Wl,--subsystem,windows
endif
release: all run

# quick TODO: add export linux support
export:
g++ ./export/exporter.cpp -o ./export/exporter.exe -O2 -Wall -Wno-sign-compare -std=c++20 -I ./include -I ./export/assets -L ./lib -lraylib -lopengl32 -lgdi32 -lwinmm && ./export/exporter.exe

Expand Down
Binary file removed build/obj/nfd_wrapper.o
Binary file not shown.
4 changes: 2 additions & 2 deletions data/user_data.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
}
],
"punctuation": 1,
"test time": 30,
"test time": 5,
"numbers": 0,
"dictionary": "english doubleletter",
"dictionary": "english",
"custom time": 12
}
21 changes: 0 additions & 21 deletions include/nfd_src/common.h

This file was deleted.

74 changes: 0 additions & 74 deletions include/nfd_src/nfd.h

This file was deleted.

Loading

0 comments on commit 5c03acb

Please sign in to comment.