From b9a847b78ceaa3b5840429dab1bc50d35c7ef3de Mon Sep 17 00:00:00 2001 From: Riccardo Magliocchetti Date: Mon, 22 Dec 2014 19:10:59 +0100 Subject: Fixup --without-x build Accept gl linkage in hope of future offscreen mesa support. Avoid linking with GLX though. Change-Id: I4e666f60e74fe34075a8da9eeba95807cf8fe38c Signed-off-by: Riccardo Magliocchetti Reviewed-on: https://gerrit.libreoffice.org/13452 Reviewed-by: Michael Stahl Tested-by: Michael Stahl --- configure.ac | 5 ++++- desktop/Library_sofficeapp.mk | 8 ++++++++ desktop/inc/app.hxx | 2 +- desktop/source/app/sofficemain.cxx | 2 +- include/vcl/opengl/OpenGLContext.hxx | 10 +++++++--- include/vcl/opengl/OpenGLHelper.hxx | 4 ++-- svx/Executable_gengal.mk | 7 +++++++ sw/Module_sw.mk | 3 ++- sw/qa/extras/odfimport/odfimport.cxx | 2 +- vcl/Executable_icontest.mk | 2 -- vcl/Module_vcl.mk | 18 +++++++++++++----- vcl/source/opengl/OpenGLContext.cxx | 26 ++++++++++++++------------ vcl/source/opengl/OpenGLHelper.cxx | 2 +- vcl/source/salmain/salmain.cxx | 4 ++-- 14 files changed, 63 insertions(+), 32 deletions(-) diff --git a/configure.ac b/configure.ac index e1f22548b332..d8401fc5b4e7 100644 --- a/configure.ac +++ b/configure.ac @@ -10210,6 +10210,7 @@ else fi AC_SUBST(ENABLE_VLC) +# this is for opengl transitions in impress slideshow ENABLE_OPENGL= if test $_os = iOS -o $_os = Android; then : # disable @@ -10226,7 +10227,9 @@ elif test $_os = WINNT; then SYSTEM_MESA_HEADERS= BUILD_TYPE="$BUILD_TYPE MESA" else - ENABLE_OPENGL=TRUE + if test "$with_x" != "no"; then + ENABLE_OPENGL=TRUE + fi ENABLE_OPENGL_CANVAS=TRUE dnl =================================================================== diff --git a/desktop/Library_sofficeapp.mk b/desktop/Library_sofficeapp.mk index 1f4eb1f015b9..f674d6b06631 100644 --- a/desktop/Library_sofficeapp.mk +++ b/desktop/Library_sofficeapp.mk @@ -91,6 +91,13 @@ $(eval $(call gb_Library_add_exception_objects,sofficeapp,\ desktop/source/migration/migration \ )) +ifeq ($(ENABLE_HEADLESS),TRUE) +$(eval $(call gb_Library_add_libs,sofficeapp,\ + -lm \ + -ldl \ + -lpthread \ +)) +else ifeq ($(OS),LINUX) $(eval $(call gb_Library_use_static_libraries,sofficeapp,\ glxtest \ @@ -105,6 +112,7 @@ $(eval $(call gb_Library_add_libs,sofficeapp,\ -lX11 \ )) endif +endif # LibreOfficeKit bits ifneq ($(filter $(OS),ANDROID IOS),) diff --git a/desktop/inc/app.hxx b/desktop/inc/app.hxx index 2ed33c8f258c..22c40f804180 100644 --- a/desktop/inc/app.hxx +++ b/desktop/inc/app.hxx @@ -193,7 +193,7 @@ OUString ReplaceStringHookProc(const OUString& rStr); } -#if defined( UNX ) && !defined MACOSX && !defined IOS && !defined ANDROID +#if defined( UNX ) && !defined MACOSX && !defined IOS && !defined ANDROID && !defined LIBO_HEADLESS bool fire_glxtest_process(); #endif diff --git a/desktop/source/app/sofficemain.cxx b/desktop/source/app/sofficemain.cxx index 0597a4f0d395..4f7dec977577 100644 --- a/desktop/source/app/sofficemain.cxx +++ b/desktop/source/app/sofficemain.cxx @@ -51,7 +51,7 @@ extern "C" int DESKTOP_DLLPUBLIC soffice_main() { -#if defined( UNX ) && !defined MACOSX && !defined IOS && !defined ANDROID +#if defined( UNX ) && !defined MACOSX && !defined IOS && !defined ANDROID && !defined(LIBO_HEADLESS) /* Run test for OpenGL support in own process to avoid crash with broken * OpenGL drivers. Start process as early as possible. */ diff --git a/include/vcl/opengl/OpenGLContext.hxx b/include/vcl/opengl/OpenGLContext.hxx index 6f665875e256..02769231db34 100644 --- a/include/vcl/opengl/OpenGLContext.hxx +++ b/include/vcl/opengl/OpenGLContext.hxx @@ -17,6 +17,7 @@ #if defined( MACOSX ) #elif defined( IOS ) #elif defined( ANDROID ) +#elif defined( LIBO_HEADLESS ) #elif defined( UNX ) # include # include "GL/glxew.h" @@ -42,6 +43,7 @@ class NSOpenGLView; #endif #elif defined( IOS ) #elif defined( ANDROID ) +#elif defined( LIBO_HEADLESS ) #elif defined( UNX ) #include #define GLX_GLXEXT_PROTOTYPES 1 @@ -110,6 +112,7 @@ struct GLWindow #elif defined( MACOSX ) #elif defined( IOS ) #elif defined( ANDROID ) +#elif defined( LIBO_HEADLESS ) #elif defined( UNX ) Display* dpy; int screen; @@ -137,6 +140,7 @@ struct GLWindow #elif defined( MACOSX ) #elif defined( IOS ) #elif defined( ANDROID ) +#elif defined( LIBO_HEADLESS ) #elif defined( UNX ) dpy(NULL), screen(0), @@ -176,7 +180,7 @@ public: // these methods are for the deep platform layer, don't use them in normal code // only in vcl's platform code -#if defined( UNX ) && !defined MACOSX && !defined IOS && !defined ANDROID +#if defined( UNX ) && !defined MACOSX && !defined IOS && !defined ANDROID && !defined(LIBO_HEADLESS) bool init(Display* dpy, Window win, int screen); bool init(Display* dpy, Pixmap pix, unsigned int width, unsigned int height, int nScreen); #elif defined( _WIN32 ) @@ -237,7 +241,7 @@ private: SAL_DLLPRIVATE bool InitGLEW(); SAL_DLLPRIVATE bool initWindow(); SAL_DLLPRIVATE bool ImplInit(); -#if defined( UNX ) && !defined MACOSX && !defined IOS && !defined ANDROID +#if defined( UNX ) && !defined MACOSX && !defined IOS && !defined ANDROID && !defined(LIBO_HEADLESS) SAL_DLLPRIVATE void initGLWindow(Visual* pVisual); #endif @@ -255,7 +259,7 @@ private: bool mbRequestLegacyContext; bool mbUseDoubleBufferedRendering; bool mbRequestVirtualDevice; -#if defined( UNX ) && !defined MACOSX && !defined IOS && !defined ANDROID +#if defined( UNX ) && !defined MACOSX && !defined IOS && !defined ANDROID && !defined(LIBO_HEADLESS) bool mbPixmap; // is a pixmap instead of a window #endif diff --git a/include/vcl/opengl/OpenGLHelper.hxx b/include/vcl/opengl/OpenGLHelper.hxx index 4e11bf8306ef..2f4aec010e76 100644 --- a/include/vcl/opengl/OpenGLHelper.hxx +++ b/include/vcl/opengl/OpenGLHelper.hxx @@ -16,7 +16,7 @@ #include -#if defined UNX && !defined MACOSX && !defined IOS && !defined ANDROID +#if defined UNX && !defined MACOSX && !defined IOS && !defined ANDROID && !defined(LIBO_HEADLESS) # include # include "GL/glxew.h" # include @@ -67,7 +67,7 @@ public: */ static bool isVCLOpenGLEnabled(); -#if defined UNX && !defined MACOSX && !defined IOS && !defined ANDROID +#if defined UNX && !defined MACOSX && !defined IOS && !defined ANDROID && !defined(LIBO_HEADLESS) static bool GetVisualInfo(Display* pDisplay, int nScreen, XVisualInfo& rVI); static GLXFBConfig GetPixmapFBConfig( Display* pDisplay, bool& bInverted ); #endif diff --git a/svx/Executable_gengal.mk b/svx/Executable_gengal.mk index 17a57dc0f4c7..6e8bda1de304 100644 --- a/svx/Executable_gengal.mk +++ b/svx/Executable_gengal.mk @@ -61,6 +61,12 @@ $(eval $(call gb_Executable_use_system_win32_libs,gengal,\ )) endif +ifeq ($(ENABLE_HEADLESS),TRUE) +$(eval $(call gb_Executable_add_libs,gengal,\ + -ldl \ + -lpthread \ +)) +else ifeq ($(OS),LINUX) $(eval $(call gb_Executable_add_libs,gengal,\ -ldl \ @@ -74,5 +80,6 @@ $(eval $(call gb_Executable_use_static_libraries,gengal,\ glxtest \ )) endif +endif # vim: set noet sw=4 ts=4: diff --git a/sw/Module_sw.mk b/sw/Module_sw.mk index bf110be6a29c..54760102dfd0 100644 --- a/sw/Module_sw.mk +++ b/sw/Module_sw.mk @@ -20,7 +20,8 @@ $(eval $(call gb_Module_Module,sw)) $(eval $(call gb_Module_add_targets,sw,\ - $(call gb_Helper_optional,DESKTOP,Executable_tiledrendering) \ + $(if $(ENABLE_HEADLESS),, \ + $(call gb_Helper_optional,DESKTOP,Executable_tiledrendering)) \ CustomTarget_generated \ Library_msword \ Library_sw \ diff --git a/sw/qa/extras/odfimport/odfimport.cxx b/sw/qa/extras/odfimport/odfimport.cxx index cf24c9a545ec..139e2bc585e5 100644 --- a/sw/qa/extras/odfimport/odfimport.cxx +++ b/sw/qa/extras/odfimport/odfimport.cxx @@ -459,7 +459,7 @@ DECLARE_ODFIMPORT_TEST(testFdo37606Copy, "fdo37606.odt") // Previously copy&paste failed to copy the table in case it was the document-starting one. uno::Reference xTablesSupplier(mxComponent, uno::UNO_QUERY); uno::Reference xTables(xTablesSupplier->getTextTables(), uno::UNO_QUERY); -#if !defined(MACOSX) && !defined(ENABLE_HEADLESS) // FIXME +#if !defined(MACOSX) && !defined(LIBO_HEADLESS) // FIXME CPPUNIT_ASSERT_EQUAL(sal_Int32(2), xTables->getCount()); #endif } diff --git a/vcl/Executable_icontest.mk b/vcl/Executable_icontest.mk index 345203c877ca..28b686bbd7e7 100644 --- a/vcl/Executable_icontest.mk +++ b/vcl/Executable_icontest.mk @@ -26,7 +26,6 @@ $(eval $(call gb_Executable_use_static_libraries,icontest,\ )) ifeq ($(OS),LINUX) - $(eval $(call gb_Executable_add_libs,icontest,\ -lm \ -ldl \ @@ -39,7 +38,6 @@ $(eval $(call gb_Executable_add_libs,icontest,\ $(eval $(call gb_Executable_use_static_libraries,icontest,\ glxtest \ )) - else ifeq ($(OS),WNT) $(eval $(call gb_Executable_use_system_win32_libs,icontest,\ diff --git a/vcl/Module_vcl.mk b/vcl/Module_vcl.mk index 9cc9ee038d87..a0ed040cdbe5 100644 --- a/vcl/Module_vcl.mk +++ b/vcl/Module_vcl.mk @@ -25,12 +25,14 @@ $(eval $(call gb_Module_add_targets,vcl,\ Package_opengl \ $(if $(filter DESKTOP,$(BUILD_TYPE)), \ StaticLibrary_vclmain \ - Executable_ui-previewer \ + $(if $(ENABLE_HEADLESS),, \ + Executable_ui-previewer) \ $(if $(filter LINUX MACOSX WNT,$(OS)), \ - Executable_icontest \ Executable_outdevgrind \ - Executable_vcldemo \ - Executable_mtfdemo )) \ + $(if $(ENABLE_HEADLESS),, \ + Executable_vcldemo \ + Executable_icontest \ + Executable_mtfdemo ))) \ $(if $(filter-out ANDROID IOS WNT,$(OS)), \ Executable_svdemo \ Executable_svptest \ @@ -48,7 +50,7 @@ $(eval $(call gb_Module_add_targets,vcl,\ Library_vclplug_gen \ Library_desktop_detector \ StaticLibrary_headless \ - StaticLibrary_glxtest \ + StaticLibrary_glxtest \ Package_fontunxppds \ Package_fontunxpsprint \ )) @@ -107,10 +109,16 @@ $(eval $(call gb_Module_add_check_targets,vcl,\ CppunitTest_vcl_wmf_test \ )) + ifeq ($(GUIBASE),unx) $(eval $(call gb_Module_add_check_targets,vcl,\ CppunitTest_vcl_timer \ )) endif +ifeq ($(ENABLE_HEADLESS),TRUE) +$(eval $(call gb_Module_add_check_targets,vcl,\ + CppunitTest_vcl_timer \ +)) +endif # vim: set noet sw=4 ts=4: diff --git a/vcl/source/opengl/OpenGLContext.cxx b/vcl/source/opengl/OpenGLContext.cxx index 04aa5dac8ad7..fa0684d063a3 100644 --- a/vcl/source/opengl/OpenGLContext.cxx +++ b/vcl/source/opengl/OpenGLContext.cxx @@ -38,7 +38,7 @@ using namespace com::sun::star; #define MAX_FRAMEBUFFER_COUNT 30 // TODO use rtl::Static instead of 'static' -#if defined( UNX ) && !defined MACOSX && !defined IOS && !defined ANDROID +#if defined( UNX ) && !defined MACOSX && !defined IOS && !defined ANDROID && !defined(LIBO_HEADLESS) static std::vector g_vShareList; #elif defined(WNT) static std::vector g_vShareList; @@ -46,7 +46,7 @@ static std::vector g_vShareList; GLWindow::~GLWindow() { -#if defined( UNX ) && !defined MACOSX && !defined IOS && !defined ANDROID +#if defined( UNX ) && !defined MACOSX && !defined IOS && !defined ANDROID && !defined(LIBO_HEADLESS) XFree(vi); #endif } @@ -69,7 +69,7 @@ OpenGLContext::OpenGLContext(): mpNextContext(NULL) { SAL_INFO("vcl.opengl", "new context: " << this); -#if defined( UNX ) && !defined MACOSX && !defined IOS && !defined ANDROID +#if defined( UNX ) && !defined MACOSX && !defined IOS && !defined ANDROID && !defined(LIBO_HEADLESS) mbPixmap = false; #endif @@ -450,7 +450,7 @@ debug_callback(GLenum source, GLenum type, GLuint id, #endif -#if defined UNX && !defined MACOSX && !defined IOS && !defined ANDROID +#if defined UNX && !defined MACOSX && !defined IOS && !defined ANDROID && !defined(LIBO_HEADLESS) namespace { @@ -679,7 +679,7 @@ bool OpenGLContext::init(SystemChildWindow* pChildWindow) return ImplInit(); } -#if defined( UNX ) && !defined MACOSX && !defined IOS && !defined ANDROID +#if defined( UNX ) && !defined MACOSX && !defined IOS && !defined ANDROID && !defined(LIBO_HEADLESS) bool OpenGLContext::init(Display* dpy, Window win, int screen) { if(mbInitialized) @@ -1125,7 +1125,7 @@ bool OpenGLContext::initWindow() return true; } -#elif defined( IOS ) || defined( ANDROID ) +#elif defined( IOS ) || defined( ANDROID ) || defined(LIBO_HEADLESS) bool OpenGLContext::initWindow() { @@ -1245,7 +1245,7 @@ void OpenGLContext::reset() } #elif defined( MACOSX ) OpenGLWrapper::resetCurrent(); -#elif defined( IOS ) || defined( ANDROID ) +#elif defined( IOS ) || defined( ANDROID ) || defined(LIBO_HEADLESS) // nothing #elif defined( UNX ) if(m_aGLWin.ctx) @@ -1289,6 +1289,7 @@ SystemWindowData OpenGLContext::generateWinData(vcl::Window* pParent, bool) aWinData.nSize = sizeof(aWinData); aWinData.pVisual = NULL; +#if !defined(LIBO_HEADLESS) const SystemEnvData* sysData(pParent->GetSystemData()); Display *dpy = reinterpret_cast(sysData->pDisplay); @@ -1316,6 +1317,7 @@ SystemWindowData OpenGLContext::generateWinData(vcl::Window* pParent, bool) SAL_INFO("vcl.opengl", "using VisualID " << vi->visualid); aWinData.pVisual = (void*)(vi->visual); } +#endif return aWinData; } @@ -1329,7 +1331,7 @@ bool OpenGLContext::isCurrent() wglGetCurrentDC() == m_aGLWin.hDC); #elif defined( MACOSX ) return false; -#elif defined( IOS ) || defined( ANDROID ) +#elif defined( IOS ) || defined( ANDROID ) || defined(LIBO_HEADLESS) return false; #elif defined( UNX ) GLXDrawable nDrawable = mbPixmap ? m_aGLWin.glPix : m_aGLWin.win; @@ -1367,7 +1369,7 @@ void OpenGLContext::makeCurrent() #elif defined( MACOSX ) NSOpenGLView* pView = getOpenGLView(); OpenGLWrapper::makeCurrent(pView); -#elif defined( IOS ) || defined( ANDROID ) +#elif defined( IOS ) || defined( ANDROID ) || defined(LIBO_HEADLESS) // nothing #elif defined( UNX ) #ifdef DBG_UTIL @@ -1408,7 +1410,7 @@ void OpenGLContext::resetCurrent() wglMakeCurrent( m_aGLWin.hDC, 0 ); #elif defined( MACOSX ) OpenGLWrapper::resetCurrent(); -#elif defined( IOS ) || defined( ANDROID ) +#elif defined( IOS ) || defined( ANDROID ) || defined(LIBO_HEADLESS) // nothing #elif defined( UNX ) glXMakeCurrent(m_aGLWin.dpy, None, NULL); @@ -1422,7 +1424,7 @@ void OpenGLContext::swapBuffers() #elif defined( MACOSX ) NSOpenGLView* pView = getOpenGLView(); OpenGLWrapper::swapBuffers(pView); -#elif defined( IOS ) || defined( ANDROID ) +#elif defined( IOS ) || defined( ANDROID ) || defined(LIBO_HEADLESS) // nothing #elif defined( UNX ) glXSwapBuffers(m_aGLWin.dpy, mbPixmap ? m_aGLWin.glPix : m_aGLWin.win); @@ -1433,7 +1435,7 @@ void OpenGLContext::sync() { #if defined( WNT ) // nothing -#elif defined( MACOSX ) || defined( IOS ) || defined( ANDROID ) +#elif defined( MACOSX ) || defined( IOS ) || defined( ANDROID ) || defined(LIBO_HEADLESS) // nothing #elif defined( UNX ) glXWaitGL(); diff --git a/vcl/source/opengl/OpenGLHelper.cxx b/vcl/source/opengl/OpenGLHelper.cxx index 7ef47c231618..23b5fccca57d 100644 --- a/vcl/source/opengl/OpenGLHelper.cxx +++ b/vcl/source/opengl/OpenGLHelper.cxx @@ -480,7 +480,7 @@ bool OpenGLHelper::isVCLOpenGLEnabled() return bEnable; } -#if defined UNX && !defined MACOSX && !defined IOS && !defined ANDROID +#if defined UNX && !defined MACOSX && !defined IOS && !defined ANDROID && !defined(LIBO_HEADLESS) bool OpenGLHelper::GetVisualInfo(Display* pDisplay, int nScreen, XVisualInfo& rVI) { diff --git a/vcl/source/salmain/salmain.cxx b/vcl/source/salmain/salmain.cxx index e7318e8424cd..ee9ed69fb11b 100644 --- a/vcl/source/salmain/salmain.cxx +++ b/vcl/source/salmain/salmain.cxx @@ -28,12 +28,12 @@ #include "salinst.hxx" -#if defined( UNX ) && !defined MACOSX && !defined IOS && !defined ANDROID +#if defined( UNX ) && !defined MACOSX && !defined IOS && !defined ANDROID && !defined LIBO_HEADLESS #include #endif SAL_IMPLEMENT_MAIN() { -#if defined( UNX ) && !defined MACOSX && !defined IOS && !defined ANDROID +#if defined( UNX ) && !defined MACOSX && !defined IOS && !defined ANDROID && !defined LIBO_HEADLESS fire_glxtest_process(); #endif tools::extendApplicationEnvironment(); -- cgit v1.2.3