mirror of
https://github.com/seekrs/MacroLibX.git
synced 2026-01-11 14:43:34 +00:00
adding xmake support and windows workflow
This commit is contained in:
75
.github/workflows/windows.yml
vendored
git.filemode.normal_file
75
.github/workflows/windows.yml
vendored
git.filemode.normal_file
@@ -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/install-vulkan-sdk@v1.1.1
|
||||
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
|
||||
5
.gitignore
vendored
5
.gitignore
vendored
@@ -4,5 +4,10 @@
|
||||
*.a
|
||||
*.so
|
||||
*.out
|
||||
*.dll
|
||||
*.json
|
||||
.xmake/
|
||||
.cache/
|
||||
build/
|
||||
test/.gdb_history
|
||||
test/Test
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2022/10/04 16:56:35 by maldavid #+# #+# */
|
||||
/* Updated: 2023/12/08 12:14:31 by kbz_8 ### ########.fr */
|
||||
/* Updated: 2023/12/08 14:09:31 by kbz_8 ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@@ -19,6 +19,20 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#if defined(_WIN32) || defined(_WIN64)
|
||||
#define MLX_EXPORT __declspec(dllexport)
|
||||
#define MLX_IMPORT __declspec(dllexport)
|
||||
#else
|
||||
#define MLX_EXPORT
|
||||
#define MLX_IMPORT
|
||||
#endif
|
||||
|
||||
#ifdef MLX_BUILD
|
||||
#define MLX_API MLX_EXPORT
|
||||
#else
|
||||
#define MLX_API MLX_IMPORT
|
||||
#endif
|
||||
|
||||
typedef enum
|
||||
{
|
||||
MLX_KEYDOWN = 0,
|
||||
@@ -34,7 +48,7 @@ typedef enum
|
||||
*
|
||||
* @return (void*) An opaque pointer to the internal MLX application or NULL (0x0) in case of error
|
||||
*/
|
||||
void* mlx_init();
|
||||
MLX_API void* mlx_init();
|
||||
|
||||
/**
|
||||
* @brief Creates a new window
|
||||
@@ -46,7 +60,7 @@ void* mlx_init();
|
||||
*
|
||||
* @return (void*) An opaque pointer to the internal MLX window or NULL (0x0) in case of error
|
||||
*/
|
||||
void* mlx_new_window(void* mlx, int w, int h, const char* title);
|
||||
MLX_API void* mlx_new_window(void* mlx, int w, int h, const char* title);
|
||||
|
||||
/**
|
||||
* @brief Gives a function to be executed at each loop turn
|
||||
@@ -58,7 +72,7 @@ void* mlx_new_window(void* mlx, int w, int h, const char* title);
|
||||
* @return (int) Always return 0, made this to copy the behaviour of the original MLX
|
||||
*/
|
||||
|
||||
int mlx_loop_hook(void* mlx, int (*f)(), void* param);
|
||||
MLX_API int mlx_loop_hook(void* mlx, int (*f)(), void* param);
|
||||
|
||||
/**
|
||||
* @brief Starts the internal main loop
|
||||
@@ -67,7 +81,7 @@ int mlx_loop_hook(void* mlx, int (*f)(), void* param);
|
||||
*
|
||||
* @return (int) Always return 0, made this to copy the behaviour of the original MLX
|
||||
*/
|
||||
int mlx_loop(void* mlx);
|
||||
MLX_API int mlx_loop(void* mlx);
|
||||
|
||||
/**
|
||||
* @brief Ends the internal main loop
|
||||
@@ -76,21 +90,21 @@ int mlx_loop(void* mlx);
|
||||
*
|
||||
* @return (int) Always return 0, made this to copy the behaviour of the original MLX
|
||||
*/
|
||||
int mlx_loop_end(void* mlx);
|
||||
MLX_API int mlx_loop_end(void* mlx);
|
||||
|
||||
/**
|
||||
* @brief Shows mouse cursor
|
||||
*
|
||||
* @return (int) Always return 0, made this to copy the behaviour of the original MLX
|
||||
*/
|
||||
int mlx_mouse_show();
|
||||
MLX_API int mlx_mouse_show();
|
||||
|
||||
/**
|
||||
* @brief Hides mouse cursor
|
||||
*
|
||||
* @return (int) Always return 0, made this to copy the behaviour of the original MLX
|
||||
*/
|
||||
int mlx_mouse_hide();
|
||||
MLX_API int mlx_mouse_hide();
|
||||
|
||||
/**
|
||||
* @brief Moves cursor to givent position
|
||||
@@ -102,7 +116,7 @@ int mlx_mouse_hide();
|
||||
*
|
||||
* @return (int) Always return 0, made this to copy the behaviour of the original MLX
|
||||
*/
|
||||
int mlx_mouse_move(void* mlx, void* win, int x, int y);
|
||||
MLX_API int mlx_mouse_move(void* mlx, void* win, int x, int y);
|
||||
|
||||
/**
|
||||
* @brief Get cursor's position
|
||||
@@ -113,7 +127,7 @@ int mlx_mouse_move(void* mlx, void* win, int x, int y);
|
||||
*
|
||||
* @return (int) Always return 0, made this to copy the behaviour of the original MLX
|
||||
*/
|
||||
int mlx_mouse_get_pos(void* mlx, int* x, int* y);
|
||||
MLX_API int mlx_mouse_get_pos(void* mlx, int* x, int* y);
|
||||
|
||||
|
||||
/**
|
||||
@@ -127,7 +141,7 @@ int mlx_mouse_get_pos(void* mlx, int* x, int* y);
|
||||
*
|
||||
* @return (int) Always return 0, made this to copy the behaviour of the original MLX
|
||||
*/
|
||||
int mlx_on_event(void* mlx, void* win, mlx_event_type event, int (*f)(), void* param);
|
||||
MLX_API int mlx_on_event(void* mlx, void* win, mlx_event_type event, int (*f)(), void* param);
|
||||
|
||||
|
||||
/**
|
||||
@@ -144,7 +158,7 @@ int mlx_on_event(void* mlx, void* win, mlx_event_type event, int (*f)(), void* p
|
||||
*
|
||||
* @return (int) Always return 0, made this to copy the behaviour of the original MLX
|
||||
*/
|
||||
int mlx_pixel_put(void* mlx, void* win, int x, int y, int color);
|
||||
MLX_API int mlx_pixel_put(void* mlx, void* win, int x, int y, int color);
|
||||
|
||||
|
||||
/**
|
||||
@@ -156,7 +170,7 @@ int mlx_pixel_put(void* mlx, void* win, int x, int y, int color);
|
||||
*
|
||||
* @return (void*) An opaque pointer to the internal image or NULL (0x0) in case of error
|
||||
*/
|
||||
void* mlx_new_image(void* mlx, int width, int height);
|
||||
MLX_API void* mlx_new_image(void* mlx, int width, int height);
|
||||
|
||||
/**
|
||||
* @brief Get image pixel data
|
||||
@@ -176,7 +190,7 @@ void* mlx_new_image(void* mlx, int width, int height);
|
||||
* ~ make IMAGES_OPTIMIZED=false
|
||||
* ```
|
||||
*/
|
||||
int mlx_get_image_pixel(void* mlx, void* img, int x, int y);
|
||||
MLX_API int mlx_get_image_pixel(void* mlx, void* img, int x, int y);
|
||||
|
||||
/**
|
||||
* @brief Set image pixel data
|
||||
@@ -197,7 +211,7 @@ int mlx_get_image_pixel(void* mlx, void* img, int x, int y);
|
||||
* ~ make IMAGES_OPTIMIZED=false
|
||||
* ```
|
||||
*/
|
||||
void mlx_set_image_pixel(void* mlx, void* img, int x, int y, int color);
|
||||
MLX_API void mlx_set_image_pixel(void* mlx, void* img, int x, int y, int color);
|
||||
|
||||
/**
|
||||
* @brief Put image to the given window
|
||||
@@ -210,7 +224,7 @@ void mlx_set_image_pixel(void* mlx, void* img, int x, int y, int color);
|
||||
*
|
||||
* @return (int) Always return 0, made this to copy the behaviour of the original MLX
|
||||
*/
|
||||
int mlx_put_image_to_window(void* mlx, void* win, void* img, int x, int y);
|
||||
MLX_API int mlx_put_image_to_window(void* mlx, void* win, void* img, int x, int y);
|
||||
|
||||
/**
|
||||
* @brief Destroys internal image
|
||||
@@ -220,7 +234,7 @@ int mlx_put_image_to_window(void* mlx, void* win, void* img, int x, int y);
|
||||
*
|
||||
* @return (int) Always return 0, made this to copy the behaviour of the original MLX
|
||||
*/
|
||||
int mlx_destroy_image(void* mlx, void* img);
|
||||
MLX_API int mlx_destroy_image(void* mlx, void* img);
|
||||
|
||||
|
||||
/**
|
||||
@@ -233,7 +247,7 @@ int mlx_destroy_image(void* mlx, void* img);
|
||||
*
|
||||
* @return (void*) An opaque pointer to the internal image or NULL (0x0) in case of error
|
||||
*/
|
||||
void* mlx_png_file_to_image(void* mlx, char* filename, int* width, int* height);
|
||||
MLX_API void* mlx_png_file_to_image(void* mlx, char* filename, int* width, int* height);
|
||||
|
||||
/**
|
||||
* @brief Create a new image from a jpg file
|
||||
@@ -245,7 +259,7 @@ void* mlx_png_file_to_image(void* mlx, char* filename, int* width, int* height);
|
||||
*
|
||||
* @return (void*) An opaque pointer to the internal image or NULL (0x0) in case of error
|
||||
*/
|
||||
void* mlx_jpg_file_to_image(void* mlx, char* filename, int* width, int* height);
|
||||
MLX_API void* mlx_jpg_file_to_image(void* mlx, char* filename, int* width, int* height);
|
||||
|
||||
/**
|
||||
* @brief Create a new image from a bmp file
|
||||
@@ -257,7 +271,7 @@ void* mlx_jpg_file_to_image(void* mlx, char* filename, int* width, int* height);
|
||||
*
|
||||
* @return (void*) An opaque pointer to the internal image or NULL (0x0) in case of error
|
||||
*/
|
||||
void* mlx_bmp_file_to_image(void* mlx, char* filename, int* width, int* height);
|
||||
MLX_API void* mlx_bmp_file_to_image(void* mlx, char* filename, int* width, int* height);
|
||||
|
||||
|
||||
/**
|
||||
@@ -272,7 +286,7 @@ void* mlx_bmp_file_to_image(void* mlx, char* filename, int* width, int* height);
|
||||
*
|
||||
* @return (int) Always return 0, made this to copy the behaviour of the original MLX
|
||||
*/
|
||||
int mlx_string_put(void* mlx, void* win, int x, int y, int color, char* str);
|
||||
MLX_API int mlx_string_put(void* mlx, void* win, int x, int y, int color, char* str);
|
||||
|
||||
|
||||
/**
|
||||
@@ -284,7 +298,7 @@ int mlx_string_put(void* mlx, void* win, int x, int y, int color, char* str);
|
||||
*
|
||||
* @return (void)
|
||||
*/
|
||||
void mlx_set_font(void* mlx, void* win, char* filepath);
|
||||
MLX_API void mlx_set_font(void* mlx, void* win, char* filepath);
|
||||
|
||||
/**
|
||||
* @brief Loads a font to be used by `mlx_string_put` and scales it
|
||||
@@ -296,7 +310,7 @@ void mlx_set_font(void* mlx, void* win, char* filepath);
|
||||
*
|
||||
* @return (void)
|
||||
*/
|
||||
void mlx_set_font_scale(void* mlx, void* win, char* filepath, float scale);
|
||||
MLX_API void mlx_set_font_scale(void* mlx, void* win, char* filepath, float scale);
|
||||
|
||||
|
||||
/**
|
||||
@@ -307,7 +321,7 @@ void mlx_set_font_scale(void* mlx, void* win, char* filepath, float scale);
|
||||
*
|
||||
* @return (int) Always return 0, made this to copy the behaviour of the original MLX
|
||||
*/
|
||||
int mlx_clear_window(void* mlx, void* win);
|
||||
MLX_API int mlx_clear_window(void* mlx, void* win);
|
||||
|
||||
|
||||
/**
|
||||
@@ -318,7 +332,7 @@ int mlx_clear_window(void* mlx, void* win);
|
||||
*
|
||||
* @return (int) Always return 0, made this to copy the behaviour of the original MLX
|
||||
*/
|
||||
int mlx_destroy_window(void* mlx, void* win);
|
||||
MLX_API int mlx_destroy_window(void* mlx, void* win);
|
||||
|
||||
/**
|
||||
* @brief Destroy internal MLX application
|
||||
@@ -327,7 +341,7 @@ int mlx_destroy_window(void* mlx, void* win);
|
||||
*
|
||||
* @return (int) Always return 0, made this to copy the behaviour of the original MLX
|
||||
*/
|
||||
int mlx_destroy_display(void* mlx);
|
||||
MLX_API int mlx_destroy_display(void* mlx);
|
||||
|
||||
|
||||
/**
|
||||
@@ -339,7 +353,7 @@ int mlx_destroy_display(void* mlx);
|
||||
*
|
||||
* @return (int) Always return 0, made this to copy the behaviour of the original MLX
|
||||
*/
|
||||
int mlx_get_screens_size(void* mlx, int* w, int* h);
|
||||
MLX_API int mlx_get_screens_size(void* mlx, int* w, int* h);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
27194
objs/xmake/linux_x86_64/libmlx/linux/x86_64/release/src/core/__cpp_application.cpp-33125923.cpp.tmp
git.filemode.normal_file
27194
objs/xmake/linux_x86_64/libmlx/linux/x86_64/release/src/core/__cpp_application.cpp-33125923.cpp.tmp
git.filemode.normal_file
File diff suppressed because it is too large
Load Diff
6401
objs/xmake/linux_x86_64/libmlx/linux/x86_64/release/src/core/__cpp_bridge.cpp-eb644723.cpp.tmp
git.filemode.normal_file
6401
objs/xmake/linux_x86_64/libmlx/linux/x86_64/release/src/core/__cpp_bridge.cpp-eb644723.cpp.tmp
git.filemode.normal_file
File diff suppressed because it is too large
Load Diff
38940
objs/xmake/linux_x86_64/libmlx/linux/x86_64/release/src/platform/__cpp_inputs.cpp-7e53d83f.cpp.tmp
git.filemode.normal_file
38940
objs/xmake/linux_x86_64/libmlx/linux/x86_64/release/src/platform/__cpp_inputs.cpp-7e53d83f.cpp.tmp
git.filemode.normal_file
File diff suppressed because it is too large
Load Diff
37918
objs/xmake/linux_x86_64/libmlx/linux/x86_64/release/src/renderer/__cpp_text_pipeline.cpp-cd270745.cpp.tmp
git.filemode.normal_file
37918
objs/xmake/linux_x86_64/libmlx/linux/x86_64/release/src/renderer/__cpp_text_pipeline.cpp-cd270745.cpp.tmp
git.filemode.normal_file
File diff suppressed because it is too large
Load Diff
34132
objs/xmake/linux_x86_64/libmlx/linux/x86_64/release/src/renderer/descriptors/__cpp_vk_descriptor_set.cpp-e50198dc.cpp.tmp
git.filemode.normal_file
34132
objs/xmake/linux_x86_64/libmlx/linux/x86_64/release/src/renderer/descriptors/__cpp_vk_descriptor_set.cpp-e50198dc.cpp.tmp
git.filemode.normal_file
File diff suppressed because it is too large
Load Diff
18406
objs/xmake/linux_x86_64/libmlx/linux/x86_64/release/src/renderer/swapchain/__cpp_vk_swapchain.cpp-ea9c7bae.cpp.tmp
git.filemode.normal_file
18406
objs/xmake/linux_x86_64/libmlx/linux/x86_64/release/src/renderer/swapchain/__cpp_vk_swapchain.cpp-ea9c7bae.cpp.tmp
git.filemode.normal_file
File diff suppressed because it is too large
Load Diff
@@ -6,7 +6,7 @@
|
||||
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2022/10/04 22:10:52 by maldavid #+# #+# */
|
||||
/* Updated: 2023/11/20 07:29:12 by maldavid ### ########.fr */
|
||||
/* Updated: 2023/12/08 13:32:18 by kbz_8 ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
||||
74
xmake.lua
git.filemode.normal_file
74
xmake.lua
git.filemode.normal_file
@@ -0,0 +1,74 @@
|
||||
--------------------------------------------------------------------------------
|
||||
-- --
|
||||
-- ::: :::::::: --
|
||||
-- xmake.lua :+: :+: :+: --
|
||||
-- +:+ +:+ +:+ --
|
||||
-- By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ --
|
||||
-- +#+#+#+#+#+ +#+ --
|
||||
-- Created: 2023/12/07 15:21:38 by kbz_8 #+# #+# --
|
||||
-- Updated: 2023/12/07 15:21:38 by kbz_8 ### ########.fr --
|
||||
-- --
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
-- Global settings
|
||||
|
||||
add_requires("libsdl", "vulkan-headers")
|
||||
|
||||
add_rules("mode.debug", "mode.release")
|
||||
set_languages("cxx17")
|
||||
|
||||
set_objectdir("objs/xmake/$(os)_$(arch)")
|
||||
set_targetdir("./")
|
||||
|
||||
set_optimize("fastest")
|
||||
|
||||
-- Options
|
||||
|
||||
option("images_optimized")
|
||||
set_default(true)
|
||||
add_defines("IMAGE_OPTIMIZED")
|
||||
option_end()
|
||||
|
||||
option("force_integrated_gpu")
|
||||
set_default(false)
|
||||
add_defines("FORCE_INTEGRATED_GPU")
|
||||
option_end()
|
||||
|
||||
option("graphics_memory_dump")
|
||||
set_default(false)
|
||||
add_defines("GRAPHICS_MEMORY_DUMP")
|
||||
option_end()
|
||||
|
||||
-- Targets
|
||||
|
||||
target("mlx")
|
||||
set_default(true)
|
||||
set_license("MIT")
|
||||
set_kind("shared")
|
||||
add_options("images_optimized")
|
||||
add_options("force_integrated_gpu")
|
||||
add_options("graphics_memory_dump")
|
||||
add_includedirs("includes", "src", "third_party")
|
||||
|
||||
add_defines("MLX_BUILD")
|
||||
|
||||
add_files("src/**.cpp")
|
||||
|
||||
add_packages("libsdl", "vulkan-headers")
|
||||
|
||||
if is_mode("debug") then
|
||||
add_defines("DEBUG")
|
||||
end
|
||||
target_end() -- optional but I think the code is cleaner with this -- optional but I think the code is cleaner with this
|
||||
|
||||
target("Test")
|
||||
set_default(false)
|
||||
set_kind("binary")
|
||||
set_targetdir("test")
|
||||
|
||||
add_deps("mlx")
|
||||
|
||||
add_files("test/main.c")
|
||||
|
||||
add_packages("libsdl")
|
||||
target_end()
|
||||
Reference in New Issue
Block a user