Commits

Leonard Ritter  committed 96060b8 Draft Merge

merge

  • Participants
  • Parent commits 465fb4d, 7e74a8c

Comments (0)

Files changed (6)

File blender/build_darwin

+echo building project...
+python scons/scons.py -j1

File blender/intern/ghost/SConscript

 
 window_system = env['OURPLATFORM']
 
-sources = env.Glob('intern/*.cpp')
-if window_system == 'darwin':
-    sources += env.Glob('intern/*.mm')
+def intern(filelist):
+    return ['intern/' + filename for filename in filelist]
 
+common_sources = intern([
+ 'GHOST_Buttons.cpp',
+ 'GHOST_C-api.cpp',
+ 'GHOST_CallbackEventConsumer.cpp',
+ 'GHOST_DisplayManager.cpp',
+ 'GHOST_EventManager.cpp',
+ 'GHOST_ISystem.cpp',
+ 'GHOST_ISystemPaths.cpp',
+ 'GHOST_ModifierKeys.cpp',
+ 'GHOST_Path-api.cpp',
+ 'GHOST_Rect.cpp',
+ 'GHOST_System.cpp',
+ 'GHOST_TimerManager.cpp',
+ 'GHOST_Window.cpp',
+ 'GHOST_WindowManager.cpp',
+])
 
-pf = ['GHOST_DisplayManager', 'GHOST_System', 'GHOST_SystemPaths', 'GHOST_Window', 'GHOST_DropTarget', 'GHOST_NDOFManager']
+ndof_sources = intern([
+ 'GHOST_NDOFManager.cpp',
+])
+
+debug_sources = intern([
+ 'GHOST_EventPrinter.cpp',
+])
+
+x11_sources = intern([
+ 'GHOST_DisplayManagerX11.cpp',
+ 'GHOST_SystemX11.cpp',
+ 'GHOST_WindowX11.cpp'
+])
+
+x11_base_sources = intern([
+ 'GHOST_SystemPathsX11.cpp',
+])
+
+x11_ndof_sources = intern([
+ 'GHOST_NDOFManagerX11.cpp',
+])
+
+x11_dnd_sources = intern([
+ 'GHOST_DropTargetX11.cpp',
+])
+
+sdl_sources = intern([
+ 'GHOST_DisplayManagerSDL.cpp',
+ 'GHOST_SystemSDL.cpp',
+ 'GHOST_WindowSDL.cpp',
+])
+
+win32_sources = intern([
+ 'GHOST_DisplayManagerWin32.cpp',
+ 'GHOST_SystemWin32.cpp',
+ 'GHOST_WindowWin32.cpp',
+])
+
+win32_base_sources = intern([
+ 'GHOST_DropTargetWin32.cpp',
+ 'GHOST_SystemPathsWin32.cpp',
+])
+
+win32_ndof_sources = intern([
+ 'GHOST_NDOFManagerWin32.cpp',
+])
+
+cocoa_sources = intern([
+ 'GHOST_DisplayManagerCocoa.mm',
+ 'GHOST_SystemCocoa.mm',
+ 'GHOST_WindowCocoa.mm'
+])
+
+cocoa_base_sources = intern([
+ 'GHOST_SystemPathsCocoa.mm',
+])
+
+cocoa_ndof_sources = intern([
+ 'GHOST_NDOFManagerCocoa.mm',
+])
+
+
 defs=['_USE_MATH_DEFINES']
 
 incs = '. ../string #extern/glew/include #source/blender/imbuf #source/blender/makesdna ' + env['BF_OPENGL_INC']
 
+sources = common_sources
+
+HAS_X11 =  window_system in ('linux', 'openbsd3', 'sunos5', 'freebsd7', 'freebsd8', 'freebsd9', 'aix4', 'aix5')
+HAS_WIN32 = window_system in ('win32-vc', 'win32-mingw', 'cygwin', 'linuxcross', 'win64-vc', 'win64-mingw') 
+HAS_DARWIN = window_system == 'darwin' 
+
+if HAS_X11:
+    sources += x11_base_sources
+elif HAS_WIN32:
+    sources += win32_base_sources
+elif HAS_DARWIN:
+    sources += cocoa_base_sources
+
 if env['WITH_GHOST_SDL']:
-    for f in pf:
-        try:
-            sources.remove('intern' + os.sep + f + 'Carbon.cpp')
-            sources.remove('intern' + os.sep + f + 'Win32.cpp')
-            sources.remove('intern' + os.sep + f + 'X11.cpp')
-        except ValueError:
-            pass
+    sources += sdl_sources
     incs += ' ' + env['BF_SDL_INC']
     defs += ['WITH_GHOST_SDL']
-elif window_system in ('linux', 'openbsd3', 'sunos5', 'freebsd7', 'freebsd8', 'freebsd9', 'aix4', 'aix5'):
-    for f in pf:
-        try:
-            sources.remove('intern' + os.sep + f + 'Win32.cpp')
-            sources.remove('intern' + os.sep + f + 'Carbon.cpp')
-            sources.remove('intern' + os.sep + f + 'SDL.cpp')
-        except ValueError:
-            pass
+elif HAS_X11:
+    sources += x11_sources
     ## removing because scons does not support system installation
     ## if this is used for blender.org builds it means our distrobution
     ## will find any locally installed blender and double up its script path.
     if env['WITH_GHOST_XDND'] and window_system not in ('freebsd7', 'freebsd8', 'freebsd9'):
         incs += ' #/extern/xdnd'
         defs += ['WITH_XDND']
-    else:
-        sources.remove('intern' + os.sep + 'GHOST_DropTargetX11.cpp')
+        sources += x11_dnd_sources
 
-elif window_system in ('win32-vc', 'win32-mingw', 'cygwin', 'linuxcross', 'win64-vc', 'win64-mingw'):
-    for f in pf:
-        try:
-            sources.remove('intern' + os.sep + f + 'X11.cpp')
-            sources.remove('intern' + os.sep + f + 'Carbon.cpp')
-            sources.remove('intern' + os.sep + f + 'SDL.cpp')
-        except ValueError:
-            pass
-elif window_system == 'darwin':
-    if env['WITH_GHOST_COCOA']:
-        if env['WITH_BF_QUICKTIME']:
-            defs.append('WITH_QUICKTIME')
-        if env['USE_QTKIT']:
-            defs.append('USE_QTKIT')
-        for f in pf:
-            try:
-                sources.remove('intern' + os.sep + f + 'Win32.cpp')
-                sources.remove('intern' + os.sep + f + 'X11.cpp')
-                sources.remove('intern' + os.sep + f + 'Carbon.cpp')
-                sources.remove('intern' + os.sep + f + 'SDL.cpp')
-            except ValueError:
-                pass
-    else:
-        for f in pf:
-            try:
-                sources.remove('intern' + os.sep + f + 'Win32.cpp')
-                sources.remove('intern' + os.sep + f + 'X11.cpp')
-                sources.remove('intern' + os.sep + f + 'Cocoa.mm')
-                sources.remove('intern' + os.sep + f + 'SDL.cpp')
-            except ValueError:
-                pass
-
+elif HAS_WIN32:
+    sources += win32_sources
+elif HAS_DARWIN:
+    if env['WITH_BF_QUICKTIME']:
+        defs.append('WITH_QUICKTIME')
+    if env['USE_QTKIT']:
+        defs.append('USE_QTKIT')
+    sources += cocoa_sources
 else:
     print "Unknown window system specified."
     Exit()
 
 if env['BF_GHOST_DEBUG']:
     defs.append('WITH_GHOST_DEBUG')
-else:
-    sources.remove('intern' + os.sep + 'GHOST_EventPrinter.cpp')
+    sources += debug_sources
 
 if env['WITH_BF_3DMOUSE']:
     defs.append('WITH_INPUT_NDOF')
 
     if env['OURPLATFORM']=='linux':
         incs += ' ' + env['BF_3DMOUSE_INC']
-else:
-    sources.remove('intern' + os.sep + 'GHOST_NDOFManager.cpp')
-    try:
-        if window_system in ('win32-vc', 'win32-mingw', 'cygwin', 'linuxcross', 'win64-vc', 'win64-mingw'):
-            sources.remove('intern' + os.sep + 'GHOST_NDOFManagerWin32.cpp')
-        elif window_system=='darwin':
-            sources.remove('intern' + os.sep + 'GHOST_NDOFManagerCocoa.mm')
-        else:
-            sources.remove('intern' + os.sep + 'GHOST_NDOFManagerX11.cpp')
-    except ValueError:
+    sources += ndof_sources
+    
+    if env['WITH_GHOST_SDL']:
         pass
+    elif HAS_WIN32:
+        sources += win32_ndof_sources
+    elif HAS_DARWIN:
+        sources += cocoa_ndof_sources
+    else:
+        sources += x11_ndof_sources
 
-
-if window_system in ('win32-vc', 'win32-mingw', 'cygwin', 'linuxcross', 'win64-vc', 'win64-mingw'):
+if HAS_WIN32:
     incs = env['BF_WINTAB_INC'] + ' ' + incs
     incs += ' ../utfconv'
 
 if window_system in ('win32-vc', 'win64-vc'):
     env.BlenderLib ('bf_intern_ghost', sources, Split(incs), defines=defs, libtype=['intern','player'], priority = [40,15]) #, cc_compileflags=env['CCFLAGS'].append('/WX') )
 
-elif env['WITH_GHOST_COCOA']:	 # always use default-Apple-gcc for objC language, for gnu-compilers do not support it fully yet
+elif HAS_DARWIN:	 # always use default-Apple-gcc for objC language, for gnu-compilers do not support it fully yet
     env.BlenderLib ('bf_intern_ghost', sources, Split(incs), defines=defs, libtype=['intern','player'], priority = [40,15], cc_compilerchange='/usr/bin/gcc', cxx_compilerchange='/usr/bin/g++' )
     print "GHOST COCOA WILL BE COMPILED WITH APPLE GCC"
 

File blender/intern/ghost/intern/GHOST_ISystemPaths.cpp

 #  include "GHOST_SystemPathsWin32.h"
 #else
 #  ifdef __APPLE__
-#    ifdef GHOST_COCOA
+#    if defined(GHOST_COCOA) || defined(WITH_GHOST_SDL)
 #      include "GHOST_SystemPathsCocoa.h"
 #    else
 #      include "GHOST_SystemPathsCarbon.h"
 		m_systemPaths = new GHOST_SystemPathsWin32();
 #else
 #  ifdef __APPLE__
-#    ifdef GHOST_COCOA
+#    if defined(GHOST_COCOA) || defined(WITH_GHOST_SDL)
 		m_systemPaths = new GHOST_SystemPathsCocoa();
 #    else
 		m_systemPaths = new GHOST_SystemPathsCarbon();

File blender/intern/ghost/intern/GHOST_SystemCocoa.mm

 
 #pragma mark Utility functions
 
-#define FIRSTFILEBUFLG 512
-static bool g_hasFirstFile = false;
-static char g_firstFileBuf[512];
-
-//TODO:Need to investigate this. Function called too early in creator.c to have g_hasFirstFile == true
-extern "C" int GHOST_HACK_getFirstFile(char buf[FIRSTFILEBUFLG])
-{
-	if (g_hasFirstFile) {
-		strncpy(buf, g_firstFileBuf, FIRSTFILEBUFLG - 1);
-		buf[FIRSTFILEBUFLG - 1] = '\0';
-		return 1;
-	} else {
-		return 0; 
-	}
-}
-
 #if defined(WITH_QUICKTIME) && !defined(USE_QTKIT)
 //Need to place this quicktime function in an ObjC file
 //It is used to avoid memory leak when raising the quicktime "compression settings" standard dialog

File blender/intern/ghost/intern/GHOST_SystemPathsCocoa.mm

 
 #include "GHOST_SystemPathsCocoa.h"
 
+#define FIRSTFILEBUFLG 512
+static bool g_hasFirstFile = false;
+static char g_firstFileBuf[512];
+
+//TODO:Need to investigate this. Function called too early in creator.c to have g_hasFirstFile == true
+extern "C" int GHOST_HACK_getFirstFile(char buf[FIRSTFILEBUFLG])
+{
+    if (g_hasFirstFile) {
+        strncpy(buf, g_firstFileBuf, FIRSTFILEBUFLG - 1);
+        buf[FIRSTFILEBUFLG - 1] = '\0';
+        return 1;
+    } else {
+        return 0; 
+    }
+}
 
 #pragma mark initialization/finalization
 

File blender/source/blender/windowmanager/intern/wm_window.c

 	
 	wm_get_screensize(&width, &height);
 	
-#if defined(__APPLE__) && !defined(GHOST_COCOA)
+#if 0//defined(__APPLE__) && !defined(GHOST_COCOA)
 	height -= 70;
 #endif
 	
 		 * in case of OS application terminate request (e.g. OS Shortcut Alt+F4, Cmd+Q, (...), or session end) */
 		GHOST_SetWindowModifiedState(win->ghostwin, (GHOST_TUns8) !wm->file_saved);
 		
-#if defined(__APPLE__) && !defined(GHOST_COCOA)
+#if 0//defined(__APPLE__) && !defined(GHOST_COCOA)
 		if (wm->file_saved)
 			GHOST_SetWindowState(win->ghostwin, GHOST_kWindowStateUnModified);
 		else
 	wm_get_screensize(&scr_w, &scr_h);
 	posy = (scr_h - win->posy - win->sizey);
 	
-#if defined(__APPLE__) && !defined(GHOST_COCOA)
+#if 0//defined(__APPLE__) && !defined(GHOST_COCOA)
 	{
 		extern int macPrefState; /* creator.c */
 		initial_state += macPrefState;
 	if (wm_init_state.size_x == 0) {
 		wm_get_screensize(&wm_init_state.size_x, &wm_init_state.size_y);
 		
-#if defined(__APPLE__) && !defined(GHOST_COCOA)
+#if 0//defined(__APPLE__) && !defined(GHOST_COCOA)
 		/* Cocoa provides functions to get correct max window size */
 		{
 			extern void wm_set_apple_prefsize(int, int);    /* wm_apple.c */