Advertisement
bytecounter

Untitled

Oct 5th, 2022
1,423
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
CMake 1.45 KB | None | 0 0
  1. IF(WITH_LIB_GLAD)
  2.     message(STATUS "Included lib_glad.cmake.")
  3.     ###################
  4.     ## first example ##
  5.     ###################
  6.     set(OpenGL_GL_PREFERENCE CACHE STRING "LEGACY")
  7.  
  8.  
  9.     find_package(OpenGL REQUIRED)
  10.     find_package(glfw3 REQUIRED)
  11.     find_package(X11 REQUIRED)
  12.     find_package(Threads REQUIRED)
  13.  
  14.     set(THREADS_PREFER_PTHREAD_FLAG ON)
  15.     find_package(Threads REQUIRED)
  16.  
  17.     set(LIB_GLAD_INC_PATH
  18.         ${PLATFORM_INC_PATH}
  19.         ${X11_INCLUDE_DIR}
  20.         ${OPENGL_INCLUDE_DIR}
  21.         ${OUTPUT_PATH}/lib/glad/include
  22.         ${CMAKE_SYSTEM_INCLUDE_PATH}
  23.     )
  24.  
  25.     set(LIB_GLAD_LIB_PATH
  26.         ${PLATFORM_LIB_PATH}
  27.         ${X11_LIBRARIES}
  28.         ${OPENGL_LIBRARIES}
  29.         ${OUTPUT_PATH}/lib/glad/lib
  30.         ${CMAKE_SYSTEM_LIBRARY_PATH}
  31.     )
  32.  
  33.     cmake_print_variables(${CMAKE_SYSTEM_LIBRARY_PATH})
  34.  
  35.     set(LIB_GLAD_STATIC_LIBS
  36.         ${PLATFORM_STATIC_LIBS}
  37.         ${CMAKE_DL_LIBS}
  38.         glut
  39.         glad
  40.         OpenGL::GL
  41.         Threads::Threads
  42.         X11::X11
  43.         X11::Xxf86vm
  44.         X11::Xi
  45.         X11::Xrandr
  46.         X11::Xcursor
  47.         X11::Xinerama
  48.     )
  49.  
  50.     set(LIB_GLAD_DEPS "external_glad")
  51.  
  52.    
  53.     ExternalProject_Add(external_glad
  54.         PREFIX ${CMAKE_BINARY_DIR}/glad
  55.         GIT_REPOSITORY ${GLAD_REPO}
  56.         GIT_TAG ${GLAD_TAG}
  57.         GIT_PROGRESS TRUE
  58.         GIT_SHALLOW TRUE
  59.         SOURCE_DIR ${CMAKE_BINARY_DIR}/glad-src
  60.         INSTALL_DIR ${CMAKE_BINARY_DIR}/glad-download
  61.         CMAKE_ARGS -DCMAKE_BUILD_TYPE:String=${CMAKE_BUILD_TYPE} -DGLAD_INSTALL=ON -DCMAKE_INSTALL_PREFIX=${OUTPUT_PATH}/lib/glad
  62.         INSTALL_COMMAND COMMAND make -j${CPU_COUNT} install
  63.     )
  64. ENDIF()
  65.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement