From 157dddbd90168455ebe3620fd7072ef3dcc899c9 Mon Sep 17 00:00:00 2001 From: PlexSheep Date: Fri, 13 Oct 2023 10:25:05 +0200 Subject: [PATCH] building from source --- .gitignore | 6 ++++++ .gitmodules | 6 ++++++ CMakeLists.txt | 44 ++++++++++++++++++++++++++++++++++++++++++++ bin/loader/.git-keep | 0 build.sh | 5 +++++ lib/glad | 1 + lib/glfw | 1 + src/main.cpp | 12 ++++++++++++ 8 files changed, 75 insertions(+) create mode 100644 .gitignore create mode 100644 .gitmodules create mode 100644 CMakeLists.txt create mode 100644 bin/loader/.git-keep create mode 100755 build.sh create mode 160000 lib/glad create mode 160000 lib/glfw create mode 100644 src/main.cpp diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..2ed6e3e --- /dev/null +++ b/.gitignore @@ -0,0 +1,6 @@ +CMakeFiles +CMakeCache.txt +CMakeDoxyfile.in +CMakeDoxygenDefaults.cmake +Makefile +cmake_install.cmake diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..a4929c7 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,6 @@ +[submodule "lib/glfw"] + path = lib/glfw + url = https://github.com/glfw/glfw +[submodule "lib/glad"] + path = lib/glad + url = https://github.com/Dav1dde/glad diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..193824d --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,44 @@ +cmake_minimum_required(VERSION 3.27) +project(glsl-basic) + +add_subdirectory(lib/glfw) + +include_directories( + include/ + lib/glad/include/ + lib/glfw/include/ +) +file( + GLOB VENDORS_SOURCES + lib/glad/src/glad.c +) +file( + GLOB PROJECT_HEADERS + include/*.h +) +file( + GLOB PROJECT_SOURCES + src/*.cpp +) +file( + GLOB PROJECT_SHADERS + data/shader/*.glsl +) + +source_group("headers" FILES ${PROJECT_HEADERS}) +source_group("shaders" FILES ${PROJECT_SHADERS}) +source_group("sources" FILES ${PROJECT_SOURCES}) +source_group("vendors" FILES ${VENDORS_SOURCES}) + +set(EXE_1_NAME loader) +file( + GLOB EXE_1_SOURCES + src/main.cpp +) +set(CMAKE_BINARY_DIR "bin") + +add_executable(${EXE_1_NAME} ${EXE_1_SOURCES} ${PROJECT_HEADERS} + ${PROJECT_SHADERS} ${VENDORS_SOURCES}) +target_link_libraries(${EXE_1_NAME} glfw ${GLAD_LIBRARIES}) +set_target_properties(${EXE_1_NAME} PROPERTIES + RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${EXE_1_NAME}) diff --git a/bin/loader/.git-keep b/bin/loader/.git-keep new file mode 100644 index 0000000..e69de29 diff --git a/build.sh b/build.sh new file mode 100755 index 0000000..ded4558 --- /dev/null +++ b/build.sh @@ -0,0 +1,5 @@ +#!/bin/bash +set -e +cmake . +cmake --build . +./bin/loader/loader diff --git a/lib/glad b/lib/glad new file mode 160000 index 0000000..2348b07 --- /dev/null +++ b/lib/glad @@ -0,0 +1 @@ +Subproject commit 2348b07c1ab4504d60398713781d8a57880234fa diff --git a/lib/glfw b/lib/glfw new file mode 160000 index 0000000..3eaf125 --- /dev/null +++ b/lib/glfw @@ -0,0 +1 @@ +Subproject commit 3eaf1255b29fdf5c2895856c7be7d7185ef2b241 diff --git a/src/main.cpp b/src/main.cpp new file mode 100644 index 0000000..b5fb8c9 --- /dev/null +++ b/src/main.cpp @@ -0,0 +1,12 @@ +#include + +#include + +#include +#include + +#include + +int main() { + printf("foo"); +}