-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5 from 420verfl0w/indev
merge Indev to master
- Loading branch information
Showing
53 changed files
with
3,674 additions
and
134 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
name: Windows (xmake) | ||
|
||
on: | ||
pull_request: | ||
push: | ||
paths-ignore: | ||
- '.gitignore' | ||
- 'LICENSE' | ||
- 'README.md' | ||
|
||
jobs: | ||
build: | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: [windows-latest] | ||
arch: [x64] | ||
mode: [release] | ||
|
||
runs-on: ${{ matrix.os }} | ||
if: "!contains(github.event.head_commit.message, 'ci skip')" | ||
|
||
steps: | ||
- name: Get current date as package key | ||
id: cache_key | ||
run: echo "key=$(date +'%W')" >> $GITHUB_OUTPUT | ||
|
||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
# Install system dependencies | ||
- name: Install Vulkan SDK | ||
uses: humbletim/[email protected] | ||
with: | ||
version: 1.3.204.1 | ||
cache: true | ||
|
||
# Force xmake to a specific folder (for cache) | ||
- name: Set xmake env | ||
run: echo "XMAKE_GLOBALDIR=${{ runner.workspace }}/xmake-global" >> $GITHUB_ENV | ||
|
||
# Install xmake | ||
- name: Setup xmake | ||
uses: xmake-io/github-action-setup-xmake@v1 | ||
with: | ||
xmake-version: branch@master | ||
actions-cache-folder: .xmake-cache-W${{ steps.cache_key.outputs.key }} | ||
|
||
# Update xmake repository (in order to have the file that will be cached) | ||
- name: Update xmake repository | ||
run: xmake repo --update | ||
|
||
# Fetch xmake dephash | ||
- name: Retrieve dependencies hash | ||
id: dep_hash | ||
run: echo "hash=$(xmake l utils.ci.packageskey)" >> $GITHUB_OUTPUT | ||
|
||
# Cache xmake dependencies | ||
- name: Retrieve cached xmake dependencies | ||
uses: actions/cache@v3 | ||
with: | ||
path: ${{ env.XMAKE_GLOBALDIR }}/.xmake/packages | ||
key: Windows-${{ matrix.arch }}-${{ matrix.mode }}-${{ steps.dep_hash.outputs.hash }}-W${{ steps.cache_key.outputs.key }} | ||
|
||
# Setup compilation mode and install project dependencies | ||
- name: Configure xmake and install dependencies | ||
run: xmake config --arch=${{ matrix.arch }} --mode=${{ matrix.mode }} --yes | ||
|
||
# Build the mlx | ||
- name: Build MacroLibX | ||
run: xmake --yes | ||
|
||
# Build the test | ||
- name: Build Test | ||
run: xmake build --yes Test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
# 🏗️ xmake build | ||
To build on Windows (if you don't use [WSL](https://learn.microsoft.com/en-us/windows/wsl/install)) or on other OS, the MacroLibX uses [xmake](https://xmake.io), a build system which will download and compile all dependencies it won't find on your computer. | ||
|
||
## 💾 Install xmake | ||
You can find how to install it on your system [here](https://xmake.io/#/guide/installation). Note that you can also download a [portable version](https://github.com/xmake-io/xmake/releases) of xmake if you wish not to install it. | ||
|
||
## ⚙️ Configure the MacroLibX build | ||
Just as the Makfile build system, you can configure how xmake should build the MacroLibX. The base command to configure it is `xmake config [opts...]` or `xmake f [opts...]`. | ||
|
||
### 📦 Compile mode | ||
You can configure xmake to build the mlx in debug mode or in release mode (release mode is enabled by default). To do so you can use `xmake config --mode=debug` or `xmake config --mode=release`. | ||
|
||
### 🛠️ Set the toolchain | ||
To change the compilation toolchain using `xmake config --toolchain=[gcc|clang|...]` | ||
|
||
### 🖼️ Image optimisations | ||
If you run into glitches when writing or reading pixels from images you can turn off image optimisations using `xmake config --images_optimized=n`. | ||
|
||
### 🖥️ Force the use of 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 using that. | ||
|
||
### 💽 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`. | ||
|
||
### 🪛 A possible build configuration | ||
As a configuration example here's how the command can look like `xmake config --mode=debug --toolchain=clang --graphics_memory_dump=y --images_optimized=n` | ||
|
||
## 🚧 Build the lib | ||
|
||
### Compile using command-line (first method) | ||
Once you're ready to compile the lib, run `xmake` (or `xmake -jX` if you wish not to use all your computer threads, with X being the number of threads you wish to use) and watch as the lib compiles. | ||
|
||
### Generate a project (second method) | ||
xmake can also generate a project file for another tool: | ||
* Visual Studio : `xmake project -k vs` | ||
* CMakeLists.txt (which you can open in CLion and more) : `xmake project -k cmake` | ||
* Makefile : `xmake project -k make` | ||
* Ninja : `xmake project -k ninja` | ||
* XCode : `xmake project -k xcode` | ||
|
||
You should now be able to open the project file with the tool of your choice. | ||
|
||
## 😋 Enjoy | ||
Enjoy you project built with the mlx | ||
<p align="center"> | ||
<img src="./res/screenshot_test_windows.png" alt="drawing" width="400"/> | ||
</p> |
Oops, something went wrong.