mirror of
https://github.com/seekrs/MacroLibX.git
synced 2026-01-11 22:53:34 +00:00
Compare commits
9 Commits
f44c4d106c
...
v2.2.3
| Author | SHA1 | Date | |
|---|---|---|---|
| 3e82487037 | |||
| 768dc0c1d9 | |||
| 55086a05a6 | |||
| bef1888a79 | |||
|
519b273a20
|
|||
|
fd8beaaf17
|
|||
|
|
c4979ceded | ||
|
|
f4a1dc386a | ||
|
|
83d05cc6e2 |
43
.github/workflows/linux_meson.yml
vendored
git.filemode.normal_file
43
.github/workflows/linux_meson.yml
vendored
git.filemode.normal_file
@@ -0,0 +1,43 @@
|
|||||||
|
name: Linux (meson)
|
||||||
|
|
||||||
|
on:
|
||||||
|
repository_dispatch:
|
||||||
|
types: [create-pull-request]
|
||||||
|
pull_request:
|
||||||
|
push:
|
||||||
|
paths-ignore:
|
||||||
|
- '.gitignore'
|
||||||
|
- 'LICENSE'
|
||||||
|
- 'README.md'
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
os: [ubuntu-24.04]
|
||||||
|
arch: [x86_64]
|
||||||
|
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
if: "!contains(github.event.head_commit.message, 'ci skip')"
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v6
|
||||||
|
|
||||||
|
- name: Install system dependencies
|
||||||
|
run: |
|
||||||
|
sudo apt-get update
|
||||||
|
sudo apt-get -y install mesa-common-dev clang libsdl2-2.0-0 libsdl2-dev build-essential libvulkan-dev
|
||||||
|
|
||||||
|
- name: Python
|
||||||
|
uses: actions/setup-python@v5
|
||||||
|
with:
|
||||||
|
python-version: '3.11'
|
||||||
|
|
||||||
|
- name: Install Meson with pip
|
||||||
|
run: sudo pip3 install meson
|
||||||
|
|
||||||
|
- name: Build with meson
|
||||||
|
run: |
|
||||||
|
meson build --prefix=$PWD/ --bindir='' --libdir=''
|
||||||
|
ninja install -C build
|
||||||
@@ -16,7 +16,7 @@ jobs:
|
|||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
os: [macOS-latest]
|
os: [macOS-latest]
|
||||||
arch: [x86_64]
|
arch: [x86_64, arm]
|
||||||
|
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
if: "!contains(github.event.head_commit.message, 'ci skip')"
|
if: "!contains(github.event.head_commit.message, 'ci skip')"
|
||||||
42
.github/workflows/macos_meson.yml
vendored
git.filemode.normal_file
42
.github/workflows/macos_meson.yml
vendored
git.filemode.normal_file
@@ -0,0 +1,42 @@
|
|||||||
|
name: macOS (meson)
|
||||||
|
|
||||||
|
on:
|
||||||
|
repository_dispatch:
|
||||||
|
types: [create-pull-request]
|
||||||
|
pull_request:
|
||||||
|
push:
|
||||||
|
paths-ignore:
|
||||||
|
- '.gitignore'
|
||||||
|
- 'LICENSE'
|
||||||
|
- 'README.md'
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
os: [macOS-latest]
|
||||||
|
arch: [x86_64, arm]
|
||||||
|
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
if: "!contains(github.event.head_commit.message, 'ci skip')"
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v6
|
||||||
|
|
||||||
|
- name: Install system dependencies
|
||||||
|
run: |
|
||||||
|
brew install SDL2
|
||||||
|
|
||||||
|
- name: Python
|
||||||
|
uses: actions/setup-python@v5
|
||||||
|
with:
|
||||||
|
python-version: '3.11'
|
||||||
|
|
||||||
|
- name: Install Meson with pip
|
||||||
|
run: sudo pip3 install meson
|
||||||
|
|
||||||
|
- name: Build with meson
|
||||||
|
run: |
|
||||||
|
meson build --prefix=$PWD/ --bindir='' --libdir=''
|
||||||
|
ninja install -C build
|
||||||
2
LICENSE
2
LICENSE
@@ -1,5 +1,5 @@
|
|||||||
MIT License
|
MIT License
|
||||||
Copyright (c) 2022-2024 kbz_8
|
Copyright (c) 2022-2026 kbz_8
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|||||||
5
Makefile
5
Makefile
@@ -4,7 +4,6 @@ MAKE = make --no-print-directory
|
|||||||
OS ?= $(shell uname -s)
|
OS ?= $(shell uname -s)
|
||||||
DEBUG ?= false
|
DEBUG ?= false
|
||||||
TOOLCHAIN ?= clang
|
TOOLCHAIN ?= clang
|
||||||
FORCE_INTEGRATED_GPU ?= false
|
|
||||||
GRAPHICS_MEMORY_DUMP ?= false
|
GRAPHICS_MEMORY_DUMP ?= false
|
||||||
PROFILER ?= false
|
PROFILER ?= false
|
||||||
FORCE_WAYLAND ?= false
|
FORCE_WAYLAND ?= false
|
||||||
@@ -64,10 +63,6 @@ else
|
|||||||
CXXFLAGS += -O3
|
CXXFLAGS += -O3
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(FORCE_INTEGRATED_GPU), true)
|
|
||||||
_ENABLEDFLAGS += FORCE_INTEGRATED_GPU
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifeq ($(GRAPHICS_MEMORY_DUMP), true)
|
ifeq ($(GRAPHICS_MEMORY_DUMP), true)
|
||||||
_ENABLEDFLAGS += GRAPHICS_MEMORY_DUMP
|
_ENABLEDFLAGS += GRAPHICS_MEMORY_DUMP
|
||||||
endif
|
endif
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
<div align="center">
|
<div align="center">
|
||||||
<a href="https://github.com/seekrs/MacroLibX/actions/workflows/linux_clang.yml"><img src="https://github.com/seekrs/MacroLibX/actions/workflows/linux_clang.yml/badge.svg"></a>
|
<a href="https://github.com/seekrs/MacroLibX/actions/workflows/linux_clang.yml"><img src="https://github.com/seekrs/MacroLibX/actions/workflows/linux_clang.yml/badge.svg"></a>
|
||||||
<a href="https://github.com/seekrs/MacroLibX/actions/workflows/linux_gcc.yml"><img src="https://github.com/seekrs/MacroLibX/actions/workflows/linux_gcc.yml/badge.svg"></a>
|
<a href="https://github.com/seekrs/MacroLibX/actions/workflows/linux_gcc.yml"><img src="https://github.com/seekrs/MacroLibX/actions/workflows/linux_gcc.yml/badge.svg"></a>
|
||||||
<a href="https://github.com/seekrs/MacroLibX/actions/workflows/macos_x86.yml"><img src="https://github.com/seekrs/MacroLibX/actions/workflows/macos_x86.yml/badge.svg"></a>
|
<a href="https://github.com/seekrs/MacroLibX/actions/workflows/macos.yml"><img src="https://github.com/seekrs/MacroLibX/actions/workflows/macos.yml/badge.svg"></a>
|
||||||
</div>
|
</div>
|
||||||
<div align="center">
|
<div align="center">
|
||||||
<a href="https://github.com/seekrs/MacroLibX/actions/workflows/windows.yml"><img src="https://github.com/seekrs/MacroLibX/actions/workflows/windows.yml/badge.svg"></a>
|
<a href="https://github.com/seekrs/MacroLibX/actions/workflows/windows.yml"><img src="https://github.com/seekrs/MacroLibX/actions/workflows/windows.yml/badge.svg"></a>
|
||||||
@@ -103,9 +103,6 @@ MacroLibX has a strong safety support, mainly by checking every pointer that you
|
|||||||
### 🛠️ Set the toolchain
|
### 🛠️ Set the toolchain
|
||||||
If you want to use `GCC` to build the mlx you can use `make TOOLCHAIN=gcc`
|
If you want to use `GCC` to build the mlx you can use `make TOOLCHAIN=gcc`
|
||||||
|
|
||||||
### 🖥️ Force the integrated GPU (not recommended)
|
|
||||||
You can force the mlx to use your integrated GPU by using `make FORCE_INTEGRATED_GPU=true`. Note that there are a lot of chances that your application crashes by using that.
|
|
||||||
|
|
||||||
### đź’˝ Dump the graphics memory
|
### đź’˝ Dump the graphics memory
|
||||||
The mlx can dump it's graphics memory use to json files every two seconds by enabling this option `make GRAPHICS_MEMORY_DUMP=true`.
|
The mlx can dump it's graphics memory use to json files every two seconds by enabling this option `make GRAPHICS_MEMORY_DUMP=true`.
|
||||||
|
|
||||||
|
|||||||
@@ -16,9 +16,6 @@ MacroLibX has a strong safety support, mainly by checking every pointer that you
|
|||||||
### 🛠️ Set the toolchain
|
### 🛠️ Set the toolchain
|
||||||
To change the compilation toolchain you can use `xmake config --toolchain=[gcc|clang|...]`
|
To change the compilation toolchain you can use `xmake config --toolchain=[gcc|clang|...]`
|
||||||
|
|
||||||
### 🖥️ Force the integrated GPU (not recommended)
|
|
||||||
You can force the mlx to use your integrated GPU using `xmake config --force_integrated_gpu=y`. Note that there are a lot of chances that your application crashes by using that.
|
|
||||||
|
|
||||||
### đź’˝ Dump the graphics memory
|
### đź’˝ Dump the graphics memory
|
||||||
The mlx can dump it's graphics memory use to json files every two seconds by enabling this option `xmake config --graphics_memory_dump=y`.
|
The mlx can dump it's graphics memory use to json files every two seconds by enabling this option `xmake config --graphics_memory_dump=y`.
|
||||||
|
|
||||||
|
|||||||
@@ -206,7 +206,7 @@
|
|||||||
|
|
||||||
typedef void (*mlx_function)(void);
|
typedef void (*mlx_function)(void);
|
||||||
|
|
||||||
#define MLX_VERSION MLX_MAKE_VERSION(2, 2, 0)
|
#define MLX_VERSION MLX_MAKE_VERSION(2, 2, 3)
|
||||||
#define MLX_TARGET_VULKAN_API_VERSION MLX_MAKE_VERSION(1, 0, 0)
|
#define MLX_TARGET_VULKAN_API_VERSION MLX_MAKE_VERSION(1, 0, 0)
|
||||||
|
|
||||||
// Checking common assumptions
|
// Checking common assumptions
|
||||||
|
|||||||
107
meson.build
git.filemode.normal_file
107
meson.build
git.filemode.normal_file
@@ -0,0 +1,107 @@
|
|||||||
|
project('MacroLibX',
|
||||||
|
['c', 'cpp'],
|
||||||
|
version : '2.2.3',
|
||||||
|
license : 'MIT',
|
||||||
|
meson_version : '>= 1.9.0',
|
||||||
|
default_options : ['warning_level=2', 'optimization=3', 'cpp_std=c++20'])
|
||||||
|
|
||||||
|
add_project_arguments('-Wno-error=', language : 'c')
|
||||||
|
add_project_arguments('-fPIC', language : 'c')
|
||||||
|
add_project_arguments('-DSDL_MAIN_HANDLED', language : 'c')
|
||||||
|
|
||||||
|
if get_option('graphics_memory_dump')
|
||||||
|
add_project_arguments('-DGRAPHICS_MEMORY_DUMP', language : 'c')
|
||||||
|
endif
|
||||||
|
|
||||||
|
if get_option('profiler')
|
||||||
|
add_project_arguments('-DPROFILER_ENABLED', language : 'c')
|
||||||
|
endif
|
||||||
|
|
||||||
|
if get_option('force_wayland')
|
||||||
|
add_project_arguments('-DFORCE_WAYLAND', language : 'c')
|
||||||
|
endif
|
||||||
|
|
||||||
|
if get_option('disable_all_safeties')
|
||||||
|
add_project_arguments('-DDISABLE_ALL_SAFETIES', language : 'c')
|
||||||
|
endif
|
||||||
|
|
||||||
|
includes_directories = [
|
||||||
|
include_directories('includes'),
|
||||||
|
include_directories('runtime/Includes'),
|
||||||
|
include_directories('runtime/Sources'),
|
||||||
|
include_directories('third_party'),
|
||||||
|
]
|
||||||
|
|
||||||
|
sources = [
|
||||||
|
files(
|
||||||
|
'runtime/Sources/Core/Application.cpp',
|
||||||
|
'runtime/Sources/Core/Bridge.cpp',
|
||||||
|
'runtime/Sources/Core/EventBus.cpp',
|
||||||
|
'runtime/Sources/Core/EventListener.cpp',
|
||||||
|
'runtime/Sources/Core/Fps.cpp',
|
||||||
|
'runtime/Sources/Core/Graphics.cpp',
|
||||||
|
'runtime/Sources/Core/Logs.cpp',
|
||||||
|
'runtime/Sources/Core/Memory.cpp',
|
||||||
|
'runtime/Sources/Core/Profiler.cpp',
|
||||||
|
'runtime/Sources/Core/SDLManager.cpp',
|
||||||
|
'runtime/Sources/Core/UUID.cpp',
|
||||||
|
'runtime/Sources/Graphics/Font.cpp',
|
||||||
|
'runtime/Sources/Graphics/Mesh.cpp',
|
||||||
|
'runtime/Sources/Graphics/PutPixelManager.cpp',
|
||||||
|
'runtime/Sources/Graphics/Scene.cpp',
|
||||||
|
'runtime/Sources/Graphics/Sprite.cpp',
|
||||||
|
'runtime/Sources/Graphics/Text.cpp',
|
||||||
|
'runtime/Sources/Platform/Inputs.cpp',
|
||||||
|
'runtime/Sources/Platform/Window.cpp',
|
||||||
|
'runtime/Sources/Renderer/Pipelines/Graphics.cpp',
|
||||||
|
'runtime/Sources/Renderer/Pipelines/Shader.cpp',
|
||||||
|
'runtime/Sources/Renderer/RenderPasses/2DPass.cpp',
|
||||||
|
'runtime/Sources/Renderer/RenderPasses/FinalPass.cpp',
|
||||||
|
'runtime/Sources/Renderer/RenderPasses/Passes.cpp',
|
||||||
|
'runtime/Sources/Renderer/Vulkan/VulkanLoader.cpp',
|
||||||
|
'runtime/Sources/Renderer/Buffer.cpp',
|
||||||
|
'runtime/Sources/Renderer/Descriptor.cpp',
|
||||||
|
'runtime/Sources/Renderer/Image.cpp',
|
||||||
|
'runtime/Sources/Renderer/Memory.cpp',
|
||||||
|
'runtime/Sources/Renderer/RenderCore.cpp',
|
||||||
|
'runtime/Sources/Renderer/Renderer.cpp',
|
||||||
|
'runtime/Sources/Renderer/SceneRenderer.cpp',
|
||||||
|
'runtime/Sources/Renderer/Swapchain.cpp'
|
||||||
|
)
|
||||||
|
]
|
||||||
|
|
||||||
|
mlx_headers = [
|
||||||
|
'includes/mlx.h',
|
||||||
|
'includes/mlx_extended.h',
|
||||||
|
'includes/mlx_profile.h'
|
||||||
|
]
|
||||||
|
|
||||||
|
install_headers(mlx_headers)
|
||||||
|
|
||||||
|
deps = [
|
||||||
|
dependency('sdl2'),
|
||||||
|
]
|
||||||
|
|
||||||
|
libmlx = library('mlx',
|
||||||
|
sources,
|
||||||
|
include_directories : includes_directories,
|
||||||
|
dependencies : deps,
|
||||||
|
install : true)
|
||||||
|
|
||||||
|
libmlx_dep = declare_dependency(
|
||||||
|
include_directories: includes_directories,
|
||||||
|
dependencies : deps,
|
||||||
|
link_with : libmlx)
|
||||||
|
|
||||||
|
meson.override_dependency('mlx', libmlx_dep)
|
||||||
|
|
||||||
|
# PKG CONFIG GENERATION
|
||||||
|
pkg_mod = import('pkgconfig')
|
||||||
|
|
||||||
|
pkg_mod.generate(
|
||||||
|
libmlx,
|
||||||
|
name : 'mlx',
|
||||||
|
description : 'MacroLibX Library',
|
||||||
|
version : meson.project_version(),
|
||||||
|
subdirs : ['.'],
|
||||||
|
)
|
||||||
23
meson_options.txt
git.filemode.normal_file
23
meson_options.txt
git.filemode.normal_file
@@ -0,0 +1,23 @@
|
|||||||
|
option('graphics_memory_dump',
|
||||||
|
type : 'boolean',
|
||||||
|
value : false,
|
||||||
|
description : 'Enable graphics memory dump for debugging purposes.'
|
||||||
|
)
|
||||||
|
|
||||||
|
option('profiler',
|
||||||
|
type : 'boolean',
|
||||||
|
value : false,
|
||||||
|
description : 'Enable profiler for performance analysis.'
|
||||||
|
)
|
||||||
|
|
||||||
|
option('force_wayland',
|
||||||
|
type : 'boolean',
|
||||||
|
value : false,
|
||||||
|
description : 'Force the application to use Wayland display server.'
|
||||||
|
)
|
||||||
|
|
||||||
|
option('disable_all_safeties',
|
||||||
|
type : 'boolean',
|
||||||
|
value : false,
|
||||||
|
description : 'Disable all safety checks in the application.'
|
||||||
|
)
|
||||||
@@ -21,6 +21,6 @@ rm vulkan-headers.zip
|
|||||||
|
|
||||||
# Update KVF
|
# Update KVF
|
||||||
rm -f ../third_party/kvf.h
|
rm -f ../third_party/kvf.h
|
||||||
git clone https://github.com/Kbz-8/KVF.git ../third_party/KVF/
|
git clone https://git.kbz8.me/kbz_8/KVF.git ../third_party/KVF/
|
||||||
mv ../third_party/KVF/kvf.h ../third_party/kvf.h
|
mv ../third_party/KVF/kvf.h ../third_party/kvf.h
|
||||||
rm -rf ../third_party/KVF
|
rm -rf ../third_party/KVF
|
||||||
|
|||||||
@@ -11,11 +11,6 @@ set_targetdir("./")
|
|||||||
set_optimize("fastest")
|
set_optimize("fastest")
|
||||||
|
|
||||||
-- Options
|
-- Options
|
||||||
option("force_integrated_gpu")
|
|
||||||
set_default(false)
|
|
||||||
add_defines("FORCE_INTEGRATED_GPU")
|
|
||||||
option_end()
|
|
||||||
|
|
||||||
option("graphics_memory_dump")
|
option("graphics_memory_dump")
|
||||||
set_default(false)
|
set_default(false)
|
||||||
add_defines("GRAPHICS_MEMORY_DUMP")
|
add_defines("GRAPHICS_MEMORY_DUMP")
|
||||||
@@ -42,7 +37,6 @@ target("mlx")
|
|||||||
set_default(true)
|
set_default(true)
|
||||||
set_license("MIT")
|
set_license("MIT")
|
||||||
set_kind("shared")
|
set_kind("shared")
|
||||||
add_options("force_integrated_gpu")
|
|
||||||
add_options("graphics_memory_dump")
|
add_options("graphics_memory_dump")
|
||||||
add_options("profiler")
|
add_options("profiler")
|
||||||
add_options("force_wayland")
|
add_options("force_wayland")
|
||||||
|
|||||||
Reference in New Issue
Block a user