From bbec2ed9308f9db738fa5f08885e14a4530fe528 Mon Sep 17 00:00:00 2001 From: ofTheo Date: Fri, 8 Nov 2019 16:30:13 -0800 Subject: [PATCH 01/19] supports the Rpi 4 with EGL and GLFW. Closes #6436 --- libs/openFrameworks/app/ofAppBaseWindow.h | 4 +- libs/openFrameworks/app/ofAppEGLWindow.cpp | 26 ++++++------ libs/openFrameworks/app/ofAppEGLWindow.h | 10 ++--- libs/openFrameworks/app/ofAppGLFWWindow.cpp | 2 +- libs/openFrameworks/app/ofAppGLFWWindow.h | 6 +-- libs/openFrameworks/app/ofMainLoop.cpp | 4 ++ libs/openFrameworks/gl/ofGLUtils.cpp | 2 +- .../linuxarmv6l/config.linuxarmv6l.default.mk | 42 ++++++++++++++++++- scripts/linux/debian/install_dependencies.sh | 4 +- 9 files changed, 71 insertions(+), 29 deletions(-) mode change 100755 => 100644 scripts/linux/debian/install_dependencies.sh diff --git a/libs/openFrameworks/app/ofAppBaseWindow.h b/libs/openFrameworks/app/ofAppBaseWindow.h index 235d7bc7f89..fc758b64dee 100644 --- a/libs/openFrameworks/app/ofAppBaseWindow.h +++ b/libs/openFrameworks/app/ofAppBaseWindow.h @@ -12,7 +12,7 @@ struct __GLXcontextRec; typedef __GLXcontextRec * GLXContext; #endif -#if defined(TARGET_LINUX) && !defined(TARGET_RASPBERRY_PI) +#if defined(TARGET_LINUX) && (!defined(TARGET_RASPBERRY_PI) || defined(TARGET_RASPBERRY_PI_4)) typedef unsigned long Window; struct _XDisplay; typedef struct _XDisplay Display; @@ -77,7 +77,7 @@ class ofAppBaseWindow{ virtual void * getWindowContext(){return nullptr;}; -#if defined(TARGET_LINUX) && !defined(TARGET_RASPBERRY_PI) +#if defined(TARGET_LINUX) && (!defined(TARGET_RASPBERRY_PI) || defined(TARGET_RASPBERRY_PI_4)) virtual Display* getX11Display(){return nullptr;} virtual Window getX11Window() {return 0;} #endif diff --git a/libs/openFrameworks/app/ofAppEGLWindow.cpp b/libs/openFrameworks/app/ofAppEGLWindow.cpp index 6c103e937c8..4be2e5dfe01 100644 --- a/libs/openFrameworks/app/ofAppEGLWindow.cpp +++ b/libs/openFrameworks/app/ofAppEGLWindow.cpp @@ -287,7 +287,7 @@ EGLContext ofAppEGLWindow::getEglContext() const { return eglContext; } -#ifndef TARGET_RASPBERRY_PI +#if (!defined(TARGET_RASPBERRY_PI) || defined(TARGET_RASPBERRY_PI_4)) //------------------------------------------------------------ Display* ofAppEGLWindow::getX11Display(){ return x11Display; @@ -315,14 +315,14 @@ EGLint ofAppEGLWindow::getEglVersionMinor() const { //------------------------------------------------------------ void ofAppEGLWindow::initNative() { -#ifdef TARGET_RASPBERRY_PI +#if (defined(TARGET_RASPBERRY_PI) && !defined(TARGET_RASPBERRY_PI_4)) initRPiNative(); #endif } //------------------------------------------------------------ void ofAppEGLWindow::exitNative() { -#ifdef TARGET_RASPBERRY_PI +#if (defined(TARGET_RASPBERRY_PI) && !defined(TARGET_RASPBERRY_PI_4)) exitRPiNative(); #endif } @@ -337,7 +337,7 @@ EGLNativeWindowType ofAppEGLWindow::getNativeWindow() { if(isUsingX11) { return (EGLNativeWindowType)x11Window; } else { -#ifdef TARGET_RASPBERRY_PI +#if (defined(TARGET_RASPBERRY_PI) && !defined(TARGET_RASPBERRY_PI_4)) return (EGLNativeWindowType)&dispman_native_window; #else ofLogNotice("ofAppEGLWindow") << "getNativeWindow(): no native window type for this system, perhaps try X11?"; @@ -356,7 +356,7 @@ EGLNativeDisplayType ofAppEGLWindow::getNativeDisplay() { if(isUsingX11) { return (EGLNativeDisplayType)x11Display; } else { -#ifdef TARGET_RASPBERRY_PI +#if (defined(TARGET_RASPBERRY_PI) && !defined(TARGET_RASPBERRY_PI_4)) return (EGLNativeDisplayType)NULL; #else ofLogNotice("ofAppEGLWindow") << "getNativeDisplay(): no native window type for this system, perhaps try X11?"; @@ -429,7 +429,7 @@ void ofAppEGLWindow::setup(const ofAppEGLWindowSettings & _settings) { //////////////// // TODO remove the following ifdef once x11 is accelerated on RPI -#ifdef TARGET_RASPBERRY_PI +#if (defined(TARGET_RASPBERRY_PI) && !defined(TARGET_RASPBERRY_PI_4)) if(isUsingX11) { isUsingX11 = false; ofLogWarning("ofAppEGLWindow") << "init(): X11 not availble on RPI yet, using a native window instead"; @@ -758,7 +758,7 @@ bool ofAppEGLWindow::destroyWindow() { XDestroyWindow(x11Display,x11Window); // or XCloseWindow? XFree(x11Screen); } else { -#ifdef TARGET_RASPBERRY_PI +#if (defined(TARGET_RASPBERRY_PI) && !defined(TARGET_RASPBERRY_PI_4)) dispman_update = vc_dispmanx_update_start(0); if (dispman_element != DISPMANX_NO_HANDLE) { vc_dispmanx_element_remove(dispman_update, dispman_element); @@ -942,7 +942,7 @@ void ofAppEGLWindow::setWindowRect(const ofRectangle& requestedWindowRect) { currentWindowRect = newRect; } } else { -#ifdef TARGET_RASPBERRY_PI +#if (defined(TARGET_RASPBERRY_PI) && !defined(TARGET_RASPBERRY_PI_4)) VC_RECT_T dst_rect; dst_rect.x = (int32_t)newRect.x; @@ -996,7 +996,7 @@ bool ofAppEGLWindow::createWindow(const ofRectangle& requestedWindowRect) { if(isUsingX11) { return createX11NativeWindow(requestedWindowRect); } else { -#ifdef TARGET_RASPBERRY_PI +#if (defined(TARGET_RASPBERRY_PI) && !defined(TARGET_RASPBERRY_PI_4)) return createRPiNativeWindow(requestedWindowRect); #else ofLogError("ofAppEGLWindow") << "createEGLWindow(): no native window type for this system, perhaps try X11?"; @@ -1097,7 +1097,7 @@ glm::vec2 ofAppEGLWindow::getScreenSize(){ } } else { -#ifdef TARGET_RASPBERRY_PI +#if (defined(TARGET_RASPBERRY_PI) && !defined(TARGET_RASPBERRY_PI_4)) int success = graphics_get_display_size(settings.screenNum, &screenWidth, &screenHeight); if(success < 0) { ofLogError("ofAppEGLWindow") << "getScreenSize(): tried to get display size but failed"; @@ -1165,7 +1165,7 @@ void ofAppEGLWindow::setWindowPosition(int x, int y){ nonFullscreenWindowRect = currentWindowRect; } } else { -#ifdef TARGET_RASPBERRY_PI +#if (defined(TARGET_RASPBERRY_PI) && !defined(TARGET_RASPBERRY_PI_4)) // keep it in bounds auto screenSize = getScreenSize(); @@ -1226,7 +1226,7 @@ void ofAppEGLWindow::setWindowShape(int w, int h){ nonFullscreenWindowRect = currentWindowRect; } } else { -#ifdef TARGET_RASPBERRY_PI +#if (defined(TARGET_RASPBERRY_PI) && !defined(TARGET_RASPBERRY_PI_4)) setWindowRect(ofRectangle(currentWindowRect.x,currentWindowRect.y,w,h)); nonFullscreenWindowRect = currentWindowRect; #else @@ -1836,7 +1836,7 @@ void ofAppEGLWindow::readNativeInputEvents(){ } } -#ifdef TARGET_RASPBERRY_PI +#if (defined(TARGET_RASPBERRY_PI) && !defined(TARGET_RASPBERRY_PI_4)) //------------------------------------------------------------ void ofAppEGLWindow::initRPiNative() { bcm_host_init(); diff --git a/libs/openFrameworks/app/ofAppEGLWindow.h b/libs/openFrameworks/app/ofAppEGLWindow.h index 245062496b0..5ce8789433a 100644 --- a/libs/openFrameworks/app/ofAppEGLWindow.h +++ b/libs/openFrameworks/app/ofAppEGLWindow.h @@ -18,9 +18,6 @@ enum ofAppEGLWindowType { OF_APP_WINDOW_X11 }; -typedef std::map ofEGLAttributeList; -typedef std::map::iterator ofEGLAttributeListIterator; - typedef struct _XIM * XIM; typedef struct _XIC * XIC; typedef unsigned long Window; @@ -34,6 +31,9 @@ typedef void *EGLConfig; typedef void *EGLSurface; typedef void *EGLContext; +typedef std::map ofEGLAttributeList; +typedef std::map::iterator ofEGLAttributeListIterator; + struct ofAppEGLWindowSettings: public ofGLESWindowSettings { public: ofAppEGLWindowType eglWindowPreference; ///< what window type is preferred? @@ -119,7 +119,7 @@ class ofAppEGLWindow : public ofAppBaseGLESWindow, public ofThread { EGLSurface getEglSurface() const; EGLContext getEglContext() const; -#ifndef TARGET_RASPBERRY_PI +#if (!defined(TARGET_RASPBERRY_PI) || defined(TARGET_RASPBERRY_PI_4)) Display* getX11Display(); Window getX11Window(); #endif @@ -225,7 +225,7 @@ class ofAppEGLWindow : public ofAppBaseGLESWindow, public ofThread { EGLNativeWindowType getNativeWindow(); EGLNativeDisplayType getNativeDisplay(); -#ifdef TARGET_RASPBERRY_PI +#if (defined(TARGET_RASPBERRY_PI) && !defined(TARGET_RASPBERRY_PI_4)) void initRPiNative(); void exitRPiNative(); diff --git a/libs/openFrameworks/app/ofAppGLFWWindow.cpp b/libs/openFrameworks/app/ofAppGLFWWindow.cpp index 6f0db8d2948..642da27b21d 100644 --- a/libs/openFrameworks/app/ofAppGLFWWindow.cpp +++ b/libs/openFrameworks/app/ofAppGLFWWindow.cpp @@ -1651,7 +1651,7 @@ void ofAppGLFWWindow::makeCurrent(){ glfwMakeContextCurrent(windowP); } -#if defined(TARGET_LINUX) && !defined(TARGET_RASPBERRY_PI) +#if defined(TARGET_LINUX) Display* ofAppGLFWWindow::getX11Display(){ return glfwGetX11Display(); } diff --git a/libs/openFrameworks/app/ofAppGLFWWindow.h b/libs/openFrameworks/app/ofAppGLFWWindow.h index 50fd677eca2..d019cdf20a8 100644 --- a/libs/openFrameworks/app/ofAppGLFWWindow.h +++ b/libs/openFrameworks/app/ofAppGLFWWindow.h @@ -4,7 +4,7 @@ #include "ofAppBaseWindow.h" #include "ofRectangle.h" -#ifdef TARGET_LINUX +#if defined(TARGET_LINUX) && (!defined(TARGET_RASPBERRY_PI) || defined(TARGET_RASPBERRY_PI_4)) typedef struct _XIM * XIM; typedef struct _XIC * XIC; #endif @@ -146,7 +146,7 @@ class ofAppGLFWWindow : public ofAppBaseGLWindow { OF_DEPRECATED_MSG("use ofGLFWWindowSettings to create the window instead", void setStencilBits(int stencil)); OF_DEPRECATED_MSG("use ofGLFWWindowSettings to create the window instead", void setMultiDisplayFullscreen(bool bMultiFullscreen)); //note this just enables the mode, you have to toggle fullscreen to activate it. -#if defined(TARGET_LINUX) && !defined(TARGET_RASPBERRY_PI) +#if defined(TARGET_LINUX) && (!defined(TARGET_RASPBERRY_PI) || defined(TARGET_RASPBERRY_PI_4) ) Display* getX11Display(); Window getX11Window(); XIC getX11XIC(); @@ -188,7 +188,7 @@ class ofAppGLFWWindow : public ofAppBaseGLWindow { void close(); -#ifdef TARGET_LINUX +#if defined(TARGET_LINUX) && (!defined(TARGET_RASPBERRY_PI) || defined(TARGET_RASPBERRY_PI_4)) void setWindowIcon(const std::string & path); void setWindowIcon(const ofPixels & iconPixels); XIM xim; diff --git a/libs/openFrameworks/app/ofMainLoop.cpp b/libs/openFrameworks/app/ofMainLoop.cpp index 5131db1d838..bb787ff9a2d 100644 --- a/libs/openFrameworks/app/ofMainLoop.cpp +++ b/libs/openFrameworks/app/ofMainLoop.cpp @@ -21,6 +21,8 @@ #include "ofAppAndroidWindow.h" #include "ofxAndroidUtils.h" #include "ofxAndroidApp.h" +#elif defined(TARGET_RASPBERRY_PI) && defined(TARGET_GLFW_WINDOW) + #include "ofAppGLFWWindow.h" #elif defined(TARGET_RASPBERRY_PI) #include "ofAppEGLWindow.h" #elif defined(TARGET_EMSCRIPTEN) @@ -51,6 +53,8 @@ shared_ptr ofMainLoop::createWindow(const ofWindowSettings & se shared_ptr window = std::make_shared(); #elif defined(TARGET_ANDROID) shared_ptr window = std::make_shared(); + #elif (defined(TARGET_RASPBERRY_PI) && defined(TARGET_GLFW_WINDOW)) + shared_ptr window = std::make_shared(); #elif defined(TARGET_RASPBERRY_PI) shared_ptr window = std::make_shared(); #elif defined(TARGET_EMSCRIPTEN) diff --git a/libs/openFrameworks/gl/ofGLUtils.cpp b/libs/openFrameworks/gl/ofGLUtils.cpp index 30fb9705257..5bec3acff4f 100644 --- a/libs/openFrameworks/gl/ofGLUtils.cpp +++ b/libs/openFrameworks/gl/ofGLUtils.cpp @@ -575,7 +575,7 @@ int ofGetGLInternalFormatFromPixelFormat(ofPixelFormat pixelFormat){ return GL_RGB; #endif case OF_PIXELS_RGB565: - #if defined(TARGET_ANDROID) || defined(TARGET_RASPBERRY_PI) + #if defined(TARGET_ANDROID) || (defined(TARGET_RASPBERRY_PI) && !defined(TARGET_RASPBERRY_PI_4)) return GL_RGB565_OES; #elif defined(GL_RGB565) return GL_RGB565; diff --git a/libs/openFrameworksCompiled/project/linuxarmv6l/config.linuxarmv6l.default.mk b/libs/openFrameworksCompiled/project/linuxarmv6l/config.linuxarmv6l.default.mk index 61ccb33b890..7ea44ac1a33 100644 --- a/libs/openFrameworksCompiled/project/linuxarmv6l/config.linuxarmv6l.default.mk +++ b/libs/openFrameworksCompiled/project/linuxarmv6l/config.linuxarmv6l.default.mk @@ -46,6 +46,23 @@ include $(OF_SHARED_MAKEFILES_PATH)/config.linux.common.mk # defines used inside openFrameworks libs. PLATFORM_DEFINES += TARGET_RASPBERRY_PI +# this needs to be set for rpi 4 and newer +# note this only works with the new GL driver and not the Legacy driver ( set with: sudo raspi-config ) + +# TODO: detect rpi4 or newer by parsing /proc/device-tree/model +IS_RPI_4_NEWER = 1 + +# uncomment this for glfw windowing on rpi 4 and newer +#USE_GLFW_WINDOW = 1; + +ifdef IS_RPI_4_NEWER + PLATFORM_DEFINES += TARGET_RASPBERRY_PI_4 +endif + +ifdef USE_GLFW_WINDOW + PLATFORM_DEFINES += TARGET_GLFW_WINDOW +endif + # TODO many of these are not relevant to openFrameworks (were just pasted from hello_pi examples) # from raspberry pi examples PLATFORM_DEFINES += STANDALONE @@ -119,8 +136,19 @@ PLATFORM_CFLAGS += -pipe # Note: Leave a leading space when adding list items with the += operator ################################################################################ +#rpi4 +ifdef USE_GLFW_WINDOW + PLATFORM_PKG_CONFIG_LIBRARIES += gl + PLATFORM_PKG_CONFIG_LIBRARIES += glu + PLATFORM_PKG_CONFIG_LIBRARIES += glew +endif + # raspberry pi specific -ifneq (,$(wildcard $(RPI_ROOT)/opt/vc/lib/libGLESv2.so)) +ifdef IS_RPI_4_NEWER + PLATFORM_LIBRARIES += GLESv2 + PLATFORM_LIBRARIES += GLESv1_CM + PLATFORM_LIBRARIES += EGL +else ifneq (,$(wildcard $(RPI_ROOT)/opt/vc/lib/libGLESv2.so)) PLATFORM_LIBRARIES += GLESv2 PLATFORM_LIBRARIES += GLESv1_CM PLATFORM_LIBRARIES += EGL @@ -128,6 +156,7 @@ else PLATFORM_LIBRARIES += brcmGLESv2 PLATFORM_LIBRARIES += brcmEGL endif + PLATFORM_LIBRARIES += openmaxil PLATFORM_LIBRARIES += bcm_host PLATFORM_LIBRARIES += vcos @@ -140,6 +169,10 @@ PLATFORM_LIBRARIES += dl PLATFORM_LDFLAGS += -pthread +#rpi4 +ifdef IS_RPI_4_NEWER + PLATFORM_LDFLAGS += -latomic +endif ################################################################################ # PLATFORM HEADER SEARCH PATHS @@ -186,7 +219,12 @@ PLATFORM_LIBRARY_SEARCH_PATHS += $(RPI_ROOT)/opt/vc/lib # Note: Leave a leading space when adding list items with the += operator ################################################################################ -PLATFORM_CORE_EXCLUSIONS += $(OF_LIBS_PATH)/openFrameworks/app/ofAppGLFWWindow.cpp +#rpi4 +ifndef USE_GLFW_WINDOW + PLATFORM_CORE_EXCLUSIONS += $(OF_LIBS_PATH)/openFrameworks/app/ofAppGLFWWindow.cpp +else + PLATFORM_CORE_EXCLUSIONS += $(OF_LIBS_PATH)/openFrameworks/app/ofAppEGLWindow.cpp +endif PLATFORM_CORE_EXCLUSIONS += $(OF_LIBS_PATH)/openFrameworks/sound/ofFmodSoundPlayer.cpp ifeq ($(CROSS_COMPILING),1) diff --git a/scripts/linux/debian/install_dependencies.sh b/scripts/linux/debian/install_dependencies.sh old mode 100755 new mode 100644 index 0879b779ac3..fe0eac8879b --- a/scripts/linux/debian/install_dependencies.sh +++ b/scripts/linux/debian/install_dependencies.sh @@ -37,7 +37,7 @@ fi echo "installing OF dependencies" -apt-get install freeglut3-dev libasound2-dev libxmu-dev libxxf86vm-dev g++ libgl1-mesa-dev libglu1-mesa-dev libraw1394-dev libudev-dev libdrm-dev libglew-dev libopenal-dev libsndfile-dev libfreeimage-dev libcairo2-dev libfreetype6-dev libssl-dev libpulse-dev libusb-1.0-0-dev libgtk${GTK_VERSION}-dev libopencv-dev libegl1-mesa-dev libgles1-mesa-dev libgles2-mesa-dev libassimp-dev librtaudio-dev libboost-filesystem-dev libglfw3-dev liburiparser-dev libcurl4-openssl-dev libpugixml-dev libpoco-dev +apt-get install freeglut3-dev libasound2-dev libxmu-dev libxxf86vm-dev g++ libgl1-mesa-dev libglu1-mesa-dev libraw1394-dev libudev-dev libdrm-dev libglew-dev libopenal-dev libsndfile-dev libfreeimage-dev libcairo2-dev libfreetype6-dev libssl-dev libpulse-dev libusb-1.0-0-dev libgtk${GTK_VERSION}-dev libopencv-dev libegl1-mesa-dev libgles1 libgles2-mesa-dev libassimp-dev librtaudio-dev libboost-filesystem-dev libglfw3-dev liburiparser-dev libcurl4-openssl-dev libpugixml-dev libpoco-dev exit_code=$? if [ $exit_code != 0 ]; then echo "error installing dependencies, there could be an error with your internet connection" @@ -81,4 +81,4 @@ else echo "Updating ofxOpenCV to use openCV4" sed -i -E 's/ADDON_PKG_CONFIG_LIBRARIES =(.*)opencv\s/ADDON_PKG_CONFIG_LIBRARIES =\1opencv4 /g' "$addons_dir/ofxOpenCv/addon_config.mk" sed -i -E 's/ADDON_PKG_CONFIG_LIBRARIES =(.*)opencv$/ADDON_PKG_CONFIG_LIBRARIES =\1opencv4/g' "$addons_dir/ofxOpenCv/addon_config.mk" -fi \ No newline at end of file +fi From 10fcaf8d93b7fd3b9f8df0cb4a7e5dac3739f563 Mon Sep 17 00:00:00 2001 From: ofTheo Date: Tue, 12 Nov 2019 11:44:57 -0800 Subject: [PATCH 02/19] better defines for rpi. changed make file to reflect. --- libs/openFrameworks/app/ofAppBaseWindow.h | 4 +-- libs/openFrameworks/app/ofAppEGLWindow.cpp | 26 +++++++++---------- libs/openFrameworks/app/ofAppEGLWindow.h | 4 +-- libs/openFrameworks/app/ofAppGLFWWindow.h | 6 ++--- libs/openFrameworks/app/ofAppRunner.cpp | 4 +-- libs/openFrameworks/app/ofAppRunner.h | 2 +- libs/openFrameworks/gl/ofGLUtils.cpp | 2 +- libs/openFrameworks/ofMain.h | 2 +- libs/openFrameworks/utils/ofSystemUtils.cpp | 2 +- libs/openFrameworks/utils/ofTimer.cpp | 2 +- libs/openFrameworks/utils/ofUtils.cpp | 2 +- .../linuxarmv6l/config.linuxarmv6l.default.mk | 26 +++++++++---------- 12 files changed, 40 insertions(+), 42 deletions(-) diff --git a/libs/openFrameworks/app/ofAppBaseWindow.h b/libs/openFrameworks/app/ofAppBaseWindow.h index fc758b64dee..cee6648029c 100644 --- a/libs/openFrameworks/app/ofAppBaseWindow.h +++ b/libs/openFrameworks/app/ofAppBaseWindow.h @@ -12,7 +12,7 @@ struct __GLXcontextRec; typedef __GLXcontextRec * GLXContext; #endif -#if defined(TARGET_LINUX) && (!defined(TARGET_RASPBERRY_PI) || defined(TARGET_RASPBERRY_PI_4)) +#if defined(TARGET_LINUX) && !defined(TARGET_RASPBERRY_PI_LEGACY) typedef unsigned long Window; struct _XDisplay; typedef struct _XDisplay Display; @@ -77,7 +77,7 @@ class ofAppBaseWindow{ virtual void * getWindowContext(){return nullptr;}; -#if defined(TARGET_LINUX) && (!defined(TARGET_RASPBERRY_PI) || defined(TARGET_RASPBERRY_PI_4)) +#if defined(TARGET_LINUX) && !defined(TARGET_RASPBERRY_PI_LEGACY) virtual Display* getX11Display(){return nullptr;} virtual Window getX11Window() {return 0;} #endif diff --git a/libs/openFrameworks/app/ofAppEGLWindow.cpp b/libs/openFrameworks/app/ofAppEGLWindow.cpp index 4be2e5dfe01..b589256170a 100644 --- a/libs/openFrameworks/app/ofAppEGLWindow.cpp +++ b/libs/openFrameworks/app/ofAppEGLWindow.cpp @@ -287,7 +287,7 @@ EGLContext ofAppEGLWindow::getEglContext() const { return eglContext; } -#if (!defined(TARGET_RASPBERRY_PI) || defined(TARGET_RASPBERRY_PI_4)) +#ifndef TARGET_RASPBERRY_PI_LEGACY //------------------------------------------------------------ Display* ofAppEGLWindow::getX11Display(){ return x11Display; @@ -315,14 +315,14 @@ EGLint ofAppEGLWindow::getEglVersionMinor() const { //------------------------------------------------------------ void ofAppEGLWindow::initNative() { -#if (defined(TARGET_RASPBERRY_PI) && !defined(TARGET_RASPBERRY_PI_4)) +#ifdef TARGET_RASPBERRY_PI_LEGACY initRPiNative(); #endif } //------------------------------------------------------------ void ofAppEGLWindow::exitNative() { -#if (defined(TARGET_RASPBERRY_PI) && !defined(TARGET_RASPBERRY_PI_4)) +#ifdef TARGET_RASPBERRY_PI_LEGACY exitRPiNative(); #endif } @@ -337,7 +337,7 @@ EGLNativeWindowType ofAppEGLWindow::getNativeWindow() { if(isUsingX11) { return (EGLNativeWindowType)x11Window; } else { -#if (defined(TARGET_RASPBERRY_PI) && !defined(TARGET_RASPBERRY_PI_4)) +#ifdef TARGET_RASPBERRY_PI_LEGACY return (EGLNativeWindowType)&dispman_native_window; #else ofLogNotice("ofAppEGLWindow") << "getNativeWindow(): no native window type for this system, perhaps try X11?"; @@ -356,7 +356,7 @@ EGLNativeDisplayType ofAppEGLWindow::getNativeDisplay() { if(isUsingX11) { return (EGLNativeDisplayType)x11Display; } else { -#if (defined(TARGET_RASPBERRY_PI) && !defined(TARGET_RASPBERRY_PI_4)) +#ifdef TARGET_RASPBERRY_PI_LEGACY return (EGLNativeDisplayType)NULL; #else ofLogNotice("ofAppEGLWindow") << "getNativeDisplay(): no native window type for this system, perhaps try X11?"; @@ -429,7 +429,7 @@ void ofAppEGLWindow::setup(const ofAppEGLWindowSettings & _settings) { //////////////// // TODO remove the following ifdef once x11 is accelerated on RPI -#if (defined(TARGET_RASPBERRY_PI) && !defined(TARGET_RASPBERRY_PI_4)) +#ifdef TARGET_RASPBERRY_PI_LEGACY if(isUsingX11) { isUsingX11 = false; ofLogWarning("ofAppEGLWindow") << "init(): X11 not availble on RPI yet, using a native window instead"; @@ -758,7 +758,7 @@ bool ofAppEGLWindow::destroyWindow() { XDestroyWindow(x11Display,x11Window); // or XCloseWindow? XFree(x11Screen); } else { -#if (defined(TARGET_RASPBERRY_PI) && !defined(TARGET_RASPBERRY_PI_4)) +#ifdef TARGET_RASPBERRY_PI_LEGACY dispman_update = vc_dispmanx_update_start(0); if (dispman_element != DISPMANX_NO_HANDLE) { vc_dispmanx_element_remove(dispman_update, dispman_element); @@ -942,7 +942,7 @@ void ofAppEGLWindow::setWindowRect(const ofRectangle& requestedWindowRect) { currentWindowRect = newRect; } } else { -#if (defined(TARGET_RASPBERRY_PI) && !defined(TARGET_RASPBERRY_PI_4)) +#ifdef TARGET_RASPBERRY_PI_LEGACY VC_RECT_T dst_rect; dst_rect.x = (int32_t)newRect.x; @@ -996,7 +996,7 @@ bool ofAppEGLWindow::createWindow(const ofRectangle& requestedWindowRect) { if(isUsingX11) { return createX11NativeWindow(requestedWindowRect); } else { -#if (defined(TARGET_RASPBERRY_PI) && !defined(TARGET_RASPBERRY_PI_4)) +#ifdef TARGET_RASPBERRY_PI_LEGACY return createRPiNativeWindow(requestedWindowRect); #else ofLogError("ofAppEGLWindow") << "createEGLWindow(): no native window type for this system, perhaps try X11?"; @@ -1097,7 +1097,7 @@ glm::vec2 ofAppEGLWindow::getScreenSize(){ } } else { -#if (defined(TARGET_RASPBERRY_PI) && !defined(TARGET_RASPBERRY_PI_4)) +#ifdef TARGET_RASPBERRY_PI_LEGACY int success = graphics_get_display_size(settings.screenNum, &screenWidth, &screenHeight); if(success < 0) { ofLogError("ofAppEGLWindow") << "getScreenSize(): tried to get display size but failed"; @@ -1165,7 +1165,7 @@ void ofAppEGLWindow::setWindowPosition(int x, int y){ nonFullscreenWindowRect = currentWindowRect; } } else { -#if (defined(TARGET_RASPBERRY_PI) && !defined(TARGET_RASPBERRY_PI_4)) +#ifdef TARGET_RASPBERRY_PI_LEGACY // keep it in bounds auto screenSize = getScreenSize(); @@ -1226,7 +1226,7 @@ void ofAppEGLWindow::setWindowShape(int w, int h){ nonFullscreenWindowRect = currentWindowRect; } } else { -#if (defined(TARGET_RASPBERRY_PI) && !defined(TARGET_RASPBERRY_PI_4)) +#ifdef TARGET_RASPBERRY_PI_LEGACY setWindowRect(ofRectangle(currentWindowRect.x,currentWindowRect.y,w,h)); nonFullscreenWindowRect = currentWindowRect; #else @@ -1836,7 +1836,7 @@ void ofAppEGLWindow::readNativeInputEvents(){ } } -#if (defined(TARGET_RASPBERRY_PI) && !defined(TARGET_RASPBERRY_PI_4)) +#ifdef TARGET_RASPBERRY_PI_LEGACY //------------------------------------------------------------ void ofAppEGLWindow::initRPiNative() { bcm_host_init(); diff --git a/libs/openFrameworks/app/ofAppEGLWindow.h b/libs/openFrameworks/app/ofAppEGLWindow.h index 5ce8789433a..a5a6b5671cd 100644 --- a/libs/openFrameworks/app/ofAppEGLWindow.h +++ b/libs/openFrameworks/app/ofAppEGLWindow.h @@ -119,7 +119,7 @@ class ofAppEGLWindow : public ofAppBaseGLESWindow, public ofThread { EGLSurface getEglSurface() const; EGLContext getEglContext() const; -#if (!defined(TARGET_RASPBERRY_PI) || defined(TARGET_RASPBERRY_PI_4)) +#ifndef TARGET_RASPBERRY_PI_LEGACY Display* getX11Display(); Window getX11Window(); #endif @@ -225,7 +225,7 @@ class ofAppEGLWindow : public ofAppBaseGLESWindow, public ofThread { EGLNativeWindowType getNativeWindow(); EGLNativeDisplayType getNativeDisplay(); -#if (defined(TARGET_RASPBERRY_PI) && !defined(TARGET_RASPBERRY_PI_4)) +#ifdef TARGET_RASPBERRY_PI_LEGACY void initRPiNative(); void exitRPiNative(); diff --git a/libs/openFrameworks/app/ofAppGLFWWindow.h b/libs/openFrameworks/app/ofAppGLFWWindow.h index d019cdf20a8..b9a9f4381cc 100644 --- a/libs/openFrameworks/app/ofAppGLFWWindow.h +++ b/libs/openFrameworks/app/ofAppGLFWWindow.h @@ -4,7 +4,7 @@ #include "ofAppBaseWindow.h" #include "ofRectangle.h" -#if defined(TARGET_LINUX) && (!defined(TARGET_RASPBERRY_PI) || defined(TARGET_RASPBERRY_PI_4)) +#if defined(TARGET_LINUX) && !defined(TARGET_RASPBERRY_PI_LEGACY) typedef struct _XIM * XIM; typedef struct _XIC * XIC; #endif @@ -146,7 +146,7 @@ class ofAppGLFWWindow : public ofAppBaseGLWindow { OF_DEPRECATED_MSG("use ofGLFWWindowSettings to create the window instead", void setStencilBits(int stencil)); OF_DEPRECATED_MSG("use ofGLFWWindowSettings to create the window instead", void setMultiDisplayFullscreen(bool bMultiFullscreen)); //note this just enables the mode, you have to toggle fullscreen to activate it. -#if defined(TARGET_LINUX) && (!defined(TARGET_RASPBERRY_PI) || defined(TARGET_RASPBERRY_PI_4) ) +#if defined(TARGET_LINUX) && !defined(TARGET_RASPBERRY_PI_LEGACY) Display* getX11Display(); Window getX11Window(); XIC getX11XIC(); @@ -188,7 +188,7 @@ class ofAppGLFWWindow : public ofAppBaseGLWindow { void close(); -#if defined(TARGET_LINUX) && (!defined(TARGET_RASPBERRY_PI) || defined(TARGET_RASPBERRY_PI_4)) +#if defined(TARGET_LINUX) && !defined(TARGET_RASPBERRY_PI_LEGACY) void setWindowIcon(const std::string & path); void setWindowIcon(const ofPixels & iconPixels); XIM xim; diff --git a/libs/openFrameworks/app/ofAppRunner.cpp b/libs/openFrameworks/app/ofAppRunner.cpp index 010cb38472f..e3f7802c0d9 100644 --- a/libs/openFrameworks/app/ofAppRunner.cpp +++ b/libs/openFrameworks/app/ofAppRunner.cpp @@ -23,7 +23,7 @@ using namespace std; -#if !defined( TARGET_OF_IOS ) & !defined(TARGET_ANDROID) & !defined(TARGET_EMSCRIPTEN) & !defined(TARGET_RASPBERRY_PI) +#if !defined( TARGET_OF_IOS ) & !defined(TARGET_ANDROID) & !defined(TARGET_EMSCRIPTEN) & !defined(TARGET_RASPBERRY_PI_LEGACY) #include "ofAppGLFWWindow.h" //special case so we preserve supplied settngs //TODO: remove me when we remove the ofAppGLFWWindow setters. @@ -471,7 +471,7 @@ void ofSetVerticalSync(bool bSync){ } //-------------------------- native window handles -#if defined(TARGET_LINUX) && !defined(TARGET_RASPBERRY_PI) +#if defined(TARGET_LINUX) && !defined(TARGET_RASPBERRY_PI_LEGACY) Display* ofGetX11Display(){ return mainLoop()->getCurrentWindow()->getX11Display(); } diff --git a/libs/openFrameworks/app/ofAppRunner.h b/libs/openFrameworks/app/ofAppRunner.h index 021e12f7ec2..742f7997b50 100644 --- a/libs/openFrameworks/app/ofAppRunner.h +++ b/libs/openFrameworks/app/ofAppRunner.h @@ -112,7 +112,7 @@ std::shared_ptr & ofGetCurrentRenderer(); void ofSetEscapeQuitsApp(bool bQuitOnEsc); //-------------------------- native window handles -#if defined(TARGET_LINUX) && !defined(TARGET_RASPBERRY_PI) +#if defined(TARGET_LINUX) && !defined(TARGET_RASPBERRY_PI_LEGACY) typedef unsigned long Window; struct _XDisplay; typedef struct _XDisplay Display; diff --git a/libs/openFrameworks/gl/ofGLUtils.cpp b/libs/openFrameworks/gl/ofGLUtils.cpp index 5bec3acff4f..df2a574ccc6 100644 --- a/libs/openFrameworks/gl/ofGLUtils.cpp +++ b/libs/openFrameworks/gl/ofGLUtils.cpp @@ -575,7 +575,7 @@ int ofGetGLInternalFormatFromPixelFormat(ofPixelFormat pixelFormat){ return GL_RGB; #endif case OF_PIXELS_RGB565: - #if defined(TARGET_ANDROID) || (defined(TARGET_RASPBERRY_PI) && !defined(TARGET_RASPBERRY_PI_4)) + #if defined(TARGET_ANDROID) || defined(TARGET_RASPBERRY_PI_LEGACY) return GL_RGB565_OES; #elif defined(GL_RGB565) return GL_RGB565; diff --git a/libs/openFrameworks/ofMain.h b/libs/openFrameworks/ofMain.h index c9f5909ade3..dd0db80a979 100644 --- a/libs/openFrameworks/ofMain.h +++ b/libs/openFrameworks/ofMain.h @@ -80,7 +80,7 @@ #include "ofAppBaseWindow.h" #include "ofWindowSettings.h" #include "ofMainLoop.h" -#if !defined( TARGET_OF_IOS ) & !defined(TARGET_ANDROID) & !defined(TARGET_EMSCRIPTEN) & !defined(TARGET_RASPBERRY_PI) +#if !defined( TARGET_OF_IOS ) & !defined(TARGET_ANDROID) & !defined(TARGET_EMSCRIPTEN) & !defined(TARGET_RASPBERRY_PI_LEGACY) #include "ofAppGLFWWindow.h" #if !defined( TARGET_LINUX_ARM ) #include "ofAppGlutWindow.h" diff --git a/libs/openFrameworks/utils/ofSystemUtils.cpp b/libs/openFrameworks/utils/ofSystemUtils.cpp index 4b5e07e4342..aae91e3ff56 100644 --- a/libs/openFrameworks/utils/ofSystemUtils.cpp +++ b/libs/openFrameworks/utils/ofSystemUtils.cpp @@ -203,7 +203,7 @@ gboolean text_dialog_gtk(gpointer userdata){ static void initGTK(){ static bool initialized = false; if(!initialized){ - #if !defined(TARGET_RASPBERRY_PI) + #if !defined(TARGET_RASPBERRY_PI_LEGACY) XInitThreads(); #endif int argc=0; char **argv = nullptr; diff --git a/libs/openFrameworks/utils/ofTimer.cpp b/libs/openFrameworks/utils/ofTimer.cpp index f1dd327a8cf..82a2778b806 100644 --- a/libs/openFrameworks/utils/ofTimer.cpp +++ b/libs/openFrameworks/utils/ofTimer.cpp @@ -28,7 +28,7 @@ void ofTimer::setPeriodicEvent(uint64_t nanoseconds){ } void ofTimer::waitNext(){ -#if (defined(TARGET_LINUX) && !defined(TARGET_RASPBERRY_PI)) +#if (defined(TARGET_LINUX) && !defined(TARGET_RASPBERRY_PI_LEGACY)) timespec remainder = {0,0}; timespec wakeTime = nextWakeTime.getAsTimespec(); clock_nanosleep(CLOCK_MONOTONIC,TIMER_ABSTIME,&wakeTime,&remainder); diff --git a/libs/openFrameworks/utils/ofUtils.cpp b/libs/openFrameworks/utils/ofUtils.cpp index 96ad2100234..e48625519e5 100644 --- a/libs/openFrameworks/utils/ofUtils.cpp +++ b/libs/openFrameworks/utils/ofUtils.cpp @@ -162,7 +162,7 @@ namespace priv{ ofTime t; t.mode = mode; if(mode == ofTime::System){ - #if (defined(TARGET_LINUX) && !defined(TARGET_RASPBERRY_PI)) || defined(TARGET_EMSCRIPTEN) + #if (defined(TARGET_LINUX) && !defined(TARGET_RASPBERRY_PI_LEGACY)) || defined(TARGET_EMSCRIPTEN) struct timespec now; clock_gettime(CLOCK_MONOTONIC, &now); t.seconds = now.tv_sec; diff --git a/libs/openFrameworksCompiled/project/linuxarmv6l/config.linuxarmv6l.default.mk b/libs/openFrameworksCompiled/project/linuxarmv6l/config.linuxarmv6l.default.mk index 7ea44ac1a33..c425e7235a3 100644 --- a/libs/openFrameworksCompiled/project/linuxarmv6l/config.linuxarmv6l.default.mk +++ b/libs/openFrameworksCompiled/project/linuxarmv6l/config.linuxarmv6l.default.mk @@ -43,20 +43,19 @@ include $(OF_SHARED_MAKEFILES_PATH)/config.linux.common.mk # Note: Leave a leading space when adding list items with the += operator ################################################################################ -# defines used inside openFrameworks libs. -PLATFORM_DEFINES += TARGET_RASPBERRY_PI - -# this needs to be set for rpi 4 and newer -# note this only works with the new GL driver and not the Legacy driver ( set with: sudo raspi-config ) +# We need a detection here for PI versions older than stretch +# Uncomment the following line to build for older Raspbian releases or older devices +# USE_PI_LEGACY = 1 -# TODO: detect rpi4 or newer by parsing /proc/device-tree/model -IS_RPI_4_NEWER = 1 +# comment this for older EGL windowing. Has no effect if USE_PI_LEGACY is enabled +# GLFW seems to provide a more robust window on newer Raspbian releases +USE_GLFW_WINDOW = 1; -# uncomment this for glfw windowing on rpi 4 and newer -#USE_GLFW_WINDOW = 1; +# defines used inside openFrameworks libs. +PLATFORM_DEFINES += TARGET_RASPBERRY_PI -ifdef IS_RPI_4_NEWER - PLATFORM_DEFINES += TARGET_RASPBERRY_PI_4 +ifdef USE_PI_LEGACY + PLATFORM_DEFINES += TARGET_RASPBERRY_PI_LEGACY endif ifdef USE_GLFW_WINDOW @@ -144,7 +143,7 @@ ifdef USE_GLFW_WINDOW endif # raspberry pi specific -ifdef IS_RPI_4_NEWER +ifndef USE_PI_LEGACY PLATFORM_LIBRARIES += GLESv2 PLATFORM_LIBRARIES += GLESv1_CM PLATFORM_LIBRARIES += EGL @@ -169,8 +168,7 @@ PLATFORM_LIBRARIES += dl PLATFORM_LDFLAGS += -pthread -#rpi4 -ifdef IS_RPI_4_NEWER +ifndef USE_PI_LEGACY PLATFORM_LDFLAGS += -latomic endif From b35eee3224335814648b298d508b6bcf4826c278 Mon Sep 17 00:00:00 2001 From: ofTheo Date: Tue, 12 Nov 2019 12:00:33 -0800 Subject: [PATCH 03/19] undefine GLFW for legacy PI --- .../project/linuxarmv6l/config.linuxarmv6l.default.mk | 1 + 1 file changed, 1 insertion(+) diff --git a/libs/openFrameworksCompiled/project/linuxarmv6l/config.linuxarmv6l.default.mk b/libs/openFrameworksCompiled/project/linuxarmv6l/config.linuxarmv6l.default.mk index c425e7235a3..0bf9c1a35a9 100644 --- a/libs/openFrameworksCompiled/project/linuxarmv6l/config.linuxarmv6l.default.mk +++ b/libs/openFrameworksCompiled/project/linuxarmv6l/config.linuxarmv6l.default.mk @@ -56,6 +56,7 @@ PLATFORM_DEFINES += TARGET_RASPBERRY_PI ifdef USE_PI_LEGACY PLATFORM_DEFINES += TARGET_RASPBERRY_PI_LEGACY + undefine USE_GLFW_WINDOW endif ifdef USE_GLFW_WINDOW From 2588fc2bcc372d211fa4bd111e4cc058c8741040 Mon Sep 17 00:00:00 2001 From: ofTheo Date: Tue, 12 Nov 2019 12:11:29 -0800 Subject: [PATCH 04/19] updated config.linuxarmv7l.raspberry2.mk to reflect changes to armv6l changes --- .../config.linuxarmv7l.raspberry2.mk | 51 +++++++++++++++++-- 1 file changed, 46 insertions(+), 5 deletions(-) diff --git a/libs/openFrameworksCompiled/project/linuxarmv7l/config.linuxarmv7l.raspberry2.mk b/libs/openFrameworksCompiled/project/linuxarmv7l/config.linuxarmv7l.raspberry2.mk index 5bb34f348f1..ad1798dde4c 100644 --- a/libs/openFrameworksCompiled/project/linuxarmv7l/config.linuxarmv7l.raspberry2.mk +++ b/libs/openFrameworksCompiled/project/linuxarmv7l/config.linuxarmv7l.raspberry2.mk @@ -43,9 +43,26 @@ include $(OF_SHARED_MAKEFILES_PATH)/config.linux.common.mk # Note: Leave a leading space when adding list items with the += operator ################################################################################ +# We need a detection here for PI versions older than stretch +# Uncomment the following line to build for older Raspbian releases or older devices +# USE_PI_LEGACY = 1 + +# comment this for older EGL windowing. Has no effect if USE_PI_LEGACY is enabled +# GLFW seems to provide a more robust window on newer Raspbian releases +USE_GLFW_WINDOW = 1; + # defines used inside openFrameworks libs. PLATFORM_DEFINES += TARGET_RASPBERRY_PI +ifdef USE_PI_LEGACY + PLATFORM_DEFINES += TARGET_RASPBERRY_PI_LEGACY + undefine USE_GLFW_WINDOW +endif + +ifdef USE_GLFW_WINDOW + PLATFORM_DEFINES += TARGET_GLFW_WINDOW +endif + # TODO many of these are not relevant to openFrameworks (were just pasted from hello_pi examples) # from raspberry pi examples PLATFORM_DEFINES += STANDALONE @@ -119,10 +136,27 @@ PLATFORM_CFLAGS += -pipe # Note: Leave a leading space when adding list items with the += operator ################################################################################ +#rpi4 +ifdef USE_GLFW_WINDOW + PLATFORM_PKG_CONFIG_LIBRARIES += gl + PLATFORM_PKG_CONFIG_LIBRARIES += glu + PLATFORM_PKG_CONFIG_LIBRARIES += glew +endif + # raspberry pi specific -PLATFORM_LIBRARIES += GLESv2 -PLATFORM_LIBRARIES += GLESv1_CM -PLATFORM_LIBRARIES += EGL +ifndef USE_PI_LEGACY + PLATFORM_LIBRARIES += GLESv2 + PLATFORM_LIBRARIES += GLESv1_CM + PLATFORM_LIBRARIES += EGL +else ifneq (,$(wildcard $(RPI_ROOT)/opt/vc/lib/libGLESv2.so)) + PLATFORM_LIBRARIES += GLESv2 + PLATFORM_LIBRARIES += GLESv1_CM + PLATFORM_LIBRARIES += EGL +else + PLATFORM_LIBRARIES += brcmGLESv2 + PLATFORM_LIBRARIES += brcmEGL +endif + PLATFORM_LIBRARIES += openmaxil PLATFORM_LIBRARIES += bcm_host PLATFORM_LIBRARIES += vcos @@ -136,6 +170,9 @@ PLATFORM_LIBRARIES += dl PLATFORM_LDFLAGS += -pthread +ifndef USE_PI_LEGACY + PLATFORM_LDFLAGS += -latomic +endif ################################################################################ # PLATFORM HEADER SEARCH PATHS @@ -183,8 +220,12 @@ PLATFORM_LIBRARY_SEARCH_PATHS += $(RPI_ROOT)/opt/vc/lib # Note: Leave a leading space when adding list items with the += operator ################################################################################ -#PLATFORM_PKG_CONFIG_LIBRARIES += gstreamer-egl-$(GST_VERSION) -PLATFORM_CORE_EXCLUSIONS += $(OF_LIBS_PATH)/openFrameworks/app/ofAppGLFWWindow.cpp +#rpi4 +ifndef USE_GLFW_WINDOW + PLATFORM_CORE_EXCLUSIONS += $(OF_LIBS_PATH)/openFrameworks/app/ofAppGLFWWindow.cpp +else + PLATFORM_CORE_EXCLUSIONS += $(OF_LIBS_PATH)/openFrameworks/app/ofAppEGLWindow.cpp +endif PLATFORM_CORE_EXCLUSIONS += $(OF_LIBS_PATH)/openFrameworks/sound/ofFmodSoundPlayer.cpp ifeq ($(CROSS_COMPILING),1) From 1a41ad921ddb639f0f91a4213dc3f90508f6eefe Mon Sep 17 00:00:00 2001 From: ofTheo Date: Tue, 12 Nov 2019 15:16:55 -0800 Subject: [PATCH 05/19] detect new Raspbian releases and disable legacy system in make file --- .../linuxarmv6l/config.linuxarmv6l.default.mk | 19 ++++++++++++++++--- .../config.linuxarmv7l.raspberry2.mk | 19 ++++++++++++++++--- 2 files changed, 32 insertions(+), 6 deletions(-) diff --git a/libs/openFrameworksCompiled/project/linuxarmv6l/config.linuxarmv6l.default.mk b/libs/openFrameworksCompiled/project/linuxarmv6l/config.linuxarmv6l.default.mk index 0bf9c1a35a9..0a5691b77a8 100644 --- a/libs/openFrameworksCompiled/project/linuxarmv6l/config.linuxarmv6l.default.mk +++ b/libs/openFrameworksCompiled/project/linuxarmv6l/config.linuxarmv6l.default.mk @@ -43,9 +43,22 @@ include $(OF_SHARED_MAKEFILES_PATH)/config.linux.common.mk # Note: Leave a leading space when adding list items with the += operator ################################################################################ -# We need a detection here for PI versions older than stretch -# Uncomment the following line to build for older Raspbian releases or older devices -# USE_PI_LEGACY = 1 +# We detect Raspbian versions Stretch and newer and disable legacy automatically +# If detection fails comment out USE_PI_LEGACY to use the newer system +USE_PI_LEGACY = 1 + +#if we have this file lets see if we are Stretch or Newer +ifneq (,$(wildcard $(RPI_ROOT)/etc/os-release)) + + #grab the Debian version ( 9 = Stretch, 10 = Buster ) + VER_ID = $(shell grep -oP '(?<=^VERSION_ID=).+' $(RPI_ROOT)/etc/os-release | tr -d '"') + + #check if we are newer than 8 and use the new system + ifeq ($(shell test $(VER_ID) -gt 8; echo $$?),0) + undefine USE_PI_LEGACY + endif + +endif # comment this for older EGL windowing. Has no effect if USE_PI_LEGACY is enabled # GLFW seems to provide a more robust window on newer Raspbian releases diff --git a/libs/openFrameworksCompiled/project/linuxarmv7l/config.linuxarmv7l.raspberry2.mk b/libs/openFrameworksCompiled/project/linuxarmv7l/config.linuxarmv7l.raspberry2.mk index ad1798dde4c..fde12fadad0 100644 --- a/libs/openFrameworksCompiled/project/linuxarmv7l/config.linuxarmv7l.raspberry2.mk +++ b/libs/openFrameworksCompiled/project/linuxarmv7l/config.linuxarmv7l.raspberry2.mk @@ -43,9 +43,22 @@ include $(OF_SHARED_MAKEFILES_PATH)/config.linux.common.mk # Note: Leave a leading space when adding list items with the += operator ################################################################################ -# We need a detection here for PI versions older than stretch -# Uncomment the following line to build for older Raspbian releases or older devices -# USE_PI_LEGACY = 1 +# We detect Raspbian versions Stretch and newer and disable legacy automatically +# If detection fails comment out USE_PI_LEGACY to use the newer system +USE_PI_LEGACY = 1 + +#if we have this file lets see if we are Stretch or Newer +ifneq (,$(wildcard $(RPI_ROOT)/etc/os-release)) + + #grab the Debian version ( 9 = Stretch, 10 = Buster ) + VER_ID = $(shell grep -oP '(?<=^VERSION_ID=).+' $(RPI_ROOT)/etc/os-release | tr -d '"') + + #check if we are newer than 8 and use the new system + ifeq ($(shell test $(VER_ID) -gt 8; echo $$?),0) + undefine USE_PI_LEGACY + endif + +endif # comment this for older EGL windowing. Has no effect if USE_PI_LEGACY is enabled # GLFW seems to provide a more robust window on newer Raspbian releases From 272dd01c9cc1b2003b7ecc5c79205443c1d10f79 Mon Sep 17 00:00:00 2001 From: ofTheo Date: Tue, 12 Nov 2019 15:26:50 -0800 Subject: [PATCH 06/19] spaces breaking things --- .../linuxarmv6l/config.linuxarmv6l.default.mk | 12 ++++++------ .../linuxarmv7l/config.linuxarmv7l.raspberry2.mk | 12 ++++++------ 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/libs/openFrameworksCompiled/project/linuxarmv6l/config.linuxarmv6l.default.mk b/libs/openFrameworksCompiled/project/linuxarmv6l/config.linuxarmv6l.default.mk index 0a5691b77a8..e72ca36bde9 100644 --- a/libs/openFrameworksCompiled/project/linuxarmv6l/config.linuxarmv6l.default.mk +++ b/libs/openFrameworksCompiled/project/linuxarmv6l/config.linuxarmv6l.default.mk @@ -50,13 +50,13 @@ USE_PI_LEGACY = 1 #if we have this file lets see if we are Stretch or Newer ifneq (,$(wildcard $(RPI_ROOT)/etc/os-release)) - #grab the Debian version ( 9 = Stretch, 10 = Buster ) - VER_ID = $(shell grep -oP '(?<=^VERSION_ID=).+' $(RPI_ROOT)/etc/os-release | tr -d '"') +#grab the Debian version ( 9 = Stretch, 10 = Buster ) +VER_ID = $(shell grep -oP '(?<=^VERSION_ID=).+' $(RPI_ROOT)/etc/os-release | tr -d '"') - #check if we are newer than 8 and use the new system - ifeq ($(shell test $(VER_ID) -gt 8; echo $$?),0) - undefine USE_PI_LEGACY - endif +#check if we are newer than 8 and use the new system +ifeq ($(shell test $(VER_ID) -gt 8; echo $$?),0) +undefine USE_PI_LEGACY +endif endif diff --git a/libs/openFrameworksCompiled/project/linuxarmv7l/config.linuxarmv7l.raspberry2.mk b/libs/openFrameworksCompiled/project/linuxarmv7l/config.linuxarmv7l.raspberry2.mk index fde12fadad0..db3d11453be 100644 --- a/libs/openFrameworksCompiled/project/linuxarmv7l/config.linuxarmv7l.raspberry2.mk +++ b/libs/openFrameworksCompiled/project/linuxarmv7l/config.linuxarmv7l.raspberry2.mk @@ -50,13 +50,13 @@ USE_PI_LEGACY = 1 #if we have this file lets see if we are Stretch or Newer ifneq (,$(wildcard $(RPI_ROOT)/etc/os-release)) - #grab the Debian version ( 9 = Stretch, 10 = Buster ) - VER_ID = $(shell grep -oP '(?<=^VERSION_ID=).+' $(RPI_ROOT)/etc/os-release | tr -d '"') +#grab the Debian version ( 9 = Stretch, 10 = Buster ) +VER_ID = $(shell grep -oP '(?<=^VERSION_ID=).+' $(RPI_ROOT)/etc/os-release | tr -d '"') - #check if we are newer than 8 and use the new system - ifeq ($(shell test $(VER_ID) -gt 8; echo $$?),0) - undefine USE_PI_LEGACY - endif +#check if we are newer than 8 and use the new system +ifeq ($(shell test $(VER_ID) -gt 8; echo $$?),0) +undefine USE_PI_LEGACY +endif endif From e9308d44cb4ebb2a493f4ab7e50d24b58d849805 Mon Sep 17 00:00:00 2001 From: ofTheo Date: Tue, 12 Nov 2019 16:10:30 -0800 Subject: [PATCH 07/19] test tab make fix --- .../linuxarmv6l/config.linuxarmv6l.default.mk | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/libs/openFrameworksCompiled/project/linuxarmv6l/config.linuxarmv6l.default.mk b/libs/openFrameworksCompiled/project/linuxarmv6l/config.linuxarmv6l.default.mk index e72ca36bde9..226fa00847b 100644 --- a/libs/openFrameworksCompiled/project/linuxarmv6l/config.linuxarmv6l.default.mk +++ b/libs/openFrameworksCompiled/project/linuxarmv6l/config.linuxarmv6l.default.mk @@ -50,14 +50,13 @@ USE_PI_LEGACY = 1 #if we have this file lets see if we are Stretch or Newer ifneq (,$(wildcard $(RPI_ROOT)/etc/os-release)) -#grab the Debian version ( 9 = Stretch, 10 = Buster ) -VER_ID = $(shell grep -oP '(?<=^VERSION_ID=).+' $(RPI_ROOT)/etc/os-release | tr -d '"') - -#check if we are newer than 8 and use the new system -ifeq ($(shell test $(VER_ID) -gt 8; echo $$?),0) -undefine USE_PI_LEGACY -endif + #grab the Debian version ( 9 = Stretch, 10 = Buster ) + VER_ID = $(shell grep -oP '(?<=^VERSION_ID=).+' $(RPI_ROOT)/etc/os-release | tr -d '"') + #check if we are newer than 8 and use the new system + ifeq ($(shell test $(VER_ID) -gt 8; echo $$?),0) + undefine USE_PI_LEGACY + endif endif # comment this for older EGL windowing. Has no effect if USE_PI_LEGACY is enabled From 81e2e54c414fc2a3358d32ea39dc2cd2732e78e5 Mon Sep 17 00:00:00 2001 From: ofTheo Date: Tue, 12 Nov 2019 16:37:02 -0800 Subject: [PATCH 08/19] learning about tabs and makefiles --- .../linuxarmv6l/config.linuxarmv6l.default.mk | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/libs/openFrameworksCompiled/project/linuxarmv6l/config.linuxarmv6l.default.mk b/libs/openFrameworksCompiled/project/linuxarmv6l/config.linuxarmv6l.default.mk index 226fa00847b..e72ca36bde9 100644 --- a/libs/openFrameworksCompiled/project/linuxarmv6l/config.linuxarmv6l.default.mk +++ b/libs/openFrameworksCompiled/project/linuxarmv6l/config.linuxarmv6l.default.mk @@ -50,13 +50,14 @@ USE_PI_LEGACY = 1 #if we have this file lets see if we are Stretch or Newer ifneq (,$(wildcard $(RPI_ROOT)/etc/os-release)) - #grab the Debian version ( 9 = Stretch, 10 = Buster ) - VER_ID = $(shell grep -oP '(?<=^VERSION_ID=).+' $(RPI_ROOT)/etc/os-release | tr -d '"') +#grab the Debian version ( 9 = Stretch, 10 = Buster ) +VER_ID = $(shell grep -oP '(?<=^VERSION_ID=).+' $(RPI_ROOT)/etc/os-release | tr -d '"') + +#check if we are newer than 8 and use the new system +ifeq ($(shell test $(VER_ID) -gt 8; echo $$?),0) +undefine USE_PI_LEGACY +endif - #check if we are newer than 8 and use the new system - ifeq ($(shell test $(VER_ID) -gt 8; echo $$?),0) - undefine USE_PI_LEGACY - endif endif # comment this for older EGL windowing. Has no effect if USE_PI_LEGACY is enabled From 4bfa7f8aa47b481ddd20c0bc81f7e89794a5ac26 Mon Sep 17 00:00:00 2001 From: ofTheo Date: Tue, 12 Nov 2019 19:57:23 -0800 Subject: [PATCH 09/19] last try with tabs --- .../project/linuxarmv6l/config.linuxarmv6l.default.mk | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libs/openFrameworksCompiled/project/linuxarmv6l/config.linuxarmv6l.default.mk b/libs/openFrameworksCompiled/project/linuxarmv6l/config.linuxarmv6l.default.mk index e72ca36bde9..564ab9e6440 100644 --- a/libs/openFrameworksCompiled/project/linuxarmv6l/config.linuxarmv6l.default.mk +++ b/libs/openFrameworksCompiled/project/linuxarmv6l/config.linuxarmv6l.default.mk @@ -68,8 +68,8 @@ USE_GLFW_WINDOW = 1; PLATFORM_DEFINES += TARGET_RASPBERRY_PI ifdef USE_PI_LEGACY - PLATFORM_DEFINES += TARGET_RASPBERRY_PI_LEGACY - undefine USE_GLFW_WINDOW + PLATFORM_DEFINES += TARGET_RASPBERRY_PI_LEGACY + undefine USE_GLFW_WINDOW endif ifdef USE_GLFW_WINDOW From d4c682c228d3c7027584fcad133677c89db2030b Mon Sep 17 00:00:00 2001 From: ofTheo Date: Tue, 12 Nov 2019 20:08:14 -0800 Subject: [PATCH 10/19] another try --- .../linuxarmv6l/config.linuxarmv6l.default.mk | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/libs/openFrameworksCompiled/project/linuxarmv6l/config.linuxarmv6l.default.mk b/libs/openFrameworksCompiled/project/linuxarmv6l/config.linuxarmv6l.default.mk index 564ab9e6440..1992f188dcc 100644 --- a/libs/openFrameworksCompiled/project/linuxarmv6l/config.linuxarmv6l.default.mk +++ b/libs/openFrameworksCompiled/project/linuxarmv6l/config.linuxarmv6l.default.mk @@ -47,18 +47,19 @@ include $(OF_SHARED_MAKEFILES_PATH)/config.linux.common.mk # If detection fails comment out USE_PI_LEGACY to use the newer system USE_PI_LEGACY = 1 +VER_ID = 0 + #if we have this file lets see if we are Stretch or Newer ifneq (,$(wildcard $(RPI_ROOT)/etc/os-release)) - -#grab the Debian version ( 9 = Stretch, 10 = Buster ) -VER_ID = $(shell grep -oP '(?<=^VERSION_ID=).+' $(RPI_ROOT)/etc/os-release | tr -d '"') + #grab the Debian version ( 9 = Stretch, 10 = Buster ) + VER_ID = $(shell grep -oP '(?<=^VERSION_ID=).+' $(RPI_ROOT)/etc/os-release | tr -d '"') +endif #check if we are newer than 8 and use the new system ifeq ($(shell test $(VER_ID) -gt 8; echo $$?),0) -undefine USE_PI_LEGACY + undefine USE_PI_LEGACY endif -endif # comment this for older EGL windowing. Has no effect if USE_PI_LEGACY is enabled # GLFW seems to provide a more robust window on newer Raspbian releases @@ -68,8 +69,8 @@ USE_GLFW_WINDOW = 1; PLATFORM_DEFINES += TARGET_RASPBERRY_PI ifdef USE_PI_LEGACY - PLATFORM_DEFINES += TARGET_RASPBERRY_PI_LEGACY - undefine USE_GLFW_WINDOW + PLATFORM_DEFINES += TARGET_RASPBERRY_PI_LEGACY + undefine USE_GLFW_WINDOW endif ifdef USE_GLFW_WINDOW From d56c2c1a0c4135a561124d050164b697a57a3b19 Mon Sep 17 00:00:00 2001 From: ofTheo Date: Tue, 12 Nov 2019 20:30:07 -0800 Subject: [PATCH 11/19] think the issue was with undefine - trying a different approach --- .../linuxarmv6l/config.linuxarmv6l.default.mk | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/libs/openFrameworksCompiled/project/linuxarmv6l/config.linuxarmv6l.default.mk b/libs/openFrameworksCompiled/project/linuxarmv6l/config.linuxarmv6l.default.mk index 1992f188dcc..02d59df3538 100644 --- a/libs/openFrameworksCompiled/project/linuxarmv6l/config.linuxarmv6l.default.mk +++ b/libs/openFrameworksCompiled/project/linuxarmv6l/config.linuxarmv6l.default.mk @@ -43,10 +43,6 @@ include $(OF_SHARED_MAKEFILES_PATH)/config.linux.common.mk # Note: Leave a leading space when adding list items with the += operator ################################################################################ -# We detect Raspbian versions Stretch and newer and disable legacy automatically -# If detection fails comment out USE_PI_LEGACY to use the newer system -USE_PI_LEGACY = 1 - VER_ID = 0 #if we have this file lets see if we are Stretch or Newer @@ -55,11 +51,14 @@ ifneq (,$(wildcard $(RPI_ROOT)/etc/os-release)) VER_ID = $(shell grep -oP '(?<=^VERSION_ID=).+' $(RPI_ROOT)/etc/os-release | tr -d '"') endif -#check if we are newer than 8 and use the new system -ifeq ($(shell test $(VER_ID) -gt 8; echo $$?),0) - undefine USE_PI_LEGACY +#check if we are older than 9 and use the old system +ifeq ($(shell test $(VER_ID) -lt 9; echo $$?),0) + USE_PI_LEGACY = 1 endif +# We detect Raspbian versions Stretch and newer above and enable legacy automatically for older versions +# If detection fails uncomment USE_PI_LEGACY = 1 to use the older system +# USE_PI_LEGACY = 1 # comment this for older EGL windowing. Has no effect if USE_PI_LEGACY is enabled # GLFW seems to provide a more robust window on newer Raspbian releases From aa4378722847f8d9b6ad93d77ecaaf22314e1b1b Mon Sep 17 00:00:00 2001 From: ofTheo Date: Tue, 12 Nov 2019 20:31:52 -0800 Subject: [PATCH 12/19] need undefine alternative for USE_GLFW_WINDOW --- .../project/linuxarmv6l/config.linuxarmv6l.default.mk | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/libs/openFrameworksCompiled/project/linuxarmv6l/config.linuxarmv6l.default.mk b/libs/openFrameworksCompiled/project/linuxarmv6l/config.linuxarmv6l.default.mk index 02d59df3538..7295a1278dd 100644 --- a/libs/openFrameworksCompiled/project/linuxarmv6l/config.linuxarmv6l.default.mk +++ b/libs/openFrameworksCompiled/project/linuxarmv6l/config.linuxarmv6l.default.mk @@ -60,16 +60,15 @@ endif # If detection fails uncomment USE_PI_LEGACY = 1 to use the older system # USE_PI_LEGACY = 1 -# comment this for older EGL windowing. Has no effect if USE_PI_LEGACY is enabled -# GLFW seems to provide a more robust window on newer Raspbian releases -USE_GLFW_WINDOW = 1; - # defines used inside openFrameworks libs. PLATFORM_DEFINES += TARGET_RASPBERRY_PI ifdef USE_PI_LEGACY PLATFORM_DEFINES += TARGET_RASPBERRY_PI_LEGACY - undefine USE_GLFW_WINDOW +else + # comment this for older EGL windowing. Has no effect if USE_PI_LEGACY is enabled + # GLFW seems to provide a more robust window on newer Raspbian releases + USE_GLFW_WINDOW = 1; endif ifdef USE_GLFW_WINDOW From f7603e8e9afe43c60251152d4c5f41e90d4cff62 Mon Sep 17 00:00:00 2001 From: ofTheo Date: Tue, 12 Nov 2019 20:50:12 -0800 Subject: [PATCH 13/19] glfw included lib --- .../project/linuxarmv6l/config.linuxarmv6l.default.mk | 1 + 1 file changed, 1 insertion(+) diff --git a/libs/openFrameworksCompiled/project/linuxarmv6l/config.linuxarmv6l.default.mk b/libs/openFrameworksCompiled/project/linuxarmv6l/config.linuxarmv6l.default.mk index 7295a1278dd..200d1f5d183 100644 --- a/libs/openFrameworksCompiled/project/linuxarmv6l/config.linuxarmv6l.default.mk +++ b/libs/openFrameworksCompiled/project/linuxarmv6l/config.linuxarmv6l.default.mk @@ -153,6 +153,7 @@ ifdef USE_GLFW_WINDOW PLATFORM_PKG_CONFIG_LIBRARIES += gl PLATFORM_PKG_CONFIG_LIBRARIES += glu PLATFORM_PKG_CONFIG_LIBRARIES += glew + PLATFORM_PKG_CONFIG_LIBRARIES += glfw endif # raspberry pi specific From 8c67a78f66e88729c95f66de635630e1306bb76e Mon Sep 17 00:00:00 2001 From: ofTheo Date: Tue, 12 Nov 2019 20:59:47 -0800 Subject: [PATCH 14/19] glfw error --- .../project/linuxarmv6l/config.linuxarmv6l.default.mk | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/libs/openFrameworksCompiled/project/linuxarmv6l/config.linuxarmv6l.default.mk b/libs/openFrameworksCompiled/project/linuxarmv6l/config.linuxarmv6l.default.mk index 200d1f5d183..4225f91b549 100644 --- a/libs/openFrameworksCompiled/project/linuxarmv6l/config.linuxarmv6l.default.mk +++ b/libs/openFrameworksCompiled/project/linuxarmv6l/config.linuxarmv6l.default.mk @@ -153,7 +153,6 @@ ifdef USE_GLFW_WINDOW PLATFORM_PKG_CONFIG_LIBRARIES += gl PLATFORM_PKG_CONFIG_LIBRARIES += glu PLATFORM_PKG_CONFIG_LIBRARIES += glew - PLATFORM_PKG_CONFIG_LIBRARIES += glfw endif # raspberry pi specific @@ -178,7 +177,9 @@ PLATFORM_LIBRARIES += pcre PLATFORM_LIBRARIES += rt PLATFORM_LIBRARIES += X11 PLATFORM_LIBRARIES += dl - +ifdef USE_GLFW_WINDOW + PLATFORM_LIBRARIES += glfw +endif PLATFORM_LDFLAGS += -pthread From 55eb4ba8e6281d86e1de0fa9bb8cac70c9340fd8 Mon Sep 17 00:00:00 2001 From: ofTheo Date: Tue, 12 Nov 2019 21:26:25 -0800 Subject: [PATCH 15/19] trying a different approach --- .../linuxarmv6l/config.linuxarmv6l.default.mk | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/libs/openFrameworksCompiled/project/linuxarmv6l/config.linuxarmv6l.default.mk b/libs/openFrameworksCompiled/project/linuxarmv6l/config.linuxarmv6l.default.mk index 4225f91b549..230eccb1059 100644 --- a/libs/openFrameworksCompiled/project/linuxarmv6l/config.linuxarmv6l.default.mk +++ b/libs/openFrameworksCompiled/project/linuxarmv6l/config.linuxarmv6l.default.mk @@ -43,6 +43,10 @@ include $(OF_SHARED_MAKEFILES_PATH)/config.linux.common.mk # Note: Leave a leading space when adding list items with the += operator ################################################################################ +# We detect Raspbian versions Stretch and newer above and enable legacy automatically for older versions +# If detection fails comment USE_PI_LEGACY = 1 to use the newer system +USE_PI_LEGACY = 1 + VER_ID = 0 #if we have this file lets see if we are Stretch or Newer @@ -52,18 +56,17 @@ ifneq (,$(wildcard $(RPI_ROOT)/etc/os-release)) endif #check if we are older than 9 and use the old system -ifeq ($(shell test $(VER_ID) -lt 9; echo $$?),0) - USE_PI_LEGACY = 1 -endif -# We detect Raspbian versions Stretch and newer above and enable legacy automatically for older versions -# If detection fails uncomment USE_PI_LEGACY = 1 to use the older system -# USE_PI_LEGACY = 1 +#ifeq ($(shell test $(VER_ID) -lt 9; echo $$?),0) + +ifeq ($(shell expr $(VER_ID) \>= 9), 1) + USE_PI_LEGACY = 0 +endif # defines used inside openFrameworks libs. PLATFORM_DEFINES += TARGET_RASPBERRY_PI -ifdef USE_PI_LEGACY +ifeq ($(USE_PI_LEGACY), 1) PLATFORM_DEFINES += TARGET_RASPBERRY_PI_LEGACY else # comment this for older EGL windowing. Has no effect if USE_PI_LEGACY is enabled @@ -156,7 +159,7 @@ ifdef USE_GLFW_WINDOW endif # raspberry pi specific -ifndef USE_PI_LEGACY +ifeq ($(USE_PI_LEGACY), 0) PLATFORM_LIBRARIES += GLESv2 PLATFORM_LIBRARIES += GLESv1_CM PLATFORM_LIBRARIES += EGL @@ -177,13 +180,10 @@ PLATFORM_LIBRARIES += pcre PLATFORM_LIBRARIES += rt PLATFORM_LIBRARIES += X11 PLATFORM_LIBRARIES += dl -ifdef USE_GLFW_WINDOW - PLATFORM_LIBRARIES += glfw -endif PLATFORM_LDFLAGS += -pthread -ifndef USE_PI_LEGACY +ifeq ($(USE_PI_LEGACY), 0) PLATFORM_LDFLAGS += -latomic endif From 9d79dd086619ea34cdb37d9b4ebd14ec8ef0e159 Mon Sep 17 00:00:00 2001 From: ofTheo Date: Wed, 13 Nov 2019 08:52:33 -0800 Subject: [PATCH 16/19] added glfw3 package config --- .../project/linuxarmv6l/config.linuxarmv6l.default.mk | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libs/openFrameworksCompiled/project/linuxarmv6l/config.linuxarmv6l.default.mk b/libs/openFrameworksCompiled/project/linuxarmv6l/config.linuxarmv6l.default.mk index 230eccb1059..3186c26bd77 100644 --- a/libs/openFrameworksCompiled/project/linuxarmv6l/config.linuxarmv6l.default.mk +++ b/libs/openFrameworksCompiled/project/linuxarmv6l/config.linuxarmv6l.default.mk @@ -71,7 +71,7 @@ ifeq ($(USE_PI_LEGACY), 1) else # comment this for older EGL windowing. Has no effect if USE_PI_LEGACY is enabled # GLFW seems to provide a more robust window on newer Raspbian releases - USE_GLFW_WINDOW = 1; + USE_GLFW_WINDOW = 1 endif ifdef USE_GLFW_WINDOW @@ -156,6 +156,7 @@ ifdef USE_GLFW_WINDOW PLATFORM_PKG_CONFIG_LIBRARIES += gl PLATFORM_PKG_CONFIG_LIBRARIES += glu PLATFORM_PKG_CONFIG_LIBRARIES += glew + PLATFORM_PKG_CONFIG_LIBRARIES += glfw3 endif # raspberry pi specific From 4e4d3e74b64192ce7d41865d07cf4ceecc6ab4b4 Mon Sep 17 00:00:00 2001 From: ofTheo Date: Wed, 13 Nov 2019 12:24:49 -0800 Subject: [PATCH 17/19] debug info prob wont pass ci --- .../project/linuxarmv6l/config.linuxarmv6l.default.mk | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/libs/openFrameworksCompiled/project/linuxarmv6l/config.linuxarmv6l.default.mk b/libs/openFrameworksCompiled/project/linuxarmv6l/config.linuxarmv6l.default.mk index 3186c26bd77..1b45aa44d42 100644 --- a/libs/openFrameworksCompiled/project/linuxarmv6l/config.linuxarmv6l.default.mk +++ b/libs/openFrameworksCompiled/project/linuxarmv6l/config.linuxarmv6l.default.mk @@ -63,15 +63,19 @@ ifeq ($(shell expr $(VER_ID) \>= 9), 1) USE_PI_LEGACY = 0 endif +$(info VER ID IS $(VER_ID)) + # defines used inside openFrameworks libs. PLATFORM_DEFINES += TARGET_RASPBERRY_PI ifeq ($(USE_PI_LEGACY), 1) PLATFORM_DEFINES += TARGET_RASPBERRY_PI_LEGACY + $(info using legacy build) else # comment this for older EGL windowing. Has no effect if USE_PI_LEGACY is enabled # GLFW seems to provide a more robust window on newer Raspbian releases USE_GLFW_WINDOW = 1 + $(info using newer build and GLFW window) endif ifdef USE_GLFW_WINDOW @@ -156,7 +160,7 @@ ifdef USE_GLFW_WINDOW PLATFORM_PKG_CONFIG_LIBRARIES += gl PLATFORM_PKG_CONFIG_LIBRARIES += glu PLATFORM_PKG_CONFIG_LIBRARIES += glew - PLATFORM_PKG_CONFIG_LIBRARIES += glfw3 + PLATFORM_LIBRARIES += glfw3 endif # raspberry pi specific From ac8f38aec2aa864a049b1e98c1535f279b3fa4b9 Mon Sep 17 00:00:00 2001 From: ofTheo Date: Wed, 13 Nov 2019 15:31:18 -0800 Subject: [PATCH 18/19] these should both work now - just need glfw installed for armv6 CI --- .../linuxarmv6l/config.linuxarmv6l.default.mk | 7 +--- .../config.linuxarmv7l.raspberry2.mk | 37 +++++++++++-------- 2 files changed, 23 insertions(+), 21 deletions(-) diff --git a/libs/openFrameworksCompiled/project/linuxarmv6l/config.linuxarmv6l.default.mk b/libs/openFrameworksCompiled/project/linuxarmv6l/config.linuxarmv6l.default.mk index 1b45aa44d42..71ffce291a7 100644 --- a/libs/openFrameworksCompiled/project/linuxarmv6l/config.linuxarmv6l.default.mk +++ b/libs/openFrameworksCompiled/project/linuxarmv6l/config.linuxarmv6l.default.mk @@ -55,10 +55,7 @@ ifneq (,$(wildcard $(RPI_ROOT)/etc/os-release)) VER_ID = $(shell grep -oP '(?<=^VERSION_ID=).+' $(RPI_ROOT)/etc/os-release | tr -d '"') endif -#check if we are older than 9 and use the old system - -#ifeq ($(shell test $(VER_ID) -lt 9; echo $$?),0) - +#check if we are newer than 8 and use the new system ifeq ($(shell expr $(VER_ID) \>= 9), 1) USE_PI_LEGACY = 0 endif @@ -160,7 +157,7 @@ ifdef USE_GLFW_WINDOW PLATFORM_PKG_CONFIG_LIBRARIES += gl PLATFORM_PKG_CONFIG_LIBRARIES += glu PLATFORM_PKG_CONFIG_LIBRARIES += glew - PLATFORM_LIBRARIES += glfw3 + PLATFORM_LIBRARIES += glfw endif # raspberry pi specific diff --git a/libs/openFrameworksCompiled/project/linuxarmv7l/config.linuxarmv7l.raspberry2.mk b/libs/openFrameworksCompiled/project/linuxarmv7l/config.linuxarmv7l.raspberry2.mk index db3d11453be..d6ed3561f37 100644 --- a/libs/openFrameworksCompiled/project/linuxarmv7l/config.linuxarmv7l.raspberry2.mk +++ b/libs/openFrameworksCompiled/project/linuxarmv7l/config.linuxarmv7l.raspberry2.mk @@ -43,39 +43,43 @@ include $(OF_SHARED_MAKEFILES_PATH)/config.linux.common.mk # Note: Leave a leading space when adding list items with the += operator ################################################################################ -# We detect Raspbian versions Stretch and newer and disable legacy automatically -# If detection fails comment out USE_PI_LEGACY to use the newer system +# We detect Raspbian versions Stretch and newer above and enable legacy automatically for older versions +# If detection fails comment USE_PI_LEGACY = 1 to use the newer system USE_PI_LEGACY = 1 +VER_ID = 0 + #if we have this file lets see if we are Stretch or Newer ifneq (,$(wildcard $(RPI_ROOT)/etc/os-release)) - -#grab the Debian version ( 9 = Stretch, 10 = Buster ) -VER_ID = $(shell grep -oP '(?<=^VERSION_ID=).+' $(RPI_ROOT)/etc/os-release | tr -d '"') - -#check if we are newer than 8 and use the new system -ifeq ($(shell test $(VER_ID) -gt 8; echo $$?),0) -undefine USE_PI_LEGACY + #grab the Debian version ( 9 = Stretch, 10 = Buster ) + VER_ID = $(shell grep -oP '(?<=^VERSION_ID=).+' $(RPI_ROOT)/etc/os-release | tr -d '"') endif +#check if we are newer than 8 and use the new system +ifeq ($(shell expr $(VER_ID) \>= 9), 1) + USE_PI_LEGACY = 0 endif -# comment this for older EGL windowing. Has no effect if USE_PI_LEGACY is enabled -# GLFW seems to provide a more robust window on newer Raspbian releases -USE_GLFW_WINDOW = 1; +$(info VER ID IS $(VER_ID)) # defines used inside openFrameworks libs. PLATFORM_DEFINES += TARGET_RASPBERRY_PI -ifdef USE_PI_LEGACY +ifeq ($(USE_PI_LEGACY), 1) PLATFORM_DEFINES += TARGET_RASPBERRY_PI_LEGACY - undefine USE_GLFW_WINDOW + $(info using legacy build) +else + # comment this for older EGL windowing. Has no effect if USE_PI_LEGACY is enabled + # GLFW seems to provide a more robust window on newer Raspbian releases + USE_GLFW_WINDOW = 1 + $(info using newer build and GLFW window) endif ifdef USE_GLFW_WINDOW PLATFORM_DEFINES += TARGET_GLFW_WINDOW endif + # TODO many of these are not relevant to openFrameworks (were just pasted from hello_pi examples) # from raspberry pi examples PLATFORM_DEFINES += STANDALONE @@ -154,10 +158,11 @@ ifdef USE_GLFW_WINDOW PLATFORM_PKG_CONFIG_LIBRARIES += gl PLATFORM_PKG_CONFIG_LIBRARIES += glu PLATFORM_PKG_CONFIG_LIBRARIES += glew + PLATFORM_LIBRARIES += glfw endif # raspberry pi specific -ifndef USE_PI_LEGACY +ifeq ($(USE_PI_LEGACY), 0) PLATFORM_LIBRARIES += GLESv2 PLATFORM_LIBRARIES += GLESv1_CM PLATFORM_LIBRARIES += EGL @@ -183,7 +188,7 @@ PLATFORM_LIBRARIES += dl PLATFORM_LDFLAGS += -pthread -ifndef USE_PI_LEGACY +ifeq ($(USE_PI_LEGACY), 0) PLATFORM_LDFLAGS += -latomic endif From f47456482e6dc0d428861b200e42d52fb3f8b2c4 Mon Sep 17 00:00:00 2001 From: ofTheo Date: Wed, 13 Nov 2019 20:39:29 -0800 Subject: [PATCH 19/19] adding glfw to multistrap.conf --- scripts/ci/linuxarmv6l/multistrap.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/ci/linuxarmv6l/multistrap.conf b/scripts/ci/linuxarmv6l/multistrap.conf index 1dbd56bf507..077b43284fd 100644 --- a/scripts/ci/linuxarmv6l/multistrap.conf +++ b/scripts/ci/linuxarmv6l/multistrap.conf @@ -22,7 +22,7 @@ components=main contrib non-free rpi suite=stretch [OpenFrameworks] -packages=libasound2-dev libxmu-dev libxxf86vm-dev g++ libgl1-mesa-dev libglu1-mesa-dev libraw1394-dev libudev-dev libdrm-dev libglew-dev libopenal-dev libsndfile-dev libfreeimage-dev libcairo2-dev libfreetype6-dev libssl-dev libpulse-dev libusb-1.0-0-dev libopencv-dev libegl1-mesa-dev libgles1-mesa-dev libgles2-mesa-dev libassimp-dev librtaudio-dev libboost-filesystem-dev libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev gstreamer1.0-libav gstreamer1.0-pulseaudio gstreamer1.0-x gstreamer1.0-plugins-bad gstreamer1.0-alsa gstreamer1.0-plugins-base gstreamer1.0-plugins-good liburiparser-dev libcurl4-openssl-dev libxml2-dev libpugixml-dev libpoco-dev +packages=libasound2-dev libxmu-dev libxxf86vm-dev g++ libgl1-mesa-dev libglu1-mesa-dev libraw1394-dev libudev-dev libdrm-dev libglew-dev libopenal-dev libsndfile-dev libfreeimage-dev libcairo2-dev libfreetype6-dev libssl-dev libpulse-dev libusb-1.0-0-dev libopencv-dev libegl1-mesa-dev libgles1-mesa-dev libgles2-mesa-dev libassimp-dev librtaudio-dev libboost-filesystem-dev libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev gstreamer1.0-libav gstreamer1.0-pulseaudio gstreamer1.0-x gstreamer1.0-plugins-bad gstreamer1.0-alsa gstreamer1.0-plugins-base gstreamer1.0-plugins-good liburiparser-dev libcurl4-openssl-dev libxml2-dev libpugixml-dev libpoco-dev libglfw3-dev source=http://archive.raspbian.org/raspbian keyring=raspbian-archive-keyring components=main contrib non-free rpi