diff --git a/utils/CMakeLists.txt b/utils/CMakeLists.txt index 78ad79863d..206978b4b1 100644 --- a/utils/CMakeLists.txt +++ b/utils/CMakeLists.txt @@ -4,7 +4,6 @@ if( COMPILER_SUPPORTS_WSHADOW ) endif() add_subdirectory( idftools ) -add_subdirectory( kicad-ogltest ) if( KICAD_USE_OCE OR KICAD_USE_OCC ) add_subdirectory( kicad2step ) diff --git a/utils/kicad-ogltest/CMakeLists.txt b/utils/kicad-ogltest/CMakeLists.txt deleted file mode 100644 index 21aa68c9e7..0000000000 --- a/utils/kicad-ogltest/CMakeLists.txt +++ /dev/null @@ -1,54 +0,0 @@ -include_directories( BEFORE - ${CMAKE_CURRENT_SOURCE_DIR} - ${CMAKE_SOURCE_DIR}/include - ${OPENGL_INCLUDE_DIR} - ${GLEW_INCLUDE_DIR} - ${GLM_INCLUDE_DIR} - ${Boost_INCLUDE_DIR} -) - -include_directories( - ../../include - ../../common - ${INC_AFTER} -) - -set( OGLTEST_FILES - kicad-ogltest.cpp -) - -add_executable( kicad-ogltest WIN32 - ${OGLTEST_FILES} ) - -target_link_libraries( kicad-ogltest - gal - common - polygon - ${wxWidgets_LIBRARIES} ) - -if( APPLE ) - if( KICAD_USE_OCC ) - set( KICAD_BUNDLE_LIBS ${OCC_LIBRARY_DIR} ) - endif() - # puts binary into the main kicad.app bundle while linking - set_target_properties( kicad-ogltest PROPERTIES - RUNTIME_OUTPUT_DIRECTORY ${OSX_BUNDLE_BUILD_BIN_DIR} - ) - # bundle dependencies, rewrite binary to use bundled libraries - install( CODE " - # override default embedded path settings - ${OSX_BUNDLE_OVERRIDE_PATHS} - - # do all the work - include( BundleUtilities ) - fixup_bundle( ${OSX_BUNDLE_BUILD_BIN_DIR}/kicad-ogltest - \"\" - \" ${KICAD_BUNDLE_LIBS}\" - ) - " COMPONENT Runtime - ) -else() - install( TARGETS kicad-ogltest - DESTINATION ${KICAD_BIN} - COMPONENT binary ) -endif() diff --git a/utils/kicad-ogltest/kicad-ogltest.cpp b/utils/kicad-ogltest/kicad-ogltest.cpp deleted file mode 100644 index 31157b900b..0000000000 --- a/utils/kicad-ogltest/kicad-ogltest.cpp +++ /dev/null @@ -1,151 +0,0 @@ -/* - * This program source code file is part of KiCad, a free EDA CAD application. - * - * Copyright (C) 2017 KiCad Developers, see AUTHORS.txt for contributors. - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation, either version 3 of the License, or (at your - * option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see . - */ - -/* - * This executable tests for OpenGL compatibility. This is done in a separate - * process to contain any crashes. - * - * Early version, intended just for user testing. - */ - -#include -#include -#include -#include -#include -#include -#include -#include - -// Required OpenGL version -#define REQUIRED_MAJOR 2L -#define REQUIRED_MINOR 1L - -static wxRegEx OGLVersionRegex( R"(^(\d+)\.(\d+))", wxRE_ADVANCED ); - -static const int glAttributes[] = { WX_GL_RGBA, WX_GL_DOUBLEBUFFER, WX_GL_DEPTH_SIZE, 8, 0 }; - -PGM_BASE& Pgm() -{ - throw std::logic_error("Dummy function called"); -} - - -class OGLTEST_APP : public wxApp -{ -public: - virtual bool OnInit() override; -}; - -wxIMPLEMENT_APP( OGLTEST_APP ); - - -class WX_QUIET -{ - wxLogLevel m_old_level; - wxAssertHandler_t m_old_handler; - -public: - WX_QUIET() - { - m_old_level = wxLog::GetLogLevel(); - m_old_handler = wxSetAssertHandler( nullptr ); - wxLog::SetLogLevel( wxLOG_FatalError ); - } - - ~WX_QUIET() - { - wxLog::SetLogLevel( m_old_level ); - wxSetAssertHandler( m_old_handler ); - } -}; - - -bool OGLTEST_APP::OnInit() -{ - WX_QUIET be_quiet; - - auto frame = new wxFrame( nullptr, wxID_ANY, "OpenGL test", wxDefaultPosition, wxDefaultSize, - wxTOPLEVEL_EX_DIALOG ); - - KIGFX::GAL_DISPLAY_OPTIONS gal_opts; - - auto canvas = new KIGFX::OPENGL_GAL( gal_opts, frame ); - auto context = new wxGLContext( canvas ); - - frame->Raise(); - frame->Show(); - canvas->SetCurrent( *context ); - auto size = canvas->GetSize(); - canvas->ResizeScreen( size.GetWidth(), size.GetHeight() ); - - printf( "INFO: Instantiated GL window\n" ); - - char* pversion = (char*) glGetString( GL_VERSION ); - - if( !pversion ) - { - printf( "FAIL: Cannot get OpenGL version\n" ); - return false; - } - - wxString version = wxString::FromUTF8( pversion ); - - if( !OGLVersionRegex.Matches( version ) ) - { - printf( "FAIL: Cannot interpret OpenGL version %s\n", pversion ); - return false; - } - - wxString smajor = OGLVersionRegex.GetMatch( version, 1 ); - wxString sminor = OGLVersionRegex.GetMatch( version, 2 ); - - long major, minor; - - smajor.ToLong( &major ); - sminor.ToLong( &minor ); - - if( major < REQUIRED_MAJOR || ( major == REQUIRED_MAJOR && minor < REQUIRED_MINOR ) ) - { - printf( "FAIL: Found OpenGL version %ld.%ld, required at least %ld.%ld\n", - major, minor, REQUIRED_MAJOR, REQUIRED_MINOR ); - return false; - } - else - { - printf( "INFO: Found OpenGL version %ld.%ld\n", major, minor ); - } - - { - KIGFX::GAL_DRAWING_CONTEXT ctx( canvas ); - printf( "INFO: Successfully called OPENGL_GAL::beginDrawing\n" ); - } - - bool supported = wxGLCanvas::IsDisplaySupported( &glAttributes[0] ); - - if( supported ) - printf( "PASS\n" ); - else - { - printf( "FAIL: Display settings not supported\n" ); - return false; - } - - return false; -}