From b10a2f5d5401c105a46e53078390d5493dc19489 Mon Sep 17 00:00:00 2001 From: Paul Cercueil Date: Wed, 24 Jun 2026 12:40:15 +0200 Subject: [PATCH] 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 --- CMakeLists.txt | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f96a737..b33a3c1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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