switch to xmake

This commit is contained in:
2025-11-08 19:01:17 +01:00
parent 86a810b65e
commit 86def65569
15 changed files with 48 additions and 8103 deletions

20
.gitignore vendored
View File

@@ -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 # Visual Studio
.vs/ .vs/
*.user *.user
# VsCode
.vsCode
# Xmake
.xmake
build

10
.vscode/c_cpp_properties.json vendored Normal file
View 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
View 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"
}]

View File

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

View File

@@ -1,2 +0,0 @@
#define STB_IMAGE_IMPLEMENTATION
#include "stb_image.h"

File diff suppressed because it is too large Load Diff

View File

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

View File

@@ -2,14 +2,12 @@
Simple app to run compute shaders using OpenGL. Simple app to run compute shaders using OpenGL.
## Building ## Building
Just run CMake and build. Here's an example: Just run xmake and build. Here's an example:
``` ```
mkdir build xmake
cd build
cmake ..
``` ```
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 ## Third-Party Dependencies
Uses the following third-party dependencies: Uses the following third-party dependencies:

View File

@@ -45,7 +45,7 @@ int main()
glfwSetKeyCallback(window, KeyCallback); glfwSetKeyCallback(window, KeyCallback);
glfwMakeContextCurrent(window); glfwMakeContextCurrent(window);
gladLoadGL(glfwGetProcAddress); gladLoadGL();
glfwSwapInterval(1); glfwSwapInterval(1);
s_ComputeShader = CreateComputeShader(s_ComputeShaderPath); s_ComputeShader = CreateComputeShader(s_ComputeShaderPath);

View File

@@ -2,6 +2,7 @@
#include <iostream> #include <iostream>
#define STB_IMAGE_IMPLEMENTATION
#include "stb_image.h" #include "stb_image.h"
Texture CreateTexture(int width, int height) Texture CreateTexture(int width, int height)

View File

@@ -1,6 +1,6 @@
#pragma once #pragma once
#include <glad/gl.h> #include <glad/glad.h>
#define GLFW_INCLUDE_NONE #define GLFW_INCLUDE_NONE
#include <GLFW/glfw3.h> #include <GLFW/glfw3.h>

View File

@@ -2,8 +2,9 @@
#include <iostream> #include <iostream>
#include <fstream> #include <fstream>
#include <vector>
#include <glad/gl.h> #include <glad/glad.h>
static std::string ReadTextFile(const std::filesystem::path& path) static std::string ReadTextFile(const std::filesystem::path& path)
{ {

7
xmake.lua Normal file
View File

@@ -0,0 +1,7 @@
add_requires("glfw", "glad", "glm", "stb")
target("App")
set_kind("binary")
add_files("src/*.cpp")
add_packages("glfw", "glad", "glm", "stb")
set_rundir(".")