diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..25df076 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "deps/glfw"] + path = deps/glfw + url = https://github.com/glfw/glfw/ diff --git a/CMakeLists.txt b/CMakeLists.txt index 29b33f8..4c0f378 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,7 +1,12 @@ cmake_minimum_required(VERSION 3.10) +add_subdirectory("deps/glfw") project(Raycaster VERSION 0.1) set(CMAKE_CXX_STANDARD 11) set(CMAKE_CXX_STANDARD_REQUIRED True) add_executable(raycaster src/main.cpp) configure_file(src/RaycasterConfig.h.in RaycasterConfig.h) -target_include_directories(raycaster PUBLIC "${PROJECT_BINARY_DIR}") \ No newline at end of file +target_include_directories(raycaster PUBLIC + "${PROJECT_BINARY_DIR}" + "deps/glfw/include" + ) +target_link_libraries(raycaster glfw) \ No newline at end of file diff --git a/deps/glfw b/deps/glfw new file mode 160000 index 0000000..b35641f --- /dev/null +++ b/deps/glfw @@ -0,0 +1 @@ +Subproject commit b35641f4a3c62aa86a0b3c983d163bc0fe36026d diff --git a/src/main.cpp b/src/main.cpp index f6379cf..ad81179 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1,7 +1,23 @@ #include #include "RaycasterConfig.h" +#include int main(int argc, char *argv[]){ std::cout << Raycaster_VERSION_MAJOR << "." << Raycaster_VERSION_MINOR << std::endl; + if(!glfwInit()){ + std::cout << "GLFW Init failed" << std::endl; + return -1; + } + GLFWwindow* window = glfwCreateWindow(640, 480, "My Title", NULL, NULL); + if (!window){ + std::cout << "GLFW Window creation failed" << std::endl; + return -1; + } + glfwMakeContextCurrent(window); + while(!glfwWindowShouldClose(window)){ + glfwPollEvents(); + glfwSwapBuffers(window); + } + glfwTerminate(); return 0; } \ No newline at end of file