2.5 - Start of Make Proxy Operator
[blender.git] / CMakeLists.txt
index 0df36f04173a86ace7bfa75710100e765215789f..fc6a3d3ade8067a7ea2a3318ec750013ee64dc22 100644 (file)
@@ -63,10 +63,11 @@ OPTION(WITH_OPENEXR         "Enable OpenEXR Support (http://www.openexr.com)"       ON)
 OPTION(WITH_DDS                        "Enable DDS Support"                                    ON)
 OPTION(WITH_FFMPEG             "Enable FFMPeg Support (http://ffmpeg.mplayerhq.hu/)"   OFF)
 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_YAFRAY             "Enable Yafray (Renderer)"                              OFF)
 
 IF(NOT WITH_GAMEENGINE AND WITH_PLAYER)
   MESSAGE("WARNING: WITH_PLAYER needs WITH_GAMEENGINE")
@@ -87,9 +88,9 @@ INCLUDE(CMake/macros.cmake)
 #-----------------------------------------------------------------------------
 #Platform specifics
 
-IF(UNIX)
+IF(UNIX AND NOT APPLE)
   IF(WITH_OPENAL)
-    INCLUDE(${CMAKE_ROOT}/Modules/FindOpenAL.cmake)
+    FIND_PACKAGE(OpenAL)
     IF(OPENAL_FOUND)
       SET(WITH_OPENAL ON)
       SET(OPENAL_LIB ${OPENAL_LIBRARY})
@@ -99,39 +100,15 @@ IF(UNIX)
     ENDIF(OPENAL_FOUND)
   ENDIF(WITH_OPENAL)
 
-  FIND_LIBRARY(ALUT_LIBRARY
-    NAMES alut
-    PATHS
-    /usr/local/lib
-    /usr/lib
-    /sw/lib
-    /opt/local/lib
-    /opt/csw/lib
-    /opt/lib
-  )
-  IF(ALUT_LIBRARY)
-    SET(OPENAL_LIB ${OPENAL_LIB} ${ALUT_LIBRARY})
-  ENDIF(ALUT_LIBRARY)
-
   FIND_LIBRARY(INTL_LIBRARY
     NAMES intl
     PATHS
-    /usr/local/lib
-    /usr/lib
     /sw/lib
-    /opt/local/lib
-    /opt/csw/lib
-    /opt/lib
   )
   FIND_LIBRARY(ICONV_LIBRARY
     NAMES iconv
     PATHS
-    /usr/local/lib
-    /usr/lib
     /sw/lib
-    /opt/local/lib
-    /opt/csw/lib
-    /opt/lib
   )
   IF(INTL_LIBRARY AND ICONV_LIBRARY)
     SET(GETTEXT_LIB ${INTL_LIBRARY} ${ICONV_LIBRARY})
@@ -150,16 +127,18 @@ IF(UNIX)
   )
   SET(FREETYPE_LIB freetype)
 
-  INCLUDE(${CMAKE_ROOT}/Modules/FindPythonLibs.cmake)
+  FIND_PACKAGE(PythonLibs)
   SET(PYTHON_INC "${PYTHON_INCLUDE_PATH}" CACHE STRING "")
   SET(PYTHON_LIB "${PYTHON_LIBRARIES}" CACHE STRING "")
-  INCLUDE(${CMAKE_ROOT}/Modules/FindPythonInterp.cmake)
+  FIND_PACKAGE(PythonInterp)
   SET(PYTHON_BINARY ${PYTHON_EXECUTABLE} CACHE STRING "")
   SET(PYTHON_LINKFLAGS "-Xlinker -export-dynamic")
 
-  INCLUDE(${CMAKE_ROOT}/Modules/FindSDL.cmake)
-  SET(SDL_INC ${SDL_INCLUDE_DIR})
-  SET(SDL_LIB ${SDL_LIBRARY})
+  IF(WITH_SDL)
+    FIND_PACKAGE(SDL)
+    SET(SDL_INC ${SDL_INCLUDE_DIR})
+    SET(SDL_LIB ${SDL_LIBRARY})
+  ENDIF(WITH_SDL)
 
   FIND_PATH(OPENEXR_INC
     ImfXdr.h
@@ -175,14 +154,14 @@ IF(UNIX)
 
   SET(FFMPEG /usr)
   SET(FFMPEG_INC ${FFMPEG}/include)
-  SET(FFMPEG_LIB avformat avcodec avutil)
+  SET(FFMPEG_LIB avformat avcodec avutil avdevice swscale)
   SET(FFMPEG_LIBPATH ${FFMPEG}/lib)
 
-  SET(JPEG_LIB jpeg)
+  FIND_PACKAGE(JPEG REQUIRED)
 
-  SET(PNG_LIB png)
+  FIND_PACKAGE(PNG REQUIRED)
 
-  SET(ZLIB_LIB z)
+  FIND_PACKAGE(ZLIB REQUIRED)
 
   SET(LLIBS "-lXi -lutil -lc -lm -lpthread -lstdc++ -lX11 -ldl")
 
@@ -198,14 +177,15 @@ IF(UNIX)
   SET(PLATFORM_LINKFLAGS "-pthread")
 
   # Better warnings
-  SET(C_WARNINGS "-Wall -Wno-char-subscripts -Wpointer-arith -Wcast-align -Waggregate-return -Wnested-externs -Wdeclaration-after-statement")
+  SET(C_WARNINGS "-Wall -Wno-char-subscripts -Wpointer-arith -Wcast-align -Wnested-externs -Wdeclaration-after-statement")
 
-  INCLUDE_DIRECTORIES(/usr/include /usr/local/include)
-ENDIF(UNIX)
+  INCLUDE_DIRECTORIES(${JPEG_INCLUDE_DIR} ${PNG_INCLUDE_DIR} ${ZLIB_INCLUDE_DIR} )
+ENDIF(UNIX AND NOT APPLE)
 
 IF(WIN32)
 
-  INCLUDE(${CMAKE_ROOT}/Modules/Platform/Windows-cl.cmake)
+  # this file is included anyway when building under Windows with cl.exe
+  #  INCLUDE(${CMAKE_ROOT}/Modules/Platform/Windows-cl.cmake)
   
   SET(LIBDIR ${CMAKE_SOURCE_DIR}/../lib/windows)
 
@@ -216,32 +196,32 @@ IF(WIN32)
   ENDIF(CMAKE_CL_64)
 
   SET(PYTHON ${LIBDIR}/python)
-  SET(PYTHON_VERSION 2.5)
+  SET(PYTHON_VERSION 2.6)
   SET(PYTHON_INC "${PYTHON}/include/python${PYTHON_VERSION}")
   SET(PYTHON_BINARY python)
-  SET(PYTHON_LIB python25)
+  SET(PYTHON_LIB python26)
   SET(PYTHON_LIBPATH ${PYTHON}/lib)
 
-  #SET(WITH_OPENAL ON)
-  SET(OPENAL ${LIBDIR}/openal)
-  SET(OPENAL_INC ${OPENAL}/include ${OPENAL}/include/AL)
-  SET(OPENAL_LIB openal_static)
-  SET(OPENAL_LIBPATH ${OPENAL}/lib)
-
   IF(CMAKE_CL_64)
-       SET(PNG_LIB libpng)
+    SET(WITH_OPENAL OFF)
   ELSE(CMAKE_CL_64)
-       SET(PNG_LIB libpng_st)
+    #SET(WITH_OPENAL ON)
+    SET(OPENAL ${LIBDIR}/openal)
+    SET(OPENAL_INC ${OPENAL}/include ${OPENAL}/include/AL)
+    SET(OPENAL_LIB openal_static)
+    SET(OPENAL_LIBPATH ${OPENAL}/lib)
   ENDIF(CMAKE_CL_64)
-  SET(JPEG_LIB libjpeg)
 
-  SET(ZLIB ${LIBDIR}/zlib)
-  SET(ZLIB_INC ${ZLIB}/include)
   IF(CMAKE_CL_64)
-       SET(ZLIB_LIB zlib)
+       SET(PNG_LIBRARIES libpng)
   ELSE(CMAKE_CL_64)
-       SET(ZLIB_LIB libz)
+    SET(PNG_LIBRARIES libpng_st)
   ENDIF(CMAKE_CL_64)
+  SET(JPEG_LIBRARY libjpeg)
+
+  SET(ZLIB ${LIBDIR}/zlib)
+  SET(ZLIB_INC ${ZLIB}/include)
+  SET(ZLIB_LIBRARIES zlib)
   SET(ZLIB_LIBPATH ${ZLIB}/lib)
   
   SET(PTHREADS ${LIBDIR}/pthreads)
@@ -288,7 +268,7 @@ IF(WIN32)
 
   SET(FFMPEG ${LIBDIR}/ffmpeg)
   SET(FFMPEG_INC ${FFMPEG}/include)
-  SET(FFMPEG_LIB avcodec-51 avformat-52 avdevice-52 avutil-49 swscale-0)
+  SET(FFMPEG_LIB avcodec-52 avformat-52 avdevice-52 avutil-50 swscale-0)
   SET(FFMPEG_LIBPATH ${FFMPEG}/lib)
 
   IF(CMAKE_CL_64)
@@ -348,34 +328,52 @@ IF(APPLE)
     SET(LIBDIR ${CMAKE_SOURCE_DIR}/../lib/darwin-6.1-powerpc)
   ENDIF(CMAKE_OSX_ARCHITECTURES MATCHES i386)
 
-  INCLUDE(${CMAKE_ROOT}/Modules/FindOpenAL.cmake)
-  IF(OPENAL_FOUND)
-    SET(WITH_OPENAL ON)
-    SET(OPENAL_LIB ${OPENAL_LIBRARY})
-    SET(OPENAL_INC ${OPENAL_INCLUDE_DIR})
-  ELSE(OPENAL_FOUND)
-    SET(WITH_OPENAL OFF)
-  ENDIF(OPENAL_FOUND)
+  IF(WITH_OPENAL)
+    FIND_PACKAGE(OpenAL)
+    IF(OPENAL_FOUND)
+      SET(WITH_OPENAL ON)
+      SET(OPENAL_LIB ${OPENAL_LIBRARY})
+      SET(OPENAL_INC ${OPENAL_INCLUDE_DIR})
+    ELSE(OPENAL_FOUND)
+      SET(WITH_OPENAL OFF)
+    ENDIF(OPENAL_FOUND)
+  ENDIF(WITH_OPENAL)
+
+
+  SET(PYTHON_VERSION 3.1)
 
-  SET(PYTHON /System/Library/Frameworks/Python.framework/Versions/)
-  SET(PYTHON_VERSION 2.3)
-  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_LIB "")
-  SET(PYTHON_LIBPATH ${PYTHON}${PYTHON_VERSION}/lib/python${PYTHON_VERSION}/config CACHE STRING "")
-  SET(PYTHON_LINKFLAGS "-u __dummy -u _PyMac_Error -framework System -framework Python")
+  IF(PYTHON_VERSION MATCHES 3.1)
+    # 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 "")
+    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
+  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 "")
+    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")
+  ENDIF(PYTHON_VERSION MATCHES 3.1)
 
   SET(GETTEXT ${LIBDIR}/gettext)
   SET(GETTEXT_INC "${GETTEXT}/include")
   SET(GETTEXT_LIB intl iconv)
   SET(GETTEXT_LIBPATH ${GETTEXT}/lib)
 
-  SET(PNG_LIB png)
-  SET(JPEG_LIB jpeg)
+  SET(PNG_LIBRARIES png)
+  SET(JPEG_LIBRARY jpeg)
 
   SET(ZLIB /usr)
   SET(ZLIB_INC "${ZLIB}/include")
-  SET(ZLIB_LIB z)
+  SET(ZLIB_LIBRARIES z)
 
   SET(FREETYPE ${LIBDIR}/freetype)
   SET(FREETYPE_INC ${FREETYPE}/include ${FREETYPE}/include/freetype2)
@@ -429,10 +427,9 @@ ENDIF(CMAKE_SYSTEM_NAME MATCHES "Linux")
 #-----------------------------------------------------------------------------
 # Common.
 
-SET(FTGL ${CMAKE_SOURCE_DIR}/extern/bFTGL)
-SET(FTGL_INC ${FTGL}/include)
-SET(FTGL_LIB extern_ftgl)
-
+set(OPENJPEG ${CMAKE_SOURCE_DIR}/extern/libopenjpeg)
+set(OPENJPEG_INC ${OPENJPEG})
+set(OPENJPEG_LIb extern_libopenjpeg)
 
 #-----------------------------------------------------------------------------
 # Blender WebPlugin
@@ -447,7 +444,7 @@ ENDIF(WITH_WEBPLUGIN)
 
 #-----------------------------------------------------------------------------
 # Configure OpenGL.
-INCLUDE(${CMAKE_ROOT}/Modules/FindOpenGL.cmake)
+FIND_PACKAGE(OpenGL)
 INCLUDE_DIRECTORIES(${OPENGL_INCLUDE_DIR})
 #-----------------------------------------------------------------------------
 # Extra compile flags
@@ -463,20 +460,18 @@ SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${PLATFORM_CFLAGS} ")
 #-----------------------------------------------------------------------------
 # Libraries
 FILE(WRITE ${CMAKE_BINARY_DIR}/cmake_blender_libs.txt "")
-SUBDIRS(
-  intern
-  extern
-  source
-)
+ADD_SUBDIRECTORY(intern)
+ADD_SUBDIRECTORY(extern)
+ADD_SUBDIRECTORY(source)
 
 
 #-----------------------------------------------------------------------------
 # Blender Application
-SUBDIRS(source/creator)
+ADD_SUBDIRECTORY(source/creator)
 
 
 #-----------------------------------------------------------------------------
 # Blender Player
 IF(WITH_PLAYER)
-  SUBDIRS(blenderplayer)
+  ADD_SUBDIRECTORY(blenderplayer)
 ENDIF(WITH_PLAYER)