generated from Persson-dev/OpenGLComputeShader
switch to xmake
This commit is contained in:
20
.gitignore
vendored
20
.gitignore
vendored
@@ -1,16 +1,10 @@
|
||||
CMakeLists.txt.user
|
||||
CMakeCache.txt
|
||||
CMakeFiles
|
||||
CMakeScripts
|
||||
Testing
|
||||
Makefile
|
||||
cmake_install.cmake
|
||||
install_manifest.txt
|
||||
compile_commands.json
|
||||
CTestTestfile.cmake
|
||||
_deps
|
||||
CMakeUserPresets.json
|
||||
|
||||
# Visual Studio
|
||||
.vs/
|
||||
*.user
|
||||
|
||||
# VsCode
|
||||
.vsCode
|
||||
|
||||
# Xmake
|
||||
.xmake
|
||||
build
|
||||
10
.vscode/c_cpp_properties.json
vendored
Normal file
10
.vscode/c_cpp_properties.json
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"configurations": [
|
||||
{
|
||||
"name": "App",
|
||||
"cppStandard": "c++17",
|
||||
"compileCommands": ".vscode/compile_commands.json"
|
||||
}
|
||||
],
|
||||
"version": 4
|
||||
}
|
||||
16
.vscode/compile_commands.json
vendored
Normal file
16
.vscode/compile_commands.json
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
[
|
||||
{
|
||||
"directory": "/home/simon/Programmation/GPUCompute",
|
||||
"arguments": ["/usr/bin/g++", "-c", "-m64", "-isystem", "/usr/include/X11/dri", "-isystem", "/home/simon/.xmake/packages/g/glad/v0.1.36/9e3539cb78a3425b96246554411a0b79/include", "-isystem", "/home/simon/.xmake/packages/g/glm/1.0.2/f8fba32531124eb38c4833bdc558de88/include", "-isystem", "/home/simon/.xmake/packages/s/stb/2025.03.14/67005fc11486400896028eb775a57270/include", "-isystem", "/home/simon/.xmake/packages/s/stb/2025.03.14/67005fc11486400896028eb775a57270/include/stb", "-o", "build/.objs/App/linux/x86_64/release/src/Shader.cpp.o", "src/Shader.cpp"],
|
||||
"file": "src/Shader.cpp"
|
||||
},
|
||||
{
|
||||
"directory": "/home/simon/Programmation/GPUCompute",
|
||||
"arguments": ["/usr/bin/g++", "-c", "-m64", "-isystem", "/usr/include/X11/dri", "-isystem", "/home/simon/.xmake/packages/g/glad/v0.1.36/9e3539cb78a3425b96246554411a0b79/include", "-isystem", "/home/simon/.xmake/packages/g/glm/1.0.2/f8fba32531124eb38c4833bdc558de88/include", "-isystem", "/home/simon/.xmake/packages/s/stb/2025.03.14/67005fc11486400896028eb775a57270/include", "-isystem", "/home/simon/.xmake/packages/s/stb/2025.03.14/67005fc11486400896028eb775a57270/include/stb", "-o", "build/.objs/App/linux/x86_64/release/src/Renderer.cpp.o", "src/Renderer.cpp"],
|
||||
"file": "src/Renderer.cpp"
|
||||
},
|
||||
{
|
||||
"directory": "/home/simon/Programmation/GPUCompute",
|
||||
"arguments": ["/usr/bin/g++", "-c", "-m64", "-isystem", "/usr/include/X11/dri", "-isystem", "/home/simon/.xmake/packages/g/glad/v0.1.36/9e3539cb78a3425b96246554411a0b79/include", "-isystem", "/home/simon/.xmake/packages/g/glm/1.0.2/f8fba32531124eb38c4833bdc558de88/include", "-isystem", "/home/simon/.xmake/packages/s/stb/2025.03.14/67005fc11486400896028eb775a57270/include", "-isystem", "/home/simon/.xmake/packages/s/stb/2025.03.14/67005fc11486400896028eb775a57270/include/stb", "-o", "build/.objs/App/linux/x86_64/release/src/Main.cpp.o", "src/Main.cpp"],
|
||||
"file": "src/Main.cpp"
|
||||
}]
|
||||
@@ -1,23 +0,0 @@
|
||||
|
||||
# App
|
||||
|
||||
set(SOURCE_DIR "Source")
|
||||
|
||||
set(SOURCES
|
||||
Source/Main.cpp
|
||||
Source/Shader.h
|
||||
Source/Shader.cpp
|
||||
Source/Renderer.h
|
||||
Source/Renderer.cpp
|
||||
vendor/stb/stb_image.h
|
||||
vendor/stb/stb_image.cpp
|
||||
)
|
||||
|
||||
# Add the executable target
|
||||
add_executable(App ${SOURCES})
|
||||
|
||||
target_link_libraries(App glfw)
|
||||
target_link_libraries(App glad)
|
||||
target_link_libraries(App glm)
|
||||
|
||||
target_include_directories(App PRIVATE vendor/stb)
|
||||
2
App/vendor/stb/stb_image.cpp
vendored
2
App/vendor/stb/stb_image.cpp
vendored
@@ -1,2 +0,0 @@
|
||||
#define STB_IMAGE_IMPLEMENTATION
|
||||
#include "stb_image.h"
|
||||
7988
App/vendor/stb/stb_image.h
vendored
7988
App/vendor/stb/stb_image.h
vendored
File diff suppressed because it is too large
Load Diff
@@ -1,69 +0,0 @@
|
||||
cmake_minimum_required(VERSION 3.28)
|
||||
include(FetchContent)
|
||||
|
||||
project(App)
|
||||
|
||||
set(CMAKE_CXX_STANDARD 20)
|
||||
|
||||
#
|
||||
# Dependencies
|
||||
#
|
||||
|
||||
# GLFW
|
||||
find_package(glfw3 3.4 QUIET)
|
||||
if (NOT glfw3_FOUND)
|
||||
FetchContent_Declare(
|
||||
glfw3
|
||||
DOWNLOAD_EXTRACT_TIMESTAMP OFF
|
||||
URL https://github.com/glfw/glfw/releases/download/3.4/glfw-3.4.zip
|
||||
)
|
||||
FetchContent_GetProperties(glfw3)
|
||||
if (NOT glfw3_POPULATED)
|
||||
set(FETCHCONTENT_QUIET NO)
|
||||
FetchContent_Populate(glfw3)
|
||||
add_subdirectory(${glfw3_SOURCE_DIR} ${glfw3_BINARY_DIR})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# OpenGL
|
||||
find_package(OpenGL REQUIRED)
|
||||
|
||||
# GLAD
|
||||
FetchContent_Declare(
|
||||
glad
|
||||
DOWNLOAD_EXTRACT_TIMESTAMP OFF
|
||||
URL https://github.com/Dav1dde/glad/archive/refs/tags/v2.0.8.zip
|
||||
)
|
||||
|
||||
FetchContent_GetProperties(glad)
|
||||
if(NOT glad_POPULATED)
|
||||
set(FETCHCONTENT_QUIET NO)
|
||||
FetchContent_MakeAvailable(glad)
|
||||
|
||||
add_subdirectory("${glad_SOURCE_DIR}/cmake" glad_cmake)
|
||||
glad_add_library(glad REPRODUCIBLE EXCLUDE_FROM_ALL LOADER API gl:core=4.6)
|
||||
endif()
|
||||
set_target_properties(glad PROPERTIES FOLDER "Dependencies")
|
||||
|
||||
# GLM
|
||||
find_package(glm 1.0.1 QUIET)
|
||||
if (NOT glm_FOUND)
|
||||
FetchContent_Declare(
|
||||
glm
|
||||
DOWNLOAD_EXTRACT_TIMESTAMP OFF
|
||||
URL https://github.com/g-truc/glm/archive/refs/tags/1.0.1.zip
|
||||
)
|
||||
FetchContent_GetProperties(glm)
|
||||
if (NOT glm_POPULATED)
|
||||
set(FETCHCONTENT_QUIET NO)
|
||||
FetchContent_Populate(glm)
|
||||
add_subdirectory(${glm_SOURCE_DIR} ${glm_BINARY_DIR})
|
||||
endif()
|
||||
endif()
|
||||
set_target_properties(glm PROPERTIES FOLDER "Dependencies")
|
||||
|
||||
#
|
||||
# Projects
|
||||
#
|
||||
|
||||
add_subdirectory(App)
|
||||
@@ -2,14 +2,12 @@
|
||||
Simple app to run compute shaders using OpenGL.
|
||||
|
||||
## Building
|
||||
Just run CMake and build. Here's an example:
|
||||
Just run xmake and build. Here's an example:
|
||||
```
|
||||
mkdir build
|
||||
cd build
|
||||
cmake ..
|
||||
xmake
|
||||
```
|
||||
|
||||
Tested on Windows 11 using Visual Studio 2022, more testing to follow.
|
||||
Tested on PopOS! using gcc 11.4.0, more testing to follow.
|
||||
|
||||
## Third-Party Dependencies
|
||||
Uses the following third-party dependencies:
|
||||
|
||||
@@ -45,7 +45,7 @@ int main()
|
||||
glfwSetKeyCallback(window, KeyCallback);
|
||||
|
||||
glfwMakeContextCurrent(window);
|
||||
gladLoadGL(glfwGetProcAddress);
|
||||
gladLoadGL();
|
||||
glfwSwapInterval(1);
|
||||
|
||||
s_ComputeShader = CreateComputeShader(s_ComputeShaderPath);
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
#include <iostream>
|
||||
|
||||
#define STB_IMAGE_IMPLEMENTATION
|
||||
#include "stb_image.h"
|
||||
|
||||
Texture CreateTexture(int width, int height)
|
||||
@@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include <glad/gl.h>
|
||||
#include <glad/glad.h>
|
||||
#define GLFW_INCLUDE_NONE
|
||||
#include <GLFW/glfw3.h>
|
||||
|
||||
@@ -2,8 +2,9 @@
|
||||
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include <vector>
|
||||
|
||||
#include <glad/gl.h>
|
||||
#include <glad/glad.h>
|
||||
|
||||
static std::string ReadTextFile(const std::filesystem::path& path)
|
||||
{
|
||||
Reference in New Issue
Block a user