* CMake fixes, mustn't have come through in the merge
authorMatt Ebb <matt@mke3.net>
Wed, 19 Aug 2009 21:47:47 +0000 (21:47 +0000)
committerMatt Ebb <matt@mke3.net>
Wed, 19 Aug 2009 21:47:47 +0000 (21:47 +0000)
CMakeLists.txt

index edbb66290d360c8897ee4fb4767a147d47cdcc1e..00d2244511fdd992e8c39fd6b8c9d11c47b08848 100644 (file)
@@ -53,22 +53,25 @@ SET(LIBRARY_OUTPUT_PATH  ${CMAKE_BINARY_DIR}/lib)
 
 #-----------------------------------------------------------------------------
 # Set default config options
-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_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)
-OPTION(WITH_FFTW3              "Enable FFTW3 support"                          OFF)
+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_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)
+OPTION(WITH_FFTW3         "Enable FFTW3 support" OFF)
+OPTION(WITH_JACK          "Enable Jack Support (http://www.jackaudio.org)" OFF)
+OPTION(WITH_CXX_GUARDEDALLOC "Enable GuardedAlloc for C++ memory allocation" OFF)
+OPTION(WITH_INSTALL       "Install accompanying scripts and language files needed to run blender" ON)
 
 IF(NOT WITH_GAMEENGINE AND WITH_PLAYER)
   MESSAGE("WARNING: WITH_PLAYER needs WITH_GAMEENGINE")
@@ -94,13 +97,18 @@ IF(UNIX AND NOT APPLE)
     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)
 
+  IF(WITH_JACK)
+    SET(JACK /usr)
+    SET(JACK_INC ${JACK}/include/jack)
+    SET(JACK_LIB jack)
+    SET(JACK_LIBPATH ${JACK}/lib)
+  ENDIF(WITH_JACK)
+
   FIND_LIBRARY(INTL_LIBRARY
     NAMES intl
     PATHS
@@ -111,34 +119,34 @@ IF(UNIX AND NOT APPLE)
     PATHS
     /sw/lib
   )
+  
   IF(INTL_LIBRARY AND ICONV_LIBRARY)
     SET(GETTEXT_LIB ${INTL_LIBRARY} ${ICONV_LIBRARY})
   ENDIF(INTL_LIBRARY AND ICONV_LIBRARY)
-  
-  FIND_PATH(FREETYPE_INC
-    freetype
-    PATHS
-    /usr/local/include/freetype2
-    /usr/include/freetype2
-    /sw/include/freetype2
-    /opt/local/include/freetype2
-    /opt/csw/include/freetype2
-    /opt/include/freetype2
-    NO_DEFAULT_PATH
-  )
-  SET(FREETYPE_LIB freetype)
 
-  FIND_PACKAGE(PythonLibs)
-  SET(PYTHON_INC "${PYTHON_INCLUDE_PATH}" CACHE STRING "")
-  SET(PYTHON_LIB "${PYTHON_LIBRARIES}" CACHE STRING "")
-  FIND_PACKAGE(PythonInterp)
-  SET(PYTHON_BINARY ${PYTHON_EXECUTABLE} CACHE STRING "")
+  FIND_PACKAGE(Freetype)
+  # UNSET(FREETYPE_INCLUDE_DIRS CACHE) # cant use
+
+  # No way to set py31. remove for now.
+  # FIND_PACKAGE(PythonLibs)
+  SET(PYTHON /usr)
+  SET(PYTHON_VERSION 3.1)
+  SET(PYTHON_INC "${PYTHON}/include/python${PYTHON_VERSION}" CACHE STRING "")
+  # SET(PYTHON_BINARY python) # not used yet
+  SET(PYTHON_LIB python${PYTHON_VERSION} CACHE STRING "")
+  SET(PYTHON_LIBPATH ${PYTHON}/lib CACHE STRING "")
+  
+  # FIND_PACKAGE(PythonInterp) # not used yet
+  # SET(PYTHON_BINARY ${PYTHON_EXECUTABLE} CACHE STRING "")
+  
   SET(PYTHON_LINKFLAGS "-Xlinker -export-dynamic")
 
   IF(WITH_SDL)
     FIND_PACKAGE(SDL)
-    SET(SDL_INC ${SDL_INCLUDE_DIR})
-    SET(SDL_LIB ${SDL_LIBRARY})
+    # UNSET(SDLMAIN_LIBRARY CACHE)
+    IF(NOT SDL_FOUND)
+      SET(WITH_SDL OFF)
+    ENDIF(NOT SDL_FOUND)
   ENDIF(WITH_SDL)
 
   FIND_PATH(OPENEXR_INC
@@ -159,10 +167,10 @@ IF(UNIX AND NOT APPLE)
   SET(FFMPEG_LIBPATH ${FFMPEG}/lib)
   
   IF(WITH_FFTW3)
-         SET(FFTW3 /usr)
-         SET(FFTW3_INC ${FFTW3}/include)
-         SET(FFTW3_LIB fftw3)
-         SET(FFTW3_LIBPATH ${FFTW3}/lib)
+    SET(FFTW3 /usr)
+    SET(FFTW3_INC ${FFTW3}/include)
+    SET(FFTW3_LIB fftw3)
+    SET(FFTW3_LIBPATH ${FFTW3}/lib)
   ENDIF(WITH_FFTW3)
 
   SET(LIBSAMPLERATE /usr)
@@ -176,7 +184,13 @@ IF(UNIX AND NOT APPLE)
 
   FIND_PACKAGE(ZLIB REQUIRED)
 
-  SET(LLIBS "-lXi -lutil -lc -lm -lpthread -lstdc++ -lX11 -ldl")
+  # Could use ${X11_Xinput_LIB} ${X11_X11_LIB} too
+  SET(LLIBS "-lXi -lutil -lc -lm -lpthread -lstdc++ -lX11")
+
+  IF(CMAKE_SYSTEM_NAME MATCHES "Linux")
+    # BSD's dont use libdl.so
+    SET(LLIBS "${LLIBS} -ldl")
+  ENDIF(CMAKE_SYSTEM_NAME MATCHES "Linux")
 
   IF(WITH_OPENMP)
     SET(LLIBS "${LLIBS} -lgomp")
@@ -191,6 +205,7 @@ IF(UNIX AND NOT APPLE)
 
   # Better warnings
   SET(C_WARNINGS "-Wall -Wno-char-subscripts -Wpointer-arith -Wcast-align -Wnested-externs -Wdeclaration-after-statement")
+  SET(CXX_WARNINGS "-Wall -Wno-invalid-offsetof -Wno-sign-compare")
 
   INCLUDE_DIRECTORIES(${JPEG_INCLUDE_DIR} ${PNG_INCLUDE_DIR} ${ZLIB_INCLUDE_DIR} )
 ENDIF(UNIX AND NOT APPLE)
@@ -211,22 +226,29 @@ IF(WIN32)
   SET(PYTHON ${LIBDIR}/python)
   SET(PYTHON_VERSION 3.1)
   SET(PYTHON_INC "${PYTHON}/include/python${PYTHON_VERSION}")
-  SET(PYTHON_BINARY python)
+  # SET(PYTHON_BINARY python) # not used yet
   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_INC ${OPENAL}/include)
-       SET(OPENAL_LIB wrap_oal)
-       SET(OPENAL_LIBPATH ${OPENAL}/lib)
+    #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)
 
+  IF(WITH_JACK)
+    SET(JACK ${LIBDIR}/jack)
+    SET(JACK_INC ${JACK}/include/jack)
+    SET(JACK_LIB jack)
+    SET(JACK_LIBPATH ${JACK}/lib)
+  ENDIF(WITH_JACK)
+
   IF(CMAKE_CL_64)
-       SET(PNG_LIBRARIES libpng)
+    SET(PNG_LIBRARIES libpng)
   ELSE(CMAKE_CL_64)
     SET(PNG_LIBRARIES libpng_st)
   ENDIF(CMAKE_CL_64)
@@ -234,7 +256,7 @@ IF(WIN32)
 
   SET(ZLIB ${LIBDIR}/zlib)
   SET(ZLIB_INC ${ZLIB}/include)
-  SET(ZLIB_LIBRARIES libz)
+  SET(ZLIB_LIBRARIES zlib)
   SET(ZLIB_LIBPATH ${ZLIB}/lib)
   
   SET(PTHREADS ${LIBDIR}/pthreads)
@@ -248,36 +270,36 @@ IF(WIN32)
   SET(ICONV_LIBPATH ${ICONV}/lib)
   
   IF(WITH_FFTW3)
-         SET(FFTW3 ${LIBDIR}/fftw3)
-         SET(FFTW3_INC ${FFTW3}/include)
-         SET(FFTW3_LIB libfftw)
-         SET(FFTW3_LIBPATH ${FFTW3}/lib)
+    SET(FFTW3 ${LIBDIR}/fftw3)
+    SET(FFTW3_INC ${FFTW3}/include)
+    SET(FFTW3_LIB libfftw)
+    SET(FFTW3_LIBPATH ${FFTW3}/lib)
   ENDIF(WITH_FFTW3)
   
   SET(GETTEXT ${LIBDIR}/gettext)
   SET(GETTEXT_INC ${GETTEXT}/include)
   IF(CMAKE_CL_64)
-       SET(GETTEXT_LIB gettext)
+    SET(GETTEXT_LIB gettextlib)
   ELSE(CMAKE_CL_64)
-       SET(GETTEXT_LIB gnu_gettext)
+    SET(GETTEXT_LIB gnu_gettext)
   ENDIF(CMAKE_CL_64)
   SET(GETTEXT_LIBPATH ${GETTEXT}/lib)
 
   SET(FREETYPE ${LIBDIR}/freetype)
-  SET(FREETYPE_INC ${FREETYPE}/include ${FREETYPE}/include/freetype2)
+  SET(FREETYPE_INCLUDE_DIRS ${FREETYPE}/include ${FREETYPE}/include/freetype2)
   SET(FREETYPE_LIBPATH ${FREETYPE}/lib)
-  SET(FREETYPE_LIB freetype2ST)
+  SET(FREETYPE_LIBRARY freetype2ST)
   
   SET(OPENEXR ${LIBDIR}/openexr)
   SET(OPENEXR_INC ${OPENEXR}/include ${OPENEXR}/include/IlmImf ${OPENEXR}/include/Iex ${OPENEXR}/include/Imath)
   SET(OPENEXR_LIB Iex Half IlmImf Imath IlmThread)
   IF (MSVC80)
-  SET(OPENEXR_LIBPATH ${OPENEXR}/lib_vs2005)
+    SET(OPENEXR_LIBPATH ${OPENEXR}/lib_vs2005)
   ELSE (MSVC80)
-  SET(OPENEXR_LIBPATH ${OPENEXR}/lib_msvc)
+    SET(OPENEXR_LIBPATH ${OPENEXR}/lib_msvc)
   ENDIF(MSVC80)
   IF (MSVC90)
-  SET(OPENEXR_LIBPATH ${OPENEXR}/lib_vs2008)
+    SET(OPENEXR_LIBPATH ${OPENEXR}/lib_vs2008)
   ENDIF(MSVC90)
 
   
@@ -297,9 +319,9 @@ IF(WIN32)
   SET(LIBSAMPLERATE_LIBPATH ${LIBSAMPLERATE}/lib)
 
   IF(CMAKE_CL_64)
-  SET(LLIBS kernel32 user32 vfw32 winmm ws2_32 )
+    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)
+    SET(LLIBS kernel32 user32 gdi32 comdlg32 advapi32 shell32 ole32 oleaut32 uuid ws2_32 vfw32 winmm)
   ENDIF(CMAKE_CL_64)
 
   SET(CMAKE_CXX_FLAGS_DEBUG "/D_CRT_NONSTDC_NO_DEPRECATE /D_CRT_SECURE_NO_DEPRECATE /D_SCL_SECURE_NO_DEPRECATE /wd4800 /wd4244 /wd4305 /D_DEBUG /Od /Gm /EHsc /RTC1 /MTd /W3 /nologo /ZI /J" CACHE STRING "MSVC MT flags " FORCE)
@@ -317,8 +339,8 @@ IF(WIN32)
   ENDIF(WITH_OPENMP)
 
   SET(SDL ${LIBDIR}/sdl)
-  SET(SDL_INC ${SDL}/include)
-  SET(SDL_LIB SDL)
+  SET(SDL_INCLUDE_DIR ${SDL}/include)
+  SET(SDL_LIBRARY SDL)
   SET(SDL_LIBPATH ${SDL}/lib)
 
   SET(PNG "${LIBDIR}/png")
@@ -335,10 +357,11 @@ IF(WIN32)
   SET(WINTAB_INC ${LIBDIR}/wintab/include) 
 
   IF(CMAKE_CL_64)
-  SET(PLATFORM_LINKFLAGS "/MANIFEST:NO /MANIFESTUAC:NO /MACHINE:X64 /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 ")
+    SET(PLATFORM_LINKFLAGS "/NODEFAULTLIB:libc.lib ")
   ENDIF(CMAKE_CL_64)
+  
   SET(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} /NODEFAULTLIB:libcmt.lib;libc.lib ")
 ENDIF(WIN32)
 
@@ -353,13 +376,17 @@ IF(APPLE)
     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)
 
+  IF(WITH_JACK)
+    SET(JACK /usr)
+    SET(JACK_INC ${JACK}/include/jack)
+    SET(JACK_LIB jack)
+    SET(JACK_LIBPATH ${JACK}/lib)
+  ENDIF(WITH_JACK)
 
   SET(PYTHON_VERSION 3.1)
 
@@ -368,7 +395,7 @@ IF(APPLE)
 
     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_BINARY "${PYTHON}/bin/python${PYTHON_VERSION}" CACHE STRING "") # not used yet
     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
@@ -378,7 +405,7 @@ IF(APPLE)
     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_BINARY ${PYTHON}${PYTHON_VERSION}/bin/python${PYTHON_VERSION} CACHE STRING "") # not used yet
     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")
@@ -391,9 +418,9 @@ IF(APPLE)
   
   IF(WITH_FFTW3)
     SET(FFTW3 ${LIBDIR}/fftw3)
-       SET(FFTW3_INC ${FFTW3}/include)
-       SET(FFTW3_LIB libfftw)
-       SET(FFTW3_LIBPATH ${FFTW3}/lib)
+    SET(FFTW3_INC ${FFTW3}/include)
+    SET(FFTW3_LIB libfftw)
+    SET(FFTW3_LIBPATH ${FFTW3}/lib)
   ENDIF(WITH_FFTW3)
 
   SET(PNG_LIBRARIES png)
@@ -404,9 +431,9 @@ IF(APPLE)
   SET(ZLIB_LIBRARIES z)
 
   SET(FREETYPE ${LIBDIR}/freetype)
-  SET(FREETYPE_INC ${FREETYPE}/include ${FREETYPE}/include/freetype2)
+  SET(FREETYPE_INCLUDE_DIRS ${FREETYPE}/include ${FREETYPE}/include/freetype2)
   SET(FREETYPE_LIBPATH ${FREETYPE}/lib)
-  SET(FREETYPE_LIB freetype)
+  SET(FREETYPE_LIBRARY freetype)
 
   SET(OPENEXR ${LIBDIR}/openexr)
   SET(OPENEXR_INC ${OPENEXR}/include/OpenEXR ${OPENEXR}/include)
@@ -435,8 +462,8 @@ IF(APPLE)
   ENDIF(WITH_OPENMP)
 
   SET(SDL ${LIBDIR}/sdl)
-  SET(SDL_INC ${SDL}/include)
-  SET(SDL_LIB SDL)
+  SET(SDL_INCLUDE_DIR ${SDL}/include)
+  SET(SDL_LIBRARY SDL)
   SET(SDL_LIBPATH ${SDL}/lib)
 
   SET(PNG "${LIBDIR}/png")
@@ -480,16 +507,18 @@ ENDIF(WITH_WEBPLUGIN)
 # Configure OpenGL.
 FIND_PACKAGE(OpenGL)
 INCLUDE_DIRECTORIES(${OPENGL_INCLUDE_DIR})
+# UNSET(OPENGL_LIBRARIES CACHE) # not compat with older cmake 
+# UNSET(OPENGL_xmesa_INCLUDE_DIR CACHE) # not compat with older cmake 
+
 #-----------------------------------------------------------------------------
 # Extra compile flags
-IF(WITH_GAMEENGINE)
-  SET(PLATFORM_CFLAGS "${PLATFORM_CFLAGS} -DGAMEBLENDER ")
-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} ${C_WARNINGS}")
-SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${PLATFORM_CFLAGS} ")
+SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${PLATFORM_CFLAGS} ${CXX_WARNINGS}")
+
+# better not define flags here but this is a debugging option thats off by default.
+IF(WITH_CXX_GUARDEDALLOC)
+  SET(CMAKE_CXX_FLAGS " -DWITH_CXX_GUARDEDALLOC -I${CMAKE_SOURCE_DIR}/intern/guardedalloc ${CMAKE_CXX_FLAGS}")
+ENDIF(WITH_CXX_GUARDEDALLOC)
 
 #-----------------------------------------------------------------------------
 # Libraries
@@ -509,3 +538,4 @@ ADD_SUBDIRECTORY(source/creator)
 IF(WITH_PLAYER)
   ADD_SUBDIRECTORY(blenderplayer)
 ENDIF(WITH_PLAYER)
+