diff --git a/examples/events/eventsExample/src/testApp.cpp b/examples/events/eventsExample/src/testApp.cpp index 36b1734595a..369dedf69e0 100644 --- a/examples/events/eventsExample/src/testApp.cpp +++ b/examples/events/eventsExample/src/testApp.cpp @@ -15,7 +15,7 @@ void testApp::update(){ //-------------------------------------------------------------- void testApp::draw(){ - sprintf (timeString, "time: %i:%i:%i \nelapsed time %i", ofGetHours(), ofGetMinutes(), ofGetSeconds(), ofGetElapsedTimeMillis()); + sprintf (timeString, "time: %i:%i:%i \nelapsed time %lli", ofGetHours(), ofGetMinutes(), ofGetSeconds(), ofGetElapsedTimeMillis()); float w = vagRounded.stringWidth(eventString); float h = vagRounded.stringHeight(eventString); @@ -38,12 +38,12 @@ void testApp::draw(){ //-------------------------------------------------------------- void testApp::keyPressed (int key){ - sprintf(eventString, "keyPressed = (%i)", key); + sprintf(eventString, "keyPressed = (%i) %c", key, (char)key); } //-------------------------------------------------------------- void testApp::keyReleased(int key){ - sprintf(eventString, "keyReleased = (%i)", key); + sprintf(eventString, "keyReleased = (%i) %c", key, (char)key); } //-------------------------------------------------------------- diff --git a/libs/openFrameworks/app/ofAppNoWindow.cpp b/libs/openFrameworks/app/ofAppNoWindow.cpp new file mode 100644 index 00000000000..3563ebe84ab --- /dev/null +++ b/libs/openFrameworks/app/ofAppNoWindow.cpp @@ -0,0 +1,266 @@ +#include "ofAppNoWindow.h" +#include "ofBaseApp.h" +#include "ofMain.h" + + + +#if defined TARGET_OSX || defined TARGET_LINUX +#include +#include +#include +#include + +struct termios orig_termios; +struct sigaction act_open; + +void reset_terminal_mode() +{ + tcsetattr(0, TCSANOW, &orig_termios); +} + + +void set_conio_terminal_mode() +{ + struct termios new_termios; + + /* take two copies - one for now, one for later */ + tcgetattr(0, &orig_termios); + memcpy(&new_termios, &orig_termios, sizeof(new_termios)); + + /* register cleanup handler, and set the new terminal mode */ + atexit(reset_terminal_mode); + // setup new_termios for raw keyboard input + cfmakeraw(&new_termios); + // handle "\n" properly + new_termios.c_oflag |= OPOST; + //new_termios.c_oflag |= ONLCR; + // set the new_termios + tcsetattr(0, TCSANOW, &new_termios); +} + +int kbhit() +{ + return 0; + struct timeval tv = { 0L, 0L }; + fd_set fds; + FD_SET(0, &fds); + return select(1, &fds, NULL, NULL, &tv); +} + +int getch() +{ + int r; + unsigned char c; + if ((r = read(0, &c, sizeof(c))) < 0) { + return r; + } else { + return c; + } +} + +#endif + + +//---------------------------------------------------------- +ofAppNoWindow::ofAppNoWindow(){ + timeNow = 0; + timeThen = 0; + fps = 60; //give a realistic starting value - win32 issues + nFramesForFPS = 0; + nFrameCount = 0; + bFrameRateSet = false; + millisForFrame = 0; + prevMillis = 0; + diffMillis = 0; + frameRate = 0; + lastFrameTime = 0; +} + + +void ofAppNoWindow::setupOpenGL(int w, int h, int screenMode){ + width = w; + height = h; +} + +//------------------------------------------------------------ +void ofAppNoWindow::runAppViaInfiniteLoop(ofBaseApp * appPtr){ + + ofSetCurrentRenderer(ofPtr(new ofNoopRenderer)); + static ofEventArgs voidEventArgs; + + ofAppPtr = appPtr; + + if(ofAppPtr){ + ofAppPtr->setup(); + ofAppPtr->update(); + } + #if defined TARGET_OSX || defined TARGET_LINUX + // for keyboard + //set_conio_terminal_mode(); + #endif + + #ifdef OF_USING_POCO + ofNotifyEvent( ofEvents().setup, voidEventArgs ); + ofNotifyEvent( ofEvents().update, voidEventArgs ); + #endif + + ofLogNotice()<< "***\n***\n*** ofAppNoWindow running a headless openFrameworks app\n" + "***\n*** keyboard input works here\n" + "***\n*** press Esc or Ctrl-C to quit\n" + "***\n"; + while (true) + { + if (nFrameCount != 0 && bFrameRateSet == true){ + diffMillis = ofGetElapsedTimeMillis() - prevMillis; + if (diffMillis > millisForFrame){ + ; // we do nothing, we are already slower than target frame + } else { + int waitMillis = millisForFrame - diffMillis; + #ifdef TARGET_WIN32 + Sleep(waitMillis); //windows sleep in milliseconds + #else + usleep(waitMillis * 1000); //mac sleep in microseconds - cooler :) + #endif + } + } + prevMillis = ofGetElapsedTimeMillis(); // you have to measure here + + + /// listen for escape + #ifdef TARGET_WIN32 + if (GetAsyncKeyState(VK_ESCAPE)) + OF_EXIT_APP(0); + #endif + + #if defined TARGET_OSX || defined TARGET_LINUX + while ( kbhit() ) + { + int key = getch(); + if ( key == 27 ) + { + OF_EXIT_APP(0); + } + else if ( key == /* ctrl-c */ 3 ) + { + ofLogNotice()<< "Ctrl-C pressed\n"; + OF_EXIT_APP(0); + } + else + { + ofAppPtr->keyPressed( key ); + } + } + #endif + + + /// update + if (ofAppPtr) + ofAppPtr->update(); + + #ifdef OF_USING_POCO + ofNotifyEvent( ofEvents().update, voidEventArgs); + #endif + + if(ofGetCurrentRenderer()){ + if (ofAppPtr) + ofAppPtr->draw(); + + #ifdef OF_USING_POCO + ofNotifyEvent( ofEvents().draw, voidEventArgs); + #endif + } + + + + // -------------- fps calculation: + timeNow = ofGetElapsedTimef(); + double diff = timeNow-timeThen; + if( diff > 0.00001 ){ + fps = 1.0 / diff; + frameRate *= 0.9f; + frameRate += 0.1f*fps; + } + lastFrameTime = diff; + timeThen = timeNow; + // -------------- + + nFrameCount++; // increase the overall frame count + + } +} + +//------------------------------------------------------------ +void ofAppNoWindow::exitApp(){ + +// -- This already exists in ofExitCallback + +// static ofEventArgs voidEventArgs; +// +// if(ofAppPtr)ofAppPtr->exit(); +// +// #ifdef OF_USING_POCO +// ofNotifyEvent( ofEvents.exit, voidEventArgs ); +// #endif + + ofLog(OF_LOG_VERBOSE,"No Window OF app is being terminated!"); + + +#if defined TARGET_OSX || defined TARGET_LINUX + // this doesn't exist on windows and gives linking errors, so commented out. + reset_terminal_mode(); +#endif + + OF_EXIT_APP(0); +} + +//------------------------------------------------------------ +float ofAppNoWindow::getFrameRate(){ + return frameRate; +} + +//------------------------------------------------------------ +int ofAppNoWindow::getFrameNum(){ + return nFrameCount; +} + +//------------------------------------------------------------ +void ofAppNoWindow::setFrameRate(float targetRate){ + // given this FPS, what is the amount of millis per frame + // that should elapse? + + // --- > f / s + + if (targetRate == 0){ + bFrameRateSet = false; + return; + } + + bFrameRateSet = true; + float durationOfFrame = 1.0f / (float)targetRate; + millisForFrame = (int)(1000.0f * durationOfFrame); + + frameRate = targetRate; + +} + +ofPoint ofAppNoWindow::getWindowPosition(){ + return ofPoint(0,0); +} + +ofPoint ofAppNoWindow::getWindowSize(){ + return ofPoint(width,height); +} + +ofPoint ofAppNoWindow::getScreenSize(){ + return ofPoint(width,height); +} + + +int ofAppNoWindow::getWidth(){ + return width; +} + +int ofAppNoWindow::getHeight(){ + return height; +} + diff --git a/libs/openFrameworks/app/ofAppNoWindow.h b/libs/openFrameworks/app/ofAppNoWindow.h new file mode 100644 index 00000000000..c3383cea9b6 --- /dev/null +++ b/libs/openFrameworks/app/ofAppNoWindow.h @@ -0,0 +1,164 @@ +#pragma once + +#include "ofConstants.h" +#include "ofAppBaseWindow.h" +#include "ofBaseTypes.h" + + +//#ifdef TARGET_WIN32 +// #define GLUT_BUILDING_LIB +// #include "glut.h" +//#endif +//#ifdef TARGET_OSX +// #include +//#endif +//#ifdef TARGET_LINUX +// #include +//#endif + +class ofBaseApp; + +class ofAppNoWindow : public ofAppBaseWindow { + +public: + ofAppNoWindow(); + ~ofAppNoWindow(){} + + void runAppViaInfiniteLoop(ofBaseApp * appPtr); + + static void exitApp(); + void setupOpenGL(int w, int h, int screenMode); + + int getFrameNum(); + float getFrameRate(); + void setFrameRate(float targetRate); + + double getLastFrameTime() { return lastFrameTime; } + + ofPoint getWindowPosition(); + ofPoint getWindowSize(); + ofPoint getScreenSize(); + + int getWidth(); + int getHeight(); + + +private: + int width, height; + + double timeNow, timeThen, fps, lastFrameTime; + int nFramesForFPS; + int nFrameCount; + + bool bFrameRateSet; + int millisForFrame; + int prevMillis; + int diffMillis; + + float frameRate; + + ofBaseApp * ofAppPtr; +}; + +class ofNoopRenderer: public ofBaseRenderer{ + virtual string getType(){return "NOOP";} + + virtual void update(){} + + virtual void draw(ofPolyline & poly){} + virtual void draw(ofPath & shape){} + virtual void draw(ofMesh & vertexData, bool useColors, bool useTextures, bool useNormals){} + virtual void draw(ofMesh & vertexData, ofPolyRenderMode renderType, bool useColors, bool useTextures, bool useNormals){} + virtual void draw(vector & vertexData, ofPrimitiveMode drawMode){} + virtual void draw(ofImage & image, float x, float y, float z, float w, float h, float sx, float sy, float sw, float sh){} + virtual void draw(ofFloatImage & image, float x, float y, float z, float w, float h, float sx, float sy, float sw, float sh){} + virtual void draw(ofShortImage & image, float x, float y, float z, float w, float h, float sx, float sy, float sw, float sh){} + + //-------------------------------------------- + // transformations + virtual void pushView(){}; + virtual void popView(){}; + + // setup matrices and viewport (upto you to push and pop view before and after) + // if width or height are 0, assume windows dimensions (ofGetWidth(), ofGetHeight()) + // if nearDist or farDist are 0 assume defaults (calculated based on width / height) + virtual void viewport(ofRectangle viewport){}; + virtual void viewport(float x = 0, float y = 0, float width = 0, float height = 0, bool invertY = true){}; + virtual void setupScreenPerspective(float width = 0, float height = 0, ofOrientation orientation=OF_ORIENTATION_UNKNOWN, bool vFlip = true, float fov = 60, float nearDist = 0, float farDist = 0){} + virtual void setupScreenOrtho(float width = 0, float height = 0, ofOrientation orientation=OF_ORIENTATION_UNKNOWN, bool vFlip = true, float nearDist = -1, float farDist = 1){}; + virtual ofRectangle getCurrentViewport(){return ofRectangle();}; + virtual int getViewportWidth(){return 0;}; + virtual int getViewportHeight(){return 0;}; + + virtual void setCoordHandedness(ofHandednessType handedness){}; + virtual ofHandednessType getCoordHandedness(){return OF_LEFT_HANDED;}; + + //our openGL wrappers + virtual void pushMatrix(){}; + virtual void popMatrix(){}; + virtual void translate(float x, float y, float z = 0){}; + virtual void translate(const ofPoint & p){}; + virtual void scale(float xAmnt, float yAmnt, float zAmnt = 1){}; + virtual void rotate(float degrees, float vecX, float vecY, float vecZ){}; + virtual void rotateX(float degrees){}; + virtual void rotateY(float degrees){}; + virtual void rotateZ(float degrees){}; + virtual void rotate(float degrees){}; + + // screen coordinate things / default gl values + virtual void setupGraphicDefaults(){}; + virtual void setupScreen(){}; + + // drawing modes + virtual void setRectMode(ofRectMode mode){} + virtual ofRectMode getRectMode(){return OF_RECTMODE_CORNER;} + virtual void setFillMode(ofFillFlag fill){} + virtual ofFillFlag getFillMode(){return OF_FILLED;} + virtual void setLineWidth(float lineWidth){} + virtual void setBlendMode(ofBlendMode blendMode){} + virtual void setLineSmoothing(bool smooth){} + virtual void setCircleResolution(int res){}; + virtual void setSphereResolution(int res){}; + virtual void enablePointSprites(){}; + virtual void disablePointSprites(){}; + + // color options + virtual void setColor(int r, int g, int b){}; // 0-255 + virtual void setColor(int r, int g, int b, int a){}; // 0-255 + virtual void setColor(const ofColor & color){}; + virtual void setColor(const ofColor & color, int _a){}; + virtual void setColor(int gray){}; // new set a color as grayscale with one argument + virtual void setHexColor( int hexColor ){}; // hex, like web 0xFF0033; + + // bg color + virtual ofFloatColor & getBgColor(){return bgColor;} + virtual bool bClearBg(){ + return true; + } + virtual void background(const ofColor & c){}; + virtual void background(float brightness){}; + virtual void background(int hexColor, float _a=255.0f){}; + virtual void background(int r, int g, int b, int a=255){}; + + virtual void setBackgroundAuto(bool bManual){}; // default is true + + virtual void clear(float r, float g, float b, float a=0){}; + virtual void clear(float brightness, float a=0){}; + virtual void clearAlpha(){}; + + // drawing + virtual void drawLine(float x1, float y1, float z1, float x2, float y2, float z2){} + virtual void drawRectangle(float x, float y, float z, float w, float h){} + virtual void drawTriangle(float x1, float y1, float z1, float x2, float y2, float z2, float x3, float y3, float z3){} + virtual void drawCircle(float x, float y, float z, float radius){} + virtual void drawSphere(float x, float y, float z, float radius){} + virtual void drawEllipse(float x, float y, float z, float width, float height){} + virtual void drawString(string text, float x, float y, float z, ofDrawBitmapMode mode){} + + + // returns true if the renderer can render curves without decomposing them + virtual bool rendersPathPrimitives(){return true;} +private: + ofFloatColor bgColor; +}; + diff --git a/libs/openFrameworks/app/ofAppRunner.cpp b/libs/openFrameworks/app/ofAppRunner.cpp index 60d4f69665b..409512a08fe 100644 --- a/libs/openFrameworks/app/ofAppRunner.cpp +++ b/libs/openFrameworks/app/ofAppRunner.cpp @@ -30,7 +30,9 @@ static ofPtr window; //======================================================================== // default windowing -#ifdef TARGET_OF_IPHONE +#ifdef TARGET_NODISPLAY + #include "ofAppNoWindow.h" +#elif defined(TARGET_OF_IPHONE) #include "ofAppiPhoneWindow.h" #elif defined(TARGET_ANDROID) #include "ofAppAndroidWindow.h" @@ -108,7 +110,9 @@ void ofSetupOpenGL(ofPtr windowPtr, int w, int h, int screenMod //-------------------------------------- void ofSetupOpenGL(int w, int h, int screenMode){ - #ifdef TARGET_OF_IPHONE + #ifdef TARGET_NODISPLAY + window = ofPtr(new ofAppNoWindow()); + #elif defined(TARGET_OF_IPHONE) window = ofPtr(new ofAppiPhoneWindow()); #elif defined(TARGET_ANDROID) window = ofPtr(new ofAppAndroidWindow()); diff --git a/libs/openFrameworks/sound/ofSoundPlayer.cpp b/libs/openFrameworks/sound/ofSoundPlayer.cpp index c99b1af0ccc..28a63aad626 100644 --- a/libs/openFrameworks/sound/ofSoundPlayer.cpp +++ b/libs/openFrameworks/sound/ofSoundPlayer.cpp @@ -26,7 +26,7 @@ void ofSoundUpdate(){ #endif } -#ifndef TARGET_ANDROID +#if !defined(TARGET_ANDROID) && !defined(TARGET_LINUX_ARM) //-------------------- void ofSoundShutdown(){ #ifdef OF_SOUND_PLAYER_FMOD diff --git a/libs/openFrameworks/sound/ofSoundPlayer.h b/libs/openFrameworks/sound/ofSoundPlayer.h index 36eed0a681c..68cf2793750 100644 --- a/libs/openFrameworks/sound/ofSoundPlayer.h +++ b/libs/openFrameworks/sound/ofSoundPlayer.h @@ -44,6 +44,10 @@ void ofSoundShutdown(); inline void ofSoundShutdown(){} #endif +#ifdef TARGET_LINUX_ARM +inline void ofSoundShutdown(){} +#endif + //--------------------------------------------- class ofSoundPlayer : public ofBaseSoundPlayer { diff --git a/libs/openFrameworksCompiled/project/linuxarmv6l/configure.core.linuxarmv6l.default.make b/libs/openFrameworksCompiled/project/linuxarmv6l/configure.core.linuxarmv6l.default.make index 25e3b50719b..64559c64720 100755 --- a/libs/openFrameworksCompiled/project/linuxarmv6l/configure.core.linuxarmv6l.default.make +++ b/libs/openFrameworksCompiled/project/linuxarmv6l/configure.core.linuxarmv6l.default.make @@ -26,6 +26,11 @@ # ifdefs within the openFrameworks core source code. ################################################################################ +#check if gtk exists and add it +HAS_SYSTEM_GTK = $(shell pkg-config gtk+-2.0 --exists; echo $$?) +#check if mpg123 exists and add it +HAS_SYSTEM_MPG123 = $(shell pkg-config libmpg123 --exists; echo $$?) + ################################################################################ # PLATFORM DEFINES # Create a list of DEFINES for this platform. The list will be converted into @@ -43,12 +48,17 @@ PLATFORM_DEFINES = +# add OF_USING_GTK define IF we have it defined as a system library +ifeq ($(HAS_SYSTEM_GTK),0) + PLATFORM_DEFINES += OF_USING_GTK +endif + +# add OF_USING_MPG123 define IF we have it defined as a system library +ifeq ($(HAS_SYSTEM_MPG123),0) + PLATFORM_DEFINES += OF_USING_MPG123 +endif + # defines used inside openFrameworks libs. -PLATFORM_DEFINES += TARGET_NO_SOUND -PLATFORM_DEFINES += TARGET_NO_GLUT -PLATFORM_DEFINES += TARGET_NO_GLU -PLATFORM_DEFINES += TARGET_NO_X11 -PLATFORM_DEFINES += TARGET_OPENGLES2 PLATFORM_DEFINES += TARGET_RASPBERRY_PI # from raspberry pi examples @@ -126,7 +136,7 @@ PLATFORM_CFLAGS += -pipe ################################################################################ # RELEASE Debugging options (http://gcc.gnu.org/onlinedocs/gcc/Debugging-Options.html) -PLATFORM_OPTIMIZATION_CFLAGS_RELEASE = +PLATFORM_OPTIMIZATION_CFLAGS_RELEASE = -Os # DEBUG Debugging options (http://gcc.gnu.org/onlinedocs/gcc/Debugging-Options.html) PLATFORM_OPTIMIZATION_CFLAGS_DEBUG = -g3 @@ -151,11 +161,11 @@ PLATFORM_CORE_EXCLUSIONS = # core sources PLATFORM_CORE_EXCLUSIONS += $(OF_LIBS_PATH)/openFrameworks/app/ofAppGlutWindow.cpp -PLATFORM_CORE_EXCLUSIONS += $(OF_LIBS_PATH)/openFrameworks/sound/% PLATFORM_CORE_EXCLUSIONS += $(OF_LIBS_PATH)/openFrameworks/video/ofQtUtils.cpp PLATFORM_CORE_EXCLUSIONS += $(OF_LIBS_PATH)/openFrameworks/video/ofQuickTimeGrabber.cpp PLATFORM_CORE_EXCLUSIONS += $(OF_LIBS_PATH)/openFrameworks/video/ofQuickTimePlayer.cpp PLATFORM_CORE_EXCLUSIONS += $(OF_LIBS_PATH)/openFrameworks/video/ofDirectShowGrabber.cpp +PLATFORM_CORE_EXCLUSIONS += $(OF_LIBS_PATH)/openFrameworks/sound/ofFmodSoundPlayer.cpp # third party @@ -173,15 +183,6 @@ PLATFORM_CORE_EXCLUSIONS += $(OF_LIBS_PATH)/glut/% PLATFORM_CORE_EXCLUSIONS += $(OF_LIBS_PATH)/glew/% -# third party static libs (this may not matter due to exclusions in poco's libsorder.make) -PLATFORM_CORE_EXCLUSIONS += $(OF_LIBS_PATH)/poco/lib/$(PLATFORM_LIB_SUBPATH)/libPocoCrypto.a -PLATFORM_CORE_EXCLUSIONS += $(OF_LIBS_PATH)/poco/lib/$(PLATFORM_LIB_SUBPATH)/libPocoData.a -PLATFORM_CORE_EXCLUSIONS += $(OF_LIBS_PATH)/poco/lib/$(PLATFORM_LIB_SUBPATH)/libPocoDataMySQL.a -PLATFORM_CORE_EXCLUSIONS += $(OF_LIBS_PATH)/poco/lib/$(PLATFORM_LIB_SUBPATH)/libPocoDataODBC.a -PLATFORM_CORE_EXCLUSIONS += $(OF_LIBS_PATH)/poco/lib/$(PLATFORM_LIB_SUBPATH)/libPocoDataSQLite.a -PLATFORM_CORE_EXCLUSIONS += $(OF_LIBS_PATH)/poco/lib/$(PLATFORM_LIB_SUBPATH)/libPocoNetSSL.a -PLATFORM_CORE_EXCLUSIONS += $(OF_LIBS_PATH)/poco/lib/$(PLATFORM_LIB_SUBPATH)/libPocoZip.a - ################################################################################ # PLATFORM LIBRARIES # These are library names/paths that are platform specific and are specified @@ -234,6 +235,22 @@ PLATFORM_PKG_CONFIG_LIBRARIES += gstreamer-app-0.10 PLATFORM_PKG_CONFIG_LIBRARIES += gstreamer-0.10 PLATFORM_PKG_CONFIG_LIBRARIES += gstreamer-video-0.10 PLATFORM_PKG_CONFIG_LIBRARIES += gstreamer-base-0.10 +PLATFORM_PKG_CONFIG_LIBRARIES += libudev +PLATFORM_PKG_CONFIG_LIBRARIES += freetype2 +PLATFORM_PKG_CONFIG_LIBRARIES += sndfile +PLATFORM_PKG_CONFIG_LIBRARIES += openal +PLATFORM_PKG_CONFIG_LIBRARIES += portaudio-2.0 +PLATFORM_PKG_CONFIG_LIBRARIES += x11 + +# conditionally add GTK +ifeq ($(HAS_SYSTEM_GTK),0) + PLATFORM_PKG_CONFIG_LIBRARIES += gtk+-2.0 +endif + +# conditionally add mpg123 +ifeq ($(HAS_SYSTEM_MPG123),0) + PLATFORM_PKG_CONFIG_LIBRARIES += libmpg123 +endif ################################################################################ # PLATFORM HEADER SEARCH PATHS diff --git a/libs/openFrameworksCompiled/project/makefileCommon/config.make b/libs/openFrameworksCompiled/project/makefileCommon/config.make new file mode 100644 index 00000000000..e844c259eb5 --- /dev/null +++ b/libs/openFrameworksCompiled/project/makefileCommon/config.make @@ -0,0 +1,276 @@ +#------------------------------------------------------------------------------ +# This file detects the current platform, creates the needed variables for that +# platform, generates the variables for the paths to the code, addons, libraries... +# and the list of source code for the core and common include search paths for the +# core and projects. It's included from both the core makefile and the projects +# makefile + + +# ##################### PLATFORM DETECTION ################################### +# determine the platform's architecture, os and form the platform-specific libarary subpath +# If they haven't already been defined, this file will generate the following +# variables +# +# $(PLATFORM_OS) (e.g. Linux, Darwin, etc.). +# $(PLATFORM_ARCH) (e.g. armv6l, x86_64, i386, etc.). +# $(PLATFORM_LIB_SUBPATH) (e.g. linuxarmv6l, osx, linux64, linux, etc) +################################################################################ +# + +# if not defined, determine this platform's operating system via uname -s +ifndef PLATFORM_OS + # determine from the uname if not defined manually + PLATFORM_OS=$(shell uname -s) +endif + +# if not defined, determine this platform's architecture via uname -m +ifndef PLATFORM_ARCH + # determine from the uname + PLATFORM_ARCH=$(shell uname -m) +endif + +# if not defined, construct the default PLATFORM_LIB_SUBPATH +ifndef PLATFORM_LIB_SUBPATH + # determine from the arch + ifeq ($(PLATFORM_OS),Linux) + ifeq ($(PLATFORM_ARCH),x86_64) + PLATFORM_LIB_SUBPATH=linux64 + else ifeq ($(PLATFORM_ARCH),armv6l) + PLATFORM_LIB_SUBPATH=linuxarmv6l + else ifeq ($(PLATFORM_ARCH),armv7l) + PLATFORM_LIB_SUBPATH=linuxarmv7l + else ifeq ($(PLATFORM_ARCH),i386) + PLATFORM_LIB_SUBPATH=linux + else + $(error This makefile does not support your architecture) + endif + else ifeq ($(PLATFORM_OS),Android) + PLATFORM_LIB_SUBPATH=android + else ifeq ($(PLATFORM_OS),Darwin) + PLATFORM_LIB_SUBPATH=osx + else + $(error This makefile does not support your operating system) + endif +endif + +# TODO: add appropriate list of platform suffixes +# these variables will actually be used during compilation +# http://en.wikipedia.org/wiki/Library_(computing)#File_naming +#ifndef PLATFORM_SHARED_LIB_SUFFIXES +# i.e. if osx check for .dylib AND .so +# if linux, just look for so +#endif +#ifndef PLATFORM_STATIC_LIB_SUFFIXES +#endif + +# if desired, print the variables +ifdef MAKEFILE_DEBUG + $(info =================== config.make platform detection ================) + $(info PLATFORM_ARCH=$(PLATFORM_ARCH)) + $(info PLATFORM_OS=$(PLATFORM_OS)) + $(info PLATFORM_VARIANT=$(PLATFORM_VARIANT)) + $(info PLATFORM_LIB_SUBPATH=$(PLATFORM_LIB_SUBPATH)) +endif + + + + + + + + +# ##################### PATHS ############################################### +# confgure all core paths, excluding platform and project specific paths +# +# $(OF_ADDONS_PATH) +# $(OF_EXPORT_PATH) +# $(OF_EXAMPLES_PATH) +# $(OF_APPS_PATH) +# $(OF_LIBS_PATH) +# +# $(OF_LIBS_OPENFRAMEWORKS_PATH) +# $(OF_LIBS_OF_COMPILED_PATH) +# $(OF_LIBS_OF_COMPILED_PROJECT_PATH) +# $(OF_MAKEFILE_INCLUDES_PATH) +# +# $(OF_ROOT) must be defined previously. +################################################################################ + + +################################################################################ +# create path definitions +ifndef OF_ADDONS_PATH + OF_ADDONS_PATH=$(OF_ROOT)/addons +endif +ifndef OF_EXPORT_PATH + OF_EXPORT_PATH=$(OF_ROOT)/export +endif +ifndef OF_EXAMPLES_PATH + OF_EXAMPLES_PATH=$(OF_ROOT)/examples +endif +ifndef OF_APPS_PATH + OF_APPS_PATH=$(OF_ROOT)/apps +endif +ifndef OF_LIBS_PATH + OF_LIBS_PATH=$(OF_ROOT)/libs +endif + +################################################################################ +ifndef OF_LIBS_OPENFRAMEWORKS_PATH + OF_LIBS_OPENFRAMEWORKS_PATH=$(OF_LIBS_PATH)/openFrameworks +endif +ifndef OF_LIBS_OF_COMPILED_PATH + OF_LIBS_OF_COMPILED_PATH=$(OF_LIBS_OPENFRAMEWORKS_PATH)Compiled +endif +ifndef OF_LIBS_OF_COMPILED_PROJECT_PATH + OF_LIBS_OF_COMPILED_PROJECT_PATH=$(OF_LIBS_OF_COMPILED_PATH)/project +endif +ifndef OF_SHARED_MAKEFILES_PATH + OF_SHARED_MAKEFILES_PATH=$(OF_LIBS_OF_COMPILED_PROJECT_PATH)/makefileCommon +endif + +ifdef OF_LIBS_OF_COMPILED_PROJECT_PATH + OF_PLATFORM_MAKEFILES=$(OF_LIBS_OF_COMPILED_PROJECT_PATH)/$(PLATFORM_LIB_SUBPATH) +else + $(error OF_LIBS_OF_COMPILED_PATH is not defined) +endif + +ifndef OF_CORE_LIB_PATH + OF_CORE_LIB_PATH=$(OF_LIBS_OF_COMPILED_PATH)/lib/$(PLATFORM_LIB_SUBPATH) +endif + +################################################################################ +# print debug information if needed +ifdef MAKEFILE_DEBUG + $(info =================== config.make paths =============================) + $(info OF_ADDONS_PATH=$(OF_ADDONS_PATH)) + $(info OF_EXPORT_PATH=$(OF_EXPORT_PATH)) + $(info OF_EXAMPLES_PATH=$(OF_EXAMPLES_PATH)) + $(info OF_APPS_PATH=$(OF_APPS_PATH)) + $(info OF_LIBS_PATH=$(OF_LIBS_PATH)) + $(info OF_LIBS_OPENFRAMEWORKS_PATH=$(OF_LIBS_OPENFRAMEWORKS_PATH)) + $(info OF_LIBS_OF_COMPILED_PATH=$(OF_LIBS_OF_COMPILED_PATH)) + $(info OF_LIBS_OF_COMPILED_PROJECT_PATH=$(OF_LIBS_OF_COMPILED_PROJECT_PATH)) + $(info OF_SHARED_MAKEFILES_PATH=$(OF_SHARED_MAKEFILES_PATH)) + $(info OF_PLATFORM_MAKEFILES=$(OF_PLATFORM_MAKEFILES)) + $(info OF_CORE_LIB_PATH=$(OF_CORE_LIB_PATH)) +endif + + + +# generate a list of valid core platform variants from the files in the platform makefiles directory +AVAILABLE_PLATFORM_VARIANTS=$(shell find $(OF_PLATFORM_MAKEFILES)/config.*.make -maxdepth 1 -type f | sed -E 's/.*\.([^\.]*)\.make/\1/' ) +AVAILABLE_PLATFORM_VARIANTS+=default + +# check to see if we have a file for the desired variant. if not, quit and list the variants. +ifeq ($(findstring $(PLATFORM_VARIANT),$(AVAILABLE_PLATFORM_VARIANTS)),) + $(error Platform Variant "$(PLATFORM_VARIANT)" is not valid. Valid variants include [$(strip $(AVAILABLE_PLATFORM_VARIANTS))]) +endif + + + + +# include the platform specific user and platform configuration files +include $(OF_PLATFORM_MAKEFILES)/config.$(PLATFORM_LIB_SUBPATH).$(PLATFORM_VARIANT).make + + + + + +################################ FLAGS ######################################### +# define the location of the core path +#TODO: make sure all of the right checks are here. +ifndef PLATFORM_CORE_EXCLUSIONS + $(error PLATFORM_CORE_EXCLUSIONS not defined) +endif + +ifndef OF_LIBS_OPENFRAMEWORKS_PATH + $(error OF_LIBS_OPENFRAMEWORKS_PATH not defined) +endif + +################################################################################ +# CLEAN CORE EXCLUSIONS +################################################################################ + +# take from the platform core exclusions and strip and collapse spaces +CORE_EXCLUSIONS = $(strip $(PLATFORM_CORE_EXCLUSIONS)) + + +################################################################################ +# OF CORE HEADER INCLUDES (-I ...) +################################################################################ + +# find all of the source directories +# grep -v "/\.[^\.]" will exclude all .hidden folders and files +ALL_OF_CORE_SOURCE_PATHS=$(shell find $(OF_LIBS_OPENFRAMEWORKS_PATH) -maxdepth 1 -mindepth 1 -type d | grep -v "/\.[^\.]" ) + +# create a list of core source PATHS, filtering out any items that have a match in the CORE_EXCLUSIONS list +OF_CORE_SOURCE_PATHS=$(filter-out $(CORE_EXCLUSIONS),$(ALL_OF_CORE_SOURCE_PATHS)) + +# create our core include paths from the source directory paths, +# these have already been filtered and processed according to rules. +# plus the root so that we don't miss the ofMain.h. +OF_CORE_HEADER_PATHS = $(OF_LIBS_OPENFRAMEWORKS_PATH) $(OF_CORE_SOURCE_PATHS) + +# add folders or single files to exclude fromt he compiled lib +# grep -v "/\.[^\.]" will exclude all .hidden folders and files +ALL_OF_CORE_THIRDPARTY_HEADER_PATHS = $(shell find $(OF_LIBS_PATH)/*/include -type d | grep -v "/\.[^\.]") + +# filter out all excluded files / folders that were defined above +OF_CORE_THIRDPARTY_HEADER_PATHS = $(filter-out $(CORE_EXCLUSIONS),$(ALL_OF_CORE_THIRDPARTY_HEADER_PATHS)) + +# generate the list of core includes +# 1. Add the header search paths defined by the platform config files. +OF_CORE_INCLUDES_CFLAGS = $(addprefix -I,$(PLATFORM_HEADER_SEARCH_PATHS)) +# 2. Add all of the system library search paths defined by the platform config files. +# Note, 2> /dev/null sends all STDERR message into the /dev/null abyss. +OF_CORE_INCLUDES_CFLAGS += $(shell pkg-config "$(PLATFORM_PKG_CONFIG_LIBRARIES)" --cflags) +# 3. Add all of the standard OF third party library headers (these have already been filtered above according to the platform config files) +OF_CORE_INCLUDES_CFLAGS += $(addprefix -I,$(OF_CORE_THIRDPARTY_HEADER_PATHS)) +# 4. Add all of the core OF headers(these have already been filtered above according to the platform config files) +OF_CORE_INCLUDES_CFLAGS += $(addprefix -I,$(OF_CORE_HEADER_PATHS)) + + +################################################################################ +# OF CORE DEFINES +################################################################################ + +OF_CORE_DEFINES_CFLAGS=$(addprefix -D,$(PLATFORM_DEFINES)) + +################################################################################ +# OF PLATFORM CFLAGS +################################################################################ + +# gather any platform CFLAGS +OF_CORE_BASE_CFLAGS=$(PLATFORM_CFLAGS) + + +################################################################################ +# CORE SOURCE FILES +################################################################################ + +# search the directories in the source folders for all .cpp files +# filter out all excluded files / folders that were defined above +# grep -v "/\.[^\.]" will exclude all .hidden folders and files +OF_CORE_SOURCE_FILES=$(filter-out $(CORE_EXCLUSIONS),$(shell find $(OF_CORE_SOURCE_PATHS) -name "*.cpp" | grep -v "/\.[^\.]")) + + +################################################################################ +# DEBUG INFO +################################################################################ +ifdef MAKEFILE_DEBUG + $(info ========================= config.make flags ========================) + $(info ---OF_CORE_DEFINES_CFLAGS---) + $(foreach v, $(OF_CORE_DEFINES_CFLAGS),$(info $(v))) + + $(info ---OF_CORE_INCLUDES_CFLAGS---) + $(foreach v, $(OF_CORE_INCLUDES_CFLAGS),$(info $(v))) + + $(info ---OF_CORE_FRAMEWORKS_CFLAGS---) + $(foreach v, $(OF_CORE_FRAMEWORKS_CFLAGS),$(info $(v))) + + $(info ---OF_CORE_SOURCE_FILES---) + $(foreach v, $(OF_CORE_SOURCE_FILES),$(info $(v))) +endif + + diff --git a/libs/poco/lib/linuxarmv6l/libPocoFoundation.a b/libs/poco/lib/linuxarmv6l/libPocoFoundation.a index 77ea5ae4a33..ebc86ce221e 100644 Binary files a/libs/poco/lib/linuxarmv6l/libPocoFoundation.a and b/libs/poco/lib/linuxarmv6l/libPocoFoundation.a differ diff --git a/libs/poco/lib/linuxarmv6l/libPocoFoundationd.a b/libs/poco/lib/linuxarmv6l/libPocoFoundationd.a deleted file mode 100644 index c4a1432ffd5..00000000000 Binary files a/libs/poco/lib/linuxarmv6l/libPocoFoundationd.a and /dev/null differ diff --git a/libs/poco/lib/linuxarmv6l/libPocoNet.a b/libs/poco/lib/linuxarmv6l/libPocoNet.a index 968653b3626..9fd8291f2ad 100644 Binary files a/libs/poco/lib/linuxarmv6l/libPocoNet.a and b/libs/poco/lib/linuxarmv6l/libPocoNet.a differ diff --git a/libs/poco/lib/linuxarmv6l/libPocoNetd.a b/libs/poco/lib/linuxarmv6l/libPocoNetd.a deleted file mode 100644 index 65ff6c52899..00000000000 Binary files a/libs/poco/lib/linuxarmv6l/libPocoNetd.a and /dev/null differ diff --git a/libs/poco/lib/linuxarmv6l/libPocoUtil.a b/libs/poco/lib/linuxarmv6l/libPocoUtil.a index 9b9ec5ae9a7..a87bd9fcf37 100644 Binary files a/libs/poco/lib/linuxarmv6l/libPocoUtil.a and b/libs/poco/lib/linuxarmv6l/libPocoUtil.a differ diff --git a/libs/poco/lib/linuxarmv6l/libPocoUtild.a b/libs/poco/lib/linuxarmv6l/libPocoUtild.a deleted file mode 100644 index 7d34f7be7c6..00000000000 Binary files a/libs/poco/lib/linuxarmv6l/libPocoUtild.a and /dev/null differ diff --git a/libs/poco/lib/linuxarmv6l/libPocoXML.a b/libs/poco/lib/linuxarmv6l/libPocoXML.a index ce6236a411e..0f1f306a1b3 100644 Binary files a/libs/poco/lib/linuxarmv6l/libPocoXML.a and b/libs/poco/lib/linuxarmv6l/libPocoXML.a differ diff --git a/libs/poco/lib/linuxarmv6l/libPocoXMLd.a b/libs/poco/lib/linuxarmv6l/libPocoXMLd.a deleted file mode 100644 index 0b159af9398..00000000000 Binary files a/libs/poco/lib/linuxarmv6l/libPocoXMLd.a and /dev/null differ diff --git a/scripts/linux/compileOF.sh b/scripts/linux/compileOF.sh index 9511f72b350..615e09f6140 100755 --- a/scripts/linux/compileOF.sh +++ b/scripts/linux/compileOF.sh @@ -5,27 +5,12 @@ # force all commands to use a traditional C locale export LC_ALL=C -# determine the current architecture -ARCH=$(uname -m) - -# set the LIBSPATH variable based on the ARCH -if [ "$ARCH" = "x86_64" ]; then - LIBSPATH=linux64 -elif [ "$ARCH" = "armv6l" ]; then - LIBSPATH=linuxarmv6l -elif [ "$ARCH" = "armv7l" ]; then - LIBSPATH=linuxarmv7l -else - # default to x86 linux - LIBSPATH=linux -fi - # record our id to set up ownership later WHO=`who am i`;ID=`echo ${WHO%% *}` GROUP_ID=`id --group -n ${ID}` # change into our $LIBSPATH directory -cd ../../libs/openFrameworksCompiled/project/$LIBSPATH +cd ../../libs/openFrameworksCompiled/project # make the DEBUG target based on the makefile in the $LIBSPATH directory make Debug