Install_deps.sh: attempt to add OpenVDB, not working for now.
[blender.git] / CMakeLists.txt
index 7319a34d11b3bef4a8637710bf7546d09425b748..ae224f2a53d37051096c4825d9150097b3febaad 100644 (file)
@@ -158,7 +158,6 @@ option_defaults_init(
        _init_IMAGE_REDCODE
        _init_INPUT_NDOF
        _init_JACK
-       _init_LIBMV_SCHUR_SPECIALIZATION
        _init_OPENCOLLADA
        _init_OPENCOLORIO
        _init_SDL
@@ -185,7 +184,6 @@ if (UNIX AND NOT APPLE)
 elseif(WIN32)
        set(_init_JACK                           OFF)
 elseif(APPLE)
-       set(_init_INPUT_NDOF                     OFF)
        set(_init_JACK                           OFF)
        set(_init_OPENSUBDIV                     OFF)
 endif()
@@ -242,11 +240,14 @@ option(WITH_OPENSUBDIV    "Enable OpenSubdiv for surface subdivision" _init_OPEN
 option(WITH_SUBSURF_WERROR  "Treat warnings as errors in subsurf code" OFF)
 mark_as_advanced(WITH_COMPOSITOR_WERROR)
 
+option(WITH_OPENVDB       "Enable features relying on OpenVDB" OFF)
+option(WITH_OPENVDB_BLOSC "Enable blosc compression for OpenVDB, only enable if OpenVDB was built with blosc support" OFF)
+
 # GHOST Windowing Library Options
 option(WITH_GHOST_DEBUG   "Enable debugging output for the GHOST library" OFF)
 mark_as_advanced(WITH_GHOST_DEBUG)
 
-option(WITH_GHOST_SDL    "Enable building blender against SDL for windowing rather then the native APIs" OFF)
+option(WITH_GHOST_SDL    "Enable building Blender against SDL for windowing rather than the native APIs" OFF)
 mark_as_advanced(WITH_GHOST_SDL)
 
 if(WITH_X11)
@@ -267,6 +268,10 @@ if(NOT WITH_AUDASPACE)
 endif()
 
 option(WITH_OPENMP        "Enable OpenMP (has to be supported by the compiler)" ON)
+if(UNIX AND NOT APPLE)
+       option(WITH_OPENMP_STATIC "Link OpenMP statically (only used by the release environment)" OFF)
+       mark_as_advanced(WITH_OPENMP_STATIC)
+endif()
 
 if(WITH_X11)
        option(WITH_X11_XINPUT    "Enable X11 Xinput (tablet support and unicode input)"  ON)
@@ -344,7 +349,7 @@ endif()
 
 # Camera/motion tracking
 option(WITH_LIBMV         "Enable Libmv structure from motion library" ON)
-option(WITH_LIBMV_SCHUR_SPECIALIZATIONS "Enable fixed-size schur specializations." ${_init_LIBMV_SCHUR_SPECIALIZATION})
+option(WITH_LIBMV_SCHUR_SPECIALIZATIONS "Enable fixed-size schur specializations." OFF)
 option(WITH_LIBMV_WERROR  "Treat warnings as errors in Libmv (and Blender's motion tracking) code")
 mark_as_advanced(WITH_LIBMV_SCHUR_SPECIALIZATIONS)
 mark_as_advanced(WITH_LIBMV_WERROR)
@@ -358,7 +363,6 @@ if(WIN32)
 endif()
 option(WITH_INPUT_NDOF "Enable NDOF input devices (SpaceNavigator and friends)" ${_init_INPUT_NDOF})
 option(WITH_RAYOPTIMIZATION    "Enable use of SIMD (SSE) optimizations for the raytracer" ON)
-option(WITH_OPENNL        "Enable use of Open Numerical Library" ON)
 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)
@@ -386,7 +390,7 @@ option(WITH_CYCLES_STANDALONE               "Build Cycles standalone application" OFF)
 option(WITH_CYCLES_STANDALONE_GUI      "Build Cycles standalone with GUI" OFF)
 option(WITH_CYCLES_OSL                         "Build Cycles with OSL support" ${_init_CYCLES_OSL})
 option(WITH_CYCLES_CUDA_BINARIES       "Build Cycles CUDA binaries" OFF)
-set(CYCLES_CUDA_BINARIES_ARCH sm_20 sm_21 sm_30 sm_35 sm_50 sm_52 CACHE STRING "CUDA architectures to build binaries for")
+set(CYCLES_CUDA_BINARIES_ARCH sm_20 sm_21 sm_30 sm_35 sm_37 sm_50 sm_52 CACHE STRING "CUDA architectures to build binaries for")
 mark_as_advanced(CYCLES_CUDA_BINARIES_ARCH)
 unset(PLATFORM_DEFAULT)
 option(WITH_CYCLES_LOGGING     "Build Cycles with logging support" ON)
@@ -396,6 +400,9 @@ mark_as_advanced(WITH_CYCLES_LOGGING)
 mark_as_advanced(WITH_CYCLES_DEBUG)
 mark_as_advanced(WITH_CYCLES_WERROR)
 
+option(WITH_CUDA_DYNLOAD "Dynamically load CUDA libraries at runtime" ON)
+mark_as_advanced(WITH_CUDA_DYNLOAD)
+
 # LLVM
 option(WITH_LLVM                                       "Use LLVM" OFF)
 if(APPLE)
@@ -466,7 +473,7 @@ if(WITH_GLEW_ES AND WITH_SYSTEM_GLEW)
        set(WITH_SYSTEM_GLEW OFF)
 endif()
 
-if(MSVC)
+if(WIN32)
        getDefaultWindowsPrefixBase(CMAKE_GENERIC_PROGRAM_FILES)
        set(CPACK_INSTALL_PREFIX ${CMAKE_GENERIC_PROGRAM_FILES}/${})
 endif()
@@ -489,7 +496,7 @@ option_defaults_clear()
 # By default we want to install to the directory we are compiling our executables
 # unless specified otherwise, which we currently do not allow
 if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
-       if(MSVC)
+       if(WIN32)
                set(CMAKE_INSTALL_PREFIX ${EXECUTABLE_OUTPUT_PATH}/\${BUILD_TYPE} CACHE PATH "default install path" FORCE)
        elseif(APPLE)
                set(CMAKE_INSTALL_PREFIX ${EXECUTABLE_OUTPUT_PATH}/\${BUILD_TYPE} CACHE PATH "default install path" FORCE)
@@ -671,10 +678,14 @@ if(NOT WITH_BOOST)
        set_and_warn(WITH_CYCLES         OFF)
        set_and_warn(WITH_AUDASPACE      OFF)
        set_and_warn(WITH_INTERNATIONAL  OFF)
+       set_and_warn(WITH_OPENVDB        OFF)
+       set_and_warn(WITH_OPENCOLORIO    OFF)
+       set_and_warn(WITH_MOD_BOOLEAN    OFF)
 
        set_and_warn(WITH_OPENAL         OFF)  # depends on AUDASPACE
        set_and_warn(WITH_GAMEENGINE     OFF)  # depends on AUDASPACE
-elseif(WITH_CYCLES OR WITH_OPENIMAGEIO OR WITH_AUDASPACE OR WITH_INTERNATIONAL)
+       set_and_warn(WITH_PLAYER         OFF)  # depends on GAMEENGINE
+elseif(WITH_CYCLES OR WITH_OPENIMAGEIO OR WITH_AUDASPACE OR WITH_INTERNATIONAL OR WITH_OPENVDB OR WITH_OPENCOLORIO OR WITH_MOD_BOOLEAN)
        # Keep enabled
 else()
        # Enabled but we don't need it
@@ -720,10 +731,8 @@ else()
        set(COMPILER_SSE2_FLAG)
 endif()
 
-TEST_STDBOOL_SUPPORT()
-if(HAVE_STDBOOL_H)
-       add_definitions(-DHAVE_STDBOOL_H)
-endif()
+TEST_SHARED_PTR_SUPPORT()
+TEST_UNORDERED_MAP_SUPPORT()
 
 if(WITH_AUDASPACE)
        if(WITH_SYSTEM_AUDASPACE)
@@ -810,14 +819,14 @@ set(PLATFORM_LINKFLAGS_DEBUG "")
 # For alternate Python locations the commandline can be used to override detected/default cache settings, e.g:
 # On Unix:
 #   cmake ../blender \
-#         -D PYTHON_VERSION=3.4 \
-#         -D PYTHON_INCLUDE_DIR=/opt/py34/include/python3.4d \
-#         -D PYTHON_LIBRARY=/opt/py34/lib/libpython3.4d.so
+#         -D PYTHON_VERSION=3.5 \
+#         -D PYTHON_INCLUDE_DIR=/opt/py35/include/python3.5d \
+#         -D PYTHON_LIBRARY=/opt/py35/lib/libpython3.5d.so
 #
 # On Macs:
 #   cmake ../blender \
-#         -D PYTHON_INCLUDE_DIR=/System/Library/Frameworks/Python.framework/Versions/3.4/include/python3.4 \
-#         -D PYTHON_LIBPATH=/System/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/config \
+#         -D PYTHON_INCLUDE_DIR=/System/Library/Frameworks/Python.framework/Versions/3.5/include/python3.5 \
+#         -D PYTHON_LIBPATH=/System/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/config \
 #         -G Xcode
 #
 # When changing any of this remember to update the notes in doc/build_systems/cmake.txt
@@ -865,13 +874,9 @@ endif()
 if(UNIX AND NOT APPLE)
        macro(find_package_wrapper)
                if(WITH_STATIC_LIBS)
-                       set(_cmake_find_library_suffixes_back ${CMAKE_FIND_LIBRARY_SUFFIXES})
-                       set(CMAKE_FIND_LIBRARY_SUFFIXES .a ${CMAKE_FIND_LIBRARY_SUFFIXES})
-               endif()
-               find_package(${ARGV})
-               if(WITH_STATIC_LIBS)
-                       set(CMAKE_FIND_LIBRARY_SUFFIXES ${_cmake_find_library_suffixes_back})
-                       unset(_cmake_find_library_suffixes_back)
+                       find_package_static(${ARGV})
+               else()
+                       find_package(${ARGV})
                endif()
        endmacro()
 
@@ -896,10 +901,10 @@ if(UNIX AND NOT APPLE)
        # else values are set below for all platforms
 
        if(WITH_PYTHON)
-               # No way to set py34. remove for now.
+               # No way to set py35, remove for now.
                # find_package(PythonLibs)
 
-               # Use our own instead, since wothout py is such a rare case,
+               # Use our own instead, since without py is such a rare case,
                # require this package
                # XXX Linking errors with debian static python :/
 #              find_package_wrapper(PythonLibsUnix REQUIRED)
@@ -1056,6 +1061,16 @@ if(UNIX AND NOT APPLE)
                endif()
        endif()
 
+       if(WITH_OPENVDB)
+               find_package_wrapper(OpenVDB)
+               find_package_wrapper(TBB)
+               if(NOT OPENVDB_FOUND OR NOT TBB_FOUND)
+                       set(WITH_OPENVDB OFF)
+                       set(WITH_OPENVDB_BLOSC OFF)
+                       message(STATUS "OpenVDB not found, disabling it")
+               endif()
+       endif()
+
        if(WITH_BOOST)
                # uses in build instructions to override include and library variables
                if(NOT BOOST_CUSTOM)
@@ -1076,6 +1091,9 @@ if(UNIX AND NOT APPLE)
                        if(WITH_CYCLES_NETWORK)
                                list(APPEND __boost_packages serialization)
                        endif()
+                       if(WITH_OPENVDB)
+                               list(APPEND __boost_packages iostreams)
+                       endif()
                        find_package(Boost 1.48 COMPONENTS ${__boost_packages})
                        if(NOT Boost_FOUND)
                                # try to find non-multithreaded if -mt not found, this flag
@@ -1292,13 +1310,22 @@ elseif(WIN32)
                set(PLATFORM_LINKFLAGS_DEBUG "/IGNORE:4099 /NODEFAULTLIB:libcmt.lib /NODEFAULTLIB:libc.lib")
 
                if(NOT DEFINED LIBDIR)
+
                        # Setup 64bit and 64bit windows systems
                        if(CMAKE_CL_64)
                                message(STATUS "64 bit compiler detected.")
-                               set(LIBDIR ${CMAKE_SOURCE_DIR}/../lib/win64_vc12)
+                               set(LIBDIR_BASE "win64")
                        else()
                                message(STATUS "32 bit compiler detected.")
-                               set(LIBDIR ${CMAKE_SOURCE_DIR}/../lib/windows_vc12)
+                               set(LIBDIR_BASE "windows")
+                       endif()
+
+                       if(MSVC_VERSION EQUAL 1900)
+                               message(STATUS "Visual Studio 2015 detected.")
+                               set(LIBDIR ${CMAKE_SOURCE_DIR}/../lib/${LIBDIR_BASE}_vc14)
+                       else()
+                               message(STATUS "Visual Studio 2013 detected.")
+                               set(LIBDIR ${CMAKE_SOURCE_DIR}/../lib/${LIBDIR_BASE}_vc12)
                        endif()
                else()
                        message(STATUS using LIBDIR  ${LIBDIR})
@@ -1330,9 +1357,7 @@ elseif(WIN32)
                        set(PNG_LIBPATH ${PNG}/lib) # not cmake defined
                endif()
 
-               if(MSVC)
-                       set(JPEG_NAMES ${JPEG_NAMES} libjpeg)
-               endif()
+               set(JPEG_NAMES ${JPEG_NAMES} libjpeg)
                find_package(jpeg REQUIRED)
 
                set(PTHREADS_INCLUDE_DIRS ${LIBDIR}/pthreads/include)
@@ -1476,12 +1501,12 @@ elseif(WIN32)
                                set(BOOST_INCLUDE_DIR ${BOOST}/include)
                                if(MSVC12)
                                        set(BOOST_LIBPATH ${BOOST}/lib)
-                                       set(BOOST_POSTFIX "vc120-mt-s-1_55.lib")
-                                       set(BOOST_DEBUG_POSTFIX "vc120-mt-sgd-1_55.lib")
+                                       set(BOOST_POSTFIX "vc120-mt-s-1_60.lib")
+                                       set(BOOST_DEBUG_POSTFIX "vc120-mt-sgd-1_60.lib")
                                else()
                                        set(BOOST_LIBPATH ${BOOST}/lib)
-                                       set(BOOST_POSTFIX "vc90-mt-s-1_49.lib")
-                                       set(BOOST_DEBUG_POSTFIX "vc90-mt-sgd-1_49.lib")
+                                       set(BOOST_POSTFIX "vc140-mt-s-1_60.lib")
+                                       set(BOOST_DEBUG_POSTFIX "vc140-mt-sgd-1_60.lib")
                                endif()
                                set(BOOST_LIBRARIES
                                        optimized libboost_date_time-${BOOST_POSTFIX} optimized libboost_filesystem-${BOOST_POSTFIX}
@@ -1554,7 +1579,14 @@ elseif(WIN32)
                        set(OPENCOLORIO_LIBPATH ${LIBDIR}/opencolorio/lib)
                        set(OPENCOLORIO_DEFINITIONS)
                endif()
-               
+
+               if(WITH_OPENVDB)
+                       set(OPENVDB ${LIBDIR}/openvdb)
+                       set(OPENVDB_INCLUDE_DIRS ${OPENVDB}/include)
+                       set(OPENVDB_LIBRARIES openvdb ${TBB_LIBRARIES})
+                       set(OPENVDB_LIBPATH ${LIBDIR}/openvdb/lib)
+                       set(OPENVDB_DEFINITIONS)
+               endif()
 
                if(WITH_MOD_CLOTH_ELTOPO)
                        set(LAPACK ${LIBDIR}/lapack)
@@ -1577,8 +1609,13 @@ elseif(WIN32)
                if(WITH_SDL)
                        set(SDL ${LIBDIR}/sdl)
                        set(SDL_INCLUDE_DIR ${SDL}/include)
-                       set(SDL_LIBRARY SDL2)
                        set(SDL_LIBPATH ${SDL}/lib)
+                       # MinGW TODO: Update MinGW to SDL2
+                       if(NOT CMAKE_COMPILER_IS_GNUCC)
+                               set(SDL_LIBRARY SDL2)
+                       else()
+                               set(SDL_LIBRARY SDL)
+                       endif()
                endif()
 
                # Audio IO
@@ -1608,12 +1645,7 @@ elseif(WIN32)
                
                if(WITH_MINGW64)
                        message(STATUS "Compiling for 64 bit with MinGW-w64.")
-                       execute_process(COMMAND ${CMAKE_C_COMPILER} -dumpversion OUTPUT_VARIABLE GCC_VERSION)
-                       if(GCC_VERSION VERSION_GREATER 4.9 OR GCC_VERSION VERSION_EQUAL 4.9)
-                               set(LIBDIR ${CMAKE_SOURCE_DIR}/../lib/mingw64_gcc49)
-                       else()
-                               set(LIBDIR ${CMAKE_SOURCE_DIR}/../lib/mingw64)
-                       endif()
+                       set(LIBDIR ${CMAKE_SOURCE_DIR}/../lib/mingw64)
                else()
                        message(STATUS "Compiling for 32 bit with MinGW-w32.")
                        set(LIBDIR ${CMAKE_SOURCE_DIR}/../lib/mingw32)
@@ -1734,7 +1766,7 @@ elseif(WIN32)
 
                if(WITH_PYTHON)
                        # normally cached but not since we include them with blender
-                       set(PYTHON_VERSION 3.4) #  CACHE STRING)
+                       set(PYTHON_VERSION 3.5) #  CACHE STRING)
                        string(REPLACE "." "" _PYTHON_VERSION_NO_DOTS ${PYTHON_VERSION})
                        set(PYTHON_INCLUDE_DIR "${LIBDIR}/python/include/python${PYTHON_VERSION}")  # CACHE PATH)
                        set(PYTHON_LIBRARY "${LIBDIR}/python/lib/python${_PYTHON_VERSION_NO_DOTS}mw.lib")  # CACHE FILEPATH)
@@ -1827,6 +1859,14 @@ elseif(WIN32)
                        set(SDL_LIBPATH ${SDL}/lib)
                endif()
 
+               if(WITH_OPENVDB)
+                       set(OPENVDB ${LIBDIR}/openvdb)
+                       set(OPENVDB_INCLUDE_DIRS ${OPENVDB}/include)
+                       set(OPENVDB_LIBRARIES openvdb ${TBB_LIBRARIES})
+                       set(OPENVDB_LIBPATH ${LIBDIR}/openvdb/lib)
+                       set(OPENVDB_DEFINITIONS)
+               endif()
+
                set(PLATFORM_LINKFLAGS "-Xlinker --stack=2097152")
 
                ## DISABLE - causes linking errors 
@@ -1939,8 +1979,8 @@ elseif(APPLE)
        endif()
 
        if(WITH_PYTHON)
-               # we use precompiled libraries for py 3.4 and up by default
-               set(PYTHON_VERSION 3.4)
+               # we use precompiled libraries for py 3.5 and up by default
+               set(PYTHON_VERSION 3.5)
                if(NOT WITH_PYTHON_MODULE AND NOT WITH_PYTHON_FRAMEWORK)
                        # normally cached but not since we include them with blender
                        set(PYTHON_INCLUDE_DIR "${LIBDIR}/python/include/python${PYTHON_VERSION}m")
@@ -2132,6 +2172,14 @@ elseif(APPLE)
                set(OPENCOLORIO_LIBPATH ${OPENCOLORIO}/lib)
        endif()
 
+       if(WITH_OPENVDB)
+               set(OPENVDB ${LIBDIR}/openvdb)
+               set(OPENVDB_INCLUDE_DIRS ${OPENVDB}/include)
+               set(OPENVDB_LIBRARIES openvdb ${TBB_LIBRARIES})
+               set(OPENVDB_LIBPATH ${LIBDIR}/openvdb/lib)
+               set(OPENVDB_DEFINITIONS)
+       endif()
+
        if(WITH_LLVM)
                set(LLVM_ROOT_DIR ${LIBDIR}/llvm CACHE PATH     "Path to the LLVM installation")
                set(LLVM_VERSION "3.4" CACHE STRING     "Version of LLVM to use")
@@ -2458,8 +2506,18 @@ endif()
 if(WITH_OPENMP)
        find_package(OpenMP)
        if(OPENMP_FOUND)
-               set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
-               set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
+               if(NOT WITH_OPENMP_STATIC)
+                       set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
+                       set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
+               else()
+                       # Typically avoid adding flags as defines but we can't
+                       # pass OpenMP flags to the linker for static builds, meaning
+                       # we can't add any OpenMP related flags to CFLAGS variables
+                       # since they're passed to the linker as well.
+                       add_definitions("${OpenMP_C_FLAGS}")
+
+                       find_library_static(OpenMP_LIBRARIES gomp ${CMAKE_CXX_IMPLICIT_LINK_DIRECTORIES})
+               endif()
        else()
                set(WITH_OPENMP OFF)
        endif()
@@ -2564,6 +2622,59 @@ if(WITH_PYTHON_MODULE)
        add_definitions(-DPy_ENABLE_SHARED)
 endif()
 
+#-----------------------------------------------------------------------------
+# Configure GLog/GFlags
+
+if(WITH_LIBMV OR WITH_GTESTS OR (WITH_CYCLES AND WITH_CYCLES_LOGGING))
+       set(GLOG_DEFINES
+               -DGOOGLE_GLOG_DLL_DECL=
+       )
+
+       set(GFLAGS_DEFINES
+               -DGFLAGS_DLL_DEFINE_FLAG=
+               -DGFLAGS_DLL_DECLARE_FLAG=
+               -DGFLAGS_DLL_DECL=
+       )
+endif()
+
+#-----------------------------------------------------------------------------
+# Configure Ceres
+
+if(WITH_LIBMV)
+       set(CERES_DEFINES)
+
+       if(SHARED_PTR_FOUND)
+               if(SHARED_PTR_TR1_MEMORY_HEADER)
+                       list(APPEND CERES_DEFINES -DCERES_TR1_MEMORY_HEADER)
+               endif()
+               if(SHARED_PTR_TR1_NAMESPACE)
+                       list(APPEND CERES_DEFINES -DCERES_TR1_SHARED_PTR)
+               endif()
+       else()
+               message(FATAL_ERROR "Ceres: Unable to find shared_ptr.")
+       endif()
+
+       if(HAVE_STD_UNORDERED_MAP_HEADER)
+               if(HAVE_UNORDERED_MAP_IN_STD_NAMESPACE)
+                       list(APPEND CERES_DEFINES -DCERES_STD_UNORDERED_MAP)
+               else()
+                       if(HAVE_UNORDERED_MAP_IN_TR1_NAMESPACE)
+                               list(APPEND CERES_DEFINES -DCERES_STD_UNORDERED_MAP_IN_TR1_NAMESPACE)
+                       else()
+                               list(APPEND CERES_DEFINES -DCERES_NO_UNORDERED_MAP)
+                               message(STATUS "Ceres: Replacing unordered_map/set with map/set (warning: slower!)")
+                       endif()
+               endif()
+       else()
+               if(HAVE_UNORDERED_MAP_IN_TR1_NAMESPACE)
+                       list(APPEND CERES_DEFINES -DCERES_TR1_UNORDERED_MAP)
+               else()
+                       list(APPEND CERES_DEFINES -DCERES_NO_UNORDERED_MAP)
+                       message(STATUS "Ceres: Replacing unordered_map/set with map/set (warning: slower!)")
+               endif()
+       endif()
+endif()
+
 #-----------------------------------------------------------------------------
 # Extra compile flags
 
@@ -2602,6 +2713,11 @@ if(CMAKE_COMPILER_IS_GNUCC)
                ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_REDUNDANT_DECLS -Wredundant-decls)
        endif()
 
+       # versions before gcc4.8 include global name-space.
+       if(NOT "${CMAKE_C_COMPILER_VERSION}" VERSION_LESS "4.8")
+               ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_SHADOW -Wshadow)
+       endif()
+
        # disable because it gives warnings for printf() & friends.
        # ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_DOUBLE_PROMOTION -Wdouble-promotion -Wno-error=double-promotion)
 
@@ -2715,6 +2831,7 @@ elseif(CMAKE_C_COMPILER_ID MATCHES "MSVC")
                "/w34062"  # switch statement contains 'default' but no 'case' labels
                # disable:
                "/wd4018"  # signed/unsigned mismatch
+               "/wd4146"  # unary minus operator applied to unsigned type, result still unsigned
                "/wd4065"  # switch statement contains 'default' but no 'case' labels
                "/wd4127"  # conditional expression is constant
                "/wd4181"  # qualifier applied to reference type; ignored
@@ -2769,7 +2886,7 @@ if(WITH_CPP11)
 endif()
 
 # Visual Studio has all standards it supports available by default
-if(CMAKE_COMPILER_IS_GNUCC)
+if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID MATCHES "Clang" OR CMAKE_C_COMPILER_ID MATCHES "Intel")
        # Use C99 + GNU extensions, works with GCC, Clang, ICC
        set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu99")
 endif()
@@ -2829,7 +2946,9 @@ if(WITH_BLENDER OR WITH_PLAYER)
 elseif(WITH_CYCLES_STANDALONE)
        add_subdirectory(intern/cycles)
        add_subdirectory(extern/clew)
-       add_subdirectory(extern/cuew)
+       if(WITH_CUDA_DYNLOAD)
+               add_subdirectory(extern/cuew)
+       endif()
        if(NOT WITH_SYSTEM_GLEW)
                add_subdirectory(extern/glew)
        endif()
@@ -2903,6 +3022,7 @@ if(FIRST_RUN)
        info_cfg_option(WITH_CYCLES)
        info_cfg_option(WITH_FREESTYLE)
        info_cfg_option(WITH_OPENCOLORIO)
+       info_cfg_option(WITH_OPENVDB)
 
        info_cfg_text("Compiler Options:")
        info_cfg_option(WITH_BUILDINFO)
@@ -2968,12 +3088,6 @@ if(FIRST_RUN)
                info_cfg_option(WITH_GL_ANGLE)
        endif()
 
-       info_cfg_text("Other:")
-       info_cfg_option(WITH_OPENNL)
-
-       # debug
-       message(STATUS "HAVE_STDBOOL_H = ${HAVE_STDBOOL_H}")
-
        info_cfg_text("")
 
        message("${_config_msg}")