Add cmake scripts that find egl and wayland libraries
This commit is contained in:
parent
b09eec4bcb
commit
66cebbdbe7
18
cmake/FindEGL.cmake
Normal file
18
cmake/FindEGL.cmake
Normal file
@ -0,0 +1,18 @@
|
||||
# - Find EGL
|
||||
# Find the EGL includes and libraries
|
||||
#
|
||||
# Following variables are provided:
|
||||
# EGL_FOUND
|
||||
# True if EGL has been found
|
||||
# EGL_INCLUDE_DIR
|
||||
# The include directory of EGL
|
||||
# EGL_LIBRARY
|
||||
# EGL library list
|
||||
|
||||
find_path(EGL_INCLUDE_DIR EGL/egl.h)
|
||||
find_library(EGL_LIBRARY NAMES EGL)
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(EGL DEFAULT_MSG EGL_LIBRARY EGL_INCLUDE_DIR)
|
||||
|
||||
mark_as_advanced(EGL_LIBRARY EGL_INCLUDE_DIR)
|
52
cmake/FindWayland.cmake
Normal file
52
cmake/FindWayland.cmake
Normal file
@ -0,0 +1,52 @@
|
||||
# - Find Wayland
|
||||
# Find the Wayland includes and libraries
|
||||
#
|
||||
# Following variables are provided:
|
||||
# WAYLAND_FOUND
|
||||
# True if Wayland has been found
|
||||
# WAYLAND_INCLUDE_DIRS
|
||||
# The include directories of Wayland
|
||||
# WAYLAND_LIBRARIES
|
||||
# Wayland library list
|
||||
|
||||
find_path(WAYLAND_CLIENT_INCLUDE_DIR wayland-client.h)
|
||||
find_path(WAYLAND_CURSOR_INCLUDE_DIR wayland-cursor.h)
|
||||
find_path(WAYLAND_EGL_INCLUDE_DIR wayland-egl.h)
|
||||
find_path(XKBCOMMON_INCLUDE_DIR xkbcommon/xkbcommon.h)
|
||||
|
||||
find_library(WAYLAND_CLIENT_LIBRARY NAMES wayland-client)
|
||||
find_library(WAYLAND_CURSOR_LIBRARY NAMES wayland-cursor)
|
||||
find_library(WAYLAND_EGL_LIBRARY NAMES wayland-egl)
|
||||
find_library(XKBCOMMON_LIBRARY NAMES xkbcommon)
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(Wayland DEFAULT_MSG WAYLAND_CLIENT_LIBRARY
|
||||
WAYLAND_CURSOR_LIBRARY
|
||||
WAYLAND_EGL_LIBRARY
|
||||
XKBCOMMON_LIBRARY
|
||||
WAYLAND_CLIENT_INCLUDE_DIR
|
||||
WAYLAND_CURSOR_INCLUDE_DIR
|
||||
WAYLAND_EGL_INCLUDE_DIR
|
||||
XKBCOMMON_INCLUDE_DIR)
|
||||
|
||||
set(WAYLAND_INCLUDE_DIRS ${WAYLAND_CLIENT_INCLUDE_DIR}
|
||||
${WAYLAND_CURSOR_INCLUDE_DIR}
|
||||
${WAYLAND_EGL_INCLUDE_DIR}
|
||||
${XKBCOMMON_INCLUDE_DIR})
|
||||
|
||||
set(WAYLAND_LIBRARIES ${WAYLAND_CLIENT_LIBRARY}
|
||||
${WAYLAND_CURSOR_LIBRARY}
|
||||
${WAYLAND_EGL_LIBRARY}
|
||||
${XKBCOMMON_LIBRARY})
|
||||
|
||||
list(REMOVE_DUPLICATES WAYLAND_INCLUDE_DIRS)
|
||||
list(REMOVE_DUPLICATES WAYLAND_LIBRARIES)
|
||||
|
||||
mark_as_advanced(WAYLAND_CLIENT_LIBRARY
|
||||
WAYLAND_CURSOR_LIBRARY
|
||||
WAYLAND_EGL_LIBRARY
|
||||
XKBCOMMON_LIBRARY
|
||||
WAYLAND_CLIENT_INCLUDE_DIR
|
||||
WAYLAND_CURSOR_INCLUDE_DIR
|
||||
WAYLAND_EGL_INCLUDE_DIR
|
||||
XKBCOMMON_INCLUDE_DIR)
|
@ -12,24 +12,40 @@ if(MSVC OR APPLE)
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/../libpng/")
|
||||
endif()
|
||||
|
||||
if (SERVER_ONLY)
|
||||
add_definitions(-DNO_IRR_COMPILE_WITH_OPENGL_)
|
||||
add_definitions(-DNO_IRR_COMPILE_WITH_X11_)
|
||||
add_definitions(-DNO_IRR_COMPILE_WITH_WAYLAND_DEVICE_)
|
||||
else()
|
||||
if (NOT SERVER_ONLY)
|
||||
if(NOT USE_GLES2)
|
||||
find_package(OpenGL REQUIRED)
|
||||
include_directories(${OPENGL_INCLUDE_DIR})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(UNIX AND NOT APPLE)
|
||||
find_package(X11 REQUIRED)
|
||||
include_directories(${X11_INCLUDE_DIR})
|
||||
endif()
|
||||
|
||||
if (UNIX AND NOT APPLE)
|
||||
find_package(X11 REQUIRED)
|
||||
include_directories(${X11_INCLUDE_DIR})
|
||||
endif()
|
||||
if(ENABLE_WAYLAND_DEVICE)
|
||||
find_package(Wayland REQUIRED)
|
||||
include_directories(${WAYLAND_INCLUDE_DIR})
|
||||
|
||||
if(NOT WAYLAND_FOUND)
|
||||
message(FATAL_ERROR "Wayland not found.")
|
||||
endif()
|
||||
|
||||
add_definitions(-D_IRR_COMPILE_WITH_WAYLAND_DEVICE_)
|
||||
endif()
|
||||
|
||||
if(ENABLE_WAYLAND_DEVICE)
|
||||
add_definitions(-D_IRR_COMPILE_WITH_WAYLAND_DEVICE_)
|
||||
if(USE_GLES2 OR ENABLE_WAYLAND_DEVICE)
|
||||
find_package(EGL REQUIRED)
|
||||
include_directories(${EGL_INCLUDE_DIR})
|
||||
|
||||
if(NOT EGL_FOUND)
|
||||
message(FATAL_ERROR "EGL not found.")
|
||||
endif()
|
||||
endif()
|
||||
else()
|
||||
add_definitions(-DNO_IRR_COMPILE_WITH_OPENGL_)
|
||||
add_definitions(-DNO_IRR_COMPILE_WITH_X11_)
|
||||
add_definitions(-DNO_IRR_COMPILE_WITH_WAYLAND_DEVICE_)
|
||||
endif()
|
||||
|
||||
if(APPLE)
|
||||
@ -44,21 +60,18 @@ if(UNIX OR MINGW)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++0x")
|
||||
endif()
|
||||
|
||||
if(MSVC)
|
||||
add_definitions(/D_IRR_STATIC_LIB_)
|
||||
add_definitions(/D_CRT_SECURE_NO_WARNINGS) # Shut up about unsafe stuff
|
||||
elseif(MINGW)
|
||||
add_definitions(-D_IRR_STATIC_LIB_)
|
||||
add_definitions(-D_CRT_SECURE_NO_WARNINGS) # Shut up about unsafe stuff
|
||||
if(WIN32)
|
||||
add_definitions(-D_IRR_STATIC_LIB_)
|
||||
add_definitions(-D_CRT_SECURE_NO_WARNINGS) # Shut up about unsafe stuff
|
||||
else()
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -pipe -O3 -fno-exceptions -fstrict-aliasing")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -pipe -O3 -fno-exceptions -fstrict-aliasing")
|
||||
if(CMAKE_COMPILER_IS_GNUCC)
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fexpensive-optimizations")
|
||||
endif()
|
||||
if(CMAKE_COMPILER_IS_GNUCXX)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fexpensive-optimizations")
|
||||
endif()
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -pipe -O3 -fno-exceptions -fstrict-aliasing")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -pipe -O3 -fno-exceptions -fstrict-aliasing")
|
||||
if(CMAKE_COMPILER_IS_GNUCC)
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fexpensive-optimizations")
|
||||
endif()
|
||||
if(CMAKE_COMPILER_IS_GNUCXX)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fexpensive-optimizations")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(USE_GLES2)
|
||||
@ -562,11 +575,11 @@ add_library(stkirrlicht STATIC ${IRRLICHT_SOURCES})
|
||||
target_link_libraries(stkirrlicht ${PNG_LIBRARY} ${JPEG_LIBRARY} ${ZLIB_LIBRARY})
|
||||
|
||||
if(USE_GLES2 OR ENABLE_WAYLAND_DEVICE)
|
||||
target_link_libraries(stkirrlicht EGL)
|
||||
target_link_libraries(stkirrlicht ${EGL_LIBRARY})
|
||||
endif()
|
||||
|
||||
if(ENABLE_WAYLAND_DEVICE)
|
||||
target_link_libraries(stkirrlicht wayland-client wayland-egl wayland-cursor xkbcommon)
|
||||
target_link_libraries(stkirrlicht ${WAYLAND_LIBRARIES})
|
||||
endif()
|
||||
|
||||
if(WIN32)
|
||||
|
Loading…
Reference in New Issue
Block a user