Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Makefile, some fixes #1

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
BasedOnStyle: Google

...
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
*.o
build
sfml-app
215 changes: 0 additions & 215 deletions Boids.cpp

This file was deleted.

23 changes: 23 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
cmake_minimum_required(VERSION 2.8...3.13)
project(boids)

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17 -Wall")
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake_modules" ${CMAKE_MODULE_PATH})

find_package(SFML 2 REQUIRED system window graphics network audio)
find_package(TGUI 0.10 REQUIRED)

if(NOT SFML_FOUND)
message(FATAL_ERROR "Could not find SFML")
endif()

if(NOT TGUI_FOUND)
message(FATAL_ERROR "Could not find TGUI")
endif()
set(CMAKE_VERBOSE_MAKEFILE ON)
file(GLOB SRCS *.cpp )

add_executable(${PROJECT_NAME} ${SRCS})
target_link_libraries(${PROJECT_NAME} tgui sfml-system sfml-window sfml-graphics sfml-network sfml-audio)
file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/arrow.png
DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
24 changes: 12 additions & 12 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
all: sfml-app
./sfml-app
EXEC = sfml-app
CC = g++
CFLAGS = -std=c++17 -c -Wall
LDFLAGS = -std=c++17 -o $(EXEC) -ltgui -lsfml-graphics -lsfml-window -lsfml-audio -lsfml-system
SRCS = $(wildcard *.cpp)
OBJS = $(SRCS:.cpp=.o)

sfml-app: $(F2) Vector2.o Boids.o
g++ -std=c++17 $(F2) Vector2.o Boids.o -o sfml-app -ltgui -lsfml-graphics -lsfml-window -lsfml-audio -lsfml-system
all: $(EXEC)

Vector2.o : Vector2.cpp Vector2.h;
g++ -std=c++17 -c Vector2.cpp
$(EXEC): $(OBJS)
$(CC) $^ $(LDFLAGS)

Boids.o : Boids.cpp Boids.h
g++ -std=c++17 -c Boids.cpp

$(F2) : Vector2.h $(F1) Boids.h
g++ -std=c++17 -c $(F1)
%.o: %.cpp
$(CC) $(CFLAGS) $< -o $@

clean:
rm -rf *o sfml-app
$(RM) -rf *o $(EXEC)
Loading