building from source

This commit is contained in:
Christoph J. Scherr 2023-10-13 10:25:05 +02:00
commit 157dddbd90
8 changed files with 75 additions and 0 deletions

6
.gitignore vendored Normal file
View File

@ -0,0 +1,6 @@
CMakeFiles
CMakeCache.txt
CMakeDoxyfile.in
CMakeDoxygenDefaults.cmake
Makefile
cmake_install.cmake

6
.gitmodules vendored Normal file
View File

@ -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

44
CMakeLists.txt Normal file
View File

@ -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})

0
bin/loader/.git-keep Normal file
View File

5
build.sh Executable file
View File

@ -0,0 +1,5 @@
#!/bin/bash
set -e
cmake .
cmake --build .
./bin/loader/loader

1
lib/glad Submodule

@ -0,0 +1 @@
Subproject commit 2348b07c1ab4504d60398713781d8a57880234fa

1
lib/glfw Submodule

@ -0,0 +1 @@
Subproject commit 3eaf1255b29fdf5c2895856c7be7d7185ef2b241

12
src/main.cpp Normal file
View File

@ -0,0 +1,12 @@
#include <glad/glad.h>
#include <GLFW/glfw3.h>
#include <string>
#include <vector>
#include <stdio.h>
int main() {
printf("foo");
}