Add MLX42 V2
This commit is contained in:
43
MLX42/cmake/Findglfw3.cmake
Normal file
43
MLX42/cmake/Findglfw3.cmake
Normal file
@ -0,0 +1,43 @@
|
||||
# -----------------------------------------------------------------------------
|
||||
# Codam Coding College, Amsterdam @ 2022-2023 by W2Wizard.
|
||||
# See README in the root project for more information.
|
||||
# -----------------------------------------------------------------------------
|
||||
|
||||
# Try to find GLFW3 library and include path.
|
||||
# Once done this will define:
|
||||
# - GLFW3_FOUND
|
||||
# - GLFW3_INCLUDE_PATH
|
||||
# - GLFW3_LIBRARY
|
||||
|
||||
# Possbile header locations
|
||||
set(_glfw3_HEADER_SEARCH_DIRS
|
||||
"/usr/include"
|
||||
"/usr/local/include"
|
||||
"C:/Program Files/GLFW/include"
|
||||
"C:/Program Files (x86)/GLFW/include"
|
||||
"$ENV{HOME}/.brew/include/"
|
||||
)
|
||||
|
||||
# Possbile library locations
|
||||
set(_glfw3_LIB_SEARCH_DIRS
|
||||
"/usr/lib"
|
||||
"/usr/local/lib"
|
||||
"C:/Program Files/GLFW"
|
||||
"C:/Program Files (x86)/GLFW"
|
||||
"$ENV{HOME}/.brew/lib/"
|
||||
)
|
||||
|
||||
# Search for the header
|
||||
find_path(GLFW3_INCLUDE_PATH "GLFW/glfw3.h" PATHS ${_glfw3_HEADER_SEARCH_DIRS})
|
||||
|
||||
# Search for the library
|
||||
find_library(GLFW3_LIBRARY NAMES glfw3 glfw PATHS ${_glfw3_LIB_SEARCH_DIRS})
|
||||
|
||||
if (GLFW3_INCLUDE_PATH AND GLFW3_LIBRARY)
|
||||
set(glfw3_FOUND "YES")
|
||||
include_directories(${GLFW3_INCLUDE_PATH})
|
||||
message(STATUS "Found GLFW: ${GLFW3_LIBRARY}")
|
||||
else()
|
||||
set(glfw3_FOUND "NO")
|
||||
message(WARNING "Unable to find dependency: GLFW\nDid you install it?")
|
||||
endif()
|
38
MLX42/cmake/LinkGLFW.cmake
Normal file
38
MLX42/cmake/LinkGLFW.cmake
Normal file
@ -0,0 +1,38 @@
|
||||
# -----------------------------------------------------------------------------
|
||||
# Codam Coding College, Amsterdam @ 2022-2023 by W2Wizard.
|
||||
# See README in the root project for more information.
|
||||
# -----------------------------------------------------------------------------
|
||||
|
||||
include(FetchContent)
|
||||
|
||||
macro(LinkGLFW TARGET)
|
||||
FetchContent_Declare(
|
||||
glfw
|
||||
GIT_REPOSITORY https://github.com/glfw/glfw
|
||||
GIT_TAG 3.3.8
|
||||
)
|
||||
|
||||
FetchContent_GetProperties(glfw)
|
||||
|
||||
if (NOT glfw_POPULATED)
|
||||
FetchContent_Populate(glfw)
|
||||
|
||||
# Just configure GLFW only
|
||||
set(GLFW_BUILD_EXAMPLES OFF CACHE BOOL "Build Examples" FORCE)
|
||||
set(GLFW_BUILD_TESTS OFF CACHE BOOL "Build tests" FORCE)
|
||||
set(GLFW_BUILD_DOCS OFF CACHE BOOL "Build docs" FORCE)
|
||||
set(GLFW_INSTALL ON CACHE BOOL "Configure an install" FORCE)
|
||||
|
||||
# This excludes glfw from being rebuilt when ALL_BUILD is built
|
||||
# it will only be built when a target is built that has a dependency on glfw
|
||||
add_subdirectory(${glfw_SOURCE_DIR} ${glfw_BINARY_DIR} EXCLUDE_FROM_ALL)
|
||||
|
||||
# Set the target's folders
|
||||
set_target_properties(glfw PROPERTIES FOLDER ${PROJECT_NAME}/thirdparty)
|
||||
endif()
|
||||
|
||||
target_include_directories(${TARGET} PRIVATE ${glfw_SOURCE_DIR}/include)
|
||||
target_link_libraries(${TARGET} glfw)
|
||||
|
||||
add_dependencies(${TARGET} glfw)
|
||||
endmacro()
|
Reference in New Issue
Block a user