#Issue with GLAD

7 messages · Page 1 of 1 (latest)

candid oak
#

_deps/glad-src/src/glad.c Is missing even tho it should not be the case. Here is my cmakelist : ```cmake
cmake_minimum_required(VERSION 3.20)

project(OpenGLApp C)

set(CMAKE_C_STANDARD 23)
add_compile_options(-Wall -Wextra -Wpedantic -O3 -march=native)

Add executable

add_executable(OpenGLApp
main.c
fenetre.c
fenetre.h
optimization.h
)

Find OpenGL

find_package(OpenGL REQUIRED)

FetchContent for GLFW and GLAD

include(FetchContent)
FetchContent_Declare(
glfw
GIT_REPOSITORY https://github.com/glfw/glfw.git
GIT_TAG 3.4
)
FetchContent_Declare(
glad
GIT_REPOSITORY https://github.com/Dav1dde/glad.git
GIT_TAG v2.0.8
)
FetchContent_MakeAvailable(glfw glad)

Add GLAD source files

add_library(glad_lib STATIC
${glad_SOURCE_DIR}/src/glad.c
)
target_include_directories(glad_lib PRIVATE ${glad_SOURCE_DIR}/include)

Link libraries

target_link_libraries(OpenGLApp
PRIVATE
glfw
OpenGL::GL
glad_lib
)

Copy shaders or assets if needed

add_custom_target(copy_shaders ALL
COMMAND ${CMAKE_COMMAND} -E copy_directory
${CMAKE_CURRENT_SOURCE_DIR}/shaders
${CMAKE_CURRENT_BINARY_DIR}/shaders
)
add_dependencies(OpenGLApp copy_shaders)```

tender trench
#

!cpphelp

sullen crystalBOT
#
C++ Questions

Hey, it looks like you have a C++ question! While C++ is a common language to use for Graphics Programming, questions related solely to the language or its ecosystem may get a faster response time in a server dedicated to C++. You will likely find better help in one of servers linked #related-servers. Please consider asking your question in Together C & C++ or #include.

tender trench
#

not strictly C++ sure, its cmake - but same idea

#

this is not a graphics question

hollow crown
#
FetchContent_Declare(
    glad
    GIT_REPOSITORY https://github.com/Dav1dde/glad
    GIT_TAG        v2.0.6
    GIT_SHALLOW    TRUE
    GIT_PROGRESS   TRUE
)

FetchContent_GetProperties(glad)
if(NOT glad_POPULATED)
    message("Fetching glad")
    FetchContent_MakeAvailable(glad)

    add_subdirectory("${glad_SOURCE_DIR}/cmake" glad_cmake)
    glad_add_library(glad REPRODUCIBLE EXCLUDE_FROM_ALL LOADER API gl:core=4.6 EXTENSIONS GL_ARB_bindless_texture GL_EXT_texture_compression_s3tc)
endif()
#
target_link_libraries(YourProject
...
    PRIVATE glad
...
)