Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2009-09-25 06:40:10 +0400
committerCampbell Barton <ideasman42@gmail.com>2009-09-25 06:40:10 +0400
commit314d460eb87ec6f383358e0dbb77e9fdf5c99f23 (patch)
treedbad3bfa62dc321298218c3de15e666ff65d7950
parentb4f235adc0a61a74b753db4704af0c02229eb856 (diff)
options WITH_LZO and WITH_LZMA for cmake and scons (default to true) pointcache.c also needed to have checks for these defines.
-rw-r--r--CMakeLists.txt2
-rw-r--r--extern/CMakeLists.txt9
-rw-r--r--extern/Makefile6
-rw-r--r--extern/SConscript7
-rw-r--r--source/blender/SConscript2
-rw-r--r--source/blender/blenkernel/CMakeLists.txt12
-rw-r--r--source/blender/blenkernel/SConscript12
-rw-r--r--source/blender/blenkernel/intern/Makefile18
-rw-r--r--source/blender/blenkernel/intern/pointcache.c32
-rwxr-xr-xtools/btools.py4
10 files changed, 79 insertions, 25 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 92c670f572c..d8c5a132995 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -75,6 +75,8 @@ OPTION(WITH_WEBPLUGIN "Enable Web Plugin (Unix only)" OFF)
OPTION(WITH_FFTW3 "Enable FFTW3 support" OFF)
OPTION(WITH_JACK "Enable Jack Support (http://www.jackaudio.org)" OFF)
OPTION(WITH_SNDFILE "Enable libsndfile Support (http://www.mega-nerd.com/libsndfile)" OFF)
+OPTION(WITH_LZO "Enable fast LZO compression, used for pointcache" ON)
+OPTION(WITH_LZMA "Enable best LZMA compression, used for pointcache" ON)
OPTION(WITH_CXX_GUARDEDALLOC "Enable GuardedAlloc for C++ memory allocation" OFF)
OPTION(WITH_BUILDINFO "Include extra build details" ON)
OPTION(WITH_INSTALL "Install accompanying scripts and language files needed to run blender" ON)
diff --git a/extern/CMakeLists.txt b/extern/CMakeLists.txt
index 44e47aaf88d..35271d24a2d 100644
--- a/extern/CMakeLists.txt
+++ b/extern/CMakeLists.txt
@@ -38,5 +38,10 @@ IF(WITH_OPENJPEG)
ADD_SUBDIRECTORY(libopenjpeg)
ENDIF(WITH_OPENJPEG)
-ADD_SUBDIRECTORY(lzo)
-ADD_SUBDIRECTORY(lzma)
+IF(WITH_LZO)
+ ADD_SUBDIRECTORY(lzo)
+ENDIF(WITH_LZO)
+
+IF(WITH_LZMA)
+ ADD_SUBDIRECTORY(lzma)
+ENDIF(WITH_LZMA)
diff --git a/extern/Makefile b/extern/Makefile
index b81fbd2b91a..a30cd1d7ca3 100644
--- a/extern/Makefile
+++ b/extern/Makefile
@@ -33,9 +33,9 @@ DIR = $(OCGDIR)/extern
DIRS = glew/src
# Cloth requires it
-#ifneq ($(NAN_NO_KETSJI), true)
-DIRS += bullet2
-#endif
+ifeq ($(NAN_USE_BULLET), true)
+ DIRS += bullet2
+endif
ifeq ($(WITH_BINRELOC), true)
DIRS += binreloc
diff --git a/extern/SConscript b/extern/SConscript
index 20604d87e45..af057a73927 100644
--- a/extern/SConscript
+++ b/extern/SConscript
@@ -22,5 +22,8 @@ if env['WITH_BF_REDCODE'] and env['BF_REDCODE_LIB'] == '':
if env['OURPLATFORM'] == 'linux2':
SConscript(['binreloc/SConscript']);
-SConscript(['lzo/SConscript'])
-SConscript(['lzma/SConscript'])
+if env['WITH_BF_LZO']:
+ SConscript(['lzo/SConscript'])
+
+if env['WITH_BF_LZMA']:
+ SConscript(['lzma/SConscript'])
diff --git a/source/blender/SConscript b/source/blender/SConscript
index af2c81a3b45..3625678f610 100644
--- a/source/blender/SConscript
+++ b/source/blender/SConscript
@@ -18,7 +18,7 @@ SConscript(['avi/SConscript',
'nodes/SConscript',
'ikplugin/SConscript',
'windowmanager/SConscript',
- 'blenfont/SConscript'])
+ 'blenfont/SConscript'])
diff --git a/source/blender/blenkernel/CMakeLists.txt b/source/blender/blenkernel/CMakeLists.txt
index 3473950ab3a..f60cade61ed 100644
--- a/source/blender/blenkernel/CMakeLists.txt
+++ b/source/blender/blenkernel/CMakeLists.txt
@@ -34,8 +34,6 @@ SET(INC
../nodes ../../../extern/glew/include ../gpu ../makesrna ../../../intern/smoke/extern
../../../intern/bsp/extern ../blenfont
../../../intern/audaspace/intern
- ../../../extern/lzo/minilzo
- ../../../extern/lzma
${ZLIB_INC}
)
@@ -76,6 +74,16 @@ IF(NOT WITH_ELBEEM)
ADD_DEFINITIONS(-DDISABLE_ELBEEM)
ENDIF(NOT WITH_ELBEEM)
+IF(WITH_LZO)
+ SET(INC ${INC} ../../../extern/lzo/minilzo)
+ ADD_DEFINITIONS(-DWITH_LZO)
+ENDIF(WITH_LZO)
+
+IF(WITH_LZMA)
+ SET(INC ${INC} ../../../extern/lzma)
+ ADD_DEFINITIONS(-DWITH_LZMA)
+ENDIF(WITH_LZMA)
+
IF(WIN32)
SET(INC ${INC} ${PTHREADS_INC})
ENDIF(WIN32)
diff --git a/source/blender/blenkernel/SConscript b/source/blender/blenkernel/SConscript
index 944667e2963..63631ddc40f 100644
--- a/source/blender/blenkernel/SConscript
+++ b/source/blender/blenkernel/SConscript
@@ -11,8 +11,6 @@ incs += ' #/extern/bullet2/src'
incs += ' #/intern/opennl/extern #/intern/bsp/extern'
incs += ' ../gpu #/extern/glew/include'
incs += ' #/intern/smoke/extern'
-incs += ' #/extern/lzo/minilzo'
-incs += ' #/extern/lzma'
incs += ' #/intern/audaspace/intern'
incs += ' ' + env['BF_OPENGL_INC']
@@ -61,7 +59,15 @@ if env['BF_NO_ELBEEM']:
if env['WITH_BF_LCMS']:
defs.append('WITH_LCMS')
-
+
+if env['WITH_BF_LZO']:
+ incs += ' #/extern/lzo/minilzo'
+ defs.append('WITH_LZO')
+
+if env['WITH_BF_LZMA']:
+ incs += ' #/extern/lzma'
+ defs.append('WITH_LZMA')
+
if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc'):
incs += ' ' + env['BF_PTHREADS_INC']
diff --git a/source/blender/blenkernel/intern/Makefile b/source/blender/blenkernel/intern/Makefile
index f16b57c8469..26b9b9ef0dd 100644
--- a/source/blender/blenkernel/intern/Makefile
+++ b/source/blender/blenkernel/intern/Makefile
@@ -86,14 +86,24 @@ CPPFLAGS += -I../../gpu
# path to our own external headerfiles
CPPFLAGS += -I..
-# path to bullet2, for cloth
-CPPFLAGS += -I$(NAN_BULLET2)/include
CPPFLAGS += -I$(NAN_FREETYPE)/include
CPPFLAGS += -I$(NAN_FREETYPE)/include/freetype2
+# path to bullet2, for cloth
+ifeq ($(NAN_USE_BULLET), true)
+ CPPFLAGS += -I$(NAN_BULLET2)/include
+endif
+
# lzo and lzma, for pointcache
-CPPFLAGS += -I$(NAN_LZO)/minilzo
-CPPFLAGS += -I$(NAN_LZMA)
+ifeq ($(WITH_LZO),true)
+ CPPFLAGS += -I$(NAN_LZO)/minilzo
+ CPPFLAGS += -DWITH_LZO
+endif
+
+ifeq ($(WITH_LZO),true)
+ CPPFLAGS += -I$(NAN_LZMA)
+ CPPFLAGS += -DWITH_LZMA
+endif
ifeq ($(WITH_FFMPEG),true)
CPPFLAGS += -DWITH_FFMPEG
diff --git a/source/blender/blenkernel/intern/pointcache.c b/source/blender/blenkernel/intern/pointcache.c
index e5f89727ab8..3915a6901a0 100644
--- a/source/blender/blenkernel/intern/pointcache.c
+++ b/source/blender/blenkernel/intern/pointcache.c
@@ -62,10 +62,17 @@
/* both in intern */
#include "smoke_API.h"
+
+#ifdef WITH_LZO
#include "minilzo.h"
+#else
+/* used for non-lzo cases */
+#define LZO_OUT_LEN(size) ((size) + (size) / 16 + 64 + 3)
+#endif
+#ifdef WITH_LZMA
#include "LzmaLib.h"
-
+#endif
/* needed for directory lookup */
/* untitled blend's need getpid for a unique name */
@@ -625,20 +632,25 @@ static int ptcache_file_write(PTCacheFile *pf, void *f, size_t tot, int size);
static int ptcache_compress_write(PTCacheFile *pf, unsigned char *in, unsigned int in_len, unsigned char *out, int mode)
{
int r = 0;
- unsigned char compressed;
- LZO_HEAP_ALLOC(wrkmem, LZO1X_MEM_COMPRESS);
- unsigned int out_len = LZO_OUT_LEN(in_len);
+ unsigned char compressed = 0;
+ unsigned int out_len= 0;
unsigned char *props = MEM_callocN(16*sizeof(char), "tmp");
size_t sizeOfIt = 5;
+#ifdef WITH_LZO
+ out_len= LZO_OUT_LEN(in_len);
if(mode == 1) {
+ LZO_HEAP_ALLOC(wrkmem, LZO1X_MEM_COMPRESS);
+
r = lzo1x_1_compress(in, (lzo_uint)in_len, out, (lzo_uint *)&out_len, wrkmem);
if (!(r == LZO_E_OK) || (out_len >= in_len))
compressed = 0;
else
compressed = 1;
}
- else if(mode == 2) {
+#endif
+#ifdef WITH_LZMA
+ if(mode == 2) {
r = LzmaCompress(out, (size_t *)&out_len, in, in_len,//assume sizeof(char)==1....
props, &sizeOfIt, 5, 1 << 24, 3, 0, 2, 32, 2);
@@ -648,7 +660,8 @@ static int ptcache_compress_write(PTCacheFile *pf, unsigned char *in, unsigned i
else
compressed = 2;
}
-
+#endif
+
ptcache_file_write(pf, &compressed, 1, sizeof(unsigned char));
if(compressed) {
ptcache_file_write(pf, &out_len, 1, sizeof(unsigned int));
@@ -762,16 +775,19 @@ static int ptcache_compress_read(PTCacheFile *pf, unsigned char *result, unsigne
in = (unsigned char *)MEM_callocN(sizeof(unsigned char)*in_len, "pointcache_compressed_buffer");
ptcache_file_read(pf, in, in_len, sizeof(unsigned char));
+#ifdef WITH_LZO
if(compressed == 1)
r = lzo1x_decompress(in, (lzo_uint)in_len, result, (lzo_uint *)&out_len, NULL);
- else if(compressed == 2)
+#endif
+#ifdef WITH_LZMA
+ if(compressed == 2)
{
size_t leni = in_len, leno = out_len;
ptcache_file_read(pf, &sizeOfIt, 1, sizeof(unsigned int));
ptcache_file_read(pf, props, sizeOfIt, sizeof(unsigned char));
r = LzmaUncompress(result, &leno, in, &leni, props, sizeOfIt);
}
-
+#endif
MEM_freeN(in);
}
else {
diff --git a/tools/btools.py b/tools/btools.py
index e3f3827ff45..b1584ae8784 100755
--- a/tools/btools.py
+++ b/tools/btools.py
@@ -56,6 +56,7 @@ def validate_arguments(args, bc):
'WITH_BF_PLAYER',
'WITH_BF_NOBLENDER',
'WITH_BF_BINRELOC',
+ 'WITH_BF_LZO', 'WITH_BF_LZMA',
'LCGDIR',
'BF_CXX', 'WITH_BF_STATICCXX', 'BF_CXX_LIB_STATIC',
'BF_TWEAK_MODE', 'BF_SPLIT_SRC',
@@ -379,6 +380,9 @@ def read_opts(cfg, args):
(BoolVariable('BF_QUIET', 'Enable silent output if true', True)),
(BoolVariable('WITH_BF_BINRELOC', 'Enable relocatable binary (linux only)', False)),
+ (BoolVariable('WITH_BF_LZO', 'Enable fast LZO pointcache compression', True)),
+ (BoolVariable('WITH_BF_LZMA', 'Enable best LZMA pointcache compression', True)),
+
(BoolVariable('WITH_BF_LCMS', 'Enable color correction with lcms', False)),
('BF_LCMS_LIB', 'LCMSlibrary', 'lcms'),