bugfix [#21230] set-scene animation updates not working
[blender.git] / CMakeLists.txt
index 504ef5d8dd81cb1378a9fc09b472ce7dc9ea5c46..8b690cdd81a3c23262a4dc1907c40fdda08a58c5 100644 (file)
@@ -1,4 +1,4 @@
-# $Id$
+ # $Id$
 # ***** BEGIN GPL LICENSE BLOCK *****
 #
 # This program is free software; you can redistribute it and/or
@@ -13,7 +13,7 @@
 #
 # You should have received a copy of the GNU General Public License
 # along with this program; if not, write to the Free Software Foundation,
-# Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 #
 # The Original Code is Copyright (C) 2006, Blender Foundation
 # All rights reserved.
@@ -70,14 +70,31 @@ OPTION(WITH_PYTHON        "Enable Embedded Python API" ON)
 OPTION(WITH_SDL           "Enable SDL for sound and joystick support" ON)
 OPTION(WITH_OPENJPEG      "Enable OpenJpeg Support (http://www.openjpeg.org/)" OFF)
 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_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_BUILDINFO     "Include extra build details" ON)
 OPTION(WITH_INSTALL       "Install accompanying scripts and language files needed to run blender" ON)
+OPTION(WITH_OPENCOLLADA                "Enable OpenCollada Support (http://www.opencollada.org/)"      ON)
+
+# Unix defaults to OpenMP On
+IF(UNIX AND NOT APPLE)
+       OPTION(WITH_OPENMP        "Enable OpenMP (has to be supported by the compiler)" ON)
+ELSE()
+       OPTION(WITH_OPENMP        "Enable OpenMP (has to be supported by the compiler)" OFF)
+ENDIF()
+
+OPTION(WITH_RAYOPTIMIZATION    "Enable use of SIMD (SSE) optimizations for the raytracer" OFF) 
+
+IF (APPLE)
+       OPTION(WITH_COCOA         "Use Cocoa framework instead of deprecated Carbon" ON)
+       OPTION(USE_QTKIT          "Use QtKit instead of Carbon quicktime (needed for having partial quicktime for 64bit)" OFF)
+       OPTION(WITH_LIBS10.5  "Use 10.5 libs (needed for 64bit builds)" OFF)
+ENDIF (APPLE)
 
 IF(NOT WITH_GAMEENGINE AND WITH_PLAYER)
        MESSAGE("WARNING: WITH_PLAYER needs WITH_GAMEENGINE")
@@ -99,6 +116,8 @@ INCLUDE(CMake/macros.cmake)
 #Platform specifics
 
 IF(UNIX AND NOT APPLE)
+
+
        IF(WITH_OPENAL)
                FIND_PACKAGE(OpenAL)
                IF(OPENAL_FOUND)
@@ -162,11 +181,12 @@ IF(UNIX AND NOT APPLE)
                ENDIF(NOT SDL_FOUND)
        ENDIF(WITH_SDL)
 
+    SET(OPENEXR /usr CACHE FILEPATH "OPENEXR Directory")
        FIND_PATH(OPENEXR_INC
                ImfXdr.h
                PATHS
+        ${OPENEXR}/include/OpenEXR
                /usr/local/include/OpenEXR
-               /usr/include/OpenEXR
                /sw/include/OpenEXR
                /opt/local/include/OpenEXR
                /opt/csw/include/OpenEXR
@@ -174,9 +194,9 @@ IF(UNIX AND NOT APPLE)
        )
        SET(OPENEXR_LIB Half IlmImf Iex Imath)
 
-       SET(FFMPEG /usr)
+       SET(FFMPEG /usr CACHE FILEPATH "FFMPEG Directory")
        SET(FFMPEG_INC ${FFMPEG}/include)
-       SET(FFMPEG_LIB avformat avcodec avutil avdevice swscale)
+       SET(FFMPEG_LIB avformat avcodec avutil avdevice swscale CACHE STRING "FFMPEG Libraries")
        SET(FFMPEG_LIBPATH ${FFMPEG}/lib)
   
        IF(WITH_FFTW3)
@@ -197,6 +217,20 @@ IF(UNIX AND NOT APPLE)
 
        FIND_PACKAGE(ZLIB REQUIRED)
 
+       IF (WITH_OPENCOLLADA)
+               SET(OPENCOLLADA /usr/local/opencollada CACHE FILEPATH "OpenCollada Directory")
+               SET(OPENCOLLADA_LIBPATH ${OPENCOLLADA}/lib)
+               SET(OPENCOLLADA_LIB OpenCOLLADAStreamWriter OpenCOLLADASaxFrameworkLoader OpenCOLLADAFramework OpenCOLLADABaseUtils GeneratedSaxParser UTF MathMLSolver pcre ftoa buffer)
+               SET(OPENCOLLADA_INC ${OPENCOLLADA})
+               SET(PCRE /usr CACHE FILEPATH "PCRE Directory")
+               SET(PCRE_LIBPATH ${PCRE}/lib)
+               SET(PCRE_LIB pcre)
+               SET(EXPAT /usr CACHE FILEPATH "Expat Directory")
+               SET(EXPAT_LIBPATH ${EXPAT}/lib)
+               SET(EXPAT_LIB expat)
+       ENDIF (WITH_OPENCOLLADA)
+
+
        # Could use ${X11_Xinput_LIB} ${X11_X11_LIB} too
        SET(LLIBS "-lXi -lutil -lc -lm -lpthread -lstdc++ -lX11")
 
@@ -212,12 +246,12 @@ IF(UNIX AND NOT APPLE)
        ENDIF(WITH_OPENMP)
 
 
-       SET(PLATFORM_CFLAGS "-pipe -fPIC -funsigned-char -fno-strict-aliasing -DXP_UNIX -Wno-char-subscripts")
+       SET(PLATFORM_CFLAGS "-pipe -fPIC -funsigned-char -fno-strict-aliasing -Wno-char-subscripts")
 
        SET(PLATFORM_LINKFLAGS "-pthread")
 
        # Better warnings
-       SET(C_WARNINGS "-Wall -Wno-char-subscripts -Wpointer-arith -Wcast-align -Wdeclaration-after-statement")
+       SET(C_WARNINGS "-Wall -Wno-char-subscripts -Wpointer-arith -Wcast-align -Wdeclaration-after-statement -Wno-unknown-pragmas")
        SET(CXX_WARNINGS "-Wall -Wno-invalid-offsetof -Wno-sign-compare")
 
        INCLUDE_DIRECTORIES(${JPEG_INCLUDE_DIR} ${PNG_INCLUDE_DIR} ${ZLIB_INCLUDE_DIR} )
@@ -243,15 +277,10 @@ IF(WIN32)
        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_INCLUDE_DIR ${OPENAL}/include)
-               SET(OPENAL_LIBRARY wrap_oal)
-               SET(OPENAL_LIBPATH ${OPENAL}/lib)
-       ENDIF(CMAKE_CL_64)
+       SET(OPENAL ${LIBDIR}/openal)
+       SET(OPENAL_INCLUDE_DIR ${OPENAL}/include)
+       SET(OPENAL_LIBRARY wrap_oal)
+       SET(OPENAL_LIBPATH ${OPENAL}/lib)
 
        IF(WITH_JACK)
                SET(JACK ${LIBDIR}/jack)
@@ -380,6 +409,16 @@ IF(WIN32)
   
        SET(WINTAB_INC ${LIBDIR}/wintab/include) 
 
+       SET(OPENCOLLADA ${LIBDIR}/opencollada)
+       SET(OPENCOLLADA_INC ${OPENCOLLADA}/include)
+       SET(OPENCOLLADA_LIBPATH ${OPENCOLLADA}/lib)
+       SET(OPENCOLLADA_LIB OpenCOLLADASaxFrameworkLoader OpenCOLLADAFramework OpenCOLLADABaseUtils OpenCOLLADAStreamWriter MathMLSolver GeneratedSaxParser UTF xml2 buffer ftoa)
+       #pcre is bundled with openCollada
+       #SET(PCRE ${LIBDIR}/pcre)
+       #SET(PCRE_LIBPATH ${PCRE}/lib)
+       SET(PCRE_LIB pcre)
+
+
        IF(CMAKE_CL_64)
                SET(PLATFORM_LINKFLAGS "/MACHINE:X64 /NODEFAULTLIB:libc.lib;MSVCRT.lib ")
        ELSE(CMAKE_CL_64)
@@ -390,16 +429,22 @@ IF(WIN32)
 ENDIF(WIN32)
 
 IF(APPLE)
-       IF(CMAKE_OSX_ARCHITECTURES MATCHES i386)
-               SET(LIBDIR ${CMAKE_SOURCE_DIR}/../lib/darwin-8.x.i386)
-       ELSE(CMAKE_OSX_ARCHITECTURES MATCHES i386)
-               SET(LIBDIR ${CMAKE_SOURCE_DIR}/../lib/darwin-6.1-powerpc)
-       ENDIF(CMAKE_OSX_ARCHITECTURES MATCHES i386)
+       IF(WITH_LIBS10.5)
+               SET(LIBDIR ${CMAKE_SOURCE_DIR}/../lib/darwin-9.x.universal)
+       ELSE(WITH_LIBS10.5)
+               IF(CMAKE_OSX_ARCHITECTURES MATCHES i386)
+                       SET(LIBDIR ${CMAKE_SOURCE_DIR}/../lib/darwin-8.x.i386)
+               ELSE(CMAKE_OSX_ARCHITECTURES MATCHES i386)
+                       SET(LIBDIR ${CMAKE_SOURCE_DIR}/../lib/darwin-8.0.0-powerpc)
+               ENDIF(CMAKE_OSX_ARCHITECTURES MATCHES i386)
+       ENDIF(WITH_LIBS10.5)
+       
 
        IF(WITH_OPENAL)
                FIND_PACKAGE(OpenAL)
                IF(OPENAL_FOUND)
                        SET(WITH_OPENAL ON)
+                       SET(OPENAL_INCLUDE_DIR "${LIBDIR}/openal/include")
                ELSE(OPENAL_FOUND)
                        SET(WITH_OPENAL OFF)
                ENDIF(OPENAL_FOUND)
@@ -425,20 +470,20 @@ IF(APPLE)
                # we use precompiled libraries for py 3.1 and up by default
 
                SET(PYTHON ${LIBDIR}/python)
-               SET(PYTHON_INC "${PYTHON}/include/python${PYTHON_VERSION}" CACHE STRING "")
-               # SET(PYTHON_BINARY "${PYTHON}/bin/python${PYTHON_VERSION}" CACHE STRING "") # not used yet
+               SET(PYTHON_INC "${PYTHON}/include/python${PYTHON_VERSION}")
+               # SET(PYTHON_BINARY "${PYTHON}/bin/python${PYTHON_VERSION}") # not used yet
                SET(PYTHON_LIB python${PYTHON_VERSION})
-               SET(PYTHON_LIBPATH "${PYTHON}/lib/python${PYTHON_VERSION}" CACHE STRING "")
+               SET(PYTHON_LIBPATH "${PYTHON}/lib/python${PYTHON_VERSION}")
                #    SET(PYTHON_LINKFLAGS "-u _PyMac_Error")  # won't  build with this enabled
        ELSE(PYTHON_VERSION MATCHES 3.1)
                # otherwise, use custom system framework
 
                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 "") # not used yet
+               SET(PYTHON_INC "${PYTHON}${PYTHON_VERSION}/include/python${PYTHON_VERSION}")
+               # SET(PYTHON_BINARY ${PYTHON}${PYTHON_VERSION}/bin/python${PYTHON_VERSION}) # not used yet
                SET(PYTHON_LIB "")
-               SET(PYTHON_LIBPATH ${PYTHON}${PYTHON_VERSION}/lib/python${PYTHON_VERSION}/config CACHE STRING "")
+               SET(PYTHON_LIBPATH ${PYTHON}${PYTHON_VERSION}/lib/python${PYTHON_VERSION}/config)
                SET(PYTHON_LINKFLAGS "-u _PyMac_Error -framework System -framework Python")
        ENDIF(PYTHON_VERSION MATCHES 3.1)
 
@@ -450,7 +495,7 @@ IF(APPLE)
        IF(WITH_FFTW3)
                SET(FFTW3 ${LIBDIR}/fftw3)
                SET(FFTW3_INC ${FFTW3}/include)
-               SET(FFTW3_LIB libfftw)
+               SET(FFTW3_LIB fftw3)
                SET(FFTW3_LIBPATH ${FFTW3}/lib)
        ENDIF(WITH_FFTW3)
 
@@ -459,7 +504,7 @@ IF(APPLE)
 
        SET(ZLIB /usr)
        SET(ZLIB_INC "${ZLIB}/include")
-       SET(ZLIB_LIBRARIES z)
+       SET(ZLIB_LIBRARIES z bz2)
 
        SET(FREETYPE ${LIBDIR}/freetype)
        SET(FREETYPE_INCLUDE_DIRS ${FREETYPE}/include ${FREETYPE}/include/freetype2)
@@ -472,8 +517,8 @@ IF(APPLE)
        SET(OPENEXR_LIBPATH ${OPENEXR}/lib)
 
        SET(FFMPEG ${LIBDIR}/ffmpeg)
-       SET(FFMPEG_INC ${CMAKE_SOURCE_DIR}/extern/ffmpeg)
-       SET(FFMPEG_LIB avcodec avdevice avformat avutil mp3lame swscale x264 xvidcore)
+       SET(FFMPEG_INC ${FFMPEG}/include)
+       SET(FFMPEG_LIB avcodec avdevice avformat avutil mp3lame swscale x264 xvidcore theora theoradec theoraenc vorbis vorbisenc vorbisfile ogg)
        SET(FFMPEG_LIBPATH ${FFMPEG}/lib)
 
        SET(LIBSAMPLERATE ${LIBDIR}/samplerate)
@@ -483,15 +528,45 @@ IF(APPLE)
 
        SET(LLIBS stdc++ SystemStubs)
 
-       SET(PLATFORM_CFLAGS "-pipe -fPIC -funsigned-char -fno-strict-aliasing")
-       SET(PLATFORM_LINKFLAGS "-fexceptions -framework CoreServices -framework Foundation -framework IOKit -framework AppKit -framework Carbon -framework AGL -framework AudioUnit -framework AudioToolbox -framework CoreAudio -framework QuickTime")
+       IF (WITH_COCOA)
+               SET(PLATFORM_CFLAGS "-pipe -funsigned-char -DGHOST_COCOA")
+               SET(PLATFORM_LINKFLAGS "-fexceptions -framework CoreServices -framework Foundation -framework IOKit -framework AppKit -framework Cocoa -framework Carbon -framework AudioUnit -framework AudioToolbox -framework CoreAudio")
+               IF(USE_QTKIT)
+                       SET(PLATFORM_CFLAGS "${PLATFORM_CFLAGS} -DUSE_QTKIT")
+                       SET(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -framework QTKit")
+                       IF(CMAKE_OSX_ARCHITECTURES MATCHES i386)
+                               SET(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -framework QuickTime")
+                               #libSDL still needs 32bit carbon quicktime 
+                       ENDIF(CMAKE_OSX_ARCHITECTURES MATCHES i386)
+               ELSEIF(WITH_QUICKTIME)
+                       SET(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -framework QuickTime")
+               ENDIF(USE_QTKIT)
+       ELSE (WITH_COCOA)
+               SET(PLATFORM_CFLAGS "-pipe -funsigned-char")
+               SET(PLATFORM_LINKFLAGS "-fexceptions -framework CoreServices -framework Foundation -framework IOKit -framework AppKit -framework Carbon -framework AGL -framework AudioUnit -framework AudioToolbox -framework CoreAudio -framework QuickTime")
+       ENDIF (WITH_COCOA)
 
        IF(WITH_OPENMP)
-               SET(LLIBS "${LLIBS} -lgomp ")
-               SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fopenmp ")
-               SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fopenmp ")
+               SET(LLIBS "${LLIBS} -lgomp")
+               SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fopenmp")
+               SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fopenmp")
        ENDIF(WITH_OPENMP)
 
+       IF (WITH_OPENCOLLADA)
+               SET(OPENCOLLADA ${LIBDIR}/opencollada)
+               SET(OPENCOLLADA_INC ${OPENCOLLADA}/include)
+               SET(OPENCOLLADA_LIBPATH ${OPENCOLLADA}/lib)
+               SET(OPENCOLLADA_LIB "OpenCOLLADASaxFrameworkLoader -lOpenCOLLADAFramework -lOpenCOLLADABaseUtils -lOpenCOLLADAStreamWriter -lMathMLSolver -lGeneratedSaxParser -lUTF -lxml2 -lbuffer -lftoa" )
+               #pcre is bundled with openCollada
+               #SET(PCRE ${LIBDIR}/pcre)
+               #SET(PCRE_LIBPATH ${PCRE}/lib)
+               SET(PCRE_LIB pcre)
+               #libxml2 is used
+               #SET(EXPAT ${LIBDIR}/expat)
+               #SET(EXPAT_LIBPATH ${EXPAT}/lib)
+               SET(EXPAT_LIB)
+       ENDIF (WITH_OPENCOLLADA)
+
        SET(SDL ${LIBDIR}/sdl)
        SET(SDL_INCLUDE_DIR ${SDL}/include)
        SET(SDL_LIBRARY SDL)
@@ -509,6 +584,24 @@ IF(APPLE)
        SET(TIFF_INC ${TIFF}/include)
 
        SET(EXETYPE MACOSX_BUNDLE)
+
+       SET(CMAKE_C_FLAGS_DEBUG "-fno-strict-aliasing -g")
+       SET(CMAKE_CXX_FLAGS_DEBUG "-fno-strict-aliasing -g")
+       IF(CMAKE_OSX_ARCHITECTURES MATCHES "i386")
+               SET(CMAKE_CXX_FLAGS_RELEASE "-O3 -mdynamic-no-pic -ftree-vectorize -msse -msse2 -fvariable-expansion-in-unroller")
+               SET(CMAKE_C_FLAGS_RELEASE "-O3 -mdynamic-no-pic -ftree-vectorize -msse -msse2 -fvariable-expansion-in-unroller")
+       ELSEIF(CMAKE_OSX_ARCHITECTURES MATCHES "x86_64")
+               SET(CMAKE_CXX_FLAGS_RELEASE "-O3 -mdynamic-no-pic -ftree-vectorize -msse -msse2 -msse3 -mssse3 -fvariable-expansion-in-unroller")
+               SET(CMAKE_C_FLAGS_RELEASE "-O3 -mdynamic-no-pic -ftree-vectorize -msse -msse2 -msse3 -mssse3 -fvariable-expansion-in-unroller")
+       ELSE(CMAKE_OSX_ARCHITECTURES MATCHES "x86_64")
+               SET(CMAKE_C_FLAGS_RELEASE "-mdynamic-no-pic -fno-strict-aliasing")
+               SET(CMAKE_CXX_FLAGS_RELEASE "-mdynamic-no-pic -fno-strict-aliasing")
+       ENDIF(CMAKE_OSX_ARCHITECTURES MATCHES "i386")
+
+       # Better warnings
+       SET(C_WARNINGS "-Wall -Wno-char-subscripts -Wpointer-arith -Wcast-align -Wdeclaration-after-statement -Wno-unknown-pragmas")
+       SET(CXX_WARNINGS "-Wall -Wno-invalid-offsetof -Wno-sign-compare")
+
 ENDIF(APPLE)
 
 IF(CMAKE_SYSTEM_NAME MATCHES "Linux")
@@ -517,16 +610,28 @@ IF(CMAKE_SYSTEM_NAME MATCHES "Linux")
 ENDIF(CMAKE_SYSTEM_NAME MATCHES "Linux")
 
 
-# TODO - buildinfo
-# IF(UNIX)
-#   IF(WITH_BUILDINFO)
-#     EXEC_PROGRAM("date \"+%Y-%m-%d\"" OUTPUT_VARIABLE BUILD_DATE)
-#     EXEC_PROGRAM("date \"+%H:%M:%S\"" OUTPUT_VARIABLE BUILD_TIME)  
-#     EXEC_PROGRAM("svnversion ${CMAKE_SOURCE_DIR}" OUTPUT_VARIABLE BUILD_REV)
-#     SET(BUILD_TYPE ${CMAKE_BUILD_TYPE})
-#   ENDIF(WITH_BUILDINFO)
-# ENDIF(UNIX)
-
+# buildinfo
+IF(WITH_BUILDINFO)
+       # BUILD_PLATFORM and BUILD_PLATFORM are taken from CMake
+       IF(UNIX)
+               EXEC_PROGRAM("date \"+%Y-%m-%d\"" OUTPUT_VARIABLE BUILD_DATE)
+               EXEC_PROGRAM("date \"+%H:%M:%S\"" OUTPUT_VARIABLE BUILD_TIME)  
+               EXEC_PROGRAM("svnversion ${CMAKE_SOURCE_DIR}" OUTPUT_VARIABLE BUILD_REV RETURN_VALUE BUILD_REV_RETURN)
+               IF(BUILD_REV_RETURN)
+                       SET(BUILD_REV "unknown")
+               ENDIF(BUILD_REV_RETURN)
+       ENDIF(UNIX)
+       
+       IF(WIN32)
+               EXEC_PROGRAM("cmd /c date /t" OUTPUT_VARIABLE BUILD_DATE)
+               EXEC_PROGRAM("cmd /c time /t" OUTPUT_VARIABLE BUILD_TIME)  
+               EXEC_PROGRAM("svnversion ${CMAKE_SOURCE_DIR}" OUTPUT_VARIABLE BUILD_REV RETURN_VALUE BUILD_REV_RETURN)
+               IF(BUILD_REV_RETURN)
+                       SET(BUILD_REV "unknown")
+               ENDIF(BUILD_REV_RETURN)
+       ENDIF(WIN32)
+ENDIF(WITH_BUILDINFO)
+       
 #-----------------------------------------------------------------------------
 # Common.
 
@@ -580,4 +685,3 @@ ADD_SUBDIRECTORY(source/creator)
 IF(WITH_PLAYER)
        ADD_SUBDIRECTORY(source/blenderplayer)
 ENDIF(WITH_PLAYER)
-