Compare commits
1 Commits
benchmark
...
tmp-Collec
Author | SHA1 | Date | |
---|---|---|---|
d1e3ba22a0 |
@@ -1,44 +0,0 @@
|
|||||||
# C/C++
|
|
||||||
[*.{c,cc,h,hh,inl,glsl}]
|
|
||||||
charset = utf-8
|
|
||||||
trim_trailing_whitespace = true
|
|
||||||
insert_final_newline = true
|
|
||||||
indent_style = tab
|
|
||||||
indent_size = 4
|
|
||||||
max_line_length = 120
|
|
||||||
|
|
||||||
# CMake & Text
|
|
||||||
[*.{cmake,txt}]
|
|
||||||
charset = utf-8
|
|
||||||
trim_trailing_whitespace = true
|
|
||||||
insert_final_newline = true
|
|
||||||
indent_style = tab
|
|
||||||
indent_size = 4
|
|
||||||
max_line_length = 120
|
|
||||||
|
|
||||||
# Python
|
|
||||||
[*.py]
|
|
||||||
charset = utf-8
|
|
||||||
trim_trailing_whitespace = true
|
|
||||||
insert_final_newline = true
|
|
||||||
indent_style = space
|
|
||||||
indent_size = 4
|
|
||||||
max_line_length = 120
|
|
||||||
|
|
||||||
# Shell
|
|
||||||
[*.sh]
|
|
||||||
charset = utf-8
|
|
||||||
trim_trailing_whitespace = true
|
|
||||||
insert_final_newline = true
|
|
||||||
indent_style = tab
|
|
||||||
indent_size = 4
|
|
||||||
max_line_length = 120
|
|
||||||
|
|
||||||
# reStructuredText
|
|
||||||
[*.rst]
|
|
||||||
charset = utf-8
|
|
||||||
trim_trailing_whitespace = true
|
|
||||||
insert_final_newline = true
|
|
||||||
indent_style = space
|
|
||||||
indent_size = 3
|
|
||||||
max_line_length = 120
|
|
3
.gitmodules
vendored
3
.gitmodules
vendored
@@ -18,6 +18,3 @@
|
|||||||
url = ../blender-dev-tools.git
|
url = ../blender-dev-tools.git
|
||||||
branch = master
|
branch = master
|
||||||
ignore = all
|
ignore = all
|
||||||
[submodule "release/scripts/benchmark"]
|
|
||||||
path = release/scripts/benchmark
|
|
||||||
url = ../blender-benchmark-bundle.git
|
|
||||||
|
208
CMakeLists.txt
208
CMakeLists.txt
@@ -62,11 +62,6 @@ if(NOT DEFINED CMAKE_BUILD_TYPE_INIT)
|
|||||||
set(CMAKE_BUILD_TYPE_INIT "Release")
|
set(CMAKE_BUILD_TYPE_INIT "Release")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Omit superfluous "Up-to-date" messages.
|
|
||||||
if(NOT DEFINED CMAKE_INSTALL_MESSAGE)
|
|
||||||
set(CMAKE_INSTALL_MESSAGE "LAZY")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# quiet output for Makefiles, 'make -s' helps too
|
# quiet output for Makefiles, 'make -s' helps too
|
||||||
# set_property(GLOBAL PROPERTY RULE_MESSAGES OFF)
|
# set_property(GLOBAL PROPERTY RULE_MESSAGES OFF)
|
||||||
|
|
||||||
@@ -201,7 +196,7 @@ mark_as_advanced(WITH_BLENDER)
|
|||||||
option(WITH_INTERNATIONAL "Enable I18N (International fonts and text)" ON)
|
option(WITH_INTERNATIONAL "Enable I18N (International fonts and text)" ON)
|
||||||
|
|
||||||
option(WITH_PYTHON "Enable Embedded Python API (only disable for development)" ON)
|
option(WITH_PYTHON "Enable Embedded Python API (only disable for development)" ON)
|
||||||
option(WITH_PYTHON_SECURITY "Disables execution of scripts within blend files by default" ON)
|
option(WITH_PYTHON_SECURITY "Disables execution of scripts within blend files by default" ON)
|
||||||
mark_as_advanced(WITH_PYTHON) # dont want people disabling this unless they really know what they are doing.
|
mark_as_advanced(WITH_PYTHON) # dont want people disabling this unless they really know what they are doing.
|
||||||
mark_as_advanced(WITH_PYTHON_SECURITY) # some distributions see this as a security issue, rather than have them patch it, make a build option.
|
mark_as_advanced(WITH_PYTHON_SECURITY) # some distributions see this as a security issue, rather than have them patch it, make a build option.
|
||||||
|
|
||||||
@@ -232,6 +227,8 @@ option(WITH_SYSTEM_BULLET "Use the systems bullet library (currently unsupported
|
|||||||
mark_as_advanced(WITH_SYSTEM_BULLET)
|
mark_as_advanced(WITH_SYSTEM_BULLET)
|
||||||
option(WITH_OPENCOLORIO "Enable OpenColorIO color management" ${_init_OPENCOLORIO})
|
option(WITH_OPENCOLORIO "Enable OpenColorIO color management" ${_init_OPENCOLORIO})
|
||||||
|
|
||||||
|
option(WITH_CLAY_ENGINE "Enable Clay engine" ON)
|
||||||
|
|
||||||
# Compositor
|
# Compositor
|
||||||
option(WITH_COMPOSITOR "Enable the tile based nodal compositor" ON)
|
option(WITH_COMPOSITOR "Enable the tile based nodal compositor" ON)
|
||||||
|
|
||||||
@@ -444,7 +441,7 @@ mark_as_advanced(WITH_MEM_VALGRIND)
|
|||||||
option(WITH_CXX_GUARDEDALLOC "Enable GuardedAlloc for C++ memory allocation tracking (only enable for development)" OFF)
|
option(WITH_CXX_GUARDEDALLOC "Enable GuardedAlloc for C++ memory allocation tracking (only enable for development)" OFF)
|
||||||
mark_as_advanced(WITH_CXX_GUARDEDALLOC)
|
mark_as_advanced(WITH_CXX_GUARDEDALLOC)
|
||||||
|
|
||||||
option(WITH_ASSERT_ABORT "Call abort() when raising an assertion through BLI_assert()" ON)
|
option(WITH_ASSERT_ABORT "Call abort() when raising an assertion through BLI_assert()" OFF)
|
||||||
mark_as_advanced(WITH_ASSERT_ABORT)
|
mark_as_advanced(WITH_ASSERT_ABORT)
|
||||||
|
|
||||||
option(WITH_BOOST "Enable features depending on boost" ON)
|
option(WITH_BOOST "Enable features depending on boost" ON)
|
||||||
@@ -463,13 +460,11 @@ endif()
|
|||||||
|
|
||||||
# OpenGL
|
# OpenGL
|
||||||
|
|
||||||
option(WITH_OPENGL "When off limits visibility of the opengl headers to just bf_gpu and gawain (temporary option for development purposes)" ON)
|
|
||||||
option(WITH_GLEW_ES "Switches to experimental copy of GLEW that has support for OpenGL ES. (temporary option for development purposes)" OFF)
|
option(WITH_GLEW_ES "Switches to experimental copy of GLEW that has support for OpenGL ES. (temporary option for development purposes)" OFF)
|
||||||
option(WITH_GL_EGL "Use the EGL OpenGL system library instead of the platform specific OpenGL system library (CGL, glX, or WGL)" OFF)
|
option(WITH_GL_EGL "Use the EGL OpenGL system library instead of the platform specific OpenGL system library (CGL, glX, or WGL)" OFF)
|
||||||
option(WITH_GL_PROFILE_ES20 "Support using OpenGL ES 2.0. (thru either EGL or the AGL/WGL/XGL 'es20' profile)" OFF)
|
option(WITH_GL_PROFILE_ES20 "Support using OpenGL ES 2.0. (thru either EGL or the AGL/WGL/XGL 'es20' profile)" OFF)
|
||||||
|
|
||||||
mark_as_advanced(
|
mark_as_advanced(
|
||||||
WITH_OPENGL
|
|
||||||
WITH_GLEW_ES
|
WITH_GLEW_ES
|
||||||
WITH_GL_EGL
|
WITH_GL_EGL
|
||||||
WITH_GL_PROFILE_ES20
|
WITH_GL_PROFILE_ES20
|
||||||
@@ -490,6 +485,26 @@ if(WIN32)
|
|||||||
set(CPACK_INSTALL_PREFIX ${CMAKE_GENERIC_PROGRAM_FILES}/${})
|
set(CPACK_INSTALL_PREFIX ${CMAKE_GENERIC_PROGRAM_FILES}/${})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
# Experimental support of C11 and C++11
|
||||||
|
#
|
||||||
|
# We default options to whatever default standard in the current compiler.
|
||||||
|
if(APPLE)
|
||||||
|
set(_c11_init ON)
|
||||||
|
set(_cxx11_init ON)
|
||||||
|
set(WITH_C11 ON)
|
||||||
|
set(WITH_CXX11 ON)
|
||||||
|
elseif(CMAKE_COMPILER_IS_GNUCC AND (NOT "${CMAKE_C_COMPILER_VERSION}" VERSION_LESS "6.0") AND (NOT WITH_CXX11))
|
||||||
|
set(_c11_init ON)
|
||||||
|
else()
|
||||||
|
set(_c11_init OFF)
|
||||||
|
endif()
|
||||||
|
set(_cxx11_init ON)
|
||||||
|
|
||||||
|
option(WITH_C11 "Build with C11 standard enabled, for development use only!" ${_c11_init})
|
||||||
|
mark_as_advanced(WITH_C11)
|
||||||
|
option(WITH_CXX11 "Build with C++11 standard enabled, for development use only!" ${_cxx11_init})
|
||||||
|
mark_as_advanced(WITH_CXX11)
|
||||||
|
|
||||||
# Compiler toolchain
|
# Compiler toolchain
|
||||||
if(CMAKE_COMPILER_IS_GNUCC)
|
if(CMAKE_COMPILER_IS_GNUCC)
|
||||||
option(WITH_LINKER_GOLD "Use ld.gold linker which is usually faster than ld.bfd" ON)
|
option(WITH_LINKER_GOLD "Use ld.gold linker which is usually faster than ld.bfd" ON)
|
||||||
@@ -530,11 +545,10 @@ if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID MATCHES "Clang")
|
|||||||
find_library(COMPILER_ASAN_LIBRARY asan ${CMAKE_C_IMPLICIT_LINK_DIRECTORIES})
|
find_library(COMPILER_ASAN_LIBRARY asan ${CMAKE_C_IMPLICIT_LINK_DIRECTORIES})
|
||||||
else()
|
else()
|
||||||
find_library( COMPILER_ASAN_LIBRARY NAMES clang_rt.asan-x86_64
|
find_library( COMPILER_ASAN_LIBRARY NAMES clang_rt.asan-x86_64
|
||||||
PATHS
|
PATHS [HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\LLVM\\LLVM;]/lib/clang/7.0.0/lib/windows
|
||||||
[HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\LLVM\\LLVM;]/lib/clang/7.0.0/lib/windows
|
[HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\LLVM\\LLVM;]/lib/clang/6.0.0/lib/windows
|
||||||
[HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\LLVM\\LLVM;]/lib/clang/6.0.0/lib/windows
|
)
|
||||||
)
|
endif()
|
||||||
endif()
|
|
||||||
mark_as_advanced(COMPILER_ASAN_LIBRARY)
|
mark_as_advanced(COMPILER_ASAN_LIBRARY)
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
@@ -601,14 +615,18 @@ if(NOT WITH_BLENDER AND NOT WITH_CYCLES_STANDALONE)
|
|||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if(NOT WITH_CXX11)
|
||||||
|
if(WITH_AUDASPACE AND NOT WITH_SYSTEM_AUDASPACE)
|
||||||
|
message(FATAL_ERROR "WITH_AUDASPACE requires WITH_CXX11")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
if(NOT WITH_AUDASPACE)
|
if(NOT WITH_AUDASPACE)
|
||||||
if(WITH_OPENAL)
|
if(WITH_OPENAL)
|
||||||
message(WARNING "WITH_OPENAL requires WITH_AUDASPACE which is disabled")
|
message(FATAL_ERROR "WITH_OPENAL requires WITH_AUDASPACE")
|
||||||
set(WITH_OPENAL OFF)
|
|
||||||
endif()
|
endif()
|
||||||
if(WITH_JACK)
|
if(WITH_JACK)
|
||||||
message(WARNING "WITH_JACK requires WITH_AUDASPACE which is disabled")
|
message(FATAL_ERROR "WITH_JACK requires WITH_AUDASPACE")
|
||||||
set(WITH_JACK OFF)
|
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
@@ -651,8 +669,11 @@ elseif(WITH_CYCLES OR WITH_OPENIMAGEIO OR WITH_INTERNATIONAL OR
|
|||||||
WITH_OPENVDB OR WITH_OPENCOLORIO)
|
WITH_OPENVDB OR WITH_OPENCOLORIO)
|
||||||
# Keep enabled
|
# Keep enabled
|
||||||
else()
|
else()
|
||||||
# Disable boost if not needed.
|
# New dependency graph needs either Boost or C++11 for function bindings.
|
||||||
set(WITH_BOOST OFF)
|
if(NOT WITH_CXX11)
|
||||||
|
# Enabled but we don't need it
|
||||||
|
set(WITH_BOOST OFF)
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# auto enable openimageio for cycles
|
# auto enable openimageio for cycles
|
||||||
@@ -709,6 +730,9 @@ if(WITH_BUILDINFO)
|
|||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
TEST_SHARED_PTR_SUPPORT()
|
||||||
|
TEST_UNORDERED_MAP_SUPPORT()
|
||||||
|
|
||||||
if(WITH_AUDASPACE)
|
if(WITH_AUDASPACE)
|
||||||
if(NOT WITH_SYSTEM_AUDASPACE)
|
if(NOT WITH_SYSTEM_AUDASPACE)
|
||||||
set(AUDASPACE_C_INCLUDE_DIRS "${CMAKE_SOURCE_DIR}/extern/audaspace/bindings/C" "${CMAKE_BINARY_DIR}/extern/audaspace")
|
set(AUDASPACE_C_INCLUDE_DIRS "${CMAKE_SOURCE_DIR}/extern/audaspace/bindings/C" "${CMAKE_BINARY_DIR}/extern/audaspace")
|
||||||
@@ -781,8 +805,7 @@ set(C_WARNINGS)
|
|||||||
set(CXX_WARNINGS)
|
set(CXX_WARNINGS)
|
||||||
|
|
||||||
# for gcc -Wno-blah-blah
|
# for gcc -Wno-blah-blah
|
||||||
set(C_REMOVE_STRICT_FLAGS)
|
set(CC_REMOVE_STRICT_FLAGS)
|
||||||
set(CXX_REMOVE_STRICT_FLAGS)
|
|
||||||
|
|
||||||
# libraries to link the binary with passed to target_link_libraries()
|
# libraries to link the binary with passed to target_link_libraries()
|
||||||
# known as LLIBS to scons
|
# known as LLIBS to scons
|
||||||
@@ -794,20 +817,18 @@ set(PLATFORM_LINKLIBS "")
|
|||||||
set(PLATFORM_LINKFLAGS "")
|
set(PLATFORM_LINKFLAGS "")
|
||||||
set(PLATFORM_LINKFLAGS_DEBUG "")
|
set(PLATFORM_LINKFLAGS_DEBUG "")
|
||||||
|
|
||||||
if (NOT CMAKE_BUILD_TYPE MATCHES "Release")
|
if(WITH_COMPILER_ASAN)
|
||||||
if(WITH_COMPILER_ASAN)
|
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} ${COMPILER_ASAN_CFLAGS}")
|
||||||
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} ${COMPILER_ASAN_CFLAGS}")
|
set(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO} ${COMPILER_ASAN_CFLAGS}")
|
||||||
set(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO} ${COMPILER_ASAN_CFLAGS}")
|
|
||||||
|
|
||||||
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} ${COMPILER_ASAN_CXXFLAGS}")
|
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} ${COMPILER_ASAN_CXXFLAGS}")
|
||||||
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} ${COMPILER_ASAN_CXXFLAGS}")
|
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} ${COMPILER_ASAN_CXXFLAGS}")
|
||||||
if(MSVC)
|
if(MSVC)
|
||||||
set(COMPILER_ASAN_LINKER_FLAGS "/FUNCTIONPADMIN:6")
|
set(COMPILER_ASAN_LINKER_FLAGS "/FUNCTIONPADMIN:6")
|
||||||
endif()
|
|
||||||
set(PLATFORM_LINKLIBS "${PLATFORM_LINKLIBS};${COMPILER_ASAN_LIBRARY}")
|
|
||||||
set(PLATFORM_LINKFLAGS "${COMPILER_ASAN_LIBRARY} ${COMPILER_ASAN_LINKER_FLAGS}")
|
|
||||||
set(PLATFORM_LINKFLAGS_DEBUG "${COMPILER_ASAN_LIBRARY} ${COMPILER_ASAN_LINKER_FLAGS}")
|
|
||||||
endif()
|
endif()
|
||||||
|
set(PLATFORM_LINKLIBS "${PLATFORM_LINKLIBS};${COMPILER_ASAN_LIBRARY}")
|
||||||
|
set(PLATFORM_LINKFLAGS "${COMPILER_ASAN_LIBRARY} ${COMPILER_ASAN_LINKER_FLAGS}")
|
||||||
|
set(PLATFORM_LINKFLAGS_DEBUG "${COMPILER_ASAN_LIBRARY} ${COMPILER_ASAN_LINKER_FLAGS}")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
#-----------------------------------------------------------------------------
|
#-----------------------------------------------------------------------------
|
||||||
@@ -981,10 +1002,6 @@ endif()
|
|||||||
find_package(OpenGL)
|
find_package(OpenGL)
|
||||||
blender_include_dirs_sys("${OPENGL_INCLUDE_DIR}")
|
blender_include_dirs_sys("${OPENGL_INCLUDE_DIR}")
|
||||||
|
|
||||||
if(WITH_OPENGL)
|
|
||||||
add_definitions(-DWITH_OPENGL)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(WITH_SYSTEM_GLES)
|
if(WITH_SYSTEM_GLES)
|
||||||
find_package_wrapper(OpenGLES)
|
find_package_wrapper(OpenGLES)
|
||||||
endif()
|
endif()
|
||||||
@@ -1187,7 +1204,7 @@ else()
|
|||||||
|
|
||||||
list(APPEND GL_DEFINITIONS -DGLEW_STATIC)
|
list(APPEND GL_DEFINITIONS -DGLEW_STATIC)
|
||||||
|
|
||||||
# This won't affect the non-experimental glew library,
|
# This won't affect the non-experimental glew library,
|
||||||
# but is used for conditional compilation elsewhere.
|
# but is used for conditional compilation elsewhere.
|
||||||
list(APPEND GL_DEFINITIONS -DGLEW_NO_ES)
|
list(APPEND GL_DEFINITIONS -DGLEW_NO_ES)
|
||||||
|
|
||||||
@@ -1265,8 +1282,42 @@ endif()
|
|||||||
# Configure Ceres
|
# Configure Ceres
|
||||||
|
|
||||||
if(WITH_LIBMV)
|
if(WITH_LIBMV)
|
||||||
# We always have C++11 which includes unordered_map.
|
set(CERES_DEFINES)
|
||||||
set(CERES_DEFINES -DCERES_STD_UNORDERED_MAP)
|
|
||||||
|
if(WITH_CXX11)
|
||||||
|
# nothing to be done
|
||||||
|
elseif(SHARED_PTR_FOUND)
|
||||||
|
if(SHARED_PTR_TR1_MEMORY_HEADER)
|
||||||
|
list(APPEND CERES_DEFINES -DCERES_TR1_MEMORY_HEADER)
|
||||||
|
endif()
|
||||||
|
if(SHARED_PTR_TR1_NAMESPACE)
|
||||||
|
list(APPEND CERES_DEFINES -DCERES_TR1_SHARED_PTR)
|
||||||
|
endif()
|
||||||
|
else()
|
||||||
|
message(FATAL_ERROR "Ceres: Unable to find shared_ptr.")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(WITH_CXX11)
|
||||||
|
list(APPEND CERES_DEFINES -DCERES_STD_UNORDERED_MAP)
|
||||||
|
elseif(HAVE_STD_UNORDERED_MAP_HEADER)
|
||||||
|
if(HAVE_UNORDERED_MAP_IN_STD_NAMESPACE)
|
||||||
|
list(APPEND CERES_DEFINES -DCERES_STD_UNORDERED_MAP)
|
||||||
|
else()
|
||||||
|
if(HAVE_UNORDERED_MAP_IN_TR1_NAMESPACE)
|
||||||
|
list(APPEND CERES_DEFINES -DCERES_STD_UNORDERED_MAP_IN_TR1_NAMESPACE)
|
||||||
|
else()
|
||||||
|
list(APPEND CERES_DEFINES -DCERES_NO_UNORDERED_MAP)
|
||||||
|
message(STATUS "Ceres: Replacing unordered_map/set with map/set (warning: slower!)")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
else()
|
||||||
|
if(HAVE_UNORDERED_MAP_IN_TR1_NAMESPACE)
|
||||||
|
list(APPEND CERES_DEFINES -DCERES_TR1_UNORDERED_MAP)
|
||||||
|
else()
|
||||||
|
list(APPEND CERES_DEFINES -DCERES_NO_UNORDERED_MAP)
|
||||||
|
message(STATUS "Ceres: Replacing unordered_map/set with map/set (warning: slower!)")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
#-----------------------------------------------------------------------------
|
#-----------------------------------------------------------------------------
|
||||||
@@ -1357,22 +1408,16 @@ if(CMAKE_COMPILER_IS_GNUCC)
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
# flags to undo strict flags
|
# flags to undo strict flags
|
||||||
ADD_CHECK_C_COMPILER_FLAG(C_REMOVE_STRICT_FLAGS C_WARN_NO_DEPRECATED_DECLARATIONS -Wno-deprecated-declarations)
|
ADD_CHECK_C_COMPILER_FLAG(CC_REMOVE_STRICT_FLAGS C_WARN_NO_DEPRECATED_DECLARATIONS -Wno-deprecated-declarations)
|
||||||
ADD_CHECK_C_COMPILER_FLAG(C_REMOVE_STRICT_FLAGS C_WARN_NO_UNUSED_PARAMETER -Wno-unused-parameter)
|
ADD_CHECK_C_COMPILER_FLAG(CC_REMOVE_STRICT_FLAGS C_WARN_NO_UNUSED_PARAMETER -Wno-unused-parameter)
|
||||||
ADD_CHECK_C_COMPILER_FLAG(C_REMOVE_STRICT_FLAGS C_WARN_NO_UNUSED_FUNCTION -Wno-unused-function)
|
ADD_CHECK_C_COMPILER_FLAG(CC_REMOVE_STRICT_FLAGS C_WARN_NO_UNUSED_FUNCTION -Wno-unused-function)
|
||||||
ADD_CHECK_C_COMPILER_FLAG(C_REMOVE_STRICT_FLAGS C_WARN_NO_TYPE_LIMITS -Wno-type-limits)
|
|
||||||
ADD_CHECK_C_COMPILER_FLAG(C_REMOVE_STRICT_FLAGS C_WARN_NO_INT_IN_BOOL_CONTEXT -Wno-int-in-bool-context)
|
|
||||||
ADD_CHECK_C_COMPILER_FLAG(C_REMOVE_STRICT_FLAGS C_WARN_NO_FORMAT -Wno-format)
|
|
||||||
ADD_CHECK_C_COMPILER_FLAG(C_REMOVE_STRICT_FLAGS C_WARN_NO_SWITCH -Wno-switch)
|
|
||||||
|
|
||||||
ADD_CHECK_CXX_COMPILER_FLAG(CXX_REMOVE_STRICT_FLAGS CXX_WARN_NO_CLASS_MEMACCESS -Wno-class-memaccess)
|
|
||||||
|
|
||||||
if(CMAKE_COMPILER_IS_GNUCC AND (NOT "${CMAKE_C_COMPILER_VERSION}" VERSION_LESS "7.0"))
|
if(CMAKE_COMPILER_IS_GNUCC AND (NOT "${CMAKE_C_COMPILER_VERSION}" VERSION_LESS "7.0"))
|
||||||
ADD_CHECK_C_COMPILER_FLAG(C_REMOVE_STRICT_FLAGS C_WARN_NO_IMPLICIT_FALLTHROUGH -Wno-implicit-fallthrough)
|
ADD_CHECK_C_COMPILER_FLAG(CC_REMOVE_STRICT_FLAGS C_WARN_NO_IMPLICIT_FALLTHROUGH -Wno-implicit-fallthrough)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(NOT APPLE)
|
if(NOT APPLE)
|
||||||
ADD_CHECK_C_COMPILER_FLAG(C_REMOVE_STRICT_FLAGS C_WARN_NO_ERROR_UNUSED_BUT_SET_VARIABLE -Wno-error=unused-but-set-variable)
|
ADD_CHECK_C_COMPILER_FLAG(CC_REMOVE_STRICT_FLAGS C_WARN_NO_ERROR_UNUSED_BUT_SET_VARIABLE -Wno-error=unused-but-set-variable)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
elseif(CMAKE_C_COMPILER_ID MATCHES "Clang")
|
elseif(CMAKE_C_COMPILER_ID MATCHES "Clang")
|
||||||
@@ -1401,23 +1446,23 @@ elseif(CMAKE_C_COMPILER_ID MATCHES "Clang")
|
|||||||
# ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_UNUSED_MACROS -Wunused-macros)
|
# ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_UNUSED_MACROS -Wunused-macros)
|
||||||
|
|
||||||
# flags to undo strict flags
|
# flags to undo strict flags
|
||||||
ADD_CHECK_C_COMPILER_FLAG(C_REMOVE_STRICT_FLAGS C_WARN_NO_UNUSED_PARAMETER -Wno-unused-parameter)
|
ADD_CHECK_C_COMPILER_FLAG(CC_REMOVE_STRICT_FLAGS C_WARN_NO_UNUSED_PARAMETER -Wno-unused-parameter)
|
||||||
ADD_CHECK_C_COMPILER_FLAG(C_REMOVE_STRICT_FLAGS C_WARN_NO_UNUSED_MACROS -Wno-unused-macros)
|
ADD_CHECK_C_COMPILER_FLAG(CC_REMOVE_STRICT_FLAGS C_WARN_NO_UNUSED_MACROS -Wno-unused-macros)
|
||||||
|
|
||||||
ADD_CHECK_C_COMPILER_FLAG(C_REMOVE_STRICT_FLAGS C_WARN_NO_MISSING_VARIABLE_DECLARATIONS -Wno-missing-variable-declarations)
|
ADD_CHECK_C_COMPILER_FLAG(CC_REMOVE_STRICT_FLAGS C_WARN_NO_MISSING_VARIABLE_DECLARATIONS -Wno-missing-variable-declarations)
|
||||||
ADD_CHECK_C_COMPILER_FLAG(C_REMOVE_STRICT_FLAGS C_WARN_NO_INCOMPAT_PTR_DISCARD_QUAL -Wno-incompatible-pointer-types-discards-qualifiers)
|
ADD_CHECK_C_COMPILER_FLAG(CC_REMOVE_STRICT_FLAGS C_WARN_NO_INCOMPAT_PTR_DISCARD_QUAL -Wno-incompatible-pointer-types-discards-qualifiers)
|
||||||
ADD_CHECK_C_COMPILER_FLAG(C_REMOVE_STRICT_FLAGS C_WARN_NO_UNUSED_FUNCTION -Wno-unused-function)
|
ADD_CHECK_C_COMPILER_FLAG(CC_REMOVE_STRICT_FLAGS C_WARN_NO_UNUSED_FUNCTION -Wno-unused-function)
|
||||||
ADD_CHECK_C_COMPILER_FLAG(C_REMOVE_STRICT_FLAGS C_WARN_NO_INT_TO_VOID_POINTER_CAST -Wno-int-to-void-pointer-cast)
|
ADD_CHECK_C_COMPILER_FLAG(CC_REMOVE_STRICT_FLAGS C_WARN_NO_INT_TO_VOID_POINTER_CAST -Wno-int-to-void-pointer-cast)
|
||||||
ADD_CHECK_C_COMPILER_FLAG(C_REMOVE_STRICT_FLAGS C_WARN_NO_MISSING_PROTOTYPES -Wno-missing-prototypes)
|
ADD_CHECK_C_COMPILER_FLAG(CC_REMOVE_STRICT_FLAGS C_WARN_NO_MISSING_PROTOTYPES -Wno-missing-prototypes)
|
||||||
ADD_CHECK_C_COMPILER_FLAG(C_REMOVE_STRICT_FLAGS C_WARN_NO_DUPLICATE_ENUM -Wno-duplicate-enum)
|
ADD_CHECK_C_COMPILER_FLAG(CC_REMOVE_STRICT_FLAGS C_WARN_NO_DUPLICATE_ENUM -Wno-duplicate-enum)
|
||||||
ADD_CHECK_C_COMPILER_FLAG(C_REMOVE_STRICT_FLAGS C_WARN_NO_UNDEF -Wno-undef)
|
ADD_CHECK_C_COMPILER_FLAG(CC_REMOVE_STRICT_FLAGS C_WARN_NO_UNDEF -Wno-undef)
|
||||||
ADD_CHECK_C_COMPILER_FLAG(C_REMOVE_STRICT_FLAGS C_WARN_NO_MISSING_NORETURN -Wno-missing-noreturn)
|
ADD_CHECK_C_COMPILER_FLAG(CC_REMOVE_STRICT_FLAGS C_WARN_NO_MISSING_NORETURN -Wno-missing-noreturn)
|
||||||
|
|
||||||
ADD_CHECK_CXX_COMPILER_FLAG(CXX_REMOVE_STRICT_FLAGS CXX_WARN_NO_UNUSED_PRIVATE_FIELD -Wno-unused-private-field)
|
ADD_CHECK_CXX_COMPILER_FLAG(CC_REMOVE_STRICT_FLAGS CXX_WARN_NO_UNUSED_PRIVATE_FIELD -Wno-unused-private-field)
|
||||||
ADD_CHECK_CXX_COMPILER_FLAG(CXX_REMOVE_STRICT_FLAGS CXX_WARN_NO_CXX11_NARROWING -Wno-c++11-narrowing)
|
ADD_CHECK_CXX_COMPILER_FLAG(CC_REMOVE_STRICT_FLAGS CXX_WARN_NO_CXX11_NARROWING -Wno-c++11-narrowing)
|
||||||
ADD_CHECK_CXX_COMPILER_FLAG(CXX_REMOVE_STRICT_FLAGS CXX_WARN_NO_NON_VIRTUAL_DTOR -Wno-non-virtual-dtor)
|
ADD_CHECK_CXX_COMPILER_FLAG(CC_REMOVE_STRICT_FLAGS CXX_WARN_NO_NON_VIRTUAL_DTOR -Wno-non-virtual-dtor)
|
||||||
ADD_CHECK_CXX_COMPILER_FLAG(CXX_REMOVE_STRICT_FLAGS CXX_WARN_NO_UNUSED_MACROS -Wno-unused-macros)
|
ADD_CHECK_CXX_COMPILER_FLAG(CC_REMOVE_STRICT_FLAGS CXX_WARN_NO_UNUSED_MACROS -Wno-unused-macros)
|
||||||
ADD_CHECK_CXX_COMPILER_FLAG(CXX_REMOVE_STRICT_FLAGS CXX_WARN_NO_REORDER -Wno-reorder)
|
ADD_CHECK_CXX_COMPILER_FLAG(CC_REMOVE_STRICT_FLAGS CXX_WARN_NO_REORDER -Wno-reorder)
|
||||||
|
|
||||||
elseif(CMAKE_C_COMPILER_ID MATCHES "Intel")
|
elseif(CMAKE_C_COMPILER_ID MATCHES "Intel")
|
||||||
|
|
||||||
@@ -1449,7 +1494,7 @@ elseif(CMAKE_C_COMPILER_ID MATCHES "MSVC")
|
|||||||
"/wd4267" # conversion from 'size_t' to 'type', possible loss of data
|
"/wd4267" # conversion from 'size_t' to 'type', possible loss of data
|
||||||
"/wd4305" # truncation from 'type1' to 'type2'
|
"/wd4305" # truncation from 'type1' to 'type2'
|
||||||
"/wd4800" # forcing value to bool 'true' or 'false'
|
"/wd4800" # forcing value to bool 'true' or 'false'
|
||||||
"/wd4828" # The file contains a character that is illegal
|
"/wd4828" # The file contains a character that is illegal
|
||||||
# errors:
|
# errors:
|
||||||
"/we4013" # 'function' undefined; assuming extern returning int
|
"/we4013" # 'function' undefined; assuming extern returning int
|
||||||
"/we4133" # incompatible pointer types
|
"/we4133" # incompatible pointer types
|
||||||
@@ -1493,17 +1538,24 @@ if(WITH_PYTHON)
|
|||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(
|
if(WITH_CXX11)
|
||||||
CMAKE_COMPILER_IS_GNUCC OR
|
if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID MATCHES "Clang")
|
||||||
CMAKE_C_COMPILER_ID MATCHES "Clang" OR
|
# TODO(sergey): Do we want c++11 or gnu-c++11 here?
|
||||||
CMAKE_C_COMPILER_ID MATCHES "Intel"
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
|
||||||
)
|
elseif(MSVC)
|
||||||
# TODO(sergey): Do we want c++11 or gnu-c++11 here?
|
# Nothing special is needed, C++11 features are available by default.
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
|
else()
|
||||||
elseif(MSVC)
|
message(FATAL_ERROR "Compiler ${CMAKE_C_COMPILER_ID} is not supported for C++11 build yet")
|
||||||
# Nothing special is needed, C++11 features are available by default.
|
endif()
|
||||||
else()
|
else()
|
||||||
message(FATAL_ERROR "Unknown compiler ${CMAKE_C_COMPILER_ID}, can't enable C++11 build")
|
# GCC-6 switched to C++11 by default, which would break linking with existing libraries
|
||||||
|
# by default. So we explicitly disable C++11 for a new GCC so no linking issues happens.
|
||||||
|
if(CMAKE_COMPILER_IS_GNUCC AND (NOT "${CMAKE_C_COMPILER_VERSION}" VERSION_LESS "6.0"))
|
||||||
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++98")
|
||||||
|
# We also disable any of C++11 ABI from usage, so we wouldn't even try to
|
||||||
|
# link to stuff from std::__cxx11 namespace.
|
||||||
|
add_definitions("-D_GLIBCXX_USE_CXX11_ABI=0")
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Visual Studio has all standards it supports available by default
|
# Visual Studio has all standards it supports available by default
|
||||||
|
13
GNUmakefile
13
GNUmakefile
@@ -71,10 +71,6 @@ ifneq "$(findstring full, $(MAKECMDGOALS))" ""
|
|||||||
BUILD_DIR:=$(BUILD_DIR)_full
|
BUILD_DIR:=$(BUILD_DIR)_full
|
||||||
BUILD_CMAKE_ARGS:=$(BUILD_CMAKE_ARGS) -C"$(BLENDER_DIR)/build_files/cmake/config/blender_full.cmake"
|
BUILD_CMAKE_ARGS:=$(BUILD_CMAKE_ARGS) -C"$(BLENDER_DIR)/build_files/cmake/config/blender_full.cmake"
|
||||||
endif
|
endif
|
||||||
ifneq "$(findstring benchmark, $(MAKECMDGOALS))" ""
|
|
||||||
BUILD_DIR:=$(BUILD_DIR)_benchmark
|
|
||||||
BUILD_CMAKE_ARGS:=$(BUILD_CMAKE_ARGS) -C"$(BLENDER_DIR)/build_files/cmake/config/blender_benchmark.cmake"
|
|
||||||
endif
|
|
||||||
ifneq "$(findstring lite, $(MAKECMDGOALS))" ""
|
ifneq "$(findstring lite, $(MAKECMDGOALS))" ""
|
||||||
BUILD_DIR:=$(BUILD_DIR)_lite
|
BUILD_DIR:=$(BUILD_DIR)_lite
|
||||||
BUILD_CMAKE_ARGS:=$(BUILD_CMAKE_ARGS) -C"$(BLENDER_DIR)/build_files/cmake/config/blender_lite.cmake"
|
BUILD_CMAKE_ARGS:=$(BUILD_CMAKE_ARGS) -C"$(BLENDER_DIR)/build_files/cmake/config/blender_lite.cmake"
|
||||||
@@ -150,7 +146,6 @@ all: .FORCE
|
|||||||
debug: all
|
debug: all
|
||||||
full: all
|
full: all
|
||||||
lite: all
|
lite: all
|
||||||
benchmark: all
|
|
||||||
cycles: all
|
cycles: all
|
||||||
headless: all
|
headless: all
|
||||||
bpy: all
|
bpy: all
|
||||||
@@ -241,12 +236,8 @@ help: .FORCE
|
|||||||
@echo " * check_descriptions - check for duplicate/invalid descriptions"
|
@echo " * check_descriptions - check for duplicate/invalid descriptions"
|
||||||
@echo ""
|
@echo ""
|
||||||
@echo "Utilities (not associated with building blender)"
|
@echo "Utilities (not associated with building blender)"
|
||||||
@echo " * icons - Updates PNG icons from SVG files."
|
@echo " * icons - updates PNG icons from SVG files."
|
||||||
@echo " Set environment variables 'BLENDER_BIN' and 'INKSCAPE_BIN'"
|
@echo " * icons_geom - updates Geometry icons from BLEND file."
|
||||||
@echo " to define your own commands."
|
|
||||||
@echo " * icons_geom - Updates Geometry icons from BLEND file."
|
|
||||||
@echo " Set environment variable 'BLENDER_BIN'"
|
|
||||||
@echo " to define your own command."
|
|
||||||
@echo " * tgz - create a compressed archive of the source code."
|
@echo " * tgz - create a compressed archive of the source code."
|
||||||
@echo " * update - updates git and all submodules"
|
@echo " * update - updates git and all submodules"
|
||||||
@echo ""
|
@echo ""
|
||||||
|
@@ -25,7 +25,6 @@ set(BLOSC_EXTRA_ARGS
|
|||||||
-DThreads_FOUND=1
|
-DThreads_FOUND=1
|
||||||
-DPTHREAD_LIBS=${LIBDIR}/pthreads/lib/pthreadVC2.lib
|
-DPTHREAD_LIBS=${LIBDIR}/pthreads/lib/pthreadVC2.lib
|
||||||
-DPTHREAD_INCLUDE_DIR=${LIBDIR}/pthreads/inc
|
-DPTHREAD_INCLUDE_DIR=${LIBDIR}/pthreads/inc
|
||||||
-DDEACTIVATE_SNAPPY=ON
|
|
||||||
)
|
)
|
||||||
|
|
||||||
ExternalProject_Add(external_blosc
|
ExternalProject_Add(external_blosc
|
||||||
|
@@ -16,15 +16,7 @@
|
|||||||
#
|
#
|
||||||
# ***** END GPL LICENSE BLOCK *****
|
# ***** END GPL LICENSE BLOCK *****
|
||||||
|
|
||||||
set(FREETYPE_EXTRA_ARGS
|
set(FREETYPE_EXTRA_ARGS -DCMAKE_RELEASE_POSTFIX:STRING=2ST -DCMAKE_DEBUG_POSTFIX:STRING=2ST_d -DWITH_BZip2=OFF -DWITH_HarfBuzz=OFF)
|
||||||
-DCMAKE_RELEASE_POSTFIX:STRING=2ST
|
|
||||||
-DCMAKE_DEBUG_POSTFIX:STRING=2ST_d
|
|
||||||
-DWITH_BZip2=OFF
|
|
||||||
-DWITH_HarfBuzz=OFF
|
|
||||||
-DFT_WITH_HARFBUZZ=OFF
|
|
||||||
-DFT_WITH_BZIP2=OFF
|
|
||||||
-DCMAKE_DISABLE_FIND_PACKAGE_HarfBuzz=TRUE
|
|
||||||
-DCMAKE_DISABLE_FIND_PACKAGE_BZip2=TRUE)
|
|
||||||
|
|
||||||
ExternalProject_Add(external_freetype
|
ExternalProject_Add(external_freetype
|
||||||
URL ${FREETYPE_URI}
|
URL ${FREETYPE_URI}
|
||||||
|
@@ -58,3 +58,4 @@ if(MSVC)
|
|||||||
DEPENDEES mkdir update patch download configure build install
|
DEPENDEES mkdir update patch download configure build install
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
@@ -33,8 +33,8 @@ set(NUMPY_POSTFIX)
|
|||||||
if(WIN32)
|
if(WIN32)
|
||||||
set(NUMPY_INSTALL
|
set(NUMPY_INSTALL
|
||||||
${CMAKE_COMMAND} -E copy_directory "${BUILD_DIR}/python/src/external_python/run/lib/site-packages/numpy/core/include/numpy" "${LIBDIR}/python/include/python${PYTHON_SHORT_VERSION}/numpy" &&
|
${CMAKE_COMMAND} -E copy_directory "${BUILD_DIR}/python/src/external_python/run/lib/site-packages/numpy/core/include/numpy" "${LIBDIR}/python/include/python${PYTHON_SHORT_VERSION}/numpy" &&
|
||||||
${CMAKE_COMMAND} -E chdir "${BUILD_DIR}/numpy/src/external_numpy/build/lib.${PYTHON_ARCH2}-${PYTHON_SHORT_VERSION}${NUMPY_DIR_POSTFIX}"
|
${CMAKE_COMMAND} -E chdir "${BUILD_DIR}/numpy/src/external_numpy/build/lib.${PYTHON_ARCH2}-${PYTHON_SHORT_VERSION}${NUMPY_DIR_POSTFIX}"
|
||||||
${CMAKE_COMMAND} -E tar "cfvz" "${LIBDIR}/python${PYTHON_SHORT_VERSION_NO_DOTS}_numpy_${NUMPY_SHORT_VERSION}${NUMPY_ARCHIVE_POSTFIX}.tar.gz" "."
|
${CMAKE_COMMAND} -E tar "cfvz" "${LIBDIR}/python${PYTHON_SHORT_VERSION_NO_DOTS}_numpy_${NUMPY_SHORT_VERSION}${NUMPY_ARCHIVE_POSTFIX}.tar.gz" "."
|
||||||
)
|
)
|
||||||
set(NUMPY_PATCH ${PATCH_CMD} --verbose -p 1 -N -d ${BUILD_DIR}/numpy/src/external_numpy < ${PATCH_DIR}/numpy.diff )
|
set(NUMPY_PATCH ${PATCH_CMD} --verbose -p 1 -N -d ${BUILD_DIR}/numpy/src/external_numpy < ${PATCH_DIR}/numpy.diff )
|
||||||
else()
|
else()
|
||||||
|
@@ -39,6 +39,5 @@ if(BUILD_MODE STREQUAL Release)
|
|||||||
PREFIX ${BUILD_DIR}/openal
|
PREFIX ${BUILD_DIR}/openal
|
||||||
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBDIR}/openal ${DEFAULT_CMAKE_FLAGS} ${OPENAL_EXTRA_ARGS}
|
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBDIR}/openal ${DEFAULT_CMAKE_FLAGS} ${OPENAL_EXTRA_ARGS}
|
||||||
INSTALL_DIR ${LIBDIR}/openal
|
INSTALL_DIR ${LIBDIR}/openal
|
||||||
PATCH_COMMAND ${PATCH_CMD} -p 1 -d ${BUILD_DIR}/openal/src/external_openal < ${PATCH_DIR}/openal.diff
|
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
|
@@ -46,7 +46,7 @@ if(MSVC)
|
|||||||
DOWNLOAD_DIR ${DOWNLOAD_DIR}
|
DOWNLOAD_DIR ${DOWNLOAD_DIR}
|
||||||
URL_HASH SHA256=${OPENJPEG_HASH}
|
URL_HASH SHA256=${OPENJPEG_HASH}
|
||||||
PREFIX ${BUILD_DIR}/openjpeg_msvc
|
PREFIX ${BUILD_DIR}/openjpeg_msvc
|
||||||
CMAKE_ARGS ${OPENJPEG_EXTRA_ARGS} -DCMAKE_INSTALL_PREFIX=${LIBDIR}/openjpeg_msvc -DBUILD_SHARED_LIBS=Off -DBUILD_THIRDPARTY=OFF
|
CMAKE_ARGS ${OPENJPEG_EXTRA_ARGS} -DCMAKE_INSTALL_PREFIX=${LIBDIR}/openjpeg_msvc -DBUILD_SHARED_LIBS=Off -DBUILD_THIRDPARTY=OFF
|
||||||
INSTALL_DIR ${LIBDIR}/openjpeg_msvc
|
INSTALL_DIR ${LIBDIR}/openjpeg_msvc
|
||||||
)
|
)
|
||||||
if(BUILD_MODE STREQUAL Release)
|
if(BUILD_MODE STREQUAL Release)
|
||||||
|
@@ -56,27 +56,24 @@ if(WIN32)
|
|||||||
# For OIIO and OSL
|
# For OIIO and OSL
|
||||||
set(COMMON_DEFINES /DPSAPI_VERSION=1 /DOIIO_STATIC_BUILD /DTINYFORMAT_ALLOW_WCHAR_STRINGS)
|
set(COMMON_DEFINES /DPSAPI_VERSION=1 /DOIIO_STATIC_BUILD /DTINYFORMAT_ALLOW_WCHAR_STRINGS)
|
||||||
|
|
||||||
if(MSVC_VERSION GREATER 1909)
|
# TODO FIXME highly MSVC specific
|
||||||
set(COMMON_MSVC_FLAGS "/Wv:18") #some deps with warnings as error aren't quite ready for dealing with the new 2017 warnings.
|
if(WITH_OPTIMIZED_DEBUG)
|
||||||
|
set(BLENDER_CMAKE_C_FLAGS_DEBUG "/MTd /O2 /Ob2 /DNDEBUG /DPSAPI_VERSION=1 /DOIIO_STATIC_BUILD /DTINYFORMAT_ALLOW_WCHAR_STRINGS")
|
||||||
|
else()
|
||||||
|
set(BLENDER_CMAKE_C_FLAGS_DEBUG "/MTd /Zi /Ob0 /Od /RTC1 /D_DEBUG /DPSAPI_VERSION=1 /DOIIO_STATIC_BUILD /DTINYFORMAT_ALLOW_WCHAR_STRINGS")
|
||||||
endif()
|
endif()
|
||||||
|
set(BLENDER_CMAKE_C_FLAGS_MINSIZEREL "/MT /O1 /Ob1 /D NDEBUG /DPSAPI_VERSION=1 /DOIIO_STATIC_BUILD /DTINYFORMAT_ALLOW_WCHAR_STRINGS")
|
||||||
|
set(BLENDER_CMAKE_C_FLAGS_RELEASE "/MT /O2 /Ob2 /DNDEBUG /DPSAPI_VERSION=1 /DOIIO_STATIC_BUILD /DTINYFORMAT_ALLOW_WCHAR_STRINGS")
|
||||||
|
set(BLENDER_CMAKE_C_FLAGS_RELWITHDEBINFO "/MT /Zi /O2 /Ob1 /D NDEBUG /DPSAPI_VERSION=1 /DOIIO_STATIC_BUILD /DTINYFORMAT_ALLOW_WCHAR_STRINGS")
|
||||||
|
|
||||||
if(WITH_OPTIMIZED_DEBUG)
|
if(WITH_OPTIMIZED_DEBUG)
|
||||||
set(BLENDER_CMAKE_C_FLAGS_DEBUG "/MTd ${COMMON_MSVC_FLAGS} /O2 /Ob2 /DNDEBUG /DPSAPI_VERSION=1 /DOIIO_STATIC_BUILD /DTINYFORMAT_ALLOW_WCHAR_STRINGS")
|
set(BLENDER_CMAKE_CXX_FLAGS_DEBUG "/MTd /O2 /Ob2 /D NDEBUG /D PLATFORM_WINDOWS /DPSAPI_VERSION=1 /DOIIO_STATIC_BUILD /DTINYFORMAT_ALLOW_WCHAR_STRINGS")
|
||||||
else()
|
else()
|
||||||
set(BLENDER_CMAKE_C_FLAGS_DEBUG "/MTd ${COMMON_MSVC_FLAGS} /Zi /Ob0 /Od /RTC1 /D_DEBUG /DPSAPI_VERSION=1 /DOIIO_STATIC_BUILD /DTINYFORMAT_ALLOW_WCHAR_STRINGS")
|
set(BLENDER_CMAKE_CXX_FLAGS_DEBUG "/D_DEBUG /D PLATFORM_WINDOWS /MTd /Zi /Ob0 /Od /RTC1 /DPSAPI_VERSION=1 /DOIIO_STATIC_BUILD /DTINYFORMAT_ALLOW_WCHAR_STRINGS")
|
||||||
endif()
|
endif()
|
||||||
set(BLENDER_CMAKE_C_FLAGS_MINSIZEREL "/MT ${COMMON_MSVC_FLAGS} /O1 /Ob1 /D NDEBUG /DPSAPI_VERSION=1 /DOIIO_STATIC_BUILD /DTINYFORMAT_ALLOW_WCHAR_STRINGS")
|
set(BLENDER_CMAKE_CXX_FLAGS_MINSIZEREL "/MT /O1 /Ob1 /D NDEBUG /D PLATFORM_WINDOWS /DPSAPI_VERSION=1 /DOIIO_STATIC_BUILD /DTINYFORMAT_ALLOW_WCHAR_STRINGS")
|
||||||
set(BLENDER_CMAKE_C_FLAGS_RELEASE "/MT ${COMMON_MSVC_FLAGS} /O2 /Ob2 /DNDEBUG /DPSAPI_VERSION=1 /DOIIO_STATIC_BUILD /DTINYFORMAT_ALLOW_WCHAR_STRINGS")
|
set(BLENDER_CMAKE_CXX_FLAGS_RELEASE "/MT /O2 /Ob2 /D NDEBUG /D PLATFORM_WINDOWS /DPSAPI_VERSION=1 /DOIIO_STATIC_BUILD /DTINYFORMAT_ALLOW_WCHAR_STRINGS")
|
||||||
set(BLENDER_CMAKE_C_FLAGS_RELWITHDEBINFO "/MT ${COMMON_MSVC_FLAGS} /Zi /O2 /Ob1 /D NDEBUG /DPSAPI_VERSION=1 /DOIIO_STATIC_BUILD /DTINYFORMAT_ALLOW_WCHAR_STRINGS")
|
set(BLENDER_CMAKE_CXX_FLAGS_RELWITHDEBINFO "/MT /Zi /O2 /Ob1 /D NDEBUG /D PLATFORM_WINDOWS /DPSAPI_VERSION=1 /DOIIO_STATIC_BUILD /DTINYFORMAT_ALLOW_WCHAR_STRINGS")
|
||||||
|
|
||||||
if(WITH_OPTIMIZED_DEBUG)
|
|
||||||
set(BLENDER_CMAKE_CXX_FLAGS_DEBUG "/MTd ${COMMON_MSVC_FLAGS} /O2 /Ob2 /D NDEBUG /D PLATFORM_WINDOWS /DPSAPI_VERSION=1 /DOIIO_STATIC_BUILD /DTINYFORMAT_ALLOW_WCHAR_STRINGS")
|
|
||||||
else()
|
|
||||||
set(BLENDER_CMAKE_CXX_FLAGS_DEBUG "/D_DEBUG /D PLATFORM_WINDOWS /MTd ${COMMON_MSVC_FLAGS} /Zi /Ob0 /Od /RTC1 /DPSAPI_VERSION=1 /DOIIO_STATIC_BUILD /DTINYFORMAT_ALLOW_WCHAR_STRINGS")
|
|
||||||
endif()
|
|
||||||
set(BLENDER_CMAKE_CXX_FLAGS_MINSIZEREL "/MT /${COMMON_MSVC_FLAGS} /O1 /Ob1 /D NDEBUG /D PLATFORM_WINDOWS /DPSAPI_VERSION=1 /DOIIO_STATIC_BUILD /DTINYFORMAT_ALLOW_WCHAR_STRINGS")
|
|
||||||
set(BLENDER_CMAKE_CXX_FLAGS_RELEASE "/MT ${COMMON_MSVC_FLAGS} /O2 /Ob2 /D NDEBUG /D PLATFORM_WINDOWS /DPSAPI_VERSION=1 /DOIIO_STATIC_BUILD /DTINYFORMAT_ALLOW_WCHAR_STRINGS")
|
|
||||||
set(BLENDER_CMAKE_CXX_FLAGS_RELWITHDEBINFO "/MT ${COMMON_MSVC_FLAGS} /Zi /O2 /Ob1 /D NDEBUG /D PLATFORM_WINDOWS /DPSAPI_VERSION=1 /DOIIO_STATIC_BUILD /DTINYFORMAT_ALLOW_WCHAR_STRINGS")
|
|
||||||
|
|
||||||
set(PLATFORM_FLAGS)
|
set(PLATFORM_FLAGS)
|
||||||
set(PLATFORM_CXX_FLAGS)
|
set(PLATFORM_CXX_FLAGS)
|
||||||
|
@@ -216,3 +216,4 @@ if(NOT EXISTS "${DOWNLOAD_DIR}/mingw/mingw32/bin/i686-w64-mingw32-ranlib.exe")
|
|||||||
COMMAND ${CMAKE_COMMAND} -E copy "${DOWNLOAD_DIR}/mingw/mingw32/bin/ranlib.exe" "${DOWNLOAD_DIR}/mingw/mingw32/bin/i686-w64-mingw32-ranlib.exe"
|
COMMAND ${CMAKE_COMMAND} -E copy "${DOWNLOAD_DIR}/mingw/mingw32/bin/ranlib.exe" "${DOWNLOAD_DIR}/mingw/mingw32/bin/i686-w64-mingw32-ranlib.exe"
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
@@ -216,3 +216,4 @@ if(NOT EXISTS "${DOWNLOAD_DIR}/mingw/mingw64/bin/x86_64-w64-mingw32-ranlib.exe")
|
|||||||
COMMAND ${CMAKE_COMMAND} -E copy "${DOWNLOAD_DIR}/mingw/mingw64/bin/ranlib.exe" "${DOWNLOAD_DIR}/mingw/mingw64/bin/x86_64-w64-mingw32-ranlib.exe"
|
COMMAND ${CMAKE_COMMAND} -E copy "${DOWNLOAD_DIR}/mingw/mingw64/bin/ranlib.exe" "${DOWNLOAD_DIR}/mingw/mingw64/bin/x86_64-w64-mingw32-ranlib.exe"
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
@@ -25,7 +25,7 @@ ExternalProject_Add(external_x264
|
|||||||
DOWNLOAD_DIR ${DOWNLOAD_DIR}
|
DOWNLOAD_DIR ${DOWNLOAD_DIR}
|
||||||
URL_HASH SHA256=${X264_HASH}
|
URL_HASH SHA256=${X264_HASH}
|
||||||
PREFIX ${BUILD_DIR}/x264
|
PREFIX ${BUILD_DIR}/x264
|
||||||
CONFIGURE_COMMAND ${CONFIGURE_ENV} && cd ${BUILD_DIR}/x264/src/external_x264/ && ${CONFIGURE_COMMAND} --prefix=${LIBDIR}/x264
|
CONFIGURE_COMMAND ${CONFIGURE_ENV} && cd ${BUILD_DIR}/x264/src/external_x264/ && ${CONFIGURE_COMMAND} --prefix=${LIBDIR}/x264
|
||||||
--enable-static
|
--enable-static
|
||||||
--enable-pic
|
--enable-pic
|
||||||
--disable-lavf
|
--disable-lavf
|
||||||
|
@@ -37,3 +37,4 @@ endif()
|
|||||||
if(MSVC)
|
if(MSVC)
|
||||||
set_target_properties(external_zlib_mingw PROPERTIES FOLDER Mingw)
|
set_target_properties(external_zlib_mingw PROPERTIES FOLDER Mingw)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
@@ -285,7 +285,7 @@ SUDO="sudo"
|
|||||||
|
|
||||||
NO_BUILD=false
|
NO_BUILD=false
|
||||||
NO_CONFIRM=false
|
NO_CONFIRM=false
|
||||||
USE_CXX11=true
|
USE_CXX11=true # Mandatory in blender2.8
|
||||||
|
|
||||||
PYTHON_VERSION="3.6.2"
|
PYTHON_VERSION="3.6.2"
|
||||||
PYTHON_VERSION_MIN="3.6"
|
PYTHON_VERSION_MIN="3.6"
|
||||||
@@ -794,10 +794,20 @@ OPENCOLLADA_REPO_BRANCH="master"
|
|||||||
|
|
||||||
FFMPEG_SOURCE=( "http://ffmpeg.org/releases/ffmpeg-$FFMPEG_VERSION.tar.bz2" )
|
FFMPEG_SOURCE=( "http://ffmpeg.org/releases/ffmpeg-$FFMPEG_VERSION.tar.bz2" )
|
||||||
|
|
||||||
# C++11 is required now
|
|
||||||
CXXFLAGS_BACK=$CXXFLAGS
|
CXXFLAGS_BACK=$CXXFLAGS
|
||||||
CXXFLAGS="$CXXFLAGS -std=c++11"
|
if [ "$USE_CXX11" = true ]; then
|
||||||
export CXXFLAGS
|
WARNING "C++11 is now mandatory for blender2.8, this *should* go smoothly with any very recent distribution.
|
||||||
|
However, if you are experiencing linking errors (also when building Blender itself), please try the following:
|
||||||
|
* Re-run this script with '--build-all --force-all' options.
|
||||||
|
* Ensure your gcc version is at the very least 4.8, if possible you should really rather use gcc-5.1 or above.
|
||||||
|
|
||||||
|
Please note that until the transition to C++11-built libraries if completed in your distribution, situation will
|
||||||
|
remain fuzzy and incompatibilities may happen..."
|
||||||
|
PRINT ""
|
||||||
|
PRINT ""
|
||||||
|
CXXFLAGS="$CXXFLAGS -std=c++11"
|
||||||
|
export CXXFLAGS
|
||||||
|
fi
|
||||||
|
|
||||||
#### Show Dependencies ####
|
#### Show Dependencies ####
|
||||||
|
|
||||||
@@ -1672,7 +1682,9 @@ compile_OIIO() {
|
|||||||
# fi
|
# fi
|
||||||
cmake_d="$cmake_d -D USE_OCIO=OFF"
|
cmake_d="$cmake_d -D USE_OCIO=OFF"
|
||||||
|
|
||||||
cmake_d="$cmake_d -D OIIO_BUILD_CPP11=ON"
|
if [ "$USE_CXX11" = true ]; then
|
||||||
|
cmake_d="$cmake_d -D OIIO_BUILD_CPP11=ON"
|
||||||
|
fi
|
||||||
|
|
||||||
if file /bin/cp | grep -q '32-bit'; then
|
if file /bin/cp | grep -q '32-bit'; then
|
||||||
cflags="-fPIC -m32 -march=i686"
|
cflags="-fPIC -m32 -march=i686"
|
||||||
@@ -1885,7 +1897,9 @@ compile_OSL() {
|
|||||||
cmake_d="$cmake_d -D OSL_BUILD_PLUGINS=OFF"
|
cmake_d="$cmake_d -D OSL_BUILD_PLUGINS=OFF"
|
||||||
cmake_d="$cmake_d -D OSL_BUILD_TESTS=OFF"
|
cmake_d="$cmake_d -D OSL_BUILD_TESTS=OFF"
|
||||||
cmake_d="$cmake_d -D USE_SIMD=sse2"
|
cmake_d="$cmake_d -D USE_SIMD=sse2"
|
||||||
cmake_d="$cmake_d -D OSL_BUILD_CPP11=1"
|
if [ "$USE_CXX11" = true ]; then
|
||||||
|
cmake_d="$cmake_d -D OSL_BUILD_CPP11=1"
|
||||||
|
fi
|
||||||
|
|
||||||
#~ cmake_d="$cmake_d -D ILMBASE_VERSION=$ILMBASE_VERSION"
|
#~ cmake_d="$cmake_d -D ILMBASE_VERSION=$ILMBASE_VERSION"
|
||||||
|
|
||||||
@@ -2271,6 +2285,12 @@ compile_ALEMBIC() {
|
|||||||
|
|
||||||
cmake_d="-D CMAKE_INSTALL_PREFIX=$_inst"
|
cmake_d="-D CMAKE_INSTALL_PREFIX=$_inst"
|
||||||
|
|
||||||
|
# Without Boost or TR1, Alembic requires C++11.
|
||||||
|
if [ "$USE_CXX11" != true ]; then
|
||||||
|
cmake_d="$cmake_d -D ALEMBIC_LIB_USES_BOOST=ON"
|
||||||
|
cmake_d="$cmake_d -D ALEMBIC_LIB_USES_TR1=OFF"
|
||||||
|
fi
|
||||||
|
|
||||||
if [ -d $INST/boost ]; then
|
if [ -d $INST/boost ]; then
|
||||||
if [ -d $INST/boost ]; then
|
if [ -d $INST/boost ]; then
|
||||||
cmake_d="$cmake_d -D BOOST_ROOT=$INST/boost"
|
cmake_d="$cmake_d -D BOOST_ROOT=$INST/boost"
|
||||||
@@ -4207,6 +4227,12 @@ print_info() {
|
|||||||
_buildargs="$_buildargs -U *OPENCOLORIO* -U *OPENEXR* -U *OPENIMAGEIO* -U *LLVM* -U *CYCLES*"
|
_buildargs="$_buildargs -U *OPENCOLORIO* -U *OPENEXR* -U *OPENIMAGEIO* -U *LLVM* -U *CYCLES*"
|
||||||
_buildargs="$_buildargs -U *OPENSUBDIV* -U *OPENVDB* -U *COLLADA* -U *FFMPEG* -U *ALEMBIC*"
|
_buildargs="$_buildargs -U *OPENSUBDIV* -U *OPENVDB* -U *COLLADA* -U *FFMPEG* -U *ALEMBIC*"
|
||||||
|
|
||||||
|
if [ "$USE_CXX11" = true ]; then
|
||||||
|
_1="-D WITH_CXX11=ON"
|
||||||
|
PRINT " $_1"
|
||||||
|
_buildargs="$_buildargs $_1"
|
||||||
|
fi
|
||||||
|
|
||||||
_1="-D WITH_CODEC_SNDFILE=ON"
|
_1="-D WITH_CODEC_SNDFILE=ON"
|
||||||
PRINT " $_1"
|
PRINT " $_1"
|
||||||
_buildargs="$_buildargs $_1"
|
_buildargs="$_buildargs $_1"
|
||||||
|
@@ -75,7 +75,7 @@ macro(PREFIX_FIND_LIB prefix libname libpath_var liblist_var cachelist_var)
|
|||||||
# Handle new library names for OpenEXR 2.1 build via cmake
|
# Handle new library names for OpenEXR 2.1 build via cmake
|
||||||
string(REPLACE "." "_" _ILMBASE_VERSION ${ILMBASE_VERSION})
|
string(REPLACE "." "_" _ILMBASE_VERSION ${ILMBASE_VERSION})
|
||||||
string(SUBSTRING ${_ILMBASE_VERSION} 0 3 _ILMBASE_VERSION )
|
string(SUBSTRING ${_ILMBASE_VERSION} 0 3 _ILMBASE_VERSION )
|
||||||
|
|
||||||
find_library(${tmp_prefix}_LIBRARY_RELEASE
|
find_library(${tmp_prefix}_LIBRARY_RELEASE
|
||||||
NAMES ${libname} ${libname}-${_ILMBASE_VERSION}
|
NAMES ${libname} ${libname}-${_ILMBASE_VERSION}
|
||||||
HINTS ${${libpath_var}}
|
HINTS ${${libpath_var}}
|
||||||
@@ -177,7 +177,7 @@ if(ILMBASE_INCLUDE_DIR)
|
|||||||
"\\1" XYZ ${ILMBASE_BUILD_SPECIFICATION})
|
"\\1" XYZ ${ILMBASE_BUILD_SPECIFICATION})
|
||||||
set("ILMBASE_VERSION" ${XYZ} CACHE STRING "Version of ILMBase lib")
|
set("ILMBASE_VERSION" ${XYZ} CACHE STRING "Version of ILMBase lib")
|
||||||
else()
|
else()
|
||||||
# Old versions (before 2.0?) do not have any version string, just assuming 2.0 should be fine though.
|
# Old versions (before 2.0?) do not have any version string, just assuming 2.0 should be fine though.
|
||||||
message(WARNING "Could not determine ILMBase library version, assuming 2.0.")
|
message(WARNING "Could not determine ILMBase library version, assuming 2.0.")
|
||||||
set("ILMBASE_VERSION" "2.0" CACHE STRING "Version of ILMBase lib")
|
set("ILMBASE_VERSION" "2.0" CACHE STRING "Version of ILMBase lib")
|
||||||
endif()
|
endif()
|
||||||
|
@@ -175,7 +175,7 @@ if(OPENEXR_INCLUDE_DIR)
|
|||||||
"\\1" XYZ ${OPENEXR_BUILD_SPECIFICATION})
|
"\\1" XYZ ${OPENEXR_BUILD_SPECIFICATION})
|
||||||
set("OPENEXR_VERSION" ${XYZ} CACHE STRING "Version of OpenEXR lib")
|
set("OPENEXR_VERSION" ${XYZ} CACHE STRING "Version of OpenEXR lib")
|
||||||
else()
|
else()
|
||||||
# Old versions (before 2.0?) do not have any version string, just assuming 2.0 should be fine though.
|
# Old versions (before 2.0?) do not have any version string, just assuming 2.0 should be fine though.
|
||||||
message(WARNING "Could not determine ILMBase library version, assuming 2.0.")
|
message(WARNING "Could not determine ILMBase library version, assuming 2.0.")
|
||||||
set("OPENEXR_VERSION" "2.0" CACHE STRING "Version of OpenEXR lib")
|
set("OPENEXR_VERSION" "2.0" CACHE STRING "Version of OpenEXR lib")
|
||||||
endif()
|
endif()
|
||||||
|
@@ -6,7 +6,7 @@
|
|||||||
# basename_LIBRARY_RELEASE is defined, basename_LIBRARY, basename_LIBRARY_DEBUG,
|
# basename_LIBRARY_RELEASE is defined, basename_LIBRARY, basename_LIBRARY_DEBUG,
|
||||||
# and basename_LIBRARY_RELEASE will be set to the release value. If only
|
# and basename_LIBRARY_RELEASE will be set to the release value. If only
|
||||||
# basename_LIBRARY_DEBUG is defined, then basename_LIBRARY,
|
# basename_LIBRARY_DEBUG is defined, then basename_LIBRARY,
|
||||||
# basename_LIBRARY_DEBUG and basename_LIBRARY_RELEASE will take the debug value.
|
# basename_LIBRARY_DEBUG and basename_LIBRARY_RELEASE will take the debug value.
|
||||||
#
|
#
|
||||||
# If the generator supports configuration types, then basename_LIBRARY and
|
# If the generator supports configuration types, then basename_LIBRARY and
|
||||||
# basename_LIBRARIES will be set with debug and optimized flags specifying the
|
# basename_LIBRARIES will be set with debug and optimized flags specifying the
|
||||||
@@ -53,10 +53,10 @@ macro( select_library_configurations basename )
|
|||||||
# if the generator supports configuration types or CMAKE_BUILD_TYPE
|
# if the generator supports configuration types or CMAKE_BUILD_TYPE
|
||||||
# is set, then set optimized and debug options.
|
# is set, then set optimized and debug options.
|
||||||
if( CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE )
|
if( CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE )
|
||||||
set( ${basename}_LIBRARY
|
set( ${basename}_LIBRARY
|
||||||
optimized ${${basename}_LIBRARY_RELEASE}
|
optimized ${${basename}_LIBRARY_RELEASE}
|
||||||
debug ${${basename}_LIBRARY_DEBUG} )
|
debug ${${basename}_LIBRARY_DEBUG} )
|
||||||
set( ${basename}_LIBRARIES
|
set( ${basename}_LIBRARIES
|
||||||
optimized ${${basename}_LIBRARY_RELEASE}
|
optimized ${${basename}_LIBRARY_RELEASE}
|
||||||
debug ${${basename}_LIBRARY_DEBUG} )
|
debug ${${basename}_LIBRARY_DEBUG} )
|
||||||
else( CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE )
|
else( CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE )
|
||||||
@@ -67,15 +67,16 @@ macro( select_library_configurations basename )
|
|||||||
endif( CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE )
|
endif( CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE )
|
||||||
endif( ${basename}_LIBRARY_DEBUG AND ${basename}_LIBRARY_RELEASE )
|
endif( ${basename}_LIBRARY_DEBUG AND ${basename}_LIBRARY_RELEASE )
|
||||||
|
|
||||||
set( ${basename}_LIBRARY ${${basename}_LIBRARY} CACHE FILEPATH
|
set( ${basename}_LIBRARY ${${basename}_LIBRARY} CACHE FILEPATH
|
||||||
"The ${basename} library" )
|
"The ${basename} library" )
|
||||||
|
|
||||||
if( ${basename}_LIBRARY )
|
if( ${basename}_LIBRARY )
|
||||||
set( ${basename}_FOUND TRUE )
|
set( ${basename}_FOUND TRUE )
|
||||||
endif( ${basename}_LIBRARY )
|
endif( ${basename}_LIBRARY )
|
||||||
|
|
||||||
mark_as_advanced( ${basename}_LIBRARY
|
mark_as_advanced( ${basename}_LIBRARY
|
||||||
${basename}_LIBRARY_RELEASE
|
${basename}_LIBRARY_RELEASE
|
||||||
${basename}_LIBRARY_DEBUG
|
${basename}_LIBRARY_DEBUG
|
||||||
)
|
)
|
||||||
endmacro( select_library_configurations )
|
endmacro( select_library_configurations )
|
||||||
|
|
||||||
|
@@ -1,13 +0,0 @@
|
|||||||
diff -Naur external_openal_original/CMakeLists.txt external_openal/CMakeLists.txt
|
|
||||||
--- external_openal_original/CMakeLists.txt 2016-01-24 20:12:39 -0700
|
|
||||||
+++ external_openal/CMakeLists.txt 2018-06-02 12:16:52 -0600
|
|
||||||
@@ -885,7 +885,8 @@
|
|
||||||
OPTION(ALSOFT_REQUIRE_MMDEVAPI "Require MMDevApi backend" OFF)
|
|
||||||
IF(HAVE_WINDOWS_H)
|
|
||||||
# Check MMSystem backend
|
|
||||||
- CHECK_INCLUDE_FILES("windows.h;mmsystem.h" HAVE_MMSYSTEM_H -D_WIN32_WINNT=0x0502)
|
|
||||||
+ set(CMAKE_REQUIRED_FLAGS "-D_WIN32_WINNT=0x0502")
|
|
||||||
+ CHECK_INCLUDE_FILES("windows.h;mmsystem.h" HAVE_MMSYSTEM_H)
|
|
||||||
IF(HAVE_MMSYSTEM_H)
|
|
||||||
CHECK_SHARED_FUNCTION_EXISTS(waveOutOpen "windows.h;mmsystem.h" winmm "" HAVE_LIBWINMM)
|
|
||||||
IF(HAVE_LIBWINMM)
|
|
@@ -10,8 +10,8 @@ diff -Naur osl/src/external_osl/src/cmake/flexbison.cmake osl_bak/src/external_o
|
|||||||
MAIN_DEPENDENCY ${flexsrc}
|
MAIN_DEPENDENCY ${flexsrc}
|
||||||
DEPENDS ${${compiler_headers}}
|
DEPENDS ${${compiler_headers}}
|
||||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} )
|
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} )
|
||||||
--- osl/src/external_osl/src/include/OSL/oslconfig.h 2016-10-31 16:48:19 -0600
|
--- a/src/include/OSL/oslconfig.h 2016-10-31 16:48:19 -0600
|
||||||
+++ osl/src/external_osl/src/include/OSL/oslconfig.h 2018-05-27 11:18:08 -0600
|
+++ b/src/include/OSL/oslconfig.h 2018-05-27 11:18:08 -0600
|
||||||
@@ -44,12 +44,18 @@
|
@@ -44,12 +44,18 @@
|
||||||
// same if another packages is compiling against OSL and using these headers
|
// same if another packages is compiling against OSL and using these headers
|
||||||
// (OSL may be C++11 but the client package may be older, or vice versa --
|
// (OSL may be C++11 but the client package may be older, or vice versa --
|
||||||
|
@@ -14,18 +14,10 @@ if NOT "%1" == "" (
|
|||||||
set BuildDir=VS14
|
set BuildDir=VS14
|
||||||
goto par2
|
goto par2
|
||||||
)
|
)
|
||||||
if "%1" == "2017" (
|
|
||||||
echo "Building for VS2017"
|
|
||||||
set VSVER=15.0
|
|
||||||
set VSVER_SHORT=15
|
|
||||||
set BuildDir=VS15
|
|
||||||
goto par2
|
|
||||||
)
|
|
||||||
|
|
||||||
)
|
)
|
||||||
:usage
|
:usage
|
||||||
|
|
||||||
Echo Usage build_deps 2013/2015/2017 x64/x86
|
Echo Usage build_deps 2013/2015 x64/x86
|
||||||
goto exit
|
goto exit
|
||||||
:par2
|
:par2
|
||||||
if NOT "%2" == "" (
|
if NOT "%2" == "" (
|
||||||
@@ -39,10 +31,6 @@ if NOT "%2" == "" (
|
|||||||
if "%1" == "2015" (
|
if "%1" == "2015" (
|
||||||
set CMAKE_BUILDER=Visual Studio 14 2015
|
set CMAKE_BUILDER=Visual Studio 14 2015
|
||||||
)
|
)
|
||||||
if "%1" == "2017" (
|
|
||||||
set CMAKE_BUILDER=Visual Studio 15 2017
|
|
||||||
)
|
|
||||||
|
|
||||||
goto start
|
goto start
|
||||||
)
|
)
|
||||||
if "%2" == "x64" (
|
if "%2" == "x64" (
|
||||||
@@ -55,10 +43,6 @@ if NOT "%2" == "" (
|
|||||||
if "%1" == "2015" (
|
if "%1" == "2015" (
|
||||||
set CMAKE_BUILDER=Visual Studio 14 2015 Win64
|
set CMAKE_BUILDER=Visual Studio 14 2015 Win64
|
||||||
)
|
)
|
||||||
if "%1" == "2017" (
|
|
||||||
set CMAKE_BUILDER=Visual Studio 15 2017 Win64
|
|
||||||
)
|
|
||||||
|
|
||||||
goto start
|
goto start
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
@@ -77,13 +77,7 @@ if 'cmake' in builder:
|
|||||||
# cmake_extra_options.append('-DCUDA_NVCC_EXECUTABLE=/usr/local/cuda-hack/nvcc')
|
# cmake_extra_options.append('-DCUDA_NVCC_EXECUTABLE=/usr/local/cuda-hack/nvcc')
|
||||||
|
|
||||||
elif builder.startswith('win'):
|
elif builder.startswith('win'):
|
||||||
if builder.endswith('_vs2017'):
|
if builder.endswith('_vc2015'):
|
||||||
if builder.startswith('win64'):
|
|
||||||
cmake_options.extend(['-G', 'Visual Studio 15 2017 Win64'])
|
|
||||||
elif builder.startswith('win32'):
|
|
||||||
bits = 32
|
|
||||||
cmake_options.extend(['-G', 'Visual Studio 15 2017'])
|
|
||||||
elif builder.endswith('_vc2015'):
|
|
||||||
if builder.startswith('win64'):
|
if builder.startswith('win64'):
|
||||||
cmake_options.extend(['-G', 'Visual Studio 14 2015 Win64'])
|
cmake_options.extend(['-G', 'Visual Studio 14 2015 Win64'])
|
||||||
elif builder.startswith('win32'):
|
elif builder.startswith('win32'):
|
||||||
|
@@ -51,7 +51,7 @@ FIND_LIBRARY(ALEMBIC_LIBRARY
|
|||||||
lib64 lib lib/static
|
lib64 lib lib/static
|
||||||
)
|
)
|
||||||
|
|
||||||
# handle the QUIETLY and REQUIRED arguments and set ALEMBIC_FOUND to TRUE if
|
# handle the QUIETLY and REQUIRED arguments and set ALEMBIC_FOUND to TRUE if
|
||||||
# all listed variables are TRUE
|
# all listed variables are TRUE
|
||||||
INCLUDE(FindPackageHandleStandardArgs)
|
INCLUDE(FindPackageHandleStandardArgs)
|
||||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(ALEMBIC DEFAULT_MSG ALEMBIC_LIBRARY ALEMBIC_INCLUDE_DIR)
|
FIND_PACKAGE_HANDLE_STANDARD_ARGS(ALEMBIC DEFAULT_MSG ALEMBIC_LIBRARY ALEMBIC_INCLUDE_DIR)
|
||||||
|
@@ -40,7 +40,7 @@ FIND_PATH(EIGEN3_INCLUDE_DIR
|
|||||||
include/eigen3
|
include/eigen3
|
||||||
)
|
)
|
||||||
|
|
||||||
# handle the QUIETLY and REQUIRED arguments and set EIGEN3_FOUND to TRUE if
|
# handle the QUIETLY and REQUIRED arguments and set EIGEN3_FOUND to TRUE if
|
||||||
# all listed variables are TRUE
|
# all listed variables are TRUE
|
||||||
INCLUDE(FindPackageHandleStandardArgs)
|
INCLUDE(FindPackageHandleStandardArgs)
|
||||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(Eigen3 DEFAULT_MSG
|
FIND_PACKAGE_HANDLE_STANDARD_ARGS(Eigen3 DEFAULT_MSG
|
||||||
|
@@ -52,7 +52,7 @@ FIND_LIBRARY(FFTW3_LIBRARY
|
|||||||
lib64 lib
|
lib64 lib
|
||||||
)
|
)
|
||||||
|
|
||||||
# handle the QUIETLY and REQUIRED arguments and set FFTW3_FOUND to TRUE if
|
# handle the QUIETLY and REQUIRED arguments and set FFTW3_FOUND to TRUE if
|
||||||
# all listed variables are TRUE
|
# all listed variables are TRUE
|
||||||
INCLUDE(FindPackageHandleStandardArgs)
|
INCLUDE(FindPackageHandleStandardArgs)
|
||||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(Fftw3 DEFAULT_MSG
|
FIND_PACKAGE_HANDLE_STANDARD_ARGS(Fftw3 DEFAULT_MSG
|
||||||
|
@@ -49,7 +49,7 @@ FIND_LIBRARY(GLEW_LIBRARY
|
|||||||
lib64 lib
|
lib64 lib
|
||||||
)
|
)
|
||||||
|
|
||||||
# handle the QUIETLY and REQUIRED arguments and set GLEW_FOUND to TRUE if
|
# handle the QUIETLY and REQUIRED arguments and set GLEW_FOUND to TRUE if
|
||||||
# all listed variables are TRUE
|
# all listed variables are TRUE
|
||||||
INCLUDE(FindPackageHandleStandardArgs)
|
INCLUDE(FindPackageHandleStandardArgs)
|
||||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(Glew DEFAULT_MSG
|
FIND_PACKAGE_HANDLE_STANDARD_ARGS(Glew DEFAULT_MSG
|
||||||
|
@@ -115,7 +115,7 @@ if(Boost_USE_STATIC_LIBS)
|
|||||||
set(CMAKE_FIND_LIBRARY_SUFFIXES ${_icu_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES})
|
set(CMAKE_FIND_LIBRARY_SUFFIXES ${_icu_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# handle the QUIETLY and REQUIRED arguments and set ICU_FOUND to TRUE if
|
# handle the QUIETLY and REQUIRED arguments and set ICU_FOUND to TRUE if
|
||||||
# all listed variables are TRUE
|
# all listed variables are TRUE
|
||||||
INCLUDE(FindPackageHandleStandardArgs)
|
INCLUDE(FindPackageHandleStandardArgs)
|
||||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(Icu DEFAULT_MSG
|
FIND_PACKAGE_HANDLE_STANDARD_ARGS(Icu DEFAULT_MSG
|
||||||
|
@@ -52,7 +52,7 @@ FIND_LIBRARY(JACK_LIBRARY
|
|||||||
lib64 lib
|
lib64 lib
|
||||||
)
|
)
|
||||||
|
|
||||||
# handle the QUIETLY and REQUIRED arguments and set JACK_FOUND to TRUE if
|
# handle the QUIETLY and REQUIRED arguments and set JACK_FOUND to TRUE if
|
||||||
# all listed variables are TRUE
|
# all listed variables are TRUE
|
||||||
INCLUDE(FindPackageHandleStandardArgs)
|
INCLUDE(FindPackageHandleStandardArgs)
|
||||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(Jack DEFAULT_MSG
|
FIND_PACKAGE_HANDLE_STANDARD_ARGS(Jack DEFAULT_MSG
|
||||||
|
@@ -53,7 +53,7 @@ FIND_LIBRARY(JEMALLOC_LIBRARY
|
|||||||
lib64 lib
|
lib64 lib
|
||||||
)
|
)
|
||||||
|
|
||||||
# handle the QUIETLY and REQUIRED arguments and set JEMALLOC_FOUND to TRUE if
|
# handle the QUIETLY and REQUIRED arguments and set JEMALLOC_FOUND to TRUE if
|
||||||
# all listed variables are TRUE
|
# all listed variables are TRUE
|
||||||
INCLUDE(FindPackageHandleStandardArgs)
|
INCLUDE(FindPackageHandleStandardArgs)
|
||||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(JeMalloc DEFAULT_MSG
|
FIND_PACKAGE_HANDLE_STANDARD_ARGS(JeMalloc DEFAULT_MSG
|
||||||
|
@@ -93,3 +93,4 @@ FIND_PACKAGE_HANDLE_STANDARD_ARGS(LLVM DEFAULT_MSG
|
|||||||
MARK_AS_ADVANCED(
|
MARK_AS_ADVANCED(
|
||||||
LLVM_LIBRARY
|
LLVM_LIBRARY
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@@ -50,7 +50,7 @@ FIND_LIBRARY(LZO_LIBRARY
|
|||||||
lib64 lib
|
lib64 lib
|
||||||
)
|
)
|
||||||
|
|
||||||
# handle the QUIETLY and REQUIRED arguments and set LZO_FOUND to TRUE if
|
# handle the QUIETLY and REQUIRED arguments and set LZO_FOUND to TRUE if
|
||||||
# all listed variables are TRUE
|
# all listed variables are TRUE
|
||||||
INCLUDE(FindPackageHandleStandardArgs)
|
INCLUDE(FindPackageHandleStandardArgs)
|
||||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(LZO DEFAULT_MSG
|
FIND_PACKAGE_HANDLE_STANDARD_ARGS(LZO DEFAULT_MSG
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
# - Find OpenCOLLADA library
|
# - Find OpenCOLLADA library
|
||||||
# Find the native OpenCOLLADA includes and library
|
# Find the native OpenCOLLADA includes and library
|
||||||
# This module defines
|
# This module defines
|
||||||
# OPENCOLLADA_INCLUDE_DIRS, where to find COLLADABaseUtils/ and
|
# OPENCOLLADA_INCLUDE_DIRS, where to find COLLADABaseUtils/ and
|
||||||
# COLLADAFramework/, Set when OPENCOLLADA_INCLUDE_DIR is found.
|
# COLLADAFramework/, Set when OPENCOLLADA_INCLUDE_DIR is found.
|
||||||
# OPENCOLLADA_LIBRARIES, libraries to link against to use OpenCOLLADA.
|
# OPENCOLLADA_LIBRARIES, libraries to link against to use OpenCOLLADA.
|
||||||
# OPENCOLLADA_ROOT_DIR, The base directory to search for OpenCOLLADA.
|
# OPENCOLLADA_ROOT_DIR, The base directory to search for OpenCOLLADA.
|
||||||
@@ -129,7 +129,7 @@ FOREACH(COMPONENT ${_opencollada_FIND_STATIC_COMPONENTS})
|
|||||||
ENDFOREACH()
|
ENDFOREACH()
|
||||||
|
|
||||||
|
|
||||||
# handle the QUIETLY and REQUIRED arguments and set OPENCOLLADA_FOUND to TRUE if
|
# handle the QUIETLY and REQUIRED arguments and set OPENCOLLADA_FOUND to TRUE if
|
||||||
# all listed variables are TRUE
|
# all listed variables are TRUE
|
||||||
INCLUDE(FindPackageHandleStandardArgs)
|
INCLUDE(FindPackageHandleStandardArgs)
|
||||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(OpenCOLLADA DEFAULT_MSG
|
FIND_PACKAGE_HANDLE_STANDARD_ARGS(OpenCOLLADA DEFAULT_MSG
|
||||||
|
@@ -68,7 +68,7 @@ FOREACH(COMPONENT ${_opencolorio_FIND_COMPONENTS})
|
|||||||
ENDFOREACH()
|
ENDFOREACH()
|
||||||
|
|
||||||
|
|
||||||
# handle the QUIETLY and REQUIRED arguments and set OPENCOLORIO_FOUND to TRUE if
|
# handle the QUIETLY and REQUIRED arguments and set OPENCOLORIO_FOUND to TRUE if
|
||||||
# all listed variables are TRUE
|
# all listed variables are TRUE
|
||||||
INCLUDE(FindPackageHandleStandardArgs)
|
INCLUDE(FindPackageHandleStandardArgs)
|
||||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(OpenColorIO DEFAULT_MSG
|
FIND_PACKAGE_HANDLE_STANDARD_ARGS(OpenColorIO DEFAULT_MSG
|
||||||
|
@@ -106,7 +106,7 @@ FOREACH(COMPONENT ${_openexr_FIND_COMPONENTS})
|
|||||||
|
|
||||||
FIND_LIBRARY(OPENEXR_${UPPERCOMPONENT}_LIBRARY
|
FIND_LIBRARY(OPENEXR_${UPPERCOMPONENT}_LIBRARY
|
||||||
NAMES
|
NAMES
|
||||||
${COMPONENT}-${_openexr_libs_ver} ${COMPONENT}
|
${COMPONENT}-${_openexr_libs_ver} ${COMPONENT}
|
||||||
HINTS
|
HINTS
|
||||||
${_openexr_SEARCH_DIRS}
|
${_openexr_SEARCH_DIRS}
|
||||||
PATH_SUFFIXES
|
PATH_SUFFIXES
|
||||||
@@ -117,7 +117,7 @@ ENDFOREACH()
|
|||||||
|
|
||||||
UNSET(_openexr_libs_ver)
|
UNSET(_openexr_libs_ver)
|
||||||
|
|
||||||
# handle the QUIETLY and REQUIRED arguments and set OPENEXR_FOUND to TRUE if
|
# handle the QUIETLY and REQUIRED arguments and set OPENEXR_FOUND to TRUE if
|
||||||
# all listed variables are TRUE
|
# all listed variables are TRUE
|
||||||
INCLUDE(FindPackageHandleStandardArgs)
|
INCLUDE(FindPackageHandleStandardArgs)
|
||||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(OpenEXR DEFAULT_MSG
|
FIND_PACKAGE_HANDLE_STANDARD_ARGS(OpenEXR DEFAULT_MSG
|
||||||
|
@@ -64,7 +64,7 @@ FIND_FILE(OPENIMAGEIO_IDIFF
|
|||||||
bin
|
bin
|
||||||
)
|
)
|
||||||
|
|
||||||
# handle the QUIETLY and REQUIRED arguments and set OPENIMAGEIO_FOUND to TRUE if
|
# handle the QUIETLY and REQUIRED arguments and set OPENIMAGEIO_FOUND to TRUE if
|
||||||
# all listed variables are TRUE
|
# all listed variables are TRUE
|
||||||
INCLUDE(FindPackageHandleStandardArgs)
|
INCLUDE(FindPackageHandleStandardArgs)
|
||||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(OpenImageIO DEFAULT_MSG
|
FIND_PACKAGE_HANDLE_STANDARD_ARGS(OpenImageIO DEFAULT_MSG
|
||||||
|
@@ -53,7 +53,7 @@ FIND_LIBRARY(OPENJPEG_LIBRARY
|
|||||||
lib64 lib
|
lib64 lib
|
||||||
)
|
)
|
||||||
|
|
||||||
# handle the QUIETLY and REQUIRED arguments and set OPENJPEG_FOUND to TRUE if
|
# handle the QUIETLY and REQUIRED arguments and set OPENJPEG_FOUND to TRUE if
|
||||||
# all listed variables are TRUE
|
# all listed variables are TRUE
|
||||||
INCLUDE(FindPackageHandleStandardArgs)
|
INCLUDE(FindPackageHandleStandardArgs)
|
||||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(OpenJPEG DEFAULT_MSG
|
FIND_PACKAGE_HANDLE_STANDARD_ARGS(OpenJPEG DEFAULT_MSG
|
||||||
|
@@ -50,7 +50,7 @@ FIND_LIBRARY(PCRE_LIBRARY
|
|||||||
lib64 lib
|
lib64 lib
|
||||||
)
|
)
|
||||||
|
|
||||||
# handle the QUIETLY and REQUIRED arguments and set PCRE_FOUND to TRUE if
|
# handle the QUIETLY and REQUIRED arguments and set PCRE_FOUND to TRUE if
|
||||||
# all listed variables are TRUE
|
# all listed variables are TRUE
|
||||||
INCLUDE(FindPackageHandleStandardArgs)
|
INCLUDE(FindPackageHandleStandardArgs)
|
||||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(PCRE DEFAULT_MSG
|
FIND_PACKAGE_HANDLE_STANDARD_ARGS(PCRE DEFAULT_MSG
|
||||||
|
@@ -53,7 +53,7 @@ FIND_LIBRARY(PUGIXML_LIBRARY
|
|||||||
lib64 lib
|
lib64 lib
|
||||||
)
|
)
|
||||||
|
|
||||||
# handle the QUIETLY and REQUIRED arguments and set PUGIXML_FOUND to TRUE if
|
# handle the QUIETLY and REQUIRED arguments and set PUGIXML_FOUND to TRUE if
|
||||||
# all listed variables are TRUE
|
# all listed variables are TRUE
|
||||||
INCLUDE(FindPackageHandleStandardArgs)
|
INCLUDE(FindPackageHandleStandardArgs)
|
||||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(PUGIXML DEFAULT_MSG
|
FIND_PACKAGE_HANDLE_STANDARD_ARGS(PUGIXML DEFAULT_MSG
|
||||||
|
@@ -175,7 +175,7 @@ UNSET(_IS_INC_CONF_DEF)
|
|||||||
UNSET(_IS_LIB_DEF)
|
UNSET(_IS_LIB_DEF)
|
||||||
UNSET(_IS_LIB_PATH_DEF)
|
UNSET(_IS_LIB_PATH_DEF)
|
||||||
|
|
||||||
# handle the QUIETLY and REQUIRED arguments and SET PYTHONLIBSUNIX_FOUND to TRUE IF
|
# handle the QUIETLY and REQUIRED arguments and SET PYTHONLIBSUNIX_FOUND to TRUE IF
|
||||||
# all listed variables are TRUE
|
# all listed variables are TRUE
|
||||||
INCLUDE(FindPackageHandleStandardArgs)
|
INCLUDE(FindPackageHandleStandardArgs)
|
||||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(PythonLibsUnix DEFAULT_MSG
|
FIND_PACKAGE_HANDLE_STANDARD_ARGS(PythonLibsUnix DEFAULT_MSG
|
||||||
|
@@ -50,7 +50,7 @@ FIND_LIBRARY(LIBSNDFILE_LIBRARY
|
|||||||
lib64 lib
|
lib64 lib
|
||||||
)
|
)
|
||||||
|
|
||||||
# handle the QUIETLY and REQUIRED arguments and set LIBSNDFILE_FOUND to TRUE if
|
# handle the QUIETLY and REQUIRED arguments and set LIBSNDFILE_FOUND to TRUE if
|
||||||
# all listed variables are TRUE
|
# all listed variables are TRUE
|
||||||
INCLUDE(FindPackageHandleStandardArgs)
|
INCLUDE(FindPackageHandleStandardArgs)
|
||||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(SndFile DEFAULT_MSG
|
FIND_PACKAGE_HANDLE_STANDARD_ARGS(SndFile DEFAULT_MSG
|
||||||
|
@@ -52,7 +52,7 @@ FIND_LIBRARY(SPACENAV_LIBRARY
|
|||||||
lib64 lib
|
lib64 lib
|
||||||
)
|
)
|
||||||
|
|
||||||
# handle the QUIETLY and REQUIRED arguments and set SPACENAV_FOUND to TRUE if
|
# handle the QUIETLY and REQUIRED arguments and set SPACENAV_FOUND to TRUE if
|
||||||
# all listed variables are TRUE
|
# all listed variables are TRUE
|
||||||
INCLUDE(FindPackageHandleStandardArgs)
|
INCLUDE(FindPackageHandleStandardArgs)
|
||||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(Spacenav DEFAULT_MSG
|
FIND_PACKAGE_HANDLE_STANDARD_ARGS(Spacenav DEFAULT_MSG
|
||||||
|
@@ -50,7 +50,7 @@ FIND_LIBRARY(XML2_LIBRARY
|
|||||||
lib64 lib
|
lib64 lib
|
||||||
)
|
)
|
||||||
|
|
||||||
# handle the QUIETLY and REQUIRED arguments and set XML2_FOUND to TRUE if
|
# handle the QUIETLY and REQUIRED arguments and set XML2_FOUND to TRUE if
|
||||||
# all listed variables are TRUE
|
# all listed variables are TRUE
|
||||||
INCLUDE(FindPackageHandleStandardArgs)
|
INCLUDE(FindPackageHandleStandardArgs)
|
||||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(XML2 DEFAULT_MSG
|
FIND_PACKAGE_HANDLE_STANDARD_ARGS(XML2 DEFAULT_MSG
|
||||||
|
@@ -13,7 +13,7 @@ if(NOT DEFINED RPMBUILD)
|
|||||||
|
|
||||||
if(RPMBUILD)
|
if(RPMBUILD)
|
||||||
message(STATUS "RPM Build Found: ${RPMBUILD}")
|
message(STATUS "RPM Build Found: ${RPMBUILD}")
|
||||||
else()
|
else()
|
||||||
message(STATUS "RPM Build Not Found (rpmbuild). RPM generation will not be available")
|
message(STATUS "RPM Build Not Found (rpmbuild). RPM generation will not be available")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
@@ -21,6 +21,6 @@ endif()
|
|||||||
|
|
||||||
if(RPMBUILD)
|
if(RPMBUILD)
|
||||||
set(RPMBUILD_FOUND TRUE)
|
set(RPMBUILD_FOUND TRUE)
|
||||||
else()
|
else()
|
||||||
set(RPMBUILD_FOUND FALSE)
|
set(RPMBUILD_FOUND FALSE)
|
||||||
endif()
|
endif()
|
@@ -1,7 +0,0 @@
|
|||||||
include("${CMAKE_CURRENT_LIST_DIR}/blender_lite.cmake")
|
|
||||||
|
|
||||||
set(WITH_PYTHON_INSTALL_NUMPY OFF CACHE BOOL "" FORCE)
|
|
||||||
set(WITH_SYSTEM_GLEW OFF CACHE BOOL "" FORCE)
|
|
||||||
# Brecht says: KEEP THIS ENABLED. *SOMETHING* breaks otherwise.
|
|
||||||
# Something == DPI. Go figure.
|
|
||||||
set(WITH_GHOST_XDND ON CACHE BOOL "" FORCE)
|
|
@@ -5,7 +5,7 @@
|
|||||||
# cmake -C../blender/build_files/cmake/config/blender_headless.cmake ../blender
|
# cmake -C../blender/build_files/cmake/config/blender_headless.cmake ../blender
|
||||||
#
|
#
|
||||||
|
|
||||||
set(WITH_HEADLESS ON CACHE BOOL "" FORCE)
|
set(WITH_HEADLESS ON CACHE BOOL "" FORCE)
|
||||||
|
|
||||||
# disable audio, its possible some devs may want this but for now disable
|
# disable audio, its possible some devs may want this but for now disable
|
||||||
# so the python module doesnt hold the audio device and loads quickly.
|
# so the python module doesnt hold the audio device and loads quickly.
|
||||||
|
@@ -51,7 +51,7 @@ endmacro()
|
|||||||
function(list_assert_duplicates
|
function(list_assert_duplicates
|
||||||
list_id
|
list_id
|
||||||
)
|
)
|
||||||
|
|
||||||
# message(STATUS "list data: ${list_id}")
|
# message(STATUS "list data: ${list_id}")
|
||||||
|
|
||||||
list(LENGTH list_id _len_before)
|
list(LENGTH list_id _len_before)
|
||||||
@@ -242,7 +242,7 @@ function(blender_add_lib__impl
|
|||||||
# listed is helpful for IDE's (QtCreator/MSVC)
|
# listed is helpful for IDE's (QtCreator/MSVC)
|
||||||
blender_source_group("${sources}")
|
blender_source_group("${sources}")
|
||||||
|
|
||||||
#if enabled, set the FOLDER property for visual studio projects
|
#if enabled, set the FOLDER property for visual studio projects
|
||||||
if(WINDOWS_USE_VISUAL_STUDIO_FOLDERS)
|
if(WINDOWS_USE_VISUAL_STUDIO_FOLDERS)
|
||||||
get_filename_component(FolderDir ${CMAKE_CURRENT_SOURCE_DIR} DIRECTORY)
|
get_filename_component(FolderDir ${CMAKE_CURRENT_SOURCE_DIR} DIRECTORY)
|
||||||
string(REPLACE ${CMAKE_SOURCE_DIR} "" FolderDir ${FolderDir})
|
string(REPLACE ${CMAKE_SOURCE_DIR} "" FolderDir ${FolderDir})
|
||||||
@@ -574,7 +574,6 @@ function(SETUP_BLENDER_SORTED_LIBS)
|
|||||||
|
|
||||||
bf_editor_space_api
|
bf_editor_space_api
|
||||||
bf_editor_space_action
|
bf_editor_space_action
|
||||||
bf_editor_space_benchmark
|
|
||||||
bf_editor_space_buttons
|
bf_editor_space_buttons
|
||||||
bf_editor_space_console
|
bf_editor_space_console
|
||||||
bf_editor_space_file
|
bf_editor_space_file
|
||||||
@@ -599,12 +598,12 @@ function(SETUP_BLENDER_SORTED_LIBS)
|
|||||||
bf_editor_util
|
bf_editor_util
|
||||||
bf_editor_uvedit
|
bf_editor_uvedit
|
||||||
bf_editor_curve
|
bf_editor_curve
|
||||||
|
bf_editor_gpencil
|
||||||
bf_editor_interface
|
bf_editor_interface
|
||||||
bf_editor_gizmo_library
|
bf_editor_manipulator_library
|
||||||
bf_editor_mesh
|
bf_editor_mesh
|
||||||
bf_editor_metaball
|
bf_editor_metaball
|
||||||
bf_editor_object
|
bf_editor_object
|
||||||
bf_editor_gpencil
|
|
||||||
bf_editor_lattice
|
bf_editor_lattice
|
||||||
bf_editor_armature
|
bf_editor_armature
|
||||||
bf_editor_physics
|
bf_editor_physics
|
||||||
@@ -622,24 +621,21 @@ function(SETUP_BLENDER_SORTED_LIBS)
|
|||||||
bf_python
|
bf_python
|
||||||
bf_python_ext
|
bf_python_ext
|
||||||
bf_python_mathutils
|
bf_python_mathutils
|
||||||
bf_python_gpu
|
bf_python_gawain
|
||||||
bf_python_bmesh
|
bf_python_bmesh
|
||||||
bf_freestyle
|
bf_freestyle
|
||||||
bf_ikplugin
|
bf_ikplugin
|
||||||
bf_modifiers
|
bf_modifiers
|
||||||
bf_gpencil_modifiers
|
|
||||||
bf_alembic
|
bf_alembic
|
||||||
bf_bmesh
|
bf_bmesh
|
||||||
bf_gpu
|
bf_gpu
|
||||||
bf_draw
|
bf_draw
|
||||||
bf_blenloader
|
bf_blenloader
|
||||||
bf_blenkernel
|
bf_blenkernel
|
||||||
bf_shader_fx
|
|
||||||
bf_gpencil_modifiers
|
|
||||||
bf_physics
|
bf_physics
|
||||||
bf_nodes
|
bf_nodes
|
||||||
bf_rna
|
bf_rna
|
||||||
bf_editor_gizmo_library # rna -> gizmo bad-level calls
|
bf_editor_manipulator_library # rna -> manipulator bad-level calls
|
||||||
bf_python
|
bf_python
|
||||||
bf_imbuf
|
bf_imbuf
|
||||||
bf_blenlib
|
bf_blenlib
|
||||||
@@ -678,9 +674,7 @@ function(SETUP_BLENDER_SORTED_LIBS)
|
|||||||
extern_openjpeg
|
extern_openjpeg
|
||||||
ge_videotex
|
ge_videotex
|
||||||
bf_dna
|
bf_dna
|
||||||
|
|
||||||
bf_blenfont
|
bf_blenfont
|
||||||
bf_gpu # duplicate for blenfont
|
|
||||||
bf_blentranslation
|
bf_blentranslation
|
||||||
bf_intern_audaspace
|
bf_intern_audaspace
|
||||||
audaspace
|
audaspace
|
||||||
@@ -878,6 +872,164 @@ macro(message_first_run)
|
|||||||
endif()
|
endif()
|
||||||
endmacro()
|
endmacro()
|
||||||
|
|
||||||
|
macro(TEST_UNORDERED_MAP_SUPPORT)
|
||||||
|
# - Detect unordered_map availability
|
||||||
|
# Test if a valid implementation of unordered_map exists
|
||||||
|
# and define the include path
|
||||||
|
# This module defines
|
||||||
|
# HAVE_UNORDERED_MAP, whether unordered_map implementation was found
|
||||||
|
#
|
||||||
|
# HAVE_STD_UNORDERED_MAP_HEADER, <unordered_map.h> was found
|
||||||
|
# HAVE_UNORDERED_MAP_IN_STD_NAMESPACE, unordered_map is in namespace std
|
||||||
|
# HAVE_UNORDERED_MAP_IN_TR1_NAMESPACE, unordered_map is in namespace std::tr1
|
||||||
|
#
|
||||||
|
# UNORDERED_MAP_INCLUDE_PREFIX, include path prefix for unordered_map, if found
|
||||||
|
# UNORDERED_MAP_NAMESPACE, namespace for unordered_map, if found
|
||||||
|
|
||||||
|
include(CheckIncludeFileCXX)
|
||||||
|
|
||||||
|
# Workaround for newer GCC (6.x+) where C++11 was enabled by default, which lead us
|
||||||
|
# to a situation when there is <unordered_map> include but which can't be used uless
|
||||||
|
# C++11 is enabled.
|
||||||
|
if(CMAKE_COMPILER_IS_GNUCC AND (NOT "${CMAKE_C_COMPILER_VERSION}" VERSION_LESS "6.0") AND (NOT WITH_CXX11))
|
||||||
|
set(HAVE_STD_UNORDERED_MAP_HEADER False)
|
||||||
|
else()
|
||||||
|
CHECK_INCLUDE_FILE_CXX("unordered_map" HAVE_STD_UNORDERED_MAP_HEADER)
|
||||||
|
endif()
|
||||||
|
if(HAVE_STD_UNORDERED_MAP_HEADER)
|
||||||
|
# Even so we've found unordered_map header file it doesn't
|
||||||
|
# mean unordered_map and unordered_set will be declared in
|
||||||
|
# std namespace.
|
||||||
|
#
|
||||||
|
# Namely, MSVC 2008 have unordered_map header which declares
|
||||||
|
# unordered_map class in std::tr1 namespace. In order to support
|
||||||
|
# this, we do extra check to see which exactly namespace is
|
||||||
|
# to be used.
|
||||||
|
|
||||||
|
include(CheckCXXSourceCompiles)
|
||||||
|
CHECK_CXX_SOURCE_COMPILES("#include <unordered_map>
|
||||||
|
int main() {
|
||||||
|
std::unordered_map<int, int> map;
|
||||||
|
return 0;
|
||||||
|
}"
|
||||||
|
HAVE_UNORDERED_MAP_IN_STD_NAMESPACE)
|
||||||
|
if(HAVE_UNORDERED_MAP_IN_STD_NAMESPACE)
|
||||||
|
message_first_run(STATUS "Found unordered_map/set in std namespace.")
|
||||||
|
|
||||||
|
set(HAVE_UNORDERED_MAP "TRUE")
|
||||||
|
set(UNORDERED_MAP_INCLUDE_PREFIX "")
|
||||||
|
set(UNORDERED_MAP_NAMESPACE "std")
|
||||||
|
else()
|
||||||
|
CHECK_CXX_SOURCE_COMPILES("#include <unordered_map>
|
||||||
|
int main() {
|
||||||
|
std::tr1::unordered_map<int, int> map;
|
||||||
|
return 0;
|
||||||
|
}"
|
||||||
|
HAVE_UNORDERED_MAP_IN_TR1_NAMESPACE)
|
||||||
|
if(HAVE_UNORDERED_MAP_IN_TR1_NAMESPACE)
|
||||||
|
message_first_run(STATUS "Found unordered_map/set in std::tr1 namespace.")
|
||||||
|
|
||||||
|
set(HAVE_UNORDERED_MAP "TRUE")
|
||||||
|
set(UNORDERED_MAP_INCLUDE_PREFIX "")
|
||||||
|
set(UNORDERED_MAP_NAMESPACE "std::tr1")
|
||||||
|
else()
|
||||||
|
message_first_run(STATUS "Found <unordered_map> but cannot find either std::unordered_map "
|
||||||
|
"or std::tr1::unordered_map.")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
else()
|
||||||
|
CHECK_INCLUDE_FILE_CXX("tr1/unordered_map" HAVE_UNORDERED_MAP_IN_TR1_NAMESPACE)
|
||||||
|
if(HAVE_UNORDERED_MAP_IN_TR1_NAMESPACE)
|
||||||
|
message_first_run(STATUS "Found unordered_map/set in std::tr1 namespace.")
|
||||||
|
|
||||||
|
set(HAVE_UNORDERED_MAP "TRUE")
|
||||||
|
set(UNORDERED_MAP_INCLUDE_PREFIX "tr1")
|
||||||
|
set(UNORDERED_MAP_NAMESPACE "std::tr1")
|
||||||
|
else()
|
||||||
|
message_first_run(STATUS "Unable to find <unordered_map> or <tr1/unordered_map>. ")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
endmacro()
|
||||||
|
|
||||||
|
macro(TEST_SHARED_PTR_SUPPORT)
|
||||||
|
# This check are coming from Ceres library.
|
||||||
|
#
|
||||||
|
# Find shared pointer header and namespace.
|
||||||
|
#
|
||||||
|
# This module defines the following variables:
|
||||||
|
#
|
||||||
|
# SHARED_PTR_FOUND: TRUE if shared_ptr found.
|
||||||
|
# SHARED_PTR_TR1_MEMORY_HEADER: True if <tr1/memory> header is to be used
|
||||||
|
# for the shared_ptr object, otherwise use <memory>.
|
||||||
|
# SHARED_PTR_TR1_NAMESPACE: TRUE if shared_ptr is defined in std::tr1 namespace,
|
||||||
|
# otherwise it's assumed to be defined in std namespace.
|
||||||
|
|
||||||
|
include(CheckIncludeFileCXX)
|
||||||
|
include(CheckCXXSourceCompiles)
|
||||||
|
set(SHARED_PTR_FOUND FALSE)
|
||||||
|
# Workaround for newer GCC (6.x+) where C++11 was enabled by default, which lead us
|
||||||
|
# to a situation when there is <unordered_map> include but which can't be used uless
|
||||||
|
# C++11 is enabled.
|
||||||
|
if(CMAKE_COMPILER_IS_GNUCC AND (NOT "${CMAKE_C_COMPILER_VERSION}" VERSION_LESS "6.0") AND (NOT WITH_CXX11))
|
||||||
|
set(HAVE_STD_MEMORY_HEADER False)
|
||||||
|
else()
|
||||||
|
CHECK_INCLUDE_FILE_CXX(memory HAVE_STD_MEMORY_HEADER)
|
||||||
|
endif()
|
||||||
|
if(HAVE_STD_MEMORY_HEADER)
|
||||||
|
# Finding the memory header doesn't mean that shared_ptr is in std
|
||||||
|
# namespace.
|
||||||
|
#
|
||||||
|
# In particular, MSVC 2008 has shared_ptr declared in std::tr1. In
|
||||||
|
# order to support this, we do an extra check to see which namespace
|
||||||
|
# should be used.
|
||||||
|
CHECK_CXX_SOURCE_COMPILES("#include <memory>
|
||||||
|
int main() {
|
||||||
|
std::shared_ptr<int> int_ptr;
|
||||||
|
return 0;
|
||||||
|
}"
|
||||||
|
HAVE_SHARED_PTR_IN_STD_NAMESPACE)
|
||||||
|
|
||||||
|
if(HAVE_SHARED_PTR_IN_STD_NAMESPACE)
|
||||||
|
message_first_run("-- Found shared_ptr in std namespace using <memory> header.")
|
||||||
|
set(SHARED_PTR_FOUND TRUE)
|
||||||
|
else()
|
||||||
|
CHECK_CXX_SOURCE_COMPILES("#include <memory>
|
||||||
|
int main() {
|
||||||
|
std::tr1::shared_ptr<int> int_ptr;
|
||||||
|
return 0;
|
||||||
|
}"
|
||||||
|
HAVE_SHARED_PTR_IN_TR1_NAMESPACE)
|
||||||
|
if(HAVE_SHARED_PTR_IN_TR1_NAMESPACE)
|
||||||
|
message_first_run("-- Found shared_ptr in std::tr1 namespace using <memory> header.")
|
||||||
|
set(SHARED_PTR_TR1_NAMESPACE TRUE)
|
||||||
|
set(SHARED_PTR_FOUND TRUE)
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(NOT SHARED_PTR_FOUND)
|
||||||
|
# Further, gcc defines shared_ptr in std::tr1 namespace and
|
||||||
|
# <tr1/memory> is to be included for this. And what makes things
|
||||||
|
# even more tricky is that gcc does have <memory> header, so
|
||||||
|
# all the checks above wouldn't find shared_ptr.
|
||||||
|
CHECK_INCLUDE_FILE_CXX("tr1/memory" HAVE_TR1_MEMORY_HEADER)
|
||||||
|
if(HAVE_TR1_MEMORY_HEADER)
|
||||||
|
CHECK_CXX_SOURCE_COMPILES("#include <tr1/memory>
|
||||||
|
int main() {
|
||||||
|
std::tr1::shared_ptr<int> int_ptr;
|
||||||
|
return 0;
|
||||||
|
}"
|
||||||
|
HAVE_SHARED_PTR_IN_TR1_NAMESPACE_FROM_TR1_MEMORY_HEADER)
|
||||||
|
if(HAVE_SHARED_PTR_IN_TR1_NAMESPACE_FROM_TR1_MEMORY_HEADER)
|
||||||
|
message_first_run("-- Found shared_ptr in std::tr1 namespace using <tr1/memory> header.")
|
||||||
|
set(SHARED_PTR_TR1_MEMORY_HEADER TRUE)
|
||||||
|
set(SHARED_PTR_TR1_NAMESPACE TRUE)
|
||||||
|
set(SHARED_PTR_FOUND TRUE)
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
endmacro()
|
||||||
|
|
||||||
# when we have warnings as errors applied globally this
|
# when we have warnings as errors applied globally this
|
||||||
# needs to be removed for some external libs which we dont maintain.
|
# needs to be removed for some external libs which we dont maintain.
|
||||||
|
|
||||||
@@ -902,19 +1054,13 @@ macro(remove_cc_flag
|
|||||||
|
|
||||||
endmacro()
|
endmacro()
|
||||||
|
|
||||||
macro(add_c_flag
|
macro(add_cc_flag
|
||||||
flag)
|
flag)
|
||||||
|
|
||||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${flag}")
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${flag}")
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${flag}")
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${flag}")
|
||||||
endmacro()
|
endmacro()
|
||||||
|
|
||||||
macro(add_cxx_flag
|
|
||||||
flag)
|
|
||||||
|
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${flag}")
|
|
||||||
endmacro()
|
|
||||||
|
|
||||||
macro(remove_strict_flags)
|
macro(remove_strict_flags)
|
||||||
|
|
||||||
if(CMAKE_COMPILER_IS_GNUCC)
|
if(CMAKE_COMPILER_IS_GNUCC)
|
||||||
@@ -937,8 +1083,7 @@ macro(remove_strict_flags)
|
|||||||
)
|
)
|
||||||
|
|
||||||
# negate flags implied by '-Wall'
|
# negate flags implied by '-Wall'
|
||||||
add_c_flag("${C_REMOVE_STRICT_FLAGS}")
|
add_cc_flag("${CC_REMOVE_STRICT_FLAGS}")
|
||||||
add_cxx_flag("${CXX_REMOVE_STRICT_FLAGS}")
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(CMAKE_C_COMPILER_ID MATCHES "Clang")
|
if(CMAKE_C_COMPILER_ID MATCHES "Clang")
|
||||||
@@ -950,8 +1095,7 @@ macro(remove_strict_flags)
|
|||||||
)
|
)
|
||||||
|
|
||||||
# negate flags implied by '-Wall'
|
# negate flags implied by '-Wall'
|
||||||
add_c_flag("${C_REMOVE_STRICT_FLAGS}")
|
add_cc_flag("${CC_REMOVE_STRICT_FLAGS}")
|
||||||
add_cxx_flag("${CXX_REMOVE_STRICT_FLAGS}")
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(MSVC)
|
if(MSVC)
|
||||||
@@ -981,39 +1125,28 @@ endmacro()
|
|||||||
# note, we can only append flags on a single file so we need to negate the options.
|
# note, we can only append flags on a single file so we need to negate the options.
|
||||||
# at the moment we cant shut up ffmpeg deprecations, so use this, but will
|
# at the moment we cant shut up ffmpeg deprecations, so use this, but will
|
||||||
# probably add more removals here.
|
# probably add more removals here.
|
||||||
macro(remove_strict_c_flags_file
|
macro(remove_strict_flags_file
|
||||||
filenames)
|
filenames)
|
||||||
foreach(_SOURCE ${ARGV})
|
|
||||||
if(CMAKE_COMPILER_IS_GNUCC OR
|
|
||||||
(CMAKE_C_COMPILER_ID MATCHES "Clang"))
|
|
||||||
set_source_files_properties(${_SOURCE}
|
|
||||||
PROPERTIES
|
|
||||||
COMPILE_FLAGS "${C_REMOVE_STRICT_FLAGS}"
|
|
||||||
)
|
|
||||||
endif()
|
|
||||||
if(MSVC)
|
|
||||||
# TODO
|
|
||||||
endif()
|
|
||||||
endforeach()
|
|
||||||
unset(_SOURCE)
|
|
||||||
endmacro()
|
|
||||||
|
|
||||||
macro(remove_strict_cxx_flags_file
|
|
||||||
filenames)
|
|
||||||
remove_strict_c_flags_file(${filenames} ${ARHV})
|
|
||||||
foreach(_SOURCE ${ARGV})
|
foreach(_SOURCE ${ARGV})
|
||||||
|
|
||||||
if(CMAKE_COMPILER_IS_GNUCC OR
|
if(CMAKE_COMPILER_IS_GNUCC OR
|
||||||
(CMAKE_CXX_COMPILER_ID MATCHES "Clang"))
|
(CMAKE_C_COMPILER_ID MATCHES "Clang"))
|
||||||
|
|
||||||
set_source_files_properties(${_SOURCE}
|
set_source_files_properties(${_SOURCE}
|
||||||
PROPERTIES
|
PROPERTIES
|
||||||
COMPILE_FLAGS "${CXX_REMOVE_STRICT_FLAGS}"
|
COMPILE_FLAGS "${CC_REMOVE_STRICT_FLAGS}"
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(MSVC)
|
if(MSVC)
|
||||||
# TODO
|
# TODO
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
endforeach()
|
endforeach()
|
||||||
|
|
||||||
unset(_SOURCE)
|
unset(_SOURCE)
|
||||||
|
|
||||||
endmacro()
|
endmacro()
|
||||||
|
|
||||||
# External libs may need 'signed char' to be default.
|
# External libs may need 'signed char' to be default.
|
||||||
|
@@ -51,9 +51,9 @@ string(REPLACE "/Contents/Developer" "" XCODE_BUNDLE ${XCODE_CHECK}) # truncate
|
|||||||
if(${CMAKE_GENERATOR} MATCHES "Xcode")
|
if(${CMAKE_GENERATOR} MATCHES "Xcode")
|
||||||
|
|
||||||
# earlier xcode has no bundled developer dir, no sense in getting xcode path from
|
# earlier xcode has no bundled developer dir, no sense in getting xcode path from
|
||||||
if(${XCODE_VERSION} VERSION_GREATER 4.2)
|
if(${XCODE_VERSION} VERSION_GREATER 4.2)
|
||||||
# reduce to XCode name without dp extension
|
# reduce to XCode name without dp extension
|
||||||
string(SUBSTRING "${XCODE_CHECK}" 14 6 DP_NAME)
|
string(SUBSTRING "${XCODE_CHECK}" 14 6 DP_NAME)
|
||||||
if(${DP_NAME} MATCHES Xcode5)
|
if(${DP_NAME} MATCHES Xcode5)
|
||||||
set(XCODE_VERSION 5)
|
set(XCODE_VERSION 5)
|
||||||
endif()
|
endif()
|
||||||
@@ -64,7 +64,7 @@ if(${CMAKE_GENERATOR} MATCHES "Xcode")
|
|||||||
message(FATAL_ERROR "Xcode 4.3 and higher must be used with cmake 2.8-8 or higher")
|
message(FATAL_ERROR "Xcode 4.3 and higher must be used with cmake 2.8-8 or higher")
|
||||||
endif()
|
endif()
|
||||||
### end cmake incompatibility with xcode 4.3 and higher ###
|
### end cmake incompatibility with xcode 4.3 and higher ###
|
||||||
|
|
||||||
if(${XCODE_VERSION} VERSION_EQUAL 4 OR ${XCODE_VERSION} VERSION_GREATER 4 AND ${XCODE_VERSION} VERSION_LESS 4.3)
|
if(${XCODE_VERSION} VERSION_EQUAL 4 OR ${XCODE_VERSION} VERSION_GREATER 4 AND ${XCODE_VERSION} VERSION_LESS 4.3)
|
||||||
# Xcode 4 defaults to the Apple LLVM Compiler.
|
# Xcode 4 defaults to the Apple LLVM Compiler.
|
||||||
# Override the default compiler selection because Blender only compiles with gcc up to xcode 4.2
|
# Override the default compiler selection because Blender only compiles with gcc up to xcode 4.2
|
||||||
@@ -85,7 +85,7 @@ if(${XCODE_VERSION} VERSION_LESS 4.3)
|
|||||||
else()
|
else()
|
||||||
# note: xcode-select path could be ambigous,
|
# note: xcode-select path could be ambigous,
|
||||||
# cause /Applications/Xcode.app/Contents/Developer or /Applications/Xcode.app would be allowed
|
# cause /Applications/Xcode.app/Contents/Developer or /Applications/Xcode.app would be allowed
|
||||||
# so i use a selfcomposed bundlepath here
|
# so i use a selfcomposed bundlepath here
|
||||||
set(OSX_SYSROOT_PREFIX ${XCODE_BUNDLE}/Contents/Developer/Platforms/MacOSX.platform)
|
set(OSX_SYSROOT_PREFIX ${XCODE_BUNDLE}/Contents/Developer/Platforms/MacOSX.platform)
|
||||||
message(STATUS "OSX_SYSROOT_PREFIX: " ${OSX_SYSROOT_PREFIX})
|
message(STATUS "OSX_SYSROOT_PREFIX: " ${OSX_SYSROOT_PREFIX})
|
||||||
set(OSX_DEVELOPER_PREFIX /Developer/SDKs/MacOSX${OSX_SYSTEM}.sdk) # use guaranteed existing sdk
|
set(OSX_DEVELOPER_PREFIX /Developer/SDKs/MacOSX${OSX_SYSTEM}.sdk) # use guaranteed existing sdk
|
||||||
@@ -104,7 +104,7 @@ endif()
|
|||||||
# 10.9 is our min. target, if you use higher sdk, weak linking happens
|
# 10.9 is our min. target, if you use higher sdk, weak linking happens
|
||||||
if(CMAKE_OSX_DEPLOYMENT_TARGET)
|
if(CMAKE_OSX_DEPLOYMENT_TARGET)
|
||||||
if(${CMAKE_OSX_DEPLOYMENT_TARGET} VERSION_LESS 10.9)
|
if(${CMAKE_OSX_DEPLOYMENT_TARGET} VERSION_LESS 10.9)
|
||||||
message(STATUS "Setting deployment target to 10.9, lower versions are not supported")
|
message(STATUS "Setting deployment target to 10.9, lower versions are incompatible with WITH_CXX11")
|
||||||
set(CMAKE_OSX_DEPLOYMENT_TARGET "10.9" CACHE STRING "" FORCE)
|
set(CMAKE_OSX_DEPLOYMENT_TARGET "10.9" CACHE STRING "" FORCE)
|
||||||
endif()
|
endif()
|
||||||
else()
|
else()
|
||||||
|
@@ -31,8 +31,7 @@ endif()
|
|||||||
|
|
||||||
if(CMAKE_C_COMPILER_ID MATCHES "Clang")
|
if(CMAKE_C_COMPILER_ID MATCHES "Clang")
|
||||||
set(MSVC_CLANG On)
|
set(MSVC_CLANG On)
|
||||||
set(VC_TOOLS_DIR $ENV{VCToolsRedistDir} CACHE STRING "Location of the msvc redistributables")
|
set(MSVC_REDIST_DIR $ENV{VCToolsRedistDir})
|
||||||
set(MSVC_REDIST_DIR ${VC_TOOLS_DIR})
|
|
||||||
if (DEFINED MSVC_REDIST_DIR)
|
if (DEFINED MSVC_REDIST_DIR)
|
||||||
file(TO_CMAKE_PATH ${MSVC_REDIST_DIR} MSVC_REDIST_DIR)
|
file(TO_CMAKE_PATH ${MSVC_REDIST_DIR} MSVC_REDIST_DIR)
|
||||||
else()
|
else()
|
||||||
@@ -130,7 +129,10 @@ include(InstallRequiredSystemLibraries)
|
|||||||
|
|
||||||
remove_cc_flag("/MDd" "/MD")
|
remove_cc_flag("/MDd" "/MD")
|
||||||
|
|
||||||
if(MSVC_CLANG) # Clangs version of cl doesn't support all flags
|
if(MSVC_CLANG) # Clangs version of cl doesn't support all flags
|
||||||
|
if(NOT WITH_CXX11) # C++11 is on by default in clang-cl and can't be turned off, if c++11 is not enabled in blender repress some c++11 related warnings.
|
||||||
|
set(CXX_WARN_FLAGS "-Wno-inconsistent-missing-override")
|
||||||
|
endif()
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CXX_WARN_FLAGS} /nologo /J /Gd /EHsc -Wno-unused-command-line-argument -Wno-microsoft-enum-forward-reference ")
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CXX_WARN_FLAGS} /nologo /J /Gd /EHsc -Wno-unused-command-line-argument -Wno-microsoft-enum-forward-reference ")
|
||||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /nologo /J /Gd -Wno-unused-command-line-argument -Wno-microsoft-enum-forward-reference")
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /nologo /J /Gd -Wno-unused-command-line-argument -Wno-microsoft-enum-forward-reference")
|
||||||
else()
|
else()
|
||||||
@@ -422,7 +424,7 @@ if(WITH_OPENIMAGEIO)
|
|||||||
set(OIIO_OPTIMIZED optimized ${OPENIMAGEIO_LIBPATH}/OpenImageIO.lib optimized ${OPENIMAGEIO_LIBPATH}/OpenImageIO_Util.lib)
|
set(OIIO_OPTIMIZED optimized ${OPENIMAGEIO_LIBPATH}/OpenImageIO.lib optimized ${OPENIMAGEIO_LIBPATH}/OpenImageIO_Util.lib)
|
||||||
set(OIIO_DEBUG debug ${OPENIMAGEIO_LIBPATH}/OpenImageIO_d.lib debug ${OPENIMAGEIO_LIBPATH}/OpenImageIO_Util_d.lib)
|
set(OIIO_DEBUG debug ${OPENIMAGEIO_LIBPATH}/OpenImageIO_d.lib debug ${OPENIMAGEIO_LIBPATH}/OpenImageIO_Util_d.lib)
|
||||||
set(OPENIMAGEIO_LIBRARIES ${OIIO_OPTIMIZED} ${OIIO_DEBUG})
|
set(OPENIMAGEIO_LIBRARIES ${OIIO_OPTIMIZED} ${OIIO_DEBUG})
|
||||||
|
|
||||||
set(OPENIMAGEIO_DEFINITIONS "-DUSE_TBB=0")
|
set(OPENIMAGEIO_DEFINITIONS "-DUSE_TBB=0")
|
||||||
set(OPENCOLORIO_DEFINITIONS "-DOCIO_STATIC_BUILD")
|
set(OPENCOLORIO_DEFINITIONS "-DOCIO_STATIC_BUILD")
|
||||||
set(OPENIMAGEIO_IDIFF "${OPENIMAGEIO}/bin/idiff.exe")
|
set(OPENIMAGEIO_IDIFF "${OPENIMAGEIO}/bin/idiff.exe")
|
||||||
@@ -471,7 +473,7 @@ if(WITH_OPENVDB)
|
|||||||
set(OPENVDB_LIBPATH ${LIBDIR}/openvdb/lib)
|
set(OPENVDB_LIBPATH ${LIBDIR}/openvdb/lib)
|
||||||
set(OPENVDB_INCLUDE_DIRS ${OPENVDB}/include ${TBB_INCLUDE_DIR})
|
set(OPENVDB_INCLUDE_DIRS ${OPENVDB}/include ${TBB_INCLUDE_DIR})
|
||||||
set(OPENVDB_LIBRARIES optimized ${OPENVDB_LIBPATH}/openvdb.lib debug ${OPENVDB_LIBPATH}/openvdb_d.lib ${TBB_LIBRARIES} ${BLOSC_LIBRARIES})
|
set(OPENVDB_LIBRARIES optimized ${OPENVDB_LIBPATH}/openvdb.lib debug ${OPENVDB_LIBPATH}/openvdb_d.lib ${TBB_LIBRARIES} ${BLOSC_LIBRARIES})
|
||||||
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(WITH_ALEMBIC)
|
if(WITH_ALEMBIC)
|
||||||
|
@@ -1,14 +1,17 @@
|
|||||||
echo No explicit msvc version requested, autodetecting version.
|
echo No explicit msvc version requested, autodetecting version.
|
||||||
|
|
||||||
call "%~dp0\detect_msvc2017.cmd"
|
call "%~dp0\detect_msvc2013.cmd"
|
||||||
if %ERRORLEVEL% EQU 0 goto DetectionComplete
|
if %ERRORLEVEL% EQU 0 goto DetectionComplete
|
||||||
|
|
||||||
call "%~dp0\detect_msvc2015.cmd"
|
call "%~dp0\detect_msvc2015.cmd"
|
||||||
if %ERRORLEVEL% EQU 0 goto DetectionComplete
|
if %ERRORLEVEL% EQU 0 goto DetectionComplete
|
||||||
|
|
||||||
|
call "%~dp0\detect_msvc2017.cmd"
|
||||||
|
if %ERRORLEVEL% EQU 0 goto DetectionComplete
|
||||||
|
|
||||||
echo Compiler Detection failed. Use verbose switch for more information.
|
echo Compiler Detection failed. Use verbose switch for more information.
|
||||||
exit /b 1
|
exit /b 1
|
||||||
|
|
||||||
:DetectionComplete
|
:DetectionComplete
|
||||||
echo Compiler Detection successful, detected VS%BUILD_VS_YEAR%
|
echo Compiler Detection successfull, detected VS%BUILD_VS_YEAR%
|
||||||
exit /b 0
|
exit /b 0
|
@@ -1,3 +1,4 @@
|
|||||||
|
if "%BUILD_VS_YEAR%"=="2013" set BUILD_VS_LIBDIRPOST=vc12
|
||||||
if "%BUILD_VS_YEAR%"=="2015" set BUILD_VS_LIBDIRPOST=vc14
|
if "%BUILD_VS_YEAR%"=="2015" set BUILD_VS_LIBDIRPOST=vc14
|
||||||
if "%BUILD_VS_YEAR%"=="2017" set BUILD_VS_LIBDIRPOST=vc14
|
if "%BUILD_VS_YEAR%"=="2017" set BUILD_VS_LIBDIRPOST=vc14
|
||||||
|
|
||||||
@@ -36,7 +37,7 @@ if NOT EXIST %BUILD_VS_LIBDIR% (
|
|||||||
echo.
|
echo.
|
||||||
echo Error: Download of external libraries failed.
|
echo Error: Download of external libraries failed.
|
||||||
echo This is needed for building, please manually run 'svn cleanup' and 'svn update' in
|
echo This is needed for building, please manually run 'svn cleanup' and 'svn update' in
|
||||||
echo %BUILD_VS_LIBDIR% , until this is resolved you CANNOT make a successful blender build
|
echo %BUILD_VS_LIBDIR% , until this is resolved you CANNOT make a successfull blender build
|
||||||
echo.
|
echo.
|
||||||
exit /b 1
|
exit /b 1
|
||||||
)
|
)
|
||||||
|
@@ -1,3 +1,5 @@
|
|||||||
|
set BUILD_CMAKE_ARGS=%BUILD_CMAKE_ARGS% -G "Visual Studio %BUILD_VS_VER% %BUILD_VS_YEAR%%WINDOWS_ARCH%" %TESTS_CMAKE_ARGS%
|
||||||
|
|
||||||
if "%BUILD_ARCH%"=="x64" (
|
if "%BUILD_ARCH%"=="x64" (
|
||||||
set MSBUILD_PLATFORM=x64
|
set MSBUILD_PLATFORM=x64
|
||||||
) else if "%BUILD_ARCH%"=="x86" (
|
) else if "%BUILD_ARCH%"=="x86" (
|
||||||
@@ -9,9 +11,9 @@ if "%BUILD_ARCH%"=="x64" (
|
|||||||
)
|
)
|
||||||
|
|
||||||
if "%WITH_CLANG%"=="1" (
|
if "%WITH_CLANG%"=="1" (
|
||||||
set CLANG_CMAKE_ARGS=-T"LLVM-vs2017"
|
set BUILD_CMAKE_ARGS=%BUILD_CMAKE_ARGS% -T"LLVM-vs2017"
|
||||||
if "%WITH_ASAN%"=="1" (
|
if "%WITH_ASAN%"=="1" (
|
||||||
set ASAN_CMAKE_ARGS=-DWITH_COMPILER_ASAN=On
|
set BUILD_CMAKE_ARGS=%BUILD_CMAKE_ARGS% -DWITH_COMPILER_ASAN=On
|
||||||
)
|
)
|
||||||
) else (
|
) else (
|
||||||
if "%WITH_ASAN%"=="1" (
|
if "%WITH_ASAN%"=="1" (
|
||||||
@@ -19,7 +21,6 @@ if "%WITH_CLANG%"=="1" (
|
|||||||
exit /b 1
|
exit /b 1
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
set BUILD_CMAKE_ARGS=%BUILD_CMAKE_ARGS% -G "Visual Studio %BUILD_VS_VER% %BUILD_VS_YEAR%%WINDOWS_ARCH%" %TESTS_CMAKE_ARGS% %CLANG_CMAKE_ARGS% %ASAN_CMAKE_ARGS%
|
|
||||||
|
|
||||||
if NOT EXIST %BUILD_DIR%\nul (
|
if NOT EXIST %BUILD_DIR%\nul (
|
||||||
mkdir %BUILD_DIR%
|
mkdir %BUILD_DIR%
|
||||||
|
@@ -1,9 +1,3 @@
|
|||||||
ninja --version 1>NUL 2>&1
|
|
||||||
if %ERRORLEVEL% NEQ 0 (
|
|
||||||
echo "Ninja not detected in the path"
|
|
||||||
exit /b 1
|
|
||||||
)
|
|
||||||
|
|
||||||
set BUILD_CMAKE_ARGS=%BUILD_CMAKE_ARGS% -G "Ninja" %TESTS_CMAKE_ARGS% -DCMAKE_BUILD_TYPE=%BUILD_TYPE%
|
set BUILD_CMAKE_ARGS=%BUILD_CMAKE_ARGS% -G "Ninja" %TESTS_CMAKE_ARGS% -DCMAKE_BUILD_TYPE=%BUILD_TYPE%
|
||||||
|
|
||||||
if "%WITH_CLANG%" == "1" (
|
if "%WITH_CLANG%" == "1" (
|
||||||
|
3
build_files/windows/detect_msvc2013.cmd
Normal file
3
build_files/windows/detect_msvc2013.cmd
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
set BUILD_VS_VER=12
|
||||||
|
set BUILD_VS_YEAR=2013
|
||||||
|
call "%~dp0\detect_msvc_classic.cmd"
|
@@ -2,7 +2,6 @@ if NOT "%verbose%" == "" (
|
|||||||
echo Detecting msvc 2017
|
echo Detecting msvc 2017
|
||||||
)
|
)
|
||||||
set BUILD_VS_VER=15
|
set BUILD_VS_VER=15
|
||||||
set BUILD_VS_YEAR=2017
|
|
||||||
set ProgramFilesX86=%ProgramFiles(x86)%
|
set ProgramFilesX86=%ProgramFiles(x86)%
|
||||||
if not exist "%ProgramFilesX86%" set ProgramFilesX86=%ProgramFiles%
|
if not exist "%ProgramFilesX86%" set ProgramFilesX86=%ProgramFiles%
|
||||||
|
|
||||||
@@ -10,15 +9,10 @@ set vs_where=%ProgramFilesX86%\Microsoft Visual Studio\Installer\vswhere.exe
|
|||||||
if not exist "%vs_where%" (
|
if not exist "%vs_where%" (
|
||||||
if NOT "%verbose%" == "" (
|
if NOT "%verbose%" == "" (
|
||||||
echo Visual Studio 2017 ^(15.2 or newer^) is not detected
|
echo Visual Studio 2017 ^(15.2 or newer^) is not detected
|
||||||
|
goto FAIL
|
||||||
)
|
)
|
||||||
goto FAIL
|
|
||||||
)
|
)
|
||||||
|
for /f "usebackq tokens=1* delims=: " %%i in (`"%vs_where%" -products * -latest %VSWHERE_ARGS% -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64`) do (
|
||||||
if NOT "%verbose%" == "" (
|
|
||||||
echo "%vs_where%" -latest %VSWHERE_ARGS% -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64`
|
|
||||||
)
|
|
||||||
|
|
||||||
for /f "usebackq tokens=1* delims=: " %%i in (`"%vs_where%" -latest %VSWHERE_ARGS% -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64`) do (
|
|
||||||
if /i "%%i"=="installationPath" set VS_InstallDir=%%j
|
if /i "%%i"=="installationPath" set VS_InstallDir=%%j
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@@ -53,12 +53,10 @@ if NOT "%1" == "" (
|
|||||||
) else if "%1" == "2017pre" (
|
) else if "%1" == "2017pre" (
|
||||||
set BUILD_VS_YEAR=2017
|
set BUILD_VS_YEAR=2017
|
||||||
set VSWHERE_ARGS=-prerelease
|
set VSWHERE_ARGS=-prerelease
|
||||||
set BUILD_VS_YEAR=2017
|
|
||||||
) else if "%1" == "2017b" (
|
|
||||||
set BUILD_VS_YEAR=2017
|
|
||||||
set VSWHERE_ARGS=-products Microsoft.VisualStudio.Product.BuildTools
|
|
||||||
) else if "%1" == "2015" (
|
) else if "%1" == "2015" (
|
||||||
set BUILD_VS_YEAR=2015
|
set BUILD_VS_YEAR=2015
|
||||||
|
) else if "%1" == "2013" (
|
||||||
|
set BUILD_VS_YEAR=2013
|
||||||
) else if "%1" == "packagename" (
|
) else if "%1" == "packagename" (
|
||||||
set BUILD_CMAKE_ARGS=%BUILD_CMAKE_ARGS% -DCPACK_OVERRIDE_PACKAGENAME="%2"
|
set BUILD_CMAKE_ARGS=%BUILD_CMAKE_ARGS% -DCPACK_OVERRIDE_PACKAGENAME="%2"
|
||||||
shift /1
|
shift /1
|
||||||
|
@@ -22,6 +22,4 @@ set BUILD_SHOW_HASHES=
|
|||||||
set SHOW_HELP=
|
set SHOW_HELP=
|
||||||
set BUILD_WITH_NINJA=
|
set BUILD_WITH_NINJA=
|
||||||
set WITH_CLANG=
|
set WITH_CLANG=
|
||||||
set WITH_ASAN=
|
set WITH_ASAN=
|
||||||
set CLANG_CMAKE_ARGS=
|
|
||||||
set ASAN_CMAKE_ARGS=
|
|
@@ -3,10 +3,10 @@ if "%GIT%" == "" (
|
|||||||
goto EOF
|
goto EOF
|
||||||
)
|
)
|
||||||
cd "%BLENDER_DIR%"
|
cd "%BLENDER_DIR%"
|
||||||
for /f "delims=" %%i in ('"%GIT%" rev-parse HEAD') do echo Branch_hash=%%i
|
for /f "delims=" %%i in ('%GIT% rev-parse HEAD') do echo Branch_hash=%%i
|
||||||
cd "%BLENDER_DIR%/release/datafiles/locale"
|
cd "%BLENDER_DIR%/release/datafiles/locale"
|
||||||
for /f "delims=" %%i in ('"%GIT%" rev-parse HEAD') do echo Locale_hash=%%i
|
for /f "delims=" %%i in ('%GIT% rev-parse HEAD') do echo Locale_hash=%%i
|
||||||
cd "%BLENDER_DIR%/release/scripts/addons"
|
cd "%BLENDER_DIR%/release/scripts/addons"
|
||||||
for /f "delims=" %%i in ('"%GIT%" rev-parse HEAD') do echo Addons_Hash=%%i
|
for /f "delims=" %%i in ('%GIT% rev-parse HEAD') do echo Addons_Hash=%%i
|
||||||
cd "%BLENDER_DIR%"
|
cd "%BLENDER_DIR%"
|
||||||
:EOF
|
:EOF
|
@@ -22,14 +22,8 @@ echo - packagename [newname] ^(override default cpack package name^)
|
|||||||
echo - buildir [newdir] ^(override default build folder^)
|
echo - buildir [newdir] ^(override default build folder^)
|
||||||
echo - x86 ^(override host auto-detect and build 32 bit code^)
|
echo - x86 ^(override host auto-detect and build 32 bit code^)
|
||||||
echo - x64 ^(override host auto-detect and build 64 bit code^)
|
echo - x64 ^(override host auto-detect and build 64 bit code^)
|
||||||
echo - 2017 ^(build with visual studio 2017^)
|
echo - 2013 ^(build with visual studio 2013^)
|
||||||
echo - 2017pre ^(build with visual studio 2017 pre-release^)
|
echo - 2015 ^(build with visual studio 2015^) [EXPERIMENTAL]
|
||||||
echo - 2017b ^(build with visual studio 2017 Build Tools^)
|
echo - 2017 ^(build with visual studio 2017^) [EXPERIMENTAL]
|
||||||
|
echo - 2017pre ^(build with visual studio 2017 pre-release^) [EXPERIMENTAL]
|
||||||
echo.
|
|
||||||
echo Experimental options
|
|
||||||
echo - 2015 ^(build with visual studio 2015^)
|
|
||||||
echo - clang ^(enable building with clang^)
|
|
||||||
echo - asan ^(enable asan when building with clang^)
|
|
||||||
echo - ninja ^(enable building with ninja instead of msbuild^)
|
|
||||||
echo.
|
echo.
|
||||||
|
@@ -7,7 +7,7 @@
|
|||||||
# as published by the Free Software Foundation; either version 2
|
# as published by the Free Software Foundation; either version 2
|
||||||
# of the License, or (at your option) any later version.
|
# of the License, or (at your option) any later version.
|
||||||
#
|
#
|
||||||
# This program is distributed in the hope that it will be useful,
|
# This program is distributed in the hope that it will be useful,
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
# GNU General Public License for more details.
|
# GNU General Public License for more details.
|
||||||
@@ -22,21 +22,21 @@
|
|||||||
#
|
#
|
||||||
# Name:
|
# Name:
|
||||||
# dna.py
|
# dna.py
|
||||||
#
|
#
|
||||||
# Description:
|
# Description:
|
||||||
# Creates a browsable DNA output to HTML.
|
# Creates a browsable DNA output to HTML.
|
||||||
#
|
#
|
||||||
# Author:
|
# Author:
|
||||||
# Jeroen Bakker
|
# Jeroen Bakker
|
||||||
#
|
#
|
||||||
# Version:
|
# Version:
|
||||||
# v0.1 (12-05-2009) - migration of original source code to python.
|
# v0.1 (12-05-2009) - migration of original source code to python.
|
||||||
# Added code to support blender 2.5 branch
|
# Added code to support blender 2.5 branch
|
||||||
# v0.2 (25-05-2009) - integrated with BlendFileReader.py
|
# v0.2 (25-05-2009) - integrated with BlendFileReader.py
|
||||||
#
|
#
|
||||||
# Input:
|
# Input:
|
||||||
# blender build executable
|
# blender build executable
|
||||||
#
|
#
|
||||||
# Output:
|
# Output:
|
||||||
# dna.html
|
# dna.html
|
||||||
# dna.css (will only be created when not existing)
|
# dna.css (will only be created when not existing)
|
||||||
@@ -76,12 +76,12 @@ class DNACatalogHTML:
|
|||||||
DNACatalog is a catalog of all information in the DNA1 file-block
|
DNACatalog is a catalog of all information in the DNA1 file-block
|
||||||
'''
|
'''
|
||||||
|
|
||||||
def __init__(self, catalog, bpy_module=None):
|
def __init__(self, catalog, bpy_module = None):
|
||||||
self.Catalog = catalog
|
self.Catalog = catalog
|
||||||
self.bpy = bpy_module
|
self.bpy = bpy_module
|
||||||
|
|
||||||
def WriteToHTML(self, handle):
|
def WriteToHTML(self, handle):
|
||||||
|
|
||||||
dna_html_template = """
|
dna_html_template = """
|
||||||
<!DOCTYPE html PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN http://www.w3.org/TR/html4/loose.dtd>
|
<!DOCTYPE html PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN http://www.w3.org/TR/html4/loose.dtd>
|
||||||
<html>
|
<html>
|
||||||
@@ -105,10 +105,10 @@ class DNACatalogHTML:
|
|||||||
${structs_content}
|
${structs_content}
|
||||||
</body>
|
</body>
|
||||||
</html>"""
|
</html>"""
|
||||||
|
|
||||||
header = self.Catalog.Header
|
header = self.Catalog.Header
|
||||||
bpy = self.bpy
|
bpy = self.bpy
|
||||||
|
|
||||||
# ${version} and ${revision}
|
# ${version} and ${revision}
|
||||||
if bpy:
|
if bpy:
|
||||||
version = '.'.join(map(str, bpy.app.version))
|
version = '.'.join(map(str, bpy.app.version))
|
||||||
@@ -116,7 +116,7 @@ class DNACatalogHTML:
|
|||||||
else:
|
else:
|
||||||
version = str(header.Version)
|
version = str(header.Version)
|
||||||
revision = 'Unknown'
|
revision = 'Unknown'
|
||||||
|
|
||||||
# ${bitness}
|
# ${bitness}
|
||||||
if header.PointerSize == 8:
|
if header.PointerSize == 8:
|
||||||
bitness = '64 bit'
|
bitness = '64 bit'
|
||||||
@@ -125,10 +125,10 @@ class DNACatalogHTML:
|
|||||||
|
|
||||||
# ${endianness}
|
# ${endianness}
|
||||||
if header.LittleEndianness:
|
if header.LittleEndianness:
|
||||||
endianess = 'Little endianness'
|
endianess= 'Little endianness'
|
||||||
else:
|
else:
|
||||||
endianess = 'Big endianness'
|
endianess= 'Big endianness'
|
||||||
|
|
||||||
# ${structs_list}
|
# ${structs_list}
|
||||||
log.debug("Creating structs index")
|
log.debug("Creating structs index")
|
||||||
structs_list = ''
|
structs_list = ''
|
||||||
@@ -136,7 +136,7 @@ class DNACatalogHTML:
|
|||||||
structureIndex = 0
|
structureIndex = 0
|
||||||
for structure in self.Catalog.Structs:
|
for structure in self.Catalog.Structs:
|
||||||
structs_list += list_item.format(structureIndex, structure.Type.Name)
|
structs_list += list_item.format(structureIndex, structure.Type.Name)
|
||||||
structureIndex += 1
|
structureIndex+=1
|
||||||
|
|
||||||
# ${structs_content}
|
# ${structs_content}
|
||||||
log.debug("Creating structs content")
|
log.debug("Creating structs content")
|
||||||
@@ -144,20 +144,20 @@ class DNACatalogHTML:
|
|||||||
for structure in self.Catalog.Structs:
|
for structure in self.Catalog.Structs:
|
||||||
log.debug(structure.Type.Name)
|
log.debug(structure.Type.Name)
|
||||||
structs_content += self.Structure(structure)
|
structs_content += self.Structure(structure)
|
||||||
|
|
||||||
d = dict(
|
d = dict(
|
||||||
version=version,
|
version = version,
|
||||||
revision=revision,
|
revision = revision,
|
||||||
bitness=bitness,
|
bitness = bitness,
|
||||||
endianness=endianess,
|
endianness = endianess,
|
||||||
structs_list=structs_list,
|
structs_list = structs_list,
|
||||||
structs_content=structs_content
|
structs_content = structs_content
|
||||||
)
|
)
|
||||||
|
|
||||||
dna_html = Template(dna_html_template).substitute(d)
|
dna_html = Template(dna_html_template).substitute(d)
|
||||||
dna_html = self.format(dna_html)
|
dna_html = self.format(dna_html)
|
||||||
handle.write(dna_html)
|
handle.write(dna_html)
|
||||||
|
|
||||||
def Structure(self, structure):
|
def Structure(self, structure):
|
||||||
struct_table_template = """
|
struct_table_template = """
|
||||||
<table><a name="${struct_name}"></a>
|
<table><a name="${struct_name}"></a>
|
||||||
@@ -178,23 +178,23 @@ class DNACatalogHTML:
|
|||||||
</table>
|
</table>
|
||||||
<label>Total size: ${size} bytes</label><br/>
|
<label>Total size: ${size} bytes</label><br/>
|
||||||
<label>(<a href="#top">top</a>)</label><br/>"""
|
<label>(<a href="#top">top</a>)</label><br/>"""
|
||||||
|
|
||||||
d = dict(
|
d = dict(
|
||||||
struct_name=structure.Type.Name,
|
struct_name = structure.Type.Name,
|
||||||
fields=self.StructureFields(structure, None, 0),
|
fields = self.StructureFields(structure, None, 0),
|
||||||
size=str(structure.Type.Size)
|
size = str(structure.Type.Size)
|
||||||
)
|
)
|
||||||
|
|
||||||
struct_table = Template(struct_table_template).substitute(d)
|
struct_table = Template(struct_table_template).substitute(d)
|
||||||
return struct_table
|
return struct_table
|
||||||
|
|
||||||
def StructureFields(self, structure, parentReference, offset):
|
def StructureFields(self, structure, parentReference, offset):
|
||||||
fields = ''
|
fields = ''
|
||||||
for field in structure.Fields:
|
for field in structure.Fields:
|
||||||
fields += self.StructureField(field, structure, parentReference, offset)
|
fields += self.StructureField(field, structure, parentReference, offset)
|
||||||
offset += field.Size(self.Catalog.Header)
|
offset += field.Size(self.Catalog.Header)
|
||||||
return fields
|
return fields
|
||||||
|
|
||||||
def StructureField(self, field, structure, parentReference, offset):
|
def StructureField(self, field, structure, parentReference, offset):
|
||||||
structure_field_template = """
|
structure_field_template = """
|
||||||
<tr>
|
<tr>
|
||||||
@@ -205,7 +205,7 @@ class DNACatalogHTML:
|
|||||||
<td>${offset}</td>
|
<td>${offset}</td>
|
||||||
<td>${size}</td>
|
<td>${size}</td>
|
||||||
</tr>"""
|
</tr>"""
|
||||||
|
|
||||||
if field.Type.Structure is None or field.Name.IsPointer():
|
if field.Type.Structure is None or field.Name.IsPointer():
|
||||||
|
|
||||||
# ${reference}
|
# ${reference}
|
||||||
@@ -216,37 +216,37 @@ class DNACatalogHTML:
|
|||||||
struct = '<a href="#{0}">{0}</a>'.format(structure.Type.Name)
|
struct = '<a href="#{0}">{0}</a>'.format(structure.Type.Name)
|
||||||
else:
|
else:
|
||||||
struct = structure.Type.Name
|
struct = structure.Type.Name
|
||||||
|
|
||||||
# ${type}
|
# ${type}
|
||||||
type = field.Type.Name
|
type = field.Type.Name
|
||||||
|
|
||||||
# ${name}
|
# ${name}
|
||||||
name = field.Name.Name
|
name = field.Name.Name
|
||||||
|
|
||||||
# ${offset}
|
# ${offset}
|
||||||
# offset already set
|
# offset already set
|
||||||
|
|
||||||
# ${size}
|
# ${size}
|
||||||
size = field.Size(self.Catalog.Header)
|
size = field.Size(self.Catalog.Header)
|
||||||
|
|
||||||
d = dict(
|
d = dict(
|
||||||
reference=reference,
|
reference = reference,
|
||||||
struct=struct,
|
struct = struct,
|
||||||
type=type,
|
type = type,
|
||||||
name=name,
|
name = name,
|
||||||
offset=offset,
|
offset = offset,
|
||||||
size=size
|
size = size
|
||||||
)
|
)
|
||||||
|
|
||||||
structure_field = Template(structure_field_template).substitute(d)
|
structure_field = Template(structure_field_template).substitute(d)
|
||||||
|
|
||||||
elif field.Type.Structure is not None:
|
elif field.Type.Structure is not None:
|
||||||
reference = field.Name.AsReference(parentReference)
|
reference = field.Name.AsReference(parentReference)
|
||||||
structure_field = self.StructureFields(field.Type.Structure, reference, offset)
|
structure_field = self.StructureFields(field.Type.Structure, reference, offset)
|
||||||
|
|
||||||
return structure_field
|
return structure_field
|
||||||
|
|
||||||
def indent(self, input, dent, startswith=''):
|
def indent(self, input, dent, startswith = ''):
|
||||||
output = ''
|
output = ''
|
||||||
if dent < 0:
|
if dent < 0:
|
||||||
for line in input.split('\n'):
|
for line in input.split('\n'):
|
||||||
@@ -257,19 +257,19 @@ class DNACatalogHTML:
|
|||||||
output += line.lstrip() + '\n' # remove indentation completely
|
output += line.lstrip() + '\n' # remove indentation completely
|
||||||
elif dent > 0:
|
elif dent > 0:
|
||||||
for line in input.split('\n'):
|
for line in input.split('\n'):
|
||||||
output += ' ' * dent + line + '\n'
|
output += ' '* dent + line + '\n'
|
||||||
return output
|
return output
|
||||||
|
|
||||||
def format(self, input):
|
def format(self, input):
|
||||||
diff = {
|
diff = {
|
||||||
'\n<!DOCTYPE': '<!DOCTYPE',
|
'\n<!DOCTYPE':'<!DOCTYPE',
|
||||||
'\n</ul>': '</ul>',
|
'\n</ul>' :'</ul>',
|
||||||
'<a name': '\n<a name',
|
'<a name' :'\n<a name',
|
||||||
'<tr>\n': '<tr>',
|
'<tr>\n' :'<tr>',
|
||||||
'<tr>': ' <tr>',
|
'<tr>' :' <tr>',
|
||||||
'</th>\n': '</th>',
|
'</th>\n' :'</th>',
|
||||||
'</td>\n': '</td>',
|
'</td>\n' :'</td>',
|
||||||
'<tbody>\n': '<tbody>'
|
'<tbody>\n' :'<tbody>'
|
||||||
}
|
}
|
||||||
output = self.indent(input, 0)
|
output = self.indent(input, 0)
|
||||||
for key, value in diff.items():
|
for key, value in diff.items():
|
||||||
@@ -283,17 +283,17 @@ class DNACatalogHTML:
|
|||||||
'''
|
'''
|
||||||
css = """
|
css = """
|
||||||
@CHARSET "ISO-8859-1";
|
@CHARSET "ISO-8859-1";
|
||||||
|
|
||||||
body {
|
body {
|
||||||
font-family: verdana;
|
font-family: verdana;
|
||||||
font-size: small;
|
font-size: small;
|
||||||
}
|
}
|
||||||
|
|
||||||
div.title {
|
div.title {
|
||||||
font-size: large;
|
font-size: large;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
h1 {
|
h1 {
|
||||||
page-break-before: always;
|
page-break-before: always;
|
||||||
}
|
}
|
||||||
@@ -304,7 +304,7 @@ class DNACatalogHTML:
|
|||||||
margin-right: 3%;
|
margin-right: 3%;
|
||||||
padding-left: 40px;
|
padding-left: 40px;
|
||||||
}
|
}
|
||||||
|
|
||||||
h1:hover{
|
h1:hover{
|
||||||
background-color: #EBEBEB;
|
background-color: #EBEBEB;
|
||||||
}
|
}
|
||||||
@@ -312,7 +312,7 @@ class DNACatalogHTML:
|
|||||||
h3 {
|
h3 {
|
||||||
padding-left: 40px;
|
padding-left: 40px;
|
||||||
}
|
}
|
||||||
|
|
||||||
table {
|
table {
|
||||||
border-width: 1px;
|
border-width: 1px;
|
||||||
border-style: solid;
|
border-style: solid;
|
||||||
@@ -321,21 +321,21 @@ class DNACatalogHTML:
|
|||||||
width: 94%;
|
width: 94%;
|
||||||
margin: 20px 3% 10px;
|
margin: 20px 3% 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
caption {
|
caption {
|
||||||
margin-bottom: 5px;
|
margin-bottom: 5px;
|
||||||
}
|
}
|
||||||
|
|
||||||
th {
|
th {
|
||||||
background-color: #000000;
|
background-color: #000000;
|
||||||
color:#ffffff;
|
color:#ffffff;
|
||||||
padding-left:5px;
|
padding-left:5px;
|
||||||
padding-right:5px;
|
padding-right:5px;
|
||||||
}
|
}
|
||||||
|
|
||||||
tr {
|
tr {
|
||||||
}
|
}
|
||||||
|
|
||||||
td {
|
td {
|
||||||
border-width: 1px;
|
border-width: 1px;
|
||||||
border-style: solid;
|
border-style: solid;
|
||||||
@@ -343,12 +343,12 @@ class DNACatalogHTML:
|
|||||||
padding-left:5px;
|
padding-left:5px;
|
||||||
padding-right:5px;
|
padding-right:5px;
|
||||||
}
|
}
|
||||||
|
|
||||||
label {
|
label {
|
||||||
float:right;
|
float:right;
|
||||||
margin-right: 3%;
|
margin-right: 3%;
|
||||||
}
|
}
|
||||||
|
|
||||||
ul.multicolumn {
|
ul.multicolumn {
|
||||||
list-style:none;
|
list-style:none;
|
||||||
float:left;
|
float:left;
|
||||||
@@ -361,18 +361,18 @@ class DNACatalogHTML:
|
|||||||
width:200px;
|
width:200px;
|
||||||
margin-right:0px;
|
margin-right:0px;
|
||||||
}
|
}
|
||||||
|
|
||||||
a {
|
a {
|
||||||
color:#a000a0;
|
color:#a000a0;
|
||||||
text-decoration:none;
|
text-decoration:none;
|
||||||
}
|
}
|
||||||
|
|
||||||
a:hover {
|
a:hover {
|
||||||
color:#a000a0;
|
color:#a000a0;
|
||||||
text-decoration:underline;
|
text-decoration:underline;
|
||||||
}
|
}
|
||||||
"""
|
"""
|
||||||
|
|
||||||
css = self.indent(css, 0)
|
css = self.indent(css, 0)
|
||||||
|
|
||||||
handle.write(css)
|
handle.write(css)
|
||||||
@@ -389,13 +389,13 @@ def usage():
|
|||||||
print("\tdefault: % blender2.5 --background -noaudio --python BlendFileDnaExporter_25.py")
|
print("\tdefault: % blender2.5 --background -noaudio --python BlendFileDnaExporter_25.py")
|
||||||
print("\twith options: % blender2.5 --background -noaudio --python BlendFileDnaExporter_25.py -- --dna-keep-blend --dna-debug\n")
|
print("\twith options: % blender2.5 --background -noaudio --python BlendFileDnaExporter_25.py -- --dna-keep-blend --dna-debug\n")
|
||||||
|
|
||||||
|
|
||||||
######################################################
|
######################################################
|
||||||
# Main
|
# Main
|
||||||
######################################################
|
######################################################
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
|
||||||
import os, os.path
|
import os, os.path
|
||||||
|
|
||||||
try:
|
try:
|
||||||
@@ -408,37 +408,37 @@ def main():
|
|||||||
else:
|
else:
|
||||||
filename = 'dna'
|
filename = 'dna'
|
||||||
dir = os.path.dirname(__file__)
|
dir = os.path.dirname(__file__)
|
||||||
Path_Blend = os.path.join(dir, filename + '.blend') # temporary blend file
|
Path_Blend = os.path.join(dir, filename + '.blend') # temporary blend file
|
||||||
Path_HTML = os.path.join(dir, filename + '.html') # output html file
|
Path_HTML = os.path.join(dir, filename + '.html') # output html file
|
||||||
Path_CSS = os.path.join(dir, 'dna.css') # output css file
|
Path_CSS = os.path.join(dir, 'dna.css') # output css file
|
||||||
|
|
||||||
# create a blend file for dna parsing
|
# create a blend file for dna parsing
|
||||||
if not os.path.exists(Path_Blend):
|
if not os.path.exists(Path_Blend):
|
||||||
log.info("1: write temp blend file with SDNA info")
|
log.info("1: write temp blend file with SDNA info")
|
||||||
log.info(" saving to: " + Path_Blend)
|
log.info(" saving to: " + Path_Blend)
|
||||||
try:
|
try:
|
||||||
bpy.ops.wm.save_as_mainfile(filepath=Path_Blend, copy=True, compress=False)
|
bpy.ops.wm.save_as_mainfile(filepath = Path_Blend, copy = True, compress = False)
|
||||||
except:
|
except:
|
||||||
log.error("Filename {0} does not exist and can't be created... quitting".format(Path_Blend))
|
log.error("Filename {0} does not exist and can't be created... quitting".format(Path_Blend))
|
||||||
return
|
return
|
||||||
else:
|
else:
|
||||||
log.info("1: found blend file with SDNA info")
|
log.info("1: found blend file with SDNA info")
|
||||||
log.info(" " + Path_Blend)
|
log.info(" " + Path_Blend)
|
||||||
|
|
||||||
# read blend header from blend file
|
# read blend header from blend file
|
||||||
log.info("2: read file:")
|
log.info("2: read file:")
|
||||||
|
|
||||||
if not dir in sys.path:
|
if not dir in sys.path:
|
||||||
sys.path.append(dir)
|
sys.path.append(dir)
|
||||||
import BlendFileReader
|
import BlendFileReader
|
||||||
|
|
||||||
handle = BlendFileReader.openBlendFile(Path_Blend)
|
handle = BlendFileReader.openBlendFile(Path_Blend)
|
||||||
blendfile = BlendFileReader.BlendFile(handle)
|
blendfile = BlendFileReader.BlendFile(handle)
|
||||||
catalog = DNACatalogHTML(blendfile.Catalog, bpy)
|
catalog = DNACatalogHTML(blendfile.Catalog, bpy)
|
||||||
|
|
||||||
# close temp file
|
# close temp file
|
||||||
handle.close()
|
handle.close()
|
||||||
|
|
||||||
# deleting or not?
|
# deleting or not?
|
||||||
if '--dna-keep-blend' in sys.argv:
|
if '--dna-keep-blend' in sys.argv:
|
||||||
# keep the blend, useful for studying hexdumps
|
# keep the blend, useful for studying hexdumps
|
||||||
@@ -449,7 +449,7 @@ def main():
|
|||||||
log.info("5: close and delete temp blend:")
|
log.info("5: close and delete temp blend:")
|
||||||
log.info(" {0}".format(Path_Blend))
|
log.info(" {0}".format(Path_Blend))
|
||||||
os.remove(Path_Blend)
|
os.remove(Path_Blend)
|
||||||
|
|
||||||
# export dna to xhtml
|
# export dna to xhtml
|
||||||
log.info("6: export sdna to xhtml file: %r" % Path_HTML)
|
log.info("6: export sdna to xhtml file: %r" % Path_HTML)
|
||||||
handleHTML = open(Path_HTML, "w")
|
handleHTML = open(Path_HTML, "w")
|
||||||
@@ -466,12 +466,12 @@ def main():
|
|||||||
if not bpy.app.background:
|
if not bpy.app.background:
|
||||||
log.info("7: quit blender")
|
log.info("7: quit blender")
|
||||||
bpy.ops.wm.exit_blender()
|
bpy.ops.wm.exit_blender()
|
||||||
|
|
||||||
except ImportError:
|
except ImportError:
|
||||||
log.warning(" skipping, not running in Blender")
|
log.warning(" skipping, not running in Blender")
|
||||||
usage()
|
usage()
|
||||||
sys.exit(2)
|
sys.exit(2)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
||||||
|
@@ -7,7 +7,7 @@
|
|||||||
# as published by the Free Software Foundation; either version 2
|
# as published by the Free Software Foundation; either version 2
|
||||||
# of the License, or (at your option) any later version.
|
# of the License, or (at your option) any later version.
|
||||||
#
|
#
|
||||||
# This program is distributed in the hope that it will be useful,
|
# This program is distributed in the hope that it will be useful,
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
# GNU General Public License for more details.
|
# GNU General Public License for more details.
|
||||||
@@ -34,7 +34,6 @@ log = logging.getLogger("BlendFileReader")
|
|||||||
# module global routines
|
# module global routines
|
||||||
######################################################
|
######################################################
|
||||||
|
|
||||||
|
|
||||||
def ReadString(handle, length):
|
def ReadString(handle, length):
|
||||||
'''
|
'''
|
||||||
ReadString reads a String of given length or a zero terminating String
|
ReadString reads a String of given length or a zero terminating String
|
||||||
@@ -46,7 +45,7 @@ def ReadString(handle, length):
|
|||||||
# length == 0 means we want a zero terminating string
|
# length == 0 means we want a zero terminating string
|
||||||
result = ""
|
result = ""
|
||||||
s = ReadString(handle, 1)
|
s = ReadString(handle, 1)
|
||||||
while s != "\0":
|
while s!="\0":
|
||||||
result += s
|
result += s
|
||||||
s = ReadString(handle, 1)
|
s = ReadString(handle, 1)
|
||||||
return result
|
return result
|
||||||
@@ -58,7 +57,7 @@ def Read(type, handle, fileheader):
|
|||||||
'''
|
'''
|
||||||
def unpacked_bytes(type_char, size):
|
def unpacked_bytes(type_char, size):
|
||||||
return struct.unpack(fileheader.StructPre + type_char, handle.read(size))[0]
|
return struct.unpack(fileheader.StructPre + type_char, handle.read(size))[0]
|
||||||
|
|
||||||
if type == 'ushort':
|
if type == 'ushort':
|
||||||
return unpacked_bytes("H", 2) # unsigned short
|
return unpacked_bytes("H", 2) # unsigned short
|
||||||
elif type == 'short':
|
elif type == 'short':
|
||||||
@@ -95,10 +94,10 @@ def openBlendFile(filename):
|
|||||||
log.debug("decompressing started")
|
log.debug("decompressing started")
|
||||||
fs = gzip.open(filename, "rb")
|
fs = gzip.open(filename, "rb")
|
||||||
handle = tempfile.TemporaryFile()
|
handle = tempfile.TemporaryFile()
|
||||||
data = fs.read(1024 * 1024)
|
data = fs.read(1024*1024)
|
||||||
while data:
|
while data:
|
||||||
handle.write(data)
|
handle.write(data)
|
||||||
data = fs.read(1024 * 1024)
|
data = fs.read(1024*1024)
|
||||||
log.debug("decompressing finished")
|
log.debug("decompressing finished")
|
||||||
fs.close()
|
fs.close()
|
||||||
log.debug("resetting decompressed file")
|
log.debug("resetting decompressed file")
|
||||||
@@ -113,7 +112,7 @@ def Align(handle):
|
|||||||
offset = handle.tell()
|
offset = handle.tell()
|
||||||
trim = offset % 4
|
trim = offset % 4
|
||||||
if trim != 0:
|
if trim != 0:
|
||||||
handle.seek(4 - trim, os.SEEK_CUR)
|
handle.seek(4-trim, os.SEEK_CUR)
|
||||||
|
|
||||||
|
|
||||||
######################################################
|
######################################################
|
||||||
@@ -122,14 +121,14 @@ def Align(handle):
|
|||||||
|
|
||||||
class BlendFile:
|
class BlendFile:
|
||||||
'''
|
'''
|
||||||
Reads a blendfile and store the header, all the fileblocks, and catalogue
|
Reads a blendfile and store the header, all the fileblocks, and catalogue
|
||||||
structs foound in the DNA fileblock
|
structs foound in the DNA fileblock
|
||||||
|
|
||||||
- BlendFile.Header (BlendFileHeader instance)
|
- BlendFile.Header (BlendFileHeader instance)
|
||||||
- BlendFile.Blocks (list of BlendFileBlock instances)
|
- BlendFile.Blocks (list of BlendFileBlock instances)
|
||||||
- BlendFile.Catalog (DNACatalog instance)
|
- BlendFile.Catalog (DNACatalog instance)
|
||||||
'''
|
'''
|
||||||
|
|
||||||
def __init__(self, handle):
|
def __init__(self, handle):
|
||||||
log.debug("initializing reading blend-file")
|
log.debug("initializing reading blend-file")
|
||||||
self.Header = BlendFileHeader(handle)
|
self.Header = BlendFileHeader(handle)
|
||||||
@@ -142,13 +141,13 @@ class BlendFile:
|
|||||||
found_dna_block = True
|
found_dna_block = True
|
||||||
else:
|
else:
|
||||||
fileblock.Header.skip(handle)
|
fileblock.Header.skip(handle)
|
||||||
|
|
||||||
self.Blocks.append(fileblock)
|
self.Blocks.append(fileblock)
|
||||||
fileblock = BlendFileBlock(handle, self)
|
fileblock = BlendFileBlock(handle, self)
|
||||||
|
|
||||||
# appending last fileblock, "ENDB"
|
# appending last fileblock, "ENDB"
|
||||||
self.Blocks.append(fileblock)
|
self.Blocks.append(fileblock)
|
||||||
|
|
||||||
# seems unused?
|
# seems unused?
|
||||||
"""
|
"""
|
||||||
def FindBlendFileBlocksWithCode(self, code):
|
def FindBlendFileBlocksWithCode(self, code):
|
||||||
@@ -165,27 +164,27 @@ class BlendFileHeader:
|
|||||||
BlendFileHeader allocates the first 12 bytes of a blend file.
|
BlendFileHeader allocates the first 12 bytes of a blend file.
|
||||||
It contains information about the hardware architecture.
|
It contains information about the hardware architecture.
|
||||||
Header example: BLENDER_v254
|
Header example: BLENDER_v254
|
||||||
|
|
||||||
BlendFileHeader.Magic (str)
|
BlendFileHeader.Magic (str)
|
||||||
BlendFileHeader.PointerSize (int)
|
BlendFileHeader.PointerSize (int)
|
||||||
BlendFileHeader.LittleEndianness (bool)
|
BlendFileHeader.LittleEndianness (bool)
|
||||||
BlendFileHeader.StructPre (str) see http://docs.python.org/py3k/library/struct.html#byte-order-size-and-alignment
|
BlendFileHeader.StructPre (str) see http://docs.python.org/py3k/library/struct.html#byte-order-size-and-alignment
|
||||||
BlendFileHeader.Version (int)
|
BlendFileHeader.Version (int)
|
||||||
'''
|
'''
|
||||||
|
|
||||||
def __init__(self, handle):
|
def __init__(self, handle):
|
||||||
log.debug("reading blend-file-header")
|
log.debug("reading blend-file-header")
|
||||||
|
|
||||||
self.Magic = ReadString(handle, 7)
|
self.Magic = ReadString(handle, 7)
|
||||||
log.debug(self.Magic)
|
log.debug(self.Magic)
|
||||||
|
|
||||||
pointersize = ReadString(handle, 1)
|
pointersize = ReadString(handle, 1)
|
||||||
log.debug(pointersize)
|
log.debug(pointersize)
|
||||||
if pointersize == "-":
|
if pointersize == "-":
|
||||||
self.PointerSize = 8
|
self.PointerSize = 8
|
||||||
if pointersize == "_":
|
if pointersize == "_":
|
||||||
self.PointerSize = 4
|
self.PointerSize = 4
|
||||||
|
|
||||||
endianness = ReadString(handle, 1)
|
endianness = ReadString(handle, 1)
|
||||||
log.debug(endianness)
|
log.debug(endianness)
|
||||||
if endianness == "v":
|
if endianness == "v":
|
||||||
@@ -194,11 +193,11 @@ class BlendFileHeader:
|
|||||||
if endianness == "V":
|
if endianness == "V":
|
||||||
self.LittleEndianness = False
|
self.LittleEndianness = False
|
||||||
self.StructPre = ">"
|
self.StructPre = ">"
|
||||||
|
|
||||||
version = ReadString(handle, 3)
|
version = ReadString(handle, 3)
|
||||||
log.debug(version)
|
log.debug(version)
|
||||||
self.Version = int(version)
|
self.Version = int(version)
|
||||||
|
|
||||||
log.debug("{0} {1} {2} {3}".format(self.Magic, self.PointerSize, self.LittleEndianness, version))
|
log.debug("{0} {1} {2} {3}".format(self.Magic, self.PointerSize, self.LittleEndianness, version))
|
||||||
|
|
||||||
|
|
||||||
@@ -207,11 +206,11 @@ class BlendFileBlock:
|
|||||||
BlendFileBlock.File (BlendFile)
|
BlendFileBlock.File (BlendFile)
|
||||||
BlendFileBlock.Header (FileBlockHeader)
|
BlendFileBlock.Header (FileBlockHeader)
|
||||||
'''
|
'''
|
||||||
|
|
||||||
def __init__(self, handle, blendfile):
|
def __init__(self, handle, blendfile):
|
||||||
self.File = blendfile
|
self.File = blendfile
|
||||||
self.Header = FileBlockHeader(handle, blendfile.Header)
|
self.Header = FileBlockHeader(handle, blendfile.Header)
|
||||||
|
|
||||||
def Get(self, handle, path):
|
def Get(self, handle, path):
|
||||||
log.debug("find dna structure")
|
log.debug("find dna structure")
|
||||||
dnaIndex = self.Header.SDNAIndex
|
dnaIndex = self.Header.SDNAIndex
|
||||||
@@ -233,7 +232,7 @@ class FileBlockHeader:
|
|||||||
Count (int)
|
Count (int)
|
||||||
FileOffset (= file pointer of datablock)
|
FileOffset (= file pointer of datablock)
|
||||||
'''
|
'''
|
||||||
|
|
||||||
def __init__(self, handle, fileheader):
|
def __init__(self, handle, fileheader):
|
||||||
self.Code = ReadString(handle, 4).strip()
|
self.Code = ReadString(handle, 4).strip()
|
||||||
if self.Code != "ENDB":
|
if self.Code != "ENDB":
|
||||||
@@ -258,28 +257,28 @@ class FileBlockHeader:
|
|||||||
class DNACatalog:
|
class DNACatalog:
|
||||||
'''
|
'''
|
||||||
DNACatalog is a catalog of all information in the DNA1 file-block
|
DNACatalog is a catalog of all information in the DNA1 file-block
|
||||||
|
|
||||||
Header = None
|
Header = None
|
||||||
Names = None
|
Names = None
|
||||||
Types = None
|
Types = None
|
||||||
Structs = None
|
Structs = None
|
||||||
'''
|
'''
|
||||||
|
|
||||||
def __init__(self, fileheader, handle):
|
def __init__(self, fileheader, handle):
|
||||||
log.debug("building DNA catalog")
|
log.debug("building DNA catalog")
|
||||||
self.Names = []
|
self.Names=[]
|
||||||
self.Types = []
|
self.Types=[]
|
||||||
self.Structs = []
|
self.Structs=[]
|
||||||
self.Header = fileheader
|
self.Header = fileheader
|
||||||
|
|
||||||
SDNA = ReadString(handle, 4)
|
SDNA = ReadString(handle, 4)
|
||||||
|
|
||||||
# names
|
# names
|
||||||
NAME = ReadString(handle, 4)
|
NAME = ReadString(handle, 4)
|
||||||
numberOfNames = Read('uint', handle, fileheader)
|
numberOfNames = Read('uint', handle, fileheader)
|
||||||
log.debug("building #{0} names".format(numberOfNames))
|
log.debug("building #{0} names".format(numberOfNames))
|
||||||
for i in range(numberOfNames):
|
for i in range(numberOfNames):
|
||||||
name = ReadString(handle, 0)
|
name = ReadString(handle,0)
|
||||||
self.Names.append(DNAName(name))
|
self.Names.append(DNAName(name))
|
||||||
Align(handle)
|
Align(handle)
|
||||||
|
|
||||||
@@ -288,7 +287,7 @@ class DNACatalog:
|
|||||||
numberOfTypes = Read('uint', handle, fileheader)
|
numberOfTypes = Read('uint', handle, fileheader)
|
||||||
log.debug("building #{0} types".format(numberOfTypes))
|
log.debug("building #{0} types".format(numberOfTypes))
|
||||||
for i in range(numberOfTypes):
|
for i in range(numberOfTypes):
|
||||||
type = ReadString(handle, 0)
|
type = ReadString(handle,0)
|
||||||
self.Types.append(DNAType(type))
|
self.Types.append(DNAType(type))
|
||||||
Align(handle)
|
Align(handle)
|
||||||
|
|
||||||
@@ -322,24 +321,24 @@ class DNACatalog:
|
|||||||
class DNAName:
|
class DNAName:
|
||||||
'''
|
'''
|
||||||
DNAName is a C-type name stored in the DNA.
|
DNAName is a C-type name stored in the DNA.
|
||||||
|
|
||||||
Name = str
|
Name = str
|
||||||
'''
|
'''
|
||||||
|
|
||||||
def __init__(self, name):
|
def __init__(self, name):
|
||||||
self.Name = name
|
self.Name = name
|
||||||
|
|
||||||
def AsReference(self, parent):
|
def AsReference(self, parent):
|
||||||
if parent is None:
|
if parent is None:
|
||||||
result = ""
|
result = ""
|
||||||
else:
|
else:
|
||||||
result = parent + "."
|
result = parent+"."
|
||||||
|
|
||||||
result = result + self.ShortName()
|
result = result + self.ShortName()
|
||||||
return result
|
return result
|
||||||
|
|
||||||
def ShortName(self):
|
def ShortName(self):
|
||||||
result = self.Name
|
result = self.Name;
|
||||||
result = result.replace("*", "")
|
result = result.replace("*", "")
|
||||||
result = result.replace("(", "")
|
result = result.replace("(", "")
|
||||||
result = result.replace(")", "")
|
result = result.replace(")", "")
|
||||||
@@ -347,12 +346,12 @@ class DNAName:
|
|||||||
if Index != -1:
|
if Index != -1:
|
||||||
result = result[0:Index]
|
result = result[0:Index]
|
||||||
return result
|
return result
|
||||||
|
|
||||||
def IsPointer(self):
|
def IsPointer(self):
|
||||||
return self.Name.find("*") > -1
|
return self.Name.find("*")>-1
|
||||||
|
|
||||||
def IsMethodPointer(self):
|
def IsMethodPointer(self):
|
||||||
return self.Name.find("(*") > -1
|
return self.Name.find("(*")>-1
|
||||||
|
|
||||||
def ArraySize(self):
|
def ArraySize(self):
|
||||||
result = 1
|
result = 1
|
||||||
@@ -361,10 +360,10 @@ class DNAName:
|
|||||||
|
|
||||||
while Index != -1:
|
while Index != -1:
|
||||||
Index2 = Temp.find("]")
|
Index2 = Temp.find("]")
|
||||||
result *= int(Temp[Index + 1:Index2])
|
result*=int(Temp[Index+1:Index2])
|
||||||
Temp = Temp[Index2 + 1:]
|
Temp = Temp[Index2+1:]
|
||||||
Index = Temp.find("[")
|
Index = Temp.find("[")
|
||||||
|
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
|
||||||
@@ -376,46 +375,46 @@ class DNAType:
|
|||||||
Size = int
|
Size = int
|
||||||
Structure = DNAStructure
|
Structure = DNAStructure
|
||||||
'''
|
'''
|
||||||
|
|
||||||
def __init__(self, aName):
|
def __init__(self, aName):
|
||||||
self.Name = aName
|
self.Name = aName
|
||||||
self.Structure = None
|
self.Structure=None
|
||||||
|
|
||||||
|
|
||||||
class DNAStructure:
|
class DNAStructure:
|
||||||
'''
|
'''
|
||||||
DNAType is a C-type structure stored in the DNA
|
DNAType is a C-type structure stored in the DNA
|
||||||
|
|
||||||
Type = DNAType
|
Type = DNAType
|
||||||
Fields = [DNAField]
|
Fields = [DNAField]
|
||||||
'''
|
'''
|
||||||
|
|
||||||
def __init__(self, aType):
|
def __init__(self, aType):
|
||||||
self.Type = aType
|
self.Type = aType
|
||||||
self.Type.Structure = self
|
self.Type.Structure = self
|
||||||
self.Fields = []
|
self.Fields=[]
|
||||||
|
|
||||||
def GetField(self, header, handle, path):
|
def GetField(self, header, handle, path):
|
||||||
splitted = path.partition(".")
|
splitted = path.partition(".")
|
||||||
name = splitted[0]
|
name = splitted[0]
|
||||||
rest = splitted[2]
|
rest = splitted[2]
|
||||||
offset = 0
|
offset = 0;
|
||||||
for field in self.Fields:
|
for field in self.Fields:
|
||||||
if field.Name.ShortName() == name:
|
if field.Name.ShortName() == name:
|
||||||
log.debug("found " + name + "@" + str(offset))
|
log.debug("found "+name+"@"+str(offset))
|
||||||
handle.seek(offset, os.SEEK_CUR)
|
handle.seek(offset, os.SEEK_CUR)
|
||||||
return field.DecodeField(header, handle, rest)
|
return field.DecodeField(header, handle, rest)
|
||||||
else:
|
else:
|
||||||
offset += field.Size(header)
|
offset += field.Size(header)
|
||||||
|
|
||||||
log.debug("error did not find " + path)
|
log.debug("error did not find "+path)
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
||||||
class DNAField:
|
class DNAField:
|
||||||
'''
|
'''
|
||||||
DNAField is a coupled DNAType and DNAName.
|
DNAField is a coupled DNAType and DNAName.
|
||||||
|
|
||||||
Type = DNAType
|
Type = DNAType
|
||||||
Name = DNAName
|
Name = DNAName
|
||||||
'''
|
'''
|
||||||
@@ -423,24 +422,25 @@ class DNAField:
|
|||||||
def __init__(self, aType, aName):
|
def __init__(self, aType, aName):
|
||||||
self.Type = aType
|
self.Type = aType
|
||||||
self.Name = aName
|
self.Name = aName
|
||||||
|
|
||||||
def Size(self, header):
|
def Size(self, header):
|
||||||
if self.Name.IsPointer() or self.Name.IsMethodPointer():
|
if self.Name.IsPointer() or self.Name.IsMethodPointer():
|
||||||
return header.PointerSize * self.Name.ArraySize()
|
return header.PointerSize*self.Name.ArraySize()
|
||||||
else:
|
else:
|
||||||
return self.Type.Size * self.Name.ArraySize()
|
return self.Type.Size*self.Name.ArraySize()
|
||||||
|
|
||||||
def DecodeField(self, header, handle, path):
|
def DecodeField(self, header, handle, path):
|
||||||
if path == "":
|
if path == "":
|
||||||
if self.Name.IsPointer():
|
if self.Name.IsPointer():
|
||||||
return Read('pointer', handle, header)
|
return Read('pointer', handle, header)
|
||||||
if self.Type.Name == "int":
|
if self.Type.Name=="int":
|
||||||
return Read('int', handle, header)
|
return Read('int', handle, header)
|
||||||
if self.Type.Name == "short":
|
if self.Type.Name=="short":
|
||||||
return Read('short', handle, header)
|
return Read('short', handle, header)
|
||||||
if self.Type.Name == "float":
|
if self.Type.Name=="float":
|
||||||
return Read('float', handle, header)
|
return Read('float', handle, header)
|
||||||
if self.Type.Name == "char":
|
if self.Type.Name=="char":
|
||||||
return ReadString(handle, self.Name.ArraySize())
|
return ReadString(handle, self.Name.ArraySize())
|
||||||
else:
|
else:
|
||||||
return self.Type.Structure.GetField(header, handle, path)
|
return self.Type.Structure.GetField(header, handle, path)
|
||||||
|
|
||||||
|
@@ -42,7 +42,6 @@ def man_format(data):
|
|||||||
data = data.replace("\t", " ")
|
data = data.replace("\t", " ")
|
||||||
return data
|
return data
|
||||||
|
|
||||||
|
|
||||||
if len(sys.argv) != 3:
|
if len(sys.argv) != 3:
|
||||||
import getopt
|
import getopt
|
||||||
raise getopt.GetoptError("Usage: %s <path-to-blender> <output-filename>" % sys.argv[0])
|
raise getopt.GetoptError("Usage: %s <path-to-blender> <output-filename>" % sys.argv[0])
|
||||||
|
@@ -15,7 +15,6 @@ font_info = {
|
|||||||
"handler": None,
|
"handler": None,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
def init():
|
def init():
|
||||||
"""init function - runs once"""
|
"""init function - runs once"""
|
||||||
import os
|
import os
|
||||||
|
@@ -10,22 +10,22 @@ bm = bmesh.new()
|
|||||||
|
|
||||||
# Add a circle XXX, should return all geometry created, not just verts.
|
# Add a circle XXX, should return all geometry created, not just verts.
|
||||||
bmesh.ops.create_circle(
|
bmesh.ops.create_circle(
|
||||||
bm,
|
bm,
|
||||||
cap_ends=False,
|
cap_ends=False,
|
||||||
radius=0.2,
|
radius=0.2,
|
||||||
segments=8)
|
segments=8)
|
||||||
|
|
||||||
|
|
||||||
# Spin and deal with geometry on side 'a'
|
# Spin and deal with geometry on side 'a'
|
||||||
edges_start_a = bm.edges[:]
|
edges_start_a = bm.edges[:]
|
||||||
geom_start_a = bm.verts[:] + edges_start_a
|
geom_start_a = bm.verts[:] + edges_start_a
|
||||||
ret = bmesh.ops.spin(
|
ret = bmesh.ops.spin(
|
||||||
bm,
|
bm,
|
||||||
geom=geom_start_a,
|
geom=geom_start_a,
|
||||||
angle=math.radians(180.0),
|
angle=math.radians(180.0),
|
||||||
steps=8,
|
steps=8,
|
||||||
axis=(1.0, 0.0, 0.0),
|
axis=(1.0, 0.0, 0.0),
|
||||||
cent=(0.0, 1.0, 0.0))
|
cent=(0.0, 1.0, 0.0))
|
||||||
edges_end_a = [ele for ele in ret["geom_last"]
|
edges_end_a = [ele for ele in ret["geom_last"]
|
||||||
if isinstance(ele, bmesh.types.BMEdge)]
|
if isinstance(ele, bmesh.types.BMEdge)]
|
||||||
del ret
|
del ret
|
||||||
@@ -33,8 +33,8 @@ del ret
|
|||||||
|
|
||||||
# Extrude and create geometry on side 'b'
|
# Extrude and create geometry on side 'b'
|
||||||
ret = bmesh.ops.extrude_edge_only(
|
ret = bmesh.ops.extrude_edge_only(
|
||||||
bm,
|
bm,
|
||||||
edges=edges_start_a)
|
edges=edges_start_a)
|
||||||
geom_extrude_mid = ret["geom"]
|
geom_extrude_mid = ret["geom"]
|
||||||
del ret
|
del ret
|
||||||
|
|
||||||
@@ -45,19 +45,19 @@ verts_extrude_b = [ele for ele in geom_extrude_mid
|
|||||||
edges_extrude_b = [ele for ele in geom_extrude_mid
|
edges_extrude_b = [ele for ele in geom_extrude_mid
|
||||||
if isinstance(ele, bmesh.types.BMEdge) and ele.is_boundary]
|
if isinstance(ele, bmesh.types.BMEdge) and ele.is_boundary]
|
||||||
bmesh.ops.translate(
|
bmesh.ops.translate(
|
||||||
bm,
|
bm,
|
||||||
verts=verts_extrude_b,
|
verts=verts_extrude_b,
|
||||||
vec=(0.0, 0.0, 1.0))
|
vec=(0.0, 0.0, 1.0))
|
||||||
|
|
||||||
|
|
||||||
# Create the circle on side 'b'
|
# Create the circle on side 'b'
|
||||||
ret = bmesh.ops.spin(
|
ret = bmesh.ops.spin(
|
||||||
bm,
|
bm,
|
||||||
geom=verts_extrude_b + edges_extrude_b,
|
geom=verts_extrude_b + edges_extrude_b,
|
||||||
angle=-math.radians(180.0),
|
angle=-math.radians(180.0),
|
||||||
steps=8,
|
steps=8,
|
||||||
axis=(1.0, 0.0, 0.0),
|
axis=(1.0, 0.0, 0.0),
|
||||||
cent=(0.0, 1.0, 1.0))
|
cent=(0.0, 1.0, 1.0))
|
||||||
edges_end_b = [ele for ele in ret["geom_last"]
|
edges_end_b = [ele for ele in ret["geom_last"]
|
||||||
if isinstance(ele, bmesh.types.BMEdge)]
|
if isinstance(ele, bmesh.types.BMEdge)]
|
||||||
del ret
|
del ret
|
||||||
@@ -65,30 +65,30 @@ del ret
|
|||||||
|
|
||||||
# Bridge the resulting edge loops of both spins 'a & b'
|
# Bridge the resulting edge loops of both spins 'a & b'
|
||||||
bmesh.ops.bridge_loops(
|
bmesh.ops.bridge_loops(
|
||||||
bm,
|
bm,
|
||||||
edges=edges_end_a + edges_end_b)
|
edges=edges_end_a + edges_end_b)
|
||||||
|
|
||||||
|
|
||||||
# Now we have made a links of the chain, make a copy and rotate it
|
# Now we have made a links of the chain, make a copy and rotate it
|
||||||
# (so this looks something like a chain)
|
# (so this looks something like a chain)
|
||||||
|
|
||||||
ret = bmesh.ops.duplicate(
|
ret = bmesh.ops.duplicate(
|
||||||
bm,
|
bm,
|
||||||
geom=bm.verts[:] + bm.edges[:] + bm.faces[:])
|
geom=bm.verts[:] + bm.edges[:] + bm.faces[:])
|
||||||
geom_dupe = ret["geom"]
|
geom_dupe = ret["geom"]
|
||||||
verts_dupe = [ele for ele in geom_dupe if isinstance(ele, bmesh.types.BMVert)]
|
verts_dupe = [ele for ele in geom_dupe if isinstance(ele, bmesh.types.BMVert)]
|
||||||
del ret
|
del ret
|
||||||
|
|
||||||
# position the new link
|
# position the new link
|
||||||
bmesh.ops.translate(
|
bmesh.ops.translate(
|
||||||
bm,
|
bm,
|
||||||
verts=verts_dupe,
|
verts=verts_dupe,
|
||||||
vec=(0.0, 0.0, 2.0))
|
vec=(0.0, 0.0, 2.0))
|
||||||
bmesh.ops.rotate(
|
bmesh.ops.rotate(
|
||||||
bm,
|
bm,
|
||||||
verts=verts_dupe,
|
verts=verts_dupe,
|
||||||
cent=(0.0, 1.0, 0.0),
|
cent=(0.0, 1.0, 0.0),
|
||||||
matrix=mathutils.Matrix.Rotation(math.radians(90.0), 3, 'Z'))
|
matrix=mathutils.Matrix.Rotation(math.radians(90.0), 3, 'Z'))
|
||||||
|
|
||||||
# Done with creating the mesh, simply link it into the scene so we can see it
|
# Done with creating the mesh, simply link it into the scene so we can see it
|
||||||
|
|
||||||
|
@@ -17,5 +17,4 @@ from bpy.app.handlers import persistent
|
|||||||
def load_handler(dummy):
|
def load_handler(dummy):
|
||||||
print("Load Handler:", bpy.data.filepath)
|
print("Load Handler:", bpy.data.filepath)
|
||||||
|
|
||||||
|
|
||||||
bpy.app.handlers.load_post.append(load_handler)
|
bpy.app.handlers.load_post.append(load_handler)
|
||||||
|
@@ -11,5 +11,4 @@ import bpy
|
|||||||
def my_handler(scene):
|
def my_handler(scene):
|
||||||
print("Frame Change", scene.frame_current)
|
print("Frame Change", scene.frame_current)
|
||||||
|
|
||||||
|
|
||||||
bpy.app.handlers.frame_change_pre.append(my_handler)
|
bpy.app.handlers.frame_change_pre.append(my_handler)
|
||||||
|
@@ -54,19 +54,19 @@ translations_tuple = (
|
|||||||
"Copyright (C) 2013 The Blender Foundation.",
|
"Copyright (C) 2013 The Blender Foundation.",
|
||||||
"This file is distributed under the same license as the Blender package.",
|
"This file is distributed under the same license as the Blender package.",
|
||||||
"FIRST AUTHOR <EMAIL@ADDRESS>, YEAR."))),
|
"FIRST AUTHOR <EMAIL@ADDRESS>, YEAR."))),
|
||||||
),
|
),
|
||||||
(("Operator", "Render: Copy Settings"),
|
(("Operator", "Render: Copy Settings"),
|
||||||
(("bpy.types.SCENE_OT_render_copy_settings",),
|
(("bpy.types.SCENE_OT_render_copy_settings",),
|
||||||
()),
|
()),
|
||||||
("fr_FR", "Rendu : copier réglages",
|
("fr_FR", "Rendu : copier réglages",
|
||||||
(False, ())),
|
(False, ())),
|
||||||
),
|
),
|
||||||
(("*", "Copy render settings from current scene to others"),
|
(("*", "Copy render settings from current scene to others"),
|
||||||
(("bpy.types.SCENE_OT_render_copy_settings",),
|
(("bpy.types.SCENE_OT_render_copy_settings",),
|
||||||
()),
|
()),
|
||||||
("fr_FR", "Copier les réglages de rendu depuis la scène courante vers d’autres",
|
("fr_FR", "Copier les réglages de rendu depuis la scène courante vers d’autres",
|
||||||
(False, ())),
|
(False, ())),
|
||||||
),
|
),
|
||||||
# ... etc, all messages from your addon.
|
# ... etc, all messages from your addon.
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -81,7 +81,6 @@ for msg in translations_tuple:
|
|||||||
|
|
||||||
# Define remaining addon (operators, UI...) here.
|
# Define remaining addon (operators, UI...) here.
|
||||||
|
|
||||||
|
|
||||||
def register():
|
def register():
|
||||||
# Usual operator/UI/etc. registration...
|
# Usual operator/UI/etc. registration...
|
||||||
|
|
||||||
|
@@ -14,7 +14,6 @@ class MaterialSettings(bpy.types.PropertyGroup):
|
|||||||
my_float = bpy.props.FloatProperty()
|
my_float = bpy.props.FloatProperty()
|
||||||
my_string = bpy.props.StringProperty()
|
my_string = bpy.props.StringProperty()
|
||||||
|
|
||||||
|
|
||||||
bpy.utils.register_class(MaterialSettings)
|
bpy.utils.register_class(MaterialSettings)
|
||||||
|
|
||||||
bpy.types.Material.my_settings = \
|
bpy.types.Material.my_settings = \
|
||||||
|
@@ -14,7 +14,6 @@ class SceneSettingItem(bpy.types.PropertyGroup):
|
|||||||
name = bpy.props.StringProperty(name="Test Prop", default="Unknown")
|
name = bpy.props.StringProperty(name="Test Prop", default="Unknown")
|
||||||
value = bpy.props.IntProperty(name="Test Prop", default=22)
|
value = bpy.props.IntProperty(name="Test Prop", default=22)
|
||||||
|
|
||||||
|
|
||||||
bpy.utils.register_class(SceneSettingItem)
|
bpy.utils.register_class(SceneSettingItem)
|
||||||
|
|
||||||
bpy.types.Scene.my_settings = \
|
bpy.types.Scene.my_settings = \
|
||||||
|
@@ -14,7 +14,6 @@ import bpy
|
|||||||
def update_func(self, context):
|
def update_func(self, context):
|
||||||
print("my test function", self)
|
print("my test function", self)
|
||||||
|
|
||||||
|
|
||||||
bpy.types.Scene.testprop = bpy.props.FloatProperty(update=update_func)
|
bpy.types.Scene.testprop = bpy.props.FloatProperty(update=update_func)
|
||||||
|
|
||||||
bpy.context.scene.testprop = 11.0
|
bpy.context.scene.testprop = 11.0
|
||||||
|
@@ -19,7 +19,6 @@ def get_float(self):
|
|||||||
def set_float(self, value):
|
def set_float(self, value):
|
||||||
self["testprop"] = value
|
self["testprop"] = value
|
||||||
|
|
||||||
|
|
||||||
bpy.types.Scene.test_float = bpy.props.FloatProperty(get=get_float, set=set_float)
|
bpy.types.Scene.test_float = bpy.props.FloatProperty(get=get_float, set=set_float)
|
||||||
|
|
||||||
|
|
||||||
@@ -28,7 +27,6 @@ def get_date(self):
|
|||||||
import datetime
|
import datetime
|
||||||
return str(datetime.datetime.now())
|
return str(datetime.datetime.now())
|
||||||
|
|
||||||
|
|
||||||
bpy.types.Scene.test_date = bpy.props.StringProperty(get=get_date)
|
bpy.types.Scene.test_date = bpy.props.StringProperty(get=get_date)
|
||||||
|
|
||||||
|
|
||||||
@@ -42,7 +40,6 @@ def get_array(self):
|
|||||||
def set_array(self, values):
|
def set_array(self, values):
|
||||||
self["somebool"] = values[0] and values[1]
|
self["somebool"] = values[0] and values[1]
|
||||||
|
|
||||||
|
|
||||||
bpy.types.Scene.test_array = bpy.props.BoolVectorProperty(size=2, get=get_array, set=set_array)
|
bpy.types.Scene.test_array = bpy.props.BoolVectorProperty(size=2, get=get_array, set=set_array)
|
||||||
|
|
||||||
|
|
||||||
@@ -53,7 +50,7 @@ test_items = [
|
|||||||
("GREEN", "Green", "", 2),
|
("GREEN", "Green", "", 2),
|
||||||
("BLUE", "Blue", "", 3),
|
("BLUE", "Blue", "", 3),
|
||||||
("YELLOW", "Yellow", "", 4),
|
("YELLOW", "Yellow", "", 4),
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
def get_enum(self):
|
def get_enum(self):
|
||||||
@@ -64,7 +61,6 @@ def get_enum(self):
|
|||||||
def set_enum(self, value):
|
def set_enum(self, value):
|
||||||
print("setting value", value)
|
print("setting value", value)
|
||||||
|
|
||||||
|
|
||||||
bpy.types.Scene.test_enum = bpy.props.EnumProperty(items=test_items, get=get_enum, set=set_enum)
|
bpy.types.Scene.test_enum = bpy.props.EnumProperty(items=test_items, get=get_enum, set=set_enum)
|
||||||
|
|
||||||
|
|
||||||
|
@@ -9,7 +9,7 @@ bl_info = {
|
|||||||
"wiki_url": "",
|
"wiki_url": "",
|
||||||
"tracker_url": "",
|
"tracker_url": "",
|
||||||
"category": "Object",
|
"category": "Object",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
import bpy
|
import bpy
|
||||||
@@ -23,17 +23,17 @@ class ExampleAddonPreferences(AddonPreferences):
|
|||||||
bl_idname = __name__
|
bl_idname = __name__
|
||||||
|
|
||||||
filepath = StringProperty(
|
filepath = StringProperty(
|
||||||
name="Example File Path",
|
name="Example File Path",
|
||||||
subtype='FILE_PATH',
|
subtype='FILE_PATH',
|
||||||
)
|
)
|
||||||
number = IntProperty(
|
number = IntProperty(
|
||||||
name="Example Number",
|
name="Example Number",
|
||||||
default=4,
|
default=4,
|
||||||
)
|
)
|
||||||
boolean = BoolProperty(
|
boolean = BoolProperty(
|
||||||
name="Example Boolean",
|
name="Example Boolean",
|
||||||
default=False,
|
default=False,
|
||||||
)
|
)
|
||||||
|
|
||||||
def draw(self, context):
|
def draw(self, context):
|
||||||
layout = self.layout
|
layout = self.layout
|
||||||
|
@@ -14,5 +14,4 @@ import bpy
|
|||||||
def menu_draw(self, context):
|
def menu_draw(self, context):
|
||||||
self.layout.operator("wm.save_homefile")
|
self.layout.operator("wm.save_homefile")
|
||||||
|
|
||||||
|
|
||||||
bpy.types.INFO_MT_file.append(menu_draw)
|
bpy.types.INFO_MT_file.append(menu_draw)
|
||||||
|
@@ -32,7 +32,7 @@ class AddPresetObjectDraw(AddPresetBase, Operator):
|
|||||||
# variable used for all preset values
|
# variable used for all preset values
|
||||||
preset_defines = [
|
preset_defines = [
|
||||||
"obj = bpy.context.object"
|
"obj = bpy.context.object"
|
||||||
]
|
]
|
||||||
|
|
||||||
# properties to store in the preset
|
# properties to store in the preset
|
||||||
preset_values = [
|
preset_values = [
|
||||||
@@ -42,7 +42,7 @@ class AddPresetObjectDraw(AddPresetBase, Operator):
|
|||||||
"obj.show_name",
|
"obj.show_name",
|
||||||
"obj.show_axis",
|
"obj.show_axis",
|
||||||
"obj.show_wire",
|
"obj.show_wire",
|
||||||
]
|
]
|
||||||
|
|
||||||
# where to store the preset
|
# where to store the preset
|
||||||
preset_subdir = "object/draw"
|
preset_subdir = "object/draw"
|
||||||
@@ -61,7 +61,7 @@ def panel_func(self, context):
|
|||||||
classes = (
|
classes = (
|
||||||
OBJECT_MT_draw_presets,
|
OBJECT_MT_draw_presets,
|
||||||
AddPresetObjectDraw,
|
AddPresetObjectDraw,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def register():
|
def register():
|
||||||
|
@@ -60,7 +60,6 @@ def menu_func(self, context):
|
|||||||
layout.separator()
|
layout.separator()
|
||||||
layout.operator(WM_OT_button_context_test.bl_idname)
|
layout.operator(WM_OT_button_context_test.bl_idname)
|
||||||
|
|
||||||
|
|
||||||
classes = (
|
classes = (
|
||||||
WM_OT_button_context_test,
|
WM_OT_button_context_test,
|
||||||
WM_MT_button_context,
|
WM_MT_button_context,
|
||||||
@@ -78,6 +77,5 @@ def unregister():
|
|||||||
bpy.utils.unregister_class(cls)
|
bpy.utils.unregister_class(cls)
|
||||||
bpy.types.WM_MT_button_context.remove(menu_func)
|
bpy.types.WM_MT_button_context.remove(menu_func)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
register()
|
register()
|
||||||
|
@@ -21,5 +21,4 @@ class CyclesNodeTree(bpy.types.NodeTree):
|
|||||||
def poll(cls, context):
|
def poll(cls, context):
|
||||||
return context.scene.render.engine == 'CYCLES'
|
return context.scene.render.engine == 'CYCLES'
|
||||||
|
|
||||||
|
|
||||||
bpy.utils.register_class(CyclesNodeTree)
|
bpy.utils.register_class(CyclesNodeTree)
|
||||||
|
@@ -42,7 +42,6 @@ class SimpleMouseOperator(bpy.types.Operator):
|
|||||||
self.y = event.mouse_y
|
self.y = event.mouse_y
|
||||||
return self.execute(context)
|
return self.execute(context)
|
||||||
|
|
||||||
|
|
||||||
bpy.utils.register_class(SimpleMouseOperator)
|
bpy.utils.register_class(SimpleMouseOperator)
|
||||||
|
|
||||||
# Test call to the newly defined operator.
|
# Test call to the newly defined operator.
|
||||||
|
@@ -42,7 +42,6 @@ def menu_func(self, context):
|
|||||||
self.layout.operator_context = 'INVOKE_DEFAULT'
|
self.layout.operator_context = 'INVOKE_DEFAULT'
|
||||||
self.layout.operator(ExportSomeData.bl_idname, text="Text Export Operator")
|
self.layout.operator(ExportSomeData.bl_idname, text="Text Export Operator")
|
||||||
|
|
||||||
|
|
||||||
# Register and add to the file selector
|
# Register and add to the file selector
|
||||||
bpy.utils.register_class(ExportSomeData)
|
bpy.utils.register_class(ExportSomeData)
|
||||||
bpy.types.INFO_MT_file_export.append(menu_func)
|
bpy.types.INFO_MT_file_export.append(menu_func)
|
||||||
|
@@ -41,7 +41,6 @@ class CustomDrawOperator(bpy.types.Operator):
|
|||||||
|
|
||||||
col.prop(self, "my_string")
|
col.prop(self, "my_string")
|
||||||
|
|
||||||
|
|
||||||
bpy.utils.register_class(CustomDrawOperator)
|
bpy.utils.register_class(CustomDrawOperator)
|
||||||
|
|
||||||
# test call
|
# test call
|
||||||
|
@@ -22,7 +22,6 @@ class HelloWorldOperator(bpy.types.Operator):
|
|||||||
print("Hello World")
|
print("Hello World")
|
||||||
return {'FINISHED'}
|
return {'FINISHED'}
|
||||||
|
|
||||||
|
|
||||||
bpy.utils.register_class(HelloWorldOperator)
|
bpy.utils.register_class(HelloWorldOperator)
|
||||||
|
|
||||||
# test call to the newly defined operator
|
# test call to the newly defined operator
|
||||||
|
@@ -31,7 +31,6 @@ class MyPropertyGroup(bpy.types.PropertyGroup):
|
|||||||
custom_1 = bpy.props.FloatProperty(name="My Float")
|
custom_1 = bpy.props.FloatProperty(name="My Float")
|
||||||
custom_2 = bpy.props.IntProperty(name="My Int")
|
custom_2 = bpy.props.IntProperty(name="My Int")
|
||||||
|
|
||||||
|
|
||||||
bpy.utils.register_class(MyPropertyGroup)
|
bpy.utils.register_class(MyPropertyGroup)
|
||||||
|
|
||||||
bpy.types.Object.my_prop_grp = bpy.props.PointerProperty(type=MyPropertyGroup)
|
bpy.types.Object.my_prop_grp = bpy.props.PointerProperty(type=MyPropertyGroup)
|
||||||
|
@@ -10,5 +10,4 @@ import bpy
|
|||||||
def draw(self, context):
|
def draw(self, context):
|
||||||
self.layout.label("Hello World")
|
self.layout.label("Hello World")
|
||||||
|
|
||||||
|
|
||||||
bpy.context.window_manager.popup_menu(draw, title="Greeting", icon='INFO')
|
bpy.context.window_manager.popup_menu(draw, title="Greeting", icon='INFO')
|
||||||
|
@@ -12,7 +12,6 @@ from bpy.props import PointerProperty
|
|||||||
class MyPropGroup(bpy.types.PropertyGroup):
|
class MyPropGroup(bpy.types.PropertyGroup):
|
||||||
nested = bpy.props.FloatProperty(name="Nested", default=0.0)
|
nested = bpy.props.FloatProperty(name="Nested", default=0.0)
|
||||||
|
|
||||||
|
|
||||||
# register it so its available for all bones
|
# register it so its available for all bones
|
||||||
bpy.utils.register_class(MyPropGroup)
|
bpy.utils.register_class(MyPropGroup)
|
||||||
bpy.types.Bone.my_prop = PointerProperty(type=MyPropGroup,
|
bpy.types.Bone.my_prop = PointerProperty(type=MyPropGroup,
|
||||||
|
@@ -23,9 +23,9 @@ class OffScreenDraw(bpy.types.Operator):
|
|||||||
@staticmethod
|
@staticmethod
|
||||||
def handle_add(self, context):
|
def handle_add(self, context):
|
||||||
OffScreenDraw._handle_draw = bpy.types.SpaceView3D.draw_handler_add(
|
OffScreenDraw._handle_draw = bpy.types.SpaceView3D.draw_handler_add(
|
||||||
self.draw_callback_px, (self, context),
|
self.draw_callback_px, (self, context),
|
||||||
'WINDOW', 'POST_PIXEL',
|
'WINDOW', 'POST_PIXEL',
|
||||||
)
|
)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def handle_remove():
|
def handle_remove():
|
||||||
@@ -58,20 +58,20 @@ class OffScreenDraw(bpy.types.Operator):
|
|||||||
|
|
||||||
modelview_matrix = camera.matrix_world.inverted()
|
modelview_matrix = camera.matrix_world.inverted()
|
||||||
projection_matrix = camera.calc_matrix_camera(
|
projection_matrix = camera.calc_matrix_camera(
|
||||||
render.resolution_x,
|
render.resolution_x,
|
||||||
render.resolution_y,
|
render.resolution_y,
|
||||||
render.pixel_aspect_x,
|
render.pixel_aspect_x,
|
||||||
render.pixel_aspect_y,
|
render.pixel_aspect_y,
|
||||||
)
|
)
|
||||||
|
|
||||||
offscreen.draw_view3d(
|
offscreen.draw_view3d(
|
||||||
scene,
|
scene,
|
||||||
render_layer,
|
render_layer,
|
||||||
context.space_data,
|
context.space_data,
|
||||||
context.region,
|
context.region,
|
||||||
projection_matrix,
|
projection_matrix,
|
||||||
modelview_matrix,
|
modelview_matrix,
|
||||||
)
|
)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def _opengl_draw(context, texture, aspect_ratio, scale):
|
def _opengl_draw(context, texture, aspect_ratio, scale):
|
||||||
|
@@ -73,8 +73,6 @@ def rna_info_BuildRNAInfo_cache():
|
|||||||
if rna_info_BuildRNAInfo_cache.ret is None:
|
if rna_info_BuildRNAInfo_cache.ret is None:
|
||||||
rna_info_BuildRNAInfo_cache.ret = rna_info.BuildRNAInfo()
|
rna_info_BuildRNAInfo_cache.ret = rna_info.BuildRNAInfo()
|
||||||
return rna_info_BuildRNAInfo_cache.ret
|
return rna_info_BuildRNAInfo_cache.ret
|
||||||
|
|
||||||
|
|
||||||
rna_info_BuildRNAInfo_cache.ret = None
|
rna_info_BuildRNAInfo_cache.ret = None
|
||||||
# --- end rna_info cache
|
# --- end rna_info cache
|
||||||
|
|
||||||
@@ -334,9 +332,9 @@ except ImportError:
|
|||||||
# to avoid having to match Blender's source tree.
|
# to avoid having to match Blender's source tree.
|
||||||
EXTRA_SOURCE_FILES = (
|
EXTRA_SOURCE_FILES = (
|
||||||
"../../../release/scripts/templates_py/bmesh_simple.py",
|
"../../../release/scripts/templates_py/bmesh_simple.py",
|
||||||
"../../../release/scripts/templates_py/gizmo_operator.py",
|
"../../../release/scripts/templates_py/manipulator_operator.py",
|
||||||
"../../../release/scripts/templates_py/gizmo_operator_target.py",
|
"../../../release/scripts/templates_py/manipulator_operator_target.py",
|
||||||
"../../../release/scripts/templates_py/gizmo_simple.py",
|
"../../../release/scripts/templates_py/manipulator_simple.py",
|
||||||
"../../../release/scripts/templates_py/operator_simple.py",
|
"../../../release/scripts/templates_py/operator_simple.py",
|
||||||
"../../../release/scripts/templates_py/ui_panel_simple.py",
|
"../../../release/scripts/templates_py/ui_panel_simple.py",
|
||||||
"../../../release/scripts/templates_py/ui_previews_custom_icon.py",
|
"../../../release/scripts/templates_py/ui_previews_custom_icon.py",
|
||||||
@@ -436,7 +434,7 @@ else:
|
|||||||
BLENDER_VERSION_DOTS = ".".join(blender_version_strings)
|
BLENDER_VERSION_DOTS = ".".join(blender_version_strings)
|
||||||
if BLENDER_REVISION != "Unknown":
|
if BLENDER_REVISION != "Unknown":
|
||||||
# '2.62a SHA1' (release) or '2.62.1 SHA1' (non-release)
|
# '2.62a SHA1' (release) or '2.62.1 SHA1' (non-release)
|
||||||
BLENDER_VERSION_DOTS += " " + BLENDER_REVISION
|
BLENDER_VERSION_DOTS += " " + BLENDER_REVISION
|
||||||
|
|
||||||
if is_release:
|
if is_release:
|
||||||
# '2_62a_release'
|
# '2_62a_release'
|
||||||
@@ -518,8 +516,6 @@ def escape_rst(text):
|
|||||||
""" Escape plain text which may contain characters used by RST.
|
""" Escape plain text which may contain characters used by RST.
|
||||||
"""
|
"""
|
||||||
return text.translate(escape_rst.trans)
|
return text.translate(escape_rst.trans)
|
||||||
|
|
||||||
|
|
||||||
escape_rst.trans = str.maketrans({
|
escape_rst.trans = str.maketrans({
|
||||||
"`": "\\`",
|
"`": "\\`",
|
||||||
"|": "\\|",
|
"|": "\\|",
|
||||||
@@ -1022,7 +1018,6 @@ def pymodule2sphinx(basepath, module_name, module, title):
|
|||||||
|
|
||||||
file.close()
|
file.close()
|
||||||
|
|
||||||
|
|
||||||
# Changes in Blender will force errors here
|
# Changes in Blender will force errors here
|
||||||
context_type_map = {
|
context_type_map = {
|
||||||
"active_base": ("ObjectBase", False),
|
"active_base": ("ObjectBase", False),
|
||||||
|
@@ -21,7 +21,7 @@
|
|||||||
# <pep8 compliant>
|
# <pep8 compliant>
|
||||||
|
|
||||||
bpy_types_Operator_bl_property__doc__ = (
|
bpy_types_Operator_bl_property__doc__ = (
|
||||||
"""
|
"""
|
||||||
The name of a property to use as this operators primary property.
|
The name of a property to use as this operators primary property.
|
||||||
Currently this is only used to select the default property when
|
Currently this is only used to select the default property when
|
||||||
expanding an operator into a menu.
|
expanding an operator into a menu.
|
||||||
|
@@ -29,7 +29,7 @@ You'll need to specify your user login and password, obviously.
|
|||||||
|
|
||||||
Example usage:
|
Example usage:
|
||||||
|
|
||||||
./sphinx_doc_update.py --mirror ../../../docs/remote_api_backup/ --source ../.. --blender ../../../build_cmake/bin/blender --user foobar --password barfoo
|
./sphinx_doc_update.py --mirror ../../../docs/remote_api_backup/ --source ../.. --blender ../../../build_cmake/bin/blender --user foobar --password barfoo
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
@@ -107,16 +107,14 @@ def main():
|
|||||||
|
|
||||||
with tempfile.TemporaryDirectory() as tmp_dir:
|
with tempfile.TemporaryDirectory() as tmp_dir:
|
||||||
# II) Generate doc source in temp dir.
|
# II) Generate doc source in temp dir.
|
||||||
doc_gen_cmd = (
|
doc_gen_cmd = (args.blender, "--background", "-noaudio", "--factory-startup", "--python-exit-code", "1",
|
||||||
args.blender, "--background", "-noaudio", "--factory-startup", "--python-exit-code", "1",
|
"--python", "%s/doc/python_api/sphinx_doc_gen.py" % args.source_dir, "--",
|
||||||
"--python", "%s/doc/python_api/sphinx_doc_gen.py" % args.source_dir, "--",
|
"--output", tmp_dir)
|
||||||
"--output", tmp_dir
|
|
||||||
)
|
|
||||||
subprocess.run(doc_gen_cmd)
|
subprocess.run(doc_gen_cmd)
|
||||||
|
|
||||||
# III) Get Blender version info.
|
# III) Get Blender version info.
|
||||||
getver_file = os.path.join(tmp_dir, "blendver.txt")
|
getver_file = os.path.join(tmp_dir, "blendver.txt")
|
||||||
getver_script = (
|
getver_script = (""
|
||||||
"import sys, bpy\n"
|
"import sys, bpy\n"
|
||||||
"with open(sys.argv[-1], 'w') as f:\n"
|
"with open(sys.argv[-1], 'w') as f:\n"
|
||||||
" is_release = bpy.app.version_cycle in {'rc', 'release'}\n"
|
" is_release = bpy.app.version_cycle in {'rc', 'release'}\n"
|
||||||
@@ -126,8 +124,7 @@ def main():
|
|||||||
" f.write('%d.%d%s\\n' % (bpy.app.version[0], bpy.app.version[1], bpy.app.version_char)\n"
|
" f.write('%d.%d%s\\n' % (bpy.app.version[0], bpy.app.version[1], bpy.app.version_char)\n"
|
||||||
" if is_release else '%s\\n' % branch)\n"
|
" if is_release else '%s\\n' % branch)\n"
|
||||||
" f.write('%d_%d%s_release' % (bpy.app.version[0], bpy.app.version[1], bpy.app.version_char)\n"
|
" f.write('%d_%d%s_release' % (bpy.app.version[0], bpy.app.version[1], bpy.app.version_char)\n"
|
||||||
" if is_release else '%d_%d_%d' % bpy.app.version)\n"
|
" if is_release else '%d_%d_%d' % bpy.app.version)\n")
|
||||||
)
|
|
||||||
get_ver_cmd = (args.blender, "--background", "-noaudio", "--factory-startup", "--python-exit-code", "1",
|
get_ver_cmd = (args.blender, "--background", "-noaudio", "--factory-startup", "--python-exit-code", "1",
|
||||||
"--python-expr", getver_script, "--", getver_file)
|
"--python-expr", getver_script, "--", getver_file)
|
||||||
subprocess.run(get_ver_cmd)
|
subprocess.run(get_ver_cmd)
|
||||||
|
4
extern/CMakeLists.txt
vendored
4
extern/CMakeLists.txt
vendored
@@ -75,9 +75,9 @@ if(WITH_LZMA)
|
|||||||
add_subdirectory(lzma)
|
add_subdirectory(lzma)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(WITH_CYCLES OR WITH_COMPOSITOR OR WITH_OPENSUBDIV OR TRUE)
|
if(WITH_CYCLES OR WITH_COMPOSITOR OR WITH_OPENSUBDIV)
|
||||||
add_subdirectory(clew)
|
add_subdirectory(clew)
|
||||||
if(WITH_CUDA_DYNLOAD AND FALSE)
|
if(WITH_CUDA_DYNLOAD)
|
||||||
add_subdirectory(cuew)
|
add_subdirectory(cuew)
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
6
extern/audaspace/CMakeLists.txt
vendored
6
extern/audaspace/CMakeLists.txt
vendored
@@ -88,7 +88,7 @@ set(SRC
|
|||||||
src/fx/Volume.cpp
|
src/fx/Volume.cpp
|
||||||
src/fx/VolumeReader.cpp
|
src/fx/VolumeReader.cpp
|
||||||
src/fx/VolumeSound.cpp
|
src/fx/VolumeSound.cpp
|
||||||
src/fx/VolumeStorage.cpp
|
src/fx/VolumeStorage.cpp
|
||||||
src/generator/Sawtooth.cpp
|
src/generator/Sawtooth.cpp
|
||||||
src/generator/SawtoothReader.cpp
|
src/generator/SawtoothReader.cpp
|
||||||
src/generator/Silence.cpp
|
src/generator/Silence.cpp
|
||||||
@@ -729,8 +729,8 @@ set(LIB_DESTINATION "lib${LIB_SUFFIX}")
|
|||||||
# library
|
# library
|
||||||
|
|
||||||
add_library(audaspace ${LIBRARY_TYPE} ${SRC} ${HDR})
|
add_library(audaspace ${LIBRARY_TYPE} ${SRC} ${HDR})
|
||||||
target_link_libraries(audaspace ${LIBRARIES})
|
target_link_libraries(audaspace ${LIBRARIES})
|
||||||
set_target_properties(audaspace PROPERTIES SOVERSION ${AUDASPACE_VERSION})
|
set_target_properties(audaspace PROPERTIES SOVERSION ${AUDASPACE_VERSION})
|
||||||
|
|
||||||
if(AUDASPACE_STANDALONE)
|
if(AUDASPACE_STANDALONE)
|
||||||
install(TARGETS audaspace
|
install(TARGETS audaspace
|
||||||
|
2
extern/audaspace/plugins/ffmpeg/FFMPEG.cpp
vendored
2
extern/audaspace/plugins/ffmpeg/FFMPEG.cpp
vendored
@@ -23,9 +23,7 @@ AUD_NAMESPACE_BEGIN
|
|||||||
|
|
||||||
FFMPEG::FFMPEG()
|
FFMPEG::FFMPEG()
|
||||||
{
|
{
|
||||||
#if LIBAVCODEC_VERSION_MAJOR < 58
|
|
||||||
av_register_all();
|
av_register_all();
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void FFMPEG::registerPlugin()
|
void FFMPEG::registerPlugin()
|
||||||
|
124
extern/audaspace/plugins/ffmpeg/FFMPEGReader.cpp
vendored
124
extern/audaspace/plugins/ffmpeg/FFMPEGReader.cpp
vendored
@@ -22,37 +22,37 @@
|
|||||||
extern "C" {
|
extern "C" {
|
||||||
#include <libavcodec/avcodec.h>
|
#include <libavcodec/avcodec.h>
|
||||||
#include <libavformat/avio.h>
|
#include <libavformat/avio.h>
|
||||||
#include <libavutil/avutil.h>
|
|
||||||
}
|
}
|
||||||
|
|
||||||
AUD_NAMESPACE_BEGIN
|
AUD_NAMESPACE_BEGIN
|
||||||
|
|
||||||
#if LIBAVCODEC_VERSION_MAJOR < 58
|
|
||||||
#define FFMPEG_OLD_CODE
|
|
||||||
#endif
|
|
||||||
|
|
||||||
int FFMPEGReader::decode(AVPacket& packet, Buffer& buffer)
|
int FFMPEGReader::decode(AVPacket& packet, Buffer& buffer)
|
||||||
{
|
{
|
||||||
int buf_size = buffer.getSize();
|
AVFrame* frame = nullptr;
|
||||||
int buf_pos = 0;
|
|
||||||
|
|
||||||
#ifdef FFMPEG_OLD_CODE
|
|
||||||
int got_frame;
|
int got_frame;
|
||||||
int read_length;
|
int read_length;
|
||||||
uint8_t* orig_data = packet.data;
|
uint8_t* orig_data = packet.data;
|
||||||
int orig_size = packet.size;
|
int orig_size = packet.size;
|
||||||
|
|
||||||
|
int buf_size = buffer.getSize();
|
||||||
|
int buf_pos = 0;
|
||||||
|
|
||||||
while(packet.size > 0)
|
while(packet.size > 0)
|
||||||
{
|
{
|
||||||
got_frame = 0;
|
got_frame = 0;
|
||||||
|
|
||||||
read_length = avcodec_decode_audio4(m_codecCtx, m_frame, &got_frame, &packet);
|
if(!frame)
|
||||||
|
frame = av_frame_alloc();
|
||||||
|
else
|
||||||
|
av_frame_unref(frame);
|
||||||
|
|
||||||
|
read_length = avcodec_decode_audio4(m_codecCtx, frame, &got_frame, &packet);
|
||||||
if(read_length < 0)
|
if(read_length < 0)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if(got_frame)
|
if(got_frame)
|
||||||
{
|
{
|
||||||
int data_size = av_samples_get_buffer_size(nullptr, m_codecCtx->channels, m_frame->nb_samples, m_codecCtx->sample_fmt, 1);
|
int data_size = av_samples_get_buffer_size(nullptr, m_codecCtx->channels, frame->nb_samples, m_codecCtx->sample_fmt, 1);
|
||||||
|
|
||||||
if(buf_size - buf_pos < data_size)
|
if(buf_size - buf_pos < data_size)
|
||||||
{
|
{
|
||||||
@@ -62,18 +62,18 @@ int FFMPEGReader::decode(AVPacket& packet, Buffer& buffer)
|
|||||||
|
|
||||||
if(m_tointerleave)
|
if(m_tointerleave)
|
||||||
{
|
{
|
||||||
int single_size = data_size / m_codecCtx->channels / m_frame->nb_samples;
|
int single_size = data_size / m_codecCtx->channels / frame->nb_samples;
|
||||||
for(int channel = 0; channel < m_codecCtx->channels; channel++)
|
for(int channel = 0; channel < m_codecCtx->channels; channel++)
|
||||||
{
|
{
|
||||||
for(int i = 0; i < m_frame->nb_samples; i++)
|
for(int i = 0; i < frame->nb_samples; i++)
|
||||||
{
|
{
|
||||||
std::memcpy(((data_t*)buffer.getBuffer()) + buf_pos + ((m_codecCtx->channels * i) + channel) * single_size,
|
std::memcpy(((data_t*)buffer.getBuffer()) + buf_pos + ((m_codecCtx->channels * i) + channel) * single_size,
|
||||||
m_frame->data[channel] + i * single_size, single_size);
|
frame->data[channel] + i * single_size, single_size);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
std::memcpy(((data_t*)buffer.getBuffer()) + buf_pos, m_frame->data[0], data_size);
|
std::memcpy(((data_t*)buffer.getBuffer()) + buf_pos, frame->data[0], data_size);
|
||||||
|
|
||||||
buf_pos += data_size;
|
buf_pos += data_size;
|
||||||
}
|
}
|
||||||
@@ -83,42 +83,7 @@ int FFMPEGReader::decode(AVPacket& packet, Buffer& buffer)
|
|||||||
|
|
||||||
packet.data = orig_data;
|
packet.data = orig_data;
|
||||||
packet.size = orig_size;
|
packet.size = orig_size;
|
||||||
#else
|
av_free(frame);
|
||||||
avcodec_send_packet(m_codecCtx, &packet);
|
|
||||||
|
|
||||||
while(true)
|
|
||||||
{
|
|
||||||
auto ret = avcodec_receive_frame(m_codecCtx, m_frame);
|
|
||||||
|
|
||||||
if(ret != 0)
|
|
||||||
break;
|
|
||||||
|
|
||||||
int data_size = av_samples_get_buffer_size(nullptr, m_codecCtx->channels, m_frame->nb_samples, m_codecCtx->sample_fmt, 1);
|
|
||||||
|
|
||||||
if(buf_size - buf_pos < data_size)
|
|
||||||
{
|
|
||||||
buffer.resize(buf_size + data_size, true);
|
|
||||||
buf_size += data_size;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(m_tointerleave)
|
|
||||||
{
|
|
||||||
int single_size = data_size / m_codecCtx->channels / m_frame->nb_samples;
|
|
||||||
for(int channel = 0; channel < m_codecCtx->channels; channel++)
|
|
||||||
{
|
|
||||||
for(int i = 0; i < m_frame->nb_samples; i++)
|
|
||||||
{
|
|
||||||
std::memcpy(((data_t*)buffer.getBuffer()) + buf_pos + ((m_codecCtx->channels * i) + channel) * single_size,
|
|
||||||
m_frame->data[channel] + i * single_size, single_size);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
std::memcpy(((data_t*)buffer.getBuffer()) + buf_pos, m_frame->data[0], data_size);
|
|
||||||
|
|
||||||
buf_pos += data_size;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return buf_pos;
|
return buf_pos;
|
||||||
}
|
}
|
||||||
@@ -136,11 +101,7 @@ void FFMPEGReader::init()
|
|||||||
|
|
||||||
for(unsigned int i = 0; i < m_formatCtx->nb_streams; i++)
|
for(unsigned int i = 0; i < m_formatCtx->nb_streams; i++)
|
||||||
{
|
{
|
||||||
#ifdef FFMPEG_OLD_CODE
|
|
||||||
if((m_formatCtx->streams[i]->codec->codec_type == AVMEDIA_TYPE_AUDIO)
|
if((m_formatCtx->streams[i]->codec->codec_type == AVMEDIA_TYPE_AUDIO)
|
||||||
#else
|
|
||||||
if((m_formatCtx->streams[i]->codecpar->codec_type == AVMEDIA_TYPE_AUDIO)
|
|
||||||
#endif
|
|
||||||
&& (m_stream < 0))
|
&& (m_stream < 0))
|
||||||
{
|
{
|
||||||
m_stream=i;
|
m_stream=i;
|
||||||
@@ -151,34 +112,12 @@ void FFMPEGReader::init()
|
|||||||
if(m_stream == -1)
|
if(m_stream == -1)
|
||||||
AUD_THROW(FileException, "File couldn't be read, no audio stream found by ffmpeg.");
|
AUD_THROW(FileException, "File couldn't be read, no audio stream found by ffmpeg.");
|
||||||
|
|
||||||
// get a decoder and open it
|
|
||||||
#ifndef FFMPEG_OLD_CODE
|
|
||||||
AVCodec* aCodec = avcodec_find_decoder(m_formatCtx->streams[m_stream]->codecpar->codec_id);
|
|
||||||
|
|
||||||
if(!aCodec)
|
|
||||||
AUD_THROW(FileException, "File couldn't be read, no decoder found with ffmpeg.");
|
|
||||||
#endif
|
|
||||||
|
|
||||||
m_frame = av_frame_alloc();
|
|
||||||
|
|
||||||
if(!m_frame)
|
|
||||||
AUD_THROW(FileException, "File couldn't be read, ffmpeg frame couldn't be allocated.");
|
|
||||||
|
|
||||||
#ifdef FFMPEG_OLD_CODE
|
|
||||||
m_codecCtx = m_formatCtx->streams[m_stream]->codec;
|
m_codecCtx = m_formatCtx->streams[m_stream]->codec;
|
||||||
|
|
||||||
|
// get a decoder and open it
|
||||||
AVCodec* aCodec = avcodec_find_decoder(m_codecCtx->codec_id);
|
AVCodec* aCodec = avcodec_find_decoder(m_codecCtx->codec_id);
|
||||||
#else
|
if(!aCodec)
|
||||||
m_codecCtx = avcodec_alloc_context3(aCodec);
|
AUD_THROW(FileException, "File couldn't be read, no decoder found with ffmpeg.");
|
||||||
#endif
|
|
||||||
|
|
||||||
if(!m_codecCtx)
|
|
||||||
AUD_THROW(FileException, "File couldn't be read, ffmpeg context couldn't be allocated.");
|
|
||||||
|
|
||||||
#ifndef FFMPEG_OLD_CODE
|
|
||||||
if(avcodec_parameters_to_context(m_codecCtx, m_formatCtx->streams[m_stream]->codecpar) < 0)
|
|
||||||
AUD_THROW(FileException, "File couldn't be read, ffmpeg decoder parameters couldn't be copied to decoder context.");
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if(avcodec_open2(m_codecCtx, aCodec, nullptr) < 0)
|
if(avcodec_open2(m_codecCtx, aCodec, nullptr) < 0)
|
||||||
AUD_THROW(FileException, "File couldn't be read, ffmpeg codec couldn't be opened.");
|
AUD_THROW(FileException, "File couldn't be read, ffmpeg codec couldn't be opened.");
|
||||||
@@ -218,8 +157,6 @@ void FFMPEGReader::init()
|
|||||||
FFMPEGReader::FFMPEGReader(std::string filename) :
|
FFMPEGReader::FFMPEGReader(std::string filename) :
|
||||||
m_pkgbuf(),
|
m_pkgbuf(),
|
||||||
m_formatCtx(nullptr),
|
m_formatCtx(nullptr),
|
||||||
m_codecCtx(nullptr),
|
|
||||||
m_frame(nullptr),
|
|
||||||
m_aviocontext(nullptr),
|
m_aviocontext(nullptr),
|
||||||
m_membuf(nullptr)
|
m_membuf(nullptr)
|
||||||
{
|
{
|
||||||
@@ -240,14 +177,12 @@ FFMPEGReader::FFMPEGReader(std::string filename) :
|
|||||||
|
|
||||||
FFMPEGReader::FFMPEGReader(std::shared_ptr<Buffer> buffer) :
|
FFMPEGReader::FFMPEGReader(std::shared_ptr<Buffer> buffer) :
|
||||||
m_pkgbuf(),
|
m_pkgbuf(),
|
||||||
m_codecCtx(nullptr),
|
|
||||||
m_frame(nullptr),
|
|
||||||
m_membuffer(buffer),
|
m_membuffer(buffer),
|
||||||
m_membufferpos(0)
|
m_membufferpos(0)
|
||||||
{
|
{
|
||||||
m_membuf = reinterpret_cast<data_t*>(av_malloc(AV_INPUT_BUFFER_MIN_SIZE + AV_INPUT_BUFFER_PADDING_SIZE));
|
m_membuf = reinterpret_cast<data_t*>(av_malloc(FF_MIN_BUFFER_SIZE + FF_INPUT_BUFFER_PADDING_SIZE));
|
||||||
|
|
||||||
m_aviocontext = avio_alloc_context(m_membuf, AV_INPUT_BUFFER_MIN_SIZE, 0, this, read_packet, nullptr, seek_packet);
|
m_aviocontext = avio_alloc_context(m_membuf, FF_MIN_BUFFER_SIZE, 0, this, read_packet, nullptr, seek_packet);
|
||||||
|
|
||||||
if(!m_aviocontext)
|
if(!m_aviocontext)
|
||||||
{
|
{
|
||||||
@@ -277,14 +212,7 @@ FFMPEGReader::FFMPEGReader(std::shared_ptr<Buffer> buffer) :
|
|||||||
|
|
||||||
FFMPEGReader::~FFMPEGReader()
|
FFMPEGReader::~FFMPEGReader()
|
||||||
{
|
{
|
||||||
if(m_frame)
|
|
||||||
av_frame_free(&m_frame);
|
|
||||||
#ifdef FFMPEG_OLD_CODE
|
|
||||||
avcodec_close(m_codecCtx);
|
avcodec_close(m_codecCtx);
|
||||||
#else
|
|
||||||
if(m_codecCtx)
|
|
||||||
avcodec_free_context(&m_codecCtx);
|
|
||||||
#endif
|
|
||||||
avformat_close_input(&m_formatCtx);
|
avformat_close_input(&m_formatCtx);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -384,7 +312,7 @@ void FFMPEGReader::seek(int position)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
av_packet_unref(&packet);
|
av_free_packet(&packet);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -415,7 +343,7 @@ Specs FFMPEGReader::getSpecs() const
|
|||||||
void FFMPEGReader::read(int& length, bool& eos, sample_t* buffer)
|
void FFMPEGReader::read(int& length, bool& eos, sample_t* buffer)
|
||||||
{
|
{
|
||||||
// read packages and decode them
|
// read packages and decode them
|
||||||
AVPacket packet = {};
|
AVPacket packet;
|
||||||
int data_size = 0;
|
int data_size = 0;
|
||||||
int pkgbuf_pos;
|
int pkgbuf_pos;
|
||||||
int left = length;
|
int left = length;
|
||||||
@@ -431,7 +359,7 @@ void FFMPEGReader::read(int& length, bool& eos, sample_t* buffer)
|
|||||||
data_size = std::min(pkgbuf_pos, left * sample_size);
|
data_size = std::min(pkgbuf_pos, left * sample_size);
|
||||||
m_convert((data_t*) buf, (data_t*) m_pkgbuf.getBuffer(), data_size / AUD_FORMAT_SIZE(m_specs.format));
|
m_convert((data_t*) buf, (data_t*) m_pkgbuf.getBuffer(), data_size / AUD_FORMAT_SIZE(m_specs.format));
|
||||||
buf += data_size / AUD_FORMAT_SIZE(m_specs.format);
|
buf += data_size / AUD_FORMAT_SIZE(m_specs.format);
|
||||||
left -= data_size / sample_size;
|
left -= data_size/sample_size;
|
||||||
}
|
}
|
||||||
|
|
||||||
// for each frame read as long as there isn't enough data already
|
// for each frame read as long as there isn't enough data already
|
||||||
@@ -447,9 +375,9 @@ void FFMPEGReader::read(int& length, bool& eos, sample_t* buffer)
|
|||||||
data_size = std::min(pkgbuf_pos, left * sample_size);
|
data_size = std::min(pkgbuf_pos, left * sample_size);
|
||||||
m_convert((data_t*) buf, (data_t*) m_pkgbuf.getBuffer(), data_size / AUD_FORMAT_SIZE(m_specs.format));
|
m_convert((data_t*) buf, (data_t*) m_pkgbuf.getBuffer(), data_size / AUD_FORMAT_SIZE(m_specs.format));
|
||||||
buf += data_size / AUD_FORMAT_SIZE(m_specs.format);
|
buf += data_size / AUD_FORMAT_SIZE(m_specs.format);
|
||||||
left -= data_size / sample_size;
|
left -= data_size/sample_size;
|
||||||
}
|
}
|
||||||
av_packet_unref(&packet);
|
av_free_packet(&packet);
|
||||||
}
|
}
|
||||||
// read more data than necessary?
|
// read more data than necessary?
|
||||||
if(pkgbuf_pos > data_size)
|
if(pkgbuf_pos > data_size)
|
||||||
|
@@ -79,11 +79,6 @@ private:
|
|||||||
*/
|
*/
|
||||||
AVCodecContext* m_codecCtx;
|
AVCodecContext* m_codecCtx;
|
||||||
|
|
||||||
/**
|
|
||||||
* The AVFrame structure for using ffmpeg.
|
|
||||||
*/
|
|
||||||
AVFrame* m_frame;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The AVIOContext to read the data from.
|
* The AVIOContext to read the data from.
|
||||||
*/
|
*/
|
||||||
|
216
extern/audaspace/plugins/ffmpeg/FFMPEGWriter.cpp
vendored
216
extern/audaspace/plugins/ffmpeg/FFMPEGWriter.cpp
vendored
@@ -27,10 +27,6 @@ extern "C" {
|
|||||||
|
|
||||||
AUD_NAMESPACE_BEGIN
|
AUD_NAMESPACE_BEGIN
|
||||||
|
|
||||||
#if LIBAVCODEC_VERSION_MAJOR < 58
|
|
||||||
#define FFMPEG_OLD_CODE
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void FFMPEGWriter::encode()
|
void FFMPEGWriter::encode()
|
||||||
{
|
{
|
||||||
sample_t* data = m_input_buffer.getBuffer();
|
sample_t* data = m_input_buffer.getBuffer();
|
||||||
@@ -62,106 +58,82 @@ void FFMPEGWriter::encode()
|
|||||||
if(m_input_size)
|
if(m_input_size)
|
||||||
m_convert(reinterpret_cast<data_t*>(data), reinterpret_cast<data_t*>(data), m_input_samples * m_specs.channels);
|
m_convert(reinterpret_cast<data_t*>(data), reinterpret_cast<data_t*>(data), m_input_samples * m_specs.channels);
|
||||||
|
|
||||||
#ifdef FFMPEG_OLD_CODE
|
AVPacket packet;
|
||||||
m_packet->data = nullptr;
|
|
||||||
m_packet->size = 0;
|
|
||||||
|
|
||||||
av_init_packet(m_packet);
|
packet.data = nullptr;
|
||||||
|
packet.size = 0;
|
||||||
|
|
||||||
av_frame_unref(m_frame);
|
av_init_packet(&packet);
|
||||||
|
|
||||||
|
AVFrame* frame = av_frame_alloc();
|
||||||
|
av_frame_unref(frame);
|
||||||
int got_packet;
|
int got_packet;
|
||||||
#endif
|
|
||||||
|
|
||||||
m_frame->nb_samples = m_input_samples;
|
frame->nb_samples = m_input_samples;
|
||||||
m_frame->format = m_codecCtx->sample_fmt;
|
frame->format = m_codecCtx->sample_fmt;
|
||||||
m_frame->channel_layout = m_codecCtx->channel_layout;
|
frame->channel_layout = m_codecCtx->channel_layout;
|
||||||
|
|
||||||
if(avcodec_fill_audio_frame(m_frame, m_specs.channels, m_codecCtx->sample_fmt, reinterpret_cast<data_t*>(data), m_input_buffer.getSize(), 0) < 0)
|
if(avcodec_fill_audio_frame(frame, m_specs.channels, m_codecCtx->sample_fmt, reinterpret_cast<data_t*>(data), m_input_buffer.getSize(), 0) < 0)
|
||||||
AUD_THROW(FileException, "File couldn't be written, filling the audio frame failed with ffmpeg.");
|
AUD_THROW(FileException, "File couldn't be written, filling the audio frame failed with ffmpeg.");
|
||||||
|
|
||||||
AVRational sample_time = { 1, static_cast<int>(m_specs.rate) };
|
AVRational sample_time = { 1, static_cast<int>(m_specs.rate) };
|
||||||
m_frame->pts = av_rescale_q(m_position - m_input_samples, m_codecCtx->time_base, sample_time);
|
frame->pts = av_rescale_q(m_position - m_input_samples, m_codecCtx->time_base, sample_time);
|
||||||
|
|
||||||
#ifdef FFMPEG_OLD_CODE
|
if(avcodec_encode_audio2(m_codecCtx, &packet, frame, &got_packet))
|
||||||
if(avcodec_encode_audio2(m_codecCtx, m_packet, m_frame, &got_packet))
|
|
||||||
{
|
{
|
||||||
|
av_frame_free(&frame);
|
||||||
AUD_THROW(FileException, "File couldn't be written, audio encoding failed with ffmpeg.");
|
AUD_THROW(FileException, "File couldn't be written, audio encoding failed with ffmpeg.");
|
||||||
}
|
}
|
||||||
|
|
||||||
if(got_packet)
|
if(got_packet)
|
||||||
{
|
{
|
||||||
m_packet->flags |= AV_PKT_FLAG_KEY;
|
packet.flags |= AV_PKT_FLAG_KEY;
|
||||||
m_packet->stream_index = m_stream->index;
|
packet.stream_index = m_stream->index;
|
||||||
if(av_write_frame(m_formatCtx, m_packet) < 0)
|
if(av_write_frame(m_formatCtx, &packet) < 0)
|
||||||
{
|
{
|
||||||
av_free_packet(m_packet);
|
av_free_packet(&packet);
|
||||||
|
av_frame_free(&frame);
|
||||||
AUD_THROW(FileException, "Frame couldn't be writen to the file with ffmpeg.");
|
AUD_THROW(FileException, "Frame couldn't be writen to the file with ffmpeg.");
|
||||||
}
|
}
|
||||||
av_free_packet(m_packet);
|
av_free_packet(&packet);
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
if(avcodec_send_frame(m_codecCtx, m_frame) < 0)
|
|
||||||
AUD_THROW(FileException, "File couldn't be written, audio encoding failed with ffmpeg.");
|
|
||||||
|
|
||||||
while(avcodec_receive_packet(m_codecCtx, m_packet) == 0)
|
av_frame_free(&frame);
|
||||||
{
|
|
||||||
m_packet->stream_index = m_stream->index;
|
|
||||||
|
|
||||||
if(av_write_frame(m_formatCtx, m_packet) < 0)
|
|
||||||
AUD_THROW(FileException, "Frame couldn't be writen to the file with ffmpeg.");
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void FFMPEGWriter::close()
|
void FFMPEGWriter::close()
|
||||||
{
|
{
|
||||||
#ifdef FFMPEG_OLD_CODE
|
|
||||||
int got_packet = true;
|
int got_packet = true;
|
||||||
|
|
||||||
while(got_packet)
|
while(got_packet)
|
||||||
{
|
{
|
||||||
m_packet->data = nullptr;
|
AVPacket packet;
|
||||||
m_packet->size = 0;
|
|
||||||
|
|
||||||
av_init_packet(m_packet);
|
packet.data = nullptr;
|
||||||
|
packet.size = 0;
|
||||||
|
|
||||||
if(avcodec_encode_audio2(m_codecCtx, m_packet, nullptr, &got_packet))
|
av_init_packet(&packet);
|
||||||
|
|
||||||
|
if(avcodec_encode_audio2(m_codecCtx, &packet, nullptr, &got_packet))
|
||||||
AUD_THROW(FileException, "File end couldn't be written, audio encoding failed with ffmpeg.");
|
AUD_THROW(FileException, "File end couldn't be written, audio encoding failed with ffmpeg.");
|
||||||
|
|
||||||
if(got_packet)
|
if(got_packet)
|
||||||
{
|
{
|
||||||
m_packet->flags |= AV_PKT_FLAG_KEY;
|
packet.flags |= AV_PKT_FLAG_KEY;
|
||||||
m_packet->stream_index = m_stream->index;
|
packet.stream_index = m_stream->index;
|
||||||
if(av_write_frame(m_formatCtx, m_packet))
|
if(av_write_frame(m_formatCtx, &packet))
|
||||||
{
|
{
|
||||||
av_free_packet(m_packet);
|
av_free_packet(&packet);
|
||||||
AUD_THROW(FileException, "Final frames couldn't be writen to the file with ffmpeg.");
|
AUD_THROW(FileException, "Final frames couldn't be writen to the file with ffmpeg.");
|
||||||
}
|
}
|
||||||
av_free_packet(m_packet);
|
av_free_packet(&packet);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
if(avcodec_send_frame(m_codecCtx, nullptr) < 0)
|
|
||||||
AUD_THROW(FileException, "File couldn't be written, audio encoding failed with ffmpeg.");
|
|
||||||
|
|
||||||
while(avcodec_receive_packet(m_codecCtx, m_packet) == 0)
|
|
||||||
{
|
|
||||||
m_packet->stream_index = m_stream->index;
|
|
||||||
|
|
||||||
if(av_write_frame(m_formatCtx, m_packet) < 0)
|
|
||||||
AUD_THROW(FileException, "Frame couldn't be writen to the file with ffmpeg.");
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
FFMPEGWriter::FFMPEGWriter(std::string filename, DeviceSpecs specs, Container format, Codec codec, unsigned int bitrate) :
|
FFMPEGWriter::FFMPEGWriter(std::string filename, DeviceSpecs specs, Container format, Codec codec, unsigned int bitrate) :
|
||||||
m_position(0),
|
m_position(0),
|
||||||
m_specs(specs),
|
m_specs(specs),
|
||||||
m_formatCtx(nullptr),
|
|
||||||
m_codecCtx(nullptr),
|
|
||||||
m_stream(nullptr),
|
|
||||||
m_packet(nullptr),
|
|
||||||
m_frame(nullptr),
|
|
||||||
m_input_samples(0),
|
m_input_samples(0),
|
||||||
m_deinterleave(false)
|
m_deinterleave(false)
|
||||||
{
|
{
|
||||||
@@ -170,105 +142,75 @@ FFMPEGWriter::FFMPEGWriter(std::string filename, DeviceSpecs specs, Container fo
|
|||||||
if(avformat_alloc_output_context2(&m_formatCtx, nullptr, formats[format], filename.c_str()) < 0)
|
if(avformat_alloc_output_context2(&m_formatCtx, nullptr, formats[format], filename.c_str()) < 0)
|
||||||
AUD_THROW(FileException, "File couldn't be written, format couldn't be found with ffmpeg.");
|
AUD_THROW(FileException, "File couldn't be written, format couldn't be found with ffmpeg.");
|
||||||
|
|
||||||
AVOutputFormat* outputFmt = m_formatCtx->oformat;
|
m_outputFmt = m_formatCtx->oformat;
|
||||||
|
|
||||||
if(!outputFmt) {
|
if(!m_outputFmt) {
|
||||||
avformat_free_context(m_formatCtx);
|
avformat_free_context(m_formatCtx);
|
||||||
AUD_THROW(FileException, "File couldn't be written, output format couldn't be found with ffmpeg.");
|
AUD_THROW(FileException, "File couldn't be written, output format couldn't be found with ffmpeg.");
|
||||||
}
|
}
|
||||||
|
|
||||||
outputFmt->audio_codec = AV_CODEC_ID_NONE;
|
m_outputFmt->audio_codec = AV_CODEC_ID_NONE;
|
||||||
|
|
||||||
switch(codec)
|
switch(codec)
|
||||||
{
|
{
|
||||||
case CODEC_AAC:
|
case CODEC_AAC:
|
||||||
outputFmt->audio_codec = AV_CODEC_ID_AAC;
|
m_outputFmt->audio_codec = AV_CODEC_ID_AAC;
|
||||||
break;
|
break;
|
||||||
case CODEC_AC3:
|
case CODEC_AC3:
|
||||||
outputFmt->audio_codec = AV_CODEC_ID_AC3;
|
m_outputFmt->audio_codec = AV_CODEC_ID_AC3;
|
||||||
break;
|
break;
|
||||||
case CODEC_FLAC:
|
case CODEC_FLAC:
|
||||||
outputFmt->audio_codec = AV_CODEC_ID_FLAC;
|
m_outputFmt->audio_codec = AV_CODEC_ID_FLAC;
|
||||||
break;
|
break;
|
||||||
case CODEC_MP2:
|
case CODEC_MP2:
|
||||||
outputFmt->audio_codec = AV_CODEC_ID_MP2;
|
m_outputFmt->audio_codec = AV_CODEC_ID_MP2;
|
||||||
break;
|
break;
|
||||||
case CODEC_MP3:
|
case CODEC_MP3:
|
||||||
outputFmt->audio_codec = AV_CODEC_ID_MP3;
|
m_outputFmt->audio_codec = AV_CODEC_ID_MP3;
|
||||||
break;
|
break;
|
||||||
case CODEC_OPUS:
|
case CODEC_OPUS:
|
||||||
outputFmt->audio_codec = AV_CODEC_ID_OPUS;
|
m_outputFmt->audio_codec = AV_CODEC_ID_OPUS;
|
||||||
break;
|
break;
|
||||||
case CODEC_PCM:
|
case CODEC_PCM:
|
||||||
switch(specs.format)
|
switch(specs.format)
|
||||||
{
|
{
|
||||||
case FORMAT_U8:
|
case FORMAT_U8:
|
||||||
outputFmt->audio_codec = AV_CODEC_ID_PCM_U8;
|
m_outputFmt->audio_codec = AV_CODEC_ID_PCM_U8;
|
||||||
break;
|
break;
|
||||||
case FORMAT_S16:
|
case FORMAT_S16:
|
||||||
outputFmt->audio_codec = AV_CODEC_ID_PCM_S16LE;
|
m_outputFmt->audio_codec = AV_CODEC_ID_PCM_S16LE;
|
||||||
break;
|
break;
|
||||||
case FORMAT_S24:
|
case FORMAT_S24:
|
||||||
outputFmt->audio_codec = AV_CODEC_ID_PCM_S24LE;
|
m_outputFmt->audio_codec = AV_CODEC_ID_PCM_S24LE;
|
||||||
break;
|
break;
|
||||||
case FORMAT_S32:
|
case FORMAT_S32:
|
||||||
outputFmt->audio_codec = AV_CODEC_ID_PCM_S32LE;
|
m_outputFmt->audio_codec = AV_CODEC_ID_PCM_S32LE;
|
||||||
break;
|
break;
|
||||||
case FORMAT_FLOAT32:
|
case FORMAT_FLOAT32:
|
||||||
outputFmt->audio_codec = AV_CODEC_ID_PCM_F32LE;
|
m_outputFmt->audio_codec = AV_CODEC_ID_PCM_F32LE;
|
||||||
break;
|
break;
|
||||||
case FORMAT_FLOAT64:
|
case FORMAT_FLOAT64:
|
||||||
outputFmt->audio_codec = AV_CODEC_ID_PCM_F64LE;
|
m_outputFmt->audio_codec = AV_CODEC_ID_PCM_F64LE;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
outputFmt->audio_codec = AV_CODEC_ID_NONE;
|
m_outputFmt->audio_codec = AV_CODEC_ID_NONE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case CODEC_VORBIS:
|
case CODEC_VORBIS:
|
||||||
outputFmt->audio_codec = AV_CODEC_ID_VORBIS;
|
m_outputFmt->audio_codec = AV_CODEC_ID_VORBIS;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
outputFmt->audio_codec = AV_CODEC_ID_NONE;
|
m_outputFmt->audio_codec = AV_CODEC_ID_NONE;
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint64_t channel_layout = 0;
|
|
||||||
|
|
||||||
switch(m_specs.channels)
|
|
||||||
{
|
|
||||||
case CHANNELS_MONO:
|
|
||||||
channel_layout = AV_CH_LAYOUT_MONO;
|
|
||||||
break;
|
|
||||||
case CHANNELS_STEREO:
|
|
||||||
channel_layout = AV_CH_LAYOUT_STEREO;
|
|
||||||
break;
|
|
||||||
case CHANNELS_STEREO_LFE:
|
|
||||||
channel_layout = AV_CH_LAYOUT_2POINT1;
|
|
||||||
break;
|
|
||||||
case CHANNELS_SURROUND4:
|
|
||||||
channel_layout = AV_CH_LAYOUT_QUAD;
|
|
||||||
break;
|
|
||||||
case CHANNELS_SURROUND5:
|
|
||||||
channel_layout = AV_CH_LAYOUT_5POINT0_BACK;
|
|
||||||
break;
|
|
||||||
case CHANNELS_SURROUND51:
|
|
||||||
channel_layout = AV_CH_LAYOUT_5POINT1_BACK;
|
|
||||||
break;
|
|
||||||
case CHANNELS_SURROUND61:
|
|
||||||
channel_layout = AV_CH_LAYOUT_6POINT1_BACK;
|
|
||||||
break;
|
|
||||||
case CHANNELS_SURROUND71:
|
|
||||||
channel_layout = AV_CH_LAYOUT_7POINT1;
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if(outputFmt->audio_codec == AV_CODEC_ID_NONE)
|
if(m_outputFmt->audio_codec == AV_CODEC_ID_NONE)
|
||||||
AUD_THROW(FileException, "File couldn't be written, audio codec not found with ffmpeg.");
|
AUD_THROW(FileException, "File couldn't be written, audio codec not found with ffmpeg.");
|
||||||
|
|
||||||
AVCodec* codec = avcodec_find_encoder(outputFmt->audio_codec);
|
AVCodec* codec = avcodec_find_encoder(m_outputFmt->audio_codec);
|
||||||
if(!codec)
|
if(!codec)
|
||||||
AUD_THROW(FileException, "File couldn't be written, audio encoder couldn't be found with ffmpeg.");
|
AUD_THROW(FileException, "File couldn't be written, audio encoder couldn't be found with ffmpeg.");
|
||||||
|
|
||||||
@@ -278,14 +220,7 @@ FFMPEGWriter::FFMPEGWriter(std::string filename, DeviceSpecs specs, Container fo
|
|||||||
|
|
||||||
m_stream->id = m_formatCtx->nb_streams - 1;
|
m_stream->id = m_formatCtx->nb_streams - 1;
|
||||||
|
|
||||||
#ifdef FFMPEG_OLD_CODE
|
|
||||||
m_codecCtx = m_stream->codec;
|
m_codecCtx = m_stream->codec;
|
||||||
#else
|
|
||||||
m_codecCtx = avcodec_alloc_context3(codec);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if(!m_codecCtx)
|
|
||||||
AUD_THROW(FileException, "File couldn't be written, context creation failed with ffmpeg.");
|
|
||||||
|
|
||||||
switch(m_specs.format)
|
switch(m_specs.format)
|
||||||
{
|
{
|
||||||
@@ -312,7 +247,7 @@ FFMPEGWriter::FFMPEGWriter(std::string filename, DeviceSpecs specs, Container fo
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(m_formatCtx->oformat->flags & AVFMT_GLOBALHEADER)
|
if(m_formatCtx->oformat->flags & AVFMT_GLOBALHEADER)
|
||||||
m_codecCtx->flags |= AV_CODEC_FLAG_GLOBAL_HEADER;
|
m_codecCtx->flags |= CODEC_FLAG_GLOBAL_HEADER;
|
||||||
|
|
||||||
bool format_supported = false;
|
bool format_supported = false;
|
||||||
|
|
||||||
@@ -393,13 +328,9 @@ FFMPEGWriter::FFMPEGWriter(std::string filename, DeviceSpecs specs, Container fo
|
|||||||
|
|
||||||
m_specs.rate = m_codecCtx->sample_rate;
|
m_specs.rate = m_codecCtx->sample_rate;
|
||||||
|
|
||||||
#ifdef FFMPEG_OLD_CODE
|
m_codecCtx->codec_id = m_outputFmt->audio_codec;
|
||||||
m_codecCtx->codec_id = outputFmt->audio_codec;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
m_codecCtx->codec_type = AVMEDIA_TYPE_AUDIO;
|
m_codecCtx->codec_type = AVMEDIA_TYPE_AUDIO;
|
||||||
m_codecCtx->bit_rate = bitrate;
|
m_codecCtx->bit_rate = bitrate;
|
||||||
m_codecCtx->channel_layout = channel_layout;
|
|
||||||
m_codecCtx->channels = m_specs.channels;
|
m_codecCtx->channels = m_specs.channels;
|
||||||
m_stream->time_base.num = m_codecCtx->time_base.num = 1;
|
m_stream->time_base.num = m_codecCtx->time_base.num = 1;
|
||||||
m_stream->time_base.den = m_codecCtx->time_base.den = m_codecCtx->sample_rate;
|
m_stream->time_base.den = m_codecCtx->time_base.den = m_codecCtx->sample_rate;
|
||||||
@@ -407,11 +338,6 @@ FFMPEGWriter::FFMPEGWriter(std::string filename, DeviceSpecs specs, Container fo
|
|||||||
if(avcodec_open2(m_codecCtx, codec, nullptr) < 0)
|
if(avcodec_open2(m_codecCtx, codec, nullptr) < 0)
|
||||||
AUD_THROW(FileException, "File couldn't be written, encoder couldn't be opened with ffmpeg.");
|
AUD_THROW(FileException, "File couldn't be written, encoder couldn't be opened with ffmpeg.");
|
||||||
|
|
||||||
#ifndef FFMPEG_OLD_CODE
|
|
||||||
if(avcodec_parameters_from_context(m_stream->codecpar, m_codecCtx) < 0)
|
|
||||||
AUD_THROW(FileException, "File couldn't be written, codec parameters couldn't be copied to the context.");
|
|
||||||
#endif
|
|
||||||
|
|
||||||
int samplesize = std::max(int(AUD_SAMPLE_SIZE(m_specs)), AUD_DEVICE_SAMPLE_SIZE(m_specs));
|
int samplesize = std::max(int(AUD_SAMPLE_SIZE(m_specs)), AUD_DEVICE_SAMPLE_SIZE(m_specs));
|
||||||
|
|
||||||
if((m_input_size = m_codecCtx->frame_size))
|
if((m_input_size = m_codecCtx->frame_size))
|
||||||
@@ -420,26 +346,13 @@ FFMPEGWriter::FFMPEGWriter(std::string filename, DeviceSpecs specs, Container fo
|
|||||||
if(avio_open(&m_formatCtx->pb, filename.c_str(), AVIO_FLAG_WRITE))
|
if(avio_open(&m_formatCtx->pb, filename.c_str(), AVIO_FLAG_WRITE))
|
||||||
AUD_THROW(FileException, "File couldn't be written, file opening failed with ffmpeg.");
|
AUD_THROW(FileException, "File couldn't be written, file opening failed with ffmpeg.");
|
||||||
|
|
||||||
if(avformat_write_header(m_formatCtx, nullptr) < 0)
|
avformat_write_header(m_formatCtx, nullptr);
|
||||||
AUD_THROW(FileException, "File couldn't be written, writing the header failed.");
|
|
||||||
}
|
}
|
||||||
catch(Exception&)
|
catch(Exception&)
|
||||||
{
|
{
|
||||||
#ifndef FFMPEG_OLD_CODE
|
|
||||||
if(m_codecCtx)
|
|
||||||
avcodec_free_context(&m_codecCtx);
|
|
||||||
#endif
|
|
||||||
avformat_free_context(m_formatCtx);
|
avformat_free_context(m_formatCtx);
|
||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef FFMPEG_OLD_CODE
|
|
||||||
m_packet = new AVPacket({});
|
|
||||||
#else
|
|
||||||
m_packet = av_packet_alloc();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
m_frame = av_frame_alloc();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
FFMPEGWriter::~FFMPEGWriter()
|
FFMPEGWriter::~FFMPEGWriter()
|
||||||
@@ -452,26 +365,9 @@ FFMPEGWriter::~FFMPEGWriter()
|
|||||||
|
|
||||||
av_write_trailer(m_formatCtx);
|
av_write_trailer(m_formatCtx);
|
||||||
|
|
||||||
if(m_frame)
|
|
||||||
av_frame_free(&m_frame);
|
|
||||||
|
|
||||||
if(m_packet)
|
|
||||||
{
|
|
||||||
#ifdef FFMPEG_OLD_CODE
|
|
||||||
delete m_packet;
|
|
||||||
#else
|
|
||||||
av_packet_free(&m_packet);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef FFMPEG_OLD_CODE
|
|
||||||
avcodec_close(m_codecCtx);
|
avcodec_close(m_codecCtx);
|
||||||
#else
|
|
||||||
if(m_codecCtx)
|
|
||||||
avcodec_free_context(&m_codecCtx);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
avio_closep(&m_formatCtx->pb);
|
avio_close(m_formatCtx->pb);
|
||||||
avformat_free_context(m_formatCtx);
|
avformat_free_context(m_formatCtx);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
15
extern/audaspace/plugins/ffmpeg/FFMPEGWriter.h
vendored
15
extern/audaspace/plugins/ffmpeg/FFMPEGWriter.h
vendored
@@ -65,21 +65,16 @@ private:
|
|||||||
*/
|
*/
|
||||||
AVCodecContext* m_codecCtx;
|
AVCodecContext* m_codecCtx;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The AVOutputFormat structure for using ffmpeg.
|
||||||
|
*/
|
||||||
|
AVOutputFormat* m_outputFmt;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The AVStream structure for using ffmpeg.
|
* The AVStream structure for using ffmpeg.
|
||||||
*/
|
*/
|
||||||
AVStream* m_stream;
|
AVStream* m_stream;
|
||||||
|
|
||||||
/**
|
|
||||||
* The AVPacket structure for using ffmpeg.
|
|
||||||
*/
|
|
||||||
AVPacket* m_packet;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The AVFrame structure for using ffmpeg.
|
|
||||||
*/
|
|
||||||
AVFrame* m_frame;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The input buffer for the format converted data before encoding.
|
* The input buffer for the format converted data before encoding.
|
||||||
*/
|
*/
|
||||||
|
9
extern/clew/CMakeLists.txt
vendored
9
extern/clew/CMakeLists.txt
vendored
@@ -40,12 +40,3 @@ set(SRC
|
|||||||
add_definitions(-DCL_USE_DEPRECATED_OPENCL_1_1_APIS)
|
add_definitions(-DCL_USE_DEPRECATED_OPENCL_1_1_APIS)
|
||||||
|
|
||||||
blender_add_lib(extern_clew "${SRC}" "${INC}" "${INC_SYS}")
|
blender_add_lib(extern_clew "${SRC}" "${INC}" "${INC_SYS}")
|
||||||
|
|
||||||
add_executable(cl_query src/cl_query.cc)
|
|
||||||
target_link_libraries(cl_query extern_clew ${CMAKE_DL_LIBS})
|
|
||||||
|
|
||||||
if(APPLE)
|
|
||||||
install(TARGETS cl_query DESTINATION "blender-benchmark.app/Contents/Resources/bin")
|
|
||||||
else()
|
|
||||||
install(TARGETS cl_query DESTINATION "bin")
|
|
||||||
endif()
|
|
||||||
|
119
extern/clew/src/cl_query.cc
vendored
119
extern/clew/src/cl_query.cc
vendored
@@ -1,119 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright 2011-2015 Blender Foundation
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <cstdlib>
|
|
||||||
#include <cstdio>
|
|
||||||
#include <string>
|
|
||||||
#include <vector>
|
|
||||||
|
|
||||||
#include "clew.h"
|
|
||||||
|
|
||||||
using std::string;
|
|
||||||
using std::vector;
|
|
||||||
#define foreach(x, y) for(x : y)
|
|
||||||
|
|
||||||
namespace {
|
|
||||||
|
|
||||||
// Get all platform IDs.
|
|
||||||
bool getPlatformIDs(vector<cl_platform_id>* platform_ids) {
|
|
||||||
cl_uint num_platforms = 0;
|
|
||||||
if (clGetPlatformIDs(0, NULL, &num_platforms) != CL_SUCCESS) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
platform_ids->resize(num_platforms);
|
|
||||||
if (clGetPlatformIDs(
|
|
||||||
num_platforms, &(*platform_ids)[0], NULL) != CL_SUCCESS) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get device IDs for the given platform.
|
|
||||||
bool getPlatformDeviceIDs(cl_platform_id platform_id,
|
|
||||||
vector<cl_device_id>* device_ids) {
|
|
||||||
cl_uint num_devices = 0;
|
|
||||||
if (clGetDeviceIDs(
|
|
||||||
platform_id, CL_DEVICE_TYPE_GPU, 0, NULL, &num_devices) != CL_SUCCESS) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
device_ids->resize(num_devices);
|
|
||||||
if (num_devices == 0) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
if (clGetDeviceIDs(platform_id,
|
|
||||||
CL_DEVICE_TYPE_ALL,
|
|
||||||
num_devices,
|
|
||||||
&(*device_ids)[0],
|
|
||||||
NULL) != CL_SUCCESS) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace
|
|
||||||
|
|
||||||
int main(int argc, char **argv) {
|
|
||||||
int result = clewInit();
|
|
||||||
if (result != CLEW_SUCCESS) {
|
|
||||||
return EXIT_FAILURE;
|
|
||||||
}
|
|
||||||
// Get all platform IDs.
|
|
||||||
vector<cl_platform_id> platform_ids;
|
|
||||||
if (!getPlatformIDs(&platform_ids)) {
|
|
||||||
return EXIT_FAILURE;
|
|
||||||
}
|
|
||||||
foreach (cl_platform_id platform_id, platform_ids) {
|
|
||||||
vector<cl_device_id> device_ids;
|
|
||||||
if (!getPlatformDeviceIDs(platform_id, &device_ids)) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
foreach (cl_device_id device_id, device_ids) {
|
|
||||||
string name;
|
|
||||||
char board_name[1024] = "\0";
|
|
||||||
size_t board_length = 0;
|
|
||||||
if (clGetDeviceInfo(device_id,
|
|
||||||
CL_DEVICE_BOARD_NAME_AMD,
|
|
||||||
sizeof(board_name), board_name,
|
|
||||||
&board_length) == CL_SUCCESS) {
|
|
||||||
if (board_length != 0 && board_name[0] != '\0') {
|
|
||||||
name = board_name;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (name.empty()) {
|
|
||||||
char device_name[1024] = "\0";
|
|
||||||
if (clGetDeviceInfo(device_id,
|
|
||||||
CL_DEVICE_NAME,
|
|
||||||
sizeof(device_name), device_name,
|
|
||||||
NULL) == CL_SUCCESS) {
|
|
||||||
name = device_name;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (name.empty()) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
cl_int max_compute_units = 0;
|
|
||||||
if (clGetDeviceInfo(device_id,
|
|
||||||
CL_DEVICE_MAX_COMPUTE_UNITS,
|
|
||||||
sizeof(max_compute_units),
|
|
||||||
&max_compute_units,
|
|
||||||
NULL) != CL_SUCCESS) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
printf("%s:%d\n", name.c_str(), max_compute_units);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return EXIT_SUCCESS;
|
|
||||||
}
|
|
1
extern/rangetree/CMakeLists.txt
vendored
1
extern/rangetree/CMakeLists.txt
vendored
@@ -28,3 +28,4 @@ set(SRC
|
|||||||
)
|
)
|
||||||
|
|
||||||
blender_add_lib(extern_rangetree "${SRC}" "${INC}" "")
|
blender_add_lib(extern_rangetree "${SRC}" "${INC}" "")
|
||||||
|
|
||||||
|
8
extern/xdnd/xdnd.c
vendored
8
extern/xdnd/xdnd.c
vendored
@@ -121,10 +121,10 @@ char *xdnd_debug_milliseconds (void)
|
|||||||
#define dnd_debug3(a,b,c) printf("%s: %d: %s: " a "\n", __FILE__, __LINE__, xdnd_debug_milliseconds (), b, c)
|
#define dnd_debug3(a,b,c) printf("%s: %d: %s: " a "\n", __FILE__, __LINE__, xdnd_debug_milliseconds (), b, c)
|
||||||
#define dnd_debug4(a,b,c,d) printf("%s: %d: %s: " a "\n", __FILE__, __LINE__, xdnd_debug_milliseconds (), b, c, d)
|
#define dnd_debug4(a,b,c,d) printf("%s: %d: %s: " a "\n", __FILE__, __LINE__, xdnd_debug_milliseconds (), b, c, d)
|
||||||
#else
|
#else
|
||||||
#define dnd_debug1(a) do {} while (0)
|
#define dnd_debug1(a)
|
||||||
#define dnd_debug2(a,b) do {} while (0)
|
#define dnd_debug2(a,b)
|
||||||
#define dnd_debug3(a,b,c) do {} while (0)
|
#define dnd_debug3(a,b,c)
|
||||||
#define dnd_debug4(a,b,c,d) do {} while (0)
|
#define dnd_debug4(a,b,c,d)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define dnd_warning(a) fprintf (stderr, a)
|
#define dnd_warning(a) fprintf (stderr, a)
|
||||||
|
@@ -34,6 +34,7 @@ add_subdirectory(opencolorio)
|
|||||||
add_subdirectory(mikktspace)
|
add_subdirectory(mikktspace)
|
||||||
add_subdirectory(glew-mx)
|
add_subdirectory(glew-mx)
|
||||||
add_subdirectory(eigen)
|
add_subdirectory(eigen)
|
||||||
|
add_subdirectory(gawain)
|
||||||
|
|
||||||
if(WITH_AUDASPACE)
|
if(WITH_AUDASPACE)
|
||||||
add_subdirectory(audaspace)
|
add_subdirectory(audaspace)
|
||||||
|
@@ -472,7 +472,7 @@ void CLG_logf(
|
|||||||
static void CLG_ctx_output_set(CLogContext *ctx, void *file_handle)
|
static void CLG_ctx_output_set(CLogContext *ctx, void *file_handle)
|
||||||
{
|
{
|
||||||
ctx->output_file = file_handle;
|
ctx->output_file = file_handle;
|
||||||
ctx->output = fileno(ctx->output_file);
|
ctx->output = fileno(file_handle);
|
||||||
#if defined(__unix__) || defined(__APPLE__)
|
#if defined(__unix__) || defined(__APPLE__)
|
||||||
ctx->use_color = isatty(ctx->output);
|
ctx->use_color = isatty(ctx->output);
|
||||||
#endif
|
#endif
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user