diff --git a/CMakeLists.txt b/CMakeLists.txt index 395f342..1f30b7e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4,4 +4,6 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON) project(modern_cpp) cmake_minimum_required(VERSION 2.8) aux_source_directory(. SRC_LIST) +include_directories(./includes) +add_definitions(-Wall -Wpedantic -Werror -Wextra) add_executable(${PROJECT_NAME} ${SRC_LIST}) diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..3ae58dd --- /dev/null +++ b/Makefile @@ -0,0 +1,20 @@ +CXX= g++ +CXXFLAGS= -std=c++17 -Wall -Wpedantic -Wextra +SOURCES= *.cpp +OBJECTS= $(SOURCES:.cpp=.o) +INCLUDES= includes/*.hpp +include_dirs= -Iincludes +all_target= debug release + +.PHONY: all +all: $(all_target) + +debug: $(SOURCES) $(INCLUDES) + $(CXX) $< $(CXXFLAGS) -g -o $@ $(include_dir) + +release: $(SOURCES) $(INCLUDES) + $(CXX) $< $(CXXFLAGS) -O3 -o $@ $(include_dir) + +.PHONY: clean +clean: + rm $(all_target) diff --git a/Circle.hpp b/includes/Circle.hpp similarity index 100% rename from Circle.hpp rename to includes/Circle.hpp diff --git a/Rectangle.hpp b/includes/Rectangle.hpp similarity index 100% rename from Rectangle.hpp rename to includes/Rectangle.hpp diff --git a/Shape.hpp b/includes/Shape.hpp similarity index 86% rename from Shape.hpp rename to includes/Shape.hpp index d86bda6..c011e40 100644 --- a/Shape.hpp +++ b/includes/Shape.hpp @@ -3,7 +3,7 @@ class Shape { public: - virtual ~Shape() {} + virtual ~Shape() {}; virtual double getArea() const = 0; virtual double getPerimeter() const = 0; diff --git a/Square.hpp b/includes/Square.hpp similarity index 100% rename from Square.hpp rename to includes/Square.hpp