Merge pull request #59 from Perlmint/fix/opengl_build

Fix build test
This commit is contained in:
Gyusun Yeom 2023-02-19 13:23:06 +09:00 committed by GitHub
commit ccc2ac3e40
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 25 additions and 10 deletions

View File

@ -63,17 +63,21 @@ endif()
if(POLICY CMP0072)
set(OpenGL_GL_PREFERENCE GLVND)
if(NOT (WIN32 OR APPLE))
set(USE_GLVND YES)
else()
# GLVND is not supported
set(USE_GLVND NO)
endif()
else()
set(USE_GLVND NO)
endif()
find_package(OpenGL REQUIRED)
if(NOT (WIN32 OR APPLE))
message("Try to find OpenGL with GLVND")
find_package(OpenGL REQUIRED
COMPONENTS OpenGL GLX)
endif()
if(OPENGL_FOUND AND OpenGL_GLX_FOUND AND TARGET OpenGL::OpenGL)
set(USE_GLVND YES)
else()
message("GLVND not supported. Try find OpenGL legacy")
find_package(OpenGL REQUIRED)
set(USE_GLVND NO)
endif()
set(pc_requires)
@ -150,13 +154,24 @@ else()
set(INSTALL_LIBDIR ${CMAKE_INSTALL_LIBDIR})
endif()
execute_process(
COMMAND ${CMAKE_COMMAND} -E touch test_fs_support_case_sensitivity
COMMAND ${CMAKE_COMMAND} -E touch test_fs_support_CASE_sensitivity)
file(GLOB TEST_FILE_LIST ${CMAKE_BINARY_DIR}/test_fs_support_*_sensitivity)
list(LENGTH TEST_FILE_LIST TEST_FILE_COUNT)
if(TEST_FILE_COUNT EQUAL 2)
set(SUPPORT_CASE_SENSITIVE_FS YES)
else()
set(SUPPORT_CASE_SENSITIVE_FS NO)
endif()
function(set_representative_target TARGET)
set_target_properties(${TARGET} PROPERTIES
OUTPUT_NAME "glew"
DEBUG_POSTFIX d)
# Windows & macOS use case-insensetive FS. do not create symbolic link
if(NOT (WIN32 OR APPLE))
if(SUPPORT_CASE_SENSITIVE_FS)
get_target_property(TARGET_TYPE ${TARGET} TYPE)
if(TARGET_TYPE STREQUAL STATIC_LIBRARY)
set(EXT ".a")