Skip to content

Commit fb233fe

Browse files
Jeroenvh99W2Wizard
andauthored
Cmake fix (#74)
* added to the build instructions * added a check to install glfw * Print message to fetch GLFW * Specify the usage of threads --------- Co-authored-by: W2.Wizard <[email protected]>
1 parent 578c732 commit fb233fe

File tree

2 files changed

+8
-20
lines changed

2 files changed

+8
-20
lines changed

CMakeLists.txt

Lines changed: 6 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -118,24 +118,11 @@ target_include_directories(mlx42 PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include)
118118
# Dependencies
119119
# -----------------------------------------------------------------------------
120120

121-
# TODO: Check if GLFW is installed, if not clone, build and install it.
122-
# Run post build to install the glfw lib on the system.
123-
124-
# What we really want is for this to be so automated that even the laziest
125-
# person can just clone the repo, run the build script and it will just work.
126-
127-
# Ideally we want to pass in an option to build it in such a way that sysadmins
128-
# can just install it on their system instead of having the user install it.
129-
# E.g: For 42 Clusters and such.
130-
131-
# You can uncomment this line to download and build glfw for you.
132-
# However the linking to the lib might be a bit akward but you can just move
133-
# the static lib out of deps directory. Keep in mind that you need comment out the
134-
# find_package function below.
135-
136-
# include(${CMAKE_DIR}/LinkGLFW.cmake)
137-
# LinkGLFW(mlx42)
138-
139-
find_package(glfw3 REQUIRED)
121+
find_package(glfw3)
122+
if(NOT glfw3_FOUND)
123+
message("-- Please wait, fetching GLFW ...")
124+
include(${CMAKE_DIR}/LinkGLFW.cmake)
125+
LinkGLFW(mlx42)
126+
endif()
140127
find_package(OpenGL REQUIRED)
141128
target_link_libraries(mlx42 OpenGL::GL glfw)

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,8 +180,9 @@ Of course its up to you to make sure that the code you write is portable. Things
180180

181181
```bash
182182
~ git clone https://github.com/codam-coding-college/MLX42.git
183+
~ cd MLX42
183184
~ cmake -B build
184-
~ cmake --build build
185+
~ cmake --build build -j4
185186
```
186187

187188
The output library file is called `libmlx42.a`.

0 commit comments

Comments
 (0)