2.5 - Start of Make Proxy Operator
[blender.git] / CMakeLists.txt
index 5b86ca8f21e5a81e2f52d4f9ded2f9eb74a55bcb..fc6a3d3ade8067a7ea2a3318ec750013ee64dc22 100644 (file)
@@ -57,13 +57,17 @@ OPTION(WITH_PLAYER          "Build Player"                                          OFF)
 OPTION(WITH_GAMEENGINE         "Enable Game Engine"                                    ON)
 OPTION(WITH_BULLET             "Enable Bullet (Physics Engine)"                        ON)
 OPTION(WITH_INTERNATIONAL      "Enable I18N   (International fonts and text)"          ON)
-OPTION(WITH_VERSE              "Enable Verse  (http://verse.blender.org)"              OFF)
 OPTION(WITH_ELBEEM             "Enable Elbeem (Fluid Simulation)"                      ON)
 OPTION(WITH_QUICKTIME          "Enable Quicktime Support"                              OFF)
 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)
 
 IF(NOT WITH_GAMEENGINE AND WITH_PLAYER)
   MESSAGE("WARNING: WITH_PLAYER needs WITH_GAMEENGINE")
@@ -84,49 +88,27 @@ INCLUDE(CMake/macros.cmake)
 #-----------------------------------------------------------------------------
 #Platform specifics
 
-IF(UNIX)
-  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)
-
-  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)
+IF(UNIX AND NOT APPLE)
+  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)
 
   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})
@@ -145,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
@@ -170,16 +154,16 @@ 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++")
+  SET(LLIBS "-lXi -lutil -lc -lm -lpthread -lstdc++ -lX11 -ldl")
 
   IF(WITH_OPENMP)
     SET(LLIBS "${LLIBS} -lgomp")
@@ -192,12 +176,16 @@ IF(UNIX)
 
   SET(PLATFORM_LINKFLAGS "-pthread")
 
-  INCLUDE_DIRECTORIES(/usr/include /usr/local/include)
-ENDIF(UNIX)
+  # Better warnings
+  SET(C_WARNINGS "-Wall -Wno-char-subscripts -Wpointer-arith -Wcast-align -Wnested-externs -Wdeclaration-after-statement")
+
+  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)
 
@@ -208,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)
@@ -248,7 +236,11 @@ IF(WIN32)
   
   SET(GETTEXT ${LIBDIR}/gettext)
   SET(GETTEXT_INC ${GETTEXT}/include)
-  SET(GETTEXT_LIB gnu_gettext)
+  IF(CMAKE_CL_64)
+       SET(GETTEXT_LIB gettextlib)
+  ELSE(CMAKE_CL_64)
+       SET(GETTEXT_LIB gnu_gettext)
+  ENDIF(CMAKE_CL_64)
   SET(GETTEXT_LIBPATH ${GETTEXT}/lib)
 
   SET(FREETYPE ${LIBDIR}/freetype)
@@ -276,10 +268,15 @@ 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)
+  SET(LLIBS kernel32 user32 vfw32 winmm ws2_32 )
+  ELSE(CMAKE_CL_64)
   SET(LLIBS kernel32 user32 gdi32 comdlg32 advapi32 shell32 ole32 oleaut32 uuid ws2_32 vfw32 winmm)
+  ENDIF(CMAKE_CL_64)
+  
   IF(WITH_OPENAL)
     SET(LLIBS ${LLIBS} dxguid)
   ENDIF(WITH_OPENAL)
@@ -317,7 +314,7 @@ IF(WIN32)
   SET(WINTAB_INC ${LIBDIR}/wintab/include) 
 
   IF(CMAKE_CL_64)
-  SET(PLATFORM_LINKFLAGS "/NODEFAULTLIB:libc.lib;MSVCRT.lib ")
+  SET(PLATFORM_LINKFLAGS "/MANIFEST:NO /MANIFESTUAC:NO /MACHINE:X64 /NODEFAULTLIB:libc.lib;MSVCRT.lib ")
   ELSE(CMAKE_CL_64)
   SET(PLATFORM_LINKFLAGS "/NODEFAULTLIB:libc.lib ")
   ENDIF(CMAKE_CL_64)
@@ -331,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 /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")
+  SET(PYTHON_VERSION 3.1)
+
+  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)
@@ -411,16 +426,25 @@ ENDIF(CMAKE_SYSTEM_NAME MATCHES "Linux")
 
 #-----------------------------------------------------------------------------
 # Common.
-SET(VERSE_INC ${CMAKE_SOURCE_DIR}/extern/verse/dist)
 
-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
+
+IF(WITH_WEBPLUGIN) 
+  SET(GECKO_DIR "${CMAKE_SOURCE_DIR}/../gecko-sdk/" CACHE PATH "Gecko SDK path")
+  SET(WEBPLUGIN_SANDBOX_MODE "apparmor" CACHE STRING "WEB Plugin sandbox mode, can be apparmor, privsep, none")
+
+  SET(WITH_PLAYER ON)
+ENDIF(WITH_WEBPLUGIN)
 
 
 #-----------------------------------------------------------------------------
 # Configure OpenGL.
-INCLUDE(${CMAKE_ROOT}/Modules/FindOpenGL.cmake)
+FIND_PACKAGE(OpenGL)
 INCLUDE_DIRECTORIES(${OPENGL_INCLUDE_DIR})
 #-----------------------------------------------------------------------------
 # Extra compile flags
@@ -430,25 +454,24 @@ ENDIF(WITH_GAMEENGINE)
 IF(WITH_BULLET)
   SET(PLATFORM_CFLAGS "${PLATFORM_CFLAGS} -DWITH_BULLET ")
 ENDIF(WITH_BULLET)
-SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${PLATFORM_CFLAGS} ")
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${PLATFORM_CFLAGS} ${C_WARNINGS}")
 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)