diff options
author | Xiao Xiangquan <xiaoxiangquan@gmail.com> | 2011-06-24 07:30:50 +0400 |
---|---|---|
committer | Xiao Xiangquan <xiaoxiangquan@gmail.com> | 2011-06-24 07:30:50 +0400 |
commit | b429af10d04d727574eb50a7186e8075ae8fb0b8 (patch) | |
tree | dae073488e49cb2a4107d3fe2d553711496bf4f9 /build_files/cmake | |
parent | 9a2f36b50f818c0c1b659363a1df298f7043e207 (diff) |
merge from trunk #37722
Diffstat (limited to 'build_files/cmake')
-rw-r--r-- | build_files/cmake/FindPythonLibsUnix.cmake | 81 | ||||
-rwxr-xr-x | build_files/cmake/Modules/FindFftw3.cmake | 70 | ||||
-rwxr-xr-x | build_files/cmake/Modules/FindJack.cmake | 70 | ||||
-rwxr-xr-x | build_files/cmake/Modules/FindJeMalloc.cmake | 70 | ||||
-rwxr-xr-x | build_files/cmake/Modules/FindOpenEXR.cmake | 92 | ||||
-rwxr-xr-x | build_files/cmake/Modules/FindOpenJPEG.cmake | 70 | ||||
-rwxr-xr-x | build_files/cmake/Modules/FindPythonLibsUnix.cmake | 121 | ||||
-rwxr-xr-x | build_files/cmake/Modules/FindSamplerate.cmake | 70 | ||||
-rwxr-xr-x | build_files/cmake/Modules/FindSndFile.cmake | 68 | ||||
-rwxr-xr-x | build_files/cmake/cmake_consistency_check.py | 58 | ||||
-rw-r--r-- | build_files/cmake/macros.cmake | 136 |
11 files changed, 776 insertions, 130 deletions
diff --git a/build_files/cmake/FindPythonLibsUnix.cmake b/build_files/cmake/FindPythonLibsUnix.cmake deleted file mode 100644 index 2554b8a3585..00000000000 --- a/build_files/cmake/FindPythonLibsUnix.cmake +++ /dev/null @@ -1,81 +0,0 @@ -# - Find python libraries -# -# PYTHON_VERSION -# PYTHON_INCLUDE_DIRS -# PYTHON_LIBRARY -# PYTHON_LIBPATH -# PYTHON_LINKFLAGS - -#============================================================================= - -set(PYTHON_VERSION 3.2 CACHE STRING "") -mark_as_advanced(PYTHON_VERSION) - -set(PYTHON_LINKFLAGS "-Xlinker -export-dynamic") -mark_as_advanced(PYTHON_LINKFLAGS) - -set(_Python_ABI_FLAGS - "m;mu;u; ") - -string(REPLACE "." "" _PYTHON_VERSION_NO_DOTS ${PYTHON_VERSION}) -set(_Python_PATHS - "$ENV{HOME}/py${_PYTHON_VERSION_NO_DOTS}" "/opt/py${_PYTHON_VERSION_NO_DOTS}" "/usr" "/usr/local") - -if(NOT DEFINED PYTHON_INCLUDE_DIRS) - message(STATUS "Looking for include Python.h") - set(_Found_PYTHON_H OFF) - - foreach(_CURRENT_PATH ${_Python_PATHS}) - foreach(_CURRENT_ABI_FLAGS ${_Python_ABI_FLAGS}) - if(CMAKE_BUILD_TYPE STREQUAL Debug) - set(_CURRENT_ABI_FLAGS "d${_CURRENT_ABI_FLAGS}") - endif() - string(REPLACE " " "" _CURRENT_ABI_FLAGS ${_CURRENT_ABI_FLAGS}) - - set(_Python_HEADER "${_CURRENT_PATH}/include/python${PYTHON_VERSION}${_CURRENT_ABI_FLAGS}/Python.h") - - if(EXISTS ${_Python_HEADER}) - message(STATUS "Checking for header: ${_Python_HEADER} - found") - set(_Found_PYTHON_H ON) - set(PYTHON ${_CURRENT_PATH}) - set(PYTHON_ABI_FLAGS ${_CURRENT_ABI_FLAGS}) - break() - else() - message(STATUS "Checking for header: ${_Python_HEADER}") - endif() - endforeach() - - if(_Found_PYTHON_H) - break() - endif() - endforeach() - - if(NOT _Found_PYTHON_H) - message(FATAL_ERROR "Python.h not found") - endif() - - unset(_Found_PYTHON_H) - unset(_Python_HEADER) - unset(_CURRENT_ABI_FLAGS) - unset(_CURRENT_PATH) - -endif() - -unset(_Python_ABI_FLAGS) -unset(_Python_PATHS) - -#============================================================================= -# now the python versions are found - - -set(PYTHON_INCLUDE_DIRS "${PYTHON}/include/python${PYTHON_VERSION}${PYTHON_ABI_FLAGS}" CACHE STRING "") -mark_as_advanced(PYTHON_INCLUDE_DIRS) -set(PYTHON_LIBRARY "python${PYTHON_VERSION}${PYTHON_ABI_FLAGS}" CACHE STRING "") -mark_as_advanced(PYTHON_LIBRARY) -set(PYTHON_LIBPATH ${PYTHON}/lib CACHE STRING "") -mark_as_advanced(PYTHON_LIBPATH) -# set(PYTHON_BINARY ${PYTHON_EXECUTABLE} CACHE STRING "") - -if(NOT EXISTS "${PYTHON_INCLUDE_DIRS}/Python.h") - message(FATAL_ERROR " Missing python header: ${PYTHON_INCLUDE_DIRS}/Python.h") -endif() diff --git a/build_files/cmake/Modules/FindFftw3.cmake b/build_files/cmake/Modules/FindFftw3.cmake new file mode 100755 index 00000000000..197d4aab7b6 --- /dev/null +++ b/build_files/cmake/Modules/FindFftw3.cmake @@ -0,0 +1,70 @@ +# - Find Fftw3 library +# Find the native Fftw3 includes and library +# This module defines +# FFTW3_INCLUDE_DIRS, where to find fftw3.h, Set when +# FFTW3_INCLUDE_DIR is found. +# FFTW3_LIBRARIES, libraries to link against to use Fftw3. +# FFTW3_ROOT_DIR, The base directory to search for Fftw3. +# This can also be an environment variable. +# FFTW3_FOUND, If false, do not try to use Fftw3. +# +# also defined, but not for general use are +# FFTW3_LIBRARY, where to find the Fftw3 library. + +#============================================================================= +# Copyright 2011 Blender Foundation. +# +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file Copyright.txt for details. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= + +# If FFTW3_ROOT_DIR was defined in the environment, use it. +IF(NOT FFTW3_ROOT_DIR AND NOT $ENV{FFTW3_ROOT_DIR} STREQUAL "") + SET(FFTW3_ROOT_DIR $ENV{FFTW3_ROOT_DIR}) +ENDIF() + +SET(_fftw3_SEARCH_DIRS + ${FFTW3_ROOT_DIR} + /usr/local + /sw # Fink + /opt/local # DarwinPorts + /opt/csw # Blastwave +) + +FIND_PATH(FFTW3_INCLUDE_DIR + NAMES + fftw3.h + HINTS + ${_fftw3_SEARCH_DIRS} + PATH_SUFFIXES + include +) + +FIND_LIBRARY(FFTW3_LIBRARY + NAMES + fftw3 + HINTS + ${_fftw3_SEARCH_DIRS} + PATH_SUFFIXES + lib64 lib + ) + +# handle the QUIETLY and REQUIRED arguments and set FFTW3_FOUND to TRUE if +# all listed variables are TRUE +INCLUDE(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(Fftw3 DEFAULT_MSG + FFTW3_LIBRARY FFTW3_INCLUDE_DIR) + +IF(FFTW3_FOUND) + SET(FFTW3_LIBRARIES ${FFTW3_LIBRARY}) + SET(FFTW3_INCLUDE_DIRS ${FFTW3_INCLUDE_DIR}) +ENDIF(FFTW3_FOUND) + +MARK_AS_ADVANCED( + FFTW3_INCLUDE_DIR + FFTW3_LIBRARY +) diff --git a/build_files/cmake/Modules/FindJack.cmake b/build_files/cmake/Modules/FindJack.cmake new file mode 100755 index 00000000000..9a847fabf70 --- /dev/null +++ b/build_files/cmake/Modules/FindJack.cmake @@ -0,0 +1,70 @@ +# - Find Jack library +# Find the native Jack includes and library +# This module defines +# JACK_INCLUDE_DIRS, where to find jack.h, Set when +# JACK_INCLUDE_DIR is found. +# JACK_LIBRARIES, libraries to link against to use Jack. +# JACK_ROOT_DIR, The base directory to search for Jack. +# This can also be an environment variable. +# JACK_FOUND, If false, do not try to use Jack. +# +# also defined, but not for general use are +# JACK_LIBRARY, where to find the Jack library. + +#============================================================================= +# Copyright 2011 Blender Foundation. +# +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file Copyright.txt for details. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= + +# If JACK_ROOT_DIR was defined in the environment, use it. +IF(NOT JACK_ROOT_DIR AND NOT $ENV{JACK_ROOT_DIR} STREQUAL "") + SET(JACK_ROOT_DIR $ENV{JACK_ROOT_DIR}) +ENDIF() + +SET(_jack_SEARCH_DIRS + ${JACK_ROOT_DIR} + /usr/local + /sw # Fink + /opt/local # DarwinPorts + /opt/csw # Blastwave +) + +FIND_PATH(JACK_INCLUDE_DIR + NAMES + jack.h + HINTS + ${_jack_SEARCH_DIRS} + PATH_SUFFIXES + include/jack +) + +FIND_LIBRARY(JACK_LIBRARY + NAMES + jack + HINTS + ${_jack_SEARCH_DIRS} + PATH_SUFFIXES + lib64 lib + ) + +# handle the QUIETLY and REQUIRED arguments and set JACK_FOUND to TRUE if +# all listed variables are TRUE +INCLUDE(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(Jack DEFAULT_MSG + JACK_LIBRARY JACK_INCLUDE_DIR) + +IF(JACK_FOUND) + SET(JACK_LIBRARIES ${JACK_LIBRARY}) + SET(JACK_INCLUDE_DIRS ${JACK_INCLUDE_DIR}) +ENDIF(JACK_FOUND) + +MARK_AS_ADVANCED( + JACK_INCLUDE_DIR + JACK_LIBRARY +) diff --git a/build_files/cmake/Modules/FindJeMalloc.cmake b/build_files/cmake/Modules/FindJeMalloc.cmake new file mode 100755 index 00000000000..5c7aa2cf1e1 --- /dev/null +++ b/build_files/cmake/Modules/FindJeMalloc.cmake @@ -0,0 +1,70 @@ +# - Find JeMalloc library +# Find the native JeMalloc includes and library +# This module defines +# JEMALLOC_INCLUDE_DIRS, where to find jemalloc.h, Set when +# JEMALLOC_INCLUDE_DIR is found. +# JEMALLOC_LIBRARIES, libraries to link against to use JeMalloc. +# JEMALLOC_ROOT_DIR, The base directory to search for JeMalloc. +# This can also be an environment variable. +# JEMALLOC_FOUND, If false, do not try to use JeMalloc. +# +# also defined, but not for general use are +# JEMALLOC_LIBRARY, where to find the JeMalloc library. + +#============================================================================= +# Copyright 2011 Blender Foundation. +# +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file Copyright.txt for details. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= + +# If JEMALLOC_ROOT_DIR was defined in the environment, use it. +IF(NOT JEMALLOC_ROOT_DIR AND NOT $ENV{JEMALLOC_ROOT_DIR} STREQUAL "") + SET(JEMALLOC_ROOT_DIR $ENV{JEMALLOC_ROOT_DIR}) +ENDIF() + +SET(_jemalloc_SEARCH_DIRS + ${JEMALLOC_ROOT_DIR} + /usr/local + /sw # Fink + /opt/local # DarwinPorts + /opt/csw # Blastwave +) + +FIND_PATH(JEMALLOC_INCLUDE_DIR + NAMES + jemalloc.h + HINTS + ${_jemalloc_SEARCH_DIRS} + PATH_SUFFIXES + include/jemalloc +) + +FIND_LIBRARY(JEMALLOC_LIBRARY + NAMES + jemalloc + HINTS + ${_jemalloc_SEARCH_DIRS} + PATH_SUFFIXES + lib64 lib + ) + +# handle the QUIETLY and REQUIRED arguments and set JEMALLOC_FOUND to TRUE if +# all listed variables are TRUE +INCLUDE(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(JeMalloc DEFAULT_MSG + JEMALLOC_LIBRARY JEMALLOC_INCLUDE_DIR) + +IF(JEMALLOC_FOUND) + SET(JEMALLOC_LIBRARIES ${JEMALLOC_LIBRARY}) + SET(JEMALLOC_INCLUDE_DIRS ${JEMALLOC_INCLUDE_DIR}) +ENDIF(JEMALLOC_FOUND) + +MARK_AS_ADVANCED( + JEMALLOC_INCLUDE_DIR + JEMALLOC_LIBRARY +) diff --git a/build_files/cmake/Modules/FindOpenEXR.cmake b/build_files/cmake/Modules/FindOpenEXR.cmake new file mode 100755 index 00000000000..546f690dbf6 --- /dev/null +++ b/build_files/cmake/Modules/FindOpenEXR.cmake @@ -0,0 +1,92 @@ +# - Find OpenEXR library +# Find the native OpenEXR includes and library +# This module defines +# OPENEXR_INCLUDE_DIRS, where to find ImfXdr.h, etc. Set when +# OPENEXR_INCLUDE_DIR is found. +# OPENEXR_LIBRARIES, libraries to link against to use OpenEXR. +# OPENEXR_ROOT_DIR, The base directory to search for OpenEXR. +# This can also be an environment variable. +# OPENEXR_FOUND, If false, do not try to use OpenEXR. +# +# For indervidual library access these advanced settings are available +# OPENEXR_HALF_LIBRARY, Path to Half library +# OPENEXR_IEX_LIBRARY, Path to Half library +# OPENEXR_ILMIMF_LIBRARY, Path to Ilmimf library +# OPENEXR_ILMTHREAD_LIBRARY, Path to IlmThread library +# OPENEXR_IMATH_LIBRARY, Path to Imath library +# +# also defined, but not for general use are +# OPENEXR_LIBRARY, where to find the OpenEXR library. + +#============================================================================= +# Copyright 2011 Blender Foundation. +# +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file Copyright.txt for details. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= + +# If OPENEXR_ROOT_DIR was defined in the environment, use it. +IF(NOT OPENEXR_ROOT_DIR AND NOT $ENV{OPENEXR_ROOT_DIR} STREQUAL "") + SET(OPENEXR_ROOT_DIR $ENV{OPENEXR_ROOT_DIR}) +ENDIF() + +SET(_openexr_FIND_COMPONENTS + Half + Iex + IlmImf + IlmThread + Imath +) + +SET(_openexr_SEARCH_DIRS + ${OPENEXR_ROOT_DIR} + /usr/local + /sw # Fink + /opt/local # DarwinPorts + /opt/csw # Blastwave +) + +FIND_PATH(OPENEXR_INCLUDE_DIR + NAMES + ImfXdr.h + HINTS + ${_openexr_SEARCH_DIRS} + PATH_SUFFIXES + include/OpenEXR +) + +SET(_openexr_LIBRARIES) +FOREACH(COMPONENT ${_openexr_FIND_COMPONENTS}) + STRING(TOUPPER ${COMPONENT} UPPERCOMPONENT) + + FIND_LIBRARY(OPENEXR_${UPPERCOMPONENT}_LIBRARY + NAMES + ${COMPONENT} + HINTS + ${_openexr_SEARCH_DIRS} + PATH_SUFFIXES + lib64 lib + ) + LIST(APPEND _openexr_LIBRARIES "${OPENEXR_${UPPERCOMPONENT}_LIBRARY}") +ENDFOREACH() + +# handle the QUIETLY and REQUIRED arguments and set OPENEXR_FOUND to TRUE if +# all listed variables are TRUE +INCLUDE(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(OpenEXR DEFAULT_MSG + _openexr_LIBRARIES OPENEXR_INCLUDE_DIR) + +IF(OPENEXR_FOUND) + SET(OPENEXR_LIBRARIES ${_openexr_LIBRARIES}) + SET(OPENEXR_INCLUDE_DIRS ${OPENEXR_INCLUDE_DIR}) +ENDIF() + +MARK_AS_ADVANCED(OPENEXR_INCLUDE_DIR) +FOREACH(COMPONENT ${_openexr_FIND_COMPONENTS}) + STRING(TOUPPER ${COMPONENT} UPPERCOMPONENT) + MARK_AS_ADVANCED(OPENEXR_${UPPERCOMPONENT}_LIBRARY) +ENDFOREACH() diff --git a/build_files/cmake/Modules/FindOpenJPEG.cmake b/build_files/cmake/Modules/FindOpenJPEG.cmake new file mode 100755 index 00000000000..8d901ed633c --- /dev/null +++ b/build_files/cmake/Modules/FindOpenJPEG.cmake @@ -0,0 +1,70 @@ +# - Find OpenJPEG library +# Find the native OpenJPEG includes and library +# This module defines +# OPENJPEG_INCLUDE_DIRS, where to find openjpeg.h, Set when +# OPENJPEG_INCLUDE_DIR is found. +# OPENJPEG_LIBRARIES, libraries to link against to use OpenJPEG. +# OPENJPEG_ROOT_DIR, The base directory to search for OpenJPEG. +# This can also be an environment variable. +# OPENJPEG_FOUND, If false, do not try to use OpenJPEG. +# +# also defined, but not for general use are +# OPENJPEG_LIBRARY, where to find the OpenJPEG library. + +#============================================================================= +# Copyright 2011 Blender Foundation. +# +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file Copyright.txt for details. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= + +# If OPENJPEG_ROOT_DIR was defined in the environment, use it. +IF(NOT OPENJPEG_ROOT_DIR AND NOT $ENV{OPENJPEG_ROOT_DIR} STREQUAL "") + SET(OPENJPEG_ROOT_DIR $ENV{OPENJPEG_ROOT_DIR}) +ENDIF() + +SET(_openjpeg_SEARCH_DIRS + ${OPENJPEG_ROOT_DIR} + /usr/local + /sw # Fink + /opt/local # DarwinPorts + /opt/csw # Blastwave +) + +FIND_PATH(OPENJPEG_INCLUDE_DIR + NAMES + openjpeg.h + HINTS + ${_openjpeg_SEARCH_DIRS} + PATH_SUFFIXES + include +) + +FIND_LIBRARY(OPENJPEG_LIBRARY + NAMES + openjpeg + HINTS + ${_openjpeg_SEARCH_DIRS} + PATH_SUFFIXES + lib64 lib + ) + +# handle the QUIETLY and REQUIRED arguments and set OPENJPEG_FOUND to TRUE if +# all listed variables are TRUE +INCLUDE(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(OpenJPEG DEFAULT_MSG + OPENJPEG_LIBRARY OPENJPEG_INCLUDE_DIR) + +IF(OPENJPEG_FOUND) + SET(OPENJPEG_LIBRARIES ${OPENJPEG_LIBRARY}) + SET(OPENJPEG_INCLUDE_DIRS ${OPENJPEG_INCLUDE_DIR}) +ENDIF(OPENJPEG_FOUND) + +MARK_AS_ADVANCED( + OPENJPEG_INCLUDE_DIR + OPENJPEG_LIBRARY +) diff --git a/build_files/cmake/Modules/FindPythonLibsUnix.cmake b/build_files/cmake/Modules/FindPythonLibsUnix.cmake new file mode 100755 index 00000000000..882f1e2ea77 --- /dev/null +++ b/build_files/cmake/Modules/FindPythonLibsUnix.cmake @@ -0,0 +1,121 @@ +# - Find Python libraries +# Find the native Python includes and library +# +# Note:, This is not _yet_ intended to be a general python module for other +# projects to use since its hard coded to python 3.2 as blender only supports +# a single python version. +# This is for blender/unix python only. +# +# This module defines +# PYTHON_VERSION +# PYTHON_INCLUDE_DIRS +# PYTHON_LIBRARIES +# PYTHON_LIBPATH, Used for installation +# PYTHON_LINKFLAGS +# PYTHON_ROOT_DIR, The base directory to search for Python. +# This can also be an environment variable. +# +# also defined, but not for general use are +# PYTHON_LIBRARY, where to find the python library. + +#============================================================================= +# Copyright 2011 Blender Foundation. +# +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file Copyright.txt for details. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= + +# If PYTHON_ROOT_DIR was defined in the environment, use it. +IF(NOT PYTHON_ROOT_DIR AND NOT $ENV{PYTHON_ROOT_DIR} STREQUAL "") + SET(PYTHON_ROOT_DIR $ENV{PYTHON_ROOT_DIR}) +ENDIF() + +IF(DEFINED PYTHON_VERSION) + SET(PYTHON_VERSION "${PYTHON_VERSION}" CACHE STRING "") +ELSE() + SET(PYTHON_VERSION 3.2 CACHE STRING "") +ENDIF() +MARK_AS_ADVANCED(PYTHON_VERSION) + +SET(PYTHON_LINKFLAGS "-Xlinker -export-dynamic") +MARK_AS_ADVANCED(PYTHON_LINKFLAGS) + +SET(_python_ABI_FLAGS + "m;mu;u; " # release + "md;mud;ud;d" # debug +) + +STRING(REPLACE "." "" _PYTHON_VERSION_NO_DOTS ${PYTHON_VERSION}) + +SET(_python_SEARCH_DIRS + ${PYTHON_ROOT_DIR} + "$ENV{HOME}/py${_PYTHON_VERSION_NO_DOTS}" + "/opt/py${_PYTHON_VERSION_NO_DOTS}" +) + +FOREACH(_CURRENT_ABI_FLAGS ${_python_ABI_FLAGS}) + #IF(CMAKE_BUILD_TYPE STREQUAL Debug) + # SET(_CURRENT_ABI_FLAGS "d${_CURRENT_ABI_FLAGS}") + #ENDIF() + STRING(REPLACE " " "" _CURRENT_ABI_FLAGS ${_CURRENT_ABI_FLAGS}) + + FIND_PATH(PYTHON_INCLUDE_DIR + NAMES + Python.h + HINTS + ${_python_SEARCH_DIRS} + PATH_SUFFIXES + include/python${PYTHON_VERSION}${_CURRENT_ABI_FLAGS} + ) + + FIND_LIBRARY(PYTHON_LIBRARY + NAMES + "python${PYTHON_VERSION}${_CURRENT_ABI_FLAGS}" + HINTS + ${_python_SEARCH_DIRS} + PATH_SUFFIXES + lib64 lib + ) + + IF(PYTHON_LIBRARY AND PYTHON_INCLUDE_DIR) + break() + ELSE() + # ensure we dont find values from 2 different ABI versions + UNSET(PYTHON_INCLUDE_DIR CACHE) + UNSET(PYTHON_LIBRARY CACHE) + ENDIF() +ENDFOREACH() + +UNSET(_CURRENT_ABI_FLAGS) +UNSET(_CURRENT_PATH) + +UNSET(_python_ABI_FLAGS) +UNSET(_python_SEARCH_DIRS) + +# handle the QUIETLY and REQUIRED arguments and SET PYTHONLIBSUNIX_FOUND to TRUE IF +# all listed variables are TRUE +INCLUDE(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(PythonLibsUnix DEFAULT_MSG + PYTHON_LIBRARY PYTHON_INCLUDE_DIR) + + +IF(PYTHONLIBSUNIX_FOUND) + # Assign cache items + SET(PYTHON_INCLUDE_DIRS ${PYTHON_INCLUDE_DIR}) + SET(PYTHON_LIBRARIES ${PYTHON_LIBRARY}) + + # we need this for installation + GET_FILENAME_COMPONENT(PYTHON_LIBPATH ${PYTHON_LIBRARY} PATH) + + # not used + # SET(PYTHON_BINARY ${PYTHON_EXECUTABLE} CACHE STRING "") + + MARK_AS_ADVANCED( + PYTHON_INCLUDE_DIR + PYTHON_LIBRARY + ) +ENDIF() diff --git a/build_files/cmake/Modules/FindSamplerate.cmake b/build_files/cmake/Modules/FindSamplerate.cmake new file mode 100755 index 00000000000..ea7a0d7a18c --- /dev/null +++ b/build_files/cmake/Modules/FindSamplerate.cmake @@ -0,0 +1,70 @@ +# - Find Samplerate library +# Find the native Samplerate includes and library +# This module defines +# SAMPLERATE_INCLUDE_DIRS, where to find samplerate.h, Set when +# SAMPLERATE_INCLUDE_DIR is found. +# SAMPLERATE_LIBRARIES, libraries to link against to use Samplerate. +# SAMPLERATE_ROOT_DIR, The base directory to search for Samplerate. +# This can also be an environment variable. +# SAMPLERATE_FOUND, If false, do not try to use Samplerate. +# +# also defined, but not for general use are +# SAMPLERATE_LIBRARY, where to find the Samplerate library. + +#============================================================================= +# Copyright 2011 Blender Foundation. +# +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file Copyright.txt for details. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= + +# If SAMPLERATE_ROOT_DIR was defined in the environment, use it. +IF(NOT SAMPLERATE_ROOT_DIR AND NOT $ENV{SAMPLERATE_ROOT_DIR} STREQUAL "") + SET(SAMPLERATE_ROOT_DIR $ENV{SAMPLERATE_ROOT_DIR}) +ENDIF() + +SET(_samplerate_SEARCH_DIRS + ${SAMPLERATE_ROOT_DIR} + /usr/local + /sw # Fink + /opt/local # DarwinPorts + /opt/csw # Blastwave +) + +FIND_PATH(SAMPLERATE_INCLUDE_DIR + NAMES + samplerate.h + HINTS + ${_samplerate_SEARCH_DIRS} + PATH_SUFFIXES + include +) + +FIND_LIBRARY(SAMPLERATE_LIBRARY + NAMES + samplerate + HINTS + ${_samplerate_SEARCH_DIRS} + PATH_SUFFIXES + lib64 lib + ) + +# handle the QUIETLY and REQUIRED arguments and set SAMPLERATE_FOUND to TRUE if +# all listed variables are TRUE +INCLUDE(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(Samplerate DEFAULT_MSG + SAMPLERATE_LIBRARY SAMPLERATE_INCLUDE_DIR) + +IF(SAMPLERATE_FOUND) + SET(SAMPLERATE_LIBRARIES ${SAMPLERATE_LIBRARY}) + SET(SAMPLERATE_INCLUDE_DIRS ${SAMPLERATE_INCLUDE_DIR}) +ENDIF(SAMPLERATE_FOUND) + +MARK_AS_ADVANCED( + SAMPLERATE_INCLUDE_DIR + SAMPLERATE_LIBRARY +) diff --git a/build_files/cmake/Modules/FindSndFile.cmake b/build_files/cmake/Modules/FindSndFile.cmake new file mode 100755 index 00000000000..1b685eacfbd --- /dev/null +++ b/build_files/cmake/Modules/FindSndFile.cmake @@ -0,0 +1,68 @@ +# - Find SndFile library +# Find the native SndFile includes and library +# This module defines +# SNDFILE_INCLUDE_DIRS, where to find sndfile.h, Set when +# SNDFILE_INCLUDE_DIR is found. +# SNDFILE_LIBRARIES, libraries to link against to use SndFile. +# SNDFILE_ROOT_DIR, The base directory to search for SndFile. +# This can also be an environment variable. +# SNDFILE_FOUND, If false, do not try to use SndFile. +# +# also defined, but not for general use are +# SNDFILE_LIBRARY, where to find the SndFile library. + +#============================================================================= +# Copyright 2011 Blender Foundation. +# +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file Copyright.txt for details. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= + +# If SNDFILE_ROOT_DIR was defined in the environment, use it. +IF(NOT SNDFILE_ROOT_DIR AND NOT $ENV{SNDFILE_ROOT_DIR} STREQUAL "") + SET(SNDFILE_ROOT_DIR $ENV{SNDFILE_ROOT_DIR}) +ENDIF() + +SET(_sndfile_SEARCH_DIRS + ${SNDFILE_ROOT_DIR} + /usr/local + /sw # Fink + /opt/local # DarwinPorts + /opt/csw # Blastwave +) + +FIND_PATH(SNDFILE_INCLUDE_DIR sndfile.h + HINTS + ${_sndfile_SEARCH_DIRS} + PATH_SUFFIXES + include +) + +FIND_LIBRARY(SNDFILE_LIBRARY + NAMES + sndfile + HINTS + ${_sndfile_SEARCH_DIRS} + PATH_SUFFIXES + lib64 lib + ) + +# handle the QUIETLY and REQUIRED arguments and set SNDFILE_FOUND to TRUE if +# all listed variables are TRUE +INCLUDE(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(SndFile DEFAULT_MSG + SNDFILE_LIBRARY SNDFILE_INCLUDE_DIR) + +IF(SNDFILE_FOUND) + SET(SNDFILE_LIBRARIES ${SNDFILE_LIBRARY}) + SET(SNDFILE_INCLUDE_DIRS ${SNDFILE_INCLUDE_DIR}) +ENDIF(SNDFILE_FOUND) + +MARK_AS_ADVANCED( + SNDFILE_INCLUDE_DIR + SNDFILE_LIBRARY +) diff --git a/build_files/cmake/cmake_consistency_check.py b/build_files/cmake/cmake_consistency_check.py index f55b2e95d5e..ebcc75ade2b 100755 --- a/build_files/cmake/cmake_consistency_check.py +++ b/build_files/cmake/cmake_consistency_check.py @@ -23,15 +23,49 @@ # <pep8 compliant> -IGNORE = \ - "/test/",\ - "/decimate_glut_test/",\ - "/BSP_GhostTest/",\ - "/release/",\ - "/xembed/",\ - "/decimation/intern/future/",\ - "/TerraplayNetwork/",\ - "/ik_glut_test/" +IGNORE = ( + "/test/", + "/decimate_glut_test/", + "/BSP_GhostTest/", + "/release/", + "/xembed/", + "/decimation/intern/future/", + "/TerraplayNetwork/", + "/ik_glut_test/", + + # specific source files + "extern/Eigen2/Eigen/src/Cholesky/CholeskyInstantiations.cpp", + "extern/Eigen2/Eigen/src/Core/CoreInstantiations.cpp", + "extern/Eigen2/Eigen/src/QR/QrInstantiations.cpp", + "extern/bullet2/src/BulletCollision/CollisionDispatch/btBox2dBox2dCollisionAlgorithm.cpp", + "extern/bullet2/src/BulletCollision/CollisionDispatch/btConvex2dConvex2dAlgorithm.cpp", + "extern/bullet2/src/BulletCollision/CollisionDispatch/btInternalEdgeUtility.cpp", + "extern/bullet2/src/BulletCollision/CollisionShapes/btBox2dShape.cpp", + "extern/bullet2/src/BulletCollision/CollisionShapes/btConvex2dShape.cpp", + "extern/bullet2/src/BulletDynamics/Character/btKinematicCharacterController.cpp", + "extern/bullet2/src/BulletDynamics/ConstraintSolver/btHinge2Constraint.cpp", + "extern/bullet2/src/BulletDynamics/ConstraintSolver/btUniversalConstraint.cpp", + "extern/eltopo/common/meshes/ObjLoader.cpp", + "extern/eltopo/common/meshes/meshloader.cpp", + "extern/eltopo/common/openglutils.cpp", + "extern/eltopo/eltopo3d/broadphase_blenderbvh.cpp", + "source/blender/imbuf/intern/imbuf_cocoa.m", + + "extern/bullet2/src/BulletCollision/CollisionDispatch/btBox2dBox2dCollisionAlgorithm.h", + "extern/bullet2/src/BulletCollision/CollisionDispatch/btConvex2dConvex2dAlgorithm.h", + "extern/bullet2/src/BulletCollision/CollisionDispatch/btInternalEdgeUtility.h", + "extern/bullet2/src/BulletCollision/CollisionShapes/btBox2dShape.h", + "extern/bullet2/src/BulletCollision/CollisionShapes/btConvex2dShape.h", + "extern/bullet2/src/BulletDynamics/Character/btKinematicCharacterController.h", + "extern/bullet2/src/BulletDynamics/ConstraintSolver/btHinge2Constraint.h", + "extern/bullet2/src/BulletDynamics/ConstraintSolver/btUniversalConstraint.h", + "extern/eltopo/common/meshes/Edge.hpp", + "extern/eltopo/common/meshes/ObjLoader.hpp", + "extern/eltopo/common/meshes/TriangleIndex.hpp", + "extern/eltopo/common/meshes/meshloader.h", + "extern/eltopo/eltopo3d/broadphase_blenderbvh.h" + ) + import os from os.path import join, dirname, normpath, abspath, splitext @@ -104,7 +138,7 @@ def cmake_get_src(f): found = True break - if "list(APPEND SRC" in l: + if "list(APPEND SRC" in l or ('list(APPEND ' in l and l.endswith("SRC")): if l.endswith(")"): raise Exception("strict formatting not kept 'list(APPEND SRC...)' on 1 line %s:%d" % (f, i)) found = True @@ -136,7 +170,9 @@ def cmake_get_src(f): if not l: pass elif l.startswith("$"): - print("Cant use var '%s' %s:%d" % (l, f, i)) + # assume if it ends with SRC we know about it + if not l.split("}")[0].endswith("SRC"): + print("Can't use var '%s' %s:%d" % (l, f, i)) elif len(l.split()) > 1: raise Exception("Multi-line define '%s' %s:%d" % (l, f, i)) else: diff --git a/build_files/cmake/macros.cmake b/build_files/cmake/macros.cmake index 6c6621b7466..bb3761d4539 100644 --- a/build_files/cmake/macros.cmake +++ b/build_files/cmake/macros.cmake @@ -1,6 +1,44 @@ # -*- mode: cmake; indent-tabs-mode: t; -*- # $Id$ + +# foo_bar.spam --> foo_barMySuffix.spam +macro(file_suffix + file_name_new file_name file_suffix + ) + + get_filename_component(_file_name_PATH ${file_name} PATH) + get_filename_component(_file_name_NAME_WE ${file_name} NAME_WE) + get_filename_component(_file_name_EXT ${file_name} EXT) + set(${file_name_new} "${_file_name_PATH}/${_file_name_NAME_WE}${file_suffix}${_file_name_EXT}") + + unset(_file_name_PATH) + unset(_file_name_NAME_WE) + unset(_file_name_EXT) +endmacro() + +# usefil for adding debug suffix to library lists: +# /somepath/foo.lib --> /somepath/foo_d.lib +macro(file_list_suffix + fp_list_new fp_list fn_suffix + ) + + # incase of empty list + set(_fp) + set(_fp_suffixed) + + set(fp_list_new) + + foreach(_fp ${fp_list}) + file_suffix(_fp_suffixed "${_fp}" "${fn_suffix}") + list(APPEND "${fp_list_new}" "${_fp_suffixed}") + endforeach() + + unset(_fp) + unset(_fp_suffixed) + +endmacro() + # Nicer makefiles with -I/1/foo/ instead of -I/1/2/3/../../foo/ # use it instead of include_directories() macro(blender_include_dirs @@ -37,7 +75,7 @@ macro(blender_source_group foreach(_SRC ${sources}) get_filename_component(_SRC_EXT ${_SRC} EXT) - if(${_SRC_EXT} MATCHES ".h" OR ${_SRC_EXT} MATCHES ".hpp") + if((${_SRC_EXT} MATCHES ".h") OR (${_SRC_EXT} MATCHES ".hpp")) source_group("Header Files" FILES ${_SRC}) else() source_group("Source Files" FILES ${_SRC}) @@ -127,7 +165,7 @@ macro(SETUP_LIBDIRS) link_directories(${SNDFILE_LIBPATH}) endif() if(WITH_SAMPLERATE) - link_directories(${LIBSAMPLERATE_LIBPATH}) + link_directories(${SAMPLERATE_LIBPATH}) endif() if(WITH_FFTW3) link_directories(${FFTW3_LIBPATH}) @@ -150,17 +188,26 @@ macro(setup_liblinks target) set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${PLATFORM_LINKFLAGS} ") - target_link_libraries(${target} ${OPENGL_gl_LIBRARY} ${OPENGL_glu_LIBRARY} ${JPEG_LIBRARIES} ${PNG_LIBRARIES} ${ZLIB_LIBRARIES} ${LLIBS}) + target_link_libraries(${target} + ${OPENGL_gl_LIBRARY} + ${OPENGL_glu_LIBRARY} + ${JPEG_LIBRARIES} + ${PNG_LIBRARIES} + ${ZLIB_LIBRARIES} + ${LLIBS}) # since we are using the local libs for python when compiling msvc projects, we need to add _d when compiling debug versions if(WITH_PYTHON) # AND NOT WITH_PYTHON_MODULE # WIN32 needs target_link_libraries(${target} ${PYTHON_LINKFLAGS}) if(WIN32 AND NOT UNIX) - target_link_libraries(${target} debug ${PYTHON_LIBRARY}_d) - target_link_libraries(${target} optimized ${PYTHON_LIBRARY}) + file_list_suffix(PYTHON_LIBRARIES_DEBUG "${PYTHON_LIBRARIES}" "_d") + target_link_libraries(${target} + debug ${PYTHON_LIBRARIES_DEBUG} + optimized ${PYTHON_LIBRARIES}) + unset(PYTHON_LIBRARIES_DEBUG) else() - target_link_libraries(${target} ${PYTHON_LIBRARY}) + target_link_libraries(${target} ${PYTHON_LIBRARIES}) endif() endif() @@ -168,14 +215,18 @@ macro(setup_liblinks target_link_libraries(${target} ${GLEW_LIBRARY}) endif() - target_link_libraries(${target} ${OPENGL_glu_LIBRARY} ${JPEG_LIBRARIES} ${PNG_LIBRARIES} ${ZLIB_LIBRARIES}) - target_link_libraries(${target} ${FREETYPE_LIBRARY}) + target_link_libraries(${target} + ${OPENGL_glu_LIBRARY} + ${JPEG_LIBRARIES} + ${PNG_LIBRARIES} + ${ZLIB_LIBRARIES} + ${FREETYPE_LIBRARY}) if(WITH_INTERNATIONAL) target_link_libraries(${target} ${GETTEXT_LIB}) if(WIN32 AND NOT UNIX) - target_link_libraries(${target} ${ICONV_LIB}) + target_link_libraries(${target} ${ICONV_LIBRARIES}) endif() endif() @@ -183,67 +234,76 @@ macro(setup_liblinks target_link_libraries(${target} ${OPENAL_LIBRARY}) endif() if(WITH_FFTW3) - target_link_libraries(${target} ${FFTW3_LIB}) + target_link_libraries(${target} ${FFTW3_LIBRARIES}) endif() if(WITH_JACK) - target_link_libraries(${target} ${JACK_LIB}) + target_link_libraries(${target} ${JACK_LIBRARIES}) endif() if(WITH_CODEC_SNDFILE) - target_link_libraries(${target} ${SNDFILE_LIB}) + target_link_libraries(${target} ${SNDFILE_LIBRARIES}) endif() if(WITH_SAMPLERATE) - target_link_libraries(${target} ${LIBSAMPLERATE_LIB}) + target_link_libraries(${target} ${SAMPLERATE_LIBRARIES}) endif() if(WITH_SDL) target_link_libraries(${target} ${SDL_LIBRARY}) endif() if(WITH_CODEC_QUICKTIME) - target_link_libraries(${target} ${QUICKTIME_LIB}) + target_link_libraries(${target} ${QUICKTIME_LIBRARIES}) endif() if(WITH_IMAGE_TIFF) target_link_libraries(${target} ${TIFF_LIBRARY}) endif() if(WITH_IMAGE_OPENEXR) if(WIN32 AND NOT UNIX) - foreach(_LOOP_VAR ${OPENEXR_LIB}) - target_link_libraries(${target} debug ${_LOOP_VAR}_d) - target_link_libraries(${target} optimized ${_LOOP_VAR}) - endforeach() - unset(_LOOP_VAR) + file_list_suffix(OPENEXR_LIBRARIES_DEBUG "${OPENEXR_LIBRARIES}" "_d") + target_link_libraries(${target} + debug ${OPENEXR_LIBRARIES_DEBUG} + optimized ${OPENEXR_LIBRARIES}) + unset(OPENEXR_LIBRARIES_DEBUG) else() - target_link_libraries(${target} ${OPENEXR_LIB}) + target_link_libraries(${target} ${OPENEXR_LIBRARIES}) endif() endif() if(WITH_IMAGE_OPENJPEG AND UNIX AND NOT APPLE) - target_link_libraries(${target} ${OPENJPEG_LIB}) + target_link_libraries(${target} ${OPENJPEG_LIBRARIES}) endif() if(WITH_CODEC_FFMPEG) - target_link_libraries(${target} ${FFMPEG_LIB}) + target_link_libraries(${target} ${FFMPEG_LIBRARIES}) endif() if(WITH_OPENCOLLADA) if(WIN32 AND NOT UNIX) - foreach(_LOOP_VAR ${OPENCOLLADA_LIB}) - target_link_libraries(${target} debug ${_LOOP_VAR}_d) - target_link_libraries(${target} optimized ${_LOOP_VAR}) - endforeach() - unset(_LOOP_VAR) - target_link_libraries(${target} debug ${PCRE_LIB}_d) - target_link_libraries(${target} optimized ${PCRE_LIB}) + file_list_suffix(OPENCOLLADA_LIBRARIES_DEBUG "${OPENCOLLADA_LIBRARIES}" "_d") + target_link_libraries(${target} + debug ${OPENCOLLADA_LIBRARIES_DEBUG} + optimized ${OPENCOLLADA_LIBRARIES}) + unset(OPENCOLLADA_LIBRARIES_DEBUG) + + file_list_suffix(PCRE_LIB_DEBUG "${PCRE_LIB}" "_d") + target_link_libraries(${target} + debug ${PCRE_LIB_DEBUG} + optimized ${PCRE_LIB}) + unset(PCRE_LIB_DEBUG) + if(EXPAT_LIB) - target_link_libraries(${target} debug ${EXPAT_LIB}_d) - target_link_libraries(${target} optimized ${EXPAT_LIB}) + file_list_suffix(EXPAT_LIB_DEBUG "${EXPAT_LIB}" "_d") + target_link_libraries(${target} + debug ${EXPAT_LIB_DEBUG} + optimized ${EXPAT_LIB}) + unset(EXPAT_LIB_DEBUG) endif() else() - target_link_libraries(${target} ${OPENCOLLADA_LIB}) - target_link_libraries(${target} ${PCRE_LIB}) - target_link_libraries(${target} ${EXPAT_LIB}) + target_link_libraries(${target} + ${OPENCOLLADA_LIBRARIES} + ${PCRE_LIB} + ${EXPAT_LIB}) endif() endif() if(WITH_MEM_JEMALLOC) - target_link_libraries(${target} ${JEMALLOC_LIBRARY}) + target_link_libraries(${target} ${JEMALLOC_LIBRARIES}) endif() if(WIN32 AND NOT UNIX) - target_link_libraries(${target} ${PTHREADS_LIB}) + target_link_libraries(${target} ${PTHREADS_LIBRARIES}) endif() endmacro() @@ -484,8 +544,8 @@ macro(blender_project_hack_post) unset(_reset_standard_cflags_rel) unset(_reset_standard_cxxflags_rel) - # -------------------------------------------------- - # workaround for omission in cmake 2.8.4's GNU.cmake + # ------------------------------------------------------------------ + # workaround for omission in cmake 2.8.4's GNU.cmake, fixed in 2.8.5 if(CMAKE_COMPILER_IS_GNUCC) if(NOT DARWIN) set(CMAKE_INCLUDE_SYSTEM_FLAG_C "-isystem ") |