cmake changes
authorCampbell Barton <ideasman42@gmail.com>
Fri, 14 Aug 2009 17:16:16 +0000 (17:16 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Fri, 14 Aug 2009 17:16:16 +0000 (17:16 +0000)
- set python to 3.1 on linux (dont use FindPackage for now)
- remove duplicate settings (disable cache for copied settings, was quite confusing)
- added an option WITH_INSTALL, when disabled scripts and language files wont be copied to the target dir (better for quick builds)
- remove .svn (was still CVS), and pyc/pyc files after copy
- copy the 'io' as well as 'ui'

CMake/macros.cmake
CMakeLists.txt
source/blender/blenfont/CMakeLists.txt
source/blender/python/generic/BGL.h
source/creator/CMakeLists.txt

index 3f706e5..ff57cf6 100644 (file)
@@ -42,11 +42,15 @@ MACRO(SETUP_LIBDIRS)
   if(COMMAND cmake_policy)
     CMAKE_POLICY(SET CMP0003 NEW)
   endif(COMMAND cmake_policy)
-  LINK_DIRECTORIES(${PYTHON_LIBPATH} ${SDL_LIBPATH} ${JPEG_LIBPATH} ${PNG_LIBPATH} ${ZLIB_LIBPATH} ${ICONV_LIBPATH} ${OPENEXR_LIBPATH} ${QUICKTIME_LIBPATH} ${FFMPEG_LIBPATH})
+  LINK_DIRECTORIES(${PYTHON_LIBPATH} ${JPEG_LIBPATH} ${PNG_LIBPATH} ${ZLIB_LIBPATH} ${OPENEXR_LIBPATH} ${QUICKTIME_LIBPATH} ${FFMPEG_LIBPATH})
   LINK_DIRECTORIES(${FREETYPE_LIBPATH} ${LIBSAMPLERATE_LIBPATH})
   IF(WITH_INTERNATIONAL)
+    LINK_DIRECTORIES(${ICONV_LIBPATH})
     LINK_DIRECTORIES(${GETTEXT_LIBPATH})
   ENDIF(WITH_INTERNATIONAL)
+  IF(WITH_SDL)
+    LINK_DIRECTORIES(${SDL_LIBPATH})
+  ENDIF(WITH_SDL)
   IF(WITH_OPENAL)
     LINK_DIRECTORIES(${OPENAL_LIBPATH})
   ENDIF(WITH_OPENAL)
index bb2d336..9e552be 100644 (file)
@@ -69,6 +69,7 @@ OPTION(WITH_OPENAL            "Enable OpenAL Support (http://www.openal.org)"         ON)
 OPTION(WITH_OPENMP             "Enable OpenMP (has to be supported by the compiler)"   OFF)
 OPTION(WITH_WEBPLUGIN          "Enable Web Plugin (Unix only)"                         OFF)
 OPTION(WITH_FFTW3              "Enable FFTW3 support"                          OFF)
+OPTION(WITH_INSTALL "Install accompanying scripts and language files needed to run blender" ON)
 
 IF(NOT WITH_GAMEENGINE AND WITH_PLAYER)
   MESSAGE("WARNING: WITH_PLAYER needs WITH_GAMEENGINE")
@@ -96,6 +97,8 @@ IF(UNIX AND NOT APPLE)
       SET(WITH_OPENAL ON)
       SET(OPENAL_LIB ${OPENAL_LIBRARY})
       SET(OPENAL_INC ${OPENAL_INCLUDE_DIR})
+      UNSET(OPENAL_LIBRARY CACHE)
+      UNSET(OPENAL_INCLUDE_DIR CACHE)
     ELSE(OPENAL_FOUND)
       SET(WITH_OPENAL OFF)
     ENDIF(OPENAL_FOUND)
@@ -111,6 +114,7 @@ IF(UNIX AND NOT APPLE)
     PATHS
     /sw/lib
   )
+  
   IF(INTL_LIBRARY AND ICONV_LIBRARY)
     SET(GETTEXT_LIB ${INTL_LIBRARY} ${ICONV_LIBRARY})
   ENDIF(INTL_LIBRARY AND ICONV_LIBRARY)
@@ -118,18 +122,35 @@ IF(UNIX AND NOT APPLE)
   FIND_PACKAGE(Freetype)
   SET(FREETYPE_INC "${FREETYPE_INCLUDE_DIR_freetype2}" CACHE STRING "")
   SET(FREETYPE_LIB "${FREETYPE_LIBRARY}" CACHE STRING "")
+  UNSET(FREETYPE_INCLUDE_DIR_freetype2 CACHE)
+  UNSET(FREETYPE_LIBRARY CACHE)
+  UNSET(FREETYPE_INCLUDE_DIR_ft2build CACHE)
 
-  FIND_PACKAGE(PythonLibs)
-  SET(PYTHON_INC "${PYTHON_INCLUDE_PATH}" CACHE STRING "")
-  SET(PYTHON_LIB "${PYTHON_LIBRARIES}" CACHE STRING "")
-  FIND_PACKAGE(PythonInterp)
-  SET(PYTHON_BINARY ${PYTHON_EXECUTABLE} CACHE STRING "")
+  # No way to set py31. remove for now.
+  # FIND_PACKAGE(PythonLibs)
+  SET(PYTHON /usr)
+  SET(PYTHON_VERSION 3.1)
+  SET(PYTHON_INC "${PYTHON}/include/python${PYTHON_VERSION}" CACHE STRING "")
+  # SET(PYTHON_BINARY python) # not used yet
+  SET(PYTHON_LIB python${PYTHON_VERSION} CACHE STRING "")
+  SET(PYTHON_LIBPATH ${PYTHON}/lib CACHE STRING "")
+  
+  # FIND_PACKAGE(PythonInterp) # not used yet
+  # SET(PYTHON_BINARY ${PYTHON_EXECUTABLE} CACHE STRING "")
+  
   SET(PYTHON_LINKFLAGS "-Xlinker -export-dynamic")
 
   IF(WITH_SDL)
     FIND_PACKAGE(SDL)
-    SET(SDL_INC ${SDL_INCLUDE_DIR})
-    SET(SDL_LIB ${SDL_LIBRARY})
+    IF(SDL_FOUND)
+      SET(SDL_INC ${SDL_INCLUDE_DIR})
+      SET(SDL_LIB ${SDL_LIBRARY})
+      UNSET(SDL_INCLUDE_DIR CACHE)
+      UNSET(SDL_LIBRARY CACHE)
+      UNSET(SDLMAIN_LIBRARY CACHE)
+    ELSE(SDL_FOUND)
+      SET(WITH_SDL OFF)
+    ENDIF(SDL_FOUND)
   ENDIF(WITH_SDL)
 
   FIND_PATH(OPENEXR_INC
@@ -208,22 +229,22 @@ IF(WIN32)
   SET(PYTHON ${LIBDIR}/python)
   SET(PYTHON_VERSION 3.1)
   SET(PYTHON_INC "${PYTHON}/include/python${PYTHON_VERSION}")
-  SET(PYTHON_BINARY python)
+  # SET(PYTHON_BINARY python) # not used yet
   SET(PYTHON_LIB python31)
   SET(PYTHON_LIBPATH ${PYTHON}/lib)
 
   IF(CMAKE_CL_64)
     SET(WITH_OPENAL OFF)
   ELSE(CMAKE_CL_64)
-       #SET(WITH_OPENAL ON)
-       SET(OPENAL ${LIBDIR}/openal)
-       SET(OPENAL_INC ${OPENAL}/include)
-       SET(OPENAL_LIB wrap_oal)
-       SET(OPENAL_LIBPATH ${OPENAL}/lib)
+    #SET(WITH_OPENAL ON)
+    SET(OPENAL ${LIBDIR}/openal)
+    SET(OPENAL_INC ${OPENAL}/include)
+    SET(OPENAL_LIB wrap_oal)
+    SET(OPENAL_LIBPATH ${OPENAL}/lib)
   ENDIF(CMAKE_CL_64)
 
   IF(CMAKE_CL_64)
-       SET(PNG_LIBRARIES libpng)
+    SET(PNG_LIBRARIES libpng)
   ELSE(CMAKE_CL_64)
     SET(PNG_LIBRARIES libpng_st)
   ENDIF(CMAKE_CL_64)
@@ -245,18 +266,18 @@ IF(WIN32)
   SET(ICONV_LIBPATH ${ICONV}/lib)
   
   IF(WITH_FFTW3)
-         SET(FFTW3 ${LIBDIR}/fftw3)
-         SET(FFTW3_INC ${FFTW3}/include)
-         SET(FFTW3_LIB libfftw)
-         SET(FFTW3_LIBPATH ${FFTW3}/lib)
+      SET(FFTW3 ${LIBDIR}/fftw3)
+      SET(FFTW3_INC ${FFTW3}/include)
+      SET(FFTW3_LIB libfftw)
+      SET(FFTW3_LIBPATH ${FFTW3}/lib)
   ENDIF(WITH_FFTW3)
   
   SET(GETTEXT ${LIBDIR}/gettext)
   SET(GETTEXT_INC ${GETTEXT}/include)
   IF(CMAKE_CL_64)
-       SET(GETTEXT_LIB gettextlib)
+    SET(GETTEXT_LIB gettextlib)
   ELSE(CMAKE_CL_64)
-       SET(GETTEXT_LIB gnu_gettext)
+    SET(GETTEXT_LIB gnu_gettext)
   ENDIF(CMAKE_CL_64)
   SET(GETTEXT_LIBPATH ${GETTEXT}/lib)
 
@@ -352,6 +373,8 @@ IF(APPLE)
       SET(WITH_OPENAL ON)
       SET(OPENAL_LIB ${OPENAL_LIBRARY})
       SET(OPENAL_INC ${OPENAL_INCLUDE_DIR})
+      UNSET(OPENAL_LIBRARY CACHE)
+      UNSET(OPENAL_INCLUDE_DIR CACHE)
     ELSE(OPENAL_FOUND)
       SET(WITH_OPENAL OFF)
     ENDIF(OPENAL_FOUND)
@@ -365,7 +388,7 @@ IF(APPLE)
 
     SET(PYTHON ${LIBDIR}/python)
     SET(PYTHON_INC "${PYTHON}/include/python${PYTHON_VERSION}" CACHE STRING "")
-    SET(PYTHON_BINARY "${PYTHON}/bin/python${PYTHON_VERSION}" CACHE STRING "")
+    # SET(PYTHON_BINARY "${PYTHON}/bin/python${PYTHON_VERSION}" CACHE STRING "") # not used yet
     SET(PYTHON_LIB python${PYTHON_VERSION})
     SET(PYTHON_LIBPATH "${PYTHON}/lib/python${PYTHON_VERSION}" CACHE STRING "")
     #    SET(PYTHON_LINKFLAGS "-u _PyMac_Error")  # won't  build with this enabled
@@ -375,7 +398,7 @@ IF(APPLE)
     SET(PYTHON /System/Library/Frameworks/Python.framework/Versions/)
     SET(PYTHON_VERSION 2.5)
     SET(PYTHON_INC "${PYTHON}${PYTHON_VERSION}/include/python${PYTHON_VERSION}" CACHE STRING "")
-    SET(PYTHON_BINARY ${PYTHON}${PYTHON_VERSION}/bin/python${PYTHON_VERSION} CACHE STRING "")
+    # SET(PYTHON_BINARY ${PYTHON}${PYTHON_VERSION}/bin/python${PYTHON_VERSION} CACHE STRING "") # not used yet
     SET(PYTHON_LIB "")
     SET(PYTHON_LIBPATH ${PYTHON}${PYTHON_VERSION}/lib/python${PYTHON_VERSION}/config CACHE STRING "")
     SET(PYTHON_LINKFLAGS "-u _PyMac_Error -framework System -framework Python")
@@ -388,9 +411,9 @@ IF(APPLE)
   
   IF(WITH_FFTW3)
     SET(FFTW3 ${LIBDIR}/fftw3)
-       SET(FFTW3_INC ${FFTW3}/include)
-       SET(FFTW3_LIB libfftw)
-       SET(FFTW3_LIBPATH ${FFTW3}/lib)
+    SET(FFTW3_INC ${FFTW3}/include)
+    SET(FFTW3_LIB libfftw)
+    SET(FFTW3_LIBPATH ${FFTW3}/lib)
   ENDIF(WITH_FFTW3)
 
   SET(PNG_LIBRARIES png)
@@ -477,6 +500,9 @@ ENDIF(WITH_WEBPLUGIN)
 # Configure OpenGL.
 FIND_PACKAGE(OpenGL)
 INCLUDE_DIRECTORIES(${OPENGL_INCLUDE_DIR})
+UNSET(OPENGL_LIBRARIES CACHE)
+UNSET(OPENGL_xmesa_INCLUDE_DIR CACHE)
+
 #-----------------------------------------------------------------------------
 # Extra compile flags
 IF(WITH_GAMEENGINE)
index aef655c..4784ce8 100644 (file)
@@ -29,9 +29,12 @@ SET(INC
   ../blenkernel ../../../extern/glew/include .
   ${FTGL_INC}
   ${FREETYPE_INC}
-  ${GETTEXT_INC}
 )
 
+IF(WITH_INTERNATIONAL)
+  SET(INC ${INC} ${GETTEXT_INC})
+ENDIF(WITH_INTERNATIONAL)
+
 IF(WIN32)
   ADD_DEFINITIONS(-D_WIN32 -DUSE_GETTEXT_DLL)
 ENDIF(WIN32)
index a8c37bf..91f8854 100644 (file)
@@ -304,31 +304,30 @@ typedef struct _Buffer {
 
 #define ret_def_void
 #define ret_set_void
-/* would use Py_RETURN_NONE - except for py 2.3 doesnt have it */
-#define ret_ret_void    { Py_INCREF(Py_None); return Py_None; }
+#define ret_ret_void    return Py_INCREF(Py_None), Py_None
 
 #define ret_def_GLint   int ret_int
 #define ret_set_GLint   ret_int=
-#define ret_ret_GLint   return PyLong_FromLong(ret_int);
+#define ret_ret_GLint   return PyLong_FromLong(ret_int)
 
 #define ret_def_GLuint    unsigned int ret_uint
 #define ret_set_GLuint    ret_uint=
-#define ret_ret_GLuint    return PyLong_FromLong((long) ret_uint);
+#define ret_ret_GLuint    return PyLong_FromLong((long) ret_uint)
 
 #define ret_def_GLenum    unsigned int ret_uint
 #define ret_set_GLenum    ret_uint=
-#define ret_ret_GLenum    return PyLong_FromLong((long) ret_uint);
+#define ret_ret_GLenum    return PyLong_FromLong((long) ret_uint)
 
 #define ret_def_GLboolean unsigned char ret_bool
 #define ret_set_GLboolean ret_bool=
-#define ret_ret_GLboolean return PyLong_FromLong((long) ret_bool);
+#define ret_ret_GLboolean return PyLong_FromLong((long) ret_bool)
 
 #define ret_def_GLstring  const unsigned char *ret_str;
 #define ret_set_GLstring  ret_str=
 
 #define ret_ret_GLstring \
        if (ret_str) {\
-               return PyUnicode_FromString(ret_str);\
+               return PyUnicode_FromString((const char *)ret_str);\
        } else {\
                PyErr_SetString(PyExc_AttributeError, "could not get opengl string");\
                return NULL;\
index d29860c..19e338c 100644 (file)
@@ -84,125 +84,158 @@ ENDIF(WIN32)
 
 SET(TARGETDIR ${EXECUTABLE_OUTPUT_PATH}/${CMAKE_CFG_INTDIR})
 
+IF(WITH_INSTALL)
 
-IF(UNIX)
-  ADD_CUSTOM_COMMAND(TARGET blender
-    POST_BUILD
-    MAIN_DEPENDENCY blender
-    #COMMAND cp -R ${CMAKE_SOURCE_DIR}/release/plugins ${TARGETDIR}/
-    #COMMAND cp -R ${CMAKE_SOURCE_DIR}/release/text/* ${TARGETDIR}/
-  )
-ENDIF(UNIX)
-
-IF(UNIX AND NOT APPLE)
-  ADD_CUSTOM_COMMAND(TARGET blender
-    POST_BUILD
-    MAIN_DEPENDENCY blender
-    COMMAND rm -Rf ${TARGETDIR}/.blender
-    COMMAND mkdir ${TARGETDIR}/.blender/
-    COMMAND cp ${CMAKE_SOURCE_DIR}/bin/.blender/.bfont.ttf ${TARGETDIR}/.blender/
-    COMMAND cp ${CMAKE_SOURCE_DIR}/bin/.blender/.Blanguages ${TARGETDIR}/.blender/
-    COMMAND cp -R ${CMAKE_SOURCE_DIR}/bin/.blender/locale ${TARGETDIR}/.blender/
-    COMMAND cp -R ${CMAKE_SOURCE_DIR}/release/scripts ${TARGETDIR}/.blender/
-    COMMAND cp -R ${CMAKE_SOURCE_DIR}/release/ui ${TARGETDIR}/.blender/
-    COMMAND find ${TARGETDIR} -name CVS -prune -exec rm -rf {} "\;"
-  )
-ENDIF(UNIX AND NOT APPLE)
+  IF(UNIX)
+    ADD_CUSTOM_COMMAND(TARGET blender
+      POST_BUILD
+      MAIN_DEPENDENCY blender
+      #COMMAND cp -R ${CMAKE_SOURCE_DIR}/release/plugins ${TARGETDIR}/
+      #COMMAND cp -R ${CMAKE_SOURCE_DIR}/release/text/* ${TARGETDIR}/
+    )
+  ENDIF(UNIX)
 
-IF(APPLE)
-  SET(SOURCEDIR ${CMAKE_SOURCE_DIR}/source/darwin/blender.app)
-  SET(SOURCEINFO ${SOURCEDIR}/Contents/Info.plist)
-  SET(TARGETINFO ${TARGETDIR}/blender.app/Contents/Info.plist)
+  IF(UNIX AND NOT APPLE)
+    ADD_CUSTOM_COMMAND(
+      TARGET blender POST_BUILD MAIN_DEPENDENCY blender
+      COMMAND rm -Rf ${TARGETDIR}/.blender
+      COMMAND mkdir ${TARGETDIR}/.blender/
+      COMMAND cp ${CMAKE_SOURCE_DIR}/bin/.blender/.bfont.ttf ${TARGETDIR}/.blender/
+    )
+    
+    IF(WITH_INTERNATIONAL)
+      ADD_CUSTOM_COMMAND(
+        TARGET blender POST_BUILD MAIN_DEPENDENCY blender
+        COMMAND cp ${CMAKE_SOURCE_DIR}/bin/.blender/.Blanguages ${TARGETDIR}/.blender/
+        COMMAND cp -R ${CMAKE_SOURCE_DIR}/bin/.blender/locale ${TARGETDIR}/.blender/
+      )
+    ENDIF(WITH_INTERNATIONAL)
+    
+    IF(WITH_PYTHON)
+      ADD_CUSTOM_COMMAND(
+        TARGET blender POST_BUILD MAIN_DEPENDENCY blender
+        COMMAND cp -R ${CMAKE_SOURCE_DIR}/release/ui ${TARGETDIR}/.blender/
+        COMMAND cp -R ${CMAKE_SOURCE_DIR}/release/io ${TARGETDIR}/.blender/
+        COMMAND find ${TARGETDIR} -name "*.py?" -prune -exec rm -rf {} "\;"
+      )
+    ENDIF(WITH_PYTHON)
+      
+    ADD_CUSTOM_COMMAND(
+      TARGET blender POST_BUILD MAIN_DEPENDENCY blender
+      COMMAND find ${TARGETDIR} -name .svn -prune -exec rm -rf {} "\;"
+    )
+    
+  ENDIF(UNIX AND NOT APPLE)
 
-  ADD_CUSTOM_COMMAND(TARGET blender
-    POST_BUILD
-    MAIN_DEPENDENCY blender
-    COMMAND cp -R ${SOURCEINFO} ${TARGETDIR}/blender.app/Contents/
-    COMMAND cp -R ${SOURCEDIR}/Contents/PkgInfo ${TARGETDIR}/blender.app/Contents/
-    COMMAND cp -R ${SOURCEDIR}/Contents/Resources ${TARGETDIR}/blender.app/Contents/
-    COMMAND cat ${SOURCEINFO} | sed s/VERSION/`cat ${CMAKE_SOURCE_DIR}/release/VERSION`/ | sed s/DATE/`date +'%Y-%b-%d'`/ > ${TARGETINFO}
-    COMMAND rm -Rf ${TARGETDIR}/blender.app/Contents/MacOS/.blender
-    COMMAND mkdir ${TARGETDIR}/blender.app/Contents/MacOS/.blender/
-    COMMAND cp ${CMAKE_SOURCE_DIR}/bin/.blender/.bfont.ttf ${TARGETDIR}/blender.app/Contents/MacOS/.blender/
-    COMMAND cp ${CMAKE_SOURCE_DIR}/bin/.blender/.Blanguages ${TARGETDIR}/blender.app/Contents/MacOS/.blender/
-    COMMAND cp -R ${CMAKE_SOURCE_DIR}/bin/.blender/locale ${TARGETDIR}/blender.app/Contents/Resources/
-    COMMAND cp -R ${CMAKE_SOURCE_DIR}/bin/.blender/locale ${TARGETDIR}/blender.app/Contents/MacOS/.blender/
-    COMMAND cp ${CMAKE_SOURCE_DIR}/bin/.blender/.Blanguages ${TARGETDIR}/blender.app/Contents/Resources/
-    COMMAND cp -Rf ${CMAKE_SOURCE_DIR}/release/scripts ${TARGETDIR}/blender.app/Contents/MacOS/.blender/
-    COMMAND cp -Rf ${CMAKE_SOURCE_DIR}/release/ui ${TARGETDIR}/blender.app/Contents/MacOS/.blender/
-    COMMAND cp -Rf ${CMAKE_SOURCE_DIR}/release/io ${TARGETDIR}/blender.app/Contents/MacOS/.blender/
-    COMMAND mkdir ${TARGETDIR}/blender.app/Contents/MacOS/.blender/python/
-    COMMAND unzip -q ${LIBDIR}/release/python.zip -d ${TARGETDIR}/blender.app/Contents/MacOS/.blender/python/
-    COMMAND find ${TARGETDIR}/blender.app -name CVS -prune -exec rm -rf {} "\;"
-    COMMAND find ${TARGETDIR}/blender.app -name CVS.sandboxinfo -prune -exec rm -rf {} "\;"
-    COMMAND find ${TARGETDIR}/blender.app -name .DS_Store -prune -exec rm -rf {} "\;"
-    COMMAND find ${TARGETDIR}/blender.app -name .svn -prune -exec rm -rf {} "\;"
-  )
-ENDIF(APPLE)
+  IF(APPLE)
+    SET(SOURCEDIR ${CMAKE_SOURCE_DIR}/source/darwin/blender.app)
+    SET(SOURCEINFO ${SOURCEDIR}/Contents/Info.plist)
+    SET(TARGETINFO ${TARGETDIR}/blender.app/Contents/Info.plist)
 
-IF(WIN32)
-  FILE(TO_NATIVE_PATH ${CMAKE_SOURCE_DIR} WIN_SOURCE_DIR)
-  
-  ADD_CUSTOM_COMMAND(TARGET blender
-    POST_BUILD
-    MAIN_DEPENDENCY blender
-    COMMAND if not exist \"${TARGETDIR}\\.blender\" mkdir \"${TARGETDIR}\\.blender\"
-    COMMAND if not exist \"${TARGETDIR}\\.blender\\locale\" mkdir \"${TARGETDIR}\\.blender\\locale\"
-    COMMAND if not exist \"${TARGETDIR}\\.blender\\scripts\" mkdir \"${TARGETDIR}\\.blender\\scripts\"
-    COMMAND if not exist \"${TARGETDIR}\\.blender\\ui\" mkdir \"${TARGETDIR}\\.blender\\ui\"
-    COMMAND if not exist \"${TARGETDIR}\\plugins\" mkdir \"${TARGETDIR}\\plugins\"
-    COMMAND copy /Y \"${WIN_SOURCE_DIR}\\bin\\.blender\\.Blanguages\" \"${TARGETDIR}\\.blender\\\" 
-    COMMAND copy /Y \"${WIN_SOURCE_DIR}\\bin\\.blender\\.bfont.ttf\" \"${TARGETDIR}\\.blender\\\"
-    COMMAND xcopy /E /Y \"${WIN_SOURCE_DIR}\\bin\\.blender\\locale\\*.*\" \"${TARGETDIR}\\.blender\\locale\"
-    COMMAND xcopy /E /Y \"${WIN_SOURCE_DIR}\\release\\scripts\\*.*\" \"${TARGETDIR}\\.blender\\scripts\"
-    COMMAND xcopy /E /Y \"${WIN_SOURCE_DIR}\\release\\ui\\*.*\" \"${TARGETDIR}\\.blender\\ui\"
-    COMMAND xcopy /E /Y \"${WIN_SOURCE_DIR}\\release\\plugins\\*.*\" \"${TARGETDIR}\\plugins\"
-    COMMAND copy /Y \"${WIN_SOURCE_DIR}\\release\\text\\*.*\" \"${TARGETDIR}\"
-    COMMAND copy /Y \"${WIN_SOURCE_DIR}\\release\\windows\\extra\\python26.zip\" \"${TARGETDIR}\\\"
-  )
-  
-  FILE(TO_NATIVE_PATH "${LIBDIR}" WIN_LIBDIR)
-  
-  ADD_CUSTOM_COMMAND(TARGET blender
-    POST_BUILD
-    MAIN_DEPENDENCY blender
-    COMMAND copy /Y \"${WIN_LIBDIR}\\release\\python31.zip\" \"${TARGETDIR}\\\"
-    COMMAND copy /Y \"${WIN_LIBDIR}\\gettext\\lib\\gnu_gettext.dll\" \"${TARGETDIR}\\\"
-    COMMAND copy /Y \"${WIN_LIBDIR}\\png\\lib\\libpng.dll\" \"${TARGETDIR}\\\"
-    COMMAND copy /Y \"${WIN_LIBDIR}\\sdl\\lib\\SDL.dll\" \"${TARGETDIR}\\\"
-    COMMAND copy /Y \"${WIN_LIBDIR}\\zlib\\lib\\zlib.dll\" \"${TARGETDIR}\\\"
-    COMMAND copy /Y \"${WIN_LIBDIR}\\tiff\\lib\\libtiff.dll\" \"${TARGETDIR}\\\"
-    COMMAND copy /Y \"${WIN_LIBDIR}\\python\\lib\\python31.dll\" \"${TARGETDIR}\\\"
-    COMMAND copy /Y \"${WIN_LIBDIR}\\python\\lib\\python31_d.dll\" \"${TARGETDIR}\\\"
-    COMMAND copy /Y \"${WIN_LIBDIR}\\pthreads\\lib\\pthreadVC2.dll\" \"${TARGETDIR}\\\"
-    COMMAND copy /Y \"${WIN_LIBDIR}\\samplerate\\lib\\libsamplerate-0.dll\" \"${TARGETDIR}\\\"
-  )
+    ADD_CUSTOM_COMMAND(
+      TARGET blender POST_BUILD MAIN_DEPENDENCY blender
+      COMMAND cp -R ${SOURCEINFO} ${TARGETDIR}/blender.app/Contents/
+      COMMAND cp -R ${SOURCEDIR}/Contents/PkgInfo ${TARGETDIR}/blender.app/Contents/
+      COMMAND cp -R ${SOURCEDIR}/Contents/Resources ${TARGETDIR}/blender.app/Contents/
+      COMMAND cat ${SOURCEINFO} | sed s/VERSION/`cat ${CMAKE_SOURCE_DIR}/release/VERSION`/ | sed s/DATE/`date +'%Y-%b-%d'`/ > ${TARGETINFO}
+      COMMAND rm -Rf ${TARGETDIR}/blender.app/Contents/MacOS/.blender
+      COMMAND mkdir ${TARGETDIR}/blender.app/Contents/MacOS/.blender/
+      COMMAND cp ${CMAKE_SOURCE_DIR}/bin/.blender/.bfont.ttf ${TARGETDIR}/blender.app/Contents/MacOS/.blender/
+    )
+      
+    IF(WITH_INTERNATIONAL)
+      ADD_CUSTOM_COMMAND(
+        TARGET blender POST_BUILD MAIN_DEPENDENCY blender
+        COMMAND cp ${CMAKE_SOURCE_DIR}/bin/.blender/.Blanguages ${TARGETDIR}/blender.app/Contents/MacOS/.blender/
+        COMMAND cp -R ${CMAKE_SOURCE_DIR}/bin/.blender/locale ${TARGETDIR}/blender.app/Contents/Resources/
+        COMMAND cp -R ${CMAKE_SOURCE_DIR}/bin/.blender/locale ${TARGETDIR}/blender.app/Contents/MacOS/.blender/
+        COMMAND cp ${CMAKE_SOURCE_DIR}/bin/.blender/.Blanguages ${TARGETDIR}/blender.app/Contents/Resources/
+      )
+    ENDIF(WITH_INTERNATIONAL)
+      
+    IF(WITH_PYTHON)
+      ADD_CUSTOM_COMMAND(
+        TARGET blender POST_BUILD MAIN_DEPENDENCY blender
+        COMMAND cp -Rf ${CMAKE_SOURCE_DIR}/release/ui ${TARGETDIR}/blender.app/Contents/MacOS/.blender/
+        COMMAND cp -Rf ${CMAKE_SOURCE_DIR}/release/io ${TARGETDIR}/blender.app/Contents/MacOS/.blender/
+        COMMAND mkdir ${TARGETDIR}/blender.app/Contents/MacOS/.blender/python/
+        COMMAND unzip -q ${LIBDIR}/release/python.zip -d ${TARGETDIR}/blender.app/Contents/MacOS/.blender/python/
+        COMMAND find ${TARGETDIR}/blender.app -name "*.py?" -prune -exec rm -rf {} "\;"
+      )
+    ENDIF(WITH_PYTHON)      
+    
+    ADD_CUSTOM_COMMAND(
+      TARGET blender POST_BUILD MAIN_DEPENDENCY blender    
+      COMMAND find ${TARGETDIR}/blender.app -name .DS_Store -prune -exec rm -rf {} "\;"
+      COMMAND find ${TARGETDIR}/blender.app -name .svn -prune -exec rm -rf {} "\;"
+    )
+  ENDIF(APPLE)
 
-  IF(WITH_INTERNATIONAL)
+  IF(WIN32)
+    FILE(TO_NATIVE_PATH ${CMAKE_SOURCE_DIR} WIN_SOURCE_DIR)
+    
     ADD_CUSTOM_COMMAND(TARGET blender
       POST_BUILD
       MAIN_DEPENDENCY blender
-      COMMAND copy /Y \"${WIN_LIBDIR}\\iconv\\lib\\iconv.dll\" \"${TARGETDIR}\\\"
+      COMMAND if not exist \"${TARGETDIR}\\.blender\" mkdir \"${TARGETDIR}\\.blender\"
+      COMMAND if not exist \"${TARGETDIR}\\.blender\\locale\" mkdir \"${TARGETDIR}\\.blender\\locale\"
+      COMMAND if not exist \"${TARGETDIR}\\.blender\\ui\" mkdir \"${TARGETDIR}\\.blender\\ui\"
+      COMMAND if not exist \"${TARGETDIR}\\.blender\\io\" mkdir \"${TARGETDIR}\\.blender\\io\"
+      COMMAND if not exist \"${TARGETDIR}\\plugins\" mkdir \"${TARGETDIR}\\plugins\"
+      COMMAND copy /Y \"${WIN_SOURCE_DIR}\\bin\\.blender\\.Blanguages\" \"${TARGETDIR}\\.blender\\\" 
+      COMMAND copy /Y \"${WIN_SOURCE_DIR}\\bin\\.blender\\.bfont.ttf\" \"${TARGETDIR}\\.blender\\\"
+      COMMAND xcopy /E /Y \"${WIN_SOURCE_DIR}\\bin\\.blender\\locale\\*.*\" \"${TARGETDIR}\\.blender\\locale\"
+      COMMAND xcopy /E /Y \"${WIN_SOURCE_DIR}\\release\\scripts\\*.*\" \"${TARGETDIR}\\.blender\\scripts\"
+      COMMAND xcopy /E /Y \"${WIN_SOURCE_DIR}\\release\\ui\\*.*\" \"${TARGETDIR}\\.blender\\ui\"
+      COMMAND xcopy /E /Y \"${WIN_SOURCE_DIR}\\release\\io\\*.*\" \"${TARGETDIR}\\.blender\\io\"
+      COMMAND xcopy /E /Y \"${WIN_SOURCE_DIR}\\release\\plugins\\*.*\" \"${TARGETDIR}\\plugins\"
+      COMMAND copy /Y \"${WIN_SOURCE_DIR}\\release\\text\\*.*\" \"${TARGETDIR}\"
+      COMMAND copy /Y \"${WIN_SOURCE_DIR}\\release\\windows\\extra\\python26.zip\" \"${TARGETDIR}\\\"
     )
-  ENDIF(WITH_INTERNATIONAL)
-
-  IF(WITH_FFMPEG)
+    
+    FILE(TO_NATIVE_PATH "${LIBDIR}" WIN_LIBDIR)
+    
     ADD_CUSTOM_COMMAND(TARGET blender
       POST_BUILD
       MAIN_DEPENDENCY blender
-      COMMAND copy /Y \"${WIN_LIBDIR}\\ffmpeg\\lib\\avcodec-52.dll\" \"${TARGETDIR}\\\"
-      COMMAND copy /Y \"${WIN_LIBDIR}\\ffmpeg\\lib\\avformat-52.dll\" \"${TARGETDIR}\\\"
-      COMMAND copy /Y \"${WIN_LIBDIR}\\ffmpeg\\lib\\avdevice-52.dll\" \"${TARGETDIR}\\\"
-      COMMAND copy /Y \"${WIN_LIBDIR}\\ffmpeg\\lib\\avutil-50.dll\" \"${TARGETDIR}\\\"
-      COMMAND copy /Y \"${WIN_LIBDIR}\\ffmpeg\\lib\\libfaac-0.dll\" \"${TARGETDIR}\\\"
-      COMMAND copy /Y \"${WIN_LIBDIR}\\ffmpeg\\lib\\libfaad-2.dll\" \"${TARGETDIR}\\\"
-      COMMAND copy /Y \"${WIN_LIBDIR}\\ffmpeg\\lib\\libmp3lame-0.dll\" \"${TARGETDIR}\\\"
-      COMMAND copy /Y \"${WIN_LIBDIR}\\ffmpeg\\lib\\libx264-67.dll\" \"${TARGETDIR}\\\"
-      COMMAND copy /Y \"${WIN_LIBDIR}\\ffmpeg\\lib\\swscale-0.dll\" \"${TARGETDIR}\\\"
-      COMMAND copy /Y \"${WIN_LIBDIR}\\ffmpeg\\lib\\xvidcore.dll\" \"${TARGETDIR}\\\"
+      COMMAND copy /Y \"${WIN_LIBDIR}\\release\\python31.zip\" \"${TARGETDIR}\\\"
+      COMMAND copy /Y \"${WIN_LIBDIR}\\gettext\\lib\\gnu_gettext.dll\" \"${TARGETDIR}\\\"
+      COMMAND copy /Y \"${WIN_LIBDIR}\\png\\lib\\libpng.dll\" \"${TARGETDIR}\\\"
+      COMMAND copy /Y \"${WIN_LIBDIR}\\sdl\\lib\\SDL.dll\" \"${TARGETDIR}\\\"
+      COMMAND copy /Y \"${WIN_LIBDIR}\\zlib\\lib\\zlib.dll\" \"${TARGETDIR}\\\"
+      COMMAND copy /Y \"${WIN_LIBDIR}\\tiff\\lib\\libtiff.dll\" \"${TARGETDIR}\\\"
+      COMMAND copy /Y \"${WIN_LIBDIR}\\python\\lib\\python31.dll\" \"${TARGETDIR}\\\"
+      COMMAND copy /Y \"${WIN_LIBDIR}\\python\\lib\\python31_d.dll\" \"${TARGETDIR}\\\"
+      COMMAND copy /Y \"${WIN_LIBDIR}\\pthreads\\lib\\pthreadVC2.dll\" \"${TARGETDIR}\\\"
+      COMMAND copy /Y \"${WIN_LIBDIR}\\samplerate\\lib\\libsamplerate-0.dll\" \"${TARGETDIR}\\\"
     )
-  ENDIF(WITH_FFMPEG)
-ENDIF(WIN32)
+
+    IF(WITH_INTERNATIONAL)
+      ADD_CUSTOM_COMMAND(TARGET blender
+        POST_BUILD
+        MAIN_DEPENDENCY blender
+        COMMAND copy /Y \"${WIN_LIBDIR}\\iconv\\lib\\iconv.dll\" \"${TARGETDIR}\\\"
+      )
+    ENDIF(WITH_INTERNATIONAL)
+
+    IF(WITH_FFMPEG)
+      ADD_CUSTOM_COMMAND(TARGET blender
+        POST_BUILD
+        MAIN_DEPENDENCY blender
+        COMMAND copy /Y \"${WIN_LIBDIR}\\ffmpeg\\lib\\avcodec-52.dll\" \"${TARGETDIR}\\\"
+        COMMAND copy /Y \"${WIN_LIBDIR}\\ffmpeg\\lib\\avformat-52.dll\" \"${TARGETDIR}\\\"
+        COMMAND copy /Y \"${WIN_LIBDIR}\\ffmpeg\\lib\\avdevice-52.dll\" \"${TARGETDIR}\\\"
+        COMMAND copy /Y \"${WIN_LIBDIR}\\ffmpeg\\lib\\avutil-50.dll\" \"${TARGETDIR}\\\"
+        COMMAND copy /Y \"${WIN_LIBDIR}\\ffmpeg\\lib\\libfaac-0.dll\" \"${TARGETDIR}\\\"
+        COMMAND copy /Y \"${WIN_LIBDIR}\\ffmpeg\\lib\\libfaad-2.dll\" \"${TARGETDIR}\\\"
+        COMMAND copy /Y \"${WIN_LIBDIR}\\ffmpeg\\lib\\libmp3lame-0.dll\" \"${TARGETDIR}\\\"
+        COMMAND copy /Y \"${WIN_LIBDIR}\\ffmpeg\\lib\\libx264-67.dll\" \"${TARGETDIR}\\\"
+        COMMAND copy /Y \"${WIN_LIBDIR}\\ffmpeg\\lib\\swscale-0.dll\" \"${TARGETDIR}\\\"
+        COMMAND copy /Y \"${WIN_LIBDIR}\\ffmpeg\\lib\\xvidcore.dll\" \"${TARGETDIR}\\\"
+      )
+    ENDIF(WITH_FFMPEG)
+  ENDIF(WIN32)
+ENDIF(WITH_INSTALL)
 
 ADD_DEPENDENCIES(blender makesdna)
 
@@ -222,7 +255,7 @@ IF(UNIX)
   # Sort libraries
   SET(BLENDER_SORTED_LIBS
     bf_windowmanager
-       bf_editors
+    bf_editors
     bf_decimation 
     blender_BSP 
     bf_ghost 
@@ -233,7 +266,7 @@ IF(UNIX)
     bf_gen_python 
     bf_blenkernel 
     bf_nodes
-       bf_gpu
+    bf_gpu
     bf_blenloader 
     bf_blenpluginapi 
     bf_imbuf