commit fb740a780f783cf24c5330efde47a58c339c7304 Author: Rick van Vonderen <0945444@hr.nl> Date: Tue Dec 10 16:43:37 2019 +0100 Initial commit diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..4b4b5fd --- /dev/null +++ b/.gitignore @@ -0,0 +1,5 @@ +# Directories + +build/ + +# Files diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..0da8b97 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,6 @@ +[submodule "engine/vendor/glfw"] + path = engine/vendor/glfw + url = https://github.com/glfw/glfw +[submodule "engine/vendor/glm"] + path = engine/vendor/glm + url = https://github.com/g-truc/glm diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..1c19bf8 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,71 @@ +# User config between these lines +# ------------------------------------------ + +# Set engine name +set(ENGINE "engine") +# Set project name +set(GAME "game") + +# ------------------------------------------ + +cmake_minimum_required(VERSION 3.1) + +# Check if the build should include debugging symbols +option(DEBUG "" ON) +if(DEBUG) + # cmake -DDEBUG=on .. && make + message("--- Debug ---") + set(CMAKE_BUILD_TYPE "Debug") + + # -Og = Optimizations that do not interfere with debugging + # -Wall = All warnings about contructions that are easily avoidable + # -Wextra = Extra warning flags not covered by -Wall + # -pg = Generate profile information for analysis with gprof + set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Og -Wall -Wextra -pg") + # gprof gmon.out > profile-data.txt +else() + # cmake -DDEBUG=off .. && make + message("--- Release ---") + set(CMAKE_BUILD_TYPE "Release") + + # -O3 = Optimizations that increase compilation time and performance + set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O3") +endif() + +# Include all headers +include_directories( + "${ENGINE}/vendor/glad/include" + "${ENGINE}/vendor/glfw/include" + "${ENGINE}/vendor/glm" + "${ENGINE}/" +) + +# Add source files +file(GLOB_RECURSE GLAD "${ENGINE}/vendor/glad/*.c") +file(GLOB_RECURSE ENGINE_SOURCES "${ENGINE}/src/*.cpp") +file(GLOB_RECURSE GAME_SOURCES "${GAME}/src/*.cpp") +set(SOURCES ${GLAD} ${ENGINE_SOURCES} ${GAME_SOURCES}) + +# ------------------------------------------ + +project(${ENGINE}) +set(CMAKE_CXX_STANDARD 14) + +# GLFW +set(GLFW_BUILD_DOCS OFF CACHE BOOL "" FORCE) +set(GLFW_BUILD_TESTS OFF CACHE BOOL "" FORCE) +set(GLFW_BUILD_EXAMPLES OFF CACHE BOOL "" FORCE) + +# Add GLFW target to project +add_subdirectory(engine/vendor/glfw) + +add_library(${ENGINE} STATIC ${SOURCES}) +target_link_libraries(${ENGINE} glfw) + +# ------------------------------------------ + +project(${GAME}) +set(CMAKE_CXX_STANDARD 14) + +add_executable(${GAME} ${SOURCES}) +target_link_libraries(${GAME} ${ENGINE}) diff --git a/README.org b/README.org new file mode 100644 index 0000000..fe5824e --- /dev/null +++ b/README.org @@ -0,0 +1,11 @@ +* Engine + +Game Engine project. + +* Build instructions + +#+BEGIN_SRC sh + $ mkdir build + $ cd build + $ cmake .. && make +#+END_SRC diff --git a/engine/vendor/glfw b/engine/vendor/glfw new file mode 160000 index 0000000..fa60269 --- /dev/null +++ b/engine/vendor/glfw @@ -0,0 +1 @@ +Subproject commit fa602692455d87e11c9ff5a5fb0681ca6403772a diff --git a/engine/vendor/glm b/engine/vendor/glm new file mode 160000 index 0000000..8828c3f --- /dev/null +++ b/engine/vendor/glm @@ -0,0 +1 @@ +Subproject commit 8828c3f1fd05e173d94417ca4565aa634dabb1c1