Skip to content

Commit

Permalink
Merge branch 'master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
kodokaii authored Nov 13, 2024
2 parents aa3abd5 + 7f95e70 commit dc92dcc
Show file tree
Hide file tree
Showing 14 changed files with 683 additions and 133 deletions.
38 changes: 38 additions & 0 deletions .github/workflows/wasm.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Simple workflow for deploying static content to GitHub Pages
name: Deploy static content to Pages

on:
workflow_dispatch:

permissions:
contents: read
pages: write
id-token: write

# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency:
group: "pages"
cancel-in-progress: false

# Single deploy job since we're just deploying
jobs:
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
#TODO: add a build step to get the wasm file instead of commiting it.
#Doesn't really matter atm since the git history is polluted anyway
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Pages
uses: actions/configure-pages@v5
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: './web'
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
89 changes: 52 additions & 37 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# CMake specifications
# -----------------------------------------------------------------------------
cmake_minimum_required (VERSION 3.16)
project(mlx42 VERSION 2.3.2)
project(mlx42 VERSION 2.4.1)
message(STATUS "MLX42 @ ${CMAKE_PROJECT_VERSION}")

# Variables
Expand Down Expand Up @@ -34,14 +34,13 @@ set(BUILD_TESTS OFF CACHE BOOL "Build the tests to verify the integrity of the l
add_definitions(-D LODEPNG_NO_COMPILE_ENCODER)
add_definitions(-D LODEPNG_NO_COMPILE_ANCILLARY_CHUNKS)

if(UNIX)
set(CCSHADER ${PROJECT_SOURCE_DIR}/tools/compile_shader.sh)
if(UNIX AND NOT EMSCRIPTEN)
add_compile_options(
-Wextra
-Wall
-Werror
-Wunreachable-code

# Some low priority warnings that are annoying.
-Wno-char-subscripts
-Wno-sign-compare
Expand All @@ -58,31 +57,44 @@ if(UNIX)
endif(DEBUG)
else()
# TODO: Figure out what we need for windows.
set(CCSHADER ${PROJECT_SOURCE_DIR}/tools/compile_shader.bat)
endif()

# Build specific files
# @see https://cmake.org/cmake/help/latest/command/add_custom_command.html
# -----------------------------------------------------------------------------

if (UNIX)
set(CCSHADER ${TOOLS_DIR}/compile_shader.sh)
else()
set(CCSHADER ${TOOLS_DIR}/compile_shader.bat)
endif()

if(EMSCRIPTEN)
set(EMSCRIPTEN_VALUE 1)
else()
set(EMSCRIPTEN_VALUE 0)
endif()

# Add custom command for fragment shader
add_custom_command(
COMMENT "Building fragment shader"
DEPENDS ${PROJECT_SOURCE_DIR}/shaders/default.frag
OUTPUT mlx_frag_shader.c
COMMAND ${CCSHADER} ${PROJECT_SOURCE_DIR}/shaders/default.frag > mlx_frag_shader.c
VERBATIM
PRE_BUILD
USES_TERMINAL
COMMENT "Building fragment shader"
DEPENDS ${PROJECT_SOURCE_DIR}/shaders/default.frag
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/mlx_frag_shader.c
COMMAND ${CCSHADER} ${PROJECT_SOURCE_DIR}/shaders/default.frag ${EMSCRIPTEN_VALUE} > ${CMAKE_CURRENT_BINARY_DIR}/mlx_frag_shader.c
VERBATIM
PRE_BUILD
USES_TERMINAL
)

# Add custom command for vertex shader
add_custom_command(
COMMENT "Building vertex shader"
DEPENDS ${PROJECT_SOURCE_DIR}/shaders/default.vert
OUTPUT mlx_vert_shader.c
COMMAND ${CCSHADER} ${PROJECT_SOURCE_DIR}/shaders/default.vert > mlx_vert_shader.c
VERBATIM
PRE_BUILD
USES_TERMINAL
COMMENT "Building vertex shader"
DEPENDS ${PROJECT_SOURCE_DIR}/shaders/default.vert
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/mlx_vert_shader.c
COMMAND ${CCSHADER} ${PROJECT_SOURCE_DIR}/shaders/default.vert ${EMSCRIPTEN_VALUE} > ${CMAKE_CURRENT_BINARY_DIR}/mlx_vert_shader.c
VERBATIM
PRE_BUILD
USES_TERMINAL
)

# Sources
Expand Down Expand Up @@ -125,29 +137,32 @@ target_include_directories(mlx42 PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include)
# Dependencies
# -----------------------------------------------------------------------------

find_package(glfw3)
find_package(OpenGL REQUIRED)

target_link_libraries(mlx42 OpenGL::GL)
if (NOT glfw3_FOUND AND GLFW_FETCH)
message(STATUS "Install GLFW to suppress this message")
message(STATUS "Please wait, fetching GLFW ...")
include(${CMAKE_DIR}/LinkGLFW.cmake)
LinkGLFW(mlx42)
elseif(NOT glfw3_FOUND AND NOT GLFW_FETCH)
message(FATAL_ERROR "Unable to build: GLFW can't be found nor fetched.")
endif()

if (glfw3_FOUND)
target_link_libraries(mlx42 ${GLFW3_LIBRARY})
endif()
if(APPLE)
target_link_libraries(mlx42 "-framework Cocoa" "-framework IOKit")
if(EMSCRIPTEN)
target_link_libraries(mlx42 "-s USE_GLFW=3" "-s FULL_ES3=1")
else()
target_link_libraries(mlx42 OpenGL::GL)
find_package(glfw3)
if (glfw3_FOUND)
target_link_libraries(mlx42 ${GLFW3_LIBRARY})
endif()
if (NOT glfw3_FOUND AND GLFW_FETCH)
message(STATUS "Install GLFW to suppress this message")
message(STATUS "Please wait, fetching GLFW ...")
include(${CMAKE_DIR}/LinkGLFW.cmake)
LinkGLFW(mlx42)
elseif(NOT glfw3_FOUND AND NOT GLFW_FETCH)
message(FATAL_ERROR "Unable to build: GLFW can't be found nor fetched.")
endif()
if(APPLE)
target_link_libraries(mlx42 "-framework Cocoa" "-framework IOKit")
endif()
endif()

# Testing
# -----------------------------------------------------------------------------
# Only build tests if we are the main project or explicitly told to, make sure
# Only build tests if we are the main project or explicitly told to, make sure
# tests are not built when mlx42 is included as a subproject, use MLX42_BUILD_TESTS to overwrite this
# use cmake -DBUILD_TESTS=ON/-DMLX42_BUILD_TESTS=ON to build tests

Expand All @@ -165,7 +180,7 @@ endif()
# This only really useful if you are a system administrator and want to install
# the library to the system, if you are a developer you should just use the
# library as a subproject as you probably don't have (nor really should) have any
# amibitons to use this for anything other than your own school projects.
# ambitions to use this for anything other than your own school projects.

install(
DIRECTORY ./include/MLX42 DESTINATION ${CMAKE_INSTALL_PREFIX}/include
Expand Down
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<img src="https://user-images.githubusercontent.com/63303990/150698103-7e908ff3-abf8-4b0f-ad54-07a76b6c45e2.png" alt="42MLX_Logo">
</div>
<div align="center">
<sub>Written by <a href="https://portfolio.w2wizard.dev/">W2.Wizard</a> for the 42 Network</sub>
<sub>Written by <a href="https://portfolio.w2wizard.dev/">W2.Wizard</a> for Codam</sub>
<div align="center">
</br>
<img src="https://img.shields.io/github/license/codam-coding-college/MLX42" alt="License GPL2.0">
Expand All @@ -16,6 +16,9 @@ MLX42 is a performant, easy to use, cross-platform, minimal windowing graphics l

It provides primitive tools to draw textures onto the window as well as modifying them at runtime as they get displayed on the window.

> [!IMPORTANT]
> At times it may seem like no updates have taken place for a long time. This is expected, the project / lib is considered completed and requires minimal updates. Bug fixes are still guaranteed and the project is still being actively maintained.
# Features ✨

this fork is to adapt the lib to the computer of 42 Le Havre
Expand Down
9 changes: 5 additions & 4 deletions docs/42.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,29 +29,30 @@ It addresses one of the main problems at 42, which is that although it is a tech
| Mulhouse || |
| Quebec || |
| Belo Horizonte || |
| London || Just because ? |
| São Paulo || |
| Rio || |
| Malaga || |
| Singapore || Asked their pedago, awaiting a response.|
| Barcelona || Would like propose some modifications preferably |
| Nice || Banned `mlx_put_pixel` & `mlx_resize_image` otherwise fully authorized 🎊 |
| Berlin || Available at `usr/local/bin/minilibx` |
| Berlin || Banned `mlx_put_pixel` & `mlx_resize_image` otherwise fully authorized 🎊` |
| Heilbronn || |
| 1337 || 1337 Refers to every campus part of 1337 |
| Angoulême || |
| Lausanne || No idea how to reach them |
| Prague || |
| 19 | | Inquired and interested on it but no further details |
| 19 | | No reason (?) You can probably blame paris again I guess |
| Hive || |
| Le Havre || |
| Vienna || |
| Seoul || I didn't really understand why but basically as long as Paris says no they will too |
| Madrid | | They Tolerate it but it's up to the evaluator to decide because it's not part of the subject. |
| Madrid | | Authorized since the Linux migration |
| Porto || Not Auth from Paris|
| Lisboa || Not Auth from Paris|
| Wolfsburg || Not Auth from Paris|
| Urduliz || Not Auth from Paris|
| Paris || Because its Paris 🤡|
| Paris || Because its Paris 🤡🤡🤡|

Regarding other campuses the status is unknown.

Expand Down
4 changes: 2 additions & 2 deletions include/MLX42/MLX42.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@

/**
*
* MLX42 is a cross-platform low level and simple cross-platform graphics
* MLX42 is a cross-platform low level and simple graphics
* library written in C and uses OpenGL and GLFW for it's underlying windowing
* and rendering system.
*
* It's a much more up-to-date alternative to the miniLibX which has been
* extensively proven to be fragile, unmaintained, deprecated and just
* plain painfully bad to work with. Also it's code quality is dubious.
* plain painfully bad to work with. Also its code quality is dubious.
*
* Some structs contain potential void* which are to be ignored as they
* simply represent points of abstraction to the hidden internal header.
Expand Down
Loading

0 comments on commit dc92dcc

Please sign in to comment.