2024-11-24 22:42:36 +00:00
|
|
|
project(imgui-glad)
|
|
|
|
|
2024-11-25 02:01:00 +00:00
|
|
|
# Directories
|
|
|
|
set_and_mkdir(GLAD_DIR "${CMAKE_CURRENT_BINARY_DIR}/glad")
|
|
|
|
set_and_mkdir(GLAD_SRC_DIR "${GLAD_DIR}/src")
|
|
|
|
set_and_mkdir(GLAD_INCLUDE_DIR "${GLAD_DIR}/include")
|
|
|
|
|
|
|
|
# Files
|
|
|
|
set(GLAD_SOURCES
|
|
|
|
"${GLAD_INCLUDE_DIR}/KHR/khrplatform.h"
|
|
|
|
"${GLAD_INCLUDE_DIR}/glad/glad.h"
|
|
|
|
"${GLAD_SRC_DIR}/glad.c"
|
|
|
|
)
|
|
|
|
|
|
|
|
# Find Python
|
|
|
|
find_package(Python REQUIRED QUIET)
|
|
|
|
|
|
|
|
# Generate
|
|
|
|
add_custom_command(
|
|
|
|
OUTPUT ${GLAD_SOURCES}
|
|
|
|
COMMAND "${Python_EXECUTABLE}"
|
|
|
|
ARGS "-m" "glad"
|
|
|
|
"--out" "${GLAD_DIR}"
|
|
|
|
"--api" "gl=1.1"
|
|
|
|
"--generator" "c"
|
|
|
|
"--reproducible"
|
|
|
|
"--quiet"
|
|
|
|
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/src"
|
|
|
|
VERBATIM
|
|
|
|
)
|
|
|
|
|
|
|
|
# Build
|
|
|
|
add_library(glad SHARED ${GLAD_SOURCES})
|
2024-11-25 02:31:26 +00:00
|
|
|
target_compile_definitions(glad
|
|
|
|
PUBLIC GLAD_GLAPI_EXPORT
|
|
|
|
PRIVATE GLAD_GLAPI_EXPORT_BUILD
|
|
|
|
)
|
|
|
|
|
|
|
|
# Link
|
|
|
|
target_link_libraries(glad PRIVATE dl)
|
2024-11-25 02:01:00 +00:00
|
|
|
|
|
|
|
# Headers
|
|
|
|
setup_header_dirs(glad
|
|
|
|
"${GLAD_INCLUDE_DIR}"
|
|
|
|
"${CMAKE_CURRENT_SOURCE_DIR}/include"
|
|
|
|
)
|
2024-11-24 22:42:36 +00:00
|
|
|
|
|
|
|
# Install
|
|
|
|
setup_library(glad TRUE FALSE)
|