diff options
Diffstat (limited to 'build_files')
32 files changed, 1767 insertions, 485 deletions
diff --git a/build_files/buildbot/config/user-config-i686.py b/build_files/buildbot/config/user-config-i686.py index de8dd93982f..1ad6c5d22fe 100644 --- a/build_files/buildbot/config/user-config-i686.py +++ b/build_files/buildbot/config/user-config-i686.py @@ -29,7 +29,8 @@ BF_FFMPEG_LIB_STATIC = '${BF_FFMPEG_LIBPATH}/libavformat.a ${BF_FFMPEG_LIBPATH}/ '${BF_FFMPEG_LIBPATH}/libxvidcore.a ${BF_FFMPEG_LIBPATH}/libx264.a ${BF_FFMPEG_LIBPATH}/libmp3lame.a ' + \ '${BF_FFMPEG_LIBPATH}/libvpx.a ${BF_FFMPEG_LIBPATH}/libvorbis.a ${BF_FFMPEG_LIBPATH}/libogg.a ' + \ '${BF_FFMPEG_LIBPATH}/libvorbisenc.a ${BF_FFMPEG_LIBPATH}/libtheora.a ' + \ - '${BF_FFMPEG_LIBPATH}/libschroedinger-1.0.a ${BF_FFMPEG_LIBPATH}/liborc-0.4.a ${BF_FFMPEG_LIBPATH}/libdirac_encoder.a' + '${BF_FFMPEG_LIBPATH}/libschroedinger-1.0.a ${BF_FFMPEG_LIBPATH}/liborc-0.4.a ${BF_FFMPEG_LIBPATH}/libdirac_encoder.a ' + \ + '${BF_FFMPEG_LIBPATH}/libfaad.a' # Don't depend on system's libstdc++ WITH_BF_STATICCXX = True @@ -74,6 +75,12 @@ WITH_BF_BULLET = True # Blender player (would be enabled in it's own config) WITH_BF_PLAYER = False +# Use jemalloc memory manager +WITH_BF_JEMALLOC = True +WITH_BF_STATICJEMALLOC = True +BF_JEMALLOC = '/home/sources/staticlibs/jemalloc' +BF_JEMALLOC_LIBPATH = '${BF_JEMALLOC}/lib32' + # Compilation and optimization BF_DEBUG = False REL_CFLAGS = ['-O2'] diff --git a/build_files/buildbot/config/user-config-player-i686.py b/build_files/buildbot/config/user-config-player-i686.py index 202c7df6f98..241f5a79983 100644 --- a/build_files/buildbot/config/user-config-player-i686.py +++ b/build_files/buildbot/config/user-config-player-i686.py @@ -59,6 +59,12 @@ WITH_BF_BULLET = True WITH_BF_NOBLENDER = True WITH_BF_PLAYER = True +# Use jemalloc memory manager +WITH_BF_JEMALLOC = True +WITH_BF_STATICJEMALLOC = True +BF_JEMALLOC = '/home/sources/staticlibs/jemalloc' +BF_JEMALLOC_LIBPATH = '${BF_JEMALLOC}/lib32' + # Compilation and optimization BF_DEBUG = False REL_CFLAGS = ['-O2'] diff --git a/build_files/buildbot/config/user-config-player-x86_64.py b/build_files/buildbot/config/user-config-player-x86_64.py index 363997143e5..d51894b26cf 100644 --- a/build_files/buildbot/config/user-config-player-x86_64.py +++ b/build_files/buildbot/config/user-config-player-x86_64.py @@ -59,6 +59,12 @@ WITH_BF_BULLET = True WITH_BF_NOBLENDER = True WITH_BF_PLAYER = True +# Use jemalloc memory manager +WITH_BF_JEMALLOC = True +WITH_BF_STATICJEMALLOC = True +BF_JEMALLOC = '/home/sources/staticlibs/jemalloc' +BF_JEMALLOC_LIBPATH = '${BF_JEMALLOC}/lib64' + # Compilation and optimization BF_DEBUG = False REL_CFLAGS = ['-O2'] diff --git a/build_files/buildbot/config/user-config-x86_64.py b/build_files/buildbot/config/user-config-x86_64.py index 7bae2d232cd..3eaadd99d45 100644 --- a/build_files/buildbot/config/user-config-x86_64.py +++ b/build_files/buildbot/config/user-config-x86_64.py @@ -29,7 +29,8 @@ BF_FFMPEG_LIB_STATIC = '${BF_FFMPEG_LIBPATH}/libavformat.a ${BF_FFMPEG_LIBPATH}/ '${BF_FFMPEG_LIBPATH}/libxvidcore.a ${BF_FFMPEG_LIBPATH}/libx264.a ${BF_FFMPEG_LIBPATH}/libmp3lame.a ' + \ '${BF_FFMPEG_LIBPATH}/libvpx.a ${BF_FFMPEG_LIBPATH}/libvorbis.a ${BF_FFMPEG_LIBPATH}/libogg.a ' + \ '${BF_FFMPEG_LIBPATH}/libvorbisenc.a ${BF_FFMPEG_LIBPATH}/libtheora.a ' + \ - '${BF_FFMPEG_LIBPATH}/libschroedinger-1.0.a ${BF_FFMPEG_LIBPATH}/liborc-0.4.a ${BF_FFMPEG_LIBPATH}/libdirac_encoder.a' + '${BF_FFMPEG_LIBPATH}/libschroedinger-1.0.a ${BF_FFMPEG_LIBPATH}/liborc-0.4.a ${BF_FFMPEG_LIBPATH}/libdirac_encoder.a ' + \ + '${BF_FFMPEG_LIBPATH}/libfaad.a' # Don't depend on system's libstdc++ WITH_BF_STATICCXX = True @@ -74,6 +75,12 @@ WITH_BF_BULLET = True # Blender player (would be enabled in it's own config) WITH_BF_PLAYER = False +# Use jemalloc memory manager +WITH_BF_JEMALLOC = True +WITH_BF_STATICJEMALLOC = True +BF_JEMALLOC = '/home/sources/staticlibs/jemalloc' +BF_JEMALLOC_LIBPATH = '${BF_JEMALLOC}/lib64' + # Compilation and optimization BF_DEBUG = False REL_CFLAGS = ['-O2'] diff --git a/build_files/buildbot/master.cfg b/build_files/buildbot/master.cfg index 6913ed2dab0..fd712f1b832 100644 --- a/build_files/buildbot/master.cfg +++ b/build_files/buildbot/master.cfg @@ -53,7 +53,7 @@ c['builders'] = [] buildernames = [] -def add_builder(c, name, libdir, factory): +def add_builder(c, name, libdir, factory, branch=''): slavenames = [] for slave in master_private.slaves: @@ -61,15 +61,18 @@ def add_builder(c, name, libdir, factory): slavenames.append(slave['name']) if len(slavenames) > 0: - f = factory(name, libdir) + f = factory(name, libdir, branch) c['builders'].append(BuilderConfig(name=name, slavenames=slavenames, factory=f, category='blender')) buildernames.append(name) # common steps -def svn_step(): - return SVN(baseURL='https://svn.blender.org/svnroot/bf-blender/%%BRANCH%%/blender', mode='update', defaultBranch='trunk', workdir='blender') +def svn_step(branch=''): + if branch: + return SVN(baseURL='https://svn.blender.org/svnroot/bf-blender/branches/%%BRANCH%%', mode='update', defaultBranch=branch, workdir='blender') + else: + return SVN(baseURL='https://svn.blender.org/svnroot/bf-blender/%%BRANCH%%/blender', mode='update', defaultBranch='trunk', workdir='blender') def lib_svn_step(dir): @@ -78,7 +81,7 @@ def lib_svn_step(dir): # generic builder -def generic_builder(id, libdir=""): +def generic_builder(id, libdir='', branch=''): filename = 'buildbot_upload_' + id + '.zip' compile_script = '../blender/build_files/buildbot/slave_compile.py' test_script = '../blender/build_files/buildbot/slave_test.py' @@ -86,13 +89,13 @@ def generic_builder(id, libdir=""): unpack_script = 'master_unpack.py' f = BuildFactory() - f.addStep(svn_step()) + f.addStep(svn_step(branch)) if libdir != '': f.addStep(lib_svn_step(libdir)) f.addStep(Compile(command=['python', compile_script, id])) f.addStep(Test(command=['python', test_script, id])) - f.addStep(ShellCommand(name='package', command=['python', pack_script, id], description='packaging', descriptionDone='packaged')) + f.addStep(ShellCommand(name='package', command=['python', pack_script, id, branch], description='packaging', descriptionDone='packaged')) if id.find('cmake') != -1: f.addStep(FileUpload(name='upload', slavesrc='buildbot_upload.zip', masterdest=filename, maxsize=100 * 1024 * 1024)) else: @@ -102,12 +105,19 @@ def generic_builder(id, libdir=""): # builders -add_builder(c, 'mac_x86_64_cmake', 'darwin-9.x.universal', generic_builder) -add_builder(c, 'mac_i386_cmake', 'darwin-9.x.universal', generic_builder) -add_builder(c, 'mac_ppc_cmake', 'darwin-9.x.universal', generic_builder) -add_builder(c, 'linux_x86_64_cmake', '', generic_builder) +add_builder(c, 'mac_x86_64_scons', 'darwin-9.x.universal', generic_builder) +add_builder(c, 'salad_mac_x86_64_scons', 'darwin-9.x.universal', generic_builder, 'soc-2011-salad') +add_builder(c, 'mac_i386_scons', 'darwin-9.x.universal', generic_builder) +add_builder(c, 'mac_ppc_scons', 'darwin-9.x.universal', generic_builder) +#add_builder(c, 'linux_x86_64_cmake', '', generic_builder) +add_builder(c, 'linux_i386_scons', '', generic_builder) +add_builder(c, 'salad_linux_i386_scons', '', generic_builder, 'soc-2011-salad') add_builder(c, 'linux_x86_64_scons', '', generic_builder) +add_builder(c, 'salad_linux_x86_64_scons', '', generic_builder, 'soc-2011-salad') add_builder(c, 'win32_scons', 'windows', generic_builder) +add_builder(c, 'salad_win32_scons', 'windows', generic_builder, 'soc-2011-salad') +#add_builder(c, 'freebsd_i386_cmake', '', generic_builder) +#add_builder(c, 'freebsd_x86_64_cmake', '', generic_builder) # SCHEDULERS # @@ -149,7 +159,7 @@ authz_cfg = authz.Authz( pingBuilder=False, stopBuild=False, stopAllBuilds=False, - cancelPendingBuild=False, + cancelPendingBuild=True, ) c['status'].append(html.WebStatus(http_port=8010, authz=authz_cfg)) diff --git a/build_files/buildbot/master_unpack.py b/build_files/buildbot/master_unpack.py index 06c11b368b0..ad7c09933c6 100644 --- a/build_files/buildbot/master_unpack.py +++ b/build_files/buildbot/master_unpack.py @@ -43,6 +43,7 @@ def get_platform(filename): # platform out, but there may be some variations, so we fiddle a # bit to handle current and hopefully future names filename = strip_extension(filename) + filename = strip_extension(filename) tokens = filename.split("-") platforms = ('osx', 'mac', 'bsd', @@ -63,6 +64,22 @@ def get_platform(filename): return '-'.join(platform_tokens) + +def get_branch(filename): + tokens = filename.split("-") + branch = "" + + for token in tokens: + if branch == "": + branch = token + else: + branch = branch + "-" + token + + if token == "blender": + return branch + + return "" + # get filename if len(sys.argv) < 2: sys.stderr.write("Not enough arguments, expecting file to unpack\n") @@ -88,8 +105,9 @@ if len(z.namelist()) != 1: package = z.namelist()[0] packagename = os.path.basename(package) -# detect platform +# detect platform and branch platform = get_platform(packagename) +branch = get_branch(packagename) if platform == '': sys.stderr.write('Failed to detect platform ' + @@ -113,10 +131,10 @@ except Exception, ex: sys.stderr.write('Failed to unzip package: %s\n' % str(ex)) sys.exit(1) -# remove other files from the same platform +# remove other files from the same platform and branch try: for f in os.listdir(directory): - if platform.lower() in f.lower(): + if get_platform(f) == platform and get_branch(f) == branch: if f != packagename: os.remove(os.path.join(directory, f)) except Exception, ex: diff --git a/build_files/buildbot/slave_compile.py b/build_files/buildbot/slave_compile.py index 2a1af0578a9..e74d889c243 100644 --- a/build_files/buildbot/slave_compile.py +++ b/build_files/buildbot/slave_compile.py @@ -38,11 +38,11 @@ if builder.find('cmake') != -1: # set build options cmake_options = ['-DCMAKE_BUILD_TYPE:STRING=Release'] - if builder == 'mac_x86_64_cmake': + if builder.endswith('mac_x86_64_cmake'): cmake_options.append('-DCMAKE_OSX_ARCHITECTURES:STRING=x86_64') - elif builder == 'mac_i386_cmake': + elif builder.endswith('mac_i386_cmake'): cmake_options.append('-DCMAKE_OSX_ARCHITECTURES:STRING=i386') - elif builder == 'mac_ppc_cmake': + elif builder.endswith('mac_ppc_cmake'): cmake_options.append('-DCMAKE_OSX_ARCHITECTURES:STRING=ppc') # configure and make @@ -57,7 +57,7 @@ else: scons_cmd = ['python', 'scons/scons.py'] scons_options = [] - if builder.startswith('linux'): + if builder.find('linux') != -1: import shutil # We're using the same rules as release builder, so tweak @@ -75,10 +75,10 @@ else: config_dir = os.path.join(buildbot_dir, 'config') configs = [] - if builder == 'linux_x86_64_scons': + if builder.endswith('linux_x86_64_scons'): configs = ['user-config-player-x86_64.py', 'user-config-x86_64.py'] - elif builder == 'linux_i386_scons': + elif builder.endswith('linux_i386_scons'): configs = ['user-config-player-i686.py', 'user-config-i686.py'] diff --git a/build_files/buildbot/slave_pack.py b/build_files/buildbot/slave_pack.py index 81402b3aca4..4c19b723fc8 100644 --- a/build_files/buildbot/slave_pack.py +++ b/build_files/buildbot/slave_pack.py @@ -33,13 +33,17 @@ if len(sys.argv) < 2: sys.exit(1) builder = sys.argv[1] +branch = '' + +if len(sys.argv) >= 3: + branch = sys.argv[2] # scons does own packaging if builder.find('scons') != -1: os.chdir('../blender') - scons_options = ['BF_QUICK=slnt', 'buildslave'] + scons_options = ['BF_QUICK=slnt', 'BUILDBOT_BRANCH=' + branch, 'buildslave'] - if builder.startswith('linux'): + if builder.find('linux') != -1: buildbot_dir = os.path.dirname(os.path.realpath(__file__)) config_dir = os.path.join(buildbot_dir, 'config') build_dir = os.path.join('..', 'build', builder) @@ -52,9 +56,9 @@ if builder.find('scons') != -1: config = None - if builder == 'linux_x86_64_scons': + if builder.endswith('linux_x86_64_scons'): config = 'user-config-x86_64.py' - elif builder == 'linux_i386_scons': + elif builder.endswith('linux_i386_scons'): config = 'user-config-x86_64.py' if config is not None: diff --git a/build_files/cmake/FindPythonLibsUnix.cmake b/build_files/cmake/FindPythonLibsUnix.cmake deleted file mode 100644 index 0752de4ce3c..00000000000 --- a/build_files/cmake/FindPythonLibsUnix.cmake +++ /dev/null @@ -1,72 +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() -endif() - -#============================================================================= -# 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 100644 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 100644 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 100644 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 100644 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 100644 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 100644 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 100644 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 100644 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..ba71603b007 100644..100755 --- a/build_files/cmake/cmake_consistency_check.py +++ b/build_files/cmake/cmake_consistency_check.py @@ -23,27 +23,31 @@ # <pep8 compliant> -IGNORE = \ - "/test/",\ - "/decimate_glut_test/",\ - "/BSP_GhostTest/",\ - "/release/",\ - "/xembed/",\ - "/decimation/intern/future/",\ - "/TerraplayNetwork/",\ - "/ik_glut_test/" +from cmake_consistency_check_config import IGNORE, UTF8_CHECK, SOURCE_DIR import os -from os.path import join, dirname, normpath, abspath, splitext +from os.path import join, dirname, normpath, splitext -base = join(os.path.dirname(__file__), "..", "..") -base = normpath(base) -base = abspath(base) - -print("Scanning:", base) +print("Scanning:", SOURCE_DIR) global_h = set() global_c = set() +global_refs = {} + + +def replace_line(f, i, text, keep_indent=True): + file_handle = open(f, 'r') + data = file_handle.readlines() + file_handle.close() + + l = data[i] + ws = l[:len(l) - len(l.lstrip())] + + data[i] = "%s%s\n" % (ws, text) + + file_handle = open(f, 'w') + file_handle.writelines(data) + file_handle.close() def source_list(path, filename_check=None): @@ -88,7 +92,20 @@ def cmake_get_src(f): found = False i = 0 # print(f) + + def is_definition(l, f, i, name): + if ('set(%s' % name) in l or ('set(' in l and l.endswith(name)): + if len(l.split()) > 1: + raise Exception("strict formatting not kept 'set(%s*' %s:%d" % (name, f, i)) + return True + + if ("list(APPEND %s" % name) in l or ('list(APPEND ' in l and l.endswith(name)): + if l.endswith(")"): + raise Exception("strict formatting not kept 'list(APPEND %s...)' on 1 line %s:%d" % (name, f, i)) + return True + while it is not None: + context_name = "" while it is not None: i += 1 try: @@ -98,16 +115,13 @@ def cmake_get_src(f): break l = l.strip() if not l.startswith("#"): - if 'set(SRC' in l or ('set(' in l and l.endswith("SRC")): - if len(l.split()) > 1: - raise Exception("strict formatting not kept 'set(SRC*' %s:%d" % (f, i)) - found = True + found = is_definition(l, f, i, "SRC") + if found: + context_name = "SRC" break - - if "list(APPEND SRC" in l: - if l.endswith(")"): - raise Exception("strict formatting not kept 'list(APPEND SRC...)' on 1 line %s:%d" % (f, i)) - found = True + found = is_definition(l, f, i, "INC") + if found: + context_name = "INC" break if found: @@ -136,21 +150,44 @@ def cmake_get_src(f): if not l: pass elif l.startswith("$"): - print("Cant use var '%s' %s:%d" % (l, f, i)) + if context_name == "SRC": + # assume if it ends with context_name we know about it + if not l.split("}")[0].endswith(context_name): + 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: new_file = normpath(join(cmake_base, l)) - if is_c_header(new_file): - sources_h.append(new_file) - elif is_c(new_file): - sources_c.append(new_file) - elif l in ("PARENT_SCOPE", ): - # cmake var, ignore - pass - else: - raise Exception("unknown file type - not c or h %s -> %s" % (f, new_file)) + if context_name == "SRC": + if is_c_header(new_file): + sources_h.append(new_file) + global_refs.setdefault(new_file, []).append((f, i)) + elif is_c(new_file): + sources_c.append(new_file) + global_refs.setdefault(new_file, []).append((f, i)) + elif l in ("PARENT_SCOPE", ): + # cmake var, ignore + pass + elif new_file.endswith(".list"): + pass + elif new_file.endswith(".def"): + pass + else: + raise Exception("unknown file type - not c or h %s -> %s" % (f, new_file)) + + elif context_name == "INC": + if os.path.isdir(new_file): + new_path_rel = os.path.relpath(new_file, cmake_base) + + if new_path_rel != l: + print("overly relative path:\n %s:%d\n %s\n %s" % (f, i, l, new_path_rel)) + + ## Save time. just replace the line + # replace_line(f, i - 1, new_path_rel) + + else: + raise Exception("non existant include %s:%d -> %s" % (f, i, new_file)) # print(new_file) @@ -170,10 +207,14 @@ def cmake_get_src(f): print(" missing: " + ff) ''' + # reset + sources_h[:] = [] + sources_c[:] = [] + filen.close() -for cmake in source_list(base, is_cmake): +for cmake in source_list(SOURCE_DIR, is_cmake): cmake_get_src(cmake) @@ -183,39 +224,74 @@ def is_ignore(f): return True return False + # First do stupid check, do these files exist? +print("\nChecking for missing references:") +is_err = False +errs = [] for f in (global_h | global_c): if f.endswith("dna.c"): continue if not os.path.exists(f): - raise Exception("CMake referenced file missing: " + f) - + refs = global_refs[f] + if refs: + for cf, i in refs: + errs.append((cf, i)) + else: + raise Exception("CMake referenecs missing, internal error, aborting!") + is_err = True + +errs.sort() +errs.reverse() +for cf, i in errs: + print("%s:%d" % (cf, i)) + # Write a 'sed' script, useful if we get a lot of these + # print("sed '%dd' '%s' > '%s.tmp' ; mv '%s.tmp' '%s'" % (i, cf, cf, cf, cf)) + + +if is_err: + raise Exception("CMake referenecs missing files, aborting!") +del is_err +del errs # now check on files not accounted for. print("\nC/C++ Files CMake doesnt know about...") -for cf in sorted(source_list(base, is_c)): +for cf in sorted(source_list(SOURCE_DIR, is_c)): if not is_ignore(cf): if cf not in global_c: print("missing_c: ", cf) + + # check if automake builds a corrasponding .o file. + ''' + if cf in global_c: + out1 = os.path.splitext(cf)[0] + ".o" + out2 = os.path.splitext(cf)[0] + ".Po" + out2_dir, out2_file = out2 = os.path.split(out2) + out2 = os.path.join(out2_dir, ".deps", out2_file) + if not os.path.exists(out1) and not os.path.exists(out2): + print("bad_c: ", cf) + ''' + print("\nC/C++ Headers CMake doesnt know about...") -for hf in sorted(source_list(base, is_c_header)): +for hf in sorted(source_list(SOURCE_DIR, is_c_header)): if not is_ignore(hf): if hf not in global_h: print("missing_h: ", hf) -# test encoding -import traceback -for files in (global_c, global_h): - for f in sorted(files): - if os.path.exists(f): - # ignore outside of our source tree - if "extern" not in f: - i = 1 - try: - for l in open(f, "r", encoding="utf8"): - i += 1 - except: - print("Non utf8: %s:%d" % (f, i)) - if i > 1: - traceback.print_exc() +if UTF8_CHECK: + # test encoding + import traceback + for files in (global_c, global_h): + for f in sorted(files): + if os.path.exists(f): + # ignore outside of our source tree + if "extern" not in f: + i = 1 + try: + for l in open(f, "r", encoding="utf8"): + i += 1 + except: + print("Non utf8: %s:%d" % (f, i)) + if i > 1: + traceback.print_exc() diff --git a/build_files/cmake/cmake_consistency_check_config.py b/build_files/cmake/cmake_consistency_check_config.py new file mode 100644 index 00000000000..60a46d3a1dd --- /dev/null +++ b/build_files/cmake/cmake_consistency_check_config.py @@ -0,0 +1,48 @@ +import os + +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" + ) + +UTF8_CHECK = True + +SOURCE_DIR = os.path.normpath(os.path.abspath(os.path.normpath(os.path.join(os.path.dirname(__file__), "..", "..")))) diff --git a/build_files/cmake/cmake_netbeans_project.py b/build_files/cmake/cmake_netbeans_project.py new file mode 100755 index 00000000000..8060574580c --- /dev/null +++ b/build_files/cmake/cmake_netbeans_project.py @@ -0,0 +1,240 @@ +#!/usr/bin/env python + +# $Id$ +# ***** BEGIN GPL LICENSE BLOCK ***** +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software Foundation, +# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +# +# Contributor(s): Campbell Barton, M.G. Kishalmi +# +# ***** END GPL LICENSE BLOCK ***** + +# <pep8 compliant> + +""" +Example linux usage + python .~/blenderSVN/blender/build_files/cmake/cmake_netbeans_project.py ~/blenderSVN/cmake + +Windows not supported so far +""" + +from project_info import (SIMPLE_PROJECTFILE, + SOURCE_DIR, + CMAKE_DIR, + PROJECT_DIR, + source_list, + is_project_file, + is_c_header, + is_py, + cmake_advanced_info, + cmake_compiler_defines, + ) + + +import os +from os.path import join, dirname, normpath, relpath, exists + + +def create_nb_project_main(): + files = list(source_list(SOURCE_DIR, filename_check=is_project_file)) + files_rel = [relpath(f, start=PROJECT_DIR) for f in files] + files_rel.sort() + + if SIMPLE_PROJECTFILE: + pass + else: + includes, defines = cmake_advanced_info() + # for some reason it doesnt give all internal includes + includes = list(set(includes) | set(dirname(f) for f in files if is_c_header(f))) + includes.sort() + + PROJECT_NAME = "Blender" + + # --------------- NB spesific + defines = [("%s=%s" % cdef) if cdef[1] else cdef[0] for cdef in defines] + defines += [cdef.replace("#define", "").strip() for cdef in cmake_compiler_defines()] + + def file_list_to_nested(files): + # convert paths to hierarchy + paths_nested = {} + + def ensure_path(filepath): + filepath_split = filepath.split(os.sep) + + pn = paths_nested + for subdir in filepath_split[:-1]: + pn = pn.setdefault(subdir, {}) + pn[filepath_split[-1]] = None + + for path in files: + ensure_path(path) + return paths_nested + + PROJECT_DIR_NB = join(PROJECT_DIR, "nbproject") + if not exists(PROJECT_DIR_NB): + os.mkdir(PROJECT_DIR_NB) + + # SOURCE_DIR_REL = relpath(SOURCE_DIR, PROJECT_DIR) + + f = open(join(PROJECT_DIR_NB, "project.xml"), 'w') + + f.write('<?xml version="1.0" encoding="UTF-8"?>\n') + f.write('<project xmlns="http://www.netbeans.org/ns/project/1">\n') + f.write(' <type>org.netbeans.modules.cnd.makeproject</type>\n') + f.write(' <configuration>\n') + f.write(' <data xmlns="http://www.netbeans.org/ns/make-project/1">\n') + f.write(' <name>%s</name>\n' % PROJECT_NAME) + f.write(' <c-extensions>c,m</c-extensions>\n') + f.write(' <cpp-extensions>cpp,mm</cpp-extensions>\n') + f.write(' <header-extensions>h,hpp,inl</header-extensions>\n') + f.write(' <sourceEncoding>UTF-8</sourceEncoding>\n') + f.write(' <make-dep-projects/>\n') + f.write(' <sourceRootList>\n') + f.write(' <sourceRootElem>%s</sourceRootElem>\n' % SOURCE_DIR) # base_root_rel + f.write(' </sourceRootList>\n') + f.write(' <confList>\n') + f.write(' <confElem>\n') + f.write(' <name>Default</name>\n') + f.write(' <type>0</type>\n') + f.write(' </confElem>\n') + f.write(' </confList>\n') + f.write(' </data>\n') + f.write(' </configuration>\n') + f.write('</project>\n') + + f = open(join(PROJECT_DIR_NB, "configurations.xml"), 'w') + + f.write('<?xml version="1.0" encoding="UTF-8"?>\n') + f.write('<configurationDescriptor version="79">\n') + f.write(' <logicalFolder name="root" displayName="root" projectFiles="true" kind="ROOT">\n') + f.write(' <df name="blender" root="%s">\n' % SOURCE_DIR) # base_root_rel + + # write files! + files_rel_local = [normpath(relpath(join(CMAKE_DIR, path), SOURCE_DIR)) for path in files_rel] + files_rel_hierarchy = file_list_to_nested(files_rel_local) + # print(files_rel_hierarchy) + + def write_df(hdir, ident): + dirs = [] + files = [] + for key, item in sorted(hdir.items()): + if item is None: + files.append(key) + else: + dirs.append((key, item)) + + for key, item in dirs: + f.write('%s <df name="%s">\n' % (ident, key)) + write_df(item, ident + " ") + f.write('%s </df>\n' % ident) + + for key in files: + f.write('%s<in>%s</in>\n' % (ident, key)) + + write_df(files_rel_hierarchy, ident=" ") + + f.write(' </df>\n') + + f.write(' <logicalFolder name="ExternalFiles"\n') + f.write(' displayName="Important Files"\n') + f.write(' projectFiles="false"\n') + f.write(' kind="IMPORTANT_FILES_FOLDER">\n') + # f.write(' <itemPath>../GNUmakefile</itemPath>\n') + f.write(' </logicalFolder>\n') + + f.write(' </logicalFolder>\n') + # default, but this dir is infact not in blender dir so we can ignore it + # f.write(' <sourceFolderFilter>^(nbproject)$</sourceFolderFilter>\n') + f.write(' <sourceFolderFilter>^(nbproject|__pycache__|.*\.py|.*\.html|.*\.blend)$</sourceFolderFilter>\n') + + f.write(' <sourceRootList>\n') + f.write(' <Elem>%s</Elem>\n' % SOURCE_DIR) # base_root_rel + f.write(' </sourceRootList>\n') + + f.write(' <projectmakefile>Makefile</projectmakefile>\n') + + # paths again + f.write(' <confs>\n') + f.write(' <conf name="Default" type="0">\n') + + f.write(' <toolsSet>\n') + f.write(' <remote-sources-mode>LOCAL_SOURCES</remote-sources-mode>\n') + f.write(' <compilerSet>default</compilerSet>\n') + f.write(' </toolsSet>\n') + f.write(' <makefileType>\n') + + f.write(' <makeTool>\n') + f.write(' <buildCommandWorkingDir>.</buildCommandWorkingDir>\n') + f.write(' <buildCommand>${MAKE} -f Makefile</buildCommand>\n') + f.write(' <cleanCommand>${MAKE} -f Makefile clean</cleanCommand>\n') + f.write(' <executablePath>./bin/blender</executablePath>\n') + + def write_toolinfo(): + f.write(' <incDir>\n') + for inc in includes: + f.write(' <pElem>%s</pElem>\n' % inc) + f.write(' </incDir>\n') + f.write(' <preprocessorList>\n') + for cdef in defines: + f.write(' <Elem>%s</Elem>\n' % cdef) + f.write(' </preprocessorList>\n') + + f.write(' <cTool>\n') + write_toolinfo() + f.write(' </cTool>\n') + + f.write(' <ccTool>\n') + write_toolinfo() + f.write(' </ccTool>\n') + + f.write(' </makeTool>\n') + f.write(' </makefileType>\n') + # finishe makefle info + + f.write(' \n') + + for path in files_rel_local: + f.write(' <item path="%s"\n' % path) + f.write(' ex="false"\n') + f.write(' tool="1"\n') + f.write(' flavor="0">\n') + f.write(' </item>\n') + + f.write(' <runprofile version="9">\n') + f.write(' <runcommandpicklist>\n') + f.write(' </runcommandpicklist>\n') + f.write(' <runcommand>%s</runcommand>\n' % os.path.join(CMAKE_DIR, "bin/blender")) + f.write(' <rundir>%s</rundir>\n' % SOURCE_DIR) + f.write(' <buildfirst>false</buildfirst>\n') + f.write(' <terminal-type>0</terminal-type>\n') + f.write(' <remove-instrumentation>0</remove-instrumentation>\n') + f.write(' <environment>\n') + f.write(' </environment>\n') + f.write(' </runprofile>\n') + + f.write(' </conf>\n') + f.write(' </confs>\n') + + # todo + + f.write('</configurationDescriptor>\n') + + +def main(): + create_nb_project_main() + + +if __name__ == "__main__": + main() diff --git a/build_files/cmake/cmake_qtcreator_project.py b/build_files/cmake/cmake_qtcreator_project.py index 59b8b2a3b02..d8993c3197a 100644..100755 --- a/build_files/cmake/cmake_qtcreator_project.py +++ b/build_files/cmake/cmake_qtcreator_project.py @@ -1,6 +1,6 @@ #!/usr/bin/env python -# $Id: +# $Id$ # ***** BEGIN GPL LICENSE BLOCK ***** # # This program is free software; you can redistribute it and/or @@ -31,223 +31,65 @@ example linux usage python .~/blenderSVN/blender/build_files/cmake/cmake_qtcreator_project.py ~/blenderSVN/cmake """ -import sys -import os -from os.path import join, dirname, normpath, abspath, splitext, relpath, exists - -base = join(os.path.dirname(__file__), "..", "..") -base = normpath(base) -base = abspath(base) - -SIMPLE_PROJECTFILE = False - -# get cmake path -CMAKE_DIR = sys.argv[-1] - -if not os.path.exists(os.path.join(CMAKE_DIR, "CMakeCache.txt")): - CMAKE_DIR = os.getcwd() -if not os.path.exists(os.path.join(CMAKE_DIR, "CMakeCache.txt")): - print("CMakeCache.txt not found in %r or %r\n Pass CMake build dir as an argument, or run from that dir, aborting" % (CMAKE_DIR, os.getcwd())) - sys.exit(1) - - -# could be either. -# PROJECT_DIR = base -PROJECT_DIR = CMAKE_DIR - - -def source_list(path, filename_check=None): - for dirpath, dirnames, filenames in os.walk(path): - - # skip '.svn' - if dirpath.startswith("."): - continue - - for filename in filenames: - filepath = join(dirpath, filename) - if filename_check is None or filename_check(filepath): - yield filepath - - -# extension checking -def is_cmake(filename): - ext = splitext(filename)[1] - return (ext == ".cmake") or (filename.endswith("CMakeLists.txt")) - - -def is_c_header(filename): - ext = splitext(filename)[1] - return (ext in (".h", ".hpp", ".hxx")) - - -def is_py(filename): - ext = splitext(filename)[1] - return (ext == ".py") - - -def is_glsl(filename): - ext = splitext(filename)[1] - return (ext == ".glsl") - - -def is_c(filename): - ext = splitext(filename)[1] - return (ext in (".c", ".cpp", ".cxx", ".m", ".mm", ".rc")) - - -def is_c_any(filename): - return is_c(filename) or is_c_header(filename) - - -def is_svn_file(filename): - dn, fn = os.path.split(filename) - filename_svn = join(dn, ".svn", "text-base", "%s.svn-base" % fn) - return exists(filename_svn) - +from project_info import (SIMPLE_PROJECTFILE, + SOURCE_DIR, + CMAKE_DIR, + PROJECT_DIR, + source_list, + is_project_file, + is_c_header, + is_py, + cmake_advanced_info, + cmake_compiler_defines, + ) -def is_project_file(filename): - return (is_c_any(filename) or is_cmake(filename) or is_glsl(filename)) # and is_svn_file(filename) - - -def cmake_advanced_info(): - """ Extracr includes and defines from cmake. - """ - - def create_eclipse_project(CMAKE_DIR): - print("CMAKE_DIR %r" % CMAKE_DIR) - if sys.platform == "win32": - cmd = 'cmake "%s" -G"Eclipse CDT4 - MinGW Makefiles"' % CMAKE_DIR - else: - cmd = 'cmake "%s" -G"Eclipse CDT4 - Unix Makefiles"' % CMAKE_DIR - - os.system(cmd) - - includes = [] - defines = [] - - create_eclipse_project(CMAKE_DIR) - - from xml.dom.minidom import parse - tree = parse(os.path.join(CMAKE_DIR, ".cproject")) - ''' - f = open(".cproject_pretty", 'w') - f.write(tree.toprettyxml(indent=" ", newl="")) - ''' - ELEMENT_NODE = tree.ELEMENT_NODE - - cproject, = tree.getElementsByTagName("cproject") - for storage in cproject.childNodes: - if storage.nodeType != ELEMENT_NODE: - continue - - if storage.attributes["moduleId"].value == "org.eclipse.cdt.core.settings": - cconfig = storage.getElementsByTagName("cconfiguration")[0] - for substorage in cconfig.childNodes: - if substorage.nodeType != ELEMENT_NODE: - continue - - moduleId = substorage.attributes["moduleId"].value - - # org.eclipse.cdt.core.settings - # org.eclipse.cdt.core.language.mapping - # org.eclipse.cdt.core.externalSettings - # org.eclipse.cdt.core.pathentry - # org.eclipse.cdt.make.core.buildtargets - - if moduleId == "org.eclipse.cdt.core.pathentry": - for path in substorage.childNodes: - if path.nodeType != ELEMENT_NODE: - continue - kind = path.attributes["kind"].value - - if kind == "mac": - # <pathentry kind="mac" name="PREFIX" path="" value=""/opt/blender25""/> - defines.append((path.attributes["name"].value, path.attributes["value"].value)) - elif kind == "inc": - # <pathentry include="/data/src/blender/blender/source/blender/editors/include" kind="inc" path="" system="true"/> - includes.append(path.attributes["include"].value) - else: - pass - - return includes, defines - - -def cmake_cache_var(var): - cache_file = open(os.path.join(CMAKE_DIR, "CMakeCache.txt")) - lines = [l_strip for l in cache_file for l_strip in (l.strip(),) if l_strip if not l_strip.startswith("//") if not l_strip.startswith("#")] - cache_file.close() - - for l in lines: - if l.split(":")[0] == var: - return l.split("=", 1)[-1] - return None - - -def cmake_compiler_defines(): - compiler = cmake_cache_var("CMAKE_C_COMPILER") # could do CXX too - - if compiler is None: - print("Couldn't find the compiler, os defines will be omitted...") - return - - import tempfile - temp_c = tempfile.mkstemp(suffix=".c")[1] - temp_def = tempfile.mkstemp(suffix=".def")[1] - - os.system("%s -dM -E %s > %s" % (compiler, temp_c, temp_def)) - - temp_def_file = open(temp_def) - lines = [l.strip() for l in temp_def_file if l.strip()] - temp_def_file.close() - - os.remove(temp_c) - os.remove(temp_def) - return lines +import os +import sys def create_qtc_project_main(): - files = list(source_list(base, filename_check=is_project_file)) - files_rel = [relpath(f, start=PROJECT_DIR) for f in files] + files = list(source_list(SOURCE_DIR, filename_check=is_project_file)) + files_rel = [os.path.relpath(f, start=PROJECT_DIR) for f in files] files_rel.sort() # --- qtcreator specific, simple format if SIMPLE_PROJECTFILE: # --- qtcreator specific, simple format PROJECT_NAME = "Blender" - f = open(join(PROJECT_DIR, "%s.files" % PROJECT_NAME), 'w') + f = open(os.path.join(PROJECT_DIR, "%s.files" % PROJECT_NAME), 'w') f.write("\n".join(files_rel)) - f = open(join(PROJECT_DIR, "%s.includes" % PROJECT_NAME), 'w') - f.write("\n".join(sorted(list(set(dirname(f) for f in files_rel if is_c_header(f)))))) + f = open(os.path.join(PROJECT_DIR, "%s.includes" % PROJECT_NAME), 'w') + f.write("\n".join(sorted(list(set(os.path.dirname(f) for f in files_rel if is_c_header(f)))))) - qtc_prj = join(PROJECT_DIR, "%s.creator" % PROJECT_NAME) + qtc_prj = os.path.join(PROJECT_DIR, "%s.creator" % PROJECT_NAME) f = open(qtc_prj, 'w') f.write("[General]\n") - qtc_cfg = join(PROJECT_DIR, "%s.config" % PROJECT_NAME) - if not exists(qtc_cfg): + qtc_cfg = os.path.join(PROJECT_DIR, "%s.config" % PROJECT_NAME) + if not os.path.exists(qtc_cfg): f = open(qtc_cfg, 'w') f.write("// ADD PREDEFINED MACROS HERE!\n") else: includes, defines = cmake_advanced_info() # for some reason it doesnt give all internal includes - includes = list(set(includes) | set(dirname(f) for f in files_rel if is_c_header(f))) + includes = list(set(includes) | set(os.path.dirname(f) for f in files_rel if is_c_header(f))) includes.sort() PROJECT_NAME = "Blender" FILE_NAME = PROJECT_NAME.lower() - f = open(join(PROJECT_DIR, "%s.files" % FILE_NAME), 'w') + f = open(os.path.join(PROJECT_DIR, "%s.files" % FILE_NAME), 'w') f.write("\n".join(files_rel)) - f = open(join(PROJECT_DIR, "%s.includes" % FILE_NAME), 'w') + f = open(os.path.join(PROJECT_DIR, "%s.includes" % FILE_NAME), 'w') f.write("\n".join(sorted(includes))) - qtc_prj = join(PROJECT_DIR, "%s.creator" % FILE_NAME) + qtc_prj = os.path.join(PROJECT_DIR, "%s.creator" % FILE_NAME) f = open(qtc_prj, 'w') f.write("[General]\n") - qtc_cfg = join(PROJECT_DIR, "%s.config" % FILE_NAME) + qtc_cfg = os.path.join(PROJECT_DIR, "%s.config" % FILE_NAME) f = open(qtc_cfg, 'w') f.write("// ADD PREDEFINED MACROS HERE!\n") defines_final = [("#define %s %s" % item) for item in defines] @@ -260,22 +102,22 @@ def create_qtc_project_main(): def create_qtc_project_python(): - files = list(source_list(base, filename_check=is_py)) - files_rel = [relpath(f, start=PROJECT_DIR) for f in files] + files = list(source_list(SOURCE_DIR, filename_check=is_py)) + files_rel = [os.path.relpath(f, start=PROJECT_DIR) for f in files] files_rel.sort() # --- qtcreator specific, simple format PROJECT_NAME = "Blender_Python" FILE_NAME = PROJECT_NAME.lower() - f = open(join(PROJECT_DIR, "%s.files" % FILE_NAME), 'w') + f = open(os.path.join(PROJECT_DIR, "%s.files" % FILE_NAME), 'w') f.write("\n".join(files_rel)) - qtc_prj = join(PROJECT_DIR, "%s.creator" % FILE_NAME) + qtc_prj = os.path.join(PROJECT_DIR, "%s.creator" % FILE_NAME) f = open(qtc_prj, 'w') f.write("[General]\n") - qtc_cfg = join(PROJECT_DIR, "%s.config" % FILE_NAME) - if not exists(qtc_cfg): + qtc_cfg = os.path.join(PROJECT_DIR, "%s.config" % FILE_NAME) + if not os.path.exists(qtc_cfg): f = open(qtc_cfg, 'w') f.write("// ADD PREDEFINED MACROS HERE!\n") diff --git a/build_files/cmake/example_scripts/cmake_linux_install.sh b/build_files/cmake/example_scripts/cmake_linux_install.sh index 7770efcf392..504218f91a6 100755 --- a/build_files/cmake/example_scripts/cmake_linux_install.sh +++ b/build_files/cmake/example_scripts/cmake_linux_install.sh @@ -17,7 +17,7 @@ cd ~/blender-svn/build-cmake # cmake without copying files for fast rebuilds # the files from svn will be used in place -cmake ../blender -DWITH_INSTALL:BOOL=FALSE +cmake ../blender # make blender, will take some time make diff --git a/build_files/cmake/macros.cmake b/build_files/cmake/macros.cmake index ca1dd79cd8e..34301458a06 100644 --- a/build_files/cmake/macros.cmake +++ b/build_files/cmake/macros.cmake @@ -1,63 +1,142 @@ # -*- 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() + + +macro(target_link_libraries_optimized TARGET LIBS) + foreach(_LIB ${LIBS}) + target_link_libraries(${TARGET} optimized "${_LIB}") + endforeach() + unset(_LIB) +endmacro() + +macro(target_link_libraries_debug TARGET LIBS) + foreach(_LIB ${LIBS}) + target_link_libraries(${TARGET} debug "${_LIB}") + endforeach() + unset(_LIB) +endmacro() + # Nicer makefiles with -I/1/foo/ instead of -I/1/2/3/../../foo/ # use it instead of include_directories() macro(blender_include_dirs includes) + set(_ALL_INCS "") + foreach(_INC ${ARGV}) + get_filename_component(_ABS_INC ${_INC} ABSOLUTE) + list(APPEND _ALL_INCS ${_ABS_INC}) + endforeach() + include_directories(${_ALL_INCS}) + unset(_INC) + unset(_ABS_INC) + unset(_ALL_INCS) +endmacro() - foreach(inc ${ARGV}) - get_filename_component(abs_inc ${inc} ABSOLUTE) - list(APPEND all_incs ${abs_inc}) +macro(blender_include_dirs_sys + includes) + set(_ALL_INCS "") + foreach(_INC ${ARGV}) + get_filename_component(_ABS_INC ${_INC} ABSOLUTE) + list(APPEND _ALL_INCS ${_ABS_INC}) endforeach() - include_directories(${all_incs}) + include_directories(SYSTEM ${_ALL_INCS}) + unset(_INC) + unset(_ABS_INC) + unset(_ALL_INCS) endmacro() +macro(blender_source_group + sources) + + # Group by location on disk + source_group("Source Files" FILES CMakeLists.txt) + + foreach(_SRC ${sources}) + get_filename_component(_SRC_EXT ${_SRC} EXT) + if((${_SRC_EXT} MATCHES ".h") OR (${_SRC_EXT} MATCHES ".hpp")) + source_group("Header Files" FILES ${_SRC}) + else() + source_group("Source Files" FILES ${_SRC}) + endif() + endforeach() + + unset(_SRC) + unset(_SRC_EXT) +endmacro() + + # only MSVC uses SOURCE_GROUP macro(blender_add_lib_nolist name sources - includes) + includes + includes_sys) # message(STATUS "Configuring library ${name}") + # include_directories(${includes}) + # include_directories(SYSTEM ${includes_sys}) blender_include_dirs("${includes}") + blender_include_dirs_sys("${includes_sys}") + add_library(${name} ${sources}) - # Group by location on disk - source_group("Source Files" FILES CMakeLists.txt) - foreach(SRC ${sources}) - get_filename_component(SRC_EXT ${SRC} EXT) - if(${SRC_EXT} MATCHES ".h" OR ${SRC_EXT} MATCHES ".hpp") - source_group("Header Files" FILES ${SRC}) - else() - source_group("Source Files" FILES ${SRC}) - endif() - endforeach() + # works fine without having the includes + # listed is helpful for IDE's (QtCreator/MSVC) + blender_source_group("${sources}") + endmacro() -# # works fine but having the includes listed is helpful for IDE's (QtCreator/MSVC) -# macro(blender_add_lib_nolist -# name -# sources -# includes) -# -# message(STATUS "Configuring library ${name}") -# include_directories(${includes}) -# add_library(${name} ${sources}) -# endmacro() macro(blender_add_lib name sources - includes) + includes + includes_sys) - blender_add_lib_nolist(${name} "${sources}" "${includes}") + blender_add_lib_nolist(${name} "${sources}" "${includes}" "${includes_sys}") set_property(GLOBAL APPEND PROPERTY BLENDER_LINK_LIBS ${name}) - endmacro() + macro(SETUP_LIBDIRS) # see "cmake --help-policy CMP0003" if(COMMAND cmake_policy) @@ -88,9 +167,6 @@ macro(SETUP_LIBDIRS) if(WITH_IMAGE_OPENJPEG AND UNIX AND NOT APPLE) link_directories(${OPENJPEG_LIBPATH}) endif() - if(WITH_LCMS) - link_directories(${LCMS_LIBPATH}) - endif() if(WITH_CODEC_QUICKTIME) link_directories(${QUICKTIME_LIBPATH}) endif() @@ -104,7 +180,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}) @@ -114,6 +190,9 @@ macro(SETUP_LIBDIRS) link_directories(${PCRE_LIBPATH}) link_directories(${EXPAT_LIBPATH}) endif() + if(WITH_MEM_JEMALLOC) + link_directories(${JEMALLOC_LIBPATH}) + endif() if(WIN32 AND NOT UNIX) link_directories(${PTHREADS_LIBPATH}) @@ -122,19 +201,29 @@ endmacro() 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}) + set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${PLATFORM_LINKFLAGS}") + set(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} ${PLATFORM_LINKFLAGS_DEBUG}") + + target_link_libraries(${target} + ${OPENGL_gl_LIBRARY} + ${OPENGL_glu_LIBRARY} + ${JPEG_LIBRARIES} + ${PNG_LIBRARIES} + ${ZLIB_LIBRARIES} + ${PLATFORM_LINKLIBS}) # 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_debug(${target} "${PYTHON_LIBRARIES_DEBUG}") + target_link_libraries_optimized(${target} "${PYTHON_LIBRARIES}") + unset(PYTHON_LIBRARIES_DEBUG) else() - target_link_libraries(${target} ${PYTHON_LIBRARY}) + target_link_libraries(${target} ${PYTHON_LIBRARIES}) endif() endif() @@ -142,14 +231,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() @@ -157,71 +250,72 @@ 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() + file_list_suffix(OPENEXR_LIBRARIES_DEBUG "${OPENEXR_LIBRARIES}" "_d") + target_link_libraries_debug(${target} "${OPENEXR_LIBRARIES_DEBUG}") + target_link_libraries_optimized(${target} "${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}) - endif() - if(WITH_LCMS) - target_link_libraries(${target} ${LCMS_LIBRARY}) + 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() - 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_debug(${target} "${OPENCOLLADA_LIBRARIES_DEBUG}") + target_link_libraries_optimized(${target} "${OPENCOLLADA_LIBRARIES}") + unset(OPENCOLLADA_LIBRARIES_DEBUG) + + file_list_suffix(PCRE_LIB_DEBUG "${PCRE_LIB}" "_d") + target_link_libraries_debug(${target} "${PCRE_LIB_DEBUG}") + target_link_libraries_optimized(${target} "${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_debug(${target} "${EXPAT_LIB_DEBUG}") + target_link_libraries_optimized(${target} "${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_LCMS) - if(WIN32 AND NOT UNIX) - target_link_libraries(${target} debug ${LCMS_LIB}_d) - target_link_libraries(${target} optimized ${LCMS_LIB}) - endif() + if(WITH_MEM_JEMALLOC) + 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() @@ -394,3 +488,80 @@ macro(get_blender_version) # message(STATUS "Version (Internal): ${BLENDER_VERSION}.${BLENDER_SUBVERSION}, Version (external): ${BLENDER_VERSION}${BLENDER_VERSION_CHAR}-${BLENDER_VERSION_CYCLE}") endmacro() + + +# hacks to override initial project settings +# these macros must be called directly before/after project(Blender) +macro(blender_project_hack_pre) + # ---------------- + # MINGW HACK START + # ignore system set flag, use our own + # must be before project(...) + # if the user wants to add their own its ok after first run. + if(DEFINED CMAKE_C_STANDARD_LIBRARIES) + set(_reset_standard_libraries OFF) + else() + set(_reset_standard_libraries ON) + endif() + + # ------------------ + # GCC -O3 HACK START + # needed because O3 can cause problems but + # allow the builder to set O3 manually after. + if(DEFINED CMAKE_C_FLAGS_RELEASE) + set(_reset_standard_cflags_rel OFF) + else() + set(_reset_standard_cflags_rel ON) + endif() + if(DEFINED CMAKE_CXX_FLAGS_RELEASE) + set(_reset_standard_cxxflags_rel OFF) + else() + set(_reset_standard_cxxflags_rel ON) + endif() +endmacro() + + +macro(blender_project_hack_post) + # -------------- + # MINGW HACK END + if (_reset_standard_libraries) + # Must come after project(...) + # + # MINGW workaround for -ladvapi32 being included which surprisingly causes + # string formatting of floats, eg: printf("%.*f", 3, value). to crash blender + # with a meaningless stack trace. by overriding this flag we ensure we only + # have libs we define and that cmake & scons builds match. + set(CMAKE_C_STANDARD_LIBRARIES "" CACHE STRING "" FORCE) + set(CMAKE_CXX_STANDARD_LIBRARIES "" CACHE STRING "" FORCE) + mark_as_advanced(CMAKE_C_STANDARD_LIBRARIES) + mark_as_advanced(CMAKE_CXX_STANDARD_LIBRARIES) + endif() + unset(_reset_standard_libraries) + + + # ---------------- + # GCC -O3 HACK END + if(_reset_standard_cflags_rel) + string(REGEX REPLACE "-O3" "-O2" CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE}") + set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE}" CACHE STRING "" FORCE) + mark_as_advanced(CMAKE_C_FLAGS_RELEASE) + endif() + + if(_reset_standard_cxxflags_rel) + string(REGEX REPLACE "-O3" "-O2" CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}") + set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}" CACHE STRING "" FORCE) + mark_as_advanced(CMAKE_CXX_FLAGS_RELEASE) + endif() + + unset(_reset_standard_cflags_rel) + unset(_reset_standard_cxxflags_rel) + + # ------------------------------------------------------------------ + # 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 ") + endif() + endif() + +endmacro() diff --git a/build_files/cmake/packaging.cmake b/build_files/cmake/packaging.cmake index 07c5add52b0..6cda62b487f 100644 --- a/build_files/cmake/packaging.cmake +++ b/build_files/cmake/packaging.cmake @@ -38,7 +38,7 @@ if(CMAKE_SYSTEM_NAME MATCHES "Linux") include(build_files/cmake/RpmBuild.cmake) if(RPMBUILD_FOUND AND NOT WIN32) set(CPACK_GENERATOR "RPM") - set(CPACK_RPM_PACKAGE_RELEASE "r${BUILD_REV}") + set(CPACK_RPM_PACKAGE_RELEASE "1.r${BUILD_REV}") set(CPACK_SET_DESTDIR "true") set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "${PROJECT_DESCRIPTION}") set(CPACK_PACKAGE_RELOCATABLE "false") diff --git a/build_files/cmake/project_info.py b/build_files/cmake/project_info.py new file mode 100755 index 00000000000..db12884469b --- /dev/null +++ b/build_files/cmake/project_info.py @@ -0,0 +1,218 @@ +#!/usr/bin/env python + +# $Id$ +# ***** BEGIN GPL LICENSE BLOCK ***** +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software Foundation, +# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +# +# Contributor(s): Campbell Barton, M.G. Kishalmi +# +# ***** END GPL LICENSE BLOCK ***** + +# <pep8 compliant> + +""" +Example Win32 usage: + c:\Python32\python.exe c:\blender_dev\blender\build_files\cmake\cmake_qtcreator_project.py c:\blender_dev\cmake_build + +example linux usage + python .~/blenderSVN/blender/build_files/cmake/cmake_qtcreator_project.py ~/blenderSVN/cmake +""" + +__all__ = ( + "SIMPLE_PROJECTFILE", + "SOURCE_DIR", + "CMAKE_DIR", + "PROJECT_DIR", + "source_list", + "is_project_file", + "is_c_header", + "is_py", + "cmake_advanced_info", + "cmake_compiler_defines", +) + +import sys +import os +from os.path import join, dirname, normpath, abspath, splitext, exists + +SOURCE_DIR = join(dirname(__file__), "..", "..") +SOURCE_DIR = normpath(SOURCE_DIR) +SOURCE_DIR = abspath(SOURCE_DIR) + +SIMPLE_PROJECTFILE = False + +# get cmake path +CMAKE_DIR = sys.argv[-1] + +if not exists(join(CMAKE_DIR, "CMakeCache.txt")): + CMAKE_DIR = os.getcwd() +if not exists(join(CMAKE_DIR, "CMakeCache.txt")): + print("CMakeCache.txt not found in %r or %r\n Pass CMake build dir as an argument, or run from that dir, aborting" % (CMAKE_DIR, os.getcwd())) + sys.exit(1) + + +# could be either. +# PROJECT_DIR = SOURCE_DIR +PROJECT_DIR = CMAKE_DIR + + +def source_list(path, filename_check=None): + for dirpath, dirnames, filenames in os.walk(path): + + # skip '.svn' + if dirpath.startswith("."): + continue + + for filename in filenames: + filepath = join(dirpath, filename) + if filename_check is None or filename_check(filepath): + yield filepath + + +# extension checking +def is_cmake(filename): + ext = splitext(filename)[1] + return (ext == ".cmake") or (filename.endswith("CMakeLists.txt")) + + +def is_c_header(filename): + ext = splitext(filename)[1] + return (ext in (".h", ".hpp", ".hxx")) + + +def is_py(filename): + ext = splitext(filename)[1] + return (ext == ".py") + + +def is_glsl(filename): + ext = splitext(filename)[1] + return (ext == ".glsl") + + +def is_c(filename): + ext = splitext(filename)[1] + return (ext in (".c", ".cpp", ".cxx", ".m", ".mm", ".rc")) + + +def is_c_any(filename): + return is_c(filename) or is_c_header(filename) + + +def is_svn_file(filename): + dn, fn = os.path.split(filename) + filename_svn = join(dn, ".svn", "text-base", "%s.svn-base" % fn) + return exists(filename_svn) + + +def is_project_file(filename): + return (is_c_any(filename) or is_cmake(filename) or is_glsl(filename)) # and is_svn_file(filename) + + +def cmake_advanced_info(): + """ Extracr includes and defines from cmake. + """ + + def create_eclipse_project(CMAKE_DIR): + print("CMAKE_DIR %r" % CMAKE_DIR) + if sys.platform == "win32": + cmd = 'cmake "%s" -G"Eclipse CDT4 - MinGW Makefiles"' % CMAKE_DIR + else: + cmd = 'cmake "%s" -G"Eclipse CDT4 - Unix Makefiles"' % CMAKE_DIR + + os.system(cmd) + + includes = [] + defines = [] + + create_eclipse_project(CMAKE_DIR) + + from xml.dom.minidom import parse + tree = parse(join(CMAKE_DIR, ".cproject")) + ''' + f = open(".cproject_pretty", 'w') + f.write(tree.toprettyxml(indent=" ", newl="")) + ''' + ELEMENT_NODE = tree.ELEMENT_NODE + + cproject, = tree.getElementsByTagName("cproject") + for storage in cproject.childNodes: + if storage.nodeType != ELEMENT_NODE: + continue + + if storage.attributes["moduleId"].value == "org.eclipse.cdt.core.settings": + cconfig = storage.getElementsByTagName("cconfiguration")[0] + for substorage in cconfig.childNodes: + if substorage.nodeType != ELEMENT_NODE: + continue + + moduleId = substorage.attributes["moduleId"].value + + # org.eclipse.cdt.core.settings + # org.eclipse.cdt.core.language.mapping + # org.eclipse.cdt.core.externalSettings + # org.eclipse.cdt.core.pathentry + # org.eclipse.cdt.make.core.buildtargets + + if moduleId == "org.eclipse.cdt.core.pathentry": + for path in substorage.childNodes: + if path.nodeType != ELEMENT_NODE: + continue + kind = path.attributes["kind"].value + + if kind == "mac": + # <pathentry kind="mac" name="PREFIX" path="" value=""/opt/blender25""/> + defines.append((path.attributes["name"].value, path.attributes["value"].value)) + elif kind == "inc": + # <pathentry include="/data/src/blender/blender/source/blender/editors/include" kind="inc" path="" system="true"/> + includes.append(path.attributes["include"].value) + else: + pass + + return includes, defines + + +def cmake_cache_var(var): + cache_file = open(join(CMAKE_DIR, "CMakeCache.txt")) + lines = [l_strip for l in cache_file for l_strip in (l.strip(),) if l_strip if not l_strip.startswith("//") if not l_strip.startswith("#")] + cache_file.close() + + for l in lines: + if l.split(":")[0] == var: + return l.split("=", 1)[-1] + return None + + +def cmake_compiler_defines(): + compiler = cmake_cache_var("CMAKE_C_COMPILER") # could do CXX too + + if compiler is None: + print("Couldn't find the compiler, os defines will be omitted...") + return + + import tempfile + temp_c = tempfile.mkstemp(suffix=".c")[1] + temp_def = tempfile.mkstemp(suffix=".def")[1] + + os.system("%s -dM -E %s > %s" % (compiler, temp_c, temp_def)) + + temp_def_file = open(temp_def) + lines = [l.strip() for l in temp_def_file if l.strip()] + temp_def_file.close() + + os.remove(temp_c) + os.remove(temp_def) + return lines diff --git a/build_files/package_spec/rpm/blender.spec.in b/build_files/package_spec/rpm/blender.spec.in index 32c9ef99820..502e9f36251 100644 --- a/build_files/package_spec/rpm/blender.spec.in +++ b/build_files/package_spec/rpm/blender.spec.in @@ -5,7 +5,7 @@ BuildRoot: @CPACK_RPM_DIRECTORY@/@CPACK_PACKAGE_FILE_NAME@@CPACK_RPM_PACKAG Summary: @CPACK_RPM_PACKAGE_SUMMARY@ Name: @CPACK_RPM_PACKAGE_NAME@ Version: @CPACK_RPM_PACKAGE_VERSION@ -Release: @CPACK_RPM_PACKAGE_RELEASE@ +Release: @CPACK_RPM_PACKAGE_RELEASE@%{?dist} License: @CPACK_RPM_PACKAGE_LICENSE@ Group: @CPACK_RPM_PACKAGE_GROUP@ Vendor: @CPACK_RPM_PACKAGE_VENDOR@ diff --git a/build_files/scons/config/aix4-config.py b/build_files/scons/config/aix4-config.py index e8004338271..f8b3e750e74 100644 --- a/build_files/scons/config/aix4-config.py +++ b/build_files/scons/config/aix4-config.py @@ -76,11 +76,6 @@ BF_GETTEXT_INC = '${BF_GETTEXT}/include' BF_GETTEXT_LIB = 'gettextpo intl' BF_GETTEXT_LIBPATH = '${BF_GETTEXT}/lib' -WITH_BF_FTGL = 'false' -BF_FTGL = '#extern/bFTGL' -BF_FTGL_INC = '${BF_FTGL}/include' -BF_FTGL_LIB = 'extern_ftgl' - WITH_BF_GAMEENGINE='false' WITH_BF_BULLET = 'true' diff --git a/build_files/scons/config/linux2-config.py b/build_files/scons/config/linux2-config.py index d4e97c78c38..328cd4cdb28 100644 --- a/build_files/scons/config/linux2-config.py +++ b/build_files/scons/config/linux2-config.py @@ -93,7 +93,7 @@ BF_GETTEXT_LIBPATH = '${BF_GETTEXT}/lib' #BF_GETTEXT_LIB_STATIC = '${BF_GETTEXT}/lib/libgettextlib.a' WITH_BF_GAMEENGINE = True -WITH_BF_PLAYER = False +WITH_BF_PLAYER = True WITH_BF_BULLET = True BF_BULLET = '#extern/bullet2/src' @@ -178,6 +178,14 @@ BF_EXPAT = '/usr' BF_EXPAT_LIB = 'expat' BF_EXPAT_LIBPATH = '/usr/lib' +WITH_BF_JEMALLOC = False +WITH_BF_STATICJEMALLOC = False +BF_JEMALLOC = '/usr' +BF_JEMALLOC_INC = '${BF_JEMALLOC}/include' +BF_JEMALLOC_LIBPATH = '${BF_JEMALLOC}/lib' +BF_JEMALLOC_LIB = 'jemalloc' +BF_JEMALLOC_LIB_STATIC = '${BF_JEMALLOC_LIBPATH}/libjemalloc.a' + WITH_BF_OPENMP = True #Ray trace optimization diff --git a/build_files/scons/config/win32-vc-config.py b/build_files/scons/config/win32-vc-config.py index eeb50a9ca65..89b246cb39f 100644 --- a/build_files/scons/config/win32-vc-config.py +++ b/build_files/scons/config/win32-vc-config.py @@ -35,7 +35,7 @@ BF_LIBSAMPLERATE_LIBPATH = '${BF_LIBSAMPLERATE}/lib' WITH_BF_JACK = False BF_JACK = LIBDIR + '/jack' -BF_JACK_INC = '${BF_JACK}/include' +BF_JACK_INC = '${BF_JACK}/include ${BF_FFMPEG}/include/msvc' BF_JACK_LIB = 'libjack' BF_JACK_LIBPATH = '${BF_JACK}/lib' @@ -99,7 +99,7 @@ BF_GETTEXT_LIB = 'gnu_gettext' BF_GETTEXT_LIBPATH = '${BF_GETTEXT}/lib' WITH_BF_GAMEENGINE = True -WITH_BF_PLAYER = False +WITH_BF_PLAYER = True WITH_BF_BULLET = True BF_BULLET = '#extern/bullet2/src' @@ -118,7 +118,7 @@ BF_FREETYPE_INC = '${BF_FREETYPE}/include ${BF_FREETYPE}/include/freetype2' BF_FREETYPE_LIB = 'freetype2ST' BF_FREETYPE_LIBPATH = '${BF_FREETYPE}/lib' -WITH_BF_QUICKTIME = True # -DWITH_QUICKTIME +WITH_BF_QUICKTIME = False # -DWITH_QUICKTIME BF_QUICKTIME = LIBDIR + '/QTDevWin' BF_QUICKTIME_INC = '${BF_QUICKTIME}/CIncludes' BF_QUICKTIME_LIB = 'qtmlClient' @@ -149,12 +149,6 @@ BF_OPENCOLLADA_INC = '${BF_OPENCOLLADA}/include' BF_OPENCOLLADA_LIB = 'OpenCOLLADAStreamWriter OpenCOLLADASaxFrameworkLoader OpenCOLLADAFramework OpenCOLLADABaseUtils GeneratedSaxParser MathMLSolver xml2 pcre buffer ftoa UTF' BF_OPENCOLLADA_LIBPATH = '${BF_OPENCOLLADA}/lib' -WITH_BF_LCMS = False -BF_LCMS = LIBDIR + '/lcms' -BF_LCMS_INC = '${BF_LCMS}/include' -BF_LCMS_LIB = 'lcms' -BF_LCMS_LIBPATH = '${BF_LCMS}/lib' - #Ray trace optimization WITH_BF_RAYOPTIMIZATION = True BF_RAYOPTIMIZATION_SSE_FLAGS = ['/arch:SSE'] @@ -176,7 +170,7 @@ BGE_CXXFLAGS = ['/O2', '/EHsc', '/GR', '/fp:fast', '/arch:SSE'] BF_DEBUG_CCFLAGS = ['/Zi', '/FR${TARGET}.sbr'] -CPPFLAGS = ['-DWIN32','-D_CONSOLE', '-D_LIB', '-DFTGL_LIBRARY_STATIC', '-D_CRT_SECURE_NO_DEPRECATE'] +CPPFLAGS = ['-DWIN32','-D_CONSOLE', '-D_LIB', '-D_CRT_SECURE_NO_DEPRECATE'] REL_CFLAGS = ['-O2', '-DNDEBUG'] REL_CCFLAGS = ['-O2', '-DNDEBUG'] REL_CXXFLAGS = ['-O2', '-DNDEBUG'] @@ -187,7 +181,7 @@ CXX_WARN = [] LLIBS = ['ws2_32', 'vfw32', 'winmm', 'kernel32', 'user32', 'gdi32', 'comdlg32', 'advapi32', 'shfolder', 'shell32', 'ole32', 'oleaut32', 'uuid'] -PLATFORM_LINKFLAGS = ['/SUBSYSTEM:CONSOLE','/MACHINE:IX86','/STACK:2097152','/INCREMENTAL:NO', '/LARGEADDRESSAWARE'] +PLATFORM_LINKFLAGS = ['/SUBSYSTEM:CONSOLE','/MACHINE:IX86','/STACK:2097152','/INCREMENTAL:NO', '/LARGEADDRESSAWARE', '/NODEFAULTLIB:msvcrt.lib', '/NODEFAULTLIB:msvcmrt.lib', '/NODEFAULTLIB:msvcurt.lib', '/NODEFAULTLIB:msvcrtd.lib'] # # Todo # BF_PROFILE_CCFLAGS = ['-pg', '-g '] diff --git a/build_files/scons/config/win64-vc-config.py b/build_files/scons/config/win64-vc-config.py index 2dcbe8aeb2e..67db1c441d7 100644 --- a/build_files/scons/config/win64-vc-config.py +++ b/build_files/scons/config/win64-vc-config.py @@ -50,6 +50,8 @@ BF_SDL_INC = '${BF_SDL}/include' BF_SDL_LIB = 'SDL.lib' BF_SDL_LIBPATH = '${BF_SDL}/lib' +WITH_BF_JACK = False + BF_PTHREADS = LIBDIR + '/pthreads' BF_PTHREADS_INC = '${BF_PTHREADS}/include' BF_PTHREADS_LIB = 'pthreadVC2' @@ -101,7 +103,7 @@ BF_GETTEXT_LIB = 'gettext' BF_GETTEXT_LIBPATH = '${BF_GETTEXT}/lib' WITH_BF_GAMEENGINE = True -WITH_BF_PLAYER = False +WITH_BF_PLAYER = True WITH_BF_BULLET = True BF_BULLET = '#extern/bullet2/src' @@ -151,12 +153,6 @@ BF_OPENCOLLADA_INC = '${BF_OPENCOLLADA}/include' BF_OPENCOLLADA_LIB = 'OpenCOLLADAStreamWriter OpenCOLLADASaxFrameworkLoader OpenCOLLADAFramework OpenCOLLADABaseUtils GeneratedSaxParser MathMLSolver xml2 pcre buffer ftoa UTF' BF_OPENCOLLADA_LIBPATH = '${BF_OPENCOLLADA}/lib' -WITH_BF_LCMS = False -BF_LCMS = LIBDIR + '/lcms' -BF_LCMS_INC = '${BF_LCMS}/include' -BF_LCMS_LIB = 'lcms' -BF_LCMS_LIBPATH = '${BF_LCMS}/lib' - #Ray trace optimization WITH_BF_RAYOPTIMIZATION = True BF_RAYOPTIMIZATION_SSE_FLAGS = ['/arch:SSE','/arch:SSE2'] @@ -176,9 +172,9 @@ CCFLAGS = ['/nologo', '/Ob1', '/J', '/W0', '/Gd', '/we4013', '/wd4018', '/wd4244 CXXFLAGS = ['/EHsc'] BGE_CXXFLAGS = ['/O2', '/EHsc', '/GR', '/fp:fast'] -BF_DEBUG_CCFLAGS = ['/Zi', '/FR${TARGET}.sbr'] +BF_DEBUG_CCFLAGS = ['/Zi', '/FR${TARGET}.sbr', '/Od'] -CPPFLAGS = ['-DWIN32', '-D_CONSOLE', '-D_LIB', '-DFTGL_LIBRARY_STATIC', '-D_CRT_SECURE_NO_DEPRECATE'] +CPPFLAGS = ['-DWIN32', '-D_CONSOLE', '-D_LIB', '-D_CRT_SECURE_NO_DEPRECATE'] REL_CFLAGS = ['-O2', '-DNDEBUG'] REL_CCFLAGS = ['-O2', '-DNDEBUG'] REL_CXXFLAGS = ['-O2', '-DNDEBUG'] @@ -194,7 +190,7 @@ if BF_DEBUG: else: BF_NUMJOBS=6 -PLATFORM_LINKFLAGS = ['/SUBSYSTEM:CONSOLE','/MACHINE:X64','/STACK:2097152','/OPT:NOREF','/INCREMENTAL:NO'] +PLATFORM_LINKFLAGS = ['/SUBSYSTEM:CONSOLE','/MACHINE:X64','/STACK:2097152','/OPT:NOREF','/INCREMENTAL:NO', '/NODEFAULTLIB:msvcrt.lib', '/NODEFAULTLIB:msvcmrt.lib', '/NODEFAULTLIB:msvcurt.lib', '/NODEFAULTLIB:msvcrtd.lib'] BF_BUILDDIR = '..\\build\\blender25-win64-vc' BF_INSTALLDIR='..\\install\\blender25-win64-vc' diff --git a/build_files/scons/tools/Blender.py b/build_files/scons/tools/Blender.py index ad4df1a60c1..75af7e47edd 100644 --- a/build_files/scons/tools/Blender.py +++ b/build_files/scons/tools/Blender.py @@ -148,8 +148,6 @@ def setup_staticlibs(lenv): libincs += Split(lenv['BF_OPENEXR_LIBPATH']) if lenv['WITH_BF_STATICOPENEXR']: statlibs += Split(lenv['BF_OPENEXR_LIB_STATIC']) - if lenv['WITH_BF_LCMS']: - libincs += Split(lenv['BF_LCMS_LIBPATH']) if lenv['WITH_BF_TIFF']: libincs += Split(lenv['BF_TIFF_LIBPATH']) if lenv['WITH_BF_STATICTIFF']: @@ -203,6 +201,11 @@ def setup_staticlibs(lenv): if lenv['OURPLATFORM'] not in ('win32-vc', 'win32-mingw', 'win64-vc', 'linuxcross'): libincs.append('/usr/lib') + if lenv['WITH_BF_JEMALLOC']: + libincs += Split(lenv['BF_JEMALLOC_LIBPATH']) + if lenv['WITH_BF_STATICJEMALLOC']: + statlibs += Split(lenv['BF_JEMALLOC_LIB_STATIC']) + return statlibs, libincs def setup_syslibs(lenv): @@ -253,16 +256,20 @@ def setup_syslibs(lenv): syslibs += Split(lenv['BF_OPENGL_LIB']) if lenv['OURPLATFORM'] in ('win32-vc', 'win32-mingw','linuxcross', 'win64-vc'): syslibs += Split(lenv['BF_PTHREADS_LIB']) - if lenv['WITH_BF_LCMS']: - syslibs.append(lenv['BF_LCMS_LIB']) if lenv['WITH_BF_COLLADA']: syslibs.append(lenv['BF_PCRE_LIB']) - syslibs += Split(lenv['BF_OPENCOLLADA_LIB']) + if lenv['BF_DEBUG']: + syslibs += [colladalib+'_d' for colladalib in Split(lenv['BF_OPENCOLLADA_LIB'])] + else: + syslibs += Split(lenv['BF_OPENCOLLADA_LIB']) syslibs.append(lenv['BF_EXPAT_LIB']) if not lenv['WITH_BF_STATICLIBSAMPLERATE']: syslibs += Split(lenv['BF_LIBSAMPLERATE_LIB']) + if lenv['WITH_BF_JEMALLOC']: + if not lenv['WITH_BF_STATICJEMALLOC']: + syslibs += Split(lenv['BF_JEMALLOC_LIB']) syslibs += lenv['LLIBS'] @@ -283,6 +290,46 @@ def propose_priorities(): print "\t\t",new_priority, v new_priority += 5 +# emits the necessary file objects for creator.c, to be used in creating +# the final blender executable +def creator(env): + sources = ['creator.c']# + Blender.buildinfo(env, "dynamic") + Blender.resources + + incs = ['#/intern/guardedalloc', '#/source/blender/blenlib', '#/source/blender/blenkernel', '#/source/blender/editors/include', '#/source/blender/blenloader', '#/source/blender/imbuf', '#/source/blender/renderconverter', '#/source/blender/render/extern/include', '#/source/blender/windowmanager', '#/source/blender/makesdna', '#/source/blender/makesrna', '#/source/gameengine/BlenderRoutines', '#/extern/glew/include', '#/source/blender/gpu', env['BF_OPENGL_INC']] + + defs = [] + if env['WITH_BF_QUICKTIME']: + incs.append(env['BF_QUICKTIME_INC']) + defs.append('WITH_QUICKTIME') + + if env['WITH_BF_BINRELOC']: + incs.append('#/extern/binreloc/include') + defs.append('WITH_BINRELOC') + + if env['WITH_BF_OPENEXR']: + defs.append('WITH_OPENEXR') + + if env['WITH_BF_TIFF']: + defs.append('WITH_TIFF') + + if not env['WITH_BF_SDL']: + defs.append('DISABLE_SDL') + + if env['WITH_BF_PYTHON']: + incs.append('#/source/blender/python') + defs.append('WITH_PYTHON') + if env['BF_DEBUG']: + defs.append('_DEBUG') + + if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc'): + incs.append(env['BF_PTHREADS_INC']) + + env.Append(CPPDEFINES=defs) + env.Append(CPPPATH=incs) + obj = [env.Object(root_build_dir+'source/creator/creator/creator', ['#source/creator/creator.c'])] + + return obj + ## TODO: see if this can be made in an emitter def buildinfo(lenv, build_type): """ @@ -320,7 +367,7 @@ def buildinfo(lenv, build_type): lenv.Append (CPPPATH = [root_build_dir+'source/blender/blenkernel']) - obj = [lenv.Object (root_build_dir+'source/creator/%s_buildinfo'%build_type, [root_build_dir+'source/creator/buildinfo.c'])] + obj = [lenv.Object (root_build_dir+'source/creator/%s_buildinfo'%build_type, ['#source/creator/buildinfo.c'])] return obj @@ -445,10 +492,16 @@ def WinPyBundle(target=None, source=None, env=None): shutil.rmtree(py_target, False, printexception) exclude_re=[re.compile('.*/test/.*'), re.compile('^config/.*'), + re.compile('^config-*/.*'), re.compile('^distutils/.*'), re.compile('^idlelib/.*'), re.compile('^lib2to3/.*'), - re.compile('^tkinter/.*')] + re.compile('^tkinter/.*'), + re.compile('^_tkinter_d.pyd'), + re.compile('^turtledemo'), + re.compile('^turtle.py'), + ] + print "Unpacking '" + py_tar + "' to '" + py_target + "'" untar_pybundle(py_tar,py_target,exclude_re) @@ -508,13 +561,16 @@ def AppIt(target=None, source=None, env=None): cmd = 'mkdir %s/%s.app/Contents/MacOS/%s/python/'%(installdir,binary, VERSION) commands.getoutput(cmd) cmd = 'unzip -q %s/release/%s -d %s/%s.app/Contents/MacOS/%s/python/'%(libdir,python_zip,installdir,binary,VERSION) - commands.getoutput(cmd) - cmd = 'cp -R %s/release/scripts %s/%s.app/Contents/MacOS/%s/'%(bldroot,installdir,binary,VERSION) - commands.getoutput(cmd) - cmd = 'cp -R %s/release/ui %s/%s.app/Contents/MacOS/%s/'%(bldroot,installdir,binary,VERSION) - commands.getoutput(cmd) - cmd = 'cp -R %s/release/io %s/%s.app/Contents/MacOS/%s/'%(bldroot,installdir,binary,VERSION) commands.getoutput(cmd) + + if binary == 'blender':#not copy everything for blenderplayer + cmd = 'cp -R %s/release/scripts %s/%s.app/Contents/MacOS/%s/'%(bldroot,installdir,binary,VERSION) + commands.getoutput(cmd) + cmd = 'cp -R %s/release/ui %s/%s.app/Contents/MacOS/%s/'%(bldroot,installdir,binary,VERSION) + commands.getoutput(cmd) + cmd = 'cp -R %s/release/io %s/%s.app/Contents/MacOS/%s/'%(bldroot,installdir,binary,VERSION) + commands.getoutput(cmd) + cmd = 'chmod +x %s/%s.app/Contents/MacOS/%s'%(installdir,binary, binary) commands.getoutput(cmd) cmd = 'find %s/%s.app -name .svn -prune -exec rm -rf {} \;'%(installdir, binary) @@ -565,17 +621,17 @@ def UnixPyBundle(target=None, source=None, env=None): run("cp -R '%s' '%s'" % (py_src, os.path.dirname(py_target))) run("rm -rf '%s/distutils'" % py_target) run("rm -rf '%s/lib2to3'" % py_target) - run("rm -rf '%s/idlelib'" % py_target) - run("rm -rf '%s/tkinter'" % py_target) run("rm -rf '%s/config'" % py_target) - + run("rm -rf '%s/config-*'" % py_target) run("rm -rf '%s/site-packages'" % py_target) run("mkdir '%s/site-packages'" % py_target) # python needs it.' - + run("rm -rf '%s/idlelib'" % py_target) + run("rm -rf '%s/tkinter'" % py_target) + run("rm -rf '%s/turtledemo'" % py_target) + run("rm -r '%s/turtle.py'" % py_target) run("rm -f '%s/lib-dynload/_tkinter.so'" % py_target) + run("find '%s' -type d -name 'test' -prune -exec rm -rf {} ';'" % py_target) - run("find '%s' -type d -name 'config-*' -prune -exec rm -rf {} ';'" % py_target) - run("find '%s' -type d -name 'turtledemo' -prune -exec rm -rf {} ';'" % py_target) run("find '%s' -type d -name '__pycache__' -exec rm -rf {} ';'" % py_target) run("find '%s' -name '*.py[co]' -exec rm -rf {} ';'" % py_target) run("find '%s' -name '*.so' -exec strip -s {} ';'" % py_target) @@ -704,23 +760,19 @@ class BlenderEnvironment(SConsEnvironment): global vcp print bc.HEADER+'Configuring program '+bc.ENDC+bc.OKGREEN+progname+bc.ENDC lenv = self.Clone() + lenv.Append(LINKFLAGS = lenv['PLATFORM_LINKFLAGS']) if lenv['OURPLATFORM'] in ('win32-vc', 'cygwin', 'win64-vc'): - lenv.Append(LINKFLAGS = lenv['PLATFORM_LINKFLAGS']) - lenv.Append(LINKFLAGS = ['/FORCE:MULTIPLE']) if lenv['BF_DEBUG']: - lenv.Prepend(LINKFLAGS = ['/DEBUG','/PDB:'+progname+'.pdb']) + lenv.Prepend(LINKFLAGS = ['/DEBUG','/PDB:'+progname+'.pdb','/NODEFAULTLIB:libcmt']) if lenv['OURPLATFORM']=='linux2': - lenv.Append(LINKFLAGS = lenv['PLATFORM_LINKFLAGS']) if lenv['WITH_BF_PYTHON']: lenv.Append(LINKFLAGS = lenv['BF_PYTHON_LINKFLAGS']) if lenv['OURPLATFORM']=='sunos5': - lenv.Append(LINKFLAGS = lenv['PLATFORM_LINKFLAGS']) if lenv['WITH_BF_PYTHON']: lenv.Append(LINKFLAGS = lenv['BF_PYTHON_LINKFLAGS']) if lenv['CXX'].endswith('CC'): lenv.Replace(LINK = '$CXX') if lenv['OURPLATFORM']=='darwin': - lenv.Append(LINKFLAGS = lenv['PLATFORM_LINKFLAGS']) if lenv['WITH_BF_PYTHON']: lenv.Append(LINKFLAGS = lenv['BF_PYTHON_LINKFLAGS']) lenv.Append(LINKFLAGS = lenv['BF_OPENGL_LINKFLAGS']) diff --git a/build_files/scons/tools/btools.py b/build_files/scons/tools/btools.py index fcc782bd824..677ddab8db5 100644 --- a/build_files/scons/tools/btools.py +++ b/build_files/scons/tools/btools.py @@ -121,11 +121,11 @@ def validate_arguments(args, bc): 'BF_OPENMP_INC', 'BF_OPENMP_LIBPATH', 'WITH_GHOST_COCOA', + 'WITH_GHOST_SDL', 'USE_QTKIT', 'BF_FANCY', 'BF_QUIET', 'BF_LINE_OVERWRITE', 'BF_X264_CONFIG', 'BF_XVIDCORE_CONFIG', - 'WITH_BF_LCMS', 'BF_LCMS', 'BF_LCMS_INC', 'BF_LCMS_LIB', 'BF_LCMS_LIBPATH', 'WITH_BF_DOCS', 'BF_NUMJOBS', 'BF_MSVS', @@ -134,7 +134,9 @@ def validate_arguments(args, bc): 'WITH_BF_RAYOPTIMIZATION', 'BF_RAYOPTIMIZATION_SSE_FLAGS', 'BF_NO_ELBEEM', - 'WITH_BF_CXX_GUARDEDALLOC' + 'WITH_BF_CXX_GUARDEDALLOC', + 'WITH_BF_JEMALLOC', 'WITH_BF_STATICJEMALLOC', 'BF_JEMALLOC', 'BF_JEMALLOC_INC', 'BF_JEMALLOC_LIBPATH', 'BF_JEMALLOC_LIB', 'BF_JEMALLOC_LIB_STATIC', + 'BUILDBOT_BRANCH' ] # Have options here that scons expects to be lists @@ -333,12 +335,6 @@ def read_opts(env, cfg, args): ('BF_TIFF_LIBPATH', 'TIFF library path', ''), ('BF_TIFF_LIB_STATIC', 'TIFF static library', ''), - (BoolVariable('WITH_BF_LCMS', 'Enable color correction with lcms', False)), - ('BF_LCMS', 'LCMS base path', ''), - ('BF_LCMS_INC', 'LCMS include path', ''), - ('BF_LCMS_LIB', 'LCMS library', ''), - ('BF_LCMS_LIBPATH', 'LCMS library path', ''), - (BoolVariable('WITH_BF_ZLIB', 'Use ZLib if true', True)), (BoolVariable('WITH_BF_STATICZLIB', 'Staticly link to ZLib', False)), ('BF_ZLIB', 'ZLib base path', ''), @@ -390,6 +386,7 @@ def read_opts(env, cfg, args): ('BF_OPENMP_INC', 'Path to OpenMP includes (used when cross-compiling with older versions of WinGW)', ''), ('BF_OPENMP_LIBPATH', 'Path to OpenMP libraries (used when cross-compiling with older versions of WinGW)', ''), (BoolVariable('WITH_GHOST_COCOA', 'Use Cocoa-framework if true', False)), + (BoolVariable('WITH_GHOST_SDL', 'Enable building blender against SDL for windowing rather then the native APIs', False)), (BoolVariable('USE_QTKIT', 'Use QTKIT if true', False)), (BoolVariable('WITH_BF_QUICKTIME', 'Use QuickTime if true', False)), @@ -429,6 +426,14 @@ def read_opts(env, cfg, args): ('BF_EXPAT_LIB', 'Expat library', ''), ('BF_EXPAT_LIBPATH', 'Expat library path', ''), + (BoolVariable('WITH_BF_JEMALLOC', 'Use jemalloc if true', False)), + (BoolVariable('WITH_BF_STATICJEMALLOC', 'Staticly link to jemalloc', False)), + ('BF_JEMALLOC', 'jemalloc base path', ''), + ('BF_JEMALLOC_INC', 'jemalloc include path', ''), + ('BF_JEMALLOC_LIB', 'jemalloc library', ''), + ('BF_JEMALLOC_LIBPATH', 'jemalloc library path', ''), + ('BF_JEMALLOC_LIB_STATIC', 'jemalloc static library', ''), + (BoolVariable('WITH_BF_PLAYER', 'Build blenderplayer if true', False)), (BoolVariable('WITH_BF_NOBLENDER', 'Do not build blender if true', False)), @@ -499,7 +504,9 @@ def read_opts(env, cfg, args): (BoolVariable('WITH_BF_RAYOPTIMIZATION', 'Enable raytracer SSE/SIMD optimization.', False)), ('BF_RAYOPTIMIZATION_SSE_FLAGS', 'SSE flags', ''), - (BoolVariable('WITH_BF_CXX_GUARDEDALLOC', 'Enable GuardedAlloc for C++ memory allocation tracking.', False)) + (BoolVariable('WITH_BF_CXX_GUARDEDALLOC', 'Enable GuardedAlloc for C++ memory allocation tracking.', False)), + + ('BUILDBOT_BRANCH', 'Buildbot branch name', ''), ) # end of opts.AddOptions() return localopts @@ -544,7 +551,7 @@ def buildslave(target=None, source=None, env=None): Builder for buildbot integration. Used by buildslaves of http://builder.blender.org only. """ - if env['OURPLATFORM'] in ('win32-vc', 'win64-vc', 'win32-mingw'): + if env['OURPLATFORM'] in ('win32-vc', 'win64-vc', 'win32-mingw', 'darwin'): extension = '.zip' else: extension = '.tar.bz2' @@ -558,9 +565,15 @@ def buildslave(target=None, source=None, env=None): platform = 'linux-glibc27-x86_64' elif bitness == '32bit': platform = 'linux-glibc27-i686' + if platform == 'darwin': + platform = 'OSX-' + env['MACOSX_ARCHITECTURE'] + + branch = env['BUILDBOT_BRANCH'] outdir = os.path.abspath(env['BF_INSTALLDIR']) package_name = 'blender-' + VERSION+'-'+REVISION + '-' + platform + if branch != '': + package_name = branch + '-' + package_name package_dir = os.path.normpath(outdir + os.sep + '..' + os.sep + package_name) package_archive = os.path.normpath(outdir + os.sep + '..' + os.sep + package_name + extension) @@ -603,9 +616,12 @@ def NSIS_Installer(target=None, source=None, env=None): doneroot = False rootdirconts = [] datafiles = '' + deldatafiles = '' + deldatadirs = '' l = len(bf_installdir) for dp,dn,df in os.walk(bf_installdir): + # install if not doneroot: for f in df: rootdirconts.append(os.path.join(dp,f)) @@ -613,15 +629,22 @@ def NSIS_Installer(target=None, source=None, env=None): else: if len(df)>0: dp_tmp = dp[l:] - if dp_tmp.find('python\\lib') > -1: - datafiles += "\n" +r'SetOutPath $INSTDIR'+dp[l:]+"\n\n" - else: - datafiles += "\n"+r'SetOutPath $BLENDERHOME'+dp[l:]+"\n\n" + datafiles += "\n" +r'SetOutPath $INSTDIR'+dp[l:]+"\n\n" for f in df: outfile = os.path.join(dp,f) datafiles += ' File '+outfile + "\n" + # uninstall + deldir = dp[l+1:] + + if len(deldir)>0: + deldatadirs = "RMDir $INSTDIR\\" + deldir + "\n" + deldatadirs + deldatadirs = "RMDir /r $INSTDIR\\" + deldir + "\\__pycache__\n" + deldatadirs + + for f in df: + deldatafiles += 'Delete \"$INSTDIR\\' + os.path.join(deldir, f) + "\"\n" + #### change to suit install dir #### inst_dir = install_base_dir + env['BF_INSTALLDIR'] @@ -658,6 +681,8 @@ def NSIS_Installer(target=None, source=None, env=None): ns_cnt = string.replace(ns_cnt, "[DELROOTDIRCONTS]", delrootstring) ns_cnt = string.replace(ns_cnt, "[DODATAFILES]", datafiles) + ns_cnt = string.replace(ns_cnt, "[DELDATAFILES]", deldatafiles) + ns_cnt = string.replace(ns_cnt, "[DELDATADIRS]", deldatadirs) tmpnsi = os.path.normpath(install_base_dir+os.sep+env['BF_BUILDDIR']+os.sep+"00.blender_tmp.nsi") new_nsis = open(tmpnsi, 'w') |