ruler3d: replace ED_view3d_cursor3d_position() with lower level function view3d_get_v...
[blender.git] / CMakeLists.txt
index fbacb37..c3ede3c 100644 (file)
@@ -124,6 +124,10 @@ mark_as_advanced(WITH_PYTHON_SECURITY)  # some distributions see this as a secur
 
 option(WITH_PYTHON_SAFETY "Enable internal API error checking to track invalid data to prevent crash on access (at the expense of some effeciency, only enable for development)." OFF)
 option(WITH_PYTHON_MODULE "Enable building as a python module which runs without a user interface, like running regular blender in background mode (experimental, only enable for development)" OFF)
+if (APPLE)
+       option(WITH_PYTHON_FRAMEWORK "Enable building using the Python available in the framework (OSX only)" OFF)
+endif()
+
 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)
@@ -166,7 +170,6 @@ unset(PLATFORM_DEFAULT)
 
 if(UNIX AND NOT APPLE)
        option(WITH_X11_XINPUT "Enable X11 Xinput (tablet support and unicode input)"   ON)
-       option(WITH_X11_XINERAMA "Enable multi-monitor support" ON)
        option(WITH_X11_XF86VMODE "Enable X11 video mode switching"     ON)
        option(WITH_SYSTEM_GLEW "Use GLEW OpenGL wrapper library provided by the operating system" ON)
 
@@ -240,6 +243,10 @@ option(WITH_RAYOPTIMIZATION        "Enable use of SIMD (SSE) optimizations for the rayt
 if(UNIX AND NOT APPLE)
        option(WITH_INSTALL_PORTABLE "Install redistributeable runtime, otherwise install into CMAKE_INSTALL_PREFIX" ON)
        option(WITH_STATIC_LIBS "Try to link with static libraries, as much as possible, to make blender more portable across distributions" OFF)
+       if(WITH_STATIC_LIBS)
+               option(WITH_BOOST_ICU "Boost uses ICU library (required for linking with static Boost built with libicu)." OFF)
+               mark_as_advanced(WITH_BOOST_ICU)
+       endif()
 endif()
 option(WITH_PYTHON_INSTALL       "Copy system python into the blender install folder" ON)
 option(WITH_PYTHON_INSTALL_NUMPY "Copy system numpy into the blender install folder"  ON)
@@ -251,7 +258,7 @@ option(WITH_CYCLES                                  "Enable cycles Render Engine" ON)
 option(WITH_CYCLES_TEST                                "Build cycles test application" OFF)
 option(WITH_CYCLES_OSL                         "Build Cycles with OSL support" OFF)
 option(WITH_CYCLES_CUDA_BINARIES       "Build cycles CUDA binaries" OFF)
-set(CYCLES_CUDA_BINARIES_ARCH sm_13 sm_20 sm_21 sm_30 CACHE STRING "CUDA architectures to build binaries for")
+set(CYCLES_CUDA_BINARIES_ARCH sm_20 sm_21 sm_30 CACHE STRING "CUDA architectures to build binaries for")
 mark_as_advanced(CYCLES_CUDA_BINARIES_ARCH)
 unset(PLATFORM_DEFAULT)
 
@@ -269,6 +276,9 @@ 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)
@@ -396,9 +406,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
@@ -415,7 +438,6 @@ if(WITH_GHOST_SDL OR WITH_HEADLESS)
        set(WITH_GHOST_XDND OFF)
        set(WITH_X11_XF86VMODE OFF)
        set(WITH_X11_XINPUT OFF)
-       set(WITH_X11_XINERAMA OFF)
 endif()
 
 if(MINGW)
@@ -665,7 +687,7 @@ if(UNIX AND NOT APPLE)
                                list(APPEND __boost_packages locale)
                        endif()
                        find_package(Boost 1.48 COMPONENTS ${__boost_packages})
-                       if(Boost_USE_STATIC_LIBS AND Boost_USE_ICU)
+                       if(Boost_USE_STATIC_LIBS AND WITH_BOOST_ICU)
                                find_package(IcuLinux)
                        endif()
                        mark_as_advanced(Boost_DIR)  # why doesnt boost do this?
@@ -799,11 +821,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}")
-               endif()
-
-               if(WITH_X11_XINERAMA)
-                       set(PLATFORM_LINKLIBS "${PLATFORM_LINKLIBS} ${X11_Xinerama_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)
@@ -1443,11 +1465,10 @@ elseif(APPLE)
        endif()
 
        if(WITH_PYTHON)
-               if(NOT WITH_PYTHON_MODULE)
-                       # we use precompiled libraries for py 3.3 and up by default
-
+               # we use precompiled libraries for py 3.3 and up by default
+               set(PYTHON_VERSION 3.3)
+               if(NOT WITH_PYTHON_MODULE AND NOT WITH_PYTHON_FRAMEWORK)
                        # normally cached but not since we include them with blender
-                       set(PYTHON_VERSION 3.3)
                        set(PYTHON_INCLUDE_DIR "${LIBDIR}/python/include/python${PYTHON_VERSION}m")
                        # set(PYTHON_BINARY "${LIBDIR}/python/bin/python${PYTHON_VERSION}") # not used yet
                        set(PYTHON_LIBRARY python${PYTHON_VERSION}m)
@@ -1455,13 +1476,10 @@ elseif(APPLE)
                        # set(PYTHON_LINKFLAGS "-u _PyMac_Error")  # won't  build with this enabled
                else()
                        # module must be compiled against Python framework
-
-                       # normally cached but not since we include them with blender
-                       set(PYTHON_VERSION 3.2)
                        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()
                
@@ -1559,8 +1577,8 @@ elseif(APPLE)
                set(WITH_INPUT_NDOF OFF)  # unsupported
        endif()
        
-       if(WITH_PYTHON_MODULE)
-               set(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} /Library/Frameworks/Python.framework/Versions/${PYTHON_VERSION}/python")# force cmake to link right framework
+       if(WITH_PYTHON_MODULE OR WITH_PYTHON_FRAMEWORK)
+               set(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} /Library/Frameworks/Python.framework/Versions/${PYTHON_VERSION}/Python")# force cmake to link right framework
        endif()
        
        if(WITH_OPENCOLLADA)
@@ -1950,20 +1968,27 @@ elseif(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
 
        # strange, clang complains these are not supported, but then yses them.
        ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_ALL -Wall)
+       ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_ERROR_DECLARATION_AFTER_STATEMENT -Werror=declaration-after-statement)
+       ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_ERROR_IMPLICIT_FUNCTION_DECLARATION -Werror=implicit-function-declaration)
+       ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_ERROR_RETURN_TYPE  -Werror=return-type)
        ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_NO_AUTOLOGICAL_COMPARE -Wno-tautological-compare)
        ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_NO_UNKNOWN_PRAGMAS -Wno-unknown-pragmas)
        ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_NO_CHAR_SUBSCRIPTS -Wno-char-subscripts)
        ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_STRICT_PROTOTYPES  -Wstrict-prototypes)
        ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_MISSING_PROTOTYPES -Wmissing-prototypes)
-       ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_UNUSED_MACROS      -Wunused-macros)
+       ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_UNUSED_PARAMETER -Wunused-parameter)
 
        ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_ALL -Wall)
        ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_NO_AUTOLOGICAL_COMPARE -Wno-tautological-compare)
        ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_NO_UNKNOWN_PRAGMAS     -Wno-unknown-pragmas)
        ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_NO_CHAR_SUBSCRIPTS     -Wno-char-subscripts)
        ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_NO_OVERLOADED_VIRTUAL  -Wno-overloaded-virtual)  # we get a lot of these, if its a problem a dev needs to look into it.
+       ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_NO_SIGN_COMPARE        -Wno-sign-compare)
        ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_NO_INVALID_OFFSETOF    -Wno-invalid-offsetof)
-       ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_UNUSED_MACROS          -Wunused-macros)
+
+       # gives too many unfixable warnings
+       # ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_UNUSED_MACROS      -Wunused-macros)
+       # ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_UNUSED_MACROS          -Wunused-macros)
 
 elseif(CMAKE_C_COMPILER_ID MATCHES "Intel")
 
@@ -2168,6 +2193,9 @@ if(FIRST_RUN)
        info_cfg_option(WITH_PYTHON_INSTALL_NUMPY)
        info_cfg_option(WITH_PYTHON_MODULE)
        info_cfg_option(WITH_PYTHON_SAFETY)
+       if(APPLE)
+               info_cfg_option(WITH_PYTHON_FRAMEWORK)
+       endif()
 
        info_cfg_text("Modifiers:")
        info_cfg_option(WITH_MOD_BOOLEAN)
@@ -2175,12 +2203,10 @@ 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}")
 endif()
-
-# debug
-message(
-    STATUS "HAVE_STDBOOL_H = ${HAVE_STDBOOL_H}"
-)