mirror of
https://gitlab.com/kicad/code/kicad.git
synced 2025-09-13 17:53:11 +02:00
Replace glew with epoxy
Glew has the problem that it has to be selected at build time if GLX or EGL is supported by the library, and this in not encoded in the library name, nor ABI, nor anything. Then it's easy to get into the situation that a binary is built but cannot run because glew supports an API different from the one used by wxWidgets, or the binary fails to link in the end after all objects are compiled. epoxy can support both with the same library avoiding this problem. epoxy is not initialized explicitly, replaced initialization with version check where one was not done already. It seems to be available as vcpkg https://vcpkg.link/ports/libepoxy There are problems related to GL context switching on Windows which does not seem to be used in kicad https://github.com/anholt/libepoxy#known-issues-when-running-on-windows There is also a problem related to multithreaded rendering on Windows https://github.com/anholt/libepoxy/pull/265 It's harder to tell if threading is used for rendering but it does not look like kicad is doing anything complex enough to warrant using multiple rendering threads. Fixes https://gitlab.com/kicad/code/kicad/-/issues/20630 Fixes https://gitlab.com/kicad/code/kicad/-/issues/12543
This commit is contained in:
parent
d2307fdcaa
commit
0c36e16292
@ -22,7 +22,7 @@
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include <gal/opengl/kiglew.h> // Must be included first
|
||||
#include <gal/opengl/kiepoxy.h> // Must be included first
|
||||
#include <gal/opengl/gl_utils.h>
|
||||
#include <wx/tokenzr.h>
|
||||
|
||||
@ -226,21 +226,12 @@ bool EDA_3D_CANVAS::initializeOpenGL()
|
||||
{
|
||||
wxLogTrace( m_logTrace, wxT( "EDA_3D_CANVAS::initializeOpenGL" ) );
|
||||
|
||||
const GLenum err = glewInit();
|
||||
|
||||
if( GLEW_OK != err )
|
||||
// Check the OpenGL version (minimum 2.1 is required)
|
||||
if( epoxy_gl_version() < 21 )
|
||||
{
|
||||
const wxString msgError = (const char*) glewGetErrorString( err );
|
||||
|
||||
wxLogMessage( msgError );
|
||||
|
||||
wxLogMessage( wxS( "OpenGL 2.1 or higher is required!" ) );
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
wxLogTrace( m_logTrace, wxT( "EDA_3D_CANVAS::initializeOpenGL Using GLEW version %s" ),
|
||||
From_UTF8( (char*) glewGetString( GLEW_VERSION ) ) );
|
||||
}
|
||||
|
||||
SetOpenGLInfo( (const char*) glGetString( GL_VENDOR ), (const char*) glGetString( GL_RENDERER ),
|
||||
(const char*) glGetString( GL_VERSION ) );
|
||||
|
@ -27,7 +27,7 @@
|
||||
* 3d models that come in the original data from the files without any transformations.
|
||||
*/
|
||||
|
||||
#include <gal/opengl/kiglew.h> // Must be included first
|
||||
#include <gal/opengl/kiepoxy.h> // Must be included first
|
||||
#include <iostream>
|
||||
#include "3d_rendering/opengl/3d_model.h"
|
||||
#include "eda_3d_model_viewer.h"
|
||||
@ -183,23 +183,17 @@ void EDA_3D_MODEL_VIEWER::Clear3DModel()
|
||||
|
||||
void EDA_3D_MODEL_VIEWER::ogl_initialize()
|
||||
{
|
||||
const GLenum err = glewInit();
|
||||
|
||||
if( GLEW_OK != err )
|
||||
{
|
||||
const wxString msgError = (const char*) glewGetErrorString( err );
|
||||
|
||||
wxLogMessage( msgError );
|
||||
}
|
||||
else
|
||||
{
|
||||
wxLogTrace( m_logTrace, wxT( "EDA_3D_MODEL_VIEWER::ogl_initialize Using GLEW version %s" ),
|
||||
From_UTF8( (char*) glewGetString( GLEW_VERSION ) ) );
|
||||
}
|
||||
// Check the OpenGL version (minimum 2.1 is required)
|
||||
if( epoxy_gl_version() < 21 )
|
||||
wxLogMessage( wxS( "OpenGL 2.1 or higher is required!" ) );
|
||||
|
||||
SetOpenGLInfo( (const char*) glGetString( GL_VENDOR ), (const char*) glGetString( GL_RENDERER ),
|
||||
(const char*) glGetString( GL_VERSION ) );
|
||||
|
||||
wxString version = From_UTF8( (char*) glGetString( GL_VERSION ) );
|
||||
|
||||
wxLogTrace( m_logTrace, wxS( "EDA_3D_MODEL_VIEWER::%s OpenGL version string %s." ), __WXFUNCTION__, version );
|
||||
|
||||
glHint( GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST );
|
||||
glHint( GL_LINE_SMOOTH_HINT, GL_NICEST );
|
||||
glHint( GL_POLYGON_SMOOTH_HINT, GL_NICEST );
|
||||
|
@ -28,7 +28,7 @@
|
||||
*/
|
||||
#include <algorithm>
|
||||
#include <stdexcept>
|
||||
#include <gal/opengl/kiglew.h> // Must be included first
|
||||
#include <gal/opengl/kiepoxy.h> // Must be included first
|
||||
|
||||
#include "3d_model.h"
|
||||
#include "../common_ogl/ogl_utils.h"
|
||||
|
@ -24,7 +24,7 @@
|
||||
*/
|
||||
|
||||
#include <cstdint>
|
||||
#include <gal/opengl/kiglew.h> // Must be included first
|
||||
#include <gal/opengl/kiepoxy.h> // Must be included first
|
||||
|
||||
#include "plugins/3dapi/xv3d_types.h"
|
||||
#include "render_3d_opengl.h"
|
||||
|
@ -23,7 +23,7 @@
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include <gal/opengl/kiglew.h> // Must be included first
|
||||
#include <gal/opengl/kiepoxy.h> // Must be included first
|
||||
|
||||
#include <algorithm>
|
||||
#include <atomic>
|
||||
@ -217,7 +217,7 @@ bool RENDER_3D_RAYTRACE_GL::Redraw( bool aIsMoving, REPORTER* aStatusReporter,
|
||||
|
||||
void RENDER_3D_RAYTRACE_GL::initPbo()
|
||||
{
|
||||
if( GLEW_ARB_pixel_buffer_object )
|
||||
if( epoxy_has_gl_extension( "GL_ARB_pixel_buffer_object" ) )
|
||||
{
|
||||
m_openglSupportsVertexBufferObjects = true;
|
||||
|
||||
@ -238,7 +238,6 @@ void RENDER_3D_RAYTRACE_GL::initPbo()
|
||||
glBufferDataARB( GL_PIXEL_UNPACK_BUFFER_ARB, m_pboDataSize, 0, GL_STREAM_DRAW_ARB );
|
||||
glBindBufferARB( GL_PIXEL_UNPACK_BUFFER_ARB, 0 );
|
||||
|
||||
wxLogTrace( m_logTrace,
|
||||
wxT( "RENDER_3D_RAYTRACE_GL:: GLEW_ARB_pixel_buffer_object is supported" ) );
|
||||
wxLogTrace( m_logTrace, wxS( "RENDER_3D_RAYTRACE_GL:: GL_ARB_pixel_buffer_object is supported" ) );
|
||||
}
|
||||
}
|
||||
|
@ -28,7 +28,7 @@
|
||||
*/
|
||||
|
||||
#include <stdexcept>
|
||||
#include <gal/opengl/kiglew.h> // Must be included first
|
||||
#include <gal/opengl/kiepoxy.h> // Must be included first
|
||||
|
||||
#include "openGL_includes.h"
|
||||
#include "ogl_utils.h"
|
||||
|
106
CMakeLists.txt
106
CMakeLists.txt
@ -115,17 +115,6 @@ option( KICAD_UPDATE_CHECK
|
||||
"Build in update check"
|
||||
ON )
|
||||
|
||||
# EGL is only needed on Linux with Wayland
|
||||
cmake_dependent_option( KICAD_USE_EGL
|
||||
"Build KiCad with EGL backend support for Wayland."
|
||||
OFF "UNIX_NOT_APPLE"
|
||||
OFF)
|
||||
|
||||
cmake_dependent_option( KICAD_USE_BUNDLED_GLEW
|
||||
"Use the bundled version of GLEW - only available when KICAD_USE_EGL is set"
|
||||
ON "KICAD_USE_EGL"
|
||||
OFF )
|
||||
|
||||
cmake_dependent_option( KICAD_WAYLAND
|
||||
"Support Wayland features"
|
||||
ON "KICAD_USE_EGL"
|
||||
@ -286,16 +275,6 @@ add_compile_definitions( $<$<BOOL:${KICAD_GAL_PROFILE}>:KICAD_GAL_PROFILE> )
|
||||
add_compile_definitions( $<$<BOOL:${KICAD_WIN32_VERIFY_CODESIGN}>:KICAD_WIN32_VERIFY_CODESIGN> )
|
||||
add_compile_definitions( $<$<BOOL:${KICAD_UPDATE_CHECK}>:KICAD_UPDATE_CHECK> )
|
||||
|
||||
if( KICAD_USE_EGL )
|
||||
message( STATUS "Configuring KiCad for the wxGLCanvas EGL backend" )
|
||||
add_compile_definitions( KICAD_USE_EGL )
|
||||
endif()
|
||||
|
||||
if( KICAD_WAYLAND )
|
||||
message( STATUS "Configuring KiCad to support Wayland features" )
|
||||
add_compile_definitions( KICAD_WAYLAND )
|
||||
endif()
|
||||
|
||||
if( KICAD_IPC_API )
|
||||
add_definitions( -DKICAD_IPC_API )
|
||||
endif()
|
||||
@ -755,50 +734,6 @@ if( KICAD_BUILD_I18N )
|
||||
find_package( Gettext REQUIRED )
|
||||
endif()
|
||||
|
||||
#
|
||||
# Find OpenGL library, required
|
||||
#
|
||||
if( KICAD_USE_EGL )
|
||||
find_package( OpenGL REQUIRED COMPONENTS OpenGL EGL )
|
||||
else()
|
||||
set( OpenGL_GL_PREFERENCE "LEGACY" ) # CMake 3.11+ setting; see 'cmake --help-policy CMP0072'
|
||||
find_package( OpenGL REQUIRED )
|
||||
endif()
|
||||
|
||||
#
|
||||
# Find GLEW library, required
|
||||
#
|
||||
# The EGL canvas on GTK requires the use of a GLEW version compiled with an EGL flag.
|
||||
# The one built in the thirdparty directory has the flag for EGL set, so we use it unless told
|
||||
# otherwise. Then we search for the system GLEW version and use that instead.
|
||||
#
|
||||
if( KICAD_USE_EGL AND KICAD_USE_BUNDLED_GLEW AND UNIX AND NOT APPLE )
|
||||
if( OpenGL_EGL_FOUND )
|
||||
message( STATUS "Found OpenGL EGL library: ${OPENGL_egl_LIBRARY}" )
|
||||
else()
|
||||
message( FATAL_ERROR "OpenGL EGL library not found" )
|
||||
endif()
|
||||
|
||||
# Add the custom GLEW target
|
||||
add_subdirectory( thirdparty/glew )
|
||||
|
||||
# Set the standard package variables to point to our custom target to mimic the system version.
|
||||
set( GLEW_LIBRARIES glew )
|
||||
set( GLEW_FOUND TRUE )
|
||||
include_directories( SYSTEM $<TARGET_PROPERTY:glew,INCLUDE_DIRECTORIES> )
|
||||
else()
|
||||
find_package( GLEW REQUIRED )
|
||||
check_find_package_result( GLEW_FOUND "GLEW" )
|
||||
include_directories( SYSTEM ${GLEW_INCLUDE_DIR} )
|
||||
endif()
|
||||
|
||||
#
|
||||
# Find GLM library, required
|
||||
#
|
||||
find_package( GLM 0.9.8 REQUIRED )
|
||||
add_compile_definitions( GLM_FORCE_CTOR_INIT )
|
||||
include_directories( SYSTEM ${GLM_INCLUDE_DIR} )
|
||||
|
||||
#
|
||||
# Find zlib library, required
|
||||
#
|
||||
@ -1077,6 +1012,8 @@ else()
|
||||
message( FATAL_ERROR "Unable to detect wxWidgets port")
|
||||
endif()
|
||||
|
||||
message(STATUS "wxUSE_GLCANVAS_EGL=${wxWidgets_GLCANVAS_EGL}")
|
||||
|
||||
if( NOT MSVC )
|
||||
if( ${wxWidgets_VERSION_STRING} VERSION_LESS 3.2 )
|
||||
message( FATAL_ERROR "wxWidgets 3.2.0 or greater is required" )
|
||||
@ -1111,6 +1048,45 @@ if( APPLE )
|
||||
)
|
||||
endif()
|
||||
|
||||
#
|
||||
# Find OpenGL library, required
|
||||
#
|
||||
if( wxWidgets_GLCANVAS_EGL EQUAL 1 )
|
||||
set( KICAD_USE_EGL ON )
|
||||
find_package( OpenGL REQUIRED COMPONENTS OpenGL EGL )
|
||||
else()
|
||||
set( KICAD_USE_EGL OFF )
|
||||
set( OpenGL_GL_PREFERENCE "LEGACY" ) # CMake 3.11+ setting; see 'cmake --help-policy CMP0072'
|
||||
find_package( OpenGL REQUIRED )
|
||||
endif()
|
||||
if( NOT OPENGL_GLU_FOUND )
|
||||
MESSAGE( FATAL_ERROR "The OpenGL GLU library is required." )
|
||||
endif()
|
||||
|
||||
if( KICAD_USE_EGL )
|
||||
message( STATUS "Configuring KiCad for the wxGLCanvas EGL backend" )
|
||||
add_compile_definitions( KICAD_USE_EGL )
|
||||
endif()
|
||||
|
||||
if( KICAD_WAYLAND )
|
||||
message( STATUS "Configuring KiCad to support Wayland features" )
|
||||
add_compile_definitions( KICAD_WAYLAND )
|
||||
endif()
|
||||
|
||||
#
|
||||
# Find Epoxy library, required
|
||||
#
|
||||
find_package( epoxy REQUIRED )
|
||||
check_find_package_result( EPOXY_FOUND "epoxy" )
|
||||
include_directories( SYSTEM ${epoxy_INCLUDE_DIR} )
|
||||
|
||||
#
|
||||
# Find GLM library, required
|
||||
#
|
||||
find_package( GLM 0.9.8 REQUIRED )
|
||||
add_compile_definitions( GLM_FORCE_CTOR_INIT )
|
||||
include_directories( SYSTEM ${GLM_INCLUDE_DIR} )
|
||||
|
||||
|
||||
if( KICAD_USE_SENTRY )
|
||||
set( KICAD_SENTRY_DSN "" CACHE STRING "The sentry DSN used with sentry integration" )
|
||||
|
@ -35,8 +35,6 @@ Licensed under MIT:
|
||||
- sentry-native in thirdparty/sentry-native
|
||||
- thread-pool in thirdparty/thread-pool
|
||||
- tinyspline_lib in thirdparty/tinyspline_lib
|
||||
Licensed under MIT and BSD:
|
||||
- glew in thirdparty/glew
|
||||
Licensed under BSD:
|
||||
- pybind11 in thirdparty/pybind11
|
||||
Licensed under BSD2:
|
||||
|
@ -1,69 +0,0 @@
|
||||
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
||||
# file Copyright.txt or https://cmake.org/licensing for details.
|
||||
|
||||
#.rst:
|
||||
# FindGLEW
|
||||
# --------
|
||||
#
|
||||
# Find the OpenGL Extension Wrangler Library (GLEW)
|
||||
#
|
||||
# IMPORTED Targets
|
||||
# ^^^^^^^^^^^^^^^^
|
||||
#
|
||||
# This module defines the :prop_tgt:`IMPORTED` target ``GLEW::GLEW``,
|
||||
# if GLEW has been found.
|
||||
#
|
||||
# Result Variables
|
||||
# ^^^^^^^^^^^^^^^^
|
||||
#
|
||||
# This module defines the following variables:
|
||||
#
|
||||
# ::
|
||||
#
|
||||
# GLEW_INCLUDE_DIRS - include directories for GLEW
|
||||
# GLEW_LIBRARIES - libraries to link against GLEW
|
||||
# GLEW_FOUND - true if GLEW has been found and can be used
|
||||
|
||||
find_path(GLEW_INCLUDE_DIR GL/glew.h)
|
||||
|
||||
if(NOT GLEW_LIBRARY)
|
||||
find_library(GLEW_LIBRARY_RELEASE NAMES GLEW glew32 glew glew32s PATH_SUFFIXES lib64)
|
||||
find_library(GLEW_LIBRARY_DEBUG NAMES GLEWd glew32d glewd PATH_SUFFIXES lib64)
|
||||
|
||||
include(SelectLibraryConfigurations)
|
||||
select_library_configurations(GLEW)
|
||||
endif ()
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(GLEW
|
||||
REQUIRED_VARS GLEW_INCLUDE_DIR GLEW_LIBRARY)
|
||||
|
||||
if(GLEW_FOUND)
|
||||
set(GLEW_INCLUDE_DIRS ${GLEW_INCLUDE_DIR})
|
||||
|
||||
if(NOT GLEW_LIBRARIES)
|
||||
set(GLEW_LIBRARIES ${GLEW_LIBRARY})
|
||||
endif()
|
||||
|
||||
if (NOT TARGET GLEW::GLEW)
|
||||
add_library(GLEW::GLEW UNKNOWN IMPORTED)
|
||||
set_target_properties(GLEW::GLEW PROPERTIES
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${GLEW_INCLUDE_DIRS}")
|
||||
|
||||
if(GLEW_LIBRARY_RELEASE)
|
||||
set_property(TARGET GLEW::GLEW APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE)
|
||||
set_target_properties(GLEW::GLEW PROPERTIES IMPORTED_LOCATION_RELEASE "${GLEW_LIBRARY_RELEASE}")
|
||||
endif()
|
||||
|
||||
if(GLEW_LIBRARY_DEBUG)
|
||||
set_property(TARGET GLEW::GLEW APPEND PROPERTY IMPORTED_CONFIGURATIONS DEBUG)
|
||||
set_target_properties(GLEW::GLEW PROPERTIES IMPORTED_LOCATION_DEBUG "${GLEW_LIBRARY_DEBUG}")
|
||||
endif()
|
||||
|
||||
if(NOT GLEW_LIBRARY_RELEASE AND NOT GLEW_LIBRARY_DEBUG)
|
||||
set_property(TARGET GLEW::GLEW APPEND PROPERTY IMPORTED_LOCATION "${GLEW_LIBRARY}")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
mark_as_advanced(GLEW_INCLUDE_DIR)
|
106
cmake/Findepoxy.cmake
Normal file
106
cmake/Findepoxy.cmake
Normal file
@ -0,0 +1,106 @@
|
||||
# SPDX-FileCopyrightText: 2014 Fredrik Höglund <fredrik@kde.org>
|
||||
# SPDX-FileCopyrightText: 2020 Vlad Zahorodnii <vlad.zahorodnii@kde.org>
|
||||
#
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
#[=======================================================================[.rst:
|
||||
Findepoxy
|
||||
---------
|
||||
|
||||
Try to find libepoxy on a Unix system.
|
||||
|
||||
This will define the following variables:
|
||||
|
||||
``epoxy_FOUND``
|
||||
True if (the requested version of) libepoxy is available
|
||||
``epoxy_VERSION``
|
||||
The version of libepoxy
|
||||
``epoxy_LIBRARIES``
|
||||
This should be passed to target_link_libraries() if the target is not
|
||||
used for linking
|
||||
``epoxy_INCLUDE_DIRS``
|
||||
This should be passed to target_include_directories() if the target is not
|
||||
used for linking
|
||||
``epoxy_DEFINITIONS``
|
||||
This should be passed to target_compile_options() if the target is not
|
||||
used for linking
|
||||
``epoxy_HAS_GLX``
|
||||
True if GLX support is available
|
||||
``epoxy_HAS_EGL``
|
||||
True if EGL support is available
|
||||
``epoxy_HAS_WGL``
|
||||
True if WGL support is available
|
||||
|
||||
If ``epoxy_FOUND`` is TRUE, it will also define the following imported target:
|
||||
|
||||
``epoxy::epoxy``
|
||||
The epoxy library
|
||||
|
||||
In general we recommend using the imported target, as it is easier to use.
|
||||
Bear in mind, however, that if the target is in the link interface of an
|
||||
exported library, it must be made available by the package config file.
|
||||
#]=======================================================================]
|
||||
|
||||
find_package(PkgConfig QUIET)
|
||||
pkg_check_modules(PKG_epoxy QUIET epoxy)
|
||||
|
||||
set(epoxy_VERSION ${PKG_epoxy_VERSION})
|
||||
set(epoxy_DEFINITIONS ${PKG_epoxy_CFLAGS})
|
||||
|
||||
find_path(epoxy_INCLUDE_DIRS
|
||||
NAMES epoxy/gl.h
|
||||
HINTS ${PKG_epoxy_INCLUDEDIR} ${PKG_epoxy_INCLUDE_DIRS}
|
||||
)
|
||||
find_library(epoxy_LIBRARIES
|
||||
NAMES epoxy
|
||||
HINTS ${PKG_epoxy_LIBDIR} ${PKG_epoxy_LIBRARY_DIRS}
|
||||
)
|
||||
find_file(epoxy_GLX_HEADER NAMES epoxy/glx.h HINTS ${epoxy_INCLUDE_DIR})
|
||||
|
||||
if (epoxy_GLX_HEADER STREQUAL "epoxy_GLX_HEADER-NOTFOUND")
|
||||
set(epoxy_HAS_GLX FALSE CACHE BOOL "whether glx is available")
|
||||
else ()
|
||||
set(epoxy_HAS_GLX TRUE CACHE BOOL "whether glx is available")
|
||||
endif()
|
||||
|
||||
find_file(epoxy_EGL_HEADER NAMES epoxy/egl.h HINTS ${epoxy_INCLUDE_DIR})
|
||||
|
||||
if (epoxy_EGL_HEADER STREQUAL "epoxy_EGL_HEADER-NOTFOUND")
|
||||
set(epoxy_HAS_EGL FALSE CACHE BOOL "whether egl is available")
|
||||
else ()
|
||||
set(epoxy_HAS_EGL TRUE CACHE BOOL "whether egl is available")
|
||||
endif()
|
||||
|
||||
find_file(epoxy_WGL_HEADER NAMES epoxy/wgl.h HINTS ${epoxy_INCLUDE_DIR})
|
||||
|
||||
if (epoxy_WGL_HEADER STREQUAL "epoxy_WGL_HEADER-NOTFOUND")
|
||||
set(epoxy_HAS_WGL FALSE CACHE BOOL "whether wgl is available")
|
||||
else ()
|
||||
set(epoxy_HAS_WGL TRUE CACHE BOOL "whether wgl is available")
|
||||
endif()
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(epoxy
|
||||
FOUND_VAR epoxy_FOUND
|
||||
REQUIRED_VARS epoxy_LIBRARIES epoxy_INCLUDE_DIRS
|
||||
VERSION_VAR epoxy_VERSION
|
||||
)
|
||||
|
||||
if (epoxy_FOUND AND NOT TARGET epoxy::epoxy)
|
||||
add_library(epoxy::epoxy UNKNOWN IMPORTED)
|
||||
set_target_properties(epoxy::epoxy PROPERTIES
|
||||
IMPORTED_LOCATION "${epoxy_LIBRARIES}"
|
||||
INTERFACE_COMPILE_OPTIONS "${epoxy_DEFINITIONS}"
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${epoxy_INCLUDE_DIRS}"
|
||||
)
|
||||
endif()
|
||||
|
||||
mark_as_advanced(
|
||||
epoxy_DEFINITIONS
|
||||
epoxy_HAS_GLX
|
||||
epoxy_HAS_EGL
|
||||
epoxy_HAS_WGL
|
||||
epoxy_INCLUDE_DIRS
|
||||
epoxy_LIBRARIES
|
||||
epoxy_VERSION
|
||||
)
|
@ -784,6 +784,14 @@ else()
|
||||
|
||||
DBG_MSG_V("wxWidgets_CXX_FLAGS=${wxWidgets_CXX_FLAGS}")
|
||||
|
||||
execute_process(
|
||||
COMMAND sh -c "echo '#include <wx/platform.h>' ; echo CMAKE_WXTEST_RESULT wxUSE_GLCANVAS_EGL"
|
||||
COMMAND ${CMAKE_CXX_COMPILER} ${wxWidgets_CXX_FLAGS} -E -
|
||||
COMMAND grep CMAKE_WXTEST_RESULT
|
||||
COMMAND awk "{print $2}"
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
OUTPUT_VARIABLE wxWidgets_GLCANVAS_EGL )
|
||||
|
||||
# parse definitions from cxxflags;
|
||||
# drop -D* from CXXFLAGS and the -D prefix
|
||||
string(REGEX MATCHALL "-D[^;]+"
|
||||
|
@ -21,9 +21,6 @@ include_directories(
|
||||
# Get the GAL Target
|
||||
add_subdirectory( gal )
|
||||
|
||||
# Only for win32 cross compilation using MXE
|
||||
add_compile_definitions( $<$<AND:$<BOOL:${WIN32}>,$<BOOL:${MSYS}>>:GLEW_STATIC> )
|
||||
|
||||
|
||||
# The build version string defaults to the value in the KiCadVersion.cmake file.
|
||||
# If being built inside a git repository, the git tag and commit hash are used to create
|
||||
|
@ -65,7 +65,7 @@ target_link_libraries( gal
|
||||
kimath
|
||||
kiplatform
|
||||
nlohmann_json
|
||||
${GLEW_LIBRARIES}
|
||||
${epoxy_LIBRARIES}
|
||||
${CAIRO_LIBRARIES}
|
||||
${PIXMAN_LIBRARIES}
|
||||
${OPENGL_LIBRARIES}
|
||||
@ -143,4 +143,4 @@ add_shader( gal smaa_pass_1_vert.glsl glsl_smaa_pass_1_vert )
|
||||
add_shader( gal smaa_pass_2_frag.glsl glsl_smaa_pass_2_frag )
|
||||
add_shader( gal smaa_pass_2_vert.glsl glsl_smaa_pass_2_vert )
|
||||
add_shader( gal smaa_pass_3_frag.glsl glsl_smaa_pass_3_frag )
|
||||
add_shader( gal smaa_pass_3_vert.glsl glsl_smaa_pass_3_vert )
|
||||
add_shader( gal smaa_pass_3_vert.glsl glsl_smaa_pass_3_vert )
|
||||
|
@ -54,7 +54,7 @@ CACHED_CONTAINER_GPU::CACHED_CONTAINER_GPU( unsigned int aSize ) :
|
||||
m_isMapped( false ),
|
||||
m_glBufferHandle( -1 )
|
||||
{
|
||||
m_useCopyBuffer = GLEW_ARB_copy_buffer;
|
||||
m_useCopyBuffer = epoxy_has_gl_extension( "GL_ARB_copy_buffer" );
|
||||
|
||||
wxString vendor( glGetString( GL_VENDOR ) );
|
||||
|
||||
|
@ -2694,44 +2694,27 @@ void OPENGL_GAL::init()
|
||||
// Check correct initialization from the constructor
|
||||
if( m_tesselator == nullptr )
|
||||
throw std::runtime_error( "Could not create the tesselator" );
|
||||
GLenum err = glewInit();
|
||||
|
||||
#ifdef KICAD_USE_EGL
|
||||
// TODO: better way to check when EGL is ready (init fails at "getString(GL_VERSION)")
|
||||
for( int i = 0; i < 10; i++ )
|
||||
{
|
||||
if( GLEW_OK == err )
|
||||
break;
|
||||
|
||||
std::this_thread::sleep_for( std::chrono::milliseconds( 250 ) );
|
||||
err = glewInit();
|
||||
}
|
||||
|
||||
#endif // KICAD_USE_EGL
|
||||
|
||||
SetOpenGLInfo( (const char*) glGetString( GL_VENDOR ), (const char*) glGetString( GL_RENDERER ),
|
||||
(const char*) glGetString( GL_VERSION ) );
|
||||
|
||||
if( GLEW_OK != err )
|
||||
throw std::runtime_error( (const char*) glewGetErrorString( err ) );
|
||||
|
||||
// Check the OpenGL version (minimum 2.1 is required)
|
||||
if( !GLEW_VERSION_2_1 )
|
||||
if( epoxy_gl_version() < 21 )
|
||||
throw std::runtime_error( "OpenGL 2.1 or higher is required!" );
|
||||
|
||||
#if defined( __LINUX__ ) // calling enableGlDebug crashes opengl on some OS (OSX and some Windows)
|
||||
#ifdef DEBUG
|
||||
if( GLEW_ARB_debug_output )
|
||||
if( epoxy_has_gl_extension( "GL_ARB_debug_output" ) )
|
||||
enableGlDebug( true );
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// Framebuffers have to be supported
|
||||
if( !GLEW_EXT_framebuffer_object )
|
||||
if( !epoxy_has_gl_extension( "GL_EXT_framebuffer_object" ) )
|
||||
throw std::runtime_error( "Framebuffer objects are not supported!" );
|
||||
|
||||
// Vertex buffer has to be supported
|
||||
if( !GLEW_ARB_vertex_buffer_object )
|
||||
if( !epoxy_has_gl_extension( "GL_ARB_vertex_buffer_object" ) )
|
||||
throw std::runtime_error( "Vertex buffer objects are not supported!" );
|
||||
|
||||
// Prepare shaders
|
||||
|
@ -26,7 +26,7 @@
|
||||
|
||||
#include <confirm.h> // DisplayError
|
||||
|
||||
#include <gal/opengl/kiglew.h> // Must be included first
|
||||
#include <gal/opengl/kiepoxy.h> // Must be included first
|
||||
|
||||
#include <stdexcept>
|
||||
#include <wx/log.h> // wxLogDebug
|
||||
|
@ -24,7 +24,7 @@
|
||||
#ifndef GL_UTILS_H
|
||||
#define GL_UTILS_H
|
||||
|
||||
#include <gal/opengl/kiglew.h> // Must be included first
|
||||
#include <gal/opengl/kiepoxy.h> // Must be included first
|
||||
#include <wx/glcanvas.h>
|
||||
#include <wx/utils.h>
|
||||
|
||||
|
@ -36,13 +36,14 @@
|
||||
// includes since they transitively include the OpenGL headers.
|
||||
#define GL_SILENCE_DEPRECATION 1
|
||||
|
||||
#include <epoxy/gl.h>
|
||||
|
||||
#if defined( __unix__ ) and not defined( __APPLE__ )
|
||||
|
||||
#ifdef KICAD_USE_EGL
|
||||
|
||||
#if wxUSE_GLCANVAS_EGL
|
||||
// wxWidgets was compiled with the EGL canvas, so use the EGL header for GLEW
|
||||
#include <GL/eglew.h>
|
||||
#include <epoxy/egl.h>
|
||||
#else
|
||||
#error "KICAD_USE_EGL can only be used when wxWidgets is compiled with the EGL canvas"
|
||||
#endif
|
||||
@ -52,23 +53,19 @@
|
||||
#if wxUSE_GLCANVAS_EGL
|
||||
#error "KICAD_USE_EGL must be defined since wxWidgets has been compiled with the EGL canvas"
|
||||
#else
|
||||
// wxWidgets wasn't compiled with the EGL canvas, so use the X11 GLEW
|
||||
#include <GL/glxew.h>
|
||||
#include <epoxy/glx.h>
|
||||
#endif
|
||||
|
||||
#endif // KICAD_USE_EGL
|
||||
|
||||
#else // defined( __unix__ ) and not defined( __APPLE__ )
|
||||
|
||||
// Non-GTK platforms only need the normal GLEW include
|
||||
#include <GL/glew.h>
|
||||
|
||||
#endif // defined( __unix__ ) and not defined( __APPLE__ )
|
||||
|
||||
#ifdef _WIN32
|
||||
|
||||
#include <GL/wglew.h>
|
||||
#include <epoxy/wgl.h>
|
||||
|
||||
#endif // _WIN32
|
||||
|
||||
#include <GL/glu.h>
|
||||
|
||||
#endif // KIGLEW_H_
|
@ -33,7 +33,7 @@
|
||||
#ifndef OPENGL_COMPOSITOR_H_
|
||||
#define OPENGL_COMPOSITOR_H_
|
||||
|
||||
#include <gal/opengl/kiglew.h> // Must be included first
|
||||
#include <gal/opengl/kiepoxy.h> // Must be included first
|
||||
|
||||
#include <gal/compositor.h>
|
||||
#include <gal/opengl/antialiasing.h>
|
||||
|
@ -29,7 +29,7 @@
|
||||
#ifndef SHADER_H_
|
||||
#define SHADER_H_
|
||||
|
||||
#include <gal/opengl/kiglew.h> // Must be included first
|
||||
#include <gal/opengl/kiepoxy.h> // Must be included first
|
||||
|
||||
#include <math/vector2d.h>
|
||||
|
||||
|
@ -32,7 +32,7 @@
|
||||
#ifndef VERTEX_COMMON_H_
|
||||
#define VERTEX_COMMON_H_
|
||||
|
||||
#include <gal/opengl/kiglew.h> // Must be included first
|
||||
#include <gal/opengl/kiepoxy.h> // Must be included first
|
||||
|
||||
#include <math/vector2d.h>
|
||||
|
||||
|
2
thirdparty/CMakeLists.txt
vendored
2
thirdparty/CMakeLists.txt
vendored
@ -24,8 +24,6 @@
|
||||
# Disable shared library building for all thirdparty libraries
|
||||
set( BUILD_SHARED_LIBS OFF )
|
||||
|
||||
# Note: The glew folder isn't added here because it is added inside the main CMakeLists.txt
|
||||
|
||||
# If this is not set, then we cannot set things like ARGPARSE_INSTALL to OFF before the
|
||||
# argparse subdirectory is added. Under the new policy, add_option will allow itself to
|
||||
# be overridden by a previously-set variable like we want to do here. Doing it this way
|
||||
|
21
thirdparty/glew/CMakeLists.txt
vendored
21
thirdparty/glew/CMakeLists.txt
vendored
@ -1,21 +0,0 @@
|
||||
add_library( glew STATIC )
|
||||
|
||||
# Mark the include directory as private so that it doesn't get used by other targets
|
||||
# and is only used when building the actual library.
|
||||
# The actual include directories will be added to the global include paths as
|
||||
# system headers
|
||||
target_include_directories( glew PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/include" )
|
||||
|
||||
# Definitions for compiling GLEW staticly for EGL (extracted from the main GLEW CMakeLists.txt file)
|
||||
add_compile_definitions( GLEW_STATIC )
|
||||
add_compile_definitions( GLEW_EGL )
|
||||
add_compile_definitions( GLEW_NO_GLU )
|
||||
|
||||
target_sources( glew PRIVATE
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src/glew.c
|
||||
)
|
||||
|
||||
target_link_libraries( glew PUBLIC
|
||||
${OPENGL_LIBRARIES}
|
||||
${OPENGL_egl_LIBRARY}
|
||||
)
|
73
thirdparty/glew/LICENSE.txt
vendored
73
thirdparty/glew/LICENSE.txt
vendored
@ -1,73 +0,0 @@
|
||||
The OpenGL Extension Wrangler Library
|
||||
Copyright (C) 2002-2007, Milan Ikits <milan ikits[]ieee org>
|
||||
Copyright (C) 2002-2007, Marcelo E. Magallon <mmagallo[]debian org>
|
||||
Copyright (C) 2002, Lev Povalahev
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
* The name of the author may be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
|
||||
THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
|
||||
Mesa 3-D graphics library
|
||||
Version: 7.0
|
||||
|
||||
Copyright (C) 1999-2007 Brian Paul All Rights Reserved.
|
||||
|
||||
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
|
||||
BRIAN PAUL 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.
|
||||
|
||||
|
||||
Copyright (c) 2007 The Khronos Group Inc.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a
|
||||
copy of this software and/or associated documentation files (the
|
||||
"Materials"), to deal in the Materials without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Materials, and to
|
||||
permit persons to whom the Materials are 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 Materials.
|
||||
|
||||
THE MATERIALS ARE 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
|
||||
MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
|
14
thirdparty/glew/README.md
vendored
14
thirdparty/glew/README.md
vendored
@ -1,14 +0,0 @@
|
||||
This directory contains the source code and includes for the GLEW library
|
||||
(https://github.com/nigels-com/glew). This library is normally dynamically
|
||||
linked to KiCad on all platforms, but wxWidgets 3.1.5+ on Linux requires
|
||||
GLEW compiled with EGL support and most distributions do not supply this
|
||||
(since compiling GLEW for EGL is mutually exclusive with GLEW for X11).
|
||||
|
||||
The source files are generated from the GLEW repo, or can be pulled from
|
||||
a recent GLEW release.
|
||||
|
||||
As of November 10, 2020 this GLEW version was pulled from its GitHub
|
||||
repository and is what should be version upstream version 2.2.0.
|
||||
|
||||
This library is licensed under BSD and MIT licenses, with the actual
|
||||
license text given in the LICENSE file in this directory.
|
3093
thirdparty/glew/include/GL/eglew.h
vendored
3093
thirdparty/glew/include/GL/eglew.h
vendored
File diff suppressed because it is too large
Load Diff
26554
thirdparty/glew/include/GL/glew.h
vendored
26554
thirdparty/glew/include/GL/glew.h
vendored
File diff suppressed because it is too large
Load Diff
1831
thirdparty/glew/include/GL/glxew.h
vendored
1831
thirdparty/glew/include/GL/glxew.h
vendored
File diff suppressed because it is too large
Load Diff
1468
thirdparty/glew/include/GL/wglew.h
vendored
1468
thirdparty/glew/include/GL/wglew.h
vendored
File diff suppressed because it is too large
Load Diff
32167
thirdparty/glew/src/glew.c
vendored
32167
thirdparty/glew/src/glew.c
vendored
File diff suppressed because it is too large
Load Diff
19147
thirdparty/glew/src/glewinfo.c
vendored
19147
thirdparty/glew/src/glewinfo.c
vendored
File diff suppressed because it is too large
Load Diff
1297
thirdparty/glew/src/visualinfo.c
vendored
1297
thirdparty/glew/src/visualinfo.c
vendored
File diff suppressed because it is too large
Load Diff
@ -11,7 +11,6 @@
|
||||
"repository": "https://gitlab.com/kicad/packaging/kicad-vcpkg-registry.git",
|
||||
"baseline": "9c06375b6b62483d39ffe78e5fc2918365ee8ead",
|
||||
"packages": [
|
||||
"glew",
|
||||
"python3",
|
||||
"opencascade",
|
||||
"wxpython",
|
||||
|
@ -19,7 +19,7 @@
|
||||
"boost-uuid",
|
||||
"cairo",
|
||||
"wxwidgets",
|
||||
"glew",
|
||||
"libepoxy",
|
||||
"curl",
|
||||
{
|
||||
"name": "gettext",
|
||||
|
Loading…
x
Reference in New Issue
Block a user