diff --git a/fonts/fonts.conf b/fonts/local.conf similarity index 100% rename from fonts/fonts.conf rename to fonts/local.conf diff --git a/openscad.pro b/openscad.pro index 85051722..2b2d1a0e 100644 --- a/openscad.pro +++ b/openscad.pro @@ -292,6 +292,7 @@ HEADERS += src/typedefs.h \ src/system-gl.h \ src/stl-utils.h \ src/boost-utils.h \ + src/LibraryInfo.h \ src/svg.h \ \ src/lodepng.h \ @@ -350,6 +351,7 @@ SOURCES += src/version_check.cc \ src/stl-utils.cc \ src/boost-utils.cc \ src/PlatformUtils.cc \ + src/LibraryInfo.cc \ \ src/nodedumper.cc \ src/traverser.cc \ diff --git a/src/LibraryInfo.cc b/src/LibraryInfo.cc new file mode 100644 index 00000000..443b4e10 --- /dev/null +++ b/src/LibraryInfo.cc @@ -0,0 +1,102 @@ +#include "LibraryInfo.h" +#include +#include + +#include "version_check.h" +#define STRINGIFY(x) #x +#define TOSTRING(x) STRINGIFY(x) + +#ifdef ENABLE_CGAL +#include "cgal.h" +#include +#if defined(__GNUG__) +#define GCC_INT_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 ) +#if GCC_INT_VERSION > 40600 || defined(__clang__) +#include +#define __openscad_info_demangle__ 1 +#endif // GCC_INT_VERSION +#endif // GNUG +#endif // ENABLE_CGAL + +extern std::vector librarypath; +extern std::vector fontpath; + +std::string LibraryInfo::info() +{ + std::stringstream s; + +#if defined(__GNUG__) && !defined(__clang__) + std::string compiler_info( "GCC " + std::string(TOSTRING(__VERSION__)) ); +#elif defined(_MSC_VER) + std::string compiler_info( "MSVC " + std::string(TOSTRING(_MSC_FULL_VER)) ); +#elif defined(__clang__) + std::string compiler_info( "Clang " + std::string(TOSTRING(__clang_version__)) ); +#else + std::string compiler_info( "unknown compiler" ); +#endif + +#if defined( __MINGW64__ ) + std::string mingwstatus("MingW64"); +#elif defined( __MINGW32__ ) + std::string mingwstatus("MingW32"); +#else + std::string mingwstatus("No"); +#endif + +#ifndef OPENCSG_VERSION_STRING +#define OPENCSG_VERSION_STRING "unknown, <1.3.2" +#endif + +#ifdef QT_VERSION + std::string qtVersion = qVersion(); +#else + std::string qtVersion = "Qt disabled - Commandline Test Version"; +#endif + +#ifdef ENABLE_CGAL + std::string cgal_3d_kernel = typeid(CGAL_Kernel3).name(); + std::string cgal_2d_kernel = typeid(CGAL_Kernel2).name(); + std::string cgal_2d_kernelEx = typeid(CGAL_ExactKernel2).name(); +#if defined(__openscad_info_demangle__) + int status; + cgal_3d_kernel = std::string( abi::__cxa_demangle( cgal_3d_kernel.c_str(), 0, 0, &status ) ); + cgal_2d_kernel = std::string( abi::__cxa_demangle( cgal_2d_kernel.c_str(), 0, 0, &status ) ); + cgal_2d_kernelEx = std::string( abi::__cxa_demangle( cgal_2d_kernelEx.c_str(), 0, 0, &status ) ); +#endif // demangle + boost::replace_all( cgal_3d_kernel, "CGAL::", "" ); + boost::replace_all( cgal_2d_kernel, "CGAL::", "" ); + boost::replace_all( cgal_2d_kernelEx, "CGAL::", "" ); +#else // ENABLE_CGAL + std::string cgal_3d_kernel = ""; + std::string cgal_2d_kernel = ""; + std::string cgal_2d_kernelEx = ""; +#endif // ENABLE_CGAL + + const char *env_path = getenv("OPENSCADPATH"); + const char *env_font_path = getenv("OPENSCAD_FONT_PATH"); + + s << "OpenSCAD Version: " << TOSTRING(OPENSCAD_VERSION) + << "\nCompiler, build date: " << compiler_info << ", " << __DATE__ + << "\nBoost version: " << BOOST_LIB_VERSION + << "\nEigen version: " << EIGEN_WORLD_VERSION << "." << EIGEN_MAJOR_VERSION << "." << EIGEN_MINOR_VERSION + << "\nCGAL version, kernels: " << TOSTRING(CGAL_VERSION) << ", " << cgal_3d_kernel << ", " << cgal_2d_kernel << ", " << cgal_2d_kernelEx + << "\nOpenCSG version: " << OPENCSG_VERSION_STRING + << "\nQt version: " << qtVersion + << "\nMingW build: " << mingwstatus + << "\nGLib version: " << GLIB_MAJOR_VERSION << "." << GLIB_MINOR_VERSION << "." << GLIB_MICRO_VERSION + << "\nOPENSCADPATH: " << (env_path == NULL ? "" : env_path) + << "\nOpenSCAD library path:\n"; + + for (std::vector::iterator it = librarypath.begin();it != librarypath.end();it++) { + s << " " << *it << "\n"; + } + + s << "\nOPENSCAD_FONT_PATH: " << (env_font_path == NULL ? "" : env_font_path) + << "\nOpenSCAD font path:\n"; + + for (std::vector::iterator it = fontpath.begin();it != fontpath.end();it++) { + s << " " << *it << "\n"; + } + + return s.str(); +} diff --git a/src/LibraryInfo.h b/src/LibraryInfo.h new file mode 100644 index 00000000..807b7e01 --- /dev/null +++ b/src/LibraryInfo.h @@ -0,0 +1,7 @@ +#pragma once + +#include + +namespace LibraryInfo { + std::string info(); +} diff --git a/src/PlatformUtils.cc b/src/PlatformUtils.cc index 2199221c..5bb02156 100644 --- a/src/PlatformUtils.cc +++ b/src/PlatformUtils.cc @@ -1,11 +1,8 @@ -#include - #include "PlatformUtils.h" #include "boosty.h" #include extern std::vector librarypath; - extern std::vector fontpath; bool PlatformUtils::createLibraryPath() @@ -79,103 +76,3 @@ bool PlatformUtils::createBackupPath() } return OK; } - -#include "version_check.h" -#define STRINGIFY(x) #x -#define TOSTRING(x) STRINGIFY(x) - -#ifdef ENABLE_CGAL -#include "cgal.h" -#include -#if defined(__GNUG__) -#define GCC_INT_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 ) -#if GCC_INT_VERSION > 40600 || defined(__clang__) -#include -#define __openscad_info_demangle__ 1 -#endif // GCC_INT_VERSION -#endif // GNUG -#endif // ENABLE_CGAL - -#ifdef ENABLE_OPENCSG -#include -#endif - -std::string PlatformUtils::info() -{ - std::stringstream s; - -#if defined(__GNUG__) && !defined(__clang__) - std::string compiler_info( "GCC " + std::string(TOSTRING(__VERSION__)) ); -#elif defined(_MSC_VER) - std::string compiler_info( "MSVC " + std::string(TOSTRING(_MSC_FULL_VER)) ); -#elif defined(__clang__) - std::string compiler_info( "Clang " + std::string(TOSTRING(__clang_version__)) ); -#else - std::string compiler_info( "unknown compiler" ); -#endif - -#if defined( __MINGW64__ ) - std::string mingwstatus("MingW64"); -#elif defined( __MINGW32__ ) - std::string mingwstatus("MingW32"); -#else - std::string mingwstatus("No"); -#endif - -#ifndef OPENCSG_VERSION_STRING -#define OPENCSG_VERSION_STRING "unknown, <1.3.2" -#endif - -#ifdef QT_VERSION - std::string qtVersion = qVersion(); -#else - std::string qtVersion = "Qt disabled - Commandline Test Version"; -#endif - -#ifdef ENABLE_CGAL - std::string cgal_3d_kernel = typeid(CGAL_Kernel3).name(); - std::string cgal_2d_kernel = typeid(CGAL_Kernel2).name(); - std::string cgal_2d_kernelEx = typeid(CGAL_ExactKernel2).name(); -#if defined(__openscad_info_demangle__) - int status; - cgal_3d_kernel = std::string( abi::__cxa_demangle( cgal_3d_kernel.c_str(), 0, 0, &status ) ); - cgal_2d_kernel = std::string( abi::__cxa_demangle( cgal_2d_kernel.c_str(), 0, 0, &status ) ); - cgal_2d_kernelEx = std::string( abi::__cxa_demangle( cgal_2d_kernelEx.c_str(), 0, 0, &status ) ); -#endif // demangle - boost::replace_all( cgal_3d_kernel, "CGAL::", "" ); - boost::replace_all( cgal_2d_kernel, "CGAL::", "" ); - boost::replace_all( cgal_2d_kernelEx, "CGAL::", "" ); -#else // ENABLE_CGAL - std::string cgal_3d_kernel = ""; - std::string cgal_2d_kernel = ""; - std::string cgal_2d_kernelEx = ""; -#endif // ENABLE_CGAL - - const char *env_path = getenv("OPENSCADPATH"); - const char *env_font_path = getenv("OPENSCAD_FONT_PATH"); - - s << "OpenSCAD Version: " << TOSTRING(OPENSCAD_VERSION) - << "\nCompiler, build date: " << compiler_info << ", " << __DATE__ - << "\nBoost version: " << BOOST_LIB_VERSION - << "\nEigen version: " << EIGEN_WORLD_VERSION << "." << EIGEN_MAJOR_VERSION << "." << EIGEN_MINOR_VERSION - << "\nCGAL version, kernels: " << TOSTRING(CGAL_VERSION) << ", " << cgal_3d_kernel << ", " << cgal_2d_kernel << ", " << cgal_2d_kernelEx - << "\nOpenCSG version: " << OPENCSG_VERSION_STRING - << "\nQt version: " << qtVersion - << "\nMingW build: " << mingwstatus - << "\nGLib version: " << GLIB_MAJOR_VERSION << "." << GLIB_MINOR_VERSION << "." << GLIB_MICRO_VERSION - << "\nOPENSCADPATH: " << (env_path == NULL ? "" : env_path) - << "\nOpenSCAD library path:\n"; - - for (std::vector::iterator it = librarypath.begin();it != librarypath.end();it++) { - s << " " << *it << "\n"; - } - - s << "\nOPENSCAD_FONT_PATH: " << (env_font_path == NULL ? "" : env_font_path) - << "\nOpenSCAD font path:\n"; - - for (std::vector::iterator it = fontpath.begin();it != fontpath.end();it++) { - s << " " << *it << "\n"; - } - - return s.str(); -} diff --git a/src/PlatformUtils.h b/src/PlatformUtils.h index 4d1bb1d2..156f8430 100644 --- a/src/PlatformUtils.h +++ b/src/PlatformUtils.h @@ -9,7 +9,6 @@ namespace PlatformUtils { bool createLibraryPath(); std::string backupPath(); bool createBackupPath(); - std::string info(); /** * Single character separating path specifications in a list diff --git a/src/mainwin.cc b/src/mainwin.cc index 77883542..09afe753 100644 --- a/src/mainwin.cc +++ b/src/mainwin.cc @@ -55,6 +55,7 @@ #include "CocoaUtils.h" #endif #include "PlatformUtils.h" +#include "LibraryInfo.h" #include #include @@ -2276,14 +2277,14 @@ MainWindow::helpManual() void MainWindow::helpLibrary() { - QString info( PlatformUtils::info().c_str() ); - info += QString( qglview->getRendererInfo().c_str() ); + QString info(LibraryInfo::info().c_str()); + info += QString(qglview->getRendererInfo().c_str()); if (!this->openglbox) { this->openglbox = new QMessageBox(QMessageBox::Information, "OpenGL Info", "OpenSCAD Detailed Library and Build Information", QMessageBox::Ok, this); } - this->openglbox->setDetailedText( info ); + this->openglbox->setDetailedText(info); this->openglbox->show(); } diff --git a/src/openscad.cc b/src/openscad.cc index cd0bea08..f73f6aa9 100644 --- a/src/openscad.cc +++ b/src/openscad.cc @@ -37,6 +37,7 @@ #include "parsersettings.h" #include "rendersettings.h" #include "PlatformUtils.h" +#include "LibraryInfo.h" #include "nodedumper.h" #include "CocoaUtils.h" @@ -135,7 +136,7 @@ static void version() static void info() { - std::cout << PlatformUtils::info() << "\n\n"; + std::cout << LibraryInfo::info() << "\n\n"; CsgInfo csgInfo = CsgInfo(); try { diff --git a/src/version_check.h b/src/version_check.h index 2688f2a5..c3370ac9 100644 --- a/src/version_check.h +++ b/src/version_check.h @@ -14,6 +14,8 @@ The extensive #else #endif is to ensure only a single error is printed at a time, to avoid confusion. */ +#pragma once + #ifndef OPENSCAD_SKIP_VERSION_CHECK diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index fc84e544..b6e0bf17 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -631,6 +631,8 @@ set(CORE_SOURCES ../src/DrawingCallback.cc ../src/FreetypeRenderer.cc ../src/lodepng.cpp + ../src/PlatformUtils.cc + ../src/${PLATFORMUTILS_SOURCE} ${FLEX_OpenSCADlexer_OUTPUTS} ${BISON_OpenSCADparser_OUTPUTS}) @@ -638,8 +640,7 @@ set(NOCGAL_SOURCES ../src/builtin.cc ../src/import.cc ../src/export.cc - ../src/PlatformUtils.cc - ../src/${PLATFORMUTILS_SOURCE}) + ../src/LibraryInfo.cc) set(CGAL_SOURCES ${NOCGAL_SOURCES}