From 66b9b7595c1c2344913bda7836bd9cf31faac2a2 Mon Sep 17 00:00:00 2001 From: "DESKTOP-HOME\\Charles" Date: Sun, 11 Nov 2018 21:21:54 -0600 Subject: [PATCH] Converted project to cmake, making it somewhat portable --- CMakeLists.txt | 33 +++++++++++++++++ CMakeSettings.json | 52 +++++++++++++++++++++++++++ {TerrainFPS => src}/Bullet.h | 0 {TerrainFPS => src}/Camera.h | 0 {TerrainFPS => src}/GridFloatData.cpp | 0 {TerrainFPS => src}/GridFloatData.h | 0 {TerrainFPS => src}/SOIL.h | 0 {TerrainFPS => src}/Shader.h | 0 {TerrainFPS => src}/TerrainFPS.cpp | 0 {TerrainFPS => src}/TerrainFPS.h | 4 +-- 10 files changed, 87 insertions(+), 2 deletions(-) create mode 100644 CMakeLists.txt create mode 100644 CMakeSettings.json rename {TerrainFPS => src}/Bullet.h (100%) rename {TerrainFPS => src}/Camera.h (100%) rename {TerrainFPS => src}/GridFloatData.cpp (100%) rename {TerrainFPS => src}/GridFloatData.h (100%) rename {TerrainFPS => src}/SOIL.h (100%) rename {TerrainFPS => src}/Shader.h (100%) rename {TerrainFPS => src}/TerrainFPS.cpp (100%) rename {TerrainFPS => src}/TerrainFPS.h (98%) diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..ead33c9 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,33 @@ +cmake_minimum_required(VERSION 3.7 FATAL_ERROR) + +project(GraphicsProject4 VERSION 0.0.1 LANGUAGES CXX) + +find_package (OpenGL REQUIRED) +find_package(GLEW REQUIRED) +find_package(SOIL CONFIG REQUIRED) +find_package(glfw3 REQUIRED) +find_package(glm REQUIRED) + +add_executable(main + +src/TerrainFPS.cpp +src/GridFloatData.cpp +) + +target_link_libraries(main PRIVATE ${OPENGL_LIBRARIES}) + +target_include_directories(main PRIVATE GLEW) +target_link_libraries(main PRIVATE GLEW::GLEW) + +target_link_libraries(main PRIVATE SOIL) + +target_link_libraries(main PUBLIC glm) + +target_include_directories(main PUBLIC glfw) +target_link_libraries(main PRIVATE glfw) + +target_include_directories(main PRIVATE ${CMAKE_SOURCE_DIR}/src) + +add_custom_command(TARGET main POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy_directory + ${PROJECT_SOURCE_DIR}/Resources $) \ No newline at end of file diff --git a/CMakeSettings.json b/CMakeSettings.json new file mode 100644 index 0000000..bd4f6d3 --- /dev/null +++ b/CMakeSettings.json @@ -0,0 +1,52 @@ +{ + "configurations": [ + { + "name": "x64-Debug", + "generator": "Ninja", + "configurationType": "Debug", + "inheritEnvironments": [ "msvc_x64_x64" ], + "buildRoot": "${env.USERPROFILE}\\CMakeBuilds\\${workspaceHash}\\build\\${name}", + "cmakeCommandArgs": "", + "buildCommandArgs": "-v", + "variables": [ + { + "name": "CMAKE_TOOLCHAIN_FILE", + "value": "C:/src/vcpkg/scripts/buildsystems/vcpkg.cmake" + } + ], + "ctestCommandArgs": "" + }, + { + "name": "x64-RelWithDebInfo", + "generator": "Ninja", + "configurationType": "RelWithDebInfo", + "inheritEnvironments": [ "msvc_x64_x64" ], + "buildRoot": "${env.USERPROFILE}\\CMakeBuilds\\${workspaceHash}\\build\\${name}", + "cmakeCommandArgs": "", + "buildCommandArgs": "-v", + "variables": [ + { + "name": "CMAKE_TOOLCHAIN_FILE", + "value": "C:/src/vcpkg/scripts/buildsystems/vcpkg.cmake" + } + ], + "ctestCommandArgs": "" + }, + { + "name": "x64-Release", + "generator": "Ninja", + "configurationType": "Release", + "inheritEnvironments": [ "msvc_x64_x64" ], + "buildRoot": "${env.USERPROFILE}\\CMakeBuilds\\${workspaceHash}\\build\\${name}", + "cmakeCommandArgs": "", + "buildCommandArgs": "-v", + "variables": [ + { + "name": "CMAKE_TOOLCHAIN_FILE", + "value": "C:/src/vcpkg/scripts/buildsystems/vcpkg.cmake" + } + ], + "ctestCommandArgs": "" + } + ] +} \ No newline at end of file diff --git a/TerrainFPS/Bullet.h b/src/Bullet.h similarity index 100% rename from TerrainFPS/Bullet.h rename to src/Bullet.h diff --git a/TerrainFPS/Camera.h b/src/Camera.h similarity index 100% rename from TerrainFPS/Camera.h rename to src/Camera.h diff --git a/TerrainFPS/GridFloatData.cpp b/src/GridFloatData.cpp similarity index 100% rename from TerrainFPS/GridFloatData.cpp rename to src/GridFloatData.cpp diff --git a/TerrainFPS/GridFloatData.h b/src/GridFloatData.h similarity index 100% rename from TerrainFPS/GridFloatData.h rename to src/GridFloatData.h diff --git a/TerrainFPS/SOIL.h b/src/SOIL.h similarity index 100% rename from TerrainFPS/SOIL.h rename to src/SOIL.h diff --git a/TerrainFPS/Shader.h b/src/Shader.h similarity index 100% rename from TerrainFPS/Shader.h rename to src/Shader.h diff --git a/TerrainFPS/TerrainFPS.cpp b/src/TerrainFPS.cpp similarity index 100% rename from TerrainFPS/TerrainFPS.cpp rename to src/TerrainFPS.cpp diff --git a/TerrainFPS/TerrainFPS.h b/src/TerrainFPS.h similarity index 98% rename from TerrainFPS/TerrainFPS.h rename to src/TerrainFPS.h index 26ac246..1d664d1 100644 --- a/TerrainFPS/TerrainFPS.h +++ b/src/TerrainFPS.h @@ -6,7 +6,7 @@ #include // GLEW -#define GLEW_STATIC +//#define GLEW_STATIC #include // GLFW @@ -20,7 +20,7 @@ // SOIL #include "SOIL.h" -// Other includes +// Other includes #include "Shader.h" #include "Camera.h" #include "GridFloatData.h"