Merging r49808 through r49814 from trunk into soc-2011-tomato
authorSergey Sharybin <sergey.vfx@gmail.com>
Sat, 11 Aug 2012 18:25:45 +0000 (18:25 +0000)
committerSergey Sharybin <sergey.vfx@gmail.com>
Sat, 11 Aug 2012 18:25:45 +0000 (18:25 +0000)
1  2 
SConstruct
build_files/cmake/macros.cmake

diff --combined SConstruct
index 4d33eb7d6a5e18167f5d16dfc1796769abdbb96e,7e6bcdf8747b33dfb730a38f594af17141f8b373..517f507ec61275efa40da7491b725e06082083fe
@@@ -455,7 -455,7 +455,7 @@@ if not os.path.isdir ( B.root_build_di
  # use for includes
  env['DATA_HEADERS'] = os.path.join(os.path.abspath(env['BF_BUILDDIR']), "data_headers")
  env['DATA_SOURCES'] = os.path.join(os.path.abspath(env['BF_BUILDDIR']), "data_sources")
- def ensure_data(FILE_FROM, FILE_TO, VAR_NAME):
+ def data_to_c(FILE_FROM, FILE_TO, VAR_NAME):
      if os.sep == "\\":
          FILE_FROM = FILE_FROM.replace("/", "\\")
          FILE_TO   = FILE_TO.replace("/", "\\")
      fpin.close()
      fpout.close()
  
- ensure_data("source/blender/compositor/operations/COM_OpenCLKernels.cl",
-             B.root_build_dir + "data_headers/COM_OpenCLKernels.cl.h",
-             "clkernelstoh_COM_OpenCLKernels_cl")
+ def data_to_c_simple(FILE_FROM):
+       filename_only = os.path.basename(FILE_FROM)
+       FILE_TO = os.path.join(env['DATA_SOURCES'], filename_only + ".c")
+       VAR_NAME = "datatoc_" + filename_only.replace(".", "_")
+       
+       data_to_c(FILE_FROM, FILE_TO, VAR_NAME)
+       
  
ensure_data("./release/datafiles/startup.blend",
-             B.root_build_dir + "data_sources/startup.blend.c",
-             "datatoc_startup_blend")
data_to_c("source/blender/compositor/operations/COM_OpenCLKernels.cl",
+           B.root_build_dir + "data_headers/COM_OpenCLKernels.cl.h",
+           "datatoc_COM_OpenCLKernels_cl")
  
- ensure_data("./release/datafiles/preview.blend",
-             B.root_build_dir + "data_sources/preview.blend.c",
-             "datatoc_preview_blend")
+ data_to_c_simple("release/datafiles/startup.blend")
+ data_to_c_simple("release/datafiles/preview.blend")
  
  # --- glsl ---
- ensure_data("source/blender/gpu/shaders/gpu_shader_material.glsl",
-             B.root_build_dir + "data_sources/gpu_shader_material.glsl.c",
-             "datatoc_gpu_shader_material_glsl")
- ensure_data("source/blender/gpu/shaders/gpu_shader_vertex.glsl",
-             B.root_build_dir + "data_sources/gpu_shader_vertex.glsl.c",
-             "datatoc_gpu_shader_vertex_glsl")
- ensure_data("source/blender/gpu/shaders/gpu_shader_sep_gaussian_blur_frag.glsl",
-             B.root_build_dir + "data_sources/gpu_shader_sep_gaussian_blur_frag.glsl.c",
-             "datatoc_gpu_shader_sep_gaussian_blur_frag_glsl")
- ensure_data("source/blender/gpu/shaders/gpu_shader_sep_gaussian_blur_vert.glsl",
-             B.root_build_dir + "data_sources/gpu_shader_sep_gaussian_blur_vert.glsl.c",
-             "datatoc_gpu_shader_sep_gaussian_blur_vert_glsl")
- ensure_data("source/blender/gpu/shaders/gpu_shader_material.glsl",
-             B.root_build_dir + "data_sources/gpu_shader_material.glsl.c",
-             "datatoc_gpu_shader_material_glsl")
- ensure_data("source/blender/gpu/shaders/gpu_shader_vsm_store_frag.glsl",
-             B.root_build_dir + "data_sources/gpu_shader_vsm_store_frag.glsl.c",
-             "datatoc_gpu_shader_vsm_store_frag_glsl")
- ensure_data("source/blender/gpu/shaders/gpu_shader_vsm_store_vert.glsl",
-             B.root_build_dir + "data_sources/gpu_shader_vsm_store_vert.glsl.c",
-             "datatoc_gpu_shader_vsm_store_vert_glsl")
+ data_to_c_simple("source/blender/gpu/shaders/gpu_shader_material.glsl")
+ data_to_c_simple("source/blender/gpu/shaders/gpu_shader_vertex.glsl")
+ data_to_c_simple("source/blender/gpu/shaders/gpu_shader_sep_gaussian_blur_frag.glsl")
+ data_to_c_simple("source/blender/gpu/shaders/gpu_shader_sep_gaussian_blur_vert.glsl")
+ data_to_c_simple("source/blender/gpu/shaders/gpu_shader_material.glsl")
+ data_to_c_simple("source/blender/gpu/shaders/gpu_shader_vsm_store_frag.glsl")
+ data_to_c_simple("source/blender/gpu/shaders/gpu_shader_vsm_store_vert.glsl")
+ # --- blender ---
+ data_to_c_simple("release/datafiles/bfont.pfb")
+ data_to_c_simple("release/datafiles/bfont.ttf")
+ data_to_c_simple("release/datafiles/bmonofont.ttf")
+ data_to_c_simple("release/datafiles/splash.png")
+ data_to_c_simple("release/datafiles/blender_icons.png")
+ data_to_c_simple("release/datafiles/prvicons.png")
+ data_to_c_simple("release/datafiles/brushicons/add.png")
+ data_to_c_simple("release/datafiles/brushicons/blob.png")
+ data_to_c_simple("release/datafiles/brushicons/blur.png")
+ data_to_c_simple("release/datafiles/brushicons/clay.png")
+ data_to_c_simple("release/datafiles/brushicons/claystrips.png")
+ data_to_c_simple("release/datafiles/brushicons/clone.png")
+ data_to_c_simple("release/datafiles/brushicons/crease.png")
+ data_to_c_simple("release/datafiles/brushicons/darken.png")
+ data_to_c_simple("release/datafiles/brushicons/draw.png")
+ data_to_c_simple("release/datafiles/brushicons/fill.png")
+ data_to_c_simple("release/datafiles/brushicons/flatten.png")
+ data_to_c_simple("release/datafiles/brushicons/grab.png")
+ data_to_c_simple("release/datafiles/brushicons/inflate.png")
+ data_to_c_simple("release/datafiles/brushicons/layer.png")
+ data_to_c_simple("release/datafiles/brushicons/lighten.png")
+ data_to_c_simple("release/datafiles/brushicons/mask.png")
+ data_to_c_simple("release/datafiles/brushicons/mix.png")
+ data_to_c_simple("release/datafiles/brushicons/multiply.png")
+ data_to_c_simple("release/datafiles/brushicons/nudge.png")
+ data_to_c_simple("release/datafiles/brushicons/pinch.png")
+ data_to_c_simple("release/datafiles/brushicons/scrape.png")
+ data_to_c_simple("release/datafiles/brushicons/smear.png")
+ data_to_c_simple("release/datafiles/brushicons/smooth.png")
+ data_to_c_simple("release/datafiles/brushicons/snake_hook.png")
+ data_to_c_simple("release/datafiles/brushicons/soften.png")
+ data_to_c_simple("release/datafiles/brushicons/subtract.png")
+ data_to_c_simple("release/datafiles/brushicons/texdraw.png")
+ data_to_c_simple("release/datafiles/brushicons/thumb.png")
+ data_to_c_simple("release/datafiles/brushicons/twist.png")
+ data_to_c_simple("release/datafiles/brushicons/vertexdraw.png")
  
  ##### END DATAFILES ##########
  
@@@ -692,26 -719,6 +719,26 @@@ if env['OURPLATFORM']!='darwin'
                      cubin_file = os.path.join(kernel_build_dir, "kernel_%s.cubin" % arch)
                      scriptinstall.append(env.Install(dir=dir,source=cubin_file))
  
 +    if env['WITH_BF_OCIO']:
 +        colormanagement = os.path.join('release', 'datafiles', 'colormanagement')
 +
 +        for dp, dn, df in os.walk(colormanagement):
 +            if '.svn' in dn:
 +                dn.remove('.svn')
 +            if '_svn' in dn:
 +                dn.remove('_svn')
 +
 +            dir = os.path.join(env['BF_INSTALLDIR'], VERSION, 'datafiles')
 +            dir += os.sep + os.path.basename(colormanagement) + dp[len(colormanagement):]
 +
 +            source = [os.path.join(dp, f) for f in df if not f.endswith(".pyc")]
 +
 +            # To ensure empty dirs are created too
 +            if len(source) == 0:
 +                env.Execute(Mkdir(dir))
 +
 +            scriptinstall.append(env.Install(dir=dir,source=source))
 +
      if env['WITH_BF_INTERNATIONAL']:
          internationalpaths=['release' + os.sep + 'datafiles']
  
@@@ -844,9 -851,6 +871,9 @@@ if env['OURPLATFORM'] in ('win32-vc', '
      if env['WITH_BF_OIIO'] and env['OURPLATFORM'] != 'win32-mingw':
          dllsources.append('${LCGDIR}/openimageio/bin/OpenImageIO.dll')
  
 +    if env['WITH_BF_OCIO'] and env['OURPLATFORM'] != 'win32-mingw':
 +        dllsources.append('${LCGDIR}/opencolorio/bin/OpenColorIO.dll')
 +
      dllsources.append('#source/icons/blender.exe.manifest')
  
      windlls = env.Install(dir=env['BF_INSTALLDIR'], source = dllsources)
index 959107d684bc1762c86188fccbf686fce5ad098c,3d2d19c7685a8ac93e9654df045bd717a691fc8a..88dd64640b6346c35beab5ebe3e22488f54e24f5
@@@ -212,9 -212,6 +212,9 @@@ macro(SETUP_LIBDIRS
        if(WITH_OPENIMAGEIO)
                link_directories(${OPENIMAGEIO_LIBPATH})
        endif()
 +      if(WITH_OPENCOLORIO)
 +              link_directories(${OPENCOLORIO_LIBPATH})
 +      endif()
        if(WITH_IMAGE_OPENJPEG AND WITH_SYSTEM_OPENJPEG)
                link_directories(${OPENJPEG_LIBPATH})
        endif()
@@@ -310,9 -307,6 +310,9 @@@ macro(setup_liblink
        if(WITH_OPENIMAGEIO)
                target_link_libraries(${target} ${OPENIMAGEIO_LIBRARIES})
        endif()
 +      if(WITH_OPENCOLORIO)
 +              target_link_libraries(${target} ${OPENCOLORIO_LIBRARIES})
 +      endif()
        if(WITH_BOOST)
                target_link_libraries(${target} ${BOOST_LIBRARIES})
        endif()
@@@ -735,19 -729,21 +735,21 @@@ endmacro(
  
  # TODO, create a C binary and call it instead!, doing this in cmake its slow
  macro(data_to_c
-       file_from file_to var_name
+       file_from file_to
        list_to_add)
  
        list(APPEND ${list_to_add} ${file_to})
  
+       get_filename_component(_file_to_path ${file_to} PATH)
        add_custom_command(
                OUTPUT ${file_to}
-               COMMAND ${CMAKE_COMMAND}
-                               -DFILE_FROM=${file_from}
-                               -DFILE_TO=${file_to}
-                               -DVAR_NAME=${var_name}
-                               -P ${CMAKE_SOURCE_DIR}/build_files/cmake/data_to_c.cmake
+               COMMAND ${CMAKE_COMMAND} -E make_directory ${_file_to_path}
+               COMMAND ${CMAKE_BINARY_DIR}/bin/${CMAKE_CFG_INTDIR}/datatoc
+                       ${file_from}
+                       ${file_to}
                DEPENDS ${file_from})
+       unset(_file_to_path)
  endmacro()
  
  # same as above but generates the var name and output automatic.
@@@ -755,26 -751,22 +757,22 @@@ macro(data_to_c_simpl
        file_from
        list_to_add)
  
-     # get var name automatic from name
-     get_filename_component(_file_from_only ${file_from} NAME)
-     string(REPLACE "." "_" _file_from_only ${_file_from_only})
-     set(_var_name "datatoc_${_file_from_only}")
-     # only to avoid confusion
-     set(_file_to ${file_from}.c)
+       # only to avoid confusion
+       set(_file_to ${file_from}.c)
  
        list(APPEND ${list_to_add} ${CMAKE_CURRENT_BINARY_DIR}/${_file_to})
  
+       get_filename_component(_file_to_path ${_file_to} PATH)
        add_custom_command(
                OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${_file_to}
-               COMMAND ${CMAKE_COMMAND}
-                               -DFILE_FROM=${CMAKE_CURRENT_SOURCE_DIR}/${file_from}
-                               -DFILE_TO=${CMAKE_CURRENT_BINARY_DIR}/${_file_to}
-                               -DVAR_NAME=${_var_name}
-                               -P ${CMAKE_SOURCE_DIR}/build_files/cmake/data_to_c.cmake
+               COMMAND ${CMAKE_COMMAND} -E make_directory ${_file_to_path}
+               COMMAND ${CMAKE_BINARY_DIR}/bin/${CMAKE_CFG_INTDIR}/datatoc
+                       ${CMAKE_CURRENT_SOURCE_DIR}/${file_from}
+                       ${CMAKE_CURRENT_BINARY_DIR}/${_file_to}
                DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${file_from})
  
-     unset(_file_from_only)
-     unset(_var_name)
-     unset(_file_to)
+       unset(_var_name)
+       unset(_file_to)
+       unset(_file_to_path)
  endmacro()