Skip to content

Commit dc92dcc

Browse files
authored
Merge branch 'master' into master
2 parents aa3abd5 + 7f95e70 commit dc92dcc

File tree

14 files changed

+683
-133
lines changed

14 files changed

+683
-133
lines changed

.github/workflows/wasm.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# Simple workflow for deploying static content to GitHub Pages
2+
name: Deploy static content to Pages
3+
4+
on:
5+
workflow_dispatch:
6+
7+
permissions:
8+
contents: read
9+
pages: write
10+
id-token: write
11+
12+
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
13+
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
14+
concurrency:
15+
group: "pages"
16+
cancel-in-progress: false
17+
18+
# Single deploy job since we're just deploying
19+
jobs:
20+
deploy:
21+
environment:
22+
name: github-pages
23+
url: ${{ steps.deployment.outputs.page_url }}
24+
runs-on: ubuntu-latest
25+
#TODO: add a build step to get the wasm file instead of commiting it.
26+
#Doesn't really matter atm since the git history is polluted anyway
27+
steps:
28+
- name: Checkout
29+
uses: actions/checkout@v4
30+
- name: Setup Pages
31+
uses: actions/configure-pages@v5
32+
- name: Upload artifact
33+
uses: actions/upload-pages-artifact@v3
34+
with:
35+
path: './web'
36+
- name: Deploy to GitHub Pages
37+
id: deployment
38+
uses: actions/deploy-pages@v4

CMakeLists.txt

Lines changed: 52 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
# CMake specifications
77
# -----------------------------------------------------------------------------
88
cmake_minimum_required (VERSION 3.16)
9-
project(mlx42 VERSION 2.3.2)
9+
project(mlx42 VERSION 2.4.1)
1010
message(STATUS "MLX42 @ ${CMAKE_PROJECT_VERSION}")
1111

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

37-
if(UNIX)
38-
set(CCSHADER ${PROJECT_SOURCE_DIR}/tools/compile_shader.sh)
37+
if(UNIX AND NOT EMSCRIPTEN)
3938
add_compile_options(
4039
-Wextra
4140
-Wall
4241
-Werror
4342
-Wunreachable-code
44-
43+
4544
# Some low priority warnings that are annoying.
4645
-Wno-char-subscripts
4746
-Wno-sign-compare
@@ -58,31 +57,44 @@ if(UNIX)
5857
endif(DEBUG)
5958
else()
6059
# TODO: Figure out what we need for windows.
61-
set(CCSHADER ${PROJECT_SOURCE_DIR}/tools/compile_shader.bat)
6260
endif()
6361

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

66+
if (UNIX)
67+
set(CCSHADER ${TOOLS_DIR}/compile_shader.sh)
68+
else()
69+
set(CCSHADER ${TOOLS_DIR}/compile_shader.bat)
70+
endif()
71+
72+
if(EMSCRIPTEN)
73+
set(EMSCRIPTEN_VALUE 1)
74+
else()
75+
set(EMSCRIPTEN_VALUE 0)
76+
endif()
77+
78+
# Add custom command for fragment shader
6879
add_custom_command(
69-
COMMENT "Building fragment shader"
70-
DEPENDS ${PROJECT_SOURCE_DIR}/shaders/default.frag
71-
OUTPUT mlx_frag_shader.c
72-
COMMAND ${CCSHADER} ${PROJECT_SOURCE_DIR}/shaders/default.frag > mlx_frag_shader.c
73-
VERBATIM
74-
PRE_BUILD
75-
USES_TERMINAL
80+
COMMENT "Building fragment shader"
81+
DEPENDS ${PROJECT_SOURCE_DIR}/shaders/default.frag
82+
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/mlx_frag_shader.c
83+
COMMAND ${CCSHADER} ${PROJECT_SOURCE_DIR}/shaders/default.frag ${EMSCRIPTEN_VALUE} > ${CMAKE_CURRENT_BINARY_DIR}/mlx_frag_shader.c
84+
VERBATIM
85+
PRE_BUILD
86+
USES_TERMINAL
7687
)
7788

89+
# Add custom command for vertex shader
7890
add_custom_command(
79-
COMMENT "Building vertex shader"
80-
DEPENDS ${PROJECT_SOURCE_DIR}/shaders/default.vert
81-
OUTPUT mlx_vert_shader.c
82-
COMMAND ${CCSHADER} ${PROJECT_SOURCE_DIR}/shaders/default.vert > mlx_vert_shader.c
83-
VERBATIM
84-
PRE_BUILD
85-
USES_TERMINAL
91+
COMMENT "Building vertex shader"
92+
DEPENDS ${PROJECT_SOURCE_DIR}/shaders/default.vert
93+
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/mlx_vert_shader.c
94+
COMMAND ${CCSHADER} ${PROJECT_SOURCE_DIR}/shaders/default.vert ${EMSCRIPTEN_VALUE} > ${CMAKE_CURRENT_BINARY_DIR}/mlx_vert_shader.c
95+
VERBATIM
96+
PRE_BUILD
97+
USES_TERMINAL
8698
)
8799

88100
# Sources
@@ -125,29 +137,32 @@ target_include_directories(mlx42 PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include)
125137
# Dependencies
126138
# -----------------------------------------------------------------------------
127139

128-
find_package(glfw3)
129140
find_package(OpenGL REQUIRED)
130141

131-
target_link_libraries(mlx42 OpenGL::GL)
132-
if (NOT glfw3_FOUND AND GLFW_FETCH)
133-
message(STATUS "Install GLFW to suppress this message")
134-
message(STATUS "Please wait, fetching GLFW ...")
135-
include(${CMAKE_DIR}/LinkGLFW.cmake)
136-
LinkGLFW(mlx42)
137-
elseif(NOT glfw3_FOUND AND NOT GLFW_FETCH)
138-
message(FATAL_ERROR "Unable to build: GLFW can't be found nor fetched.")
139-
endif()
140-
141-
if (glfw3_FOUND)
142-
target_link_libraries(mlx42 ${GLFW3_LIBRARY})
143-
endif()
144-
if(APPLE)
145-
target_link_libraries(mlx42 "-framework Cocoa" "-framework IOKit")
142+
if(EMSCRIPTEN)
143+
target_link_libraries(mlx42 "-s USE_GLFW=3" "-s FULL_ES3=1")
144+
else()
145+
target_link_libraries(mlx42 OpenGL::GL)
146+
find_package(glfw3)
147+
if (glfw3_FOUND)
148+
target_link_libraries(mlx42 ${GLFW3_LIBRARY})
149+
endif()
150+
if (NOT glfw3_FOUND AND GLFW_FETCH)
151+
message(STATUS "Install GLFW to suppress this message")
152+
message(STATUS "Please wait, fetching GLFW ...")
153+
include(${CMAKE_DIR}/LinkGLFW.cmake)
154+
LinkGLFW(mlx42)
155+
elseif(NOT glfw3_FOUND AND NOT GLFW_FETCH)
156+
message(FATAL_ERROR "Unable to build: GLFW can't be found nor fetched.")
157+
endif()
158+
if(APPLE)
159+
target_link_libraries(mlx42 "-framework Cocoa" "-framework IOKit")
160+
endif()
146161
endif()
147162

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

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

170185
install(
171186
DIRECTORY ./include/MLX42 DESTINATION ${CMAKE_INSTALL_PREFIX}/include

README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<img src="https://user-images.githubusercontent.com/63303990/150698103-7e908ff3-abf8-4b0f-ad54-07a76b6c45e2.png" alt="42MLX_Logo">
44
</div>
55
<div align="center">
6-
<sub>Written by <a href="https://portfolio.w2wizard.dev/">W2.Wizard</a> for the 42 Network</sub>
6+
<sub>Written by <a href="https://portfolio.w2wizard.dev/">W2.Wizard</a> for Codam</sub>
77
<div align="center">
88
</br>
99
<img src="https://img.shields.io/github/license/codam-coding-college/MLX42" alt="License GPL2.0">
@@ -16,6 +16,9 @@ MLX42 is a performant, easy to use, cross-platform, minimal windowing graphics l
1616

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

19+
> [!IMPORTANT]
20+
> 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.
21+
1922
# Features ✨
2023

2124
this fork is to adapt the lib to the computer of 42 Le Havre

docs/42.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,29 +29,30 @@ It addresses one of the main problems at 42, which is that although it is a tech
2929
| Mulhouse || |
3030
| Quebec || |
3131
| Belo Horizonte || |
32+
| London || Just because ? |
3233
| São Paulo || |
3334
| Rio || |
3435
| Malaga || |
3536
| Singapore || Asked their pedago, awaiting a response.|
3637
| Barcelona || Would like propose some modifications preferably |
3738
| Nice || Banned `mlx_put_pixel` & `mlx_resize_image` otherwise fully authorized 🎊 |
38-
| Berlin || Available at `usr/local/bin/minilibx` |
39+
| Berlin || Banned `mlx_put_pixel` & `mlx_resize_image` otherwise fully authorized 🎊` |
3940
| Heilbronn || |
4041
| 1337 || 1337 Refers to every campus part of 1337 |
4142
| Angoulême || |
4243
| Lausanne || No idea how to reach them |
4344
| Prague || |
44-
| 19 | | Inquired and interested on it but no further details |
45+
| 19 | | No reason (?) You can probably blame paris again I guess |
4546
| Hive || |
4647
| Le Havre || |
4748
| Vienna || |
4849
| Seoul || I didn't really understand why but basically as long as Paris says no they will too |
49-
| Madrid | | They Tolerate it but it's up to the evaluator to decide because it's not part of the subject. |
50+
| Madrid | | Authorized since the Linux migration |
5051
| Porto || Not Auth from Paris|
5152
| Lisboa || Not Auth from Paris|
5253
| Wolfsburg || Not Auth from Paris|
5354
| Urduliz || Not Auth from Paris|
54-
| Paris || Because its Paris 🤡|
55+
| Paris || Because its Paris 🤡🤡🤡|
5556

5657
Regarding other campuses the status is unknown.
5758

include/MLX42/MLX42.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,13 @@
1212

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

0 commit comments

Comments
 (0)