compile without splash and icons when WITH_HEADLESS is set.
authorCampbell Barton <ideasman42@gmail.com>
Sun, 5 Jun 2011 07:55:18 +0000 (07:55 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Sun, 5 Jun 2011 07:55:18 +0000 (07:55 +0000)
source/blender/editors/datafiles/CMakeLists.txt
source/blender/editors/interface/CMakeLists.txt
source/blender/editors/interface/interface_draw.c
source/blender/editors/interface/interface_icons.c
source/blender/editors/space_file/CMakeLists.txt
source/blender/editors/space_file/filelist.c

index 8761297b979e55817a43b30688add6d5fe62069b..ae86905a91d7ef1d9ec482e5422ea46d27c2320d 100644 (file)
@@ -29,41 +29,48 @@ set(INC_SYS
 
 set(SRC
        Bfont.c
-       add.png.c
        bfont.ttf.c
-       blenderbuttons.c
-       blob.png.c
-       blur.png.c
        bmonofont.ttf.c
-       clay.png.c
-       clone.png.c
-       crease.png.c
-       darken.png.c
-       draw.png.c
-       fill.png.c
-       flatten.png.c
-       grab.png.c
-       inflate.png.c
-       layer.png.c
-       lighten.png.c
-       mix.png.c
-       multiply.png.c
-       nudge.png.c
-       pinch.png.c
-       preview.blend.c
-       prvicons.c
-       scrape.png.c
-       smear.png.c
-       smooth.png.c
-       snake_hook.png.c
-       soften.png.c
-       splash.png.c
        startup.blend.c
-       subtract.png.c
-       texdraw.png.c
-       thumb.png.c
-       twist.png.c
-       vertexdraw.png.c
+       preview.blend.c
 )
 
+if(NOT WITH_HEADLESS)
+       list(APPEND SRC
+               splash.png.c
+               blenderbuttons.c
+
+               # brushes
+               add.png.c
+               blob.png.c
+               blur.png.c
+               clay.png.c
+               clone.png.c
+               crease.png.c
+               darken.png.c
+               draw.png.c
+               fill.png.c
+               flatten.png.c
+               grab.png.c
+               inflate.png.c
+               layer.png.c
+               lighten.png.c
+               mix.png.c
+               multiply.png.c
+               nudge.png.c
+               pinch.png.c
+               prvicons.c
+               scrape.png.c
+               smear.png.c
+               smooth.png.c
+               snake_hook.png.c
+               soften.png.c
+               subtract.png.c
+               texdraw.png.c
+               thumb.png.c
+               twist.png.c
+               vertexdraw.png.c
+       )
+endif()
+
 blender_add_lib(bf_editor_datafiles "${SRC}" "${INC}" "${INC_SYS}")
index 9902cac8857145c5703813cd6a8d55f2cef43cae..6dd7af70e33589fd107bedbc76505e82cda5b1bf 100644 (file)
@@ -63,6 +63,10 @@ if(WITH_INTERNATIONAL)
        add_definitions(-DINTERNATIONAL)
 endif()
 
+if(WITH_HEADLESS)
+       add_definitions(-DWITH_HEADLESS)
+endif()
+
 if(WITH_PYTHON)
        add_definitions(-DWITH_PYTHON)
 endif()
index f9c97c36bdd2bdb5d93f97822d655ec17710ebb9..710d4d58825d6b2b740f592361d3a2689d0eaa61 100644 (file)
@@ -471,6 +471,9 @@ void uiEmboss(float x1, float y1, float x2, float y2, int sel)
 
 void ui_draw_but_IMAGE(ARegion *UNUSED(ar), uiBut *UNUSED(but), uiWidgetColors *UNUSED(wcol), rcti *rect)
 {
+#ifdef WITH_HEADLESS
+       (void)rect;
+#else
        extern char datatoc_splash_png[];
        extern int datatoc_splash_png_size;
        ImBuf *ibuf;
@@ -507,6 +510,7 @@ void ui_draw_but_IMAGE(ARegion *UNUSED(ar), uiBut *UNUSED(but), uiWidgetColors *
        */
        
        IMB_freeImBuf(ibuf);
+#endif
 }
 
 #if 0
index b92097d124b495dfc10336e337f55bc36e60fb5f..3bf2a9ddd02426381643b450a7df2b3e75ac1dd5 100644 (file)
@@ -461,6 +461,7 @@ static void vicon_move_down_draw(int x, int y, int w, int h, float UNUSED(alpha)
        glDisable(GL_LINE_SMOOTH);
 }
 
+#ifndef WITH_HEADLESS
 static void init_brush_icons(void)
 {
 
@@ -588,7 +589,7 @@ static void init_internal_icons(void)
 
        IMB_freeImBuf(bbuf);
 }
-
+#endif // WITH_HEADLESS
 
 static void init_iconfile_list(struct ListBase *list)
 {
@@ -704,6 +705,7 @@ ListBase *UI_iconfile_list(void)
 
 void UI_icons_free(void)
 {
+#ifndef WITH_HEADLESS
        if(icongltex.id) {
                glDeleteTextures(1, &icongltex.id);
                icongltex.id= 0;
@@ -711,6 +713,7 @@ void UI_icons_free(void)
 
        free_iconfile_list(&iconfilelist);
        BKE_icons_free();
+#endif
 }
 
 void UI_icons_free_drawinfo(void *drawinfo)
@@ -792,10 +795,14 @@ int UI_icon_get_height(int icon_id)
 
 void UI_icons_init(int first_dyn_id)
 {
+#ifdef WITH_HEADLESS
+       (void)first_dyn_id;
+#else
        init_iconfile_list(&iconfilelist);
        BKE_icons_init(first_dyn_id);
        init_internal_icons();
        init_brush_icons();
+#endif
 }
 
 /* Render size for preview images and icons
index e161e2d4b9bfd495b726afd9a84da4ccdf3e048d..afa746ea359cfad117b061ff0403d7afbbcdd9a2 100644 (file)
@@ -51,6 +51,10 @@ set(SRC
        fsmenu.h
 )
 
+if(WITH_HEADLESS)
+       add_definitions(-DWITH_HEADLESS)
+endif()
+
 if(WITH_IMAGE_OPENEXR)
        add_definitions(-DWITH_OPENEXR)
 endif()
index 9b65589ef4c94afb21068a788567119d5049d7b4..32b725e0b1f40fc3e67ec6d5498aa801b1f07bc8 100644 (file)
@@ -373,7 +373,11 @@ void filelist_init_icons(void)
        short x, y, k;
        ImBuf *bbuf;
        ImBuf *ibuf;
+#ifdef WITH_HEADLESS
+       bbuf = NULL;
+#else
        bbuf = IMB_ibImageFromMemory((unsigned char*)datatoc_prvicons, datatoc_prvicons_size, IB_rect);
+#endif
        if (bbuf) {
                for (y=0; y<SPECIAL_IMG_ROWS; y++) {
                        for (x=0; x<SPECIAL_IMG_COLS; x++) {