diff --git a/.github/workflows/linux_meson.yml b/.github/workflows/linux_meson.yml new file mode 100644 index 0000000..867d8a4 --- /dev/null +++ b/.github/workflows/linux_meson.yml @@ -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 diff --git a/.github/workflows/macos_x86.yml b/.github/workflows/macos.yml similarity index 96% rename from .github/workflows/macos_x86.yml rename to .github/workflows/macos.yml index 64aab65..e5223d9 100644 --- a/.github/workflows/macos_x86.yml +++ b/.github/workflows/macos.yml @@ -16,7 +16,7 @@ jobs: fail-fast: false matrix: os: [macOS-latest] - arch: [x86_64] + arch: [x86_64, arm] runs-on: ${{ matrix.os }} if: "!contains(github.event.head_commit.message, 'ci skip')" diff --git a/.github/workflows/macos_meson.yml b/.github/workflows/macos_meson.yml new file mode 100644 index 0000000..c026970 --- /dev/null +++ b/.github/workflows/macos_meson.yml @@ -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 diff --git a/meson.build b/meson.build new file mode 100644 index 0000000..a8e6aa7 --- /dev/null +++ b/meson.build @@ -0,0 +1,111 @@ +project('MacroLibX', + ['c', 'cpp'], + version : '2.2.2', + 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('force_integrated_gpu') + add_project_arguments('-DFORCE_INTEGRATED_GPU', language : 'c') +endif + +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 : ['.'], +) diff --git a/meson_options.txt b/meson_options.txt new file mode 100644 index 0000000..c943a18 --- /dev/null +++ b/meson_options.txt @@ -0,0 +1,29 @@ +option('force_integrated_gpu', + type : 'boolean', + value : false, + description : 'Force the application to use the integrated GPU if available.' +) + +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.' +) \ No newline at end of file