correct arg order in header for isect_point_tri_v2(), Made for confusing calltips.
[blender.git] / CMakeLists.txt
index 69ddaa1..d208d73 100644 (file)
@@ -127,13 +127,14 @@ option(WITH_PYTHON_MODULE "Enable building as a python module which runs without
 option(WITH_BUILDINFO     "Include extra build details (only disable for development & faster builds)" ON)
 option(WITH_IK_ITASC      "Enable ITASC IK solver (only disable for development & for incompatible C++ compilers)" ON)
 option(WITH_IK_SOLVER     "Enable Legacy IK solver (only disable for development)" ON)
-option(WITH_FFTW3         "Enable FFTW3 support (Used for smoke and audio effects)" OFF)
+option(WITH_FFTW3         "Enable FFTW3 support (Used for smoke and audio effects)" ON)
 option(WITH_BULLET        "Enable Bullet (Physics Engine)" ON)
+option(WITH_SYSTEM_BULLET "Use the systems bullet library (currently unsupported due to missing features in upstream!)" )
+mark_as_advanced(WITH_SYSTEM_BULLET)
 option(WITH_GAMEENGINE    "Enable Game Engine" ON)
 option(WITH_PLAYER        "Build Player" OFF)
 option(WITH_OPENCOLORIO   "Enable OpenColorIO color management" ON)
 option(WITH_COMPOSITOR    "Enable the tile based nodal compositor" ON)
-option(WITH_COMPOSITOR_LEGACY "Enable legacy compositor" OFF)
 
 # GHOST Windowing Library Options
 option(WITH_GHOST_DEBUG   "Enable debugging output for the GHOST library" OFF)
@@ -149,6 +150,9 @@ mark_as_advanced(WITH_HEADLESS)
 option(WITH_AUDASPACE    "Build with blenders audio library (only disable if you know what you're doing!)" ON)
 mark_as_advanced(WITH_AUDASPACE)
 
+option(WITH_BOOL_COMPAT "Continue defining \"TRUE\" and \"FALSE\" until these can be replaced with \"true\" and \"false\" from stdbool.h" ON)
+mark_as_advanced(WITH_BOOL_COMPAT)
+
 
 # (unix defaults to OpenMP On)
 if((UNIX AND NOT APPLE) OR (MINGW))
@@ -241,11 +245,6 @@ option(WITH_PYTHON_INSTALL_NUMPY "Copy system numpy into the blender install fol
 set(PYTHON_NUMPY_PATH            "" CACHE PATH "Python to python site-packages or dist-packages containing 'numpy' module")
 mark_as_advanced(PYTHON_NUMPY_PATH)
 
-if(MINGW)
-       option(WITH_MINGW64                   "Use the 64-bit version of MinGW" OFF)
-       mark_as_advanced(WITH_MINGW64)
-endif()
-
 # Cycles
 option(WITH_CYCLES                                     "Enable cycles Render Engine" ON)
 option(WITH_CYCLES_TEST                                "Build cycles test application" OFF)
@@ -269,8 +268,13 @@ mark_as_advanced(WITH_CXX_GUARDEDALLOC)
 option(WITH_ASSERT_ABORT "Call abort() when raising an assertion through BLI_assert()" OFF)
 mark_as_advanced(WITH_ASSERT_ABORT)
 
+option(WITH_BOOST                                      "Enable features depending no boost" ON)
+
 
 if(APPLE)
+       cmake_minimum_required(VERSION 2.8.8)
+       cmake_policy(VERSION 2.8.8)
+
        if(NOT CMAKE_OSX_ARCHITECTURES)
                set(CMAKE_OSX_ARCHITECTURES x86_64 CACHE STRING
                "Choose the architecture you want to build Blender for: i386, x86_64 or ppc"
@@ -384,10 +388,6 @@ if(WITH_PYTHON_MODULE AND WITH_PYTHON_INSTALL)
 endif()
 
 
-if(NOT WITH_FFTW3 AND WITH_MOD_OCEANSIM)
-       message(FATAL_ERROR "WITH_MOD_OCEANSIM requires WITH_FFTW3 to be ON")
-endif()
-
 # may as well build python module without a UI
 if(WITH_PYTHON_MODULE)
        set(WITH_HEADLESS ON)
@@ -398,9 +398,22 @@ if(WITH_CYCLES)
        set(WITH_OPENIMAGEIO ON)
 endif()
 
-# auto enable boost for cycles, booleans, audaspace or i18n
-if(WITH_CYCLES OR WITH_MOD_BOOLEAN OR WITH_AUDASPACE OR WITH_INTERNATIONAL)
-       set(WITH_BOOST ON)
+# enable boost for cycles, booleans, audaspace or i18n
+# otherwise if the user disabled
+if(NOT WITH_BOOST)
+       # Explicitly disabled. so disable all deps.
+       set(WITH_CYCLES         OFF)
+       set(WITH_MOD_BOOLEAN    OFF)
+       set(WITH_AUDASPACE      OFF)
+       set(WITH_INTERNATIONAL  OFF)
+
+       set(WITH_OPENAL         OFF)  # depends on AUDASPACE
+       set(WITH_GAMEENGINE     OFF)  # depends on AUDASPACE
+elseif(WITH_CYCLES OR WITH_MOD_BOOLEAN OR WITH_AUDASPACE OR WITH_INTERNATIONAL)
+       # Keep enabled
+else()
+       # Enabled but we don't need it
+       set(WITH_BOOST OFF)
 endif()
 
 # auto enable llvm for cycles_osl
@@ -429,6 +442,13 @@ endif()
 
 TEST_SSE_SUPPORT(COMPILER_SSE_FLAG COMPILER_SSE2_FLAG)
 
+TEST_STDBOOL_SUPPORT()
+if(HAVE_STDBOOL_H)
+       add_definitions(-DHAVE_STDBOOL_H)
+endif()
+if(WITH_BOOL_COMPAT)
+       add_definitions(-DWITH_BOOL_COMPAT)
+endif()
 
 #-----------------------------------------------------------------------------
 # Check for valid directories
@@ -650,20 +670,15 @@ if(UNIX AND NOT APPLE)
        if(WITH_BOOST)
                # uses in build instructions to override include and library variables
                if(NOT BOOST_CUSTOM)
-                       # XXX No more lib dir, is this multithread stuff still needed?
                        if(${WITH_STATIC_LIBS})
                                set(Boost_USE_STATIC_LIBS ON)
                        endif()
-                       if(NOT BOOST_ROOT)
-                               set(Boost_USE_MULTITHREADED OFF)
-                       else()
-                               set(Boost_USE_MULTITHREADED ON)
-                       endif()
+                       set(Boost_USE_MULTITHREADED ON)
                        set(__boost_packages filesystem regex system thread date_time)
                        if (WITH_INTERNATIONAL)
                                list(APPEND __boost_packages locale)
                        endif()
-                       find_package(Boost 1.34 COMPONENTS ${__boost_packages})
+                       find_package(Boost 1.48 COMPONENTS ${__boost_packages})
                        if(Boost_USE_STATIC_LIBS AND Boost_USE_ICU)
                                find_package(IcuLinux)
                        endif()
@@ -798,7 +813,11 @@ if(UNIX AND NOT APPLE)
                set(PLATFORM_LINKLIBS "${PLATFORM_LINKLIBS} ${X11_X11_LIB}")
 
                if(WITH_X11_XINPUT)
-                       set(PLATFORM_LINKLIBS "${PLATFORM_LINKLIBS} ${X11_Xinput_LIB}")
+                       if(X11_Xinput_LIB)
+                               set(PLATFORM_LINKLIBS "${PLATFORM_LINKLIBS} ${X11_Xinput_LIB}")
+                       else()
+                               set(WITH_X11_XINPUT OFF)
+                       endif()
                endif()
 
                if(WITH_X11_XF86VMODE)
@@ -868,8 +887,16 @@ elseif(WIN32)
 
        if(CMAKE_COMPILER_IS_GNUCC)
                set(LIBDIR ${CMAKE_SOURCE_DIR}/../lib/mingw32)
-
+               INCLUDE (CheckCSourceCompiles) 
                # Setup 64bit and 64bit windows systems
+               CHECK_C_SOURCE_COMPILES("
+                       #ifndef __MINGW64__
+                       #error
+                       #endif
+                       main(){}
+                       " 
+                       WITH_MINGW64)
+               
                if(WITH_MINGW64)
                        message("Compiling for 64 bit with MinGW-w64.")
                        set(LIBDIR ${CMAKE_SOURCE_DIR}/../lib/mingw64)
@@ -941,13 +968,6 @@ elseif(WIN32)
                endif()
        endif()
 
-       if(WITH_LLVM)
-               set(LLVM_DIRECTORY ${LIBDIR}/llvm CACHE PATH    "Path to the LLVM installation")
-               file(GLOB LLVM_LIBRARY ${LLVM_DIRECTORY}/lib/*.lib)
-               set(LLVM_STATIC YES)
-       endif()
-
-
        if(MSVC)
                set(PLATFORM_LINKLIBS ws2_32 vfw32 winmm kernel32 user32 gdi32 comdlg32 advapi32 shfolder shell32 ole32 oleaut32 uuid psapi)
 
@@ -1097,14 +1117,16 @@ elseif(WIN32)
                if(WITH_PYTHON)
                        # normally cached but not since we include them with blender
                        if(MSVC10)
-                               set(PYTHON_VERSION 3.2) # CACHE STRING)
+                               set(PYTHON_VERSION 3.3) # CACHE STRING)
                        else()
                                set(PYTHON_VERSION 3.3) # CACHE STRING)
                        endif()
 
                        set_lib_path(PYTHON "python")
                        STRING(REPLACE "." "" _PYTHON_VERSION_NO_DOTS ${PYTHON_VERSION})
-                       set(PYTHON_LIBRARY ${PYTHON}/lib/python${_PYTHON_VERSION_NO_DOTS}.lib) #CACHE FILEPATH
+                       # Use shared libs for vc2008 and vc2010 until we actually have vc2010 libs
+                       set(PYTHON_LIBRARY ${LIBDIR}/python/lib/python${_PYTHON_VERSION_NO_DOTS}.lib)
+                       # set(PYTHON_LIBRARY ${PYTHON}/lib/python${_PYTHON_VERSION_NO_DOTS}.lib) #CACHE FILEPATH
                        unset(_PYTHON_VERSION_NO_DOTS)
 
                        #Shared includes for both vc2008 and vc2010
@@ -1134,11 +1156,16 @@ elseif(WIN32)
                                debug libboost_date_time-${BOOST_DEBUG_POSTFIX} debug libboost_filesystem-${BOOST_DEBUG_POSTFIX}
                                debug libboost_regex-${BOOST_DEBUG_POSTFIX}
                                debug libboost_system-${BOOST_DEBUG_POSTFIX} debug libboost_thread-${BOOST_DEBUG_POSTFIX})
+                       if(WITH_CYCLES_OSL)
+                               set(BOOST_LIBRARIES ${BOOST_LIBRARIES}
+                                       optimized libboost_wave-${BOOST_POSTFIX}
+                                       debug libboost_wave-${BOOST_DEBUG_POSTFIX})
+                       endif()
                        if(WITH_INTERNATIONAL)
                                set(BOOST_LIBRARIES ${BOOST_LIBRARIES}
                                        optimized libboost_locale-${BOOST_POSTFIX}
                                        debug libboost_locale-${BOOST_DEBUG_POSTFIX})
-                       endif(WITH_INTERNATIONAL)
+                       endif()
                        set(BOOST_DEFINITIONS "-DBOOST_ALL_NO_LIB")
                endif()
                        
@@ -1150,6 +1177,12 @@ elseif(WIN32)
                        set(OPENIMAGEIO_DEFINITIONS "-DUSE_TBB=0")
                endif()
 
+               if(WITH_LLVM)
+                       set(LLVM_DIRECTORY ${LIBDIR}/llvm CACHE PATH    "Path to the LLVM installation")
+                       file(GLOB LLVM_LIBRARY ${LLVM_DIRECTORY}/lib/*.lib)
+                       set(LLVM_STATIC YES)
+               endif()
+       
                if(WITH_OPENCOLORIO)
                        set(OPENCOLORIO ${LIBDIR}/opencolorio)
                        set(OPENCOLORIO_INCLUDE_DIRS ${OPENCOLORIO}/include)
@@ -1262,6 +1295,7 @@ elseif(WIN32)
 
                if(WITH_IMAGE_OPENEXR)
                        set(OPENEXR ${LIBDIR}/openexr)
+                       set(OPENEXR_INCLUDE_DIR ${OPENEXR}/include)
                        set(OPENEXR_INCLUDE_DIRS ${OPENEXR}/include/OpenEXR)
                        set(OPENEXR_LIBRARIES Half IlmImf Imath IlmThread Iex)
                        set(OPENEXR_LIBPATH ${OPENEXR}/lib)
@@ -1317,6 +1351,11 @@ elseif(WIN32)
                                        optimized boost_locale-${BOOST_POSTFIX}
                                        debug boost_locale-${BOOST_DEBUG_POSTFIX}) 
                        endif()
+                       if(WITH_CYCLES_OSL)
+                               set(BOOST_LIBRARIES ${BOOST_LIBRARIES}
+                                       optimized boost_wave-${BOOST_POSTFIX}
+                                       debug boost_wave-${BOOST_DEBUG_POSTFIX}) 
+                       endif()
                        set(BOOST_LIBPATH ${BOOST}/lib)
                        set(BOOST_DEFINITIONS "-DBOOST_ALL_NO_LIB -DBOOST_THREAD_USE_LIB ")
                endif()
@@ -1329,6 +1368,34 @@ elseif(WIN32)
                        set(OPENIMAGEIO_DEFINITIONS)
                endif()
                
+               if(WITH_LLVM)
+                       set(LLVM_DIRECTORY ${LIBDIR}/llvm CACHE PATH    "Path to the LLVM installation")
+                       set(LLVM_LIB_DIR ${LLVM_DIRECTORY}/lib)
+                       #Explicitly set llvm lib order.
+                       #---- WARNING ON GCC ORDER OF LIBS IS IMPORTANT, DO NOT CHANGE! ---------
+                       set(LLVM_LIBRARY LLVMSelectionDAG LLVMCodeGen LLVMScalarOpts LLVMAnalysis LLVMArchive
+                               LLVMAsmParser LLVMAsmPrinter
+                               LLVMBitReader LLVMBitWriter
+                               LLVMDebugInfo LLVMExecutionEngine
+                               LLVMInstCombine LLVMInstrumentation
+                               LLVMInterpreter LLVMJIT
+                               LLVMLinker LLVMMC
+                               LLVMMCDisassembler LLVMMCJIT
+                               LLVMMCParser LLVMObject
+                               LLVMRuntimeDyld 
+                               LLVMSupport
+                               LLVMTableGen LLVMTarget
+                               LLVMTransformUtils LLVMVectorize
+                               LLVMX86AsmParser LLVMX86AsmPrinter
+                               LLVMX86CodeGen LLVMX86Desc
+                               LLVMX86Disassembler LLVMX86Info
+                               LLVMX86Utils LLVMipa
+                               LLVMipo LLVMCore)
+                               #imagehelp is needed by LLVM 3.1 on MinGW, check lib\Support\Windows\Signals.inc
+                               set(PLATFORM_LINKLIBS "${PLATFORM_LINKLIBS} -limagehlp")
+                       set(LLVM_STATIC YES)
+               endif()
+               
                if(WITH_OPENCOLORIO)
                        set(OPENCOLORIO ${LIBDIR}/opencolorio)
                        set(OPENCOLORIO_INCLUDE_DIRS ${OPENCOLORIO}/include)
@@ -1404,11 +1471,11 @@ elseif(APPLE)
                        # module must be compiled against Python framework
 
                        # normally cached but not since we include them with blender
-                       set(PYTHON_VERSION 3.2)
+                       set(PYTHON_VERSION 3.3)
                        set(PYTHON_INCLUDE_DIR "/Library/Frameworks/Python.framework/Versions/${PYTHON_VERSION}/include/python${PYTHON_VERSION}m")
                        set(PYTHON_BINARY "/Library/Frameworks/Python.framework/Versions/${PYTHON_VERSION}/bin/python${PYTHON_VERSION}")
                        #set(PYTHON_LIBRARY python${PYTHON_VERSION})
-                       set(PYTHON_LIBPATH "/Library/Frameworks/Python.framework/Versions/${PYTHON_VERSION}/lib/python${PYTHON_VERSION}/config-3.2m")
+                       set(PYTHON_LIBPATH "/Library/Frameworks/Python.framework/Versions/${PYTHON_VERSION}/lib/python${PYTHON_VERSION}/config-${PYTHON_VERSION}m")
                        #set(PYTHON_LINKFLAGS "-u _PyMac_Error -framework Python")  # won't  build with this enabled
                endif()
                
@@ -1491,7 +1558,8 @@ elseif(APPLE)
                        endif()
 
                        if(WITH_INPUT_NDOF)
-                               set(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -weak_framework 3DconnexionClient")
+                               set(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -F/Library/Frameworks -weak_framework 3DconnexionClient")
+                               set(NDOF_INCLUDE_DIRS /Library/Frameworks/3DconnexionClient.framework/Headers )
                        endif()
                endif()
 
@@ -1667,6 +1735,10 @@ if(APPLE OR WIN32)
        endif()
 endif()
 
+if(NOT WITH_FFTW3 AND WITH_MOD_OCEANSIM)
+       message(FATAL_ERROR "WITH_MOD_OCEANSIM requires WITH_FFTW3 to be ON")
+endif()
+
 if(WITH_CYCLES)
        if(NOT WITH_OPENIMAGEIO)
                message(FATAL_ERROR "Cycles reqires WITH_OPENIMAGEIO, the library may not have been found. Configure OIIO or disable WITH_CYCLES")
@@ -1803,6 +1875,20 @@ else()
        set(GLEW_INCLUDE_PATH "${CMAKE_SOURCE_DIR}/extern/glew/include")
 endif()
 
+
+#-----------------------------------------------------------------------------
+# Configure Bullet
+
+if(WITH_BULLET AND WITH_SYSTEM_BULLET)
+       find_package(Bullet)
+       if(NOT BULLET_FOUND)
+               set(WITH_BULLET OFF)
+       endif()
+else()
+       set(BULLET_INCLUDE_DIRS "${CMAKE_SOURCE_DIR}/extern/bullet2/src")
+       # set(BULLET_LIBRARIES "")
+endif()
+
 #-----------------------------------------------------------------------------
 # Configure Python.
 
@@ -1836,7 +1922,7 @@ if(CMAKE_COMPILER_IS_GNUCC)
        ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_NO_DIV_BY_ZERO -Wno-div-by-zero)
 
        # gcc 4.2 gives annoying warnings on every file with this
-       if ("${CMAKE_C_COMPILER_VERSION}" VERSION_GREATER "4.2")
+       if (NOT "${CMAKE_C_COMPILER_VERSION}" VERSION_LESS "4.3")
                ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_UNINITIALIZED -Wuninitialized)
        endif()
 
@@ -1856,7 +1942,7 @@ if(CMAKE_COMPILER_IS_GNUCC)
        ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_NO_DIV_BY_ZERO -Wno-div-by-zero)
 
        # gcc 4.2 gives annoying warnings on every file with this
-       if ("${CMAKE_C_COMPILER_VERSION}" VERSION_GREATER "4.2")
+       if (NOT "${CMAKE_C_COMPILER_VERSION}" VERSION_LESS "4.3")
                ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_UNINITIALIZED -Wuninitialized)
        endif()
 
@@ -1929,12 +2015,13 @@ if(WITH_PYTHON)
 
        if(WITH_PYTHON_INSTALL AND WITH_PYTHON_INSTALL_NUMPY)
                # set but invalid
-               if(NOT ${PYTHON_NUMPY_PATH} STREQUAL "")
-                       if(NOT EXISTS "${PYTHON_NUMPY_PATH}/numpy")
-                               message(WARNING "PYTHON_NUMPY_PATH is invalid, numpy not found in '${PYTHON_NUMPY_PATH}' "
-                                               "WITH_PYTHON_INSTALL_NUMPY option will be ignored when installing python")
-                               set(WITH_PYTHON_INSTALL_NUMPY OFF)
-                       endif()
+        # -- disabled until we make numpy bundled with blender - campbell
+               if((NOT ${PYTHON_NUMPY_PATH} STREQUAL "") AND (NOT ${PYTHON_NUMPY_PATH} MATCHES NOTFOUND))
+#                      if(NOT EXISTS "${PYTHON_NUMPY_PATH}/numpy")
+#                              message(WARNING "PYTHON_NUMPY_PATH is invalid, numpy not found in '${PYTHON_NUMPY_PATH}' "
+#                                              "WITH_PYTHON_INSTALL_NUMPY option will be ignored when installing python")
+#                              set(WITH_PYTHON_INSTALL_NUMPY OFF)
+#                      endif()
                # not set, so initialize
                else()
                        string(REPLACE "." ";" _PY_VER_SPLIT "${PYTHON_VERSION}")
@@ -2102,6 +2189,9 @@ if(FIRST_RUN)
        info_cfg_option(WITH_MOD_FLUID)
        info_cfg_option(WITH_MOD_OCEANSIM)
 
+       # debug
+       message(STATUS "HAVE_STDBOOL_H = ${HAVE_STDBOOL_H}")
+
        info_cfg_text("")
 
        message("${_config_msg}")