Lock-free memory allocator
[blender.git] / CMakeLists.txt
index c754215ee1b2002d0b4b38d0fd99671d81069fb8..6eb8ec097b4ccc28bc6416f0dc1a72fdbc8b047d 100644 (file)
@@ -206,6 +206,7 @@ option(WITH_MOD_OCEANSIM        "Enable Ocean Modifier" OFF)
 option(WITH_IMAGE_OPENEXR       "Enable OpenEXR Support (http://www.openexr.com)" ON)
 option(WITH_IMAGE_OPENJPEG      "Enable OpenJpeg Support (http://www.openjpeg.org)" ON)
 option(WITH_IMAGE_TIFF          "Enable LibTIFF Support" ON)
+option(WITH_IMAGE_PSD           "Enable Photoshop PSD Support" ON)
 option(WITH_IMAGE_DDS           "Enable DDS Image Support" ON)
 option(WITH_IMAGE_CINEON        "Enable CINEON and DPX Image Support" ON)
 option(WITH_IMAGE_HDR           "Enable HDR Image Support" ON)
@@ -278,13 +279,14 @@ mark_as_advanced(LLVM_STATIC)
 option(WITH_MEM_JEMALLOC   "Enable malloc replacement (http://www.canonware.com/jemalloc)" OFF)
 mark_as_advanced(WITH_MEM_JEMALLOC)
 
+# currently only used for BLI_mempool
+option(WITH_MEM_VALGRIND "Enable extended valgrind support for better reporting" OFF)
+mark_as_advanced(WITH_MEM_VALGRIND)
+
 # Debug
 option(WITH_CXX_GUARDEDALLOC "Enable GuardedAlloc for C++ memory allocation tracking (only enable for development)" OFF)
 mark_as_advanced(WITH_CXX_GUARDEDALLOC)
 
-option(WITH_GUARDEDALLOC "Enable GuardedAlloc (DISABLE AT OWN RISK!)" ON)
-mark_as_advanced(WITH_GUARDEDALLOC)
-
 option(WITH_ASSERT_ABORT "Call abort() when raising an assertion through BLI_assert()" OFF)
 mark_as_advanced(WITH_ASSERT_ABORT)
 
@@ -368,7 +370,7 @@ if(APPLE)
        endif()
        
        if(NOT CMAKE_OSX_DEPLOYMENT_TARGET)
-                       set(CMAKE_OSX_DEPLOYMENT_TARGET "10.5" CACHE STRING "" FORCE) # 10.5 is our min. target, if you use higher sdk, weak linking happens
+               set(CMAKE_OSX_DEPLOYMENT_TARGET "10.5" CACHE STRING "" FORCE) # 10.5 is our min. target, if you use higher sdk, weak linking happens
        endif()
        
        if(NOT ${CMAKE_GENERATOR} MATCHES "Xcode")
@@ -437,6 +439,11 @@ if(NOT WITH_PYTHON)
        set(WITH_CYCLES OFF)
 endif()
 
+# auto enable openimageio for photoshop psd
+if(WITH_IMAGE_PSD)
+       set(WITH_OPENIMAGEIO ON)
+endif()
+
 # enable boost for cycles, booleans, audaspace or i18n
 # otherwise if the user disabled
 if(NOT WITH_BOOST)
@@ -456,7 +463,7 @@ if(NOT WITH_BOOST)
 
        set_and_warn(WITH_OPENAL         OFF)  # depends on AUDASPACE
        set_and_warn(WITH_GAMEENGINE     OFF)  # depends on AUDASPACE
-elseif(WITH_CYCLES OR WITH_MOD_BOOLEAN OR WITH_AUDASPACE OR WITH_INTERNATIONAL)
+elseif(WITH_CYCLES OR WITH_OPENIMAGEIO OR WITH_MOD_BOOLEAN OR WITH_AUDASPACE OR WITH_INTERNATIONAL)
        # Keep enabled
 else()
        # Enabled but we don't need it
@@ -798,33 +805,38 @@ if(UNIX AND NOT APPLE)
                                find_program(LLVM_CONFIG llvm-config)
                        endif()
                endif()
-               execute_process(COMMAND ${LLVM_CONFIG} --version
-                               OUTPUT_VARIABLE LLVM_VERSION
-                               OUTPUT_STRIP_TRAILING_WHITESPACE)
-               execute_process(COMMAND ${LLVM_CONFIG} --prefix
-                               OUTPUT_VARIABLE LLVM_DIRECTORY
-                               OUTPUT_STRIP_TRAILING_WHITESPACE)
-               execute_process(COMMAND ${LLVM_CONFIG} --libdir
-                               OUTPUT_VARIABLE LLVM_LIB_DIR
-                               OUTPUT_STRIP_TRAILING_WHITESPACE)
+
+               if(NOT DEFINED LLVM_VERSION)
+                       execute_process(COMMAND ${LLVM_CONFIG} --version
+                                                       OUTPUT_VARIABLE LLVM_VERSION
+                                                       OUTPUT_STRIP_TRAILING_WHITESPACE)
+                       set(LLVM_VERSION ${LLVM_VERSION} CACHE STRING "Version of LLVM to use")
+               endif()
+               if(NOT DEFINED LLVM_DIRECTORY)
+                       execute_process(COMMAND ${LLVM_CONFIG} --prefix
+                                                       OUTPUT_VARIABLE LLVM_DIRECTORY
+                                                       OUTPUT_STRIP_TRAILING_WHITESPACE)
+                       set(LLVM_DIRECTORY ${LLVM_DIRECTORY} CACHE PATH "Path to the LLVM installation")
+               endif()
+               if(NOT DEFINED LLVM_LIBPATH)
+                       execute_process(COMMAND ${LLVM_CONFIG} --libdir
+                                                       OUTPUT_VARIABLE LLVM_LIBPATH
+                                                       OUTPUT_STRIP_TRAILING_WHITESPACE)
+                       set(LLVM_LIBPATH ${LLVM_LIBPATH} CACHE PATH "Path to the LLVM library path")
+               endif()
 
                if(LLVM_STATIC)
                        find_library(LLVM_LIBRARY
                                     NAMES LLVMAnalysis # first of a whole bunch of libs to get
-                                    PATHS ${LLVM_LIB_DIR})
+                                    PATHS ${LLVM_LIBPATH})
                else()
                        find_library(LLVM_LIBRARY
                                     NAMES LLVM-${LLVM_VERSION}
-                                    PATHS ${LLVM_LIB_DIR})
+                                    PATHS ${LLVM_LIBPATH})
                endif()
 
-               message(STATUS "LLVM version  = ${LLVM_VERSION}")
-               message(STATUS "LLVM dir      = ${LLVM_DIRECTORY}")
-               message(STATUS "LLVM lib dir  = ${LLVM_LIB_DIR}")
-               set(LLVM_VERSION ${LLVM_VERSION} CACHE STRING "Version of LLVM to use")
-               set(LLVM_DIRECTORY ${LLVM_DIRECTORY} CACHE PATH "Path to the LLVM installation")
 
-               if(LLVM_LIBRARY AND LLVM_DIRECTORY AND LLVM_LIB_DIR)
+               if(LLVM_LIBRARY AND LLVM_DIRECTORY AND LLVM_LIBPATH)
                        if(LLVM_STATIC)
                                # if static LLVM libraries were requested, use llvm-config to generate
                                # the list of what libraries we need, and substitute that in the right
@@ -832,7 +844,7 @@ if(UNIX AND NOT APPLE)
                                execute_process(COMMAND ${LLVM_CONFIG} --libfiles
                                                OUTPUT_VARIABLE LLVM_LIBRARY
                                                OUTPUT_STRIP_TRAILING_WHITESPACE)
-                               string(REPLACE " " ";" LLVM_LIBRARY ${LLVM_LIBRARY})
+                               string(REPLACE " " ";" LLVM_LIBRARY "${LLVM_LIBRARY}")
                        endif()
                else()
                        message(FATAL_ERROR "LLVM not found.")
@@ -1449,7 +1461,7 @@ elseif(WIN32)
                
                if(WITH_LLVM)
                        set(LLVM_DIRECTORY ${LIBDIR}/llvm CACHE PATH    "Path to the LLVM installation")
-                       set(LLVM_LIB_DIR ${LLVM_DIRECTORY}/lib)
+                       set(LLVM_LIBPATH ${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
@@ -1743,13 +1755,13 @@ elseif(APPLE)
                                OUTPUT_VARIABLE LLVM_DIRECTORY
                                OUTPUT_STRIP_TRAILING_WHITESPACE)
                execute_process(COMMAND ${LLVM_CONFIG} --libdir
-                               OUTPUT_VARIABLE LLVM_LIB_DIR
+                               OUTPUT_VARIABLE LLVM_LIBPATH
                                OUTPUT_STRIP_TRAILING_WHITESPACE)
                find_library(LLVM_LIBRARY
                             NAMES LLVMAnalysis # first of a whole bunch of libs to get
-                            PATHS ${LLVM_LIB_DIR})
+                            PATHS ${LLVM_LIBPATH})
 
-               if(LLVM_LIBRARY AND LLVM_DIRECTORY AND LLVM_LIB_DIR)
+               if(LLVM_LIBRARY AND LLVM_DIRECTORY AND LLVM_LIBPATH)
                        if(LLVM_STATIC)
                                # if static LLVM libraries were requested, use llvm-config to generate
                                # the list of what libraries we need, and substitute that in the right
@@ -2276,6 +2288,7 @@ if(FIRST_RUN)
        info_cfg_option(WITH_X11_XF86VMODE)
        info_cfg_option(WITH_X11_XINPUT)
        info_cfg_option(WITH_MEM_JEMALLOC)
+       info_cfg_option(WITH_MEM_VALGRIND)
        info_cfg_option(WITH_SYSTEM_GLEW)
        info_cfg_option(WITH_SYSTEM_OPENJPEG)
 
@@ -2287,6 +2300,7 @@ if(FIRST_RUN)
        info_cfg_option(WITH_IMAGE_OPENJPEG)
        info_cfg_option(WITH_IMAGE_REDCODE)
        info_cfg_option(WITH_IMAGE_TIFF)
+       info_cfg_option(WITH_IMAGE_PSD)
 
        info_cfg_text("Audio:")
        info_cfg_option(WITH_OPENAL)