diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..f260804 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,15 @@ +cmake_minimum_required(VERSION 3.10) + +project( + snakeplusplus + LANGUAGES CXX) + +set(CMAKE_CXX_STANDARD 11 CACHE STRING "The C++ standard to use") +set(CMAKE_CXX_STANDARD_REQUIRED ON) +set(CMAKE_CXX_EXTENSIONS OFF) +set(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin) + +include_directories(${snakeplusplus_SOURCE_DIR}/src) + +add_subdirectory(src) + diff --git a/Makefile b/Makefile deleted file mode 100755 index bd9ffcf..0000000 --- a/Makefile +++ /dev/null @@ -1,22 +0,0 @@ -INC := -I include -STD := -std=c++11 -SFML := -lsfml-graphics -lsfml-window -lsfml-system - -all: compile link - -fresh: dirs compile link - -compile: - g++ $(INC) $(STD) -c -o build/main.o src/main.cpp - g++ $(INC) $(STD) -c -o build/playerinterface.o src/playerinterface.cpp - g++ $(INC) $(STD) -c -o build/gamestate.o src/gamestate.cpp - g++ $(INC) $(STD) -c -o build/snake.o src/snake.cpp - -dirs: - mkdir bin build - -link: - g++ build/*.o -o bin/SnakePlusPlus.out $(SFML) - -clean: - rm bin/*.out build/*.o diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt new file mode 100644 index 0000000..02db7fb --- /dev/null +++ b/src/CMakeLists.txt @@ -0,0 +1,13 @@ +find_package(SFML COMPONENTS graphics window system REQUIRED) + +add_executable(snakeplusplus + ./main.cpp + ./gamestate.cpp + ./snake.cpp + ./playerinterface.cpp +) + +target_include_directories(snakeplusplus PUBLIC ${CMAKE_CURRENT_LIST_DIR}) + +target_link_libraries(snakeplusplus sfml-graphics) + diff --git a/include/common.hpp b/src/common.hpp similarity index 100% rename from include/common.hpp rename to src/common.hpp diff --git a/include/gamestate.hpp b/src/gamestate.hpp similarity index 100% rename from include/gamestate.hpp rename to src/gamestate.hpp diff --git a/include/playerinterface.hpp b/src/playerinterface.hpp similarity index 100% rename from include/playerinterface.hpp rename to src/playerinterface.hpp diff --git a/include/snake.hpp b/src/snake.hpp similarity index 100% rename from include/snake.hpp rename to src/snake.hpp