Add option for CMake to build libredcode, also use CODEC prefix for ffmpeg, quicktime...
[blender-staging.git] / CMakeLists.txt
index ecba5caf44cc1abf4cf97aef7b158d4d46886398..826288e5fdf6fd0581800cb3a24fa5141ad116e1 100644 (file)
@@ -87,25 +87,26 @@ OPTION(WITH_MOD_BOOLEAN             "Enable Boolean Modifier" ON)
 
 # Image format support
 OPTION(WITH_IMAGE_OPENEXR       "Enable OpenEXR Support (http://www.openexr.com)" ON)
-OPTION(WITH_IMAGE_OPENJPEG      "Enable OpenJpeg Support (http://www.openjpeg.org/)" OFF)
+OPTION(WITH_IMAGE_OPENJPEG      "Enable OpenJpeg Support (http://www.openjpeg.org)" ON)
 OPTION(WITH_IMAGE_TIFF          "Enable LibTIFF Support" ON)
 OPTION(WITH_IMAGE_DDS           "Enable DDS Image Support" ON)
 OPTION(WITH_IMAGE_CINEON        "Enable CINEON and DPX Image Support" ON)
 OPTION(WITH_IMAGE_HDR           "Enable HDR Image Support" ON)
+OPTION(WITH_IMAGE_REDCODE       "Enable RedCode Image Support" ON)
 
-# Audio format support
-OPTION(WITH_FFMPEG        "Enable FFMPeg Support (http://ffmpeg.mplayerhq.hu/)" OFF)
-OPTION(WITH_SNDFILE       "Enable libsndfile Support (http://www.mega-nerd.com/libsndfile)" OFF)
+# Audio/Video format support
+OPTION(WITH_CODEC_FFMPEG        "Enable FFMPeg Support (http://ffmpeg.mplayerhq.hu)" OFF)
+OPTION(WITH_CODEC_SNDFILE       "Enable libsndfile Support (http://www.mega-nerd.com/libsndfile)" OFF)
 IF(APPLE OR (WIN32 AND NOT UNIX))
-       OPTION(WITH_QUICKTIME     "Enable Quicktime Support" OFF)
+       OPTION(WITH_CODEC_QUICKTIME     "Enable Quicktime Support" OFF)
 ENDIF(APPLE OR (WIN32 AND NOT UNIX))
 
 # 3D format support
 # disable opencollada on non-apple unix because opencollada has no package for debian
 IF(UNIX AND NOT APPLE)
-       OPTION(WITH_OPENCOLLADA         "Enable OpenCollada Support (http://www.opencollada.org/)"      OFF)
+       OPTION(WITH_OPENCOLLADA         "Enable OpenCollada Support (http://www.opencollada.org)"       OFF)
 ELSE()
-       OPTION(WITH_OPENCOLLADA         "Enable OpenCollada Support (http://www.opencollada.org/)"      OFF)
+       OPTION(WITH_OPENCOLLADA         "Enable OpenCollada Support (http://www.opencollada.org)"       OFF)
 ENDIF()
 
 # Sound output
@@ -134,17 +135,21 @@ ENDIF(APPLE)
 # OPTION(WITH_LCMS          "Enable color correction with lcms" OFF)
 
 IF(NOT WITH_GAMEENGINE AND WITH_PLAYER)
-       MESSAGE(FATAL_ERROR "WITH_PLAYER needs WITH_GAMEENGINE")
+       MESSAGE(FATAL_ERROR "WITH_PLAYER requires WITH_GAMEENGINE")
 ENDIF(NOT WITH_GAMEENGINE AND WITH_PLAYER)
 
 IF(NOT WITH_INSTALL AND WITH_PYTHON_INSTALL)
-       MESSAGE("WARNING: WITH_PYTHON_INSTALL needs WITH_INSTALL")
+       MESSAGE("WARNING: WITH_PYTHON_INSTALL requires WITH_INSTALL")
 ENDIF(NOT WITH_INSTALL AND WITH_PYTHON_INSTALL)
 
 IF(NOT WITH_SAMPLERATE AND (WITH_OPENAL OR WITH_SDL OR WITH_JACK))
-       MESSAGE(FATAL_ERROR "WITH_OPENAL/WITH_SDL/WITH_JACK need WITH_SAMPLERATE")
+       MESSAGE(FATAL_ERROR "WITH_OPENAL/WITH_SDL/WITH_JACK require WITH_SAMPLERATE")
 ENDIF(NOT WITH_SAMPLERATE AND (WITH_OPENAL OR WITH_SDL OR WITH_JACK))
 
+IF(NOT WITH_IMAGE_OPENJPEG AND WITH_IMAGE_REDCODE)
+       MESSAGE(FATAL_ERROR "WITH_IMAGE_REDCODE requires WITH_IMAGE_OPENJPEG")
+ENDIF(NOT WITH_IMAGE_OPENJPEG AND WITH_IMAGE_REDCODE)
+
 TEST_SSE_SUPPORT()
 
 # disabled for now, not supported
@@ -177,12 +182,12 @@ IF(UNIX AND NOT APPLE)
                SET(JACK_LIBPATH ${JACK}/lib)
        ENDIF(WITH_JACK)
 
-       IF(WITH_SNDFILE)
-       SET(SNDFILE /usr)
-       SET(SNDFILE_INC ${SNDFILE}/include)
-       SET(SNDFILE_LIB sndfile)
-       SET(SNDFILE_LIBPATH ${SNDFILE}/lib)
-       ENDIF(WITH_SNDFILE)
+       IF(WITH_CODEC_SNDFILE)
+               SET(SNDFILE /usr)
+               SET(SNDFILE_INC ${SNDFILE}/include)
+               SET(SNDFILE_LIB sndfile)
+               SET(SNDFILE_LIBPATH ${SNDFILE}/lib)
+       ENDIF(WITH_CODEC_SNDFILE)
 
        IF(WITH_INTERNATIONAL)
                FIND_LIBRARY(INTL_LIBRARY
@@ -269,13 +274,13 @@ IF(UNIX AND NOT APPLE)
                SET(LCMS_LIBPATH ${LCMS}/lib)
        ENDIF(WITH_LCMS)
 
-       IF(WITH_FFMPEG)
+       IF(WITH_CODEC_FFMPEG)
                SET(FFMPEG /usr CACHE FILEPATH "FFMPEG Directory")
                SET(FFMPEG_INC ${FFMPEG}/include)
                SET(FFMPEG_LIB avformat avcodec avutil avdevice swscale CACHE STRING "FFMPEG Libraries")
                SET(FFMPEG_LIBPATH ${FFMPEG}/lib)
                SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D__STDC_CONSTANT_MACROS")
-       ENDIF(WITH_FFMPEG)
+       ENDIF(WITH_CODEC_FFMPEG)
 
        IF(WITH_FFTW3)
                SET(FFTW3 /usr)
@@ -406,12 +411,12 @@ ELSEIF(WIN32)
                SET(OPENAL_LIBPATH ${OPENAL}/lib)
        ENDIF(WITH_OPENAL)
 
-       IF(WITH_SNDFILE)
+       IF(WITH_CODEC_SNDFILE)
                SET(SNDFILE ${LIBDIR}/sndfile)
                SET(SNDFILE_INC ${SNDFILE}/include)
                SET(SNDFILE_LIB libsndfile-1)
                SET(SNDFILE_LIBPATH ${SNDFILE}/lib)
-       ENDIF(WITH_SNDFILE)
+       ENDIF(WITH_CODEC_SNDFILE)
 
        IF(WITH_SDL)
                SET(SDL ${LIBDIR}/sdl)
@@ -420,12 +425,12 @@ ELSEIF(WIN32)
                SET(SDL_LIBPATH ${SDL}/lib)
        ENDIF(WITH_SDL)
 
-       IF(WITH_QUICKTIME)
+       IF(WITH_CODEC_QUICKTIME)
                SET(QUICKTIME ${LIBDIR}/QTDevWin)
                SET(QUICKTIME_INC ${QUICKTIME}/CIncludes)
                SET(QUICKTIME_LIB qtmlClient)
                SET(QUICKTIME_LIBPATH ${QUICKTIME}/Libraries)
-       ENDIF(WITH_QUICKTIME)
+       ENDIF(WITH_CODEC_QUICKTIME)
 
        IF(WITH_RAYOPTIMIZATION AND SUPPORT_SSE_BUILD)
                ADD_DEFINITIONS(-D__SSE__ -D__MMX__)
@@ -517,12 +522,12 @@ ELSEIF(WIN32)
                        SET(LCMS_LIB lcms)
                ENDIF(WITH_LCMS)
 
-               IF(WITH_FFMPEG)
+               IF(WITH_CODEC_FFMPEG)
                        SET(FFMPEG ${LIBDIR}/ffmpeg)
                        SET(FFMPEG_INC ${FFMPEG}/include ${FFMPEG}/include/msvc)
                        SET(FFMPEG_LIB avcodec-52 avformat-52 avdevice-52 avutil-50 swscale-0)
                        SET(FFMPEG_LIBPATH ${FFMPEG}/lib)
-               ENDIF(WITH_FFMPEG)
+               ENDIF(WITH_CODEC_FFMPEG)
 
                IF(WITH_IMAGE_OPENEXR)
                        SET(OPENEXR ${LIBDIR}/openexr)
@@ -629,12 +634,12 @@ ELSEIF(WIN32)
                        SET(PCRE_LIB pcre)
                ENDIF(WITH_OPENCOLLADA)
                
-               IF(WITH_FFMPEG)
+               IF(WITH_CODEC_FFMPEG)
                        SET(FFMPEG ${LIBDIR}/ffmpeg)
                        SET(FFMPEG_INC ${FFMPEG}/include ${FFMPEG}/include)
                        SET(FFMPEG_LIB avcodec-52 avformat-52 avdevice-52 avutil-50 swscale-0)
                        SET(FFMPEG_LIBPATH ${FFMPEG}/lib)
-               ENDIF(WITH_FFMPEG)
+               ENDIF(WITH_CODEC_FFMPEG)
 
                IF(WITH_IMAGE_OPENEXR)
                        SET(OPENEXR ${LIBDIR}/gcc/openexr)
@@ -707,12 +712,12 @@ ELSEIF(APPLE)
                SET(JACK_LIBPATH ${JACK}/lib)
        ENDIF(WITH_JACK)
 
-       IF(WITH_SNDFILE)
+       IF(WITH_CODEC_SNDFILE)
                SET(SNDFILE ${LIBDIR}/sndfile)
                SET(SNDFILE_INC ${SNDFILE}/include)
                SET(SNDFILE_LIB sndfile FLAC ogg vorbis vorbisenc)
                SET(SNDFILE_LIBPATH ${SNDFILE}/lib ${FFMPEG}/lib)
-       ENDIF(WITH_SNDFILE)
+       ENDIF(WITH_CODEC_SNDFILE)
 
        SET(PYTHON_VERSION 3.1)
 
@@ -777,13 +782,13 @@ ELSEIF(APPLE)
                SET(LCMS_LIBPATH ${LCMS}/lib)
        ENDIF(WITH_LCMS)
 
-       IF(WITH_FFMPEG)
+       IF(WITH_CODEC_FFMPEG)
                SET(FFMPEG ${LIBDIR}/ffmpeg)
                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(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D__STDC_CONSTANT_MACROS")
-       ENDIF(WITH_FFMPEG)
+       ENDIF(WITH_CODEC_FFMPEG)
 
        IF(WITH_SAMPLERATE)
                SET(LIBSAMPLERATE ${LIBDIR}/samplerate)
@@ -804,7 +809,7 @@ ELSEIF(APPLE)
                                SET(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -framework QuickTime")
                                #libSDL still needs 32bit carbon quicktime 
                        ENDIF(CMAKE_OSX_ARCHITECTURES MATCHES i386)
-               ELSEIF(WITH_QUICKTIME)
+               ELSEIF(WITH_CODEC_QUICKTIME)
                        SET(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -framework QuickTime")
                ENDIF(USE_QTKIT)
        ELSE (WITH_COCOA)
@@ -914,9 +919,13 @@ ENDIF(WITH_RAYOPTIMIZATION)
 IF(WITH_IMAGE_OPENJPEG)
        set(OPENJPEG ${CMAKE_SOURCE_DIR}/extern/libopenjpeg)
        set(OPENJPEG_INC ${OPENJPEG})
-       set(OPENJPEG_LIb extern_openjpeg)
 ENDIF(WITH_IMAGE_OPENJPEG)
 
+IF(WITH_IMAGE_REDCODE)
+       set(REDCODE ${CMAKE_SOURCE_DIR}/extern)
+       set(REDCODE_INC ${REDCODE})
+ENDIF(WITH_IMAGE_REDCODE)
+
 #-----------------------------------------------------------------------------
 # Blender WebPlugin