diff --git a/Makefile b/Makefile index a80241ea..51559601 100644 --- a/Makefile +++ b/Makefile @@ -2,17 +2,49 @@ MAIN := tuo.exe SRCS := $(wildcard *.cpp) OBJS := $(patsubst %.cpp,obj/%.o,$(SRCS)) INCS := $(wildcard *.h) +PREFIX ?= /usr/local CPPFLAGS := -Wall -Werror -std=gnu++11 -O3 -DNDEBUG LDFLAGS := -lboost_system -lboost_thread -lboost_filesystem -lboost_regex +ifdef SYSTEMROOT + RM = del /Q + FixPath = $(subst /,\,$1) + MKDIR = mkdir +else + ifeq ($(shell uname), Linux) + RM = rm -f + FixPath = $1 + MKDIR = mkdir -p + endif +endif + all: $(MAIN) -obj/%.o: %.cpp $(INCS) +prep: + $(MKDIR) obj + +obj/%.o: %.cpp $(INCS) prep $(CXX) $(CPPFLAGS) -o $@ -c $< $(MAIN): $(OBJS) $(CXX) -o $@ $(OBJS) $(LDFLAGS) clean: - del /q $(MAIN).exe obj\*.o + $(RM) $(call FixPath,obj/*.o) + +.PHONY: install +install: + $(MKDIR) $(DESTDIR)$(PREFIX)/bin + cp tuo.exe $(DESTDIR)$(PREFIX)/bin/ + cp update_xml.sh $(DESTDIR)$(PREFIX)/bin/ + +.PHONY: uninstall +uninstall: + $(RM) $(DESTDIR)$(PREFIX)/bin/tuo.exe + $(RM) $(DESTDIR)$(PREFIX)/bin/update_xml.sh + +# build a snap for cross distribution availability +# cleanbuild uses snapcracft and lxd +snap: + snapcraft cleanbuild diff --git a/README.snap.md b/README.snap.md new file mode 100644 index 00000000..7898eeb5 --- /dev/null +++ b/README.snap.md @@ -0,0 +1,27 @@ +# tyrant-unleashed-optimizer snap usage + +This is about using the snap'ed version of tyrant-unleashed-optimizer (tuo) + +Working features: + - updating local card database + - simulating fights + +Exposed commands: + - tyrant-unleashed-optimizer.updatexml + - tyrant-unleashed-optimizer.sim + +Known issues: + - To get to your card data files the home plug needs to be connected manually + after snap install. This is due to file access being a potential risk (and + snaps are a lot about security and isolation). To connect the home plug + call: + "sudo snap connect tyrant-unleashed-optimizer:home ubuntu-core:home" + +Card-Update: + - Note: As usual if you don't have a "data" dir yet you have to create one via ``mkdir data`` + - Then to actually call it: + ``tyrant-unleashed-optimizer.updatexml`` + +Simulate: + - Note: as usual with tuo you have to run this where you have your ``data`` dir. + - tyrant-unleashed-optimizer.sim "Lord Silus, Extreme Barrager #2" "Lord Silus, Atomic Wardriver #2" sim 100 diff --git a/snapcraft.yaml b/snapcraft.yaml new file mode 100644 index 00000000..5079fde5 --- /dev/null +++ b/snapcraft.yaml @@ -0,0 +1,33 @@ +name: tyrant-unleashed-optimizer +version: daily +summary: Tyrant Unleashed Optimizer +description: | + Simulator app for the game Tarant Unleashed that can be used to optimize your + card deck for certain raids, or temporary buffs as well as growth planning in + general. +confinement: strict + +apps: + sim: + command: usr/local/bin/tuo.exe + plugs: [home] + updatexml: + command: usr/local/bin/update_xml.sh + plugs: [home, network] + +parts: + tyrant-unleashed-optimizer: + # as we are part of the tuo git tree then just build locally + source: . + plugin: make + build-packages: + - g++ + - make + - build-essential + - libboost1.58-dev + - libboost-system1.58-dev + - libboost-thread1.58-dev + - libboost-filesystem1.58-dev + - libboost-regex1.58-dev + stage-packages: + - curl