Organize and sort out some library dependency issues

master
sfan5 2020-01-22 21:28:49 +01:00
parent a1da9caecf
commit c8583f9a5e
1 changed files with 20 additions and 13 deletions

View File

@ -108,7 +108,8 @@ if(BUILD_CLIENT)
if(ENABLE_GLES) if(ENABLE_GLES)
find_package(OpenGLES2 REQUIRED) find_package(OpenGLES2 REQUIRED)
else() else()
if(NOT WIN32) # Unix probably # transitive dependency from Irrlicht (see longer explanation below)
if(NOT WIN32)
set(OPENGL_GL_PREFERENCE "LEGACY" CACHE STRING set(OPENGL_GL_PREFERENCE "LEGACY" CACHE STRING
"See CMake Policy CMP0072 for reference. GLVND is broken on some nvidia setups") "See CMake Policy CMP0072 for reference. GLVND is broken on some nvidia setups")
set(OpenGL_GL_PREFERENCE ${OPENGL_GL_PREFERENCE}) set(OpenGL_GL_PREFERENCE ${OPENGL_GL_PREFERENCE})
@ -281,17 +282,28 @@ if(WIN32)
else() else()
# Unix probably # Unix probably
if(BUILD_CLIENT) if(BUILD_CLIENT)
if(NOT HAIKU) if(NOT HAIKU AND NOT APPLE)
find_package(X11 REQUIRED) find_package(X11 REQUIRED)
endif(NOT HAIKU) endif(NOT HAIKU AND NOT APPLE)
##
# The following dependencies are transitive dependencies from Irrlicht.
# Minetest itself does not use them, but we link them so that statically
# linking Irrlicht works.
if(NOT HAIKU AND NOT APPLE)
# This way Xxf86vm is found on OpenBSD too
find_library(XXF86VM_LIBRARY Xxf86vm)
mark_as_advanced(XXF86VM_LIBRARY)
set(CLIENT_PLATFORM_LIBS ${CLIENT_PLATFORM_LIBS} ${XXF86VM_LIBRARY})
endif(NOT HAIKU AND NOT APPLE)
find_package(JPEG REQUIRED) find_package(JPEG REQUIRED)
find_package(BZip2 REQUIRED) find_package(BZip2 REQUIRED)
find_package(PNG REQUIRED) find_package(PNG REQUIRED)
if(APPLE) if(APPLE)
find_library(CARBON_LIB Carbon) find_library(CARBON_LIB Carbon REQUIRED)
find_library(COCOA_LIB Cocoa) find_library(COCOA_LIB Cocoa REQUIRED)
find_library(IOKIT_LIB IOKit) find_library(IOKIT_LIB IOKit REQUIRED)
mark_as_advanced( mark_as_advanced(
CARBON_LIB CARBON_LIB
COCOA_LIB COCOA_LIB
@ -299,7 +311,9 @@ else()
) )
SET(CLIENT_PLATFORM_LIBS ${CLIENT_PLATFORM_LIBS} ${CARBON_LIB} ${COCOA_LIB} ${IOKIT_LIB}) SET(CLIENT_PLATFORM_LIBS ${CLIENT_PLATFORM_LIBS} ${CARBON_LIB} ${COCOA_LIB} ${IOKIT_LIB})
endif(APPLE) endif(APPLE)
##
endif(BUILD_CLIENT) endif(BUILD_CLIENT)
find_package(ZLIB REQUIRED) find_package(ZLIB REQUIRED)
set(PLATFORM_LIBS -lpthread ${CMAKE_DL_LIBS}) set(PLATFORM_LIBS -lpthread ${CMAKE_DL_LIBS})
if(APPLE) if(APPLE)
@ -311,13 +325,6 @@ else()
endif(HAVE_LIBRT) endif(HAVE_LIBRT)
endif(APPLE) endif(APPLE)
if(NOT HAIKU AND NOT APPLE)
# This way Xxf86vm is found on OpenBSD too
find_library(XXF86VM_LIBRARY Xxf86vm)
mark_as_advanced(XXF86VM_LIBRARY)
set(CLIENT_PLATFORM_LIBS ${CLIENT_PLATFORM_LIBS} ${XXF86VM_LIBRARY})
endif(NOT HAIKU AND NOT APPLE)
# Prefer local iconv if installed # Prefer local iconv if installed
find_library(ICONV_LIBRARY iconv) find_library(ICONV_LIBRARY iconv)
mark_as_advanced(ICONV_LIBRARY) mark_as_advanced(ICONV_LIBRARY)