From 7b7e9325bae7cbd0c31fb1c25ebd1280147a75ed Mon Sep 17 00:00:00 2001 From: Konstantinos Chatzilygeroudis Date: Mon, 1 Mar 2021 19:43:40 +0200 Subject: [PATCH 1/7] [gui]: switch from glx to egl for linux --- ci/install_magnum.sh | 2 +- docs/installation.md | 2 +- src/robot_dart/gui/magnum/base_application.hpp | 2 +- wscript | 6 +++--- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/ci/install_magnum.sh b/ci/install_magnum.sh index 26e0a98a..eef03b20 100755 --- a/ci/install_magnum.sh +++ b/ci/install_magnum.sh @@ -16,7 +16,7 @@ if [ "$TRAVIS_OS_NAME" == "linux" ]; then 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 .. + 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 .. make -j sudo make install cd ../.. diff --git a/docs/installation.md b/docs/installation.md index db19996d..2dceef8e 100644 --- a/docs/installation.md +++ b/docs/installation.md @@ -119,7 +119,7 @@ git clone https://github.com/mosra/magnum.git cd magnum mkdir build && cd build # Ubuntu -cmake -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 -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_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 .. # 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 -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 diff --git a/src/robot_dart/gui/magnum/base_application.hpp b/src/robot_dart/gui/magnum/base_application.hpp index d29d862b..4279831f 100644 --- a/src/robot_dart/gui/magnum/base_application.hpp +++ b/src/robot_dart/gui/magnum/base_application.hpp @@ -23,7 +23,7 @@ #include #include #ifndef MAGNUM_MAC_OSX -#include +#include #else #include #endif diff --git a/wscript b/wscript index 13bff5b1..5948182f 100644 --- a/wscript +++ b/wscript @@ -71,7 +71,7 @@ def configure(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): @@ -136,7 +136,7 @@ def configure(conf): if '-std=c++0x' in conf.env['CXXFLAGS']: conf.env['CXXFLAGS'].remove('-std=c++0x') conf.env['CXXFLAGS'] = conf.env['CXXFLAGS'] + conf.env.CXXFLAGS_DART - + # add the prefix conf.env['CXXFLAGS'] = conf.env['CXXFLAGS'] print(conf.env['CXXFLAGS']) @@ -247,7 +247,7 @@ def build(bld): f.write('#define ROBOT_DART_VERSION_MAJOR ' + version[0] + '\n') f.write('#define ROBOT_DART_VERSION_MINOR ' + version[1] + '\n') f.write('#define ROBOT_DART_VERSION_PATCH ' + version[2] + '\n') - f.write('#define ROBOT_DART_ROBOTS_DIR \"' + prefix + '/share/robot_dart/robots\"\n') + f.write('#define ROBOT_DART_ROBOTS_DIR \"' + prefix + '/share/robot_dart/robots\"\n') bld.install_files("${PREFIX}/include/robot_dart/", config_file) #### install the URDF library (robots) From e291fd2d808265858b3367e6d09b67867b315c83 Mon Sep 17 00:00:00 2001 From: Konstantinos Chatzilygeroudis Date: Tue, 2 Mar 2021 17:45:04 +0200 Subject: [PATCH 2/7] [gui]: Fix OpenGL/GLFW3 detection --- waf_tools/magnum.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/waf_tools/magnum.py b/waf_tools/magnum.py index 6cfae689..cd06a84c 100644 --- a/waf_tools/magnum.py +++ b/waf_tools/magnum.py @@ -214,10 +214,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) @@ -304,6 +304,14 @@ def fatal(required, msg): except: glfw_found = False + # GlfwApplication needs the libGLX.so library + try: + lib_dir = get_directory('libGLX.'+suffix, libs_check) + magnum_component_libpaths[component] = [lib_dir] + magnum_component_libpaths[component] + magnum_component_libs[component] = ['GLX'] + magnum_component_libs[component] + except: + glfw_found = False + if not glfw_found: fatal(required, 'Not found') return From d2bd42a4e1ee946d1bc6a597c4abcf688f2b31b8 Mon Sep 17 00:00:00 2001 From: Konstantinos Chatzilygeroudis Date: Tue, 2 Mar 2021 18:15:56 +0200 Subject: [PATCH 3/7] [gui]: wrong order for libs --- waf_tools/magnum.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/waf_tools/magnum.py b/waf_tools/magnum.py index cd06a84c..f5054914 100644 --- a/waf_tools/magnum.py +++ b/waf_tools/magnum.py @@ -296,19 +296,19 @@ def fatal(required, msg): except: glfw_found = False - # GlfwApplication needs the libdl.so library + # GlfwApplication needs the libGLX.so library try: - lib_dir = get_directory('libdl.'+suffix, libs_check) + lib_dir = get_directory('libGLX.'+suffix, libs_check) magnum_component_libpaths[component] = magnum_component_libpaths[component] + [lib_dir] - magnum_component_libs[component].append('dl') + magnum_component_libs[component] = magnum_component_libs[component] + ['GLX'] except: glfw_found = False - # GlfwApplication needs the libGLX.so library + # GlfwApplication needs the libdl.so library try: - lib_dir = get_directory('libGLX.'+suffix, libs_check) - magnum_component_libpaths[component] = [lib_dir] + magnum_component_libpaths[component] - magnum_component_libs[component] = ['GLX'] + magnum_component_libs[component] + lib_dir = get_directory('libdl.'+suffix, libs_check) + magnum_component_libpaths[component] = magnum_component_libpaths[component] + [lib_dir] + magnum_component_libs[component].append('dl') except: glfw_found = False From 0977054d80db22686234596cd7512dbe0df62451 Mon Sep 17 00:00:00 2001 From: Konstantinos Chatzilygeroudis Date: Fri, 9 Sep 2022 15:19:55 +0300 Subject: [PATCH 4/7] Fixes to magnum script --- ci/install_magnum.sh | 2 +- docs/installation.md | 2 +- waf_tools/magnum.py | 56 ++++++++++++++++++++++++++++++++++++-------- 3 files changed, 48 insertions(+), 12 deletions(-) diff --git a/ci/install_magnum.sh b/ci/install_magnum.sh index 6f4086db..e01e9589 100755 --- a/ci/install_magnum.sh +++ b/ci/install_magnum.sh @@ -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_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 -DCMAKE_INSTALL_PREFIX=/usr .. +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_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 -DCMAKE_INSTALL_PREFIX=/usr .. make -j sudo make install cd ../.. diff --git a/docs/installation.md b/docs/installation.md index 0320357c..dd5b068d 100644 --- a/docs/installation.md +++ b/docs/installation.md @@ -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_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 .. # 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 diff --git a/waf_tools/magnum.py b/waf_tools/magnum.py index d0efedff..cb69a035 100644 --- a/waf_tools/magnum.py +++ b/waf_tools/magnum.py @@ -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)) @@ -309,14 +353,6 @@ def fatal(required, msg): except: glfw_found = False - # # GlfwApplication needs the libGLX.so library - # try: - # lib_dir = get_directory('libGLX.'+suffix, libs_check) - # magnum_component_libpaths[component] = magnum_component_libpaths[component] + [lib_dir] - # magnum_component_libs[component] = magnum_component_libs[component] + ['GLX'] - # except: - # glfw_found = False - if not glfw_found: fatal(required, 'Not found') return @@ -360,7 +396,7 @@ def fatal(required, msg): fatal(required, 'Not found') return # to-do: maybe copy flags? - elif component == 'WindowlessEglApplication': + elif component == 'WindowlessEglApplication' and (not egl_found): # WindowlessEglApplication requires EGL egl_inc = get_directory('EGL/egl.h', includes_check) @@ -382,7 +418,7 @@ def fatal(required, msg): if not egl_found: fatal(required, 'Not found') return - elif component == 'WindowlessGlxApplication' or component == 'GlxApplication': + elif (component == 'WindowlessGlxApplication' or component == 'GlxApplication') and (not glx_found): # [Windowless]GlxApplication requires GLX. X11 glx_inc = get_directory('GL/glx.h', includes_check) From 34a084bd88ea1523fa2db7b753781f6d95208ee4 Mon Sep 17 00:00:00 2001 From: Konstantinos Chatzilygeroudis Date: Fri, 9 Sep 2022 15:52:09 +0300 Subject: [PATCH 5/7] Fix cmake and waf_tools --- cmake/FindEGL.cmake | 86 ++++++++++++++++++++++++++++++++++++++++++++ cmake/FindGLFW.cmake | 20 +++++++---- waf_tools/magnum.py | 86 ++++++++++++++++++++++---------------------- wscript | 1 + 4 files changed, 145 insertions(+), 48 deletions(-) create mode 100644 cmake/FindEGL.cmake diff --git a/cmake/FindEGL.cmake b/cmake/FindEGL.cmake new file mode 100644 index 00000000..c7a3f0f9 --- /dev/null +++ b/cmake/FindEGL.cmake @@ -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š +# +# 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) \ No newline at end of file diff --git a/cmake/FindGLFW.cmake b/cmake/FindGLFW.cmake index ed82186d..f391f96b 100644 --- a/cmake/FindGLFW.cmake +++ b/cmake/FindGLFW.cmake @@ -20,8 +20,8 @@ # # This file is part of Magnum. # -# Copyright © 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019 -# Vladimír Vondruš +# Copyright © 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, +# 2020, 2021, 2022 Vladimír Vondruš # Copyright © 2016 Jonathan Hale # # Permission is hereby granted, free of charge, to any person obtaining a @@ -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 @@ -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() diff --git a/waf_tools/magnum.py b/waf_tools/magnum.py index cb69a035..a35db12b 100644 --- a/waf_tools/magnum.py +++ b/waf_tools/magnum.py @@ -396,50 +396,52 @@ def fatal(required, msg): fatal(required, 'Not found') return # to-do: maybe copy flags? - elif component == 'WindowlessEglApplication' and (not egl_found): - # 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 - + elif component == 'WindowlessEglApplication': if not egl_found: - fatal(required, 'Not found') - return - elif (component == 'WindowlessGlxApplication' or component == 'GlxApplication') and (not glx_found): - # [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 - + # 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': 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' diff --git a/wscript b/wscript index 54e2acdb..fa35f1d3 100644 --- a/wscript +++ b/wscript @@ -403,6 +403,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 From 447df071f87190bbd01ae6c75222e62334bc53d3 Mon Sep 17 00:00:00 2001 From: Konstantinos Chatzilygeroudis Date: Mon, 12 Sep 2022 09:44:41 +0300 Subject: [PATCH 6/7] Let's fix/test CI --- ci/install_magnum.sh | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/ci/install_magnum.sh b/ci/install_magnum.sh index e01e9589..a6e7aedd 100755 --- a/ci/install_magnum.sh +++ b/ci/install_magnum.sh @@ -20,9 +20,10 @@ cd ../.. # install Magnum git clone https://github.com/mosra/magnum.git cd magnum +git checkout eb89b5cbf9d0ea898d5d0528805f05c85c35004a # TO-DO: Temporary!! 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_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 -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 ../.. @@ -31,7 +32,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 ../.. @@ -40,7 +41,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 ../.. From 54757d41cadcf43c7b2ecc163412cb25c3dd3018 Mon Sep 17 00:00:00 2001 From: Konstantinos Chatzilygeroudis Date: Fri, 23 Sep 2022 02:06:27 +0300 Subject: [PATCH 7/7] TARGET_EGL reached Magnum master now :) --- ci/install_magnum.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/ci/install_magnum.sh b/ci/install_magnum.sh index a6e7aedd..5da7b0ae 100755 --- a/ci/install_magnum.sh +++ b/ci/install_magnum.sh @@ -20,7 +20,6 @@ cd ../.. # install Magnum git clone https://github.com/mosra/magnum.git cd magnum -git checkout eb89b5cbf9d0ea898d5d0528805f05c85c35004a # TO-DO: Temporary!! mkdir build && cd build # Ubuntu 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 ..