Skip to content

Cmake fix #74

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Feb 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 6 additions & 19 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -118,24 +118,11 @@ target_include_directories(mlx42 PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include)
# Dependencies
# -----------------------------------------------------------------------------

# TODO: Check if GLFW is installed, if not clone, build and install it.
# Run post build to install the glfw lib on the system.

# What we really want is for this to be so automated that even the laziest
# person can just clone the repo, run the build script and it will just work.

# Ideally we want to pass in an option to build it in such a way that sysadmins
# can just install it on their system instead of having the user install it.
# E.g: For 42 Clusters and such.

# You can uncomment this line to download and build glfw for you.
# However the linking to the lib might be a bit akward but you can just move
# the static lib out of deps directory. Keep in mind that you need comment out the
# find_package function below.

# include(${CMAKE_DIR}/LinkGLFW.cmake)
# LinkGLFW(mlx42)

find_package(glfw3 REQUIRED)
find_package(glfw3)
if(NOT glfw3_FOUND)
message("-- Please wait, fetching GLFW ...")
include(${CMAKE_DIR}/LinkGLFW.cmake)
LinkGLFW(mlx42)
endif()
find_package(OpenGL REQUIRED)
target_link_libraries(mlx42 OpenGL::GL glfw)
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -180,8 +180,9 @@ Of course its up to you to make sure that the code you write is portable. Things

```bash
➜ ~ git clone https://github.com/codam-coding-college/MLX42.git
➜ ~ cd MLX42
➜ ~ cmake -B build
➜ ~ cmake --build build
➜ ~ cmake --build build -j4
```

The output library file is called `libmlx42.a`.
Expand Down