CMake: Separate GLU into its own library

Some libraries expect GL and GLU to be separate.
Move our existing glu.c code to libGLU.a to keep them happy.

Note that some of the GLU code still exists in matrix.c, but that should
be fine as GLU has a dependency on GL anyway.

Signed-off-by: Paul Cercueil <paul@crapouillou.net>
This commit is contained in:
Paul Cercueil 2026-06-24 12:40:15 +02:00
parent 134b58f8db
commit b10a2f5d54
No known key found for this signature in database
GPG Key ID: 73EE6BD2274ABD41

View File

@ -45,7 +45,6 @@ add_library(GL STATIC
GL/flush.c
GL/fog.c
GL/framebuffer.c
GL/glu.c
GL/immediate.c
GL/lighting.c
GL/matrix.c
@ -61,11 +60,19 @@ set_target_properties(GL PROPERTIES
COMPILE_DEFINITIONS -DBACKEND_${BACKEND_UPPER}
C_STANDARD 99
INTERPROCEDURAL_OPTIMIZATION ${FLTO_SUPPORTED}
PUBLIC_HEADER "include/GL/gl.h;include/GL/glext.h;include/GL/glu.h;include/GL/glkos.h"
PUBLIC_HEADER "include/GL/gl.h;include/GL/glext.h;include/GL/glkos.h"
)
target_include_directories(GL PUBLIC ${CMAKE_SOURCE_DIR}/include)
add_library(GLU STATIC GL/glu.c)
set_target_properties(GLU PROPERTIES
PUBLIC_HEADER include/GL/glu.h
)
target_link_libraries(GLU PUBLIC GL)
if(NOT PLATFORM_DREAMCAST)
target_compile_options(GL PUBLIC -m32)
target_link_options(GL PUBLIC -m32)
@ -103,7 +110,7 @@ endif()
include(GNUInstallDirs)
install(TARGETS GL
install(TARGETS GL GLU
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/GL
@ -111,7 +118,7 @@ install(TARGETS GL
function(gen_sample sample)
add_executable(${sample} ${ARGN})
target_link_libraries(${sample} PRIVATE m GL)
target_link_libraries(${sample} PRIVATE m GL GLU)
set_target_properties(${sample} PROPERTIES
C_STANDARD 99
CXX_STANDARD 14