options WITH_LZO and WITH_LZMA for cmake and scons (default to true) pointcache.c also needed to have checks for these defines.

This commit is contained in:
Campbell Barton
2009-09-25 02:40:10 +00:00
parent b4f235adc0
commit 314d460eb8
10 changed files with 79 additions and 25 deletions

View File

@@ -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)

View File

@@ -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)

6
extern/Makefile vendored
View File

@@ -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

7
extern/SConscript vendored
View File

@@ -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'])

View File

@@ -18,7 +18,7 @@ SConscript(['avi/SConscript',
'nodes/SConscript',
'ikplugin/SConscript',
'windowmanager/SConscript',
'blenfont/SConscript'])
'blenfont/SConscript'])

View File

@@ -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)

View File

@@ -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']

View File

@@ -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

View File

@@ -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 {

View File

@@ -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'),