From 3182212402b953d97cc98d3fbf6edf5a58f3491c Mon Sep 17 00:00:00 2001 From: Archivist Date: Mon, 30 Jul 2018 21:33:28 +0200 Subject: [PATCH] Initial commit --- .gitmodules | 3 +++ 9float | 1 + Makefile | 77 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 81 insertions(+) create mode 100644 .gitmodules create mode 160000 9float create mode 100644 Makefile diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..e67d1f7 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "9float"] + path = 9float + url = https://git.nekoit.xyz/Archivist/9float diff --git a/9float b/9float new file mode 160000 index 0000000..d084e91 --- /dev/null +++ b/9float @@ -0,0 +1 @@ +Subproject commit d084e918c7c510ab42607382f3de781f95fea78b diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..6f9dbf4 --- /dev/null +++ b/Makefile @@ -0,0 +1,77 @@ +# +# ************************************************************** +# * Simple C++ Makefile Template * +# * * +# * Author: Arash Partow (2003) * +# * URL: http://www.partow.net/programming/makefile/index.html * +# * * +# * Copyright notice: * +# * Free use of this C++ Makefile template is permitted under * +# * the guidelines and in accordance with the the MIT License * +# * http://www.opensource.org/licenses/MIT * +# * * +# ************************************************************** +# +# +# Modifications of the original file are licenced under MIT Licence +# +#(c) Ludovic 'Archivist' Lagouardette 2018 +# + + +CXX := -g++-7 +CXXFLAGS := -pedantic-errors -Wall -Wextra -Werror -O0 -std=c++14 -fPIC -DUSE_CATCH +# -DCOMPAT_TLS +# ^ Enable this flag if your compiler ABI have issues with thread local storage +LDFLAGS := -L/usr/lib -lstdc++ -lm -lpthread +BUILD := build +OBJ_DIR := $(BUILD)/objects +APP_DIR := $(BUILD)/apps +TARGET := tests.cpp +INCLUDE := -Iinclude/ +SRC := \ + +OBJECTS := $(SRC:%.cpp=$(OBJ_DIR)/%.o) +TEST_OBJECTS := $(SRC:%.cpp=$(OBJ_DIR)/%.test.o) +TARGETNAME := $(TARGET:%.cpp=%) + +all: build $(TARGET) + +$(OBJ_DIR)/%.test.o: %.cpp + @mkdir -p $(@D) + $(CXX) $(CXXFLAGS) $(INCLUDE) -o $@ -c $< + +$(OBJ_DIR)/%.o: %.cpp + @mkdir -p $(@D) + $(CXX) $(CXXFLAGS) $(INCLUDE) -o $@ -c $< + +$(TARGET): $(TEST_OBJECTS) build + @mkdir -p $(@D) + $(CXX) -DUSE_CATCH $(CXXFLAGS) $(INCLUDE) $(LDFLAGS) -o $(APP_DIR)/$(TARGETNAME) src/$(TARGET) $(TEST_OBJECTS) + +lib: $(OBJECTS) build + $(CXX) $(CXXFLAGS) $(INCLUDE) $(LDFLAGS) --shared -o $(APP_DIR)/libscatter.so $(OBJECTS) + ar rvs $(APP_DIR)/libscatter.a $(OBJECTS) + +install: lib + cp $(APP_DIR)/libscatter.so /usr/local/lib + cp $(APP_DIR)/libscatter.a /usr/local/lib + mkdir -p /usr/local/include/scatter + cp include/scatter/* /usr/local/include/scatter -r + +.PHONY: all build clean + +ASTYLE_FLAGS= --style=stroustrup --align-reference=type --align-pointer=type --break-blocks \ + --indent-namespaces --indent=tab --add-brackets +format: + astyle $(ASTYLE_FLAGS) include/scatter/* + astyle $(ASTYLE_FLAGS) src/scatter/* + +build: + @mkdir -p $(APP_DIR) + @mkdir -p $(OBJ_DIR) + +clean: + rm -rf build/* + rm -rf src/scatter/*.orig + rm -rf include/scatter/*.orig