mlx repaired

This commit is contained in:
Angel Ortigosa Perez
2026-01-25 14:53:53 +01:00
parent edc4144d38
commit ccde6227cb
20 changed files with 1037 additions and 61 deletions

View File

@@ -6,7 +6,7 @@
# CMake specifications
# -----------------------------------------------------------------------------
cmake_minimum_required (VERSION 3.16.0)
project(mlx42 VERSION 2.4.1)
project(mlx42 VERSION 2.4.2)
message(STATUS "MLX42 @ ${CMAKE_PROJECT_VERSION}")
# Variables
@@ -23,9 +23,11 @@ set_property(GLOBAL PROPERTY USE_FOLDERS ON)
list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake")
# Options
set(DEBUG OFF CACHE BOOL "Build MLX42 in debug mode, enabling assertions")
set(GLFW_FETCH ON CACHE BOOL "Clone and install GLFW")
set(BUILD_TESTS OFF CACHE BOOL "Build the tests to verify the integrity of the lib")
# -----------------------------------------------------------------------------
option(BUILD_SHARED_LIBS "Build mlx42 as a shared library." OFF)
set(DEBUG OFF CACHE BOOL "Build MLX42 in debug mode, enabling assertions")
set(GLFW_FETCH ON CACHE BOOL "Clone and install GLFW")
set(BUILD_TESTS OFF CACHE BOOL "Build the tests to verify the integrity of the lib")
# Compile Options
# -----------------------------------------------------------------------------
@@ -99,7 +101,9 @@ add_custom_command(
# Sources
# -----------------------------------------------------------------------------
add_library(mlx42 STATIC
# The library type is now determined by the BUILD_SHARED_LIBS option.
# By default, it builds a STATIC library.
add_library(mlx42 # Changed from "add_library(mlx42 STATIC"
# Root
${SOURCE_DIR}/mlx_cursor.c
@@ -134,6 +138,16 @@ add_library(mlx42 STATIC
)
target_include_directories(mlx42 PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include)
# Add this block to control symbol visibility for shared library builds
if(BUILD_SHARED_LIBS)
set_target_properties(mlx42 PROPERTIES
C_VISIBILITY_PRESET hidden
CXX_VISIBILITY_PRESET hidden
)
target_compile_definitions(mlx42 PRIVATE MLX42_BUILD_SHARED)
endif()
# Dependencies
# -----------------------------------------------------------------------------