From f07d25d620369f981dbb2fdb8a5500f975258d41 Mon Sep 17 00:00:00 2001 From: Jerome St-Louis Date: Fri, 16 Nov 2012 05:00:01 -0500 Subject: [PATCH] ecere/OS X: Tweaks to get the SDK building for OS X again --- Makefile | 9 +++++++++ crossplatform.mk | 2 ++ default.cf | 6 +++++- deps/Makefile | 2 +- deps/jpeg-6b/Makefile | 2 +- ecere/Makefile | 2 ++ ecere/Makefile.vanilla | 2 ++ ecere/ecere.epj | 3 +++ ecere/locale/ecere.pot | 14 +++++++------- ecere/src/gfx/drivers/CocoaOpenGLDisplayDriver.ec | 21 +++++++++------------ ecere/src/gfx/drivers/OpenGLDisplayDriver.ec | 13 ++++++++++--- ecere/src/gui/GuiApplication.ec | 6 ++++-- ecere/src/gui/drivers/XInterface.ec | 19 ++++++++++++------- ide/src/OldIDESettings.ec | 2 +- ide/src/project/Project.ec | 3 ++- 15 files changed, 70 insertions(+), 36 deletions(-) diff --git a/Makefile b/Makefile index 71487ad..711b716 100644 --- a/Makefile +++ b/Makefile @@ -71,7 +71,12 @@ endif else # WINDOWS_TARGET +ifdef OSX_TARGET +# TODO: OSX soname +SOV := $(SO) +else SOV := $(SO)$(LIBVER) +endif ifndef DESTDIR export DESTDIR= @@ -100,7 +105,11 @@ export PREFIXLIBDIR=$(LIBDIR) else ifeq "$(HOSTTYPE)" "x86_64" +ifdef OSX_HOST +export PREFIXLIBDIR=$(prefix)/lib +else export PREFIXLIBDIR=$(prefix)/lib32 +endif else export PREFIXLIBDIR=$(prefix)/lib endif diff --git a/crossplatform.mk b/crossplatform.mk index 1fcb0fb..308660f 100755 --- a/crossplatform.mk +++ b/crossplatform.mk @@ -158,6 +158,8 @@ endif _CPP = $(if $(findstring $(space),$(CPP)),"$(CPP)",$(CPP)) +_SYSROOT = $(if $(SYSROOT),$(space)--sysroot=$(SYSROOT),) + # SHELL COMMANDS ifdef WINDOWS_HOST ifndef MSYSCON diff --git a/default.cf b/default.cf index cb51e7c..d5bac69 100644 --- a/default.cf +++ b/default.cf @@ -2,7 +2,7 @@ EC_BINS := $(_CF_DIR)$(if $(USE_BOOTSTRAP),compiler/bootstrap/obj/bin.$(HOST_PLA # TOOLCHAIN export CC = $(CCACHE_COMPILE)$(DISTCC_COMPILE)$(GCC_PREFIX)gcc$(_SYSROOT) -export CPP = $(CCACHE_COMPILE)$(DISTCC_COMPILE)$(GCC_PREFIX)cpp$(_SYSROOT) +export CPP = $(CCACHE_COMPILE)$(DISTCC_COMPILE)$(GCC_PREFIX)gcc$(_SYSROOT) export AS = $(GCC_PREFIX)as export LD = $(GCC_PREFIX)ld export AR = $(GCC_PREFIX)ar @@ -36,6 +36,10 @@ CFLAGS += -isystem /usr/local/include LDFLAGS += -L/usr/local/lib endif +ifdef OSX_TARGET +CFLAGS += -I$(SYSROOT)/usr/include/ffi +endif + OFLAGS += $(LDFLAGS) # FLAGS diff --git a/deps/Makefile b/deps/Makefile index 6280b01..4ef6980 100644 --- a/deps/Makefile +++ b/deps/Makefile @@ -10,7 +10,7 @@ ifdef WINDOWS_TARGET all: freetype jpeg png gif ffi z else ifdef OSX_TARGET -all: jpeg png gif +all: jpeg gif else all: gif endif diff --git a/deps/jpeg-6b/Makefile b/deps/jpeg-6b/Makefile index 68c98f8..d4f3911 100755 --- a/deps/jpeg-6b/Makefile +++ b/deps/jpeg-6b/Makefile @@ -154,7 +154,7 @@ RESOURCES = LIBS += $(SHAREDLIB) $(EXECUTABLE) $(LINKOPT) PRJ_CFLAGS += \ - $(if $(DEBUG), -g, -O2 -ffast-math) $(FPIC) -w + $(if $(DEBUG), -g, -O2 -ffast-math) $(FPIC) -w $(FORCE_32_BIT) diff --git a/ecere/Makefile b/ecere/Makefile index 5509604..bf83a89 100755 --- a/ecere/Makefile +++ b/ecere/Makefile @@ -400,6 +400,8 @@ PRJ_CFLAGS += \ -I../deps/libungif-4.1.1/lib,) \ $(if $(OSX_TARGET), \ -I/usr/include/freetype2 \ + -I$(SYSROOT)/usr/X11/include/freetype2 \ + -I$(SYSROOT)/usr/X11/include \ -I/usr/X11R6/include/freetype2 \ -I/usr/X11R6/include \ -I../deps/jpeg-6b \ diff --git a/ecere/Makefile.vanilla b/ecere/Makefile.vanilla index de85ad1..f2faa74 100755 --- a/ecere/Makefile.vanilla +++ b/ecere/Makefile.vanilla @@ -357,6 +357,8 @@ PRJ_CFLAGS += \ -I../deps/libungif-4.1.1/lib,) \ $(if $(OSX_TARGET), \ -I/usr/include/freetype2 \ + -I$(SYSROOT)/usr/X11/include/freetype2 \ + -I$(SYSROOT)/usr/X11/include \ -I/usr/X11R6/include/freetype2 \ -I/usr/X11R6/include \ -I../deps/jpeg-6b \ diff --git a/ecere/ecere.epj b/ecere/ecere.epj index a252292..aeaa0fc 100644 --- a/ecere/ecere.epj +++ b/ecere/ecere.epj @@ -91,6 +91,8 @@ "Options" : { "IncludeDirs" : [ "/usr/include/freetype2", + "$(SYSROOT)/usr/X11/include/freetype2", + "$(SYSROOT)/usr/X11/include", "/usr/X11R6/include/freetype2", "/usr/X11R6/include", "../deps/jpeg-6b", @@ -110,6 +112,7 @@ "GL" ], "LibraryDirs" : [ + "$(SYSROOT)/usr/X11/lib", "/usr/X11R6/lib", "../deps/jpeg-6b/obj/release.$(PLATFORM)", "../deps/libpng-1.4.0/obj/release.$(PLATFORM)", diff --git a/ecere/locale/ecere.pot b/ecere/locale/ecere.pot index d1ec95a..29e058d 100644 --- a/ecere/locale/ecere.pot +++ b/ecere/locale/ecere.pot @@ -286,11 +286,11 @@ msgstr "Document" msgid "Down" msgstr "Down" -#: ./src/gui/GuiApplication.ec:100 +#: ./src/gui/GuiApplication.ec:102 msgid "Driver/Mode switch failed" msgstr "Driver/Mode switch failed" -#: ./src/gui/GuiApplication.ec:196 +#: ./src/gui/GuiApplication.ec:198 msgid "ECERE Application" msgstr "ECERE Application" @@ -302,7 +302,7 @@ msgstr "Edit" msgid "Entire Computer" msgstr "Entire Computer" -#: ./src/gui/GuiApplication.ec:1271 +#: ./src/gui/GuiApplication.ec:1273 msgid "Error falling back to previous video mode.\n" msgstr "Error falling back to previous video mode.\n" @@ -394,7 +394,7 @@ msgstr "Go To Line..." msgid "Go To...\tCtrl+G" msgstr "Go To...\tCtrl+G" -#: ./src/gui/GuiApplication.ec:96 +#: ./src/gui/GuiApplication.ec:98 msgid "Graphics driver not supported by any user interface system" msgstr "Graphics driver not supported by any user interface system" @@ -538,7 +538,7 @@ msgid "No" msgstr "No" #: ./src/sys/System.ec:106 -#: ./src/gui/GuiApplication.ec:95 +#: ./src/gui/GuiApplication.ec:97 msgid "No error" msgstr "No error" @@ -851,11 +851,11 @@ msgstr "Whole word only" msgid "Window Style" msgstr "Window Style" -#: ./src/gui/GuiApplication.ec:97 +#: ./src/gui/GuiApplication.ec:99 msgid "Window creation failed" msgstr "Window creation failed" -#: ./src/gui/GuiApplication.ec:98 +#: ./src/gui/GuiApplication.ec:100 msgid "Window graphics loading failed" msgstr "Window graphics loading failed" diff --git a/ecere/src/gfx/drivers/CocoaOpenGLDisplayDriver.ec b/ecere/src/gfx/drivers/CocoaOpenGLDisplayDriver.ec index d5f3cd0..1cfd707 100644 --- a/ecere/src/gfx/drivers/CocoaOpenGLDisplayDriver.ec +++ b/ecere/src/gfx/drivers/CocoaOpenGLDisplayDriver.ec @@ -27,8 +27,6 @@ import "Window" #define GL_CLAMP_TO_EDGE 0x812F -static bool useSingleGLContext = false; - class DisplayData : struct { ColorAlpha * flippingBuffer; @@ -70,10 +68,12 @@ class IndexData : struct int nIndices; }; +#if !defined(ECERE_NO3D) && !defined(ECERE_VANILLA) static int primitiveTypes[RenderPrimitiveType] = { GL_POINTS, GL_LINES, GL_TRIANGLES, GL_TRIANGLE_STRIP, GL_TRIANGLE_FAN, GL_QUADS, GL_QUAD_STRIP, GL_LINE_STRIP }; +#endif int current; void *previous; @@ -177,7 +177,9 @@ class CocoaOpenGLDisplayDriver : DisplayDriver glDisable(GL_MULTISAMPLE_ARB); CocoaGlAssert(); +#if !defined(ECERE_NO3D) && !defined(ECERE_VANILLA) display.ambient = Color { 50,50,50 }; +#endif printf("CocoaOpenGLDisplayDriver:CreateDisplay %p %s:%i\n", display.window, __FILE__, __LINE__); return result; @@ -1061,6 +1063,7 @@ class CocoaOpenGLDisplayDriver : DisplayDriver printf("glGetError():%i\n", glGetError()); } +#if !defined(ECERE_NO3D) && !defined(ECERE_VANILLA) void SetRenderState(Display display, RenderState state, uint value) { printf("CocoaOpenGLDisplayDriver:SetRenderState STUB! %s:%i\n", __FILE__, __LINE__); @@ -1598,8 +1601,8 @@ class CocoaOpenGLDisplayDriver : DisplayDriver { printf("CocoaOpenGLDisplayDriver: STUB! %s:%i\n", __FILE__, __LINE__); - if(display.display3D.mesh && glUnlockArraysEXT) - glUnlockArraysEXT(); + /*if(display.display3D.mesh && glUnlockArraysEXT) + glUnlockArraysEXT();*/ if(mesh) { @@ -1681,7 +1684,7 @@ class CocoaOpenGLDisplayDriver : DisplayDriver glDisableClientState(GL_COLOR_ARRAY); } - if(glLockArraysEXT) glLockArraysEXT(0, mesh.nVertices); + //if(glLockArraysEXT) glLockArraysEXT(0, mesh.nVertices); } else if(glBindBufferARB) glBindBufferARB(GL_ARRAY_BUFFER_ARB, 0); @@ -1780,11 +1783,5 @@ class CocoaOpenGLDisplayDriver : DisplayDriver glMultMatrixd(matrix.array); } +#endif } - -public void UseSingleGLContext(bool useSingle) -{ - printf("CocoaOpenGLDisplayDriver: STUB! %s:%i\n", __FILE__, __LINE__); - useSingleGLContext = useSingle; -} - diff --git a/ecere/src/gfx/drivers/OpenGLDisplayDriver.ec b/ecere/src/gfx/drivers/OpenGLDisplayDriver.ec index d49f9fd..432e219 100644 --- a/ecere/src/gfx/drivers/OpenGLDisplayDriver.ec +++ b/ecere/src/gfx/drivers/OpenGLDisplayDriver.ec @@ -956,10 +956,12 @@ void glDrawPixels(int a, int b, int c, int d, void * e) { } #endif +#if !defined(__APPLE__) void (APIENTRY * glBindBufferARB) (GLenum target, GLuint buffer); void (APIENTRY * glGenBuffersARB) (GLsizei n, GLuint *buffers); void (APIENTRY * glDeleteBuffersARB) (GLsizei n, const GLuint *buffers); void (APIENTRY * glBufferDataARB) (GLenum target, int size, const GLvoid *data, GLenum usage); +#endif #endif @@ -1071,10 +1073,12 @@ class OGLIndices : struct int nIndices; }; +#if !defined(ECERE_NO3D) && !defined(ECERE_VANILLA) static int primitiveTypes[RenderPrimitiveType] = { GL_POINTS, GL_LINES, GL_TRIANGLES, GL_TRIANGLE_STRIP, GL_TRIANGLE_FAN, GL_QUADS, GL_QUAD_STRIP, GL_LINE_STRIP }; +#endif int current; void * previous; @@ -1541,7 +1545,9 @@ class OpenGLDisplayDriver : DisplayDriver glClearDepth(1.0); glDisable(GL_MULTISAMPLE_ARB); } +#if !defined(ECERE_NO3D) && !defined(ECERE_VANILLA) display.ambient = Color { 50,50,50 }; +#endif if(!useSingleGLContext) #if defined(__WIN32__) @@ -2916,7 +2922,7 @@ class OpenGLDisplayDriver : DisplayDriver #endif } } - +#if !defined(ECERE_NO3D) && !defined(ECERE_VANILLA) void SetRenderState(Display display, RenderState state, uint value) { OGLDisplay oglDisplay = display.driverData; @@ -3486,7 +3492,7 @@ class OpenGLDisplayDriver : DisplayDriver { //Logf("SelectMesh\n"); -#ifndef __ANDROID__ +#if !defined( __ANDROID__) && !defined(__APPLE__) if(display.display3D.mesh && glUnlockArraysEXT) glUnlockArraysEXT(); #endif @@ -3565,7 +3571,7 @@ class OpenGLDisplayDriver : DisplayDriver glDisableClientState(GL_COLOR_ARRAY); } -#ifndef __ANDROID__ +#if !defined(__ANDROID__) && !defined(__APPLE__) if(glLockArraysEXT) glLockArraysEXT(0, mesh.nVertices); #endif } @@ -3663,6 +3669,7 @@ class OpenGLDisplayDriver : DisplayDriver glMultMatrixd(matrix.array); } +#endif } public void UseSingleGLContext(bool useSingle) diff --git a/ecere/src/gui/GuiApplication.ec b/ecere/src/gui/GuiApplication.ec index eef2e69..2ad10c9 100644 --- a/ecere/src/gui/GuiApplication.ec +++ b/ecere/src/gui/GuiApplication.ec @@ -72,7 +72,9 @@ import "network" #if defined(__APPLE__) import "CocoaInterface" -#elif defined(__unix__) && !defined(__ANDROID__) +#endif + +#if defined(__unix__) && !defined(__ANDROID__) import "XInterface" #endif @@ -585,7 +587,7 @@ public class GuiApplication : Application if (driver) { defaultDriver = driver; } else { - defaultDriver = "CocoaOpenGL"; + defaultDriver = "X"; //"CocoaOpenGL"; } } #elif defined(__ANDROID__) diff --git a/ecere/src/gui/drivers/XInterface.ec b/ecere/src/gui/drivers/XInterface.ec index 1d81771..af70719 100644 --- a/ecere/src/gui/drivers/XInterface.ec +++ b/ecere/src/gui/drivers/XInterface.ec @@ -317,7 +317,7 @@ static void RepositionDesktop(bool updateChildren) } // printf("Work Area width: %d, height %d\n", w, h); } - + if(desktopX != x || desktopY != y || desktopW != w || desktopH != h) { guiApp.SetDesktopPosition(x, y, w, h, updateChildren); @@ -1685,15 +1685,15 @@ class XInterface : Interface if(maxVert && maxHorz) { if(window.state != maximized) - window.state = maximized; + *&window.state = maximized; } else if(isMinimized) { if(window.state != minimized) - window.state = minimized; + *&window.state = minimized; } else if(window.state != normal) - window.state = normal; + *&window.state = normal; } } { @@ -1844,9 +1844,10 @@ class XInterface : Interface } case PropertyNotify: { + XWindowData windowData = window.windowData; XPropertyEvent * event = (XPropertyEvent *) thisEvent; if(event->atom == atoms[_net_frame_extents] && - event->state == PropertyNewValue && window.windowData) + event->state == PropertyNewValue && windowData) { int format, len, fill; Atom type; @@ -1858,7 +1859,6 @@ class XInterface : Interface &fill, &data) == Success && data) { int *extents = (int *)data; - XWindowData windowData = window.windowData; bool hadFrameExtents = windowData.gotFrameExtents; windowData.decor = { @@ -1882,6 +1882,8 @@ class XInterface : Interface XFree(data); } + else + windowData.gotFrameExtents = true; // Unsupported? } break; } @@ -2126,7 +2128,7 @@ class XInterface : Interface } { -#if defined(__APPLE__) +#if 0 //defined(__APPLE__) Atom hints[2] = { parentWindow ? atoms[_net_wm_window_type_popup_menu] : atoms[_net_wm_window_type_normal] @@ -2329,7 +2331,10 @@ class XInterface : Interface if(window.nativeDecorations) { XWindowData windowData = window.windowData; +#if !defined(__APPLE__) + // TODO: How to handle frame extents not supported? if(!windowData.gotFrameExtents || window.state == maximized) return; +#endif w -= window.size.w - window.clientSize.w; h -= window.size.h - window.clientSize.h; } diff --git a/ide/src/OldIDESettings.ec b/ide/src/OldIDESettings.ec index 2371ae1..cb362a2 100644 --- a/ide/src/OldIDESettings.ec +++ b/ide/src/OldIDESettings.ec @@ -24,7 +24,7 @@ define ecpDefaultCommand = "ecp"; define eccDefaultCommand = "ecc"; define ecsDefaultCommand = "ecs"; define earDefaultCommand = "ear"; -define cppDefaultCommand = "gcc"; // As per #624 we decided to default to "gcc"... "cpp"; +define cppDefaultCommand = "gcc"; // As per #624 we decided to default to "gcc"... define ccDefaultCommand = "gcc"; define cxxDefaultCommand = "g++"; diff --git a/ide/src/project/Project.ec b/ide/src/project/Project.ec index 067912a..b0083f1 100755 --- a/ide/src/project/Project.ec +++ b/ide/src/project/Project.ec @@ -2039,7 +2039,8 @@ private: if(compiler.sysroot && compiler.sysroot[0]) { f.Printf("SYSROOT := %s\n", compiler.sysroot); - f.Puts("_SYSROOT := $(space)--sysroot=$(SYSROOT)\n"); + // Moved this to crossplatform.mk + //f.Puts("_SYSROOT := $(space)--sysroot=$(SYSROOT)\n"); f.Puts("\n"); } -- 1.8.3.1