Skip to content

Commit

Permalink
set up basic example project and structure with Makefile
Browse files Browse the repository at this point in the history
  • Loading branch information
mbluemer committed Apr 13, 2017
1 parent 3bce999 commit 3bb50ee
Show file tree
Hide file tree
Showing 6 changed files with 70 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.vimrc
*.swp
bin/*
build
24 changes: 24 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# makefile modeled off of: http://hiltmon.com/blog/2013/07/03/a-simple-c-plus-plus-project-structure/


CC := g++ -std=c++14
SRCDIR := src
BUILDDIR := build
TARGET := build/runner

SRCEXT := cpp
SOURCES := $(shell find $(SRCDIR) -type f -name *.$(SRCEXT)) # grabs all src files
OBJECTS := $(patsubst $(SRCDIR)/%,$(BUILDDIR)/%,$(SOURCES:.$(SRCEXT)=.o))
INC := -I include

$(TARGET): $(OBJECTS)
@echo " Linking..."
@echo " $(CC) $^ -o $(TARGET)"; $(CC) $^ -o $(TARGET)

$(BUILDDIR)/%.o: $(SRCDIR)/%.$(SRCEXT)
@mkdir -p $(BUILDDIR)
@echo " $(CC) $(INC) -c -o $@ $<"; $(CC) $(INC) -c -o $@ $<

clean:
@echo " Cleaning...";
@echo " $(RM) -r $(BULIDDIR) $(TARGET)"; $(RM) -r $(BULIDDIR) $(TARGET)
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
# Checkers AI Project

This is the repo for a checkers AI project.

## Project Structure

* `src/`
- contains .cpp source files
* `include/`
- contains all .h header files
* `bin/`
- all object files are dumped in here (clean commands cleans this directory up)
* `build/runner`
- When project is built it's compiled to the `runner` file
18 changes: 18 additions & 0 deletions include/Move.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#ifndef MOVE_H
#define MOVE_H

#include <vector>

class Move
{
private:

std::vector<int> moves;

public:

Move() : moves() {};
void printMessage();
};

#endif
7 changes: 7 additions & 0 deletions src/Move.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#include <iostream>
#include "Move.h"

void Move::printMessage()
{
std::cout << "Here is an example message" << std::endl;
}
6 changes: 6 additions & 0 deletions src/main.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#include <iostream>

int main(int argc, const char * argv[]) {
std::cout << "Hello world!" << std::endl;
return 0;
}

0 comments on commit 3bb50ee

Please sign in to comment.