startup.blend and preview.blend are now converted to C at build time.

made some changes to startup.c
- change default player to internal since its working now.
- added new screen for full screen 3d viewport (nice for demo's and navigating)
- disable cursor depth option (was enabled by default because of re-used flag)
This commit is contained in:
Campbell Barton 2012-08-11 12:26:43 +00:00
parent 51182bc78d
commit 5f341a846b
9 changed files with 51 additions and 29899 deletions

@ -450,8 +450,11 @@ if not os.path.isdir ( B.root_build_dir):
###################################
if not os.path.isdir ( B.root_build_dir + 'data_headers'):
os.makedirs ( B.root_build_dir + 'data_headers' )
if not os.path.isdir ( B.root_build_dir + 'data_sources'):
os.makedirs ( B.root_build_dir + 'data_sources' )
# 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):
if os.sep == "\\":
FILE_FROM = FILE_FROM.replace("/", "\\")
@ -487,6 +490,14 @@ ensure_data("source/blender/compositor/operations/COM_OpenCLKernels.cl",
B.root_build_dir + "data_headers/COM_OpenCLKernels.cl.h",
"clkernelstoh_COM_OpenCLKernels_cl")
ensure_data("./release/datafiles/startup.blend",
B.root_build_dir + "data_sources/startup.blend.c",
"datatoc_startup_blend")
ensure_data("./release/datafiles/preview.blend",
B.root_build_dir + "data_sources/preview.blend.c",
"datatoc_preview_blend")
##### END DATAFILES ##########
Help(opts.GenerateHelpText(env))

@ -638,7 +638,7 @@ macro(blender_project_hack_post)
# --------------
# MINGW HACK END
if (_reset_standard_libraries)
# Must come after project(...)
# Must come after projecINCt(...)
#
# MINGW workaround for -ladvapi32 being included which surprisingly causes
# string formatting of floats, eg: printf("%.*f", 3, value). to crash blender
@ -727,29 +727,20 @@ macro(set_lib_path
endmacro()
# not highly optimal, may replace with generated C program like makesdna
function(data_to_c
file_from file_to var_name)
# 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
list_to_add)
file(READ ${file_from} file_from_string HEX)
string(LENGTH ${file_from_string} _max_index)
math(EXPR size_on_disk ${_max_index}/2)
list(APPEND ${list_to_add} ${file_to})
file(REMOVE ${file_to})
file(APPEND ${file_to} "int ${var_name}_size = ${size_on_disk};\n")
file(APPEND ${file_to} "char ${var_name}[] = {")
set(_index 0)
while(NOT _index EQUAL _max_index)
string(SUBSTRING "${file_from_string}" ${_index} 2 _pair)
file(APPEND ${file_to} "0x${_pair},")
math(EXPR _index ${_index}+2)
endwhile()
file(APPEND ${file_to} "};\n")
endfunction()
# eg
# data_to_c("/home/guest/test.txt" "/home/guest/test.txt.h" "this_is_data")
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
DEPENDS ${file_from})
endmacro()

Binary file not shown.

Binary file not shown.

@ -50,21 +50,6 @@ set(INC_SYS
)
# --- data file ---
# ... may make this a macro
list(APPEND INC
${CMAKE_CURRENT_BINARY_DIR}/operations
)
add_custom_command(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/operations/COM_OpenCLKernels.cl.h
COMMAND ${CMAKE_COMMAND}
-DFILE_FROM=${CMAKE_CURRENT_SOURCE_DIR}/operations/COM_OpenCLKernels.cl
-DFILE_TO=${CMAKE_CURRENT_BINARY_DIR}/operations/COM_OpenCLKernels.cl.h
-DVAR_NAME=clkernelstoh_COM_OpenCLKernels_cl
-P ${CMAKE_SOURCE_DIR}/build_files/cmake/data_to_c.cmake
DEPENDS operations/COM_OpenCLKernels.cl)
# --- end data file --
set(SRC
COM_compositor.h
COM_defines.h
@ -653,9 +638,13 @@ set(SRC
operations/COM_MaskOperation.cpp
operations/COM_MaskOperation.h
# generated file
${CMAKE_CURRENT_BINARY_DIR}/operations/COM_OpenCLKernels.cl.h
)
list(APPEND INC
${CMAKE_CURRENT_BINARY_DIR}/operations
)
data_to_c(${CMAKE_CURRENT_SOURCE_DIR}/operations/COM_OpenCLKernels.cl
${CMAKE_CURRENT_BINARY_DIR}/operations/COM_OpenCLKernels.cl.h
clkernelstoh_COM_OpenCLKernels_cl SRC)
blender_add_lib(bf_compositor "${SRC}" "${INC}" "${INC_SYS}")

@ -35,16 +35,13 @@ set(SRC
if(WITH_BLENDER)
# blender only
list(APPEND SRC
startup.blend.c
# startup.blend.c
bmonofont.ttf.c
)
if(NOT WITH_HEADLESS)
# blender UI only
list(APPEND SRC
# blends
preview.blend.c
# images
splash.png.c
blender_icons.png.c
@ -82,7 +79,17 @@ if(WITH_BLENDER)
twist.png.c
vertexdraw.png.c
)
data_to_c(${CMAKE_SOURCE_DIR}/release/datafiles/preview.blend
${CMAKE_CURRENT_BINARY_DIR}/preview.blend.c
datatoc_preview_blend SRC)
endif()
data_to_c(${CMAKE_SOURCE_DIR}/release/datafiles/startup.blend
${CMAKE_CURRENT_BINARY_DIR}/startup.blend.c
datatoc_startup_blend SRC)
endif()
blender_add_lib(bf_editor_datafiles "${SRC}" "${INC}" "${INC_SYS}")

@ -6,4 +6,11 @@ sources = env.Glob('*.c')
incs = '../include ../../blenlib ../../blenkernel ../../makesdna ../../imbuf'
incs += ' ../../bmesh #/intern/guardedalloc'
# generated data files
import os
sources.extend((
os.path.join(env['DATA_SOURCES'], "startup.blend.c"),
os.path.join(env['DATA_SOURCES'], "preview.blend.c"),
))
env.BlenderLib ( 'bf_editor_datafiles', sources, Split(incs), [], libtype=['core', 'player'], priority=[235, 30] )

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff