Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions ci/install_magnum.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ git clone https://github.com/mosra/magnum.git
cd magnum
mkdir build && cd build
# Ubuntu
cmake -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DWITH_AUDIO=ON -DWITH_DEBUGTOOLS=ON -DWITH_GL=ON -DWITH_MESHTOOLS=ON -DWITH_PRIMITIVES=ON -DWITH_SCENEGRAPH=ON -DWITH_SHADERS=ON -DWITH_TEXT=ON -DWITH_TEXTURETOOLS=ON -DWITH_TRADE=ON -DWITH_GLFWAPPLICATION=ON -DWITH_WINDOWLESSGLXAPPLICATION=ON -DWITH_OPENGLTESTER=ON -DWITH_ANYAUDIOIMPORTER=ON -DWITH_ANYIMAGECONVERTER=ON -DWITH_ANYIMAGEIMPORTER=ON -DWITH_ANYSCENEIMPORTER=ON -DWITH_MAGNUMFONT=ON -DWITH_OBJIMPORTER=ON -DWITH_TGAIMPORTER=ON -DWITH_WAVAUDIOIMPORTER=ON -DCMAKE_INSTALL_PREFIX=/usr ..
cmake -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DMAGNUM_WITH_AUDIO=ON -DMAGNUM_WITH_DEBUGTOOLS=ON -DMAGNUM_WITH_GL=ON -DMAGNUM_WITH_MESHTOOLS=ON -DMAGNUM_WITH_PRIMITIVES=ON -DMAGNUM_WITH_SCENEGRAPH=ON -DMAGNUM_WITH_SHADERS=ON -DMAGNUM_WITH_TEXT=ON -DMAGNUM_WITH_TEXTURETOOLS=ON -DMAGNUM_WITH_TRADE=ON -DMAGNUM_WITH_GLFWAPPLICATION=ON -DMAGNUM_WITH_WINDOWLESSEGLAPPLICATION=ON -DMAGNUM_WITH_OPENGLTESTER=ON -DMAGNUM_WITH_ANYAUDIOIMPORTER=ON -DMAGNUM_WITH_ANYIMAGECONVERTER=ON -DMAGNUM_WITH_ANYIMAGEIMPORTER=ON -DMAGNUM_WITH_ANYSCENEIMPORTER=ON -DMAGNUM_WITH_MAGNUMFONT=ON -DMAGNUM_WITH_OBJIMPORTER=ON -DMAGNUM_WITH_TGAIMPORTER=ON -DMAGNUM_WITH_WAVAUDIOIMPORTER=ON -DMAGNUM_TARGET_EGL=ON -DCMAKE_INSTALL_PREFIX=/usr ..
make -j
sudo make install
cd ../..
Expand All @@ -31,7 +31,7 @@ cd ../..
git clone https://github.com/mosra/magnum-plugins.git
cd magnum-plugins
mkdir build && cd build
cmake -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DWITH_ASSIMPIMPORTER=ON -DWITH_DDSIMPORTER=ON -DWITH_JPEGIMPORTER=ON -DWITH_OPENGEXIMPORTER=ON -DWITH_PNGIMPORTER=ON -DWITH_TINYGLTFIMPORTER=ON -DWITH_STBTRUETYPEFONT=ON -DCMAKE_INSTALL_PREFIX=/usr ..
cmake -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DMAGNUM_WITH_ASSIMPIMPORTER=ON -DMAGNUM_WITH_DDSIMPORTER=ON -DMAGNUM_WITH_JPEGIMPORTER=ON -DMAGNUM_WITH_OPENGEXIMPORTER=ON -DMAGNUM_WITH_PNGIMPORTER=ON -DMAGNUM_WITH_TINYGLTFIMPORTER=ON -DMAGNUM_WITH_STBTRUETYPEFONT=ON -DCMAKE_INSTALL_PREFIX=/usr ..
make -j
sudo make install
cd ../..
Expand All @@ -40,7 +40,7 @@ cd ../..
git clone https://github.com/mosra/magnum-integration.git
cd magnum-integration
mkdir build && cd build
cmake -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DWITH_DART=ON -DWITH_EIGEN=ON -DCMAKE_INSTALL_PREFIX=/usr -DDART_DIR=$DART_DIR ..
cmake -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DMAGNUM_WITH_DART=ON -DMAGNUM_WITH_EIGEN=ON -DCMAKE_INSTALL_PREFIX=/usr -DDART_DIR=$DART_DIR ..
make -j
sudo make install
cd ../..
Expand Down
86 changes: 86 additions & 0 deletions cmake/FindEGL.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
#.rst:
# Find EGL
# --------
#
# Finds the EGL library. This module defines:
#
# EGL_FOUND - True if EGL library is found
# EGL::EGL - EGL imported target
#
# Additionally these variables are defined for internal usage:
#
# EGL_LIBRARY - EGL library
# EGL_INCLUDE_DIR - Include dir
#

#
# This file is part of Magnum.
#
# Copyright © 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019,
# 2020, 2021, 2022 Vladimír Vondruš <[email protected]>
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
# to deal in the Software without restriction, including without limitation
# the rights to use, copy, modify, merge, publish, distribute, sublicense,
# and/or sell copies of the Software, and to permit persons to whom the
# Software is furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included
# in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
# DEALINGS IN THE SOFTWARE.
#

# Under Emscripten, GL is linked implicitly. With MINIMAL_RUNTIME you need to
# specify -lGL. Simply set the library name to that.
if(CORRADE_TARGET_EMSCRIPTEN)
set(EGL_LIBRARY GL CACHE STRING "Path to a library." FORCE)
else()
find_library(EGL_LIBRARY NAMES
EGL

# ANGLE (CMake doesn't search for lib prefix on Windows)
libEGL

# On iOS a part of OpenGLES
OpenGLES)
endif()

# Include dir
find_path(EGL_INCLUDE_DIR NAMES
EGL/egl.h

# iOS
EAGL.h)

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(EGL DEFAULT_MSG
EGL_LIBRARY
EGL_INCLUDE_DIR)

if(NOT TARGET EGL::EGL)
# Work around BUGGY framework support on macOS. Do this also in case of
# Emscripten, since there we don't have a location either.
# http://public.kitware.com/pipermail/cmake/2016-April/063179.html
if((APPLE AND ${EGL_LIBRARY} MATCHES "\\.framework$") OR CORRADE_TARGET_EMSCRIPTEN)
add_library(EGL::EGL INTERFACE IMPORTED)
set_property(TARGET EGL::EGL APPEND PROPERTY
INTERFACE_LINK_LIBRARIES ${EGL_LIBRARY})
else()
add_library(EGL::EGL UNKNOWN IMPORTED)
set_property(TARGET EGL::EGL PROPERTY
IMPORTED_LOCATION ${EGL_LIBRARY})
endif()

set_target_properties(EGL::EGL PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES ${EGL_INCLUDE_DIR})
endif()

mark_as_advanced(EGL_LIBRARY EGL_INCLUDE_DIR)
20 changes: 14 additions & 6 deletions cmake/FindGLFW.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
#
# This file is part of Magnum.
#
# Copyright © 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019
# Vladimír Vondruš <[email protected]>
# Copyright © 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019,
# 2020, 2021, 2022 Vladimír Vondruš <[email protected]>
# Copyright © 2016 Jonathan Hale <[email protected]>
#
# Permission is hereby granted, free of charge, to any person obtaining a
Expand All @@ -43,11 +43,17 @@
# DEALINGS IN THE SOFTWARE.
#

# GLFW installs cmake package config files to shared/ folder which handles
# dependencies in case GLFW is built statically. Try to find first, quietly, so
# it doesn't print loud messages when it's not found, since that's okay.
find_package(glfw3 CONFIG QUIET)
# GLFW installs cmake package config files which handles dependencies in case
# GLFW is built statically. Try to find first, quietly, so it doesn't print
# loud messages when it's not found, since that's okay. If the glfw target
# already exists, it means we're using it through a CMake subproject -- don't
# attempt to find the package in that case.
if(NOT TARGET glfw)
find_package(glfw3 CONFIG QUIET)
endif()

# If either a glfw config file was found or we have a subproject, point
# GLFW::GLFW to that and exit -- nothing else to do here.
if(TARGET glfw)
if(NOT TARGET GLFW::GLFW)
# Aliases of (global) targets are only supported in CMake 3.11, so we
Expand Down Expand Up @@ -81,6 +87,8 @@ if(CORRADE_TARGET_WINDOWS)
set(_GLFW_LIBRARY_PATH_SUFFIX lib-vc2017)
elseif(MSVC_VERSION VERSION_LESS 1930)
set(_GLFW_LIBRARY_PATH_SUFFIX lib-vc2019)
elseif(MSVC_VERSION VERSION_LESS 1940)
set(_GLFW_LIBRARY_PATH_SUFFIX lib-vc2022)
else()
message(FATAL_ERROR "Unsupported MSVC version")
endif()
Expand Down
2 changes: 1 addition & 1 deletion docs/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ git clone https://github.com/mosra/magnum.git
cd magnum
mkdir build && cd build
# Ubuntu
cmake -DCMAKE_BUILD_TYPE=Release -DWITH_AUDIO=ON -DWITH_DEBUGTOOLS=ON -DWITH_GL=ON -DWITH_MESHTOOLS=ON -DWITH_PRIMITIVES=ON -DWITH_SCENEGRAPH=ON -DWITH_SHADERS=ON -DWITH_TEXT=ON -DWITH_TEXTURETOOLS=ON -DWITH_TRADE=ON -DWITH_GLFWAPPLICATION=ON -DWITH_WINDOWLESSGLXAPPLICATION=ON -DWITH_OPENGLTESTER=ON -DWITH_ANYAUDIOIMPORTER=ON -DWITH_ANYIMAGECONVERTER=ON -DWITH_ANYIMAGEIMPORTER=ON -DWITH_ANYSCENEIMPORTER=ON -DWITH_MAGNUMFONT=ON -DWITH_OBJIMPORTER=ON -DWITH_TGAIMPORTER=ON -DWITH_WAVAUDIOIMPORTER=ON .. # this will enable almost all features of Magnum that are not necessarily needed for robot_dart (please refer to the documentation of Magnum for more details on selecting only the ones that you need)
cmake -DCMAKE_BUILD_TYPE=Release -DWITH_AUDIO=ON -DWITH_DEBUGTOOLS=ON -DWITH_GL=ON -DWITH_MESHTOOLS=ON -DWITH_PRIMITIVES=ON -DWITH_SCENEGRAPH=ON -DWITH_SHADERS=ON -DWITH_TEXT=ON -DWITH_TEXTURETOOLS=ON -DWITH_TRADE=ON -DWITH_GLFWAPPLICATION=ON -DWITH_WINDOWLESSEGLAPPLICATION=ON -DWITH_OPENGLTESTER=ON -DWITH_ANYAUDIOIMPORTER=ON -DWITH_ANYIMAGECONVERTER=ON -DWITH_ANYIMAGEIMPORTER=ON -DWITH_ANYSCENEIMPORTER=ON -DWITH_MAGNUMFONT=ON -DWITH_OBJIMPORTER=ON -DWITH_TGAIMPORTER=ON -DWITH_WAVAUDIOIMPORTER=ON -DTARGET_HEADLESS=ON .. # this will enable almost all features of Magnum that are not necessarily needed for robot_dart (please refer to the documentation of Magnum for more details on selecting only the ones that you need)
# Mac OSX
cmake -DCMAKE_BUILD_TYPE=Release -DWITH_AUDIO=ON -DWITH_DEBUGTOOLS=ON -DWITH_GL=ON -DWITH_MESHTOOLS=ON -DWITH_PRIMITIVES=ON -DWITH_SCENEGRAPH=ON -DWITH_SHADERS=ON -DWITH_TEXT=ON -DWITH_TEXTURETOOLS=ON -DWITH_TRADE=ON -DWITH_GLFWAPPLICATION=ON -DWITH_WINDOWLESSCGLAPPLICATION=ON -DWITH_OPENGLTESTER=ON -DWITH_ANYAUDIOIMPORTER=ON -DWITH_ANYIMAGECONVERTER=ON -DWITH_ANYIMAGEIMPORTER=ON -DWITH_ANYSCENEIMPORTER=ON -DWITH_MAGNUMFONT=ON -DWITH_OBJIMPORTER=ON -DWITH_TGAIMPORTER=ON -DWITH_WAVAUDIOIMPORTER=ON .. # this will enable almost all features of Magnum that are not necessarily needed for robot_dart (please refer to the documentation of Magnum for more details on selecting only the ones that you need)
make -j
Expand Down
2 changes: 1 addition & 1 deletion src/robot_dart/gui/magnum/base_application.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
#include <Magnum/GL/TextureArray.h>
#include <Magnum/Platform/GLContext.h>
#ifndef MAGNUM_MAC_OSX
#include <Magnum/Platform/WindowlessGlxApplication.h>
#include <Magnum/Platform/WindowlessEglApplication.h>
#else
#include <Magnum/Platform/WindowlessCglApplication.h>
#endif
Expand Down
133 changes: 90 additions & 43 deletions waf_tools/magnum.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,10 +218,10 @@ def fatal(required, msg):
conf.end_msg(opengl_include_dir)

conf.start_msg('Magnum: Checking for OpenGL lib')
opengl_lib_dir = get_directory('libGL.'+suffix, libs_check)
opengl_lib_dir = get_directory('libOpenGL.'+suffix, libs_check)
magnum_libpaths = magnum_libpaths + [opengl_lib_dir]
magnum_libs = magnum_libs + ['GL']
conf.end_msg(['GL'])
magnum_libs = magnum_libs + ['OpenGL']
conf.end_msg(['OpenGL'])

conf.start_msg('Magnum: Checking for MagnumGL lib')
gl_lib_dir = get_directory('libMagnumGL.'+suffix, libs_check)
Expand All @@ -232,6 +232,50 @@ def fatal(required, msg):
fatal(required, 'At the moment only desktop OpenGL is supported by WAF')
return

egl_found = False
glx_found = False
if 'TARGET_HEADLESS' in magnum_config:
# TARGET_HEADLESS requires EGL
egl_inc = get_directory('EGL/egl.h', includes_check)

magnum_includes = magnum_includes + [egl_inc]

libs_egl = ['EGL']
for lib_egl in libs_egl:
try:
lib_dir = get_directory('lib'+lib_egl+'.so', libs_check)
egl_found = True

magnum_libpaths = magnum_libpaths + [lib_dir]
magnum_libs.append(lib_egl)
break
except:
egl_found = False

if not egl_found:
fatal(required, 'Not found')
return
else: # we need GLX
glx_inc = get_directory('GL/glx.h', includes_check)

magnum_includes = magnum_includes + [glx_inc]

libs_glx = ['GLX', 'X11']
for lib_glx in libs_glx:
try:
lib_dir = get_directory('lib'+lib_glx+'.so', libs_check)
glx_found = True

magnum_libpaths = magnum_libpaths + [lib_dir]
magnum_libs.append(lib_glx)
# break
except:
glx_found = False

if not glx_found:
fatal(required, 'Not found')
return

conf.start_msg('Checking for Magnum components')
# only check for components that can exist
requested_components = list(set(requested_components).intersection(magnum_components))
Expand Down Expand Up @@ -293,6 +337,7 @@ def fatal(required, msg):
try:
lib_dir = get_directory('lib'+lib_glfw+'.'+suffix, libs_check)
glfw_found = True

magnum_component_libpaths[component] = magnum_component_libpaths[component] + [lib_dir]
magnum_component_libs[component].append(lib_glfw)
break
Expand Down Expand Up @@ -352,49 +397,51 @@ def fatal(required, msg):
return
# to-do: maybe copy flags?
elif component == 'WindowlessEglApplication':
# WindowlessEglApplication requires EGL
egl_inc = get_directory('EGL/egl.h', includes_check)

magnum_component_includes[component] = magnum_component_includes[component] + [egl_inc]

libs_egl = ['EGL']
egl_found = False
for lib_egl in libs_egl:
try:
lib_dir = get_directory('lib'+lib_egl+'.so', libs_check)
egl_found = True

magnum_component_libpaths[component] = magnum_component_libpaths[component] + [lib_dir]
magnum_component_libs[component].append(lib_egl)
break
except:
egl_found = False

if not egl_found:
fatal(required, 'Not found')
return
# WindowlessEglApplication requires EGL
egl_inc = get_directory('EGL/egl.h', includes_check)

magnum_component_includes[component] = magnum_component_includes[component] + [egl_inc]

libs_egl = ['EGL']
egl_found = False
for lib_egl in libs_egl:
try:
lib_dir = get_directory('lib'+lib_egl+'.so', libs_check)
egl_found = True

magnum_component_libpaths[component] = magnum_component_libpaths[component] + [lib_dir]
magnum_component_libs[component].append(lib_egl)
break
except:
egl_found = False

if not egl_found:
fatal(required, 'Not found')
return
elif component == 'WindowlessGlxApplication' or component == 'GlxApplication':
# [Windowless]GlxApplication requires GLX. X11
glx_inc = get_directory('GL/glx.h', includes_check)

magnum_component_includes[component] = magnum_component_includes[component] + [glx_inc]

libs_glx = ['GLX', 'X11']
glx_found = False
for lib_glx in libs_glx:
try:
lib_dir = get_directory('lib'+lib_glx+'.so', libs_check)
glx_found = True

magnum_component_libpaths[component] = magnum_component_libpaths[component] + [lib_dir]
magnum_component_libs[component].append(lib_glx)
# break
except:
glx_found = False

if not glx_found:
fatal(required, 'Not found')
return
# [Windowless]GlxApplication requires GLX. X11
glx_inc = get_directory('GL/glx.h', includes_check)

magnum_component_includes[component] = magnum_component_includes[component] + [glx_inc]

libs_glx = ['GLX', 'X11']
glx_found = False
for lib_glx in libs_glx:
try:
lib_dir = get_directory('lib'+lib_glx+'.so', libs_check)
glx_found = True

magnum_component_libpaths[component] = magnum_component_libpaths[component] + [lib_dir]
magnum_component_libs[component].append(lib_glx)
# break
except:
glx_found = False

if not glx_found:
fatal(required, 'Not found')
return
elif component not in ['WindowlessCglApplication', 'WindowlessWglApplication']:
# to-do: support all other applications
msg = 'Component ' + component + ' is not yet supported by WAF'
Expand Down
3 changes: 2 additions & 1 deletion wscript
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ def configure_robot_dart(conf):
if conf.env['DEST_OS'] == 'darwin':
conf.env['magnum_dep_libs'] += ' WindowlessCglApplication'
else:
conf.env['magnum_dep_libs'] += ' WindowlessGlxApplication'
conf.env['magnum_dep_libs'] += ' WindowlessEglApplication'
if len(conf.env.INCLUDES_Corrade):
conf.check_magnum(components=conf.env['magnum_dep_libs'], required=False)
if len(conf.env.INCLUDES_Magnum):
Expand Down Expand Up @@ -430,6 +430,7 @@ def build_robot_dart(bld):
bld.install_files('${PREFIX}/lib/cmake/RobotDART/', blddir + '/RobotDARTConfig.cmake')
bld.install_files('${PREFIX}/lib/cmake/RobotDART/', blddir + '/RobotDARTConfigVersion.cmake')
bld.install_files('${PREFIX}/lib/cmake/RobotDART/', 'cmake/FindGLFW.cmake')
bld.install_files('${PREFIX}/lib/cmake/RobotDART/', 'cmake/FindEGL.cmake')

def build_examples(bld):
# we first build the library
Expand Down