Compare commits
24 Commits
blender-v2
...
temp_remov
Author | SHA1 | Date | |
---|---|---|---|
1f723603c8 | |||
3632c4997f | |||
773efb506a | |||
ba279efbdb | |||
9465d3decf | |||
ecb695ccc8 | |||
cd0ec340c4 | |||
15c8d095e5 | |||
7c57822afa | |||
c92b6f1de6 | |||
d30b942f07 | |||
df2e543d44 | |||
fbed29a246 | |||
987bb50a74 | |||
d474ed9b88 | |||
664f5b8c06 | |||
d8d49befa0 | |||
d47173c8ca | |||
cf6cb3dcaf | |||
bcd12bf64d | |||
29a792a75b | |||
cc468c1974 | |||
82ec9c87a7 | |||
5a783144e2 |
2
.gitignore
vendored
2
.gitignore
vendored
@@ -21,6 +21,7 @@ Desktop.ini
|
||||
|
||||
# commonly used paths in blender
|
||||
/blender.bin
|
||||
/user-config.py
|
||||
/BUILD_NOTES.txt
|
||||
|
||||
# local patches
|
||||
@@ -32,4 +33,3 @@ Desktop.ini
|
||||
/doc/python_api/sphinx-in-tmp/
|
||||
/doc/python_api/sphinx-in/
|
||||
/doc/python_api/sphinx-out/
|
||||
/doc/python_api/rst/bmesh.ops.rst
|
||||
|
8
.gitmodules
vendored
8
.gitmodules
vendored
@@ -2,19 +2,11 @@
|
||||
path = release/scripts/addons
|
||||
url = ../blender-addons.git
|
||||
ignore = all
|
||||
branch = blender-v2.79-release
|
||||
[submodule "release/scripts/addons_contrib"]
|
||||
path = release/scripts/addons_contrib
|
||||
url = ../blender-addons-contrib.git
|
||||
ignore = all
|
||||
branch = master
|
||||
[submodule "release/datafiles/locale"]
|
||||
path = release/datafiles/locale
|
||||
url = ../blender-translations.git
|
||||
ignore = all
|
||||
branch = blender-v2.79-release
|
||||
[submodule "source/tools"]
|
||||
path = source/tools
|
||||
url = ../blender-dev-tools.git
|
||||
ignore = all
|
||||
branch = blender-v2.79-release
|
||||
|
1892
CMakeLists.txt
1892
CMakeLists.txt
File diff suppressed because it is too large
Load Diff
106
GNUmakefile
106
GNUmakefile
@@ -1,4 +1,4 @@
|
||||
# -*- mode: gnumakefile; tab-width: 4; indent-tabs-mode: t; -*-
|
||||
# -*- mode: gnumakefile; tab-width: 8; indent-tabs-mode: t; -*-
|
||||
# vim: tabstop=4
|
||||
#
|
||||
# ##### BEGIN GPL LICENSE BLOCK #####
|
||||
@@ -104,7 +104,7 @@ endif
|
||||
CMAKE_CONFIG = cmake $(BUILD_CMAKE_ARGS) \
|
||||
-H"$(BLENDER_DIR)" \
|
||||
-B"$(BUILD_DIR)" \
|
||||
-DCMAKE_BUILD_TYPE_INIT:STRING=$(BUILD_TYPE)
|
||||
-DCMAKE_BUILD_TYPE:STRING=$(BUILD_TYPE)
|
||||
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
@@ -113,21 +113,21 @@ CMAKE_CONFIG = cmake $(BUILD_CMAKE_ARGS) \
|
||||
# X11 spesific
|
||||
ifdef DISPLAY
|
||||
CMAKE_CONFIG_TOOL = cmake-gui
|
||||
else
|
||||
else
|
||||
CMAKE_CONFIG_TOOL = ccmake
|
||||
endif
|
||||
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# Build Blender
|
||||
all: .FORCE
|
||||
all: FORCE
|
||||
@echo
|
||||
@echo Configuring Blender in \"$(BUILD_DIR)\" ...
|
||||
|
||||
# # if test ! -f $(BUILD_DIR)/CMakeCache.txt ; then \
|
||||
# # $(CMAKE_CONFIG); \
|
||||
# # fi
|
||||
|
||||
|
||||
# # do this always incase of failed initial build, could be smarter here...
|
||||
@$(CMAKE_CONFIG)
|
||||
|
||||
@@ -149,13 +149,13 @@ bpy: all
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# Configuration (save some cd'ing around)
|
||||
config: .FORCE
|
||||
config: FORCE
|
||||
$(CMAKE_CONFIG_TOOL) "$(BUILD_DIR)"
|
||||
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# Help for build targets
|
||||
help: .FORCE
|
||||
help: FORCE
|
||||
@echo ""
|
||||
@echo "Convenience targets provided for building blender, (multiple at once can be used)"
|
||||
@echo " * debug - build a debug binary"
|
||||
@@ -182,20 +182,14 @@ help: .FORCE
|
||||
@echo " * package_archive - build an archive package"
|
||||
@echo ""
|
||||
@echo "Testing Targets (not associated with building blender)"
|
||||
@echo " * test - run ctest, currently tests import/export,"
|
||||
@echo " operator execution and that python modules load"
|
||||
@echo " * test_cmake - runs our own cmake file checker"
|
||||
@echo " which detects errors in the cmake file list definitions"
|
||||
@echo " * test_pep8 - checks all python script are pep8"
|
||||
@echo " which are tagged to use the stricter formatting"
|
||||
@echo " * test - run ctest, currently tests import/export, operator execution and that python modules load"
|
||||
@echo " * test_cmake - runs our own cmake file checker which detects errors in the cmake file list definitions"
|
||||
@echo " * test_pep8 - checks all python script are pep8 which are tagged to use the stricter formatting"
|
||||
@echo " * test_deprecated - checks for deprecation tags in our code which may need to be removed"
|
||||
@echo " * test_style_c - checks C/C++ conforms with blenders style guide:"
|
||||
@echo " http://wiki.blender.org/index.php/Dev:Doc/CodeStyle"
|
||||
@echo " * test_style_c - checks C/C++ conforms with blenders style guide: http://wiki.blender.org/index.php/Dev:Doc/CodeStyle"
|
||||
@echo " * test_style_c_qtc - same as test_style but outputs QtCreator tasks format"
|
||||
@echo " * test_style_osl - checks OpenShadingLanguage conforms with blenders style guide:"
|
||||
@echo " http://wiki.blender.org/index.php/Dev:Doc/CodeStyle"
|
||||
@echo " * test_style_osl_qtc - checks OpenShadingLanguage conforms with blenders style guide:"
|
||||
@echo " http://wiki.blender.org/index.php/Dev:Doc/CodeStyle"
|
||||
@echo " * test_style_osl - checks OpenShadingLanguage conforms with blenders style guide: http://wiki.blender.org/index.php/Dev:Doc/CodeStyle"
|
||||
@echo " * test_style_osl_qtc - checks OpenShadingLanguage conforms with blenders style guide: http://wiki.blender.org/index.php/Dev:Doc/CodeStyle"
|
||||
@echo ""
|
||||
@echo "Static Source Code Checking (not associated with building blender)"
|
||||
@echo " * check_cppcheck - run blender source through cppcheck (C & C++)"
|
||||
@@ -234,13 +228,13 @@ help: .FORCE
|
||||
# -----------------------------------------------------------------------------
|
||||
# Packages
|
||||
#
|
||||
package_debian: .FORCE
|
||||
package_debian: FORCE
|
||||
cd build_files/package_spec ; DEB_BUILD_OPTIONS="parallel=$(NPROCS)" sh ./build_debian.sh
|
||||
|
||||
package_pacman: .FORCE
|
||||
package_pacman: FORCE
|
||||
cd build_files/package_spec/pacman ; MAKEFLAGS="-j$(NPROCS)" makepkg
|
||||
|
||||
package_archive: .FORCE
|
||||
package_archive: FORCE
|
||||
make -C "$(BUILD_DIR)" -s package_archive
|
||||
@echo archive in "$(BUILD_DIR)/release"
|
||||
|
||||
@@ -248,24 +242,24 @@ package_archive: .FORCE
|
||||
# -----------------------------------------------------------------------------
|
||||
# Tests
|
||||
#
|
||||
test: .FORCE
|
||||
test: FORCE
|
||||
cd $(BUILD_DIR) ; ctest . --output-on-failure
|
||||
|
||||
# run pep8 check check on scripts we distribute.
|
||||
test_pep8: .FORCE
|
||||
test_pep8: FORCE
|
||||
$(PYTHON) tests/python/pep8.py > test_pep8.log 2>&1
|
||||
@echo "written: test_pep8.log"
|
||||
|
||||
# run some checks on our cmakefiles.
|
||||
test_cmake: .FORCE
|
||||
test_cmake: FORCE
|
||||
$(PYTHON) build_files/cmake/cmake_consistency_check.py > test_cmake_consistency.log 2>&1
|
||||
@echo "written: test_cmake_consistency.log"
|
||||
|
||||
# run deprecation tests, see if we have anything to remove.
|
||||
test_deprecated: .FORCE
|
||||
test_deprecated: FORCE
|
||||
$(PYTHON) tests/check_deprecated.py
|
||||
|
||||
test_style_c: .FORCE
|
||||
test_style_c: FORCE
|
||||
# run our own checks on C/C++ style
|
||||
PYTHONIOENCODING=utf_8 $(PYTHON) \
|
||||
"$(BLENDER_DIR)/source/tools/check_source/check_style_c.py" \
|
||||
@@ -273,7 +267,7 @@ test_style_c: .FORCE
|
||||
"$(BLENDER_DIR)/source/creator" \
|
||||
--no-length-check
|
||||
|
||||
test_style_c_qtc: .FORCE
|
||||
test_style_c_qtc: FORCE
|
||||
# run our own checks on C/C++ style
|
||||
USE_QTC_TASK=1 \
|
||||
PYTHONIOENCODING=utf_8 $(PYTHON) \
|
||||
@@ -286,7 +280,7 @@ test_style_c_qtc: .FORCE
|
||||
@echo "written: test_style.tasks"
|
||||
|
||||
|
||||
test_style_osl: .FORCE
|
||||
test_style_osl: FORCE
|
||||
# run our own checks on C/C++ style
|
||||
PYTHONIOENCODING=utf_8 $(PYTHON) \
|
||||
"$(BLENDER_DIR)/source/tools/check_source/check_style_c.py" \
|
||||
@@ -294,7 +288,7 @@ test_style_osl: .FORCE
|
||||
"$(BLENDER_DIR)/release/scripts/templates_osl"
|
||||
|
||||
|
||||
test_style_osl_qtc: .FORCE
|
||||
test_style_osl_qtc: FORCE
|
||||
# run our own checks on C/C++ style
|
||||
USE_QTC_TASK=1 \
|
||||
PYTHONIOENCODING=utf_8 $(PYTHON) \
|
||||
@@ -309,13 +303,13 @@ test_style_osl_qtc: .FORCE
|
||||
# Project Files
|
||||
#
|
||||
|
||||
project_qtcreator: .FORCE
|
||||
project_qtcreator: FORCE
|
||||
$(PYTHON) build_files/cmake/cmake_qtcreator_project.py "$(BUILD_DIR)"
|
||||
|
||||
project_netbeans: .FORCE
|
||||
project_netbeans: FORCE
|
||||
$(PYTHON) build_files/cmake/cmake_netbeans_project.py "$(BUILD_DIR)"
|
||||
|
||||
project_eclipse: .FORCE
|
||||
project_eclipse: FORCE
|
||||
cmake -G"Eclipse CDT4 - Unix Makefiles" -H"$(BLENDER_DIR)" -B"$(BUILD_DIR)"
|
||||
|
||||
|
||||
@@ -323,40 +317,40 @@ project_eclipse: .FORCE
|
||||
# Static Checking
|
||||
#
|
||||
|
||||
check_cppcheck: .FORCE
|
||||
check_cppcheck: FORCE
|
||||
$(CMAKE_CONFIG)
|
||||
cd "$(BUILD_DIR)" ; \
|
||||
$(PYTHON) "$(BLENDER_DIR)/build_files/cmake/cmake_static_check_cppcheck.py" 2> \
|
||||
"$(BLENDER_DIR)/check_cppcheck.txt"
|
||||
@echo "written: check_cppcheck.txt"
|
||||
|
||||
check_clang_array: .FORCE
|
||||
check_clang_array: FORCE
|
||||
$(CMAKE_CONFIG)
|
||||
cd "$(BUILD_DIR)" ; \
|
||||
$(PYTHON) "$(BLENDER_DIR)/build_files/cmake/cmake_static_check_clang_array.py"
|
||||
|
||||
check_splint: .FORCE
|
||||
check_splint: FORCE
|
||||
$(CMAKE_CONFIG)
|
||||
cd "$(BUILD_DIR)" ; \
|
||||
$(PYTHON) "$(BLENDER_DIR)/build_files/cmake/cmake_static_check_splint.py"
|
||||
|
||||
check_sparse: .FORCE
|
||||
check_sparse: FORCE
|
||||
$(CMAKE_CONFIG)
|
||||
cd "$(BUILD_DIR)" ; \
|
||||
$(PYTHON) "$(BLENDER_DIR)/build_files/cmake/cmake_static_check_sparse.py"
|
||||
|
||||
check_smatch: .FORCE
|
||||
check_smatch: FORCE
|
||||
$(CMAKE_CONFIG)
|
||||
cd "$(BUILD_DIR)" ; \
|
||||
$(PYTHON) "$(BLENDER_DIR)/build_files/cmake/cmake_static_check_smatch.py"
|
||||
|
||||
check_spelling_py: .FORCE
|
||||
check_spelling_py: FORCE
|
||||
cd "$(BUILD_DIR)" ; \
|
||||
PYTHONIOENCODING=utf_8 $(PYTHON) \
|
||||
"$(BLENDER_DIR)/source/tools/check_source/check_spelling.py" \
|
||||
"$(BLENDER_DIR)/release/scripts"
|
||||
|
||||
check_spelling_c: .FORCE
|
||||
check_spelling_c: FORCE
|
||||
cd "$(BUILD_DIR)" ; \
|
||||
PYTHONIOENCODING=utf_8 $(PYTHON) \
|
||||
"$(BLENDER_DIR)/source/tools/check_source/check_spelling.py" \
|
||||
@@ -365,7 +359,7 @@ check_spelling_c: .FORCE
|
||||
"$(BLENDER_DIR)/intern/guardedalloc" \
|
||||
"$(BLENDER_DIR)/intern/ghost" \
|
||||
|
||||
check_spelling_c_qtc: .FORCE
|
||||
check_spelling_c_qtc: FORCE
|
||||
cd "$(BUILD_DIR)" ; USE_QTC_TASK=1 \
|
||||
PYTHONIOENCODING=utf_8 $(PYTHON) \
|
||||
"$(BLENDER_DIR)/source/tools/check_source/check_spelling.py" \
|
||||
@@ -376,13 +370,13 @@ check_spelling_c_qtc: .FORCE
|
||||
> \
|
||||
"$(BLENDER_DIR)/check_spelling_c.tasks"
|
||||
|
||||
check_spelling_osl: .FORCE
|
||||
check_spelling_osl: FORCE
|
||||
cd "$(BUILD_DIR)" ;\
|
||||
PYTHONIOENCODING=utf_8 $(PYTHON) \
|
||||
"$(BLENDER_DIR)/source/tools/check_source/check_spelling.py" \
|
||||
"$(BLENDER_DIR)/intern/cycles/kernel/shaders"
|
||||
|
||||
check_descriptions: .FORCE
|
||||
check_descriptions: FORCE
|
||||
"$(BUILD_DIR)/bin/blender" --background -noaudio --factory-startup --python \
|
||||
"$(BLENDER_DIR)/source/tools/check_source/check_descriptions.py"
|
||||
|
||||
@@ -390,14 +384,14 @@ check_descriptions: .FORCE
|
||||
# Utilities
|
||||
#
|
||||
|
||||
tgz: .FORCE
|
||||
tgz: FORCE
|
||||
./build_files/utils/build_tgz.sh
|
||||
|
||||
icons: .FORCE
|
||||
icons: FORCE
|
||||
"$(BLENDER_DIR)/release/datafiles/blender_icons_update.py"
|
||||
"$(BLENDER_DIR)/release/datafiles/prvicons_update.py"
|
||||
|
||||
update: .FORCE
|
||||
update: FORCE
|
||||
if [ -d "../lib" ]; then \
|
||||
svn update ../lib/* ; \
|
||||
fi
|
||||
@@ -410,25 +404,23 @@ update: .FORCE
|
||||
#
|
||||
|
||||
# Simple version of ./doc/python_api/sphinx_doc_gen.sh with no PDF generation.
|
||||
doc_py: .FORCE
|
||||
"$(BUILD_DIR)/bin/blender" --background -noaudio --factory-startup \
|
||||
--python doc/python_api/sphinx_doc_gen.py
|
||||
doc_py: FORCE
|
||||
"$(BUILD_DIR)/bin/blender" --background -noaudio --factory-startup --python doc/python_api/sphinx_doc_gen.py
|
||||
cd doc/python_api ; sphinx-build -b html sphinx-in sphinx-out
|
||||
@echo "docs written into: '$(BLENDER_DIR)/doc/python_api/sphinx-out/contents.html'"
|
||||
|
||||
doc_doxy: .FORCE
|
||||
doc_doxy: FORCE
|
||||
cd doc/doxygen; doxygen Doxyfile
|
||||
@echo "docs written into: '$(BLENDER_DIR)/doc/doxygen/html/index.html'"
|
||||
|
||||
doc_dna: .FORCE
|
||||
"$(BUILD_DIR)/bin/blender" --background -noaudio --factory-startup \
|
||||
--python doc/blender_file_format/BlendFileDnaExporter_25.py
|
||||
doc_dna: FORCE
|
||||
"$(BUILD_DIR)/bin/blender" --background -noaudio --factory-startup --python doc/blender_file_format/BlendFileDnaExporter_25.py
|
||||
@echo "docs written into: '$(BLENDER_DIR)/doc/blender_file_format/dna.html'"
|
||||
|
||||
doc_man: .FORCE
|
||||
doc_man: FORCE
|
||||
$(PYTHON) doc/manpage/blender.1.py "$(BUILD_DIR)/bin/blender"
|
||||
|
||||
help_features: .FORCE
|
||||
help_features: FORCE
|
||||
@$(PYTHON) -c \
|
||||
"import re; \
|
||||
print('\n'.join([ \
|
||||
@@ -439,9 +431,9 @@ help_features: .FORCE
|
||||
if w.startswith('WITH_')]))" | uniq
|
||||
|
||||
|
||||
clean: .FORCE
|
||||
clean: FORCE
|
||||
$(MAKE) -C "$(BUILD_DIR)" clean
|
||||
|
||||
.PHONY: all
|
||||
|
||||
.FORCE:
|
||||
FORCE:
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -70,7 +70,7 @@ set(FFMPEG_LIBRARIES
|
||||
)
|
||||
|
||||
# SndFile libraries
|
||||
set(SNDFILE_LIBRARY "/usr/lib${MULTILIB}/libsndfile.a;/usr/lib${MULTILIB}/libFLAC.a" CACHE STRING "" FORCE)
|
||||
set(SNDFILE_LIBRARY "/usr/lib/libsndfile.a;/usr/lib/libFLAC.a" CACHE STRING "" FORCE)
|
||||
|
||||
# OpenAL libraries
|
||||
set(OPENAL_ROOT_DIR "/opt/lib/openal" CACHE STRING "" FORCE)
|
||||
@@ -94,10 +94,6 @@ set(OPENCOLORIO_OPENCOLORIO_LIBRARY "${OPENCOLORIO_ROOT_DIR}/lib/libOpenColorIO.
|
||||
set(OPENCOLORIO_TINYXML_LIBRARY "${OPENCOLORIO_ROOT_DIR}/lib/libtinyxml.a" CACHE STRING "" FORCE)
|
||||
set(OPENCOLORIO_YAML-CPP_LIBRARY "${OPENCOLORIO_ROOT_DIR}/lib/libyaml-cpp.a" CACHE STRING "" FORCE)
|
||||
|
||||
# Freetype
|
||||
set(FREETYPE_INCLUDE_DIRS "/usr/include/freetype2" CACHE STRING "" FORCE)
|
||||
set(FREETYPE_LIBRARY "/usr/lib${MULTILIB}/libfreetype.a" CACHE STRING "" FORCE)
|
||||
|
||||
# OpenImageIO
|
||||
if(GLIBC EQUAL "2.19")
|
||||
set(OPENIMAGEIO_LIBRARY
|
||||
@@ -106,7 +102,6 @@ if(GLIBC EQUAL "2.19")
|
||||
/usr/lib${MULTILIB}/libwebp.a
|
||||
/usr/lib${MULTILIB}/liblzma.a
|
||||
/usr/lib${MULTILIB}/libjbig.a
|
||||
${FREETYPE_LIBRARY}
|
||||
CACHE STRING "" FORCE
|
||||
)
|
||||
endif()
|
||||
|
@@ -1,4 +1,4 @@
|
||||
# This is applied as an override on top of blender_linux.config
|
||||
# This is applied as an ovveride on top of blender_linux.config
|
||||
# Disables all the areas which are not needed for the player.
|
||||
set(WITH_COMPOSITOR OFF CACHE BOOL "" FORCE)
|
||||
set(WITH_CYCLES OFF CACHE BOOL "" FORCE)
|
||||
|
@@ -4,10 +4,10 @@
|
||||
# <pep8 compliant>
|
||||
|
||||
# List of the branches being built automatically overnight
|
||||
NIGHT_SCHEDULE_BRANCHES = [None, "blender2.8"]
|
||||
NIGHT_SCHEDULE_BRANCHES = [None]
|
||||
|
||||
# List of the branches available for force build
|
||||
FORCE_SCHEDULE_BRANCHES = ["master", "blender2.8", "experimental-build"]
|
||||
FORCE_SCHEDULE_BRANCHES = ["master", "gooseberry", "experimental-build"]
|
||||
|
||||
"""
|
||||
Stock Twisted directory lister doesn't provide any information about last file
|
||||
@@ -94,7 +94,6 @@ all_repositories = {
|
||||
r'git://git.blender.org/blender-translations.git': 'blender-translations',
|
||||
r'git://git.blender.org/blender-addons.git': 'blender-addons',
|
||||
r'git://git.blender.org/blender-addons-contrib.git': 'blender-addons-contrib',
|
||||
r'git://git.blender.org/blender-dev-tools.git': 'blender-dev-tools',
|
||||
r'https://svn.blender.org/svnroot/bf-blender/': 'lib svn',
|
||||
}
|
||||
|
||||
@@ -127,16 +126,8 @@ def schedule_force_build(name):
|
||||
project=forcesched.FixedParameter(name="project", default="", hide=True)),
|
||||
# For now, hide other codebases.
|
||||
forcesched.CodebaseParameter(hide=True, codebase="blender-translations"),
|
||||
forcesched.CodebaseParameter(
|
||||
codebase="blender-addons",
|
||||
branch=forcesched.ChoiceStringParameter(
|
||||
name="branch", choices=["master", "blender2.8"], default="master"),
|
||||
repository=forcesched.FixedParameter(name="repository", default="", hide=True),
|
||||
project=forcesched.FixedParameter(name="project", default="", hide=True),
|
||||
revision=forcesched.FixedParameter(name="revision", default="", hide=True),
|
||||
),
|
||||
forcesched.CodebaseParameter(hide=True, codebase="blender-addons"),
|
||||
forcesched.CodebaseParameter(hide=True, codebase="blender-addons-contrib"),
|
||||
forcesched.CodebaseParameter(hide=True, codebase="blender-dev-tools"),
|
||||
forcesched.CodebaseParameter(hide=True, codebase="lib svn")],
|
||||
properties=[]))
|
||||
|
||||
@@ -146,17 +137,12 @@ def schedule_build(name, hour, minute=0):
|
||||
scheduler_name = "nightly " + name
|
||||
if current_branch:
|
||||
scheduler_name += ' ' + current_branch
|
||||
# Use special addons submodule branch when building blender2.8 branch.
|
||||
addons_branch = "master"
|
||||
if current_branch == "blender2.8":
|
||||
addons_branch = "blender2.8"
|
||||
c['schedulers'].append(timed.Nightly(name=scheduler_name,
|
||||
codebases={
|
||||
"blender": {"repository": ""},
|
||||
"blender-translations": {"repository": "", "branch": "master"},
|
||||
"blender-addons": {"repository": "", "branch": addons_branch},
|
||||
"blender-addons": {"repository": "", "branch": "master"},
|
||||
"blender-addons-contrib": {"repository": "", "branch": "master"},
|
||||
"blender-dev-tools": {"repository": "", "branch": "master"},
|
||||
"lib svn": {"repository": "", "branch": "trunk"}},
|
||||
branch=current_branch,
|
||||
builderNames=[name],
|
||||
@@ -236,7 +222,8 @@ def git_step(branch=''):
|
||||
|
||||
|
||||
def git_submodules_update():
|
||||
command = ['git', 'submodule', 'update', '--remote']
|
||||
command = ['git', 'submodule', 'foreach', '--recursive',
|
||||
'git', 'pull', 'origin', 'master']
|
||||
return ShellCommand(name='Submodules Update',
|
||||
command=command,
|
||||
description='updating',
|
||||
@@ -245,10 +232,7 @@ def git_submodules_update():
|
||||
|
||||
|
||||
def lib_svn_step(dir):
|
||||
name = "lib svn"
|
||||
if dir == "darwin":
|
||||
name = "C++11 lib svn"
|
||||
return SVN(name=name,
|
||||
return SVN(name='lib svn',
|
||||
baseURL='https://svn.blender.org/svnroot/bf-blender/%%BRANCH%%/lib/' + dir,
|
||||
codebase='lib svn',
|
||||
mode='update',
|
||||
@@ -277,14 +261,10 @@ def generic_builder(id, libdir='', branch='', rsync=False):
|
||||
f = BuildFactory()
|
||||
if libdir != '':
|
||||
f.addStep(lib_svn_step(libdir))
|
||||
# Special trick to make sure we always have all the libs.
|
||||
if libdir.startswith("darwin"):
|
||||
f.addStep(lib_svn_step("darwin"))
|
||||
|
||||
for submodule in ('blender-translations',
|
||||
'blender-addons',
|
||||
'blender-addons-contrib',
|
||||
'blender-dev-tools'):
|
||||
'blender-addons-contrib'):
|
||||
f.addStep(git_submodule_step(submodule))
|
||||
|
||||
f.addStep(git_step(branch))
|
||||
@@ -302,10 +282,10 @@ def generic_builder(id, libdir='', branch='', rsync=False):
|
||||
f.addStep(FileUpload(name='upload',
|
||||
slavesrc='buildbot_upload.zip',
|
||||
masterdest=filename,
|
||||
maxsize=180 * 1024 * 1024,
|
||||
maxsize=150 * 1024 * 1024,
|
||||
workdir='install'))
|
||||
f.addStep(MasterShellCommand(name='unpack',
|
||||
command=['python2.7', unpack_script, filename],
|
||||
command=['python', unpack_script, filename],
|
||||
description='unpacking',
|
||||
descriptionDone='unpacked'))
|
||||
return f
|
||||
@@ -313,14 +293,13 @@ def generic_builder(id, libdir='', branch='', rsync=False):
|
||||
# Builders
|
||||
|
||||
add_builder(c, 'mac_x86_64_10_6_cmake', 'darwin-9.x.universal', generic_builder, hour=5)
|
||||
# add_builder(c, 'linux_glibc211_i686_cmake', '', generic_builder, hour=1)
|
||||
# add_builder(c, 'linux_glibc211_x86_64_cmake', '', generic_builder, hour=2)
|
||||
add_builder(c, 'linux_glibc211_i686_cmake', '', generic_builder, hour=1)
|
||||
add_builder(c, 'linux_glibc211_x86_64_cmake', '', generic_builder, hour=2)
|
||||
add_builder(c, 'linux_glibc219_i686_cmake', '', generic_builder, hour=3)
|
||||
add_builder(c, 'linux_glibc219_x86_64_cmake', '', generic_builder, hour=4)
|
||||
add_builder(c, 'win32_cmake_vc2013', 'windows_vc12', generic_builder, hour=3)
|
||||
add_builder(c, 'win64_cmake_vc2013', 'win64_vc12', generic_builder, hour=4)
|
||||
add_builder(c, 'win32_cmake_vc2015', 'windows_vc14', generic_builder, hour=5)
|
||||
add_builder(c, 'win64_cmake_vc2015', 'win64_vc14', generic_builder, hour=6)
|
||||
add_builder(c, 'win64_cmake_vc2015', 'win64_vc14', generic_builder, hour=5)
|
||||
|
||||
# STATUS TARGETS
|
||||
#
|
||||
|
@@ -49,7 +49,7 @@ def get_platform(filename):
|
||||
tokens = filename.split("-")
|
||||
platforms = ('osx', 'mac', 'bsd',
|
||||
'win', 'linux', 'source',
|
||||
'irix', 'solaris')
|
||||
'irix', 'solaris', 'mingw')
|
||||
platform_tokens = []
|
||||
found = False
|
||||
|
||||
@@ -67,9 +67,6 @@ def get_platform(filename):
|
||||
|
||||
|
||||
def get_branch(filename):
|
||||
if filename.startswith("blender-2.8"):
|
||||
return "blender2.8"
|
||||
|
||||
tokens = filename.split("-")
|
||||
branch = ""
|
||||
|
||||
|
@@ -56,6 +56,7 @@ if 'cmake' in builder:
|
||||
chroot_name = None # If not None command will be delegated to that chroot
|
||||
cuda_chroot_name = None # If not None cuda compilationcommand will be delegated to that chroot
|
||||
build_cubins = True # Whether to build Cycles CUDA kernels
|
||||
remove_install_dir = False # Remove installation folder before building
|
||||
bits = 64
|
||||
|
||||
# Config file to be used (relative to blender's sources root)
|
||||
@@ -69,31 +70,19 @@ if 'cmake' in builder:
|
||||
cuda_cmake_options = []
|
||||
|
||||
if builder.startswith('mac'):
|
||||
install_dir = None
|
||||
# Set up OSX architecture
|
||||
if builder.endswith('x86_64_10_6_cmake'):
|
||||
cmake_extra_options.append('-DCMAKE_OSX_ARCHITECTURES:STRING=x86_64')
|
||||
cmake_extra_options.append('-DWITH_CODEC_QUICKTIME=OFF')
|
||||
cmake_extra_options.append('-DCMAKE_OSX_DEPLOYMENT_TARGET=10.6')
|
||||
cmake_extra_options.append('-DCUDA_HOST_COMPILER=/usr/local/cuda-hack/clang')
|
||||
cmake_extra_options.append('-DCUDA_NVCC_EXECUTABLE=/usr/local/cuda-hack/nvcc')
|
||||
|
||||
|
||||
cmake_extra_options.append('-DCUDA_NVCC_EXECUTABLE=/usr/local/cuda-hack/bin/nvcc')
|
||||
|
||||
elif builder.startswith('win'):
|
||||
if builder.endswith('_vc2015'):
|
||||
if builder.startswith('win64'):
|
||||
cmake_options.extend(['-G', 'Visual Studio 14 2015 Win64'])
|
||||
elif builder.startswith('win32'):
|
||||
bits = 32
|
||||
cmake_options.extend(['-G', 'Visual Studio 14 2015'])
|
||||
cmake_extra_options.append('-DCUDA_NVCC_FLAGS=--cl-version;2013;' +
|
||||
'--compiler-bindir;C:\\Program Files (x86)\\Microsoft Visual Studio 12.0\\VC\\bin')
|
||||
else:
|
||||
if builder.startswith('win64'):
|
||||
cmake_options.extend(['-G', 'Visual Studio 12 2013 Win64'])
|
||||
elif builder.startswith('win32'):
|
||||
bits = 32
|
||||
cmake_options.extend(['-G', 'Visual Studio 12 2013'])
|
||||
install_dir = None
|
||||
if builder.startswith('win64'):
|
||||
cmake_options.append(['-G', '"Visual Studio 12 2013 Win64"'])
|
||||
elif builder.startswith('win32'):
|
||||
bits = 32
|
||||
cmake_options.append(['-G', '"Visual Studio 12 2013"'])
|
||||
|
||||
elif builder.startswith('linux'):
|
||||
tokens = builder.split("_")
|
||||
@@ -102,6 +91,7 @@ if 'cmake' in builder:
|
||||
deb_name = "jessie"
|
||||
elif glibc == 'glibc211':
|
||||
deb_name = "squeeze"
|
||||
remove_install_dir = True
|
||||
cmake_config_file = "build_files/buildbot/config/blender_linux.cmake"
|
||||
cmake_player_config_file = "build_files/buildbot/config/blender_linux_player.cmake"
|
||||
if builder.endswith('x86_64_cmake'):
|
||||
@@ -112,14 +102,11 @@ if 'cmake' in builder:
|
||||
chroot_name = 'buildbot_' + deb_name + '_i686'
|
||||
cuda_chroot_name = 'buildbot_' + deb_name + '_x86_64'
|
||||
targets = ['player', 'blender', 'cuda']
|
||||
cmake_extra_options.extend(["-DCMAKE_C_COMPILER=/usr/bin/gcc-7",
|
||||
"-DCMAKE_CXX_COMPILER=/usr/bin/g++-7"])
|
||||
|
||||
cmake_options.append("-C" + os.path.join(blender_dir, cmake_config_file))
|
||||
|
||||
# Prepare CMake options needed to configure cuda binaries compilation.
|
||||
cuda_cmake_options.append("-DWITH_CYCLES_CUDA_BINARIES=%s" % ('ON' if build_cubins else 'OFF'))
|
||||
cuda_cmake_options.append("-DCYCLES_CUDA_BINARIES_ARCH=sm_20;sm_21;sm_30;sm_35;sm_37;sm_50;sm_52;sm_60;sm_61")
|
||||
if build_cubins or 'cuda' in targets:
|
||||
if bits == 32:
|
||||
cuda_cmake_options.append("-DCUDA_64_BIT_DEVICE_CODE=OFF")
|
||||
@@ -130,7 +117,8 @@ if 'cmake' in builder:
|
||||
if 'cuda' not in targets:
|
||||
cmake_options += cuda_cmake_options
|
||||
|
||||
cmake_options.append("-DCMAKE_INSTALL_PREFIX=%s" % (install_dir))
|
||||
if install_dir:
|
||||
cmake_options.append("-DCMAKE_INSTALL_PREFIX=%s" % (install_dir))
|
||||
|
||||
cmake_options += cmake_extra_options
|
||||
|
||||
@@ -145,8 +133,10 @@ if 'cmake' in builder:
|
||||
cuda_chroot_prefix = chroot_prefix[:]
|
||||
|
||||
# Make sure no garbage remained from the previous run
|
||||
if os.path.isdir(install_dir):
|
||||
shutil.rmtree(install_dir)
|
||||
# (only do it if builder requested this)
|
||||
if remove_install_dir:
|
||||
if os.path.isdir(install_dir):
|
||||
shutil.rmtree(install_dir)
|
||||
|
||||
for target in targets:
|
||||
print("Building target %s" % (target))
|
||||
@@ -180,11 +170,13 @@ if 'cmake' in builder:
|
||||
os.remove('CMakeCache.txt')
|
||||
retcode = subprocess.call(target_chroot_prefix + ['cmake', blender_dir] + target_cmake_options)
|
||||
if retcode != 0:
|
||||
print('Configuration FAILED!')
|
||||
print('Condifuration FAILED!')
|
||||
sys.exit(retcode)
|
||||
|
||||
if 'win32' in builder or 'win64' in builder:
|
||||
command = ['cmake', '--build', '.', '--target', target_name, '--config', 'Release']
|
||||
if 'win32' in builder:
|
||||
command = ['msbuild', 'INSTALL.vcxproj', '/Property:PlatformToolset=v120_xp', '/p:Configuration=Release']
|
||||
elif 'win64' in builder:
|
||||
command = ['msbuild', 'INSTALL.vcxproj', '/p:Configuration=Release']
|
||||
else:
|
||||
command = target_chroot_prefix + ['make', '-s', '-j2', target_name]
|
||||
|
||||
|
@@ -108,11 +108,8 @@ if builder.find('cmake') != -1:
|
||||
platform += 'i386'
|
||||
elif builder.endswith('ppc_10_6_cmake'):
|
||||
platform += 'ppc'
|
||||
if builder.endswith('vc2015'):
|
||||
platform += "-vc14"
|
||||
builderified_name = 'blender-{}-{}-{}'.format(blender_full_version, git_hash, platform)
|
||||
# NOTE: Blender 2.8 is already respected by blender_full_version.
|
||||
if branch != '' and branch != 'blender2.8':
|
||||
if branch != '':
|
||||
builderified_name = branch + "-" + builderified_name
|
||||
|
||||
os.rename(result_file, "{}.zip".format(builderified_name))
|
||||
@@ -178,8 +175,7 @@ if builder.find('cmake') != -1:
|
||||
blender_hash,
|
||||
blender_glibc,
|
||||
blender_arch)
|
||||
# NOTE: Blender 2.8 is already respected by blender_full_version.
|
||||
if branch != '' and branch != 'blender2.8':
|
||||
if branch != '':
|
||||
package_name = branch + "-" + package_name
|
||||
|
||||
upload_filename = package_name + ".tar.bz2"
|
||||
|
@@ -1,70 +0,0 @@
|
||||
# - Find Alembic library
|
||||
# Find the native Alembic includes and libraries
|
||||
# This module defines
|
||||
# ALEMBIC_INCLUDE_DIRS, where to find Alembic headers, Set when
|
||||
# ALEMBIC_INCLUDE_DIR is found.
|
||||
# ALEMBIC_LIBRARIES, libraries to link against to use Alembic.
|
||||
# ALEMBIC_ROOT_DIR, The base directory to search for Alembic.
|
||||
# This can also be an environment variable.
|
||||
# ALEMBIC_FOUND, If false, do not try to use Alembic.
|
||||
#
|
||||
|
||||
#=============================================================================
|
||||
# Copyright 2016 Blender Foundation.
|
||||
#
|
||||
# Distributed under the OSI-approved BSD License (the "License");
|
||||
# see accompanying file Copyright.txt for details.
|
||||
#
|
||||
# This software is distributed WITHOUT ANY WARRANTY; without even the
|
||||
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
# See the License for more information.
|
||||
#=============================================================================
|
||||
|
||||
# If ALEMBIC_ROOT_DIR was defined in the environment, use it.
|
||||
IF(NOT ALEMBIC_ROOT_DIR AND NOT $ENV{ALEMBIC_ROOT_DIR} STREQUAL "")
|
||||
SET(ALEMBIC_ROOT_DIR $ENV{ALEMBIC_ROOT_DIR})
|
||||
ENDIF()
|
||||
|
||||
SET(_alembic_SEARCH_DIRS
|
||||
${ALEMBIC_ROOT_DIR}
|
||||
/usr/local
|
||||
/sw # Fink
|
||||
/opt/local # DarwinPorts
|
||||
/opt/csw # Blastwave
|
||||
/opt/lib/alembic
|
||||
)
|
||||
|
||||
FIND_PATH(ALEMBIC_INCLUDE_DIR
|
||||
NAMES
|
||||
Alembic/Abc/All.h
|
||||
HINTS
|
||||
${_alembic_SEARCH_DIRS}
|
||||
PATH_SUFFIXES
|
||||
include
|
||||
)
|
||||
|
||||
FIND_LIBRARY(ALEMBIC_LIBRARY
|
||||
NAMES
|
||||
Alembic
|
||||
HINTS
|
||||
${_alembic_SEARCH_DIRS}
|
||||
PATH_SUFFIXES
|
||||
lib64 lib lib/static
|
||||
)
|
||||
|
||||
# handle the QUIETLY and REQUIRED arguments and set ALEMBIC_FOUND to TRUE if
|
||||
# all listed variables are TRUE
|
||||
INCLUDE(FindPackageHandleStandardArgs)
|
||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(ALEMBIC DEFAULT_MSG ALEMBIC_LIBRARY ALEMBIC_INCLUDE_DIR)
|
||||
|
||||
IF(ALEMBIC_FOUND)
|
||||
SET(ALEMBIC_LIBRARIES ${ALEMBIC_LIBRARY})
|
||||
SET(ALEMBIC_INCLUDE_DIRS ${ALEMBIC_INCLUDE_DIR})
|
||||
ENDIF(ALEMBIC_FOUND)
|
||||
|
||||
MARK_AS_ADVANCED(
|
||||
ALEMBIC_INCLUDE_DIR
|
||||
ALEMBIC_LIBRARY
|
||||
)
|
||||
|
||||
UNSET(_alembic_SEARCH_DIRS)
|
@@ -1,603 +0,0 @@
|
||||
# Ceres Solver - A fast non-linear least squares minimizer
|
||||
# Copyright 2015 Google Inc. All rights reserved.
|
||||
# http://ceres-solver.org/
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are met:
|
||||
#
|
||||
# * Redistributions of source code must retain the above copyright notice,
|
||||
# this list of conditions and the following disclaimer.
|
||||
# * Redistributions in binary form must reproduce the above copyright notice,
|
||||
# this list of conditions and the following disclaimer in the documentation
|
||||
# and/or other materials provided with the distribution.
|
||||
# * Neither the name of Google Inc. nor the names of its contributors may be
|
||||
# used to endorse or promote products derived from this software without
|
||||
# specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
# Author: alexs.mac@gmail.com (Alex Stewart)
|
||||
#
|
||||
|
||||
# FindGflags.cmake - Find Google gflags logging library.
|
||||
#
|
||||
# This module will attempt to find gflags, either via an exported CMake
|
||||
# configuration (generated by gflags >= 2.1 which are built with CMake), or
|
||||
# by performing a standard search for all gflags components. The order of
|
||||
# precedence for these two methods of finding gflags is controlled by:
|
||||
# GFLAGS_PREFER_EXPORTED_GFLAGS_CMAKE_CONFIGURATION.
|
||||
#
|
||||
# This module defines the following variables:
|
||||
#
|
||||
# GFLAGS_FOUND: TRUE iff gflags is found.
|
||||
# GFLAGS_INCLUDE_DIRS: Include directories for gflags.
|
||||
# GFLAGS_LIBRARIES: Libraries required to link gflags.
|
||||
# GFLAGS_NAMESPACE: The namespace in which gflags is defined. In versions of
|
||||
# gflags < 2.1, this was google, for versions >= 2.1 it is
|
||||
# by default gflags, although can be configured when building
|
||||
# gflags to be something else (i.e. google for legacy
|
||||
# compatibility).
|
||||
#
|
||||
# The following variables control the behaviour of this module when an exported
|
||||
# gflags CMake configuration is not found.
|
||||
#
|
||||
# GFLAGS_PREFER_EXPORTED_GFLAGS_CMAKE_CONFIGURATION: TRUE/FALSE, iff TRUE then
|
||||
# then prefer using an exported CMake configuration
|
||||
# generated by gflags >= 2.1 over searching for the
|
||||
# gflags components manually. Otherwise (FALSE)
|
||||
# ignore any exported gflags CMake configurations and
|
||||
# always perform a manual search for the components.
|
||||
# Default: TRUE iff user does not define this variable
|
||||
# before we are called, and does NOT specify either
|
||||
# GFLAGS_INCLUDE_DIR_HINTS or GFLAGS_LIBRARY_DIR_HINTS
|
||||
# otherwise FALSE.
|
||||
# GFLAGS_INCLUDE_DIR_HINTS: List of additional directories in which to
|
||||
# search for gflags includes, e.g: /timbuktu/include.
|
||||
# GFLAGS_LIBRARY_DIR_HINTS: List of additional directories in which to
|
||||
# search for gflags libraries, e.g: /timbuktu/lib.
|
||||
# GFLAGS_ROOT_DIR, The base directory to search for Gflags.
|
||||
# This can also be an environment variable.
|
||||
#
|
||||
# The following variables are also defined by this module, but in line with
|
||||
# CMake recommended FindPackage() module style should NOT be referenced directly
|
||||
# by callers (use the plural variables detailed above instead). These variables
|
||||
# do however affect the behaviour of the module via FIND_[PATH/LIBRARY]() which
|
||||
# are NOT re-called (i.e. search for library is not repeated) if these variables
|
||||
# are set with valid values _in the CMake cache_. This means that if these
|
||||
# variables are set directly in the cache, either by the user in the CMake GUI,
|
||||
# or by the user passing -DVAR=VALUE directives to CMake when called (which
|
||||
# explicitly defines a cache variable), then they will be used verbatim,
|
||||
# bypassing the HINTS variables and other hard-coded search locations.
|
||||
#
|
||||
# GFLAGS_INCLUDE_DIR: Include directory for gflags, not including the
|
||||
# include directory of any dependencies.
|
||||
# GFLAGS_LIBRARY: gflags library, not including the libraries of any
|
||||
# dependencies.
|
||||
|
||||
# If GFLAGS_ROOT_DIR was defined in the environment, use it.
|
||||
if(NOT GFLAGS_ROOT_DIR AND NOT $ENV{GFLAGS_ROOT_DIR} STREQUAL "")
|
||||
set(GFLAGS_ROOT_DIR $ENV{GFLAGS_ROOT_DIR})
|
||||
endif()
|
||||
|
||||
if(DEFINED GFLAGS_ROOT_DIR)
|
||||
set(GFLAGS_ROOT_DIR_INCLUDE "${GFLAGS_ROOT_DIR}/include")
|
||||
set(GFLAGS_ROOT_DIR_LIB "${GFLAGS_ROOT_DIR}/lib")
|
||||
endif()
|
||||
|
||||
# Reset CALLERS_CMAKE_FIND_LIBRARY_PREFIXES to its value when FindGflags was
|
||||
# invoked, necessary for MSVC.
|
||||
macro(GFLAGS_RESET_FIND_LIBRARY_PREFIX)
|
||||
if(MSVC)
|
||||
set(CMAKE_FIND_LIBRARY_PREFIXES "${CALLERS_CMAKE_FIND_LIBRARY_PREFIXES}")
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
# Called if we failed to find gflags or any of it's required dependencies,
|
||||
# unsets all public (designed to be used externally) variables and reports
|
||||
# error message at priority depending upon [REQUIRED/QUIET/<NONE>] argument.
|
||||
macro(GFLAGS_REPORT_NOT_FOUND REASON_MSG)
|
||||
unset(GFLAGS_FOUND)
|
||||
unset(GFLAGS_INCLUDE_DIRS)
|
||||
unset(GFLAGS_LIBRARIES)
|
||||
# Do not use unset, as we want to keep GFLAGS_NAMESPACE in the cache,
|
||||
# but simply clear its value.
|
||||
set(GFLAGS_NAMESPACE "" CACHE STRING
|
||||
"gflags namespace (google or gflags)" FORCE)
|
||||
|
||||
# Make results of search visible in the CMake GUI if gflags has not
|
||||
# been found so that user does not have to toggle to advanced view.
|
||||
mark_as_advanced(CLEAR GFLAGS_INCLUDE_DIR
|
||||
GFLAGS_LIBRARY
|
||||
GFLAGS_NAMESPACE)
|
||||
|
||||
gflags_reset_find_library_prefix()
|
||||
|
||||
# Note <package>_FIND_[REQUIRED/QUIETLY] variables defined by FindPackage()
|
||||
# use the camelcase library name, not uppercase.
|
||||
if(Gflags_FIND_QUIETLY)
|
||||
message(STATUS "Failed to find gflags - " ${REASON_MSG} ${ARGN})
|
||||
elseif(Gflags_FIND_REQUIRED)
|
||||
message(FATAL_ERROR "Failed to find gflags - " ${REASON_MSG} ${ARGN})
|
||||
else()
|
||||
# Neither QUIETLY nor REQUIRED, use no priority which emits a message
|
||||
# but continues configuration and allows generation.
|
||||
message("-- Failed to find gflags - " ${REASON_MSG} ${ARGN})
|
||||
endif()
|
||||
return()
|
||||
endmacro()
|
||||
|
||||
# Verify that all variable names passed as arguments are defined (can be empty
|
||||
# but must be defined) or raise a fatal error.
|
||||
macro(GFLAGS_CHECK_VARS_DEFINED)
|
||||
foreach(CHECK_VAR ${ARGN})
|
||||
if(NOT DEFINED ${CHECK_VAR})
|
||||
message(FATAL_ERROR "Ceres Bug: ${CHECK_VAR} is not defined.")
|
||||
endif()
|
||||
endforeach()
|
||||
endmacro()
|
||||
|
||||
# Use check_cxx_source_compiles() to compile trivial test programs to determine
|
||||
# the gflags namespace. This works on all OSs except Windows. If using Visual
|
||||
# Studio, it fails because msbuild forces check_cxx_source_compiles() to use
|
||||
# CMAKE_BUILD_TYPE=Debug for the test project, which usually breaks detection
|
||||
# because MSVC requires that the test project use the same build type as gflags,
|
||||
# which would normally be built in Release.
|
||||
#
|
||||
# Defines: GFLAGS_NAMESPACE in the caller's scope with the detected namespace,
|
||||
# which is blank (empty string, will test FALSE is CMake conditionals)
|
||||
# if detection failed.
|
||||
function(GFLAGS_CHECK_GFLAGS_NAMESPACE_USING_TRY_COMPILE)
|
||||
# Verify that all required variables are defined.
|
||||
gflags_check_vars_defined(
|
||||
GFLAGS_INCLUDE_DIR GFLAGS_LIBRARY)
|
||||
# Ensure that GFLAGS_NAMESPACE is always unset on completion unless
|
||||
# we explicitly set if after having the correct namespace.
|
||||
set(GFLAGS_NAMESPACE "" PARENT_SCOPE)
|
||||
|
||||
include(CheckCXXSourceCompiles)
|
||||
# Setup include path & link library for gflags for CHECK_CXX_SOURCE_COMPILES.
|
||||
set(CMAKE_REQUIRED_INCLUDES ${GFLAGS_INCLUDE_DIR})
|
||||
set(CMAKE_REQUIRED_LIBRARIES ${GFLAGS_LIBRARY} ${GFLAGS_LINK_LIBRARIES})
|
||||
# First try the (older) google namespace. Note that the output variable
|
||||
# MUST be unique to the build type as otherwise the test is not repeated as
|
||||
# it is assumed to have already been performed.
|
||||
check_cxx_source_compiles(
|
||||
"#include <gflags/gflags.h>
|
||||
int main(int argc, char * argv[]) {
|
||||
google::ParseCommandLineFlags(&argc, &argv, true);
|
||||
return 0;
|
||||
}"
|
||||
GFLAGS_IN_GOOGLE_NAMESPACE)
|
||||
if(GFLAGS_IN_GOOGLE_NAMESPACE)
|
||||
set(GFLAGS_NAMESPACE google PARENT_SCOPE)
|
||||
return()
|
||||
endif()
|
||||
|
||||
# Try (newer) gflags namespace instead. Note that the output variable
|
||||
# MUST be unique to the build type as otherwise the test is not repeated as
|
||||
# it is assumed to have already been performed.
|
||||
set(CMAKE_REQUIRED_INCLUDES ${GFLAGS_INCLUDE_DIR})
|
||||
set(CMAKE_REQUIRED_LIBRARIES ${GFLAGS_LIBRARY} ${GFLAGS_LINK_LIBRARIES})
|
||||
check_cxx_source_compiles(
|
||||
"#include <gflags/gflags.h>
|
||||
int main(int argc, char * argv[]) {
|
||||
gflags::ParseCommandLineFlags(&argc, &argv, true);
|
||||
return 0;
|
||||
}"
|
||||
GFLAGS_IN_GFLAGS_NAMESPACE)
|
||||
if(GFLAGS_IN_GFLAGS_NAMESPACE)
|
||||
set(GFLAGS_NAMESPACE gflags PARENT_SCOPE)
|
||||
return()
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
# Use regex on the gflags headers to attempt to determine the gflags namespace.
|
||||
# Checks both gflags.h (contained namespace on versions < 2.1.2) and
|
||||
# gflags_declare.h, which contains the namespace on versions >= 2.1.2.
|
||||
# In general, this method should only be used when
|
||||
# GFLAGS_CHECK_GFLAGS_NAMESPACE_USING_TRY_COMPILE() cannot be used, or has
|
||||
# failed.
|
||||
#
|
||||
# Defines: GFLAGS_NAMESPACE in the caller's scope with the detected namespace,
|
||||
# which is blank (empty string, will test FALSE is CMake conditionals)
|
||||
# if detection failed.
|
||||
function(GFLAGS_CHECK_GFLAGS_NAMESPACE_USING_REGEX)
|
||||
# Verify that all required variables are defined.
|
||||
gflags_check_vars_defined(GFLAGS_INCLUDE_DIR)
|
||||
# Ensure that GFLAGS_NAMESPACE is always undefined on completion unless
|
||||
# we explicitly set if after having the correct namespace.
|
||||
set(GFLAGS_NAMESPACE "" PARENT_SCOPE)
|
||||
|
||||
# Scan gflags.h to identify what namespace gflags was built with. On
|
||||
# versions of gflags < 2.1.2, gflags.h was configured with the namespace
|
||||
# directly, on >= 2.1.2, gflags.h uses the GFLAGS_NAMESPACE #define which
|
||||
# is defined in gflags_declare.h, we try each location in turn.
|
||||
set(GFLAGS_HEADER_FILE ${GFLAGS_INCLUDE_DIR}/gflags/gflags.h)
|
||||
if(NOT EXISTS ${GFLAGS_HEADER_FILE})
|
||||
gflags_report_not_found(
|
||||
"Could not find file: ${GFLAGS_HEADER_FILE} "
|
||||
"containing namespace information in gflags install located at: "
|
||||
"${GFLAGS_INCLUDE_DIR}.")
|
||||
endif()
|
||||
file(READ ${GFLAGS_HEADER_FILE} GFLAGS_HEADER_FILE_CONTENTS)
|
||||
|
||||
string(REGEX MATCH "namespace [A-Za-z]+"
|
||||
GFLAGS_NAMESPACE "${GFLAGS_HEADER_FILE_CONTENTS}")
|
||||
string(REGEX REPLACE "namespace ([A-Za-z]+)" "\\1"
|
||||
GFLAGS_NAMESPACE "${GFLAGS_NAMESPACE}")
|
||||
|
||||
if(NOT GFLAGS_NAMESPACE)
|
||||
gflags_report_not_found(
|
||||
"Failed to extract gflags namespace from header file: "
|
||||
"${GFLAGS_HEADER_FILE}.")
|
||||
endif()
|
||||
|
||||
if(GFLAGS_NAMESPACE STREQUAL "google" OR
|
||||
GFLAGS_NAMESPACE STREQUAL "gflags")
|
||||
# Found valid gflags namespace from gflags.h.
|
||||
set(GFLAGS_NAMESPACE "${GFLAGS_NAMESPACE}" PARENT_SCOPE)
|
||||
return()
|
||||
endif()
|
||||
|
||||
# Failed to find gflags namespace from gflags.h, gflags is likely a new
|
||||
# version, check gflags_declare.h, which in newer versions (>= 2.1.2) contains
|
||||
# the GFLAGS_NAMESPACE #define, which is then referenced in gflags.h.
|
||||
set(GFLAGS_DECLARE_FILE ${GFLAGS_INCLUDE_DIR}/gflags/gflags_declare.h)
|
||||
if(NOT EXISTS ${GFLAGS_DECLARE_FILE})
|
||||
gflags_report_not_found(
|
||||
"Could not find file: ${GFLAGS_DECLARE_FILE} "
|
||||
"containing namespace information in gflags install located at: "
|
||||
"${GFLAGS_INCLUDE_DIR}.")
|
||||
endif()
|
||||
file(READ ${GFLAGS_DECLARE_FILE} GFLAGS_DECLARE_FILE_CONTENTS)
|
||||
|
||||
string(REGEX MATCH "#define GFLAGS_NAMESPACE [A-Za-z]+"
|
||||
GFLAGS_NAMESPACE "${GFLAGS_DECLARE_FILE_CONTENTS}")
|
||||
string(REGEX REPLACE "#define GFLAGS_NAMESPACE ([A-Za-z]+)" "\\1"
|
||||
GFLAGS_NAMESPACE "${GFLAGS_NAMESPACE}")
|
||||
|
||||
if(NOT GFLAGS_NAMESPACE)
|
||||
gflags_report_not_found(
|
||||
"Failed to extract gflags namespace from declare file: "
|
||||
"${GFLAGS_DECLARE_FILE}.")
|
||||
endif()
|
||||
|
||||
if(GFLAGS_NAMESPACE STREQUAL "google" OR
|
||||
GFLAGS_NAMESPACE STREQUAL "gflags")
|
||||
# Found valid gflags namespace from gflags.h.
|
||||
set(GFLAGS_NAMESPACE "${GFLAGS_NAMESPACE}" PARENT_SCOPE)
|
||||
return()
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
# -----------------------------------------------------------------
|
||||
# By default, if the user has expressed no preference for using an exported
|
||||
# gflags CMake configuration over performing a search for the installed
|
||||
# components, and has not specified any hints for the search locations, then
|
||||
# prefer a gflags exported configuration if available.
|
||||
if(NOT DEFINED GFLAGS_PREFER_EXPORTED_GFLAGS_CMAKE_CONFIGURATION
|
||||
AND NOT GFLAGS_INCLUDE_DIR_HINTS
|
||||
AND NOT GFLAGS_LIBRARY_DIR_HINTS)
|
||||
message(STATUS "No preference for use of exported gflags CMake configuration "
|
||||
"set, and no hints for include/library directories provided. "
|
||||
"Defaulting to preferring an installed/exported gflags CMake configuration "
|
||||
"if available.")
|
||||
set(GFLAGS_PREFER_EXPORTED_GFLAGS_CMAKE_CONFIGURATION TRUE)
|
||||
endif()
|
||||
|
||||
if(GFLAGS_PREFER_EXPORTED_GFLAGS_CMAKE_CONFIGURATION)
|
||||
# Try to find an exported CMake configuration for gflags, as generated by
|
||||
# gflags versions >= 2.1.
|
||||
#
|
||||
# We search twice, s/t we can invert the ordering of precedence used by
|
||||
# find_package() for exported package build directories, and installed
|
||||
# packages (found via CMAKE_SYSTEM_PREFIX_PATH), listed as items 6) and 7)
|
||||
# respectively in [1].
|
||||
#
|
||||
# By default, exported build directories are (in theory) detected first, and
|
||||
# this is usually the case on Windows. However, on OS X & Linux, the install
|
||||
# path (/usr/local) is typically present in the PATH environment variable
|
||||
# which is checked in item 4) in [1] (i.e. before both of the above, unless
|
||||
# NO_SYSTEM_ENVIRONMENT_PATH is passed). As such on those OSs installed
|
||||
# packages are usually detected in preference to exported package build
|
||||
# directories.
|
||||
#
|
||||
# To ensure a more consistent response across all OSs, and as users usually
|
||||
# want to prefer an installed version of a package over a locally built one
|
||||
# where both exist (esp. as the exported build directory might be removed
|
||||
# after installation), we first search with NO_CMAKE_PACKAGE_REGISTRY which
|
||||
# means any build directories exported by the user are ignored, and thus
|
||||
# installed directories are preferred. If this fails to find the package
|
||||
# we then research again, but without NO_CMAKE_PACKAGE_REGISTRY, so any
|
||||
# exported build directories will now be detected.
|
||||
#
|
||||
# To prevent confusion on Windows, we also pass NO_CMAKE_BUILDS_PATH (which
|
||||
# is item 5) in [1]), to not preferentially use projects that were built
|
||||
# recently with the CMake GUI to ensure that we always prefer an installed
|
||||
# version if available.
|
||||
#
|
||||
# [1] http://www.cmake.org/cmake/help/v2.8.11/cmake.html#command:find_package
|
||||
find_package(gflags QUIET
|
||||
NO_MODULE
|
||||
NO_CMAKE_PACKAGE_REGISTRY
|
||||
NO_CMAKE_BUILDS_PATH)
|
||||
if(gflags_FOUND)
|
||||
message(STATUS "Found installed version of gflags: ${gflags_DIR}")
|
||||
else()
|
||||
# Failed to find an installed version of gflags, repeat search allowing
|
||||
# exported build directories.
|
||||
message(STATUS "Failed to find installed gflags CMake configuration, "
|
||||
"searching for gflags build directories exported with CMake.")
|
||||
# Again pass NO_CMAKE_BUILDS_PATH, as we know that gflags is exported and
|
||||
# do not want to treat projects built with the CMake GUI preferentially.
|
||||
find_package(gflags QUIET
|
||||
NO_MODULE
|
||||
NO_CMAKE_BUILDS_PATH)
|
||||
if(gflags_FOUND)
|
||||
message(STATUS "Found exported gflags build directory: ${gflags_DIR}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
set(FOUND_INSTALLED_GFLAGS_CMAKE_CONFIGURATION ${gflags_FOUND})
|
||||
|
||||
# gflags v2.1 - 2.1.2 shipped with a bug in their gflags-config.cmake [1]
|
||||
# whereby gflags_LIBRARIES = "gflags", but there was no imported target
|
||||
# called "gflags", they were called: gflags[_nothreads]-[static/shared].
|
||||
# As this causes linker errors when gflags is not installed in a location
|
||||
# on the current library paths, detect if this problem is present and
|
||||
# fix it.
|
||||
#
|
||||
# [1] https://github.com/gflags/gflags/issues/110
|
||||
if(gflags_FOUND)
|
||||
# NOTE: This is not written as additional conditions in the outer
|
||||
# if(gflags_FOUND) as the NOT TARGET "${gflags_LIBRARIES}"
|
||||
# condition causes problems if gflags is not found.
|
||||
if(${gflags_VERSION} VERSION_LESS 2.1.3 AND
|
||||
NOT TARGET "${gflags_LIBRARIES}")
|
||||
message(STATUS "Detected broken gflags install in: ${gflags_DIR}, "
|
||||
"version: ${gflags_VERSION} <= 2.1.2 which defines gflags_LIBRARIES = "
|
||||
"${gflags_LIBRARIES} which is not an imported CMake target, see: "
|
||||
"https://github.com/gflags/gflags/issues/110. Attempting to fix by "
|
||||
"detecting correct gflags target.")
|
||||
# Ordering here expresses preference for detection, specifically we do not
|
||||
# want to use the _nothreads variants if the full library is available.
|
||||
list(APPEND CHECK_GFLAGS_IMPORTED_TARGET_NAMES
|
||||
gflags-shared gflags-static
|
||||
gflags_nothreads-shared gflags_nothreads-static)
|
||||
foreach(CHECK_GFLAGS_TARGET ${CHECK_GFLAGS_IMPORTED_TARGET_NAMES})
|
||||
if(TARGET ${CHECK_GFLAGS_TARGET})
|
||||
message(STATUS "Found valid gflags target: ${CHECK_GFLAGS_TARGET}, "
|
||||
"updating gflags_LIBRARIES.")
|
||||
set(gflags_LIBRARIES ${CHECK_GFLAGS_TARGET})
|
||||
break()
|
||||
endif()
|
||||
endforeach()
|
||||
if(NOT TARGET ${gflags_LIBRARIES})
|
||||
message(STATUS "Failed to fix detected broken gflags install in: "
|
||||
"${gflags_DIR}, version: ${gflags_VERSION} <= 2.1.2, none of the "
|
||||
"imported targets for gflags: ${CHECK_GFLAGS_IMPORTED_TARGET_NAMES} "
|
||||
"are defined. Will continue with a manual search for gflags "
|
||||
"components. We recommend you build/install a version of gflags > "
|
||||
"2.1.2 (or master).")
|
||||
set(FOUND_INSTALLED_GFLAGS_CMAKE_CONFIGURATION FALSE)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(FOUND_INSTALLED_GFLAGS_CMAKE_CONFIGURATION)
|
||||
message(STATUS "Detected gflags version: ${gflags_VERSION}")
|
||||
set(GFLAGS_FOUND ${gflags_FOUND})
|
||||
set(GFLAGS_INCLUDE_DIR ${gflags_INCLUDE_DIR})
|
||||
set(GFLAGS_LIBRARY ${gflags_LIBRARIES})
|
||||
|
||||
# gflags does not export the namespace in their CMake configuration, so
|
||||
# use our function to determine what it should be, as it can be either
|
||||
# gflags or google dependent upon version & configuration.
|
||||
#
|
||||
# NOTE: We use the regex method to determine the namespace here, as
|
||||
# check_cxx_source_compiles() will not use imported targets, which
|
||||
# is what gflags will be in this case.
|
||||
gflags_check_gflags_namespace_using_regex()
|
||||
|
||||
if(NOT GFLAGS_NAMESPACE)
|
||||
gflags_report_not_found(
|
||||
"Failed to determine gflags namespace using regex for gflags "
|
||||
"version: ${gflags_VERSION} exported here: ${gflags_DIR} using CMake.")
|
||||
endif()
|
||||
else()
|
||||
message(STATUS "Failed to find an installed/exported CMake configuration "
|
||||
"for gflags, will perform search for installed gflags components.")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(NOT GFLAGS_FOUND)
|
||||
# Either failed to find an exported gflags CMake configuration, or user
|
||||
# told us not to use one. Perform a manual search for all gflags components.
|
||||
|
||||
# Handle possible presence of lib prefix for libraries on MSVC, see
|
||||
# also GFLAGS_RESET_FIND_LIBRARY_PREFIX().
|
||||
if(MSVC)
|
||||
# Preserve the caller's original values for CMAKE_FIND_LIBRARY_PREFIXES
|
||||
# s/t we can set it back before returning.
|
||||
set(CALLERS_CMAKE_FIND_LIBRARY_PREFIXES "${CMAKE_FIND_LIBRARY_PREFIXES}")
|
||||
# The empty string in this list is important, it represents the case when
|
||||
# the libraries have no prefix (shared libraries / DLLs).
|
||||
set(CMAKE_FIND_LIBRARY_PREFIXES "lib" "" "${CMAKE_FIND_LIBRARY_PREFIXES}")
|
||||
endif()
|
||||
|
||||
# Search user-installed locations first, so that we prefer user installs
|
||||
# to system installs where both exist.
|
||||
list(APPEND GFLAGS_CHECK_INCLUDE_DIRS
|
||||
${GFLAGS_ROOT_DIR_INCLUDE}
|
||||
/usr/local/include
|
||||
/usr/local/homebrew/include # Mac OS X
|
||||
/opt/local/var/macports/software # Mac OS X.
|
||||
/opt/local/include
|
||||
/usr/include
|
||||
/sw/include # Fink
|
||||
/opt/csw/include # Blastwave
|
||||
/opt/lib/gflags/include)
|
||||
|
||||
list(APPEND GFLAGS_CHECK_PATH_SUFFIXES
|
||||
gflags/include # Windows (for C:/Program Files prefix).
|
||||
gflags/Include) # Windows (for C:/Program Files prefix).
|
||||
|
||||
list(APPEND GFLAGS_CHECK_LIBRARY_DIRS
|
||||
${GFLAGS_ROOT_DIR_LIB}
|
||||
/usr/local/lib
|
||||
/usr/local/homebrew/lib # Mac OS X.
|
||||
/opt/local/lib
|
||||
/usr/lib
|
||||
/sw/lib # Fink
|
||||
/opt/csw/lib # Blastwave
|
||||
/opt/lib/gflags/lib)
|
||||
list(APPEND GFLAGS_CHECK_LIBRARY_SUFFIXES
|
||||
gflags/lib # Windows (for C:/Program Files prefix).
|
||||
gflags/Lib) # Windows (for C:/Program Files prefix).
|
||||
|
||||
# Search supplied hint directories first if supplied.
|
||||
find_path(GFLAGS_INCLUDE_DIR
|
||||
NAMES gflags/gflags.h
|
||||
PATHS ${GFLAGS_INCLUDE_DIR_HINTS}
|
||||
${GFLAGS_CHECK_INCLUDE_DIRS}
|
||||
PATH_SUFFIXES ${GFLAGS_CHECK_PATH_SUFFIXES})
|
||||
if(NOT GFLAGS_INCLUDE_DIR OR
|
||||
NOT EXISTS ${GFLAGS_INCLUDE_DIR})
|
||||
gflags_report_not_found(
|
||||
"Could not find gflags include directory, set GFLAGS_INCLUDE_DIR "
|
||||
"to directory containing gflags/gflags.h")
|
||||
endif(NOT GFLAGS_INCLUDE_DIR OR
|
||||
NOT EXISTS ${GFLAGS_INCLUDE_DIR})
|
||||
|
||||
find_library(GFLAGS_LIBRARY NAMES gflags
|
||||
PATHS ${GFLAGS_LIBRARY_DIR_HINTS}
|
||||
${GFLAGS_CHECK_LIBRARY_DIRS}
|
||||
PATH_SUFFIXES ${GFLAGS_CHECK_LIBRARY_SUFFIXES})
|
||||
if(NOT GFLAGS_LIBRARY OR
|
||||
NOT EXISTS ${GFLAGS_LIBRARY})
|
||||
gflags_report_not_found(
|
||||
"Could not find gflags library, set GFLAGS_LIBRARY "
|
||||
"to full path to libgflags.")
|
||||
endif(NOT GFLAGS_LIBRARY OR
|
||||
NOT EXISTS ${GFLAGS_LIBRARY})
|
||||
|
||||
# gflags typically requires a threading library (which is OS dependent), note
|
||||
# that this defines the CMAKE_THREAD_LIBS_INIT variable. If we are able to
|
||||
# detect threads, we assume that gflags requires it.
|
||||
find_package(Threads QUIET)
|
||||
set(GFLAGS_LINK_LIBRARIES ${CMAKE_THREAD_LIBS_INIT})
|
||||
# On Windows (including MinGW), the Shlwapi library is used by gflags if
|
||||
# available.
|
||||
if(WIN32)
|
||||
include(CheckIncludeFileCXX)
|
||||
check_include_file_cxx("shlwapi.h" HAVE_SHLWAPI)
|
||||
if(HAVE_SHLWAPI)
|
||||
list(APPEND GFLAGS_LINK_LIBRARIES shlwapi.lib)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Mark internally as found, then verify. GFLAGS_REPORT_NOT_FOUND() unsets
|
||||
# if called.
|
||||
set(GFLAGS_FOUND TRUE)
|
||||
|
||||
# Identify what namespace gflags was built with.
|
||||
if(GFLAGS_INCLUDE_DIR AND NOT GFLAGS_NAMESPACE)
|
||||
# To handle Windows peculiarities / CMake bugs on MSVC we try two approaches
|
||||
# to detect the gflags namespace:
|
||||
#
|
||||
# 1) Try to use check_cxx_source_compiles() to compile a trivial program
|
||||
# with the two choices for the gflags namespace.
|
||||
#
|
||||
# 2) [In the event 1) fails] Use regex on the gflags headers to try to
|
||||
# determine the gflags namespace. Whilst this is less robust than 1),
|
||||
# it does avoid any interaction with msbuild.
|
||||
gflags_check_gflags_namespace_using_try_compile()
|
||||
|
||||
if(NOT GFLAGS_NAMESPACE)
|
||||
# Failed to determine gflags namespace using check_cxx_source_compiles()
|
||||
# method, try and obtain it using regex on the gflags headers instead.
|
||||
message(STATUS "Failed to find gflags namespace using using "
|
||||
"check_cxx_source_compiles(), trying namespace regex instead, "
|
||||
"this is expected on Windows.")
|
||||
gflags_check_gflags_namespace_using_regex()
|
||||
|
||||
if(NOT GFLAGS_NAMESPACE)
|
||||
gflags_report_not_found(
|
||||
"Failed to determine gflags namespace either by "
|
||||
"check_cxx_source_compiles(), or namespace regex.")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Make the GFLAGS_NAMESPACE a cache variable s/t the user can view it, and could
|
||||
# overwrite it in the CMake GUI.
|
||||
set(GFLAGS_NAMESPACE "${GFLAGS_NAMESPACE}" CACHE STRING
|
||||
"gflags namespace (google or gflags)" FORCE)
|
||||
|
||||
# gflags does not seem to provide any record of the version in its
|
||||
# source tree, thus cannot extract version.
|
||||
|
||||
# Catch case when caller has set GFLAGS_NAMESPACE in the cache / GUI
|
||||
# with an invalid value.
|
||||
if(GFLAGS_NAMESPACE AND
|
||||
NOT GFLAGS_NAMESPACE STREQUAL "google" AND
|
||||
NOT GFLAGS_NAMESPACE STREQUAL "gflags")
|
||||
gflags_report_not_found(
|
||||
"Caller defined GFLAGS_NAMESPACE:"
|
||||
" ${GFLAGS_NAMESPACE} is not valid, not google or gflags.")
|
||||
endif()
|
||||
# Catch case when caller has set GFLAGS_INCLUDE_DIR in the cache / GUI and
|
||||
# thus FIND_[PATH/LIBRARY] are not called, but specified locations are
|
||||
# invalid, otherwise we would report the library as found.
|
||||
if(GFLAGS_INCLUDE_DIR AND
|
||||
NOT EXISTS ${GFLAGS_INCLUDE_DIR}/gflags/gflags.h)
|
||||
gflags_report_not_found(
|
||||
"Caller defined GFLAGS_INCLUDE_DIR:"
|
||||
" ${GFLAGS_INCLUDE_DIR} does not contain gflags/gflags.h header.")
|
||||
endif(GFLAGS_INCLUDE_DIR AND
|
||||
NOT EXISTS ${GFLAGS_INCLUDE_DIR}/gflags/gflags.h)
|
||||
# TODO: This regex for gflags library is pretty primitive, we use lowercase
|
||||
# for comparison to handle Windows using CamelCase library names, could
|
||||
# this check be better?
|
||||
string(TOLOWER "${GFLAGS_LIBRARY}" LOWERCASE_GFLAGS_LIBRARY)
|
||||
if(GFLAGS_LIBRARY AND
|
||||
NOT "${LOWERCASE_GFLAGS_LIBRARY}" MATCHES ".*gflags[^/]*")
|
||||
gflags_report_not_found(
|
||||
"Caller defined GFLAGS_LIBRARY: "
|
||||
"${GFLAGS_LIBRARY} does not match gflags.")
|
||||
endif(GFLAGS_LIBRARY AND
|
||||
NOT "${LOWERCASE_GFLAGS_LIBRARY}" MATCHES ".*gflags[^/]*")
|
||||
|
||||
gflags_reset_find_library_prefix()
|
||||
|
||||
endif()
|
||||
|
||||
# Set standard CMake FindPackage variables if found.
|
||||
if(GFLAGS_FOUND)
|
||||
set(GFLAGS_INCLUDE_DIRS ${GFLAGS_INCLUDE_DIR})
|
||||
set(GFLAGS_LIBRARIES ${GFLAGS_LIBRARY} ${GFLAGS_LINK_LIBRARIES})
|
||||
endif()
|
||||
|
||||
# Handle REQUIRED / QUIET optional arguments.
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(GFLAGS DEFAULT_MSG
|
||||
GFLAGS_INCLUDE_DIRS GFLAGS_LIBRARIES GFLAGS_NAMESPACE)
|
||||
|
||||
# Only mark internal variables as advanced if we found gflags, otherwise
|
||||
# leave them visible in the standard GUI for the user to set manually.
|
||||
if(GFLAGS_FOUND)
|
||||
mark_as_advanced(FORCE GFLAGS_INCLUDE_DIR
|
||||
GFLAGS_LIBRARY
|
||||
GFLAGS_NAMESPACE
|
||||
gflags_DIR) # Autogenerated by find_package(gflags)
|
||||
endif()
|
@@ -1,226 +0,0 @@
|
||||
# Ceres Solver - A fast non-linear least squares minimizer
|
||||
# Copyright 2015 Google Inc. All rights reserved.
|
||||
# http://ceres-solver.org/
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are met:
|
||||
#
|
||||
# * Redistributions of source code must retain the above copyright notice,
|
||||
# this list of conditions and the following disclaimer.
|
||||
# * Redistributions in binary form must reproduce the above copyright notice,
|
||||
# this list of conditions and the following disclaimer in the documentation
|
||||
# and/or other materials provided with the distribution.
|
||||
# * Neither the name of Google Inc. nor the names of its contributors may be
|
||||
# used to endorse or promote products derived from this software without
|
||||
# specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
# Author: alexs.mac@gmail.com (Alex Stewart)
|
||||
#
|
||||
|
||||
# FindGlog.cmake - Find Google glog logging library.
|
||||
#
|
||||
# This module defines the following variables:
|
||||
#
|
||||
# GLOG_FOUND: TRUE iff glog is found.
|
||||
# GLOG_INCLUDE_DIRS: Include directories for glog.
|
||||
# GLOG_LIBRARIES: Libraries required to link glog.
|
||||
#
|
||||
# The following variables control the behaviour of this module:
|
||||
#
|
||||
# GLOG_INCLUDE_DIR_HINTS: List of additional directories in which to
|
||||
# search for glog includes, e.g: /timbuktu/include.
|
||||
# GLOG_LIBRARY_DIR_HINTS: List of additional directories in which to
|
||||
# search for glog libraries, e.g: /timbuktu/lib.
|
||||
# GFLOG_ROOT_DIR, The base directory to search for Glog.
|
||||
# This can also be an environment variable.
|
||||
#
|
||||
# The following variables are also defined by this module, but in line with
|
||||
# CMake recommended FindPackage() module style should NOT be referenced directly
|
||||
# by callers (use the plural variables detailed above instead). These variables
|
||||
# do however affect the behaviour of the module via FIND_[PATH/LIBRARY]() which
|
||||
# are NOT re-called (i.e. search for library is not repeated) if these variables
|
||||
# are set with valid values _in the CMake cache_. This means that if these
|
||||
# variables are set directly in the cache, either by the user in the CMake GUI,
|
||||
# or by the user passing -DVAR=VALUE directives to CMake when called (which
|
||||
# explicitly defines a cache variable), then they will be used verbatim,
|
||||
# bypassing the HINTS variables and other hard-coded search locations.
|
||||
#
|
||||
# GLOG_INCLUDE_DIR: Include directory for glog, not including the
|
||||
# include directory of any dependencies.
|
||||
# GLOG_LIBRARY: glog library, not including the libraries of any
|
||||
# dependencies.
|
||||
|
||||
# If GLOG_ROOT_DIR was defined in the environment, use it.
|
||||
if(NOT GLOG_ROOT_DIR AND NOT $ENV{GLOG_ROOT_DIR} STREQUAL "")
|
||||
set(GLOG_ROOT_DIR $ENV{GLOG_ROOT_DIR})
|
||||
endif()
|
||||
|
||||
if(DEFINED GLOG_ROOT_DIR)
|
||||
set(GLOG_ROOT_DIR_INCLUDE "${GLOG_ROOT_DIR}/include")
|
||||
set(GLOG_ROOT_DIR_LIB "${GLOG_ROOT_DIR}/lib")
|
||||
endif()
|
||||
|
||||
# Reset CALLERS_CMAKE_FIND_LIBRARY_PREFIXES to its value when
|
||||
# FindGlog was invoked.
|
||||
macro(GLOG_RESET_FIND_LIBRARY_PREFIX)
|
||||
if(MSVC)
|
||||
set(CMAKE_FIND_LIBRARY_PREFIXES "${CALLERS_CMAKE_FIND_LIBRARY_PREFIXES}")
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
# Called if we failed to find glog or any of it's required dependencies,
|
||||
# unsets all public (designed to be used externally) variables and reports
|
||||
# error message at priority depending upon [REQUIRED/QUIET/<NONE>] argument.
|
||||
macro(GLOG_REPORT_NOT_FOUND REASON_MSG)
|
||||
unset(GLOG_FOUND)
|
||||
unset(GLOG_INCLUDE_DIRS)
|
||||
unset(GLOG_LIBRARIES)
|
||||
# Make results of search visible in the CMake GUI if glog has not
|
||||
# been found so that user does not have to toggle to advanced view.
|
||||
mark_as_advanced(CLEAR GLOG_INCLUDE_DIR
|
||||
GLOG_LIBRARY)
|
||||
|
||||
glog_reset_find_library_prefix()
|
||||
|
||||
# Note <package>_FIND_[REQUIRED/QUIETLY] variables defined by FindPackage()
|
||||
# use the camelcase library name, not uppercase.
|
||||
if(Glog_FIND_QUIETLY)
|
||||
message(STATUS "Failed to find glog - " ${REASON_MSG} ${ARGN})
|
||||
elseif(Glog_FIND_REQUIRED)
|
||||
message(FATAL_ERROR "Failed to find glog - " ${REASON_MSG} ${ARGN})
|
||||
else()
|
||||
# Neither QUIETLY nor REQUIRED, use no priority which emits a message
|
||||
# but continues configuration and allows generation.
|
||||
message("-- Failed to find glog - " ${REASON_MSG} ${ARGN})
|
||||
endif()
|
||||
return()
|
||||
endmacro()
|
||||
|
||||
# Handle possible presence of lib prefix for libraries on MSVC, see
|
||||
# also GLOG_RESET_FIND_LIBRARY_PREFIX().
|
||||
if(MSVC)
|
||||
# Preserve the caller's original values for CMAKE_FIND_LIBRARY_PREFIXES
|
||||
# s/t we can set it back before returning.
|
||||
set(CALLERS_CMAKE_FIND_LIBRARY_PREFIXES "${CMAKE_FIND_LIBRARY_PREFIXES}")
|
||||
# The empty string in this list is important, it represents the case when
|
||||
# the libraries have no prefix (shared libraries / DLLs).
|
||||
set(CMAKE_FIND_LIBRARY_PREFIXES "lib" "" "${CMAKE_FIND_LIBRARY_PREFIXES}")
|
||||
endif()
|
||||
|
||||
# Search user-installed locations first, so that we prefer user installs
|
||||
# to system installs where both exist.
|
||||
list(APPEND GLOG_CHECK_INCLUDE_DIRS
|
||||
${GLOG_ROOT_DIR_INCLUDE}
|
||||
/usr/local/include
|
||||
/usr/local/homebrew/include # Mac OS X
|
||||
/opt/local/var/macports/software # Mac OS X.
|
||||
/opt/local/include
|
||||
/usr/include
|
||||
/sw/include # Fink
|
||||
/opt/csw/include # Blastwave
|
||||
/opt/lib/glog/include)
|
||||
# Windows (for C:/Program Files prefix).
|
||||
list(APPEND GLOG_CHECK_PATH_SUFFIXES
|
||||
glog/include
|
||||
glog/Include
|
||||
Glog/include
|
||||
Glog/Include)
|
||||
|
||||
list(APPEND GLOG_CHECK_LIBRARY_DIRS
|
||||
${GLOG_ROOT_DIR_LIB}
|
||||
/usr/local/lib
|
||||
/usr/local/homebrew/lib # Mac OS X.
|
||||
/opt/local/lib
|
||||
/usr/lib
|
||||
/sw/lib # Fink
|
||||
/opt/csw/lib # Blastwave
|
||||
/opt/lib/gflags/lib)
|
||||
# Windows (for C:/Program Files prefix).
|
||||
list(APPEND GLOG_CHECK_LIBRARY_SUFFIXES
|
||||
glog/lib
|
||||
glog/Lib
|
||||
Glog/lib
|
||||
Glog/Lib)
|
||||
|
||||
# Search supplied hint directories first if supplied.
|
||||
find_path(GLOG_INCLUDE_DIR
|
||||
NAMES glog/logging.h
|
||||
PATHS ${GLOG_INCLUDE_DIR_HINTS}
|
||||
${GLOG_CHECK_INCLUDE_DIRS}
|
||||
PATH_SUFFIXES ${GLOG_CHECK_PATH_SUFFIXES})
|
||||
if(NOT GLOG_INCLUDE_DIR OR
|
||||
NOT EXISTS ${GLOG_INCLUDE_DIR})
|
||||
glog_report_not_found(
|
||||
"Could not find glog include directory, set GLOG_INCLUDE_DIR "
|
||||
"to directory containing glog/logging.h")
|
||||
endif()
|
||||
|
||||
find_library(GLOG_LIBRARY NAMES glog
|
||||
PATHS ${GLOG_LIBRARY_DIR_HINTS}
|
||||
${GLOG_CHECK_LIBRARY_DIRS}
|
||||
PATH_SUFFIXES ${GLOG_CHECK_LIBRARY_SUFFIXES})
|
||||
if(NOT GLOG_LIBRARY OR
|
||||
NOT EXISTS ${GLOG_LIBRARY})
|
||||
glog_report_not_found(
|
||||
"Could not find glog library, set GLOG_LIBRARY "
|
||||
"to full path to libglog.")
|
||||
endif()
|
||||
|
||||
# Mark internally as found, then verify. GLOG_REPORT_NOT_FOUND() unsets
|
||||
# if called.
|
||||
set(GLOG_FOUND TRUE)
|
||||
|
||||
# Glog does not seem to provide any record of the version in its
|
||||
# source tree, thus cannot extract version.
|
||||
|
||||
# Catch case when caller has set GLOG_INCLUDE_DIR in the cache / GUI and
|
||||
# thus FIND_[PATH/LIBRARY] are not called, but specified locations are
|
||||
# invalid, otherwise we would report the library as found.
|
||||
if(GLOG_INCLUDE_DIR AND
|
||||
NOT EXISTS ${GLOG_INCLUDE_DIR}/glog/logging.h)
|
||||
glog_report_not_found(
|
||||
"Caller defined GLOG_INCLUDE_DIR:"
|
||||
" ${GLOG_INCLUDE_DIR} does not contain glog/logging.h header.")
|
||||
endif()
|
||||
# TODO: This regex for glog library is pretty primitive, we use lowercase
|
||||
# for comparison to handle Windows using CamelCase library names, could
|
||||
# this check be better?
|
||||
string(TOLOWER "${GLOG_LIBRARY}" LOWERCASE_GLOG_LIBRARY)
|
||||
if(GLOG_LIBRARY AND
|
||||
NOT "${LOWERCASE_GLOG_LIBRARY}" MATCHES ".*glog[^/]*")
|
||||
glog_report_not_found(
|
||||
"Caller defined GLOG_LIBRARY: "
|
||||
"${GLOG_LIBRARY} does not match glog.")
|
||||
endif()
|
||||
|
||||
# Set standard CMake FindPackage variables if found.
|
||||
if(GLOG_FOUND)
|
||||
set(GLOG_INCLUDE_DIRS ${GLOG_INCLUDE_DIR})
|
||||
set(GLOG_LIBRARIES ${GLOG_LIBRARY})
|
||||
endif()
|
||||
|
||||
glog_reset_find_library_prefix()
|
||||
|
||||
# Handle REQUIRED / QUIET optional arguments.
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(GLOG DEFAULT_MSG
|
||||
GLOG_INCLUDE_DIRS GLOG_LIBRARIES)
|
||||
|
||||
# Only mark internal variables as advanced if we found glog, otherwise
|
||||
# leave them visible in the standard GUI for the user to set manually.
|
||||
if(GLOG_FOUND)
|
||||
mark_as_advanced(FORCE GLOG_INCLUDE_DIR
|
||||
GLOG_LIBRARY)
|
||||
endif()
|
@@ -1,69 +0,0 @@
|
||||
# - Find HDF5 library
|
||||
# Find the native HDF5 includes and libraries
|
||||
# This module defines
|
||||
# HDF5_INCLUDE_DIRS, where to find hdf5.h, Set when HDF5_INCLUDE_DIR is found.
|
||||
# HDF5_LIBRARIES, libraries to link against to use HDF5.
|
||||
# HDF5_ROOT_DIR, The base directory to search for HDF5.
|
||||
# This can also be an environment variable.
|
||||
# HDF5_FOUND, If false, do not try to use HDF5.
|
||||
#
|
||||
|
||||
#=============================================================================
|
||||
# Copyright 2016 Blender Foundation.
|
||||
#
|
||||
# Distributed under the OSI-approved BSD License (the "License");
|
||||
# see accompanying file Copyright.txt for details.
|
||||
#
|
||||
# This software is distributed WITHOUT ANY WARRANTY; without even the
|
||||
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
# See the License for more information.
|
||||
#=============================================================================
|
||||
|
||||
# If HDF5_ROOT_DIR was defined in the environment, use it.
|
||||
IF(NOT HDF5_ROOT_DIR AND NOT $ENV{HDF5_ROOT_DIR} STREQUAL "")
|
||||
SET(HDF5_ROOT_DIR $ENV{HDF5_ROOT_DIR})
|
||||
ENDIF()
|
||||
|
||||
SET(_hdf5_SEARCH_DIRS
|
||||
${HDF5_ROOT_DIR}
|
||||
/usr/local
|
||||
/sw # Fink
|
||||
/opt/local # DarwinPorts
|
||||
/opt/csw # Blastwave
|
||||
/opt/lib/hdf5
|
||||
)
|
||||
|
||||
FIND_LIBRARY(HDF5_LIBRARY
|
||||
NAMES
|
||||
hdf5
|
||||
HINTS
|
||||
${_hdf5_SEARCH_DIRS}
|
||||
PATH_SUFFIXES
|
||||
lib64 lib
|
||||
)
|
||||
|
||||
FIND_PATH(HDF5_INCLUDE_DIR
|
||||
NAMES
|
||||
hdf5.h
|
||||
HINTS
|
||||
${_hdf5_SEARCH_DIRS}
|
||||
PATH_SUFFIXES
|
||||
include
|
||||
)
|
||||
|
||||
# handle the QUIETLY and REQUIRED arguments and set HDF5_FOUND to TRUE if
|
||||
# all listed variables are TRUE
|
||||
INCLUDE(FindPackageHandleStandardArgs)
|
||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(HDF5 DEFAULT_MSG HDF5_LIBRARY HDF5_INCLUDE_DIR)
|
||||
|
||||
IF(HDF5_FOUND)
|
||||
SET(HDF5_LIBRARIES ${HDF5_LIBRARY})
|
||||
SET(HDF5_INCLUDE_DIRS ${HDF5_INCLUDE_DIR})
|
||||
ENDIF(HDF5_FOUND)
|
||||
|
||||
MARK_AS_ADVANCED(
|
||||
HDF5_INCLUDE_DIR
|
||||
HDF5_LIBRARY
|
||||
)
|
||||
|
||||
UNSET(_hdf5_SEARCH_DIRS)
|
@@ -1,15 +1,15 @@
|
||||
# - Find JACK library
|
||||
# Find the native JACK includes and library
|
||||
# - Find Jack library
|
||||
# Find the native Jack includes and library
|
||||
# This module defines
|
||||
# JACK_INCLUDE_DIRS, where to find jack.h, Set when
|
||||
# JACK_INCLUDE_DIR is found.
|
||||
# JACK_LIBRARIES, libraries to link against to use JACK.
|
||||
# JACK_ROOT_DIR, The base directory to search for JACK.
|
||||
# JACK_LIBRARIES, libraries to link against to use Jack.
|
||||
# JACK_ROOT_DIR, The base directory to search for Jack.
|
||||
# This can also be an environment variable.
|
||||
# JACK_FOUND, If false, do not try to use JACK.
|
||||
# JACK_FOUND, If false, do not try to use Jack.
|
||||
#
|
||||
# also defined, but not for general use are
|
||||
# JACK_LIBRARY, where to find the JACK library.
|
||||
# JACK_LIBRARY, where to find the Jack library.
|
||||
|
||||
#=============================================================================
|
||||
# Copyright 2011 Blender Foundation.
|
||||
|
@@ -83,7 +83,6 @@ FOREACH(COMPONENT ${_opencollada_FIND_INCLUDES})
|
||||
# but this is less trouble, just looks strange.
|
||||
include/opencollada/${COMPONENT}
|
||||
include/${COMPONENT}/include
|
||||
include/${COMPONENT}
|
||||
HINTS
|
||||
${_opencollada_SEARCH_DIRS}
|
||||
)
|
||||
|
@@ -60,7 +60,7 @@ FIND_FILE(OPENIMAGEIO_IDIFF
|
||||
NAMES
|
||||
idiff
|
||||
HINTS
|
||||
${_openimageio_SEARCH_DIRS}
|
||||
${OPENIMAGEIO_ROOT_DIR}
|
||||
PATH_SUFFIXES
|
||||
bin
|
||||
)
|
||||
@@ -76,8 +76,6 @@ IF(OPENIMAGEIO_FOUND)
|
||||
SET(OPENIMAGEIO_INCLUDE_DIRS ${OPENIMAGEIO_INCLUDE_DIR})
|
||||
IF(EXISTS ${OPENIMAGEIO_INCLUDE_DIR}/OpenImageIO/pugixml.hpp)
|
||||
SET(OPENIMAGEIO_PUGIXML_FOUND TRUE)
|
||||
ELSE()
|
||||
SET(OPENIMAGEIO_PUGIXML_FOUND FALSE)
|
||||
ENDIF()
|
||||
ELSE()
|
||||
SET(OPENIMAGEIO_PUGIXML_FOUND FALSE)
|
||||
|
@@ -20,10 +20,9 @@ macro(BLENDER_SRC_GTEST_EX NAME SRC EXTRA_LIBS DO_ADD_TEST)
|
||||
set(TEST_INC
|
||||
${_current_include_directories}
|
||||
${CMAKE_SOURCE_DIR}/tests/gtests
|
||||
${GLOG_INCLUDE_DIRS}
|
||||
${GFLAGS_INCLUDE_DIRS}
|
||||
${CMAKE_SOURCE_DIR}/extern/glog/src
|
||||
${CMAKE_SOURCE_DIR}/extern/gflags/src
|
||||
${CMAKE_SOURCE_DIR}/extern/gtest/include
|
||||
${CMAKE_SOURCE_DIR}/extern/gmock/include
|
||||
)
|
||||
unset(_current_include_directories)
|
||||
|
||||
@@ -34,21 +33,17 @@ macro(BLENDER_SRC_GTEST_EX NAME SRC EXTRA_LIBS DO_ADD_TEST)
|
||||
bf_testing_main
|
||||
bf_intern_guardedalloc
|
||||
extern_gtest
|
||||
extern_gmock
|
||||
# needed for glog
|
||||
${PTHREADS_LIBRARIES}
|
||||
${GLOG_LIBRARIES}
|
||||
${GFLAGS_LIBRARIES})
|
||||
if(WITH_OPENMP_STATIC)
|
||||
target_link_libraries(${NAME}_test ${OpenMP_LIBRARIES})
|
||||
endif()
|
||||
extern_glog
|
||||
extern_gflags)
|
||||
set_target_properties(${NAME}_test PROPERTIES
|
||||
RUNTIME_OUTPUT_DIRECTORY "${TESTS_OUTPUT_DIR}"
|
||||
RUNTIME_OUTPUT_DIRECTORY_RELEASE "${TESTS_OUTPUT_DIR}"
|
||||
RUNTIME_OUTPUT_DIRECTORY_DEBUG "${TESTS_OUTPUT_DIR}"
|
||||
INCLUDE_DIRECTORIES "${TEST_INC}")
|
||||
if(${DO_ADD_TEST})
|
||||
add_test(NAME ${NAME}_test COMMAND ${TESTS_OUTPUT_DIR}/${NAME}_test WORKING_DIRECTORY $<TARGET_FILE_DIR:blender>)
|
||||
add_test(${NAME}_test ${TESTS_OUTPUT_DIR}/${NAME}_test)
|
||||
endif()
|
||||
endif()
|
||||
endmacro()
|
||||
|
@@ -1,10 +1,5 @@
|
||||
# This is called by cmake as an external process from
|
||||
# This is called by cmake as an extermal process from
|
||||
# ./source/creator/CMakeLists.txt to write ./source/creator/buildinfo.h
|
||||
# Caller must define:
|
||||
# SOURCE_DIR
|
||||
# Optional overrides:
|
||||
# BUILD_DATE
|
||||
# BUILD_TIME
|
||||
|
||||
# Extract working copy information for SOURCE_DIR into MY_XXX variables
|
||||
# with a default in case anything fails, for example when using git-svn
|
||||
@@ -27,12 +22,13 @@ if(EXISTS ${SOURCE_DIR}/.git)
|
||||
OUTPUT_VARIABLE MY_WC_HASH
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
|
||||
execute_process(COMMAND git branch --list master blender-v* --contains ${MY_WC_HASH}
|
||||
execute_process(COMMAND git branch --list master --contains ${MY_WC_HASH}
|
||||
WORKING_DIRECTORY ${SOURCE_DIR}
|
||||
OUTPUT_VARIABLE _git_contains_check
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
|
||||
if(NOT _git_contains_check STREQUAL "")
|
||||
STRING(REGEX REPLACE "^[ \t]+" "" _git_contains_check "${_git_contains_check}")
|
||||
if(_git_contains_check STREQUAL "master")
|
||||
set(MY_WC_BRANCH "master")
|
||||
else()
|
||||
execute_process(COMMAND git show-ref --tags -d
|
||||
@@ -47,22 +43,6 @@ if(EXISTS ${SOURCE_DIR}/.git)
|
||||
|
||||
if(_git_tag_hashes MATCHES "${_git_head_hash}")
|
||||
set(MY_WC_BRANCH "master")
|
||||
else()
|
||||
execute_process(COMMAND git branch --contains ${MY_WC_HASH}
|
||||
WORKING_DIRECTORY ${SOURCE_DIR}
|
||||
OUTPUT_VARIABLE _git_contains_branches
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
string(REGEX REPLACE "^\\*[ \t]+" "" _git_contains_branches "${_git_contains_branches}")
|
||||
string(REGEX REPLACE "[\r\n]+" ";" _git_contains_branches "${_git_contains_branches}")
|
||||
string(REGEX REPLACE ";[ \t]+" ";" _git_contains_branches "${_git_contains_branches}")
|
||||
foreach(_branch ${_git_contains_branches})
|
||||
if(NOT "${_branch}" MATCHES "\\(HEAD.*")
|
||||
set(MY_WC_BRANCH "${_branch}")
|
||||
break()
|
||||
endif()
|
||||
endforeach()
|
||||
unset(_branch)
|
||||
unset(_git_contains_branches)
|
||||
endif()
|
||||
|
||||
unset(_git_tag_hashes)
|
||||
@@ -148,19 +128,12 @@ endif()
|
||||
# BUILD_PLATFORM and BUILD_PLATFORM are taken from CMake
|
||||
# but BUILD_DATE and BUILD_TIME are platform dependent
|
||||
if(UNIX)
|
||||
if(NOT BUILD_DATE)
|
||||
execute_process(COMMAND date "+%Y-%m-%d" OUTPUT_VARIABLE BUILD_DATE OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
endif()
|
||||
if(NOT BUILD_TIME)
|
||||
execute_process(COMMAND date "+%H:%M:%S" OUTPUT_VARIABLE BUILD_TIME OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
endif()
|
||||
elseif(WIN32)
|
||||
if(NOT BUILD_DATE)
|
||||
execute_process(COMMAND cmd /c date /t OUTPUT_VARIABLE BUILD_DATE OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
endif()
|
||||
if(NOT BUILD_TIME)
|
||||
execute_process(COMMAND cmd /c time /t OUTPUT_VARIABLE BUILD_TIME OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
endif()
|
||||
execute_process(COMMAND date "+%Y-%m-%d" OUTPUT_VARIABLE BUILD_DATE OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
execute_process(COMMAND date "+%H:%M:%S" OUTPUT_VARIABLE BUILD_TIME OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
endif()
|
||||
if(WIN32)
|
||||
execute_process(COMMAND cmd /c date /t OUTPUT_VARIABLE BUILD_DATE OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
execute_process(COMMAND cmd /c time /t OUTPUT_VARIABLE BUILD_TIME OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
endif()
|
||||
|
||||
# Write a file with the BUILD_HASH define
|
||||
|
@@ -239,8 +239,8 @@ def file_check_arg_sizes(tu):
|
||||
if 0:
|
||||
print("---",
|
||||
" <~> ".join(
|
||||
[" ".join([t.spelling for t in C.get_tokens()])
|
||||
for C in node.get_children()]
|
||||
[" ".join([t.spelling for t in C.get_tokens()])
|
||||
for C in node.get_children()]
|
||||
))
|
||||
# print(node.location)
|
||||
|
||||
|
@@ -29,11 +29,11 @@ if not sys.version.startswith("3"):
|
||||
sys.exit(1)
|
||||
|
||||
from cmake_consistency_check_config import (
|
||||
IGNORE,
|
||||
UTF8_CHECK,
|
||||
SOURCE_DIR,
|
||||
BUILD_DIR,
|
||||
)
|
||||
IGNORE,
|
||||
UTF8_CHECK,
|
||||
SOURCE_DIR,
|
||||
BUILD_DIR,
|
||||
)
|
||||
|
||||
|
||||
import os
|
||||
@@ -61,8 +61,10 @@ def replace_line(f, i, text, keep_indent=True):
|
||||
|
||||
def source_list(path, filename_check=None):
|
||||
for dirpath, dirnames, filenames in os.walk(path):
|
||||
|
||||
# skip '.git'
|
||||
dirnames[:] = [d for d in dirnames if not d.startswith(".")]
|
||||
if dirpath.startswith("."):
|
||||
continue
|
||||
|
||||
for filename in filenames:
|
||||
if filename_check is None or filename_check(filename):
|
||||
|
@@ -31,7 +31,7 @@ IGNORE = (
|
||||
"extern/carve/patches/files/random.h",
|
||||
"intern/audaspace/SRC/AUD_SRCResampleFactory.h",
|
||||
"intern/audaspace/SRC/AUD_SRCResampleReader.h",
|
||||
)
|
||||
)
|
||||
|
||||
UTF8_CHECK = True
|
||||
|
||||
|
@@ -37,19 +37,19 @@ if not project_info.init(sys.argv[-1]):
|
||||
sys.exit(1)
|
||||
|
||||
from project_info import (
|
||||
SIMPLE_PROJECTFILE,
|
||||
SOURCE_DIR,
|
||||
CMAKE_DIR,
|
||||
PROJECT_DIR,
|
||||
source_list,
|
||||
is_project_file,
|
||||
is_c_header,
|
||||
# is_py,
|
||||
cmake_advanced_info,
|
||||
cmake_compiler_defines,
|
||||
cmake_cache_var,
|
||||
project_name_get,
|
||||
)
|
||||
SIMPLE_PROJECTFILE,
|
||||
SOURCE_DIR,
|
||||
CMAKE_DIR,
|
||||
PROJECT_DIR,
|
||||
source_list,
|
||||
is_project_file,
|
||||
is_c_header,
|
||||
# is_py,
|
||||
cmake_advanced_info,
|
||||
cmake_compiler_defines,
|
||||
cmake_cache_var,
|
||||
project_name_get,
|
||||
)
|
||||
|
||||
|
||||
import os
|
||||
@@ -84,7 +84,7 @@ def create_nb_project_main():
|
||||
make_exe = cmake_cache_var("CMAKE_MAKE_PROGRAM")
|
||||
make_exe_basename = os.path.basename(make_exe)
|
||||
|
||||
# --------------- NB specific
|
||||
# --------------- NB spesific
|
||||
defines = [("%s=%s" % cdef) if cdef[1] else cdef[0] for cdef in defines]
|
||||
defines += [cdef.replace("#define", "").strip() for cdef in cmake_compiler_defines()]
|
||||
|
||||
|
@@ -43,17 +43,17 @@ def quote_define(define):
|
||||
|
||||
def create_qtc_project_main(name):
|
||||
from project_info import (
|
||||
SIMPLE_PROJECTFILE,
|
||||
SOURCE_DIR,
|
||||
# CMAKE_DIR,
|
||||
PROJECT_DIR,
|
||||
source_list,
|
||||
is_project_file,
|
||||
is_c_header,
|
||||
cmake_advanced_info,
|
||||
cmake_compiler_defines,
|
||||
project_name_get,
|
||||
)
|
||||
SIMPLE_PROJECTFILE,
|
||||
SOURCE_DIR,
|
||||
# CMAKE_DIR,
|
||||
PROJECT_DIR,
|
||||
source_list,
|
||||
is_project_file,
|
||||
is_c_header,
|
||||
cmake_advanced_info,
|
||||
cmake_compiler_defines,
|
||||
project_name_get,
|
||||
)
|
||||
|
||||
files = list(source_list(SOURCE_DIR, filename_check=is_project_file))
|
||||
files_rel = [os.path.relpath(f, start=PROJECT_DIR) for f in files]
|
||||
@@ -69,7 +69,7 @@ def create_qtc_project_main(name):
|
||||
|
||||
with open(os.path.join(PROJECT_DIR, "%s.includes" % FILE_NAME), 'w') as f:
|
||||
f.write("\n".join(sorted(list(set(os.path.dirname(f)
|
||||
for f in files_rel if is_c_header(f))))))
|
||||
for f in files_rel if is_c_header(f))))))
|
||||
|
||||
qtc_prj = os.path.join(PROJECT_DIR, "%s.creator" % FILE_NAME)
|
||||
with open(qtc_prj, 'w') as f:
|
||||
@@ -87,7 +87,7 @@ def create_qtc_project_main(name):
|
||||
|
||||
# for some reason it doesnt give all internal includes
|
||||
includes = list(set(includes) | set(os.path.dirname(f)
|
||||
for f in files_rel if is_c_header(f)))
|
||||
for f in files_rel if is_c_header(f)))
|
||||
includes.sort()
|
||||
|
||||
# be tricky, get the project name from CMake if we can!
|
||||
@@ -125,13 +125,13 @@ def create_qtc_project_main(name):
|
||||
|
||||
def create_qtc_project_python(name):
|
||||
from project_info import (
|
||||
SOURCE_DIR,
|
||||
# CMAKE_DIR,
|
||||
PROJECT_DIR,
|
||||
source_list,
|
||||
is_py,
|
||||
project_name_get,
|
||||
)
|
||||
SOURCE_DIR,
|
||||
# CMAKE_DIR,
|
||||
PROJECT_DIR,
|
||||
source_list,
|
||||
is_py,
|
||||
project_name_get,
|
||||
)
|
||||
|
||||
files = list(source_list(SOURCE_DIR, filename_check=is_py))
|
||||
files_rel = [os.path.relpath(f, start=PROJECT_DIR) for f in files]
|
||||
@@ -161,24 +161,24 @@ def argparse_create():
|
||||
import argparse
|
||||
|
||||
parser = argparse.ArgumentParser(
|
||||
description="This script generates Qt Creator project files for Blender",
|
||||
)
|
||||
description="This script generates Qt Creator project files for Blender",
|
||||
)
|
||||
|
||||
parser.add_argument(
|
||||
"-n", "--name",
|
||||
dest="name",
|
||||
metavar='NAME', type=str,
|
||||
help="Override default project name (\"Blender\")",
|
||||
required=False,
|
||||
)
|
||||
"-n", "--name",
|
||||
dest="name",
|
||||
metavar='NAME', type=str,
|
||||
help="Override default project name (\"Blender\")",
|
||||
required=False,
|
||||
)
|
||||
|
||||
parser.add_argument(
|
||||
"-b", "--build-dir",
|
||||
dest="build_dir",
|
||||
metavar='BUILD_DIR', type=str,
|
||||
help="Specify the build path (or fallback to the $PWD)",
|
||||
required=False,
|
||||
)
|
||||
"-b", "--build-dir",
|
||||
dest="build_dir",
|
||||
metavar='BUILD_DIR', type=str,
|
||||
help="Specify the build path (or fallback to the $PWD)",
|
||||
required=False,
|
||||
)
|
||||
|
||||
return parser
|
||||
|
||||
|
@@ -32,7 +32,7 @@ USE_QUIET = (os.environ.get("QUIET", None) is not None)
|
||||
CHECKER_IGNORE_PREFIX = [
|
||||
"extern",
|
||||
"intern/moto",
|
||||
]
|
||||
]
|
||||
|
||||
CHECKER_BIN = "python2"
|
||||
|
||||
@@ -42,7 +42,7 @@ CHECKER_ARGS = [
|
||||
"-I" + os.path.join(project_source_info.SOURCE_DIR, "extern", "glew", "include"),
|
||||
# stupid but needed
|
||||
"-Dbool=char"
|
||||
]
|
||||
]
|
||||
|
||||
|
||||
def main():
|
||||
|
@@ -32,7 +32,7 @@ USE_QUIET = (os.environ.get("QUIET", None) is not None)
|
||||
CHECKER_IGNORE_PREFIX = [
|
||||
"extern",
|
||||
"intern/moto",
|
||||
]
|
||||
]
|
||||
|
||||
CHECKER_BIN = "cppcheck"
|
||||
|
||||
@@ -43,7 +43,7 @@ CHECKER_ARGS = [
|
||||
"--max-configs=1", # speeds up execution
|
||||
# "--check-config", # when includes are missing
|
||||
"--enable=all", # if you want sixty hundred pedantic suggestions
|
||||
]
|
||||
]
|
||||
|
||||
if USE_QUIET:
|
||||
CHECKER_ARGS.append("--quiet")
|
||||
|
@@ -25,13 +25,13 @@
|
||||
CHECKER_IGNORE_PREFIX = [
|
||||
"extern",
|
||||
"intern/moto",
|
||||
]
|
||||
]
|
||||
|
||||
CHECKER_BIN = "smatch"
|
||||
CHECKER_ARGS = [
|
||||
"--full-path",
|
||||
"--two-passes",
|
||||
]
|
||||
]
|
||||
|
||||
import project_source_info
|
||||
import subprocess
|
||||
|
@@ -25,11 +25,11 @@
|
||||
CHECKER_IGNORE_PREFIX = [
|
||||
"extern",
|
||||
"intern/moto",
|
||||
]
|
||||
]
|
||||
|
||||
CHECKER_BIN = "sparse"
|
||||
CHECKER_ARGS = [
|
||||
]
|
||||
]
|
||||
|
||||
import project_source_info
|
||||
import subprocess
|
||||
|
@@ -25,7 +25,7 @@
|
||||
CHECKER_IGNORE_PREFIX = [
|
||||
"extern",
|
||||
"intern/moto",
|
||||
]
|
||||
]
|
||||
|
||||
CHECKER_BIN = "splint"
|
||||
|
||||
@@ -61,7 +61,7 @@ CHECKER_ARGS = [
|
||||
# dummy, witjout this splint complains with:
|
||||
# /usr/include/bits/confname.h:31:27: *** Internal Bug at cscannerHelp.c:2428: Unexpanded macro not function or constant: int _PC_MAX_CANON
|
||||
"-D_PC_MAX_CANON=0",
|
||||
]
|
||||
]
|
||||
|
||||
|
||||
import project_source_info
|
||||
|
@@ -4,7 +4,6 @@
|
||||
# cmake -C../blender/build_files/cmake/config/blender_full.cmake ../blender
|
||||
#
|
||||
|
||||
set(WITH_ALEMBIC ON CACHE BOOL "" FORCE)
|
||||
set(WITH_BUILDINFO ON CACHE BOOL "" FORCE)
|
||||
set(WITH_BULLET ON CACHE BOOL "" FORCE)
|
||||
set(WITH_CODEC_AVI ON CACHE BOOL "" FORCE)
|
||||
@@ -12,7 +11,6 @@ set(WITH_CODEC_FFMPEG ON CACHE BOOL "" FORCE)
|
||||
set(WITH_CODEC_SNDFILE ON CACHE BOOL "" FORCE)
|
||||
set(WITH_CYCLES ON CACHE BOOL "" FORCE)
|
||||
set(WITH_CYCLES_OSL ON CACHE BOOL "" FORCE)
|
||||
set(WITH_CYCLES_OPENSUBDIV ON CACHE BOOL "" FORCE)
|
||||
set(WITH_FFTW3 ON CACHE BOOL "" FORCE)
|
||||
set(WITH_LIBMV ON CACHE BOOL "" FORCE)
|
||||
set(WITH_LIBMV_SCHUR_SPECIALIZATIONS ON CACHE BOOL "" FORCE)
|
||||
@@ -56,19 +54,23 @@ set(WITH_PLAYER ON CACHE BOOL "" FORCE)
|
||||
set(WITH_MEM_JEMALLOC ON CACHE BOOL "" FORCE)
|
||||
|
||||
|
||||
# platform dependent options
|
||||
# platform dependant options
|
||||
if(UNIX AND NOT APPLE)
|
||||
set(WITH_JACK ON CACHE BOOL "" FORCE)
|
||||
set(WITH_DOC_MANPAGE ON CACHE BOOL "" FORCE)
|
||||
set(WITH_OPENSUBDIV ON CACHE BOOL "" FORCE)
|
||||
elseif(WIN32)
|
||||
set(WITH_JACK OFF CACHE BOOL "" FORCE)
|
||||
set(WITH_OPENSUBDIV ON CACHE BOOL "" FORCE)
|
||||
if(NOT CMAKE_COMPILER_IS_GNUCC)
|
||||
set(WITH_OPENSUBDIV ON CACHE BOOL "" FORCE)
|
||||
else()
|
||||
# MinGW exceptions
|
||||
set(WITH_OPENSUBDIV OFF CACHE BOOL "" FORCE)
|
||||
set(WITH_CODEC_SNDFILE OFF CACHE BOOL "" FORCE)
|
||||
set(WITH_CYCLES_OSL OFF CACHE BOOL "" FORCE)
|
||||
endif()
|
||||
elseif(APPLE)
|
||||
set(WITH_JACK ON CACHE BOOL "" FORCE)
|
||||
set(WITH_CODEC_QUICKTIME OFF CACHE BOOL "" FORCE)
|
||||
set(WITH_CODEC_QUICKTIME ON CACHE BOOL "" FORCE)
|
||||
set(WITH_OPENSUBDIV OFF CACHE BOOL "" FORCE)
|
||||
|
||||
# include("${CMAKE_CURRENT_SOURCE_DIR}/../platform/platform_apple_xcode.cmake")
|
||||
# apple_check_quicktime()
|
||||
endif()
|
||||
|
@@ -8,7 +8,6 @@
|
||||
set(WITH_INSTALL_PORTABLE ON CACHE BOOL "" FORCE)
|
||||
set(WITH_SYSTEM_GLEW ON CACHE BOOL "" FORCE)
|
||||
|
||||
set(WITH_ALEMBIC OFF CACHE BOOL "" FORCE)
|
||||
set(WITH_BUILDINFO OFF CACHE BOOL "" FORCE)
|
||||
set(WITH_BULLET OFF CACHE BOOL "" FORCE)
|
||||
set(WITH_CODEC_AVI OFF CACHE BOOL "" FORCE)
|
||||
@@ -16,7 +15,6 @@ set(WITH_CODEC_FFMPEG OFF CACHE BOOL "" FORCE)
|
||||
set(WITH_CODEC_SNDFILE OFF CACHE BOOL "" FORCE)
|
||||
set(WITH_CYCLES OFF CACHE BOOL "" FORCE)
|
||||
set(WITH_CYCLES_OSL OFF CACHE BOOL "" FORCE)
|
||||
set(WITH_CYCLES_OPENSUBDIV OFF CACHE BOOL "" FORCE)
|
||||
set(WITH_FFTW3 OFF CACHE BOOL "" FORCE)
|
||||
set(WITH_LIBMV OFF CACHE BOOL "" FORCE)
|
||||
set(WITH_LLVM OFF CACHE BOOL "" FORCE)
|
||||
@@ -49,7 +47,6 @@ set(WITH_OPENCOLLADA OFF CACHE BOOL "" FORCE)
|
||||
set(WITH_OPENCOLORIO OFF CACHE BOOL "" FORCE)
|
||||
set(WITH_OPENIMAGEIO OFF CACHE BOOL "" FORCE)
|
||||
set(WITH_OPENMP OFF CACHE BOOL "" FORCE)
|
||||
set(WITH_OPENSUBDIV OFF CACHE BOOL "" FORCE)
|
||||
set(WITH_OPENVDB OFF CACHE BOOL "" FORCE)
|
||||
set(WITH_RAYOPTIMIZATION OFF CACHE BOOL "" FORCE)
|
||||
set(WITH_SDL OFF CACHE BOOL "" FORCE)
|
||||
|
@@ -1,75 +0,0 @@
|
||||
# Turn everything ON thats expected for an official release builds.
|
||||
#
|
||||
# Example usage:
|
||||
# cmake -C../blender/build_files/cmake/config/blender_release.cmake ../blender
|
||||
#
|
||||
|
||||
set(WITH_ALEMBIC ON CACHE BOOL "" FORCE)
|
||||
set(WITH_BUILDINFO ON CACHE BOOL "" FORCE)
|
||||
set(WITH_BULLET ON CACHE BOOL "" FORCE)
|
||||
set(WITH_CODEC_AVI ON CACHE BOOL "" FORCE)
|
||||
set(WITH_CODEC_FFMPEG ON CACHE BOOL "" FORCE)
|
||||
set(WITH_CODEC_SNDFILE ON CACHE BOOL "" FORCE)
|
||||
set(WITH_CYCLES ON CACHE BOOL "" FORCE)
|
||||
set(WITH_CYCLES_OSL ON CACHE BOOL "" FORCE)
|
||||
set(WITH_CYCLES_OPENSUBDIV ON CACHE BOOL "" FORCE)
|
||||
set(WITH_FFTW3 ON CACHE BOOL "" FORCE)
|
||||
set(WITH_LIBMV ON CACHE BOOL "" FORCE)
|
||||
set(WITH_LIBMV_SCHUR_SPECIALIZATIONS ON CACHE BOOL "" FORCE)
|
||||
set(WITH_GAMEENGINE ON CACHE BOOL "" FORCE)
|
||||
set(WITH_COMPOSITOR ON CACHE BOOL "" FORCE)
|
||||
set(WITH_FREESTYLE ON CACHE BOOL "" FORCE)
|
||||
set(WITH_GHOST_XDND ON CACHE BOOL "" FORCE)
|
||||
set(WITH_IK_SOLVER ON CACHE BOOL "" FORCE)
|
||||
set(WITH_IK_ITASC ON CACHE BOOL "" FORCE)
|
||||
set(WITH_IMAGE_CINEON ON CACHE BOOL "" FORCE)
|
||||
set(WITH_IMAGE_DDS ON CACHE BOOL "" FORCE)
|
||||
set(WITH_IMAGE_FRAMESERVER ON CACHE BOOL "" FORCE)
|
||||
set(WITH_IMAGE_HDR ON CACHE BOOL "" FORCE)
|
||||
set(WITH_IMAGE_OPENEXR ON CACHE BOOL "" FORCE)
|
||||
set(WITH_IMAGE_OPENJPEG ON CACHE BOOL "" FORCE)
|
||||
set(WITH_IMAGE_TIFF ON CACHE BOOL "" FORCE)
|
||||
set(WITH_INPUT_NDOF ON CACHE BOOL "" FORCE)
|
||||
set(WITH_INTERNATIONAL ON CACHE BOOL "" FORCE)
|
||||
set(WITH_JACK ON CACHE BOOL "" FORCE)
|
||||
set(WITH_LZMA ON CACHE BOOL "" FORCE)
|
||||
set(WITH_LZO ON CACHE BOOL "" FORCE)
|
||||
set(WITH_MOD_BOOLEAN ON CACHE BOOL "" FORCE)
|
||||
set(WITH_MOD_FLUID ON CACHE BOOL "" FORCE)
|
||||
set(WITH_MOD_REMESH ON CACHE BOOL "" FORCE)
|
||||
set(WITH_MOD_SMOKE ON CACHE BOOL "" FORCE)
|
||||
set(WITH_MOD_OCEANSIM ON CACHE BOOL "" FORCE)
|
||||
set(WITH_AUDASPACE ON CACHE BOOL "" FORCE)
|
||||
set(WITH_OPENAL ON CACHE BOOL "" FORCE)
|
||||
set(WITH_OPENCOLLADA ON CACHE BOOL "" FORCE)
|
||||
set(WITH_OPENCOLORIO ON CACHE BOOL "" FORCE)
|
||||
set(WITH_OPENMP ON CACHE BOOL "" FORCE)
|
||||
set(WITH_OPENVDB ON CACHE BOOL "" FORCE)
|
||||
set(WITH_OPENVDB_BLOSC ON CACHE BOOL "" FORCE)
|
||||
set(WITH_PYTHON_INSTALL ON CACHE BOOL "" FORCE)
|
||||
set(WITH_RAYOPTIMIZATION ON CACHE BOOL "" FORCE)
|
||||
set(WITH_SDL ON CACHE BOOL "" FORCE)
|
||||
set(WITH_X11_XINPUT ON CACHE BOOL "" FORCE)
|
||||
set(WITH_X11_XF86VMODE ON CACHE BOOL "" FORCE)
|
||||
|
||||
set(WITH_PLAYER ON CACHE BOOL "" FORCE)
|
||||
set(WITH_MEM_JEMALLOC ON CACHE BOOL "" FORCE)
|
||||
set(WITH_CYCLES_CUDA_BINARIES ON CACHE BOOL "" FORCE)
|
||||
set(CYCLES_CUDA_BINARIES_ARCH sm_20;sm_21;sm_30;sm_35;sm_37;sm_50;sm_52;sm_60;sm_61 CACHE STRING "" FORCE)
|
||||
|
||||
# platform dependent options
|
||||
if(UNIX AND NOT APPLE)
|
||||
set(WITH_JACK ON CACHE BOOL "" FORCE)
|
||||
set(WITH_DOC_MANPAGE ON CACHE BOOL "" FORCE)
|
||||
set(WITH_OPENSUBDIV ON CACHE BOOL "" FORCE)
|
||||
elseif(WIN32)
|
||||
set(WITH_JACK OFF CACHE BOOL "" FORCE)
|
||||
set(WITH_OPENSUBDIV ON CACHE BOOL "" FORCE)
|
||||
elseif(APPLE)
|
||||
set(WITH_JACK ON CACHE BOOL "" FORCE)
|
||||
set(WITH_CODEC_QUICKTIME OFF CACHE BOOL "" FORCE)
|
||||
set(WITH_OPENSUBDIV OFF CACHE BOOL "" FORCE)
|
||||
|
||||
# include("${CMAKE_CURRENT_SOURCE_DIR}/../platform/platform_apple_xcode.cmake")
|
||||
# apple_check_quicktime()
|
||||
endif()
|
@@ -32,4 +32,3 @@ set(WITH_OPENCOLLADA OFF CACHE BOOL "" FORCE)
|
||||
set(WITH_INTERNATIONAL OFF CACHE BOOL "" FORCE)
|
||||
set(WITH_BULLET OFF CACHE BOOL "" FORCE)
|
||||
set(WITH_OPENVDB OFF CACHE BOOL "" FORCE)
|
||||
set(WITH_ALEMBIC OFF CACHE BOOL "" FORCE)
|
||||
|
@@ -74,7 +74,7 @@ def main():
|
||||
"rebuild_cache",
|
||||
"depend",
|
||||
"cmake_check_build_system",
|
||||
])
|
||||
])
|
||||
|
||||
targets -= set(bad)
|
||||
|
||||
|
@@ -196,33 +196,8 @@ function(blender_source_group
|
||||
endfunction()
|
||||
|
||||
|
||||
# Support per-target CMake flags
|
||||
# Read from: CMAKE_C_FLAGS_**** (made upper case) when set.
|
||||
#
|
||||
# 'name' should alway match the target name,
|
||||
# use this macro before add_library or add_executable.
|
||||
#
|
||||
# Optionally takes an arg passed to set(), eg PARENT_SCOPE.
|
||||
macro(add_cc_flags_custom_test
|
||||
name
|
||||
)
|
||||
|
||||
string(TOUPPER ${name} _name_upper)
|
||||
if(DEFINED CMAKE_C_FLAGS_${_name_upper})
|
||||
message(STATUS "Using custom CFLAGS: CMAKE_C_FLAGS_${_name_upper} in \"${CMAKE_CURRENT_SOURCE_DIR}\"")
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${CMAKE_C_FLAGS_${_name_upper}}" ${ARGV1})
|
||||
endif()
|
||||
if(DEFINED CMAKE_CXX_FLAGS_${_name_upper})
|
||||
message(STATUS "Using custom CXXFLAGS: CMAKE_CXX_FLAGS_${_name_upper} in \"${CMAKE_CURRENT_SOURCE_DIR}\"")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_${_name_upper}}" ${ARGV1})
|
||||
endif()
|
||||
unset(_name_upper)
|
||||
|
||||
endmacro()
|
||||
|
||||
|
||||
# only MSVC uses SOURCE_GROUP
|
||||
function(blender_add_lib__impl
|
||||
function(blender_add_lib_nolist
|
||||
name
|
||||
sources
|
||||
includes
|
||||
@@ -250,18 +225,6 @@ function(blender_add_lib__impl
|
||||
endfunction()
|
||||
|
||||
|
||||
function(blender_add_lib_nolist
|
||||
name
|
||||
sources
|
||||
includes
|
||||
includes_sys
|
||||
)
|
||||
|
||||
add_cc_flags_custom_test(${name} PARENT_SCOPE)
|
||||
|
||||
blender_add_lib__impl(${name} "${sources}" "${includes}" "${includes_sys}")
|
||||
endfunction()
|
||||
|
||||
function(blender_add_lib
|
||||
name
|
||||
sources
|
||||
@@ -269,9 +232,7 @@ function(blender_add_lib
|
||||
includes_sys
|
||||
)
|
||||
|
||||
add_cc_flags_custom_test(${name} PARENT_SCOPE)
|
||||
|
||||
blender_add_lib__impl(${name} "${sources}" "${includes}" "${includes_sys}")
|
||||
blender_add_lib_nolist(${name} "${sources}" "${includes}" "${includes_sys}")
|
||||
|
||||
set_property(GLOBAL APPEND PROPERTY BLENDER_LINK_LIBS ${name})
|
||||
endfunction()
|
||||
@@ -333,11 +294,6 @@ function(SETUP_LIBDIRS)
|
||||
link_directories(${LLVM_LIBPATH})
|
||||
endif()
|
||||
|
||||
if(WITH_ALEMBIC)
|
||||
link_directories(${ALEMBIC_LIBPATH})
|
||||
link_directories(${HDF5_LIBPATH})
|
||||
endif()
|
||||
|
||||
if(WIN32 AND NOT UNIX)
|
||||
link_directories(${PTHREADS_LIBPATH})
|
||||
endif()
|
||||
@@ -359,6 +315,7 @@ function(setup_liblinks
|
||||
target_link_libraries(
|
||||
${target}
|
||||
${PNG_LIBRARIES}
|
||||
${ZLIB_LIBRARIES}
|
||||
${FREETYPE_LIBRARY}
|
||||
)
|
||||
|
||||
@@ -415,8 +372,15 @@ function(setup_liblinks
|
||||
if(WITH_OPENCOLORIO)
|
||||
target_link_libraries(${target} ${OPENCOLORIO_LIBRARIES})
|
||||
endif()
|
||||
if(WITH_OPENSUBDIV OR WITH_CYCLES_OPENSUBDIV)
|
||||
if(WITH_OPENSUBDIV)
|
||||
if(WIN32 AND NOT UNIX)
|
||||
file_list_suffix(OPENSUBDIV_LIBRARIES_DEBUG "${OPENSUBDIV_LIBRARIES}" "_d")
|
||||
target_link_libraries_debug(${target} "${OPENSUBDIV_LIBRARIES_DEBUG}")
|
||||
target_link_libraries_optimized(${target} "${OPENSUBDIV_LIBRARIES}")
|
||||
unset(OPENSUBDIV_LIBRARIES_DEBUG)
|
||||
else()
|
||||
target_link_libraries(${target} ${OPENSUBDIV_LIBRARIES})
|
||||
endif()
|
||||
endif()
|
||||
if(WITH_OPENVDB)
|
||||
target_link_libraries(${target} ${OPENVDB_LIBRARIES} ${TBB_LIBRARIES})
|
||||
@@ -431,9 +395,6 @@ function(setup_liblinks
|
||||
endif()
|
||||
endif()
|
||||
target_link_libraries(${target} ${JPEG_LIBRARIES})
|
||||
if(WITH_ALEMBIC)
|
||||
target_link_libraries(${target} ${ALEMBIC_LIBRARIES} ${HDF5_LIBRARIES})
|
||||
endif()
|
||||
if(WITH_IMAGE_OPENEXR)
|
||||
target_link_libraries(${target} ${OPENEXR_LIBRARIES})
|
||||
endif()
|
||||
@@ -474,6 +435,9 @@ function(setup_liblinks
|
||||
if(WITH_MEM_JEMALLOC)
|
||||
target_link_libraries(${target} ${JEMALLOC_LIBRARIES})
|
||||
endif()
|
||||
if(WITH_INPUT_NDOF)
|
||||
target_link_libraries(${target} ${NDOF_LIBRARIES})
|
||||
endif()
|
||||
if(WITH_MOD_CLOTH_ELTOPO)
|
||||
target_link_libraries(${target} ${LAPACK_LIBRARIES})
|
||||
endif()
|
||||
@@ -487,15 +451,6 @@ function(setup_liblinks
|
||||
if(WITH_OPENMP_STATIC)
|
||||
target_link_libraries(${target} ${OpenMP_LIBRARIES})
|
||||
endif()
|
||||
if(WITH_INPUT_NDOF)
|
||||
target_link_libraries(${target} ${NDOF_LIBRARIES})
|
||||
endif()
|
||||
endif()
|
||||
if(WITH_SYSTEM_GLOG)
|
||||
target_link_libraries(${target} ${GLOG_LIBRARIES})
|
||||
endif()
|
||||
if(WITH_SYSTEM_GFLAGS)
|
||||
target_link_libraries(${target} ${GFLAGS_LIBRARIES})
|
||||
endif()
|
||||
|
||||
# We put CLEW and CUEW here because OPENSUBDIV_LIBRARIES dpeends on them..
|
||||
@@ -508,17 +463,11 @@ function(setup_liblinks
|
||||
endif()
|
||||
endif()
|
||||
|
||||
target_link_libraries(
|
||||
${target}
|
||||
${ZLIB_LIBRARIES}
|
||||
)
|
||||
|
||||
#system libraries with no dependencies such as platform link libs or opengl should go last
|
||||
target_link_libraries(${target}
|
||||
${BLENDER_GL_LIBRARIES})
|
||||
|
||||
#target_link_libraries(${target} ${PLATFORM_LINKLIBS} ${CMAKE_DL_LIBS})
|
||||
target_link_libraries(${target} ${PLATFORM_LINKLIBS})
|
||||
target_link_libraries(${target} ${PLATFORM_LINKLIBS} ${CMAKE_DL_LIBS})
|
||||
endfunction()
|
||||
|
||||
|
||||
@@ -538,7 +487,6 @@ function(SETUP_BLENDER_SORTED_LIBS)
|
||||
if(WITH_CYCLES)
|
||||
list(APPEND BLENDER_LINK_LIBS
|
||||
cycles_render
|
||||
cycles_graph
|
||||
cycles_bvh
|
||||
cycles_device
|
||||
cycles_kernel
|
||||
@@ -601,14 +549,13 @@ function(SETUP_BLENDER_SORTED_LIBS)
|
||||
bf_freestyle
|
||||
bf_ikplugin
|
||||
bf_modifiers
|
||||
bf_alembic
|
||||
bf_bmesh
|
||||
bf_gpu
|
||||
bf_blenloader
|
||||
bf_blenkernel
|
||||
bf_physics
|
||||
bf_nodes
|
||||
bf_rna
|
||||
bf_blenloader
|
||||
bf_imbuf
|
||||
bf_blenlib
|
||||
bf_depsgraph
|
||||
@@ -653,7 +600,6 @@ function(SETUP_BLENDER_SORTED_LIBS)
|
||||
bf_intern_dualcon
|
||||
bf_intern_cycles
|
||||
cycles_render
|
||||
cycles_graph
|
||||
cycles_bvh
|
||||
cycles_device
|
||||
cycles_kernel
|
||||
@@ -664,19 +610,13 @@ function(SETUP_BLENDER_SORTED_LIBS)
|
||||
extern_rangetree
|
||||
extern_wcwidth
|
||||
bf_intern_libmv
|
||||
extern_glog
|
||||
extern_gflags
|
||||
extern_sdlew
|
||||
|
||||
bf_intern_glew_mx
|
||||
)
|
||||
|
||||
if(NOT WITH_SYSTEM_GLOG)
|
||||
list(APPEND BLENDER_SORTED_LIBS extern_glog)
|
||||
endif()
|
||||
|
||||
if(NOT WITH_SYSTEM_GFLAGS)
|
||||
list(APPEND BLENDER_SORTED_LIBS extern_gflags)
|
||||
endif()
|
||||
|
||||
if(WITH_COMPOSITOR)
|
||||
# added for opencl compositor
|
||||
list_insert_before(BLENDER_SORTED_LIBS "bf_blenkernel" "bf_compositor")
|
||||
@@ -719,6 +659,10 @@ function(SETUP_BLENDER_SORTED_LIBS)
|
||||
list(APPEND BLENDER_SORTED_LIBS bf_quicktime)
|
||||
endif()
|
||||
|
||||
if(WITH_INPUT_NDOF)
|
||||
list(APPEND BLENDER_SORTED_LIBS bf_intern_ghostndof3dconnexion)
|
||||
endif()
|
||||
|
||||
if(WITH_MOD_BOOLEAN)
|
||||
list(APPEND BLENDER_SORTED_LIBS extern_carve)
|
||||
endif()
|
||||
@@ -743,15 +687,7 @@ function(SETUP_BLENDER_SORTED_LIBS)
|
||||
list_insert_after(BLENDER_SORTED_LIBS "ge_logic_ngnetwork" "extern_bullet")
|
||||
endif()
|
||||
|
||||
if(WITH_GAMEENGINE_DECKLINK)
|
||||
list(APPEND BLENDER_SORTED_LIBS bf_intern_decklink)
|
||||
endif()
|
||||
|
||||
if(WIN32)
|
||||
list(APPEND BLENDER_SORTED_LIBS bf_intern_gpudirect)
|
||||
endif()
|
||||
|
||||
if(WITH_OPENSUBDIV OR WITH_CYCLES_OPENSUBDIV)
|
||||
if(WITH_OPENSUBDIV)
|
||||
list(APPEND BLENDER_SORTED_LIBS bf_intern_opensubdiv)
|
||||
endif()
|
||||
|
||||
@@ -867,15 +803,7 @@ macro(TEST_UNORDERED_MAP_SUPPORT)
|
||||
# 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()
|
||||
CHECK_INCLUDE_FILE_CXX("unordered_map" HAVE_STD_UNORDERED_MAP_HEADER)
|
||||
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
|
||||
@@ -945,16 +873,8 @@ macro(TEST_SHARED_PTR_SUPPORT)
|
||||
# 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()
|
||||
CHECK_INCLUDE_FILE_CXX(memory HAVE_STD_MEMORY_HEADER)
|
||||
if(HAVE_STD_MEMORY_HEADER)
|
||||
# Finding the memory header doesn't mean that shared_ptr is in std
|
||||
# namespace.
|
||||
@@ -962,6 +882,7 @@ macro(TEST_SHARED_PTR_SUPPORT)
|
||||
# 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.
|
||||
include(CheckCXXSourceCompiles)
|
||||
CHECK_CXX_SOURCE_COMPILES("#include <memory>
|
||||
int main() {
|
||||
std::shared_ptr<int> int_ptr;
|
||||
@@ -1129,19 +1050,6 @@ macro(remove_strict_flags_file
|
||||
|
||||
endmacro()
|
||||
|
||||
# External libs may need 'signed char' to be default.
|
||||
macro(remove_cc_flag_unsigned_char)
|
||||
if(CMAKE_C_COMPILER_ID MATCHES "^(GNU|Clang|Intel)$")
|
||||
remove_cc_flag("-funsigned-char")
|
||||
elseif(MSVC)
|
||||
remove_cc_flag("/J")
|
||||
else()
|
||||
message(WARNING
|
||||
"Compiler '${CMAKE_C_COMPILER_ID}' failed to disable 'unsigned char' flag."
|
||||
"Build files need updating."
|
||||
)
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
function(ADD_CHECK_C_COMPILER_FLAG
|
||||
_CFLAGS
|
||||
@@ -1247,6 +1155,17 @@ endfunction()
|
||||
# hacks to override initial project settings
|
||||
# these macros must be called directly before/after project(Blender)
|
||||
macro(blender_project_hack_pre)
|
||||
# ----------------
|
||||
# MINGW HACK START
|
||||
# ignore system set flag, use our own
|
||||
# must be before project(...)
|
||||
# if the user wants to add their own its ok after first run.
|
||||
if(DEFINED CMAKE_C_STANDARD_LIBRARIES)
|
||||
set(_reset_standard_libraries OFF)
|
||||
else()
|
||||
set(_reset_standard_libraries ON)
|
||||
endif()
|
||||
|
||||
# ------------------
|
||||
# GCC -O3 HACK START
|
||||
# needed because O3 can cause problems but
|
||||
@@ -1265,6 +1184,25 @@ endmacro()
|
||||
|
||||
|
||||
macro(blender_project_hack_post)
|
||||
# --------------
|
||||
# MINGW HACK END
|
||||
if(_reset_standard_libraries)
|
||||
# Must come after projecINCt(...)
|
||||
#
|
||||
# MINGW workaround for -ladvapi32 being included which surprisingly causes
|
||||
# string formatting of floats, eg: printf("%.*f", 3, value). to crash blender
|
||||
# with a meaningless stack trace. by overriding this flag we ensure we only
|
||||
# have libs we define.
|
||||
set(CMAKE_C_STANDARD_LIBRARIES "" CACHE STRING "" FORCE)
|
||||
set(CMAKE_CXX_STANDARD_LIBRARIES "" CACHE STRING "" FORCE)
|
||||
mark_as_advanced(
|
||||
CMAKE_C_STANDARD_LIBRARIES
|
||||
CMAKE_CXX_STANDARD_LIBRARIES
|
||||
)
|
||||
endif()
|
||||
unset(_reset_standard_libraries)
|
||||
|
||||
|
||||
# ----------------
|
||||
# GCC -O3 HACK END
|
||||
if(_reset_standard_cflags_rel)
|
||||
@@ -1536,44 +1474,3 @@ function(print_all_vars)
|
||||
message("${_var}=${${_var}}")
|
||||
endforeach()
|
||||
endfunction()
|
||||
|
||||
macro(openmp_delayload
|
||||
projectname
|
||||
)
|
||||
if(MSVC)
|
||||
if(WITH_OPENMP)
|
||||
if(MSVC_VERSION EQUAL 1800)
|
||||
set(OPENMP_DLL_NAME "vcomp120")
|
||||
else()
|
||||
set(OPENMP_DLL_NAME "vcomp140")
|
||||
endif()
|
||||
SET_TARGET_PROPERTIES(${projectname} PROPERTIES LINK_FLAGS_RELEASE "/DELAYLOAD:${OPENMP_DLL_NAME}.dll delayimp.lib")
|
||||
SET_TARGET_PROPERTIES(${projectname} PROPERTIES LINK_FLAGS_DEBUG "/DELAYLOAD:${OPENMP_DLL_NAME}d.dll delayimp.lib")
|
||||
SET_TARGET_PROPERTIES(${projectname} PROPERTIES LINK_FLAGS_RELWITHDEBINFO "/DELAYLOAD:${OPENMP_DLL_NAME}.dll delayimp.lib")
|
||||
SET_TARGET_PROPERTIES(${projectname} PROPERTIES LINK_FLAGS_MINSIZEREL "/DELAYLOAD:${OPENMP_DLL_NAME}.dll delayimp.lib")
|
||||
endif(WITH_OPENMP)
|
||||
endif(MSVC)
|
||||
endmacro()
|
||||
|
||||
MACRO(WINDOWS_SIGN_TARGET target)
|
||||
if(WITH_WINDOWS_CODESIGN)
|
||||
if(!SIGNTOOL_EXE)
|
||||
error("Codesigning is enabled, but signtool is not found")
|
||||
else()
|
||||
if(WINDOWS_CODESIGN_PFX_PASSWORD)
|
||||
set(CODESIGNPASSWORD /p ${WINDOWS_CODESIGN_PFX_PASSWORD})
|
||||
else()
|
||||
if($ENV{PFXPASSWORD})
|
||||
set(CODESIGNPASSWORD /p $ENV{PFXPASSWORD})
|
||||
else()
|
||||
message(FATAL_ERROR "WITH_WINDOWS_CODESIGN is on but WINDOWS_CODESIGN_PFX_PASSWORD not set, and environment variable PFXPASSWORD not found, unable to sign code.")
|
||||
endif()
|
||||
endif()
|
||||
add_custom_command(TARGET ${target}
|
||||
POST_BUILD
|
||||
COMMAND ${SIGNTOOL_EXE} sign /f ${WINDOWS_CODESIGN_PFX} ${CODESIGNPASSWORD} $<TARGET_FILE:${target}>
|
||||
VERBATIM
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
ENDMACRO()
|
||||
|
@@ -1,7 +1,5 @@
|
||||
string(TIMESTAMP CURRENT_YEAR "%Y")
|
||||
|
||||
set(PROJECT_DESCRIPTION "Blender is the free and open source 3D creation suite software.")
|
||||
set(PROJECT_COPYRIGHT "Copyright (C) 2001-${CURRENT_YEAR} Blender Foundation")
|
||||
set(PROJECT_DESCRIPTION "Blender is a very fast and versatile 3D modeller/renderer.")
|
||||
set(PROJECT_COPYRIGHT "Copyright (C) 2001-2012 Blender Foundation")
|
||||
set(PROJECT_CONTACT "foundation@blender.org")
|
||||
set(PROJECT_VENDOR "Blender Foundation")
|
||||
|
||||
@@ -40,21 +38,7 @@ unset(MY_WC_HASH)
|
||||
# Force Package Name
|
||||
execute_process(COMMAND date "+%Y%m%d" OUTPUT_VARIABLE CPACK_DATE OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
string(TOLOWER ${PROJECT_NAME} PROJECT_NAME_LOWER)
|
||||
if(MSVC)
|
||||
if("${CMAKE_SIZEOF_VOID_P}" EQUAL "8")
|
||||
set(PACKAGE_ARCH windows64)
|
||||
else()
|
||||
set(PACKAGE_ARCH windows32)
|
||||
endif()
|
||||
else(MSVC)
|
||||
set(PACKAGE_ARCH ${CMAKE_SYSTEM_PROCESSOR})
|
||||
endif()
|
||||
|
||||
if(CPACK_OVERRIDE_PACKAGENAME)
|
||||
set(CPACK_PACKAGE_FILE_NAME ${CPACK_OVERRIDE_PACKAGENAME}-${PACKAGE_ARCH})
|
||||
else()
|
||||
set(CPACK_PACKAGE_FILE_NAME ${PROJECT_NAME_LOWER}-${MAJOR_VERSION}.${MINOR_VERSION}.${PATCH_VERSION}-git${CPACK_DATE}.${BUILD_REV}-${PACKAGE_ARCH})
|
||||
endif()
|
||||
set(CPACK_PACKAGE_FILE_NAME ${PROJECT_NAME_LOWER}-${MAJOR_VERSION}.${MINOR_VERSION}.${PATCH_VERSION}-git${CPACK_DATE}.${BUILD_REV}-${CMAKE_SYSTEM_PROCESSOR})
|
||||
|
||||
if(CMAKE_SYSTEM_NAME MATCHES "Linux")
|
||||
# RPM packages
|
||||
@@ -99,8 +83,6 @@ if(WIN32)
|
||||
endif()
|
||||
|
||||
set(CPACK_PACKAGE_EXECUTABLES "blender" "blender")
|
||||
set(CPACK_CREATE_DESKTOP_LINKS "blender" "blender")
|
||||
|
||||
include(CPack)
|
||||
|
||||
# Target for build_archive.py script, to automatically pass along
|
||||
@@ -137,3 +119,4 @@ unset(MINOR_VERSION)
|
||||
unset(PATCH_VERSION)
|
||||
|
||||
unset(BUILD_REV)
|
||||
|
||||
|
@@ -1,473 +0,0 @@
|
||||
# ***** BEGIN GPL LICENSE BLOCK *****
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation; either version 2
|
||||
# of the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software Foundation,
|
||||
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
#
|
||||
# The Original Code is Copyright (C) 2016, Blender Foundation
|
||||
# All rights reserved.
|
||||
#
|
||||
# Contributor(s): Sergey Sharybin.
|
||||
#
|
||||
# ***** END GPL LICENSE BLOCK *****
|
||||
|
||||
# Libraries configuration for Apple.
|
||||
|
||||
macro(find_package_wrapper)
|
||||
# do nothing, just satisfy the macro
|
||||
endmacro()
|
||||
|
||||
if(NOT DEFINED LIBDIR)
|
||||
if(WITH_CXX11)
|
||||
set(LIBDIR ${CMAKE_SOURCE_DIR}/../lib/darwin)
|
||||
else()
|
||||
set(LIBDIR ${CMAKE_SOURCE_DIR}/../lib/darwin-9.x.universal)
|
||||
endif()
|
||||
else()
|
||||
message(STATUS "Using pre-compiled LIBDIR: ${LIBDIR}")
|
||||
endif()
|
||||
if(NOT EXISTS "${LIBDIR}/")
|
||||
message(FATAL_ERROR "Mac OSX requires pre-compiled libs at: '${LIBDIR}'")
|
||||
endif()
|
||||
|
||||
if(WITH_OPENAL)
|
||||
find_package(OpenAL)
|
||||
if(OPENAL_FOUND)
|
||||
set(WITH_OPENAL ON)
|
||||
set(OPENAL_INCLUDE_DIR "${LIBDIR}/openal/include")
|
||||
else()
|
||||
set(WITH_OPENAL OFF)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(WITH_ALEMBIC)
|
||||
set(ALEMBIC ${LIBDIR}/alembic)
|
||||
set(ALEMBIC_INCLUDE_DIR ${ALEMBIC}/include)
|
||||
set(ALEMBIC_INCLUDE_DIRS ${ALEMBIC_INCLUDE_DIR})
|
||||
set(ALEMBIC_LIBPATH ${ALEMBIC}/lib)
|
||||
set(ALEMBIC_LIBRARIES Alembic)
|
||||
set(ALEMBIC_FOUND ON)
|
||||
endif()
|
||||
|
||||
if(WITH_OPENSUBDIV OR WITH_CYCLES_OPENSUBDIV)
|
||||
set(OPENSUBDIV ${LIBDIR}/opensubdiv)
|
||||
set(OPENSUBDIV_LIBPATH ${OPENSUBDIV}/lib)
|
||||
find_library(OSD_LIB_CPU NAMES osdCPU PATHS ${OPENSUBDIV_LIBPATH})
|
||||
find_library(OSD_LIB_GPU NAMES osdGPU PATHS ${OPENSUBDIV_LIBPATH})
|
||||
set(OPENSUBDIV_INCLUDE_DIR ${OPENSUBDIV}/include)
|
||||
set(OPENSUBDIV_INCLUDE_DIRS ${OPENSUBDIV_INCLUDE_DIR})
|
||||
list(APPEND OPENSUBDIV_LIBRARIES ${OSD_LIB_CPU} ${OSD_LIB_GPU})
|
||||
endif()
|
||||
|
||||
if(WITH_JACK)
|
||||
find_library(JACK_FRAMEWORK
|
||||
NAMES jackmp
|
||||
)
|
||||
set(JACK_INCLUDE_DIRS ${JACK_FRAMEWORK}/headers)
|
||||
if(NOT JACK_FRAMEWORK)
|
||||
set(WITH_JACK OFF)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(WITH_CODEC_SNDFILE)
|
||||
set(SNDFILE ${LIBDIR}/sndfile)
|
||||
set(SNDFILE_INCLUDE_DIRS ${SNDFILE}/include)
|
||||
set(SNDFILE_LIBRARIES sndfile FLAC ogg vorbis vorbisenc)
|
||||
set(SNDFILE_LIBPATH ${SNDFILE}/lib ${LIBDIR}/ffmpeg/lib) # TODO, deprecate
|
||||
endif()
|
||||
|
||||
if(WITH_PYTHON)
|
||||
# we use precompiled libraries for py 3.5 and up by default
|
||||
set(PYTHON_VERSION 3.5)
|
||||
if(NOT WITH_PYTHON_MODULE AND NOT WITH_PYTHON_FRAMEWORK)
|
||||
# normally cached but not since we include them with blender
|
||||
set(PYTHON_INCLUDE_DIR "${LIBDIR}/python/include/python${PYTHON_VERSION}m")
|
||||
set(PYTHON_EXECUTABLE "${LIBDIR}/python/bin/python${PYTHON_VERSION}m")
|
||||
set(PYTHON_LIBRARY python${PYTHON_VERSION}m)
|
||||
set(PYTHON_LIBPATH "${LIBDIR}/python/lib/python${PYTHON_VERSION}")
|
||||
# set(PYTHON_LINKFLAGS "-u _PyMac_Error") # won't build with this enabled
|
||||
else()
|
||||
# module must be compiled against Python framework
|
||||
set(_py_framework "/Library/Frameworks/Python.framework/Versions/${PYTHON_VERSION}")
|
||||
|
||||
set(PYTHON_INCLUDE_DIR "${_py_framework}/include/python${PYTHON_VERSION}m")
|
||||
set(PYTHON_EXECUTABLE "${_py_framework}/bin/python${PYTHON_VERSION}m")
|
||||
set(PYTHON_LIBPATH "${_py_framework}/lib/python${PYTHON_VERSION}/config-${PYTHON_VERSION}m")
|
||||
#set(PYTHON_LIBRARY python${PYTHON_VERSION})
|
||||
#set(PYTHON_LINKFLAGS "-u _PyMac_Error -framework Python") # won't build with this enabled
|
||||
|
||||
unset(_py_framework)
|
||||
endif()
|
||||
|
||||
# uncached vars
|
||||
set(PYTHON_INCLUDE_DIRS "${PYTHON_INCLUDE_DIR}")
|
||||
set(PYTHON_LIBRARIES "${PYTHON_LIBRARY}")
|
||||
|
||||
if(NOT EXISTS "${PYTHON_EXECUTABLE}")
|
||||
message(FATAL_ERROR "Python executable missing: ${PYTHON_EXECUTABLE}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(WITH_FFTW3)
|
||||
set(FFTW3 ${LIBDIR}/fftw3)
|
||||
set(FFTW3_INCLUDE_DIRS ${FFTW3}/include)
|
||||
set(FFTW3_LIBRARIES fftw3)
|
||||
set(FFTW3_LIBPATH ${FFTW3}/lib)
|
||||
endif()
|
||||
|
||||
set(PNG_LIBRARIES png)
|
||||
set(JPEG_LIBRARIES jpeg)
|
||||
|
||||
set(ZLIB /usr)
|
||||
set(ZLIB_INCLUDE_DIRS "${ZLIB}/include")
|
||||
set(ZLIB_LIBRARIES z bz2)
|
||||
|
||||
set(FREETYPE ${LIBDIR}/freetype)
|
||||
set(FREETYPE_INCLUDE_DIRS ${FREETYPE}/include ${FREETYPE}/include/freetype2)
|
||||
set(FREETYPE_LIBPATH ${FREETYPE}/lib)
|
||||
set(FREETYPE_LIBRARY freetype)
|
||||
|
||||
if(WITH_IMAGE_OPENEXR)
|
||||
set(OPENEXR ${LIBDIR}/openexr)
|
||||
set(OPENEXR_INCLUDE_DIR ${OPENEXR}/include)
|
||||
set(OPENEXR_INCLUDE_DIRS ${OPENEXR_INCLUDE_DIR} ${OPENEXR}/include/OpenEXR)
|
||||
if(WITH_CXX11)
|
||||
set(OPENEXR_POSTFIX -2_2)
|
||||
else()
|
||||
set(OPENEXR_POSTFIX)
|
||||
endif()
|
||||
set(OPENEXR_LIBRARIES
|
||||
Iex${OPENEXR_POSTFIX}
|
||||
Half
|
||||
IlmImf${OPENEXR_POSTFIX}
|
||||
Imath${OPENEXR_POSTFIX}
|
||||
IlmThread${OPENEXR_POSTFIX})
|
||||
set(OPENEXR_LIBPATH ${OPENEXR}/lib)
|
||||
endif()
|
||||
|
||||
if(WITH_CODEC_FFMPEG)
|
||||
set(FFMPEG ${LIBDIR}/ffmpeg)
|
||||
set(FFMPEG_INCLUDE_DIRS ${FFMPEG}/include)
|
||||
set(FFMPEG_LIBRARIES
|
||||
avcodec avdevice avformat avutil
|
||||
mp3lame swscale x264 xvidcore theora theoradec theoraenc vorbis vorbisenc vorbisfile ogg
|
||||
)
|
||||
if(WITH_CXX11)
|
||||
set(FFMPEG_LIBRARIES ${FFMPEG_LIBRARIES} schroedinger orc vpx webp swresample)
|
||||
endif()
|
||||
set(FFMPEG_LIBPATH ${FFMPEG}/lib)
|
||||
endif()
|
||||
|
||||
if(WITH_OPENJPEG OR WITH_CODEC_FFMPEG)
|
||||
# use openjpeg from libdir that is linked into ffmpeg
|
||||
if(WITH_CXX11)
|
||||
set(OPENJPEG ${LIBDIR}/openjpeg)
|
||||
set(WITH_SYSTEM_OPENJPEG ON)
|
||||
set(OPENJPEG_INCLUDE_DIRS ${OPENJPEG}/include)
|
||||
set(OPENJPEG_LIBRARIES ${OPENJPEG}/lib/libopenjpeg.a)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
find_library(SYSTEMSTUBS_LIBRARY
|
||||
NAMES
|
||||
SystemStubs
|
||||
PATHS
|
||||
)
|
||||
mark_as_advanced(SYSTEMSTUBS_LIBRARY)
|
||||
if(SYSTEMSTUBS_LIBRARY)
|
||||
list(APPEND PLATFORM_LINKLIBS SystemStubs)
|
||||
endif()
|
||||
|
||||
set(PLATFORM_CFLAGS "-pipe -funsigned-char")
|
||||
set(PLATFORM_LINKFLAGS
|
||||
"-fexceptions -framework CoreServices -framework Foundation -framework IOKit -framework AppKit -framework Cocoa -framework Carbon -framework AudioUnit -framework AudioToolbox -framework CoreAudio"
|
||||
)
|
||||
if(WITH_CODEC_QUICKTIME)
|
||||
set(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -framework QTKit")
|
||||
if(CMAKE_OSX_ARCHITECTURES MATCHES i386)
|
||||
set(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -framework QuickTime")
|
||||
# libSDL still needs 32bit carbon quicktime
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(WITH_CXX11)
|
||||
list(APPEND PLATFORM_LINKLIBS c++)
|
||||
else()
|
||||
list(APPEND PLATFORM_LINKLIBS stdc++)
|
||||
endif()
|
||||
|
||||
if(WITH_JACK)
|
||||
set(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -F/Library/Frameworks -weak_framework jackmp")
|
||||
endif()
|
||||
|
||||
if(WITH_PYTHON_MODULE OR WITH_PYTHON_FRAMEWORK)
|
||||
# force cmake to link right framework
|
||||
set(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} /Library/Frameworks/Python.framework/Versions/${PYTHON_VERSION}/Python")
|
||||
endif()
|
||||
|
||||
if(WITH_OPENCOLLADA)
|
||||
set(OPENCOLLADA ${LIBDIR}/opencollada)
|
||||
|
||||
set(OPENCOLLADA_INCLUDE_DIRS
|
||||
${LIBDIR}/opencollada/include/COLLADAStreamWriter
|
||||
${LIBDIR}/opencollada/include/COLLADABaseUtils
|
||||
${LIBDIR}/opencollada/include/COLLADAFramework
|
||||
${LIBDIR}/opencollada/include/COLLADASaxFrameworkLoader
|
||||
${LIBDIR}/opencollada/include/GeneratedSaxParser
|
||||
)
|
||||
|
||||
set(OPENCOLLADA_LIBPATH ${OPENCOLLADA}/lib)
|
||||
set(OPENCOLLADA_LIBRARIES
|
||||
OpenCOLLADASaxFrameworkLoader
|
||||
-lOpenCOLLADAFramework
|
||||
-lOpenCOLLADABaseUtils
|
||||
-lOpenCOLLADAStreamWriter
|
||||
-lMathMLSolver
|
||||
-lGeneratedSaxParser
|
||||
-lxml2 -lbuffer -lftoa
|
||||
)
|
||||
# Use UTF functions from collada if LLVM is not enabled
|
||||
if(NOT WITH_LLVM)
|
||||
list(APPEND OPENCOLLADA_LIBRARIES -lUTF)
|
||||
endif()
|
||||
# pcre is bundled with openCollada
|
||||
#set(PCRE ${LIBDIR}/pcre)
|
||||
#set(PCRE_LIBPATH ${PCRE}/lib)
|
||||
set(PCRE_LIBRARIES pcre)
|
||||
#libxml2 is used
|
||||
#set(EXPAT ${LIBDIR}/expat)
|
||||
#set(EXPAT_LIBPATH ${EXPAT}/lib)
|
||||
set(EXPAT_LIB)
|
||||
endif()
|
||||
|
||||
if(WITH_SDL)
|
||||
set(SDL ${LIBDIR}/sdl)
|
||||
set(SDL_INCLUDE_DIR ${SDL}/include)
|
||||
set(SDL_LIBRARY SDL2)
|
||||
set(SDL_LIBPATH ${SDL}/lib)
|
||||
if(WITH_CXX11)
|
||||
set(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -framework ForceFeedback")
|
||||
else()
|
||||
set(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -lazy_framework ForceFeedback")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
set(PNG "${LIBDIR}/png")
|
||||
set(PNG_INCLUDE_DIRS "${PNG}/include")
|
||||
set(PNG_LIBPATH ${PNG}/lib)
|
||||
|
||||
set(JPEG "${LIBDIR}/jpeg")
|
||||
set(JPEG_INCLUDE_DIR "${JPEG}/include")
|
||||
set(JPEG_LIBPATH ${JPEG}/lib)
|
||||
|
||||
if(WITH_IMAGE_TIFF)
|
||||
set(TIFF ${LIBDIR}/tiff)
|
||||
set(TIFF_INCLUDE_DIR ${TIFF}/include)
|
||||
set(TIFF_LIBRARY tiff)
|
||||
set(TIFF_LIBPATH ${TIFF}/lib)
|
||||
endif()
|
||||
|
||||
if(WITH_BOOST)
|
||||
set(BOOST ${LIBDIR}/boost)
|
||||
set(BOOST_INCLUDE_DIR ${BOOST}/include)
|
||||
if(WITH_CXX11)
|
||||
set(BOOST_POSTFIX)
|
||||
else()
|
||||
set(BOOST_POSTFIX -mt)
|
||||
endif()
|
||||
set(BOOST_LIBRARIES
|
||||
boost_date_time${BOOST_POSTFIX}
|
||||
boost_filesystem${BOOST_POSTFIX}
|
||||
boost_regex${BOOST_POSTFIX}
|
||||
boost_system${BOOST_POSTFIX}
|
||||
boost_thread${BOOST_POSTFIX}
|
||||
boost_wave${BOOST_POSTFIX}
|
||||
)
|
||||
if(WITH_INTERNATIONAL)
|
||||
list(APPEND BOOST_LIBRARIES boost_locale${BOOST_POSTFIX})
|
||||
endif()
|
||||
if(WITH_CYCLES_NETWORK)
|
||||
list(APPEND BOOST_LIBRARIES boost_serialization${BOOST_POSTFIX})
|
||||
endif()
|
||||
if(WITH_OPENVDB)
|
||||
list(APPEND BOOST_LIBRARIES boost_iostreams${BOOST_POSTFIX})
|
||||
endif()
|
||||
set(BOOST_LIBPATH ${BOOST}/lib)
|
||||
set(BOOST_DEFINITIONS)
|
||||
endif()
|
||||
|
||||
if(WITH_INTERNATIONAL OR WITH_CODEC_FFMPEG)
|
||||
set(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -liconv") # boost_locale and ffmpeg needs it !
|
||||
endif()
|
||||
|
||||
if(WITH_OPENIMAGEIO)
|
||||
set(OPENIMAGEIO ${LIBDIR}/openimageio)
|
||||
set(OPENIMAGEIO_INCLUDE_DIRS ${OPENIMAGEIO}/include)
|
||||
set(OPENIMAGEIO_LIBRARIES
|
||||
${OPENIMAGEIO}/lib/libOpenImageIO.a
|
||||
${PNG_LIBRARIES}
|
||||
${JPEG_LIBRARIES}
|
||||
${TIFF_LIBRARY}
|
||||
${OPENEXR_LIBRARIES}
|
||||
${ZLIB_LIBRARIES}
|
||||
)
|
||||
if(WITH_CXX11)
|
||||
set(OPENIMAGEIO_LIBRARIES ${OPENIMAGEIO_LIBRARIES} ${LIBDIR}/ffmpeg/lib/libwebp.a)
|
||||
endif()
|
||||
set(OPENIMAGEIO_LIBPATH
|
||||
${OPENIMAGEIO}/lib
|
||||
${JPEG_LIBPATH}
|
||||
${PNG_LIBPATH}
|
||||
${TIFF_LIBPATH}
|
||||
${OPENEXR_LIBPATH}
|
||||
${ZLIB_LIBPATH}
|
||||
)
|
||||
set(OPENIMAGEIO_DEFINITIONS "-DOIIO_STATIC_BUILD")
|
||||
set(OPENIMAGEIO_IDIFF "${LIBDIR}/openimageio/bin/idiff")
|
||||
endif()
|
||||
|
||||
if(WITH_OPENCOLORIO)
|
||||
set(OPENCOLORIO ${LIBDIR}/opencolorio)
|
||||
set(OPENCOLORIO_INCLUDE_DIRS ${OPENCOLORIO}/include)
|
||||
set(OPENCOLORIO_LIBRARIES OpenColorIO tinyxml yaml-cpp)
|
||||
set(OPENCOLORIO_LIBPATH ${OPENCOLORIO}/lib)
|
||||
endif()
|
||||
|
||||
if(WITH_OPENVDB)
|
||||
set(OPENVDB ${LIBDIR}/openvdb)
|
||||
set(OPENVDB_INCLUDE_DIRS ${OPENVDB}/include)
|
||||
set(TBB_INCLUDE_DIRS ${LIBDIR}/tbb/include)
|
||||
set(TBB_LIBRARIES ${LIBDIR}/tbb/lib/libtbb.a)
|
||||
set(OPENVDB_LIBRARIES openvdb blosc ${TBB_LIBRARIES})
|
||||
set(OPENVDB_LIBPATH ${LIBDIR}/openvdb/lib)
|
||||
set(OPENVDB_DEFINITIONS)
|
||||
endif()
|
||||
|
||||
if(WITH_LLVM)
|
||||
set(LLVM_ROOT_DIR ${LIBDIR}/llvm CACHE PATH "Path to the LLVM installation")
|
||||
set(LLVM_VERSION "3.4" CACHE STRING "Version of LLVM to use")
|
||||
if(EXISTS "${LLVM_ROOT_DIR}/bin/llvm-config")
|
||||
set(LLVM_CONFIG "${LLVM_ROOT_DIR}/bin/llvm-config")
|
||||
else()
|
||||
set(LLVM_CONFIG llvm-config)
|
||||
endif()
|
||||
execute_process(COMMAND ${LLVM_CONFIG} --version
|
||||
OUTPUT_VARIABLE LLVM_VERSION
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
execute_process(COMMAND ${LLVM_CONFIG} --prefix
|
||||
OUTPUT_VARIABLE LLVM_ROOT_DIR
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
execute_process(COMMAND ${LLVM_CONFIG} --libdir
|
||||
OUTPUT_VARIABLE LLVM_LIBPATH
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
find_library(LLVM_LIBRARY
|
||||
NAMES LLVMAnalysis # first of a whole bunch of libs to get
|
||||
PATHS ${LLVM_LIBPATH})
|
||||
|
||||
if(LLVM_LIBRARY AND LLVM_ROOT_DIR AND LLVM_LIBPATH)
|
||||
if(LLVM_STATIC)
|
||||
# if static LLVM libraries were requested, use llvm-config to generate
|
||||
# the list of what libraries we need, and substitute that in the right
|
||||
# way for LLVM_LIBRARY.
|
||||
execute_process(COMMAND ${LLVM_CONFIG} --libfiles
|
||||
OUTPUT_VARIABLE LLVM_LIBRARY
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
string(REPLACE " " ";" LLVM_LIBRARY ${LLVM_LIBRARY})
|
||||
else()
|
||||
set(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -lLLVM-3.4")
|
||||
endif()
|
||||
else()
|
||||
message(FATAL_ERROR "LLVM not found.")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(WITH_CYCLES_OSL)
|
||||
set(CYCLES_OSL ${LIBDIR}/osl CACHE PATH "Path to OpenShadingLanguage installation")
|
||||
|
||||
find_library(OSL_LIB_EXEC NAMES oslexec PATHS ${CYCLES_OSL}/lib)
|
||||
find_library(OSL_LIB_COMP NAMES oslcomp PATHS ${CYCLES_OSL}/lib)
|
||||
find_library(OSL_LIB_QUERY NAMES oslquery PATHS ${CYCLES_OSL}/lib)
|
||||
# WARNING! depends on correct order of OSL libs linking
|
||||
list(APPEND OSL_LIBRARIES ${OSL_LIB_COMP} -force_load ${OSL_LIB_EXEC} ${OSL_LIB_QUERY})
|
||||
find_path(OSL_INCLUDE_DIR OSL/oslclosure.h PATHS ${CYCLES_OSL}/include)
|
||||
find_program(OSL_COMPILER NAMES oslc PATHS ${CYCLES_OSL}/bin)
|
||||
|
||||
if(OSL_INCLUDE_DIR AND OSL_LIBRARIES AND OSL_COMPILER)
|
||||
set(OSL_FOUND TRUE)
|
||||
else()
|
||||
message(STATUS "OSL not found")
|
||||
set(WITH_CYCLES_OSL OFF)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(WITH_OPENMP)
|
||||
execute_process(COMMAND ${CMAKE_C_COMPILER} --version OUTPUT_VARIABLE COMPILER_VENDOR)
|
||||
string(SUBSTRING "${COMPILER_VENDOR}" 0 5 VENDOR_NAME) # truncate output
|
||||
if(${VENDOR_NAME} MATCHES "Apple") # Apple does not support OpenMP reliable with gcc and not with clang
|
||||
set(WITH_OPENMP OFF)
|
||||
else() # vanilla gcc or clang_omp support OpenMP
|
||||
message(STATUS "Using special OpenMP enabled compiler !") # letting find_package(OpenMP) module work for gcc
|
||||
if(CMAKE_C_COMPILER_ID MATCHES "Clang") # clang-omp in darwin libs
|
||||
set(OPENMP_FOUND ON)
|
||||
set(OpenMP_C_FLAGS "-fopenmp" CACHE STRING "C compiler flags for OpenMP parallization" FORCE)
|
||||
set(OpenMP_CXX_FLAGS "-fopenmp" CACHE STRING "C++ compiler flags for OpenMP parallization" FORCE)
|
||||
include_directories(${LIBDIR}/openmp/include)
|
||||
link_directories(${LIBDIR}/openmp/lib)
|
||||
# This is a workaround for our helperbinaries ( datatoc, masgfmt, ... ),
|
||||
# They are linked also to omp lib, so we need it in builddir for runtime exexcution,
|
||||
# TODO: remove all unneeded dependencies from these
|
||||
|
||||
# for intermediate binaries, in respect to lib ID
|
||||
execute_process(
|
||||
COMMAND ditto -arch ${CMAKE_OSX_ARCHITECTURES}
|
||||
${LIBDIR}/openmp/lib/libiomp5.dylib
|
||||
${CMAKE_BINARY_DIR}/Resources/lib/libiomp5.dylib)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
set(EXETYPE MACOSX_BUNDLE)
|
||||
|
||||
set(CMAKE_C_FLAGS_DEBUG "-fno-strict-aliasing -g")
|
||||
set(CMAKE_CXX_FLAGS_DEBUG "-fno-strict-aliasing -g")
|
||||
if(CMAKE_OSX_ARCHITECTURES MATCHES "x86_64" OR CMAKE_OSX_ARCHITECTURES MATCHES "i386")
|
||||
set(CMAKE_CXX_FLAGS_RELEASE "-O2 -mdynamic-no-pic -msse -msse2 -msse3 -mssse3")
|
||||
set(CMAKE_C_FLAGS_RELEASE "-O2 -mdynamic-no-pic -msse -msse2 -msse3 -mssse3")
|
||||
if(NOT CMAKE_C_COMPILER_ID MATCHES "Clang")
|
||||
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -ftree-vectorize -fvariable-expansion-in-unroller")
|
||||
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -ftree-vectorize -fvariable-expansion-in-unroller")
|
||||
endif()
|
||||
else()
|
||||
set(CMAKE_C_FLAGS_RELEASE "-mdynamic-no-pic -fno-strict-aliasing")
|
||||
set(CMAKE_CXX_FLAGS_RELEASE "-mdynamic-no-pic -fno-strict-aliasing")
|
||||
endif()
|
||||
|
||||
if(${XCODE_VERSION} VERSION_EQUAL 5 OR ${XCODE_VERSION} VERSION_GREATER 5)
|
||||
# Xcode 5 is always using CLANG, which has too low template depth of 128 for libmv
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ftemplate-depth=1024")
|
||||
endif()
|
||||
# Get rid of eventually clashes, we export some symbols explicite as local
|
||||
set(PLATFORM_LINKFLAGS
|
||||
"${PLATFORM_LINKFLAGS} -Xlinker -unexported_symbols_list -Xlinker ${CMAKE_SOURCE_DIR}/source/creator/osx_locals.map"
|
||||
)
|
||||
|
||||
if(WITH_CXX11)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++")
|
||||
set(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -stdlib=libc++")
|
||||
endif()
|
||||
|
||||
# Suppress ranlib "has no symbols" warnings (workaround for T48250)
|
||||
set(CMAKE_C_ARCHIVE_CREATE "<CMAKE_AR> Scr <TARGET> <LINK_FLAGS> <OBJECTS>")
|
||||
set(CMAKE_CXX_ARCHIVE_CREATE "<CMAKE_AR> Scr <TARGET> <LINK_FLAGS> <OBJECTS>")
|
||||
set(CMAKE_C_ARCHIVE_FINISH "<CMAKE_RANLIB> -no_warning_for_no_symbols -c <TARGET>")
|
||||
set(CMAKE_CXX_ARCHIVE_FINISH "<CMAKE_RANLIB> -no_warning_for_no_symbols -c <TARGET>")
|
@@ -1,135 +0,0 @@
|
||||
# ***** BEGIN GPL LICENSE BLOCK *****
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation; either version 2
|
||||
# of the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software Foundation,
|
||||
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
#
|
||||
# The Original Code is Copyright (C) 2016, Blender Foundation
|
||||
# All rights reserved.
|
||||
#
|
||||
# Contributor(s): Jacques Beaurain.
|
||||
#
|
||||
# ***** END GPL LICENSE BLOCK *****
|
||||
|
||||
# Xcode and system configuration for Apple.
|
||||
|
||||
# require newer cmake on osx because of version handling,
|
||||
# older cmake cannot handle 2 digit subversion!
|
||||
cmake_minimum_required(VERSION 3.0.0)
|
||||
|
||||
if(NOT CMAKE_OSX_ARCHITECTURES)
|
||||
set(CMAKE_OSX_ARCHITECTURES x86_64 CACHE STRING
|
||||
"Choose the architecture you want to build Blender for: i386, x86_64 or ppc"
|
||||
FORCE)
|
||||
endif()
|
||||
|
||||
if(NOT DEFINED OSX_SYSTEM)
|
||||
execute_process(
|
||||
COMMAND xcodebuild -version -sdk macosx SDKVersion
|
||||
OUTPUT_VARIABLE OSX_SYSTEM
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
endif()
|
||||
|
||||
# workaround for incorrect cmake xcode lookup for developer previews - XCODE_VERSION does not
|
||||
# take xcode-select path into account but would always look into /Applications/Xcode.app
|
||||
# while dev versions are named Xcode<version>-DP<preview_number>
|
||||
execute_process(
|
||||
COMMAND xcode-select --print-path
|
||||
OUTPUT_VARIABLE XCODE_CHECK OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
string(REPLACE "/Contents/Developer" "" XCODE_BUNDLE ${XCODE_CHECK}) # truncate to bundlepath in any case
|
||||
|
||||
if(${CMAKE_GENERATOR} MATCHES "Xcode")
|
||||
|
||||
# earlier xcode has no bundled developer dir, no sense in getting xcode path from
|
||||
if(${XCODE_VERSION} VERSION_GREATER 4.2)
|
||||
# reduce to XCode name without dp extension
|
||||
string(SUBSTRING "${XCODE_CHECK}" 14 6 DP_NAME)
|
||||
if(${DP_NAME} MATCHES Xcode5)
|
||||
set(XCODE_VERSION 5)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
##### cmake incompatibility with xcode 4.3 and higher #####
|
||||
if(${XCODE_VERSION} MATCHES '') # cmake fails due looking for xcode in the wrong path, thus will be empty var
|
||||
message(FATAL_ERROR "Xcode 4.3 and higher must be used with cmake 2.8-8 or higher")
|
||||
endif()
|
||||
### 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)
|
||||
# Xcode 4 defaults to the Apple LLVM Compiler.
|
||||
# Override the default compiler selection because Blender only compiles with gcc up to xcode 4.2
|
||||
set(CMAKE_XCODE_ATTRIBUTE_GCC_VERSION "com.apple.compilers.llvmgcc42")
|
||||
message(STATUS "Setting compiler to: " ${CMAKE_XCODE_ATTRIBUTE_GCC_VERSION})
|
||||
endif()
|
||||
else() # unix makefile generator does not fill XCODE_VERSION var, so we get it with a command
|
||||
execute_process(COMMAND xcodebuild -version OUTPUT_VARIABLE XCODE_VERS_BUILD_NR)
|
||||
string(SUBSTRING "${XCODE_VERS_BUILD_NR}" 6 3 XCODE_VERSION) # truncate away build-nr
|
||||
unset(XCODE_VERS_BUILD_NR)
|
||||
endif()
|
||||
|
||||
message(STATUS "Detected OS X ${OSX_SYSTEM} and Xcode ${XCODE_VERSION} at ${XCODE_BUNDLE}")
|
||||
|
||||
if(${XCODE_VERSION} VERSION_LESS 4.3)
|
||||
# use guaranteed existing sdk
|
||||
set(CMAKE_OSX_SYSROOT /Developer/SDKs/MacOSX${OSX_SYSTEM}.sdk CACHE PATH "" FORCE)
|
||||
else()
|
||||
# note: xcode-select path could be ambigous,
|
||||
# cause /Applications/Xcode.app/Contents/Developer or /Applications/Xcode.app would be allowed
|
||||
# so i use a selfcomposed bundlepath here
|
||||
set(OSX_SYSROOT_PREFIX ${XCODE_BUNDLE}/Contents/Developer/Platforms/MacOSX.platform)
|
||||
message(STATUS "OSX_SYSROOT_PREFIX: " ${OSX_SYSROOT_PREFIX})
|
||||
set(OSX_DEVELOPER_PREFIX /Developer/SDKs/MacOSX${OSX_SYSTEM}.sdk) # use guaranteed existing sdk
|
||||
set(CMAKE_OSX_SYSROOT ${OSX_SYSROOT_PREFIX}/${OSX_DEVELOPER_PREFIX} CACHE PATH "" FORCE)
|
||||
if(${CMAKE_GENERATOR} MATCHES "Xcode")
|
||||
# to silence sdk not found warning, just overrides CMAKE_OSX_SYSROOT
|
||||
set(CMAKE_XCODE_ATTRIBUTE_SDKROOT macosx${OSX_SYSTEM})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(OSX_SYSTEM MATCHES 10.9)
|
||||
# make sure syslibs and headers are looked up in sdk ( expecially for 10.9 openGL atm. )
|
||||
set(CMAKE_FIND_ROOT_PATH ${CMAKE_OSX_SYSROOT})
|
||||
endif()
|
||||
|
||||
if(WITH_CXX11)
|
||||
# 10.9 is our min. target, if you use higher sdk, weak linking happens
|
||||
if(CMAKE_OSX_DEPLOYMENT_TARGET)
|
||||
if(${CMAKE_OSX_DEPLOYMENT_TARGET} VERSION_LESS 10.9)
|
||||
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)
|
||||
endif()
|
||||
else()
|
||||
set(CMAKE_OSX_DEPLOYMENT_TARGET "10.9" CACHE STRING "" FORCE)
|
||||
endif()
|
||||
else()
|
||||
if(NOT CMAKE_OSX_DEPLOYMENT_TARGET)
|
||||
# 10.6 is our min. target, if you use higher sdk, weak linking happens
|
||||
set(CMAKE_OSX_DEPLOYMENT_TARGET "10.6" CACHE STRING "" FORCE)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(NOT ${CMAKE_GENERATOR} MATCHES "Xcode")
|
||||
# force CMAKE_OSX_DEPLOYMENT_TARGET for makefiles, will not work else ( cmake bug ? )
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mmacosx-version-min=${CMAKE_OSX_DEPLOYMENT_TARGET}")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mmacosx-version-min=${CMAKE_OSX_DEPLOYMENT_TARGET}")
|
||||
add_definitions("-DMACOSX_DEPLOYMENT_TARGET=${CMAKE_OSX_DEPLOYMENT_TARGET}")
|
||||
endif()
|
||||
|
||||
macro(apple_check_quicktime)
|
||||
# QuickTime framework is no longer available in SDK 10.12+
|
||||
if(WITH_CODEC_QUICKTIME AND ${OSX_SYSTEM} VERSION_GREATER 10.11)
|
||||
set(WITH_CODEC_QUICKTIME OFF CACHE BOOL "" FORCE)
|
||||
message(STATUS "QuickTime not supported by SDK ${OSX_SYSTEM}, disabling WITH_CODEC_QUICKTIME")
|
||||
endif()
|
||||
endmacro()
|
||||
|
@@ -1,428 +0,0 @@
|
||||
# ***** BEGIN GPL LICENSE BLOCK *****
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation; either version 2
|
||||
# of the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software Foundation,
|
||||
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
#
|
||||
# The Original Code is Copyright (C) 2016, Blender Foundation
|
||||
# All rights reserved.
|
||||
#
|
||||
# Contributor(s): Sergey Sharybin.
|
||||
#
|
||||
# ***** END GPL LICENSE BLOCK *****
|
||||
|
||||
# Libraries configuration for any *nix system including Linux and Unix.
|
||||
|
||||
macro(find_package_wrapper)
|
||||
if(WITH_STATIC_LIBS)
|
||||
find_package_static(${ARGV})
|
||||
else()
|
||||
find_package(${ARGV})
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
find_package_wrapper(JPEG REQUIRED)
|
||||
find_package_wrapper(PNG REQUIRED)
|
||||
find_package_wrapper(ZLIB REQUIRED)
|
||||
find_package_wrapper(Freetype REQUIRED)
|
||||
|
||||
if(WITH_LZO AND WITH_SYSTEM_LZO)
|
||||
find_package_wrapper(LZO)
|
||||
if(NOT LZO_FOUND)
|
||||
message(FATAL_ERROR "Failed finding system LZO version!")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(WITH_SYSTEM_EIGEN3)
|
||||
find_package_wrapper(Eigen3)
|
||||
if(NOT EIGEN3_FOUND)
|
||||
message(FATAL_ERROR "Failed finding system Eigen3 version!")
|
||||
endif()
|
||||
endif()
|
||||
# else values are set below for all platforms
|
||||
|
||||
if(WITH_PYTHON)
|
||||
# No way to set py35, remove for now.
|
||||
# find_package(PythonLibs)
|
||||
|
||||
# Use our own instead, since without py is such a rare case,
|
||||
# require this package
|
||||
# XXX Linking errors with debian static python :/
|
||||
# find_package_wrapper(PythonLibsUnix REQUIRED)
|
||||
find_package(PythonLibsUnix REQUIRED)
|
||||
endif()
|
||||
|
||||
if(WITH_IMAGE_OPENEXR)
|
||||
find_package_wrapper(OpenEXR) # our own module
|
||||
if(NOT OPENEXR_FOUND)
|
||||
set(WITH_IMAGE_OPENEXR OFF)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(WITH_IMAGE_OPENJPEG)
|
||||
find_package_wrapper(OpenJPEG)
|
||||
if(NOT OPENJPEG_FOUND)
|
||||
set(WITH_IMAGE_OPENJPEG OFF)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(WITH_IMAGE_TIFF)
|
||||
# XXX Linking errors with debian static tiff :/
|
||||
# find_package_wrapper(TIFF)
|
||||
find_package(TIFF)
|
||||
if(NOT TIFF_FOUND)
|
||||
set(WITH_IMAGE_TIFF OFF)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Audio IO
|
||||
if(WITH_SYSTEM_AUDASPACE)
|
||||
find_package_wrapper(Audaspace)
|
||||
if(NOT AUDASPACE_FOUND OR NOT AUDASPACE_C_FOUND)
|
||||
message(FATAL_ERROR "Audaspace external library not found!")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(WITH_OPENAL)
|
||||
find_package_wrapper(OpenAL)
|
||||
if(NOT OPENAL_FOUND)
|
||||
set(WITH_OPENAL OFF)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(WITH_SDL)
|
||||
if(WITH_SDL_DYNLOAD)
|
||||
set(SDL_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/extern/sdlew/include/SDL2")
|
||||
set(SDL_LIBRARY)
|
||||
else()
|
||||
find_package_wrapper(SDL2)
|
||||
if(SDL2_FOUND)
|
||||
# Use same names for both versions of SDL until we move to 2.x.
|
||||
set(SDL_INCLUDE_DIR "${SDL2_INCLUDE_DIR}")
|
||||
set(SDL_LIBRARY "${SDL2_LIBRARY}")
|
||||
set(SDL_FOUND "${SDL2_FOUND}")
|
||||
else()
|
||||
find_package_wrapper(SDL)
|
||||
endif()
|
||||
mark_as_advanced(
|
||||
SDL_INCLUDE_DIR
|
||||
SDL_LIBRARY
|
||||
)
|
||||
# unset(SDLMAIN_LIBRARY CACHE)
|
||||
if(NOT SDL_FOUND)
|
||||
set(WITH_SDL OFF)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(WITH_JACK)
|
||||
find_package_wrapper(Jack)
|
||||
if(NOT JACK_FOUND)
|
||||
set(WITH_JACK OFF)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Codecs
|
||||
if(WITH_CODEC_SNDFILE)
|
||||
find_package_wrapper(SndFile)
|
||||
if(NOT SNDFILE_FOUND)
|
||||
set(WITH_CODEC_SNDFILE OFF)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(WITH_CODEC_FFMPEG)
|
||||
set(FFMPEG /usr CACHE PATH "FFMPEG Directory")
|
||||
set(FFMPEG_LIBRARIES avformat avcodec avutil avdevice swscale CACHE STRING "FFMPEG Libraries")
|
||||
|
||||
mark_as_advanced(FFMPEG)
|
||||
|
||||
# lame, but until we have proper find module for ffmpeg
|
||||
set(FFMPEG_INCLUDE_DIRS ${FFMPEG}/include)
|
||||
if(EXISTS "${FFMPEG}/include/ffmpeg/")
|
||||
list(APPEND FFMPEG_INCLUDE_DIRS "${FFMPEG}/include/ffmpeg")
|
||||
endif()
|
||||
# end lameness
|
||||
|
||||
mark_as_advanced(FFMPEG_LIBRARIES)
|
||||
set(FFMPEG_LIBPATH ${FFMPEG}/lib)
|
||||
endif()
|
||||
|
||||
if(WITH_FFTW3)
|
||||
find_package_wrapper(Fftw3)
|
||||
if(NOT FFTW3_FOUND)
|
||||
set(WITH_FFTW3 OFF)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(WITH_OPENCOLLADA)
|
||||
find_package_wrapper(OpenCOLLADA)
|
||||
if(OPENCOLLADA_FOUND)
|
||||
find_package_wrapper(XML2)
|
||||
find_package_wrapper(PCRE)
|
||||
else()
|
||||
set(WITH_OPENCOLLADA OFF)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(WITH_MEM_JEMALLOC)
|
||||
find_package_wrapper(JeMalloc)
|
||||
if(NOT JEMALLOC_FOUND)
|
||||
set(WITH_MEM_JEMALLOC OFF)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(WITH_INPUT_NDOF)
|
||||
find_package_wrapper(Spacenav)
|
||||
if(SPACENAV_FOUND)
|
||||
# use generic names within blenders buildsystem.
|
||||
set(NDOF_INCLUDE_DIRS ${SPACENAV_INCLUDE_DIRS})
|
||||
set(NDOF_LIBRARIES ${SPACENAV_LIBRARIES})
|
||||
else()
|
||||
set(WITH_INPUT_NDOF OFF)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(WITH_CYCLES_OSL)
|
||||
set(CYCLES_OSL ${LIBDIR}/osl CACHE PATH "Path to OpenShadingLanguage installation")
|
||||
if(NOT OSL_ROOT)
|
||||
set(OSL_ROOT ${CYCLES_OSL})
|
||||
endif()
|
||||
find_package_wrapper(OpenShadingLanguage)
|
||||
if(OSL_FOUND)
|
||||
if(${OSL_LIBRARY_VERSION_MAJOR} EQUAL "1" AND ${OSL_LIBRARY_VERSION_MINOR} LESS "6")
|
||||
# Note: --whole-archive is needed to force loading of all symbols in liboslexec,
|
||||
# otherwise LLVM is missing the osl_allocate_closure_component function
|
||||
set(OSL_LIBRARIES
|
||||
${OSL_OSLCOMP_LIBRARY}
|
||||
-Wl,--whole-archive ${OSL_OSLEXEC_LIBRARY}
|
||||
-Wl,--no-whole-archive ${OSL_OSLQUERY_LIBRARY}
|
||||
)
|
||||
endif()
|
||||
else()
|
||||
message(STATUS "OSL not found, disabling it from Cycles")
|
||||
set(WITH_CYCLES_OSL OFF)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(WITH_OPENVDB)
|
||||
find_package_wrapper(OpenVDB)
|
||||
find_package_wrapper(TBB)
|
||||
if(NOT OPENVDB_FOUND OR NOT TBB_FOUND)
|
||||
set(WITH_OPENVDB OFF)
|
||||
set(WITH_OPENVDB_BLOSC OFF)
|
||||
message(STATUS "OpenVDB not found, disabling it")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(WITH_ALEMBIC)
|
||||
find_package_wrapper(Alembic)
|
||||
|
||||
if(WITH_ALEMBIC_HDF5)
|
||||
set(HDF5_ROOT_DIR ${LIBDIR}/hdf5)
|
||||
find_package_wrapper(HDF5)
|
||||
endif()
|
||||
|
||||
if(NOT ALEMBIC_FOUND OR (WITH_ALEMBIC_HDF5 AND NOT HDF5_FOUND))
|
||||
set(WITH_ALEMBIC OFF)
|
||||
set(WITH_ALEMBIC_HDF5 OFF)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(WITH_BOOST)
|
||||
# uses in build instructions to override include and library variables
|
||||
if(NOT BOOST_CUSTOM)
|
||||
if(WITH_STATIC_LIBS)
|
||||
set(Boost_USE_STATIC_LIBS ON)
|
||||
endif()
|
||||
set(Boost_USE_MULTITHREADED ON)
|
||||
set(__boost_packages filesystem regex thread date_time)
|
||||
if(WITH_CYCLES_OSL)
|
||||
if(NOT (${OSL_LIBRARY_VERSION_MAJOR} EQUAL "1" AND ${OSL_LIBRARY_VERSION_MINOR} LESS "6"))
|
||||
list(APPEND __boost_packages wave)
|
||||
else()
|
||||
endif()
|
||||
endif()
|
||||
if(WITH_INTERNATIONAL)
|
||||
list(APPEND __boost_packages locale)
|
||||
endif()
|
||||
if(WITH_CYCLES_NETWORK)
|
||||
list(APPEND __boost_packages serialization)
|
||||
endif()
|
||||
if(WITH_OPENVDB)
|
||||
list(APPEND __boost_packages iostreams)
|
||||
endif()
|
||||
list(APPEND __boost_packages system)
|
||||
find_package(Boost 1.48 COMPONENTS ${__boost_packages})
|
||||
if(NOT Boost_FOUND)
|
||||
# try to find non-multithreaded if -mt not found, this flag
|
||||
# doesn't matter for us, it has nothing to do with thread
|
||||
# safety, but keep it to not disturb build setups
|
||||
set(Boost_USE_MULTITHREADED OFF)
|
||||
find_package(Boost 1.48 COMPONENTS ${__boost_packages})
|
||||
endif()
|
||||
unset(__boost_packages)
|
||||
if(Boost_USE_STATIC_LIBS AND WITH_BOOST_ICU)
|
||||
find_package(IcuLinux)
|
||||
endif()
|
||||
mark_as_advanced(Boost_DIR) # why doesnt boost do this?
|
||||
endif()
|
||||
|
||||
set(BOOST_INCLUDE_DIR ${Boost_INCLUDE_DIRS})
|
||||
set(BOOST_LIBRARIES ${Boost_LIBRARIES})
|
||||
set(BOOST_LIBPATH ${Boost_LIBRARY_DIRS})
|
||||
set(BOOST_DEFINITIONS "-DBOOST_ALL_NO_LIB")
|
||||
endif()
|
||||
|
||||
if(WITH_OPENIMAGEIO)
|
||||
find_package_wrapper(OpenImageIO)
|
||||
if(NOT OPENIMAGEIO_PUGIXML_FOUND AND WITH_CYCLES_STANDALONE)
|
||||
find_package_wrapper(PugiXML)
|
||||
else()
|
||||
set(PUGIXML_INCLUDE_DIR "${OPENIMAGEIO_INCLUDE_DIR/OpenImageIO}")
|
||||
set(PUGIXML_LIBRARIES "")
|
||||
endif()
|
||||
|
||||
set(OPENIMAGEIO_LIBRARIES
|
||||
${OPENIMAGEIO_LIBRARIES}
|
||||
${PNG_LIBRARIES}
|
||||
${JPEG_LIBRARIES}
|
||||
${ZLIB_LIBRARIES}
|
||||
${BOOST_LIBRARIES}
|
||||
)
|
||||
set(OPENIMAGEIO_LIBPATH) # TODO, remove and reference the absolute path everywhere
|
||||
set(OPENIMAGEIO_DEFINITIONS "")
|
||||
|
||||
if(WITH_IMAGE_TIFF)
|
||||
list(APPEND OPENIMAGEIO_LIBRARIES "${TIFF_LIBRARY}")
|
||||
endif()
|
||||
if(WITH_IMAGE_OPENEXR)
|
||||
list(APPEND OPENIMAGEIO_LIBRARIES "${OPENEXR_LIBRARIES}")
|
||||
endif()
|
||||
|
||||
if(NOT OPENIMAGEIO_FOUND)
|
||||
set(WITH_OPENIMAGEIO OFF)
|
||||
message(STATUS "OpenImageIO not found, disabling WITH_CYCLES")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(WITH_OPENCOLORIO)
|
||||
find_package_wrapper(OpenColorIO)
|
||||
|
||||
set(OPENCOLORIO_LIBRARIES ${OPENCOLORIO_LIBRARIES})
|
||||
set(OPENCOLORIO_LIBPATH) # TODO, remove and reference the absolute path everywhere
|
||||
set(OPENCOLORIO_DEFINITIONS)
|
||||
|
||||
if(NOT OPENCOLORIO_FOUND)
|
||||
set(WITH_OPENCOLORIO OFF)
|
||||
message(STATUS "OpenColorIO not found")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(WITH_LLVM)
|
||||
find_package_wrapper(LLVM)
|
||||
|
||||
if(NOT LLVM_FOUND)
|
||||
set(WITH_LLVM OFF)
|
||||
message(STATUS "LLVM not found")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(WITH_LLVM OR WITH_SDL_DYNLOAD)
|
||||
# Fix for conflict with Mesa llvmpipe
|
||||
set(PLATFORM_LINKFLAGS
|
||||
"${PLATFORM_LINKFLAGS} -Wl,--version-script='${CMAKE_SOURCE_DIR}/source/creator/blender.map'"
|
||||
)
|
||||
endif()
|
||||
|
||||
if(WITH_OPENSUBDIV OR WITH_CYCLES_OPENSUBDIV)
|
||||
find_package_wrapper(OpenSubdiv)
|
||||
|
||||
set(OPENSUBDIV_LIBRARIES ${OPENSUBDIV_LIBRARIES})
|
||||
set(OPENSUBDIV_LIBPATH) # TODO, remove and reference the absolute path everywhere
|
||||
|
||||
if(NOT OPENSUBDIV_FOUND)
|
||||
set(WITH_OPENSUBDIV OFF)
|
||||
set(WITH_CYCLES_OPENSUBDIV OFF)
|
||||
message(STATUS "OpenSubdiv not found")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# OpenSuse needs lutil, ArchLinux not, for now keep, can avoid by using --as-needed
|
||||
list(APPEND PLATFORM_LINKLIBS -lutil -lc -lm)
|
||||
|
||||
find_package(Threads REQUIRED)
|
||||
list(APPEND PLATFORM_LINKLIBS ${CMAKE_THREAD_LIBS_INIT})
|
||||
# used by other platforms
|
||||
set(PTHREADS_LIBRARIES ${CMAKE_THREAD_LIBS_INIT})
|
||||
|
||||
if(CMAKE_DL_LIBS)
|
||||
list(APPEND PLATFORM_LINKLIBS ${CMAKE_DL_LIBS})
|
||||
endif()
|
||||
|
||||
if(CMAKE_SYSTEM_NAME MATCHES "Linux")
|
||||
if(NOT WITH_PYTHON_MODULE)
|
||||
# binreloc is linux only
|
||||
set(BINRELOC_INCLUDE_DIRS ${CMAKE_SOURCE_DIR}/extern/binreloc/include)
|
||||
set(WITH_BINRELOC ON)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# lfs on glibc, all compilers should use
|
||||
add_definitions(-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE)
|
||||
|
||||
# GNU Compiler
|
||||
if(CMAKE_COMPILER_IS_GNUCC)
|
||||
set(PLATFORM_CFLAGS "-pipe -fPIC -funsigned-char -fno-strict-aliasing")
|
||||
|
||||
if(WITH_LINKER_GOLD)
|
||||
execute_process(
|
||||
COMMAND ${CMAKE_C_COMPILER} -fuse-ld=gold -Wl,--version
|
||||
ERROR_QUIET OUTPUT_VARIABLE LD_VERSION)
|
||||
if("${LD_VERSION}" MATCHES "GNU gold")
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fuse-ld=gold")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fuse-ld=gold")
|
||||
else()
|
||||
message(STATUS "GNU gold linker isn't available, using the default system linker.")
|
||||
endif()
|
||||
unset(LD_VERSION)
|
||||
endif()
|
||||
|
||||
# CLang is the same as GCC for now.
|
||||
elseif(CMAKE_C_COMPILER_ID MATCHES "Clang")
|
||||
set(PLATFORM_CFLAGS "-pipe -fPIC -funsigned-char -fno-strict-aliasing")
|
||||
# Solaris CC
|
||||
elseif(CMAKE_C_COMPILER_ID MATCHES "SunPro")
|
||||
set(PLATFORM_CFLAGS "-pipe -features=extensions -fPIC -D__FUNCTION__=__func__")
|
||||
|
||||
# Intel C++ Compiler
|
||||
elseif(CMAKE_C_COMPILER_ID MATCHES "Intel")
|
||||
# think these next two are broken
|
||||
find_program(XIAR xiar)
|
||||
if(XIAR)
|
||||
set(CMAKE_AR "${XIAR}")
|
||||
endif()
|
||||
mark_as_advanced(XIAR)
|
||||
|
||||
find_program(XILD xild)
|
||||
if(XILD)
|
||||
set(CMAKE_LINKER "${XILD}")
|
||||
endif()
|
||||
mark_as_advanced(XILD)
|
||||
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fp-model precise -prec_div -parallel")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fp-model precise -prec_div -parallel")
|
||||
|
||||
# set(PLATFORM_CFLAGS "${PLATFORM_CFLAGS} -diag-enable sc3")
|
||||
set(PLATFORM_CFLAGS "-pipe -fPIC -funsigned-char -fno-strict-aliasing")
|
||||
set(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -static-intel")
|
||||
endif()
|
@@ -1,85 +0,0 @@
|
||||
# ***** BEGIN GPL LICENSE BLOCK *****
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation; either version 2
|
||||
# of the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software Foundation,
|
||||
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
#
|
||||
# The Original Code is Copyright (C) 2016, Blender Foundation
|
||||
# All rights reserved.
|
||||
#
|
||||
# Contributor(s): Sergey Sharybin.
|
||||
#
|
||||
# ***** END GPL LICENSE BLOCK *****
|
||||
|
||||
# Libraries configuration for Windows.
|
||||
|
||||
add_definitions(-DWIN32)
|
||||
|
||||
if(MSVC)
|
||||
include(platform_win32_msvc)
|
||||
else()
|
||||
message(FATAL_ERROR "Compiler is unsupported")
|
||||
endif()
|
||||
|
||||
set(WINTAB_INC ${LIBDIR}/wintab/include)
|
||||
|
||||
if(WITH_OPENAL)
|
||||
set(OPENAL ${LIBDIR}/openal)
|
||||
set(OPENALDIR ${LIBDIR}/openal)
|
||||
set(OPENAL_INCLUDE_DIR ${OPENAL}/include)
|
||||
if(MSVC)
|
||||
set(OPENAL_LIBRARY openal32)
|
||||
else()
|
||||
set(OPENAL_LIBRARY wrap_oal)
|
||||
endif()
|
||||
set(OPENAL_LIBPATH ${OPENAL}/lib)
|
||||
endif()
|
||||
|
||||
if(WITH_CODEC_SNDFILE)
|
||||
set(SNDFILE ${LIBDIR}/sndfile)
|
||||
set(SNDFILE_INCLUDE_DIRS ${SNDFILE}/include)
|
||||
set(SNDFILE_LIBRARIES libsndfile-1)
|
||||
set(SNDFILE_LIBPATH ${SNDFILE}/lib) # TODO, deprecate
|
||||
endif()
|
||||
|
||||
if(WITH_RAYOPTIMIZATION AND SUPPORT_SSE_BUILD)
|
||||
add_definitions(-D__SSE__ -D__MMX__)
|
||||
endif()
|
||||
|
||||
if(WITH_CYCLES_OSL)
|
||||
set(CYCLES_OSL ${LIBDIR}/osl CACHE PATH "Path to OpenShadingLanguage installation")
|
||||
|
||||
find_library(OSL_LIB_EXEC NAMES oslexec PATHS ${CYCLES_OSL}/lib)
|
||||
find_library(OSL_LIB_COMP NAMES oslcomp PATHS ${CYCLES_OSL}/lib)
|
||||
find_library(OSL_LIB_QUERY NAMES oslquery PATHS ${CYCLES_OSL}/lib)
|
||||
find_library(OSL_LIB_EXEC_DEBUG NAMES oslexec_d PATHS ${CYCLES_OSL}/lib)
|
||||
find_library(OSL_LIB_COMP_DEBUG NAMES oslcomp_d PATHS ${CYCLES_OSL}/lib)
|
||||
find_library(OSL_LIB_QUERY_DEBUG NAMES oslquery_d PATHS ${CYCLES_OSL}/lib)
|
||||
list(APPEND OSL_LIBRARIES
|
||||
optimized ${OSL_LIB_COMP}
|
||||
optimized ${OSL_LIB_EXEC}
|
||||
optimized ${OSL_LIB_QUERY}
|
||||
debug ${OSL_LIB_EXEC_DEBUG}
|
||||
debug ${OSL_LIB_COMP_DEBUG}
|
||||
debug ${OSL_LIB_QUERY_DEBUG}
|
||||
)
|
||||
find_path(OSL_INCLUDE_DIR OSL/oslclosure.h PATHS ${CYCLES_OSL}/include)
|
||||
find_program(OSL_COMPILER NAMES oslc PATHS ${CYCLES_OSL}/bin)
|
||||
|
||||
if(OSL_INCLUDE_DIR AND OSL_LIBRARIES AND OSL_COMPILER)
|
||||
set(OSL_FOUND TRUE)
|
||||
else()
|
||||
message(STATUS "OSL not found")
|
||||
set(WITH_CYCLES_OSL OFF)
|
||||
endif()
|
||||
endif()
|
@@ -1,502 +0,0 @@
|
||||
# ***** BEGIN GPL LICENSE BLOCK *****
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation; either version 2
|
||||
# of the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software Foundation,
|
||||
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
#
|
||||
# The Original Code is Copyright (C) 2016, Blender Foundation
|
||||
# All rights reserved.
|
||||
#
|
||||
# Contributor(s): Sergey Sharybin.
|
||||
#
|
||||
# ***** END GPL LICENSE BLOCK *****
|
||||
|
||||
# Libraries configuration for Windows when compiling with MSVC.
|
||||
|
||||
macro(warn_hardcoded_paths package_name
|
||||
)
|
||||
if(WITH_WINDOWS_FIND_MODULES)
|
||||
message(WARNING "Using HARDCODED ${package_name} locations")
|
||||
endif(WITH_WINDOWS_FIND_MODULES)
|
||||
endmacro()
|
||||
|
||||
macro(windows_find_package package_name
|
||||
)
|
||||
if(WITH_WINDOWS_FIND_MODULES)
|
||||
find_package(${package_name})
|
||||
endif(WITH_WINDOWS_FIND_MODULES)
|
||||
endmacro()
|
||||
|
||||
macro(find_package_wrapper)
|
||||
if(WITH_WINDOWS_FIND_MODULES)
|
||||
find_package(${ARGV})
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
add_definitions(-DWIN32)
|
||||
# Minimum MSVC Version
|
||||
if(CMAKE_CXX_COMPILER_ID MATCHES MSVC)
|
||||
if(MSVC_VERSION EQUAL 1800)
|
||||
set(_min_ver "18.0.31101")
|
||||
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS ${_min_ver})
|
||||
message(FATAL_ERROR
|
||||
"Visual Studio 2013 (Update 4, ${_min_ver}) required, "
|
||||
"found (${CMAKE_CXX_COMPILER_VERSION})")
|
||||
endif()
|
||||
endif()
|
||||
if(MSVC_VERSION EQUAL 1900)
|
||||
set(_min_ver "19.0.24210")
|
||||
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS ${_min_ver})
|
||||
message(FATAL_ERROR
|
||||
"Visual Studio 2015 (Update 3, ${_min_ver}) required, "
|
||||
"found (${CMAKE_CXX_COMPILER_VERSION})")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
unset(_min_ver)
|
||||
|
||||
# needed for some MSVC installations
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /SAFESEH:NO")
|
||||
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /SAFESEH:NO")
|
||||
set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} /SAFESEH:NO")
|
||||
|
||||
list(APPEND PLATFORM_LINKLIBS
|
||||
ws2_32 vfw32 winmm kernel32 user32 gdi32 comdlg32
|
||||
advapi32 shfolder shell32 ole32 oleaut32 uuid psapi Dbghelp
|
||||
)
|
||||
|
||||
if(WITH_INPUT_IME)
|
||||
list(APPEND PLATFORM_LINKLIBS imm32)
|
||||
endif()
|
||||
|
||||
add_definitions(
|
||||
-D_CRT_NONSTDC_NO_DEPRECATE
|
||||
-D_CRT_SECURE_NO_DEPRECATE
|
||||
-D_SCL_SECURE_NO_DEPRECATE
|
||||
-D_CONSOLE
|
||||
-D_LIB
|
||||
)
|
||||
|
||||
# MSVC11 needs _ALLOW_KEYWORD_MACROS to build
|
||||
add_definitions(-D_ALLOW_KEYWORD_MACROS)
|
||||
|
||||
# We want to support Vista level ABI
|
||||
add_definitions(-D_WIN32_WINNT=0x600)
|
||||
|
||||
# Make cmake find the msvc redistributables
|
||||
set(CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_SKIP TRUE)
|
||||
include(InstallRequiredSystemLibraries)
|
||||
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /nologo /J /Gd /MP /EHsc")
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /nologo /J /Gd /MP")
|
||||
|
||||
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /MTd")
|
||||
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /MTd")
|
||||
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /MT")
|
||||
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} /MT")
|
||||
set(CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS_MINSIZEREL} /MT")
|
||||
set(CMAKE_C_FLAGS_MINSIZEREL "${CMAKE_C_FLAGS_MINSIZEREL} /MT")
|
||||
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} /MT")
|
||||
set(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO} /MT")
|
||||
|
||||
set(PLATFORM_LINKFLAGS "/SUBSYSTEM:CONSOLE /STACK:2097152 /INCREMENTAL:NO ")
|
||||
set(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} /NODEFAULTLIB:msvcrt.lib /NODEFAULTLIB:msvcmrt.lib /NODEFAULTLIB:msvcurt.lib /NODEFAULTLIB:msvcrtd.lib ")
|
||||
|
||||
# Ignore meaningless for us linker warnings.
|
||||
set(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} /ignore:4049 /ignore:4217 /ignore:4221")
|
||||
set(CMAKE_STATIC_LINKER_FLAGS "${CMAKE_STATIC_LINKER_FLAGS} /ignore:4221")
|
||||
|
||||
if(CMAKE_CL_64)
|
||||
set(PLATFORM_LINKFLAGS "/MACHINE:X64 ${PLATFORM_LINKFLAGS}")
|
||||
else()
|
||||
set(PLATFORM_LINKFLAGS "/MACHINE:IX86 /LARGEADDRESSAWARE ${PLATFORM_LINKFLAGS}")
|
||||
endif()
|
||||
|
||||
set(PLATFORM_LINKFLAGS_DEBUG "/IGNORE:4099 /NODEFAULTLIB:libcmt.lib /NODEFAULTLIB:libc.lib")
|
||||
|
||||
if(NOT DEFINED LIBDIR)
|
||||
|
||||
# Setup 64bit and 64bit windows systems
|
||||
if(CMAKE_CL_64)
|
||||
message(STATUS "64 bit compiler detected.")
|
||||
set(LIBDIR_BASE "win64")
|
||||
else()
|
||||
message(STATUS "32 bit compiler detected.")
|
||||
set(LIBDIR_BASE "windows")
|
||||
endif()
|
||||
if(MSVC_VERSION EQUAL 1910)
|
||||
message(STATUS "Visual Studio 2017 detected.")
|
||||
set(LIBDIR ${CMAKE_SOURCE_DIR}/../lib/${LIBDIR_BASE}_vc14)
|
||||
elseif(MSVC_VERSION EQUAL 1900)
|
||||
message(STATUS "Visual Studio 2015 detected.")
|
||||
set(LIBDIR ${CMAKE_SOURCE_DIR}/../lib/${LIBDIR_BASE}_vc14)
|
||||
else()
|
||||
message(STATUS "Visual Studio 2013 detected.")
|
||||
set(LIBDIR ${CMAKE_SOURCE_DIR}/../lib/${LIBDIR_BASE}_vc12)
|
||||
endif()
|
||||
else()
|
||||
message(STATUS "Using pre-compiled LIBDIR: ${LIBDIR}")
|
||||
endif()
|
||||
if(NOT EXISTS "${LIBDIR}/")
|
||||
message(FATAL_ERROR "Windows requires pre-compiled libs at: '${LIBDIR}'")
|
||||
endif()
|
||||
|
||||
# Add each of our libraries to our cmake_prefix_path so find_package() could work
|
||||
file(GLOB children RELATIVE ${LIBDIR} ${LIBDIR}/*)
|
||||
foreach(child ${children})
|
||||
if(IS_DIRECTORY ${LIBDIR}/${child})
|
||||
list(APPEND CMAKE_PREFIX_PATH ${LIBDIR}/${child})
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
set(ZLIB_INCLUDE_DIRS ${LIBDIR}/zlib/include)
|
||||
set(ZLIB_LIBRARIES ${LIBDIR}/zlib/lib/libz_st.lib)
|
||||
set(ZLIB_INCLUDE_DIR ${LIBDIR}/zlib/include)
|
||||
set(ZLIB_LIBRARY ${LIBDIR}/zlib/lib/libz_st.lib)
|
||||
set(ZLIB_DIR ${LIBDIR}/zlib)
|
||||
|
||||
windows_find_package(zlib) # we want to find before finding things that depend on it like png
|
||||
windows_find_package(png)
|
||||
|
||||
if(NOT PNG_FOUND)
|
||||
warn_hardcoded_paths(libpng)
|
||||
set(PNG_PNG_INCLUDE_DIR ${LIBDIR}/png/include)
|
||||
set(PNG_LIBRARIES libpng)
|
||||
set(PNG "${LIBDIR}/png")
|
||||
set(PNG_INCLUDE_DIRS "${PNG}/include")
|
||||
set(PNG_LIBPATH ${PNG}/lib) # not cmake defined
|
||||
endif()
|
||||
|
||||
set(JPEG_NAMES ${JPEG_NAMES} libjpeg)
|
||||
windows_find_package(jpeg REQUIRED)
|
||||
if(NOT JPEG_FOUND)
|
||||
warn_hardcoded_paths(jpeg)
|
||||
set(JPEG_INCLUDE_DIR ${LIBDIR}/jpeg/include)
|
||||
set(JPEG_LIBRARIES ${LIBDIR}/jpeg/lib/libjpeg.lib)
|
||||
endif()
|
||||
|
||||
set(PTHREADS_INCLUDE_DIRS ${LIBDIR}/pthreads/include)
|
||||
set(PTHREADS_LIBRARIES ${LIBDIR}/pthreads/lib/pthreadVC2.lib)
|
||||
|
||||
set(FREETYPE ${LIBDIR}/freetype)
|
||||
set(FREETYPE_INCLUDE_DIRS
|
||||
${LIBDIR}/freetype/include
|
||||
${LIBDIR}/freetype/include/freetype2
|
||||
)
|
||||
set(FREETYPE_LIBRARY ${LIBDIR}/freetype/lib/freetype2ST.lib)
|
||||
windows_find_package(freetype REQUIRED)
|
||||
|
||||
if(WITH_FFTW3)
|
||||
set(FFTW3 ${LIBDIR}/fftw3)
|
||||
set(FFTW3_LIBRARIES libfftw)
|
||||
set(FFTW3_INCLUDE_DIRS ${FFTW3}/include)
|
||||
set(FFTW3_LIBPATH ${FFTW3}/lib)
|
||||
endif()
|
||||
|
||||
if(WITH_OPENCOLLADA)
|
||||
set(OPENCOLLADA ${LIBDIR}/opencollada)
|
||||
|
||||
set(OPENCOLLADA_INCLUDE_DIRS
|
||||
${OPENCOLLADA}/include/opencollada/COLLADAStreamWriter
|
||||
${OPENCOLLADA}/include/opencollada/COLLADABaseUtils
|
||||
${OPENCOLLADA}/include/opencollada/COLLADAFramework
|
||||
${OPENCOLLADA}/include/opencollada/COLLADASaxFrameworkLoader
|
||||
${OPENCOLLADA}/include/opencollada/GeneratedSaxParser
|
||||
)
|
||||
|
||||
set(OPENCOLLADA_LIBRARIES
|
||||
${OPENCOLLADA}/lib/opencollada/OpenCOLLADASaxFrameworkLoader.lib
|
||||
${OPENCOLLADA}/lib/opencollada/OpenCOLLADAFramework.lib
|
||||
${OPENCOLLADA}/lib/opencollada/OpenCOLLADABaseUtils.lib
|
||||
${OPENCOLLADA}/lib/opencollada/OpenCOLLADAStreamWriter.lib
|
||||
${OPENCOLLADA}/lib/opencollada/MathMLSolver.lib
|
||||
${OPENCOLLADA}/lib/opencollada/GeneratedSaxParser.lib
|
||||
${OPENCOLLADA}/lib/opencollada/xml.lib
|
||||
${OPENCOLLADA}/lib/opencollada/buffer.lib
|
||||
${OPENCOLLADA}/lib/opencollada/ftoa.lib
|
||||
)
|
||||
|
||||
if(NOT WITH_LLVM)
|
||||
list(APPEND OPENCOLLADA_LIBRARIES ${OPENCOLLADA}/lib/opencollada/UTF.lib)
|
||||
endif()
|
||||
|
||||
set(PCRE_LIBRARIES
|
||||
${OPENCOLLADA}/lib/opencollada/pcre.lib
|
||||
)
|
||||
endif()
|
||||
|
||||
if(WITH_CODEC_FFMPEG)
|
||||
set(FFMPEG_INCLUDE_DIRS
|
||||
${LIBDIR}/ffmpeg/include
|
||||
${LIBDIR}/ffmpeg/include/msvc
|
||||
)
|
||||
windows_find_package(FFMPEG)
|
||||
if(NOT FFMPEG_FOUND)
|
||||
warn_hardcoded_paths(ffmpeg)
|
||||
set(FFMPEG_LIBRARY_VERSION 57)
|
||||
set(FFMPEG_LIBRARY_VERSION_AVU 55)
|
||||
set(FFMPEG_LIBRARIES
|
||||
${LIBDIR}/ffmpeg/lib/avcodec.lib
|
||||
${LIBDIR}/ffmpeg/lib/avformat.lib
|
||||
${LIBDIR}/ffmpeg/lib/avdevice.lib
|
||||
${LIBDIR}/ffmpeg/lib/avutil.lib
|
||||
${LIBDIR}/ffmpeg/lib/swscale.lib
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(WITH_IMAGE_OPENEXR)
|
||||
set(OPENEXR_ROOT_DIR ${LIBDIR}/openexr)
|
||||
set(OPENEXR_VERSION "2.1")
|
||||
windows_find_package(OPENEXR REQUIRED)
|
||||
if(NOT OPENEXR_FOUND)
|
||||
warn_hardcoded_paths(OpenEXR)
|
||||
set(OPENEXR ${LIBDIR}/openexr)
|
||||
set(OPENEXR_INCLUDE_DIR ${OPENEXR}/include)
|
||||
set(OPENEXR_INCLUDE_DIRS ${OPENEXR_INCLUDE_DIR} ${OPENEXR}/include/OpenEXR)
|
||||
set(OPENEXR_LIBPATH ${OPENEXR}/lib)
|
||||
set(OPENEXR_LIBRARIES
|
||||
optimized ${OPENEXR_LIBPATH}/Iex-2_2.lib
|
||||
optimized ${OPENEXR_LIBPATH}/Half.lib
|
||||
optimized ${OPENEXR_LIBPATH}/IlmImf-2_2.lib
|
||||
optimized ${OPENEXR_LIBPATH}/Imath-2_2.lib
|
||||
optimized ${OPENEXR_LIBPATH}/IlmThread-2_2.lib
|
||||
debug ${OPENEXR_LIBPATH}/Iex-2_2_d.lib
|
||||
debug ${OPENEXR_LIBPATH}/Half_d.lib
|
||||
debug ${OPENEXR_LIBPATH}/IlmImf-2_2_d.lib
|
||||
debug ${OPENEXR_LIBPATH}/Imath-2_2_d.lib
|
||||
debug ${OPENEXR_LIBPATH}/IlmThread-2_2_d.lib
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(WITH_IMAGE_TIFF)
|
||||
# Try to find tiff first then complain and set static and maybe wrong paths
|
||||
windows_find_package(TIFF)
|
||||
if(NOT TIFF_FOUND)
|
||||
warn_hardcoded_paths(libtiff)
|
||||
set(TIFF_LIBRARY ${LIBDIR}/tiff/lib/libtiff.lib)
|
||||
set(TIFF_INCLUDE_DIR ${LIBDIR}/tiff/include)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(WITH_JACK)
|
||||
set(JACK_INCLUDE_DIRS
|
||||
${LIBDIR}/jack/include/jack
|
||||
${LIBDIR}/jack/include
|
||||
)
|
||||
set(JACK_LIBRARIES optimized ${LIBDIR}/jack/lib/libjack.lib debug ${LIBDIR}/jack/lib/libjack_d.lib)
|
||||
endif()
|
||||
|
||||
if(WITH_PYTHON)
|
||||
set(PYTHON_VERSION 3.5) # CACHE STRING)
|
||||
|
||||
string(REPLACE "." "" _PYTHON_VERSION_NO_DOTS ${PYTHON_VERSION})
|
||||
# Use shared libs for vc2008 and vc2010 until we actually have vc2010 libs
|
||||
set(PYTHON_LIBRARY ${LIBDIR}/python/lib/python${_PYTHON_VERSION_NO_DOTS}.lib)
|
||||
unset(_PYTHON_VERSION_NO_DOTS)
|
||||
|
||||
# Shared includes for both vc2008 and vc2010
|
||||
set(PYTHON_INCLUDE_DIR ${LIBDIR}/python/include/python${PYTHON_VERSION})
|
||||
|
||||
# uncached vars
|
||||
set(PYTHON_INCLUDE_DIRS "${PYTHON_INCLUDE_DIR}")
|
||||
set(PYTHON_LIBRARIES "${PYTHON_LIBRARY}")
|
||||
endif()
|
||||
|
||||
if(WITH_BOOST)
|
||||
if(WITH_CYCLES_OSL)
|
||||
set(boost_extra_libs wave)
|
||||
endif()
|
||||
if(WITH_INTERNATIONAL)
|
||||
list(APPEND boost_extra_libs locale)
|
||||
endif()
|
||||
if(WITH_OPENVDB)
|
||||
list(APPEND boost_extra_libs iostreams)
|
||||
endif()
|
||||
set(Boost_USE_STATIC_RUNTIME ON) # prefix lib
|
||||
set(Boost_USE_MULTITHREADED ON) # suffix -mt
|
||||
set(Boost_USE_STATIC_LIBS ON) # suffix -s
|
||||
if (WITH_WINDOWS_FIND_MODULES)
|
||||
find_package(Boost COMPONENTS date_time filesystem thread regex system ${boost_extra_libs})
|
||||
endif (WITH_WINDOWS_FIND_MODULES)
|
||||
if(NOT Boost_FOUND)
|
||||
warn_hardcoded_paths(BOOST)
|
||||
set(BOOST ${LIBDIR}/boost)
|
||||
set(BOOST_INCLUDE_DIR ${BOOST}/include)
|
||||
if(MSVC12)
|
||||
set(BOOST_LIBPATH ${BOOST}/lib)
|
||||
set(BOOST_POSTFIX "vc120-mt-s-1_60.lib")
|
||||
set(BOOST_DEBUG_POSTFIX "vc120-mt-sgd-1_60.lib")
|
||||
else()
|
||||
set(BOOST_LIBPATH ${BOOST}/lib)
|
||||
set(BOOST_POSTFIX "vc140-mt-s-1_60.lib")
|
||||
set(BOOST_DEBUG_POSTFIX "vc140-mt-sgd-1_60.lib")
|
||||
endif()
|
||||
set(BOOST_LIBRARIES
|
||||
optimized libboost_date_time-${BOOST_POSTFIX}
|
||||
optimized libboost_filesystem-${BOOST_POSTFIX}
|
||||
optimized libboost_regex-${BOOST_POSTFIX}
|
||||
optimized libboost_system-${BOOST_POSTFIX}
|
||||
optimized libboost_thread-${BOOST_POSTFIX}
|
||||
debug libboost_date_time-${BOOST_DEBUG_POSTFIX}
|
||||
debug libboost_filesystem-${BOOST_DEBUG_POSTFIX}
|
||||
debug libboost_regex-${BOOST_DEBUG_POSTFIX}
|
||||
debug libboost_system-${BOOST_DEBUG_POSTFIX}
|
||||
debug libboost_thread-${BOOST_DEBUG_POSTFIX}
|
||||
)
|
||||
if(WITH_CYCLES_OSL)
|
||||
set(BOOST_LIBRARIES ${BOOST_LIBRARIES}
|
||||
optimized libboost_wave-${BOOST_POSTFIX}
|
||||
debug libboost_wave-${BOOST_DEBUG_POSTFIX})
|
||||
endif()
|
||||
if(WITH_INTERNATIONAL)
|
||||
set(BOOST_LIBRARIES ${BOOST_LIBRARIES}
|
||||
optimized libboost_locale-${BOOST_POSTFIX}
|
||||
debug libboost_locale-${BOOST_DEBUG_POSTFIX})
|
||||
endif()
|
||||
else() # we found boost using find_package
|
||||
set(BOOST_INCLUDE_DIR ${Boost_INCLUDE_DIRS})
|
||||
set(BOOST_LIBRARIES ${Boost_LIBRARIES})
|
||||
set(BOOST_LIBPATH ${Boost_LIBRARY_DIRS})
|
||||
endif()
|
||||
set(BOOST_DEFINITIONS "-DBOOST_ALL_NO_LIB")
|
||||
endif()
|
||||
|
||||
if(WITH_OPENIMAGEIO)
|
||||
windows_find_package(OpenImageIO)
|
||||
set(OPENIMAGEIO ${LIBDIR}/openimageio)
|
||||
set(OPENIMAGEIO_INCLUDE_DIRS ${OPENIMAGEIO}/include)
|
||||
set(OIIO_OPTIMIZED optimized OpenImageIO optimized OpenImageIO_Util)
|
||||
set(OIIO_DEBUG debug OpenImageIO_d debug OpenImageIO_Util_d)
|
||||
set(OPENIMAGEIO_LIBRARIES ${OIIO_OPTIMIZED} ${OIIO_DEBUG})
|
||||
set(OPENIMAGEIO_LIBPATH ${OPENIMAGEIO}/lib)
|
||||
set(OPENIMAGEIO_DEFINITIONS "-DUSE_TBB=0")
|
||||
set(OPENCOLORIO_DEFINITIONS "-DOCIO_STATIC_BUILD")
|
||||
set(OPENIMAGEIO_IDIFF "${OPENIMAGEIO}/bin/idiff.exe")
|
||||
add_definitions(-DOIIO_STATIC_BUILD)
|
||||
add_definitions(-DOIIO_NO_SSE=1)
|
||||
endif()
|
||||
|
||||
if(WITH_LLVM)
|
||||
set(LLVM_ROOT_DIR ${LIBDIR}/llvm CACHE PATH "Path to the LLVM installation")
|
||||
file(GLOB LLVM_LIBRARY_OPTIMIZED ${LLVM_ROOT_DIR}/lib/*.lib)
|
||||
|
||||
if(EXISTS ${LLVM_ROOT_DIR}/debug/lib)
|
||||
foreach(LLVM_OPTIMIZED_LIB ${LLVM_LIBRARY_OPTIMIZED})
|
||||
get_filename_component(LIBNAME ${LLVM_OPTIMIZED_LIB} ABSOLUTE)
|
||||
list(APPEND LLVM_LIBS optimized ${LIBNAME})
|
||||
endforeach(LLVM_OPTIMIZED_LIB)
|
||||
|
||||
file(GLOB LLVM_LIBRARY_DEBUG ${LLVM_ROOT_DIR}/debug/lib/*.lib)
|
||||
|
||||
foreach(LLVM_DEBUG_LIB ${LLVM_LIBRARY_DEBUG})
|
||||
get_filename_component(LIBNAME ${LLVM_DEBUG_LIB} ABSOLUTE)
|
||||
list(APPEND LLVM_LIBS debug ${LIBNAME})
|
||||
endforeach(LLVM_DEBUG_LIB)
|
||||
|
||||
set(LLVM_LIBRARY ${LLVM_LIBS})
|
||||
else()
|
||||
message(WARNING "LLVM debug libs not present on this system. Using release libs for debug builds.")
|
||||
set(LLVM_LIBRARY ${LLVM_LIBRARY_OPTIMIZED})
|
||||
endif()
|
||||
|
||||
endif()
|
||||
|
||||
if(WITH_OPENCOLORIO)
|
||||
set(OPENCOLORIO ${LIBDIR}/opencolorio)
|
||||
set(OPENCOLORIO_INCLUDE_DIRS ${OPENCOLORIO}/include)
|
||||
set(OPENCOLORIO_LIBRARIES OpenColorIO)
|
||||
set(OPENCOLORIO_LIBPATH ${LIBDIR}/opencolorio/lib)
|
||||
set(OPENCOLORIO_DEFINITIONS)
|
||||
endif()
|
||||
|
||||
if(WITH_OPENVDB)
|
||||
set(BLOSC_LIBRARIES optimized ${LIBDIR}/blosc/lib/libblosc.lib debug ${LIBDIR}/blosc/lib/libblosc_d.lib)
|
||||
set(TBB_LIBRARIES optimized ${LIBDIR}/tbb/lib/tbb.lib debug ${LIBDIR}/tbb/lib/tbb_debug.lib)
|
||||
set(TBB_INCLUDE_DIR ${LIBDIR}/tbb/include)
|
||||
set(OPENVDB ${LIBDIR}/openvdb)
|
||||
set(OPENVDB_INCLUDE_DIRS ${OPENVDB}/include ${TBB_INCLUDE_DIR})
|
||||
set(OPENVDB_LIBRARIES optimized openvdb debug openvdb_d ${TBB_LIBRARIES} ${BLOSC_LIBRARIES})
|
||||
set(OPENVDB_LIBPATH ${LIBDIR}/openvdb/lib)
|
||||
endif()
|
||||
|
||||
if(WITH_ALEMBIC)
|
||||
set(ALEMBIC ${LIBDIR}/alembic)
|
||||
set(ALEMBIC_INCLUDE_DIR ${ALEMBIC}/include)
|
||||
set(ALEMBIC_INCLUDE_DIRS ${ALEMBIC_INCLUDE_DIR})
|
||||
set(ALEMBIC_LIBPATH ${ALEMBIC}/lib)
|
||||
set(ALEMBIC_LIBRARIES optimized alembic debug alembic_d)
|
||||
set(ALEMBIC_FOUND 1)
|
||||
endif()
|
||||
|
||||
if(WITH_MOD_CLOTH_ELTOPO)
|
||||
set(LAPACK ${LIBDIR}/lapack)
|
||||
# set(LAPACK_INCLUDE_DIR ${LAPACK}/include)
|
||||
set(LAPACK_LIBPATH ${LAPACK}/lib)
|
||||
set(LAPACK_LIBRARIES
|
||||
${LIBDIR}/lapack/lib/libf2c.lib
|
||||
${LIBDIR}/lapack/lib/clapack_nowrap.lib
|
||||
${LIBDIR}/lapack/lib/BLAS_nowrap.lib
|
||||
)
|
||||
endif()
|
||||
|
||||
if(WITH_OPENSUBDIV OR WITH_CYCLES_OPENSUBDIV)
|
||||
set(OPENSUBDIV_INCLUDE_DIR ${LIBDIR}/opensubdiv/include)
|
||||
set(OPENSUBDIV_LIBPATH ${LIBDIR}/opensubdiv/lib)
|
||||
set(OPENSUBDIV_LIBRARIES
|
||||
optimized ${OPENSUBDIV_LIBPATH}/osdCPU.lib
|
||||
optimized ${OPENSUBDIV_LIBPATH}/osdGPU.lib
|
||||
debug ${OPENSUBDIV_LIBPATH}/osdCPU_d.lib
|
||||
debug ${OPENSUBDIV_LIBPATH}/osdGPU_d.lib
|
||||
)
|
||||
set(OPENSUBDIV_HAS_OPENMP TRUE)
|
||||
set(OPENSUBDIV_HAS_TBB FALSE)
|
||||
set(OPENSUBDIV_HAS_OPENCL TRUE)
|
||||
set(OPENSUBDIV_HAS_CUDA FALSE)
|
||||
set(OPENSUBDIV_HAS_GLSL_TRANSFORM_FEEDBACK TRUE)
|
||||
set(OPENSUBDIV_HAS_GLSL_COMPUTE TRUE)
|
||||
windows_find_package(OpenSubdiv)
|
||||
endif()
|
||||
|
||||
if(WITH_SDL)
|
||||
set(SDL ${LIBDIR}/sdl)
|
||||
set(SDL_INCLUDE_DIR ${SDL}/include)
|
||||
set(SDL_LIBPATH ${SDL}/lib)
|
||||
set(SDL_LIBRARY SDL2)
|
||||
endif()
|
||||
|
||||
# Audio IO
|
||||
if(WITH_SYSTEM_AUDASPACE)
|
||||
set(AUDASPACE_INCLUDE_DIRS ${LIBDIR}/audaspace/include/audaspace)
|
||||
set(AUDASPACE_LIBRARIES ${LIBDIR}/audaspace/lib/audaspace.lib)
|
||||
set(AUDASPACE_C_INCLUDE_DIRS ${LIBDIR}/audaspace/include/audaspace)
|
||||
set(AUDASPACE_C_LIBRARIES ${LIBDIR}/audaspace/lib/audaspace-c.lib)
|
||||
set(AUDASPACE_PY_INCLUDE_DIRS ${LIBDIR}/audaspace/include/audaspace)
|
||||
set(AUDASPACE_PY_LIBRARIES ${LIBDIR}/audaspace/lib/audaspace-py.lib)
|
||||
endif()
|
||||
|
||||
# used in many places so include globally, like OpenGL
|
||||
blender_include_dirs_sys("${PTHREADS_INCLUDE_DIRS}")
|
||||
|
||||
#find signtool
|
||||
set(ProgramFilesX86_NAME "ProgramFiles(x86)") #env dislikes the ( )
|
||||
find_program(SIGNTOOL_EXE signtool
|
||||
HINTS
|
||||
"$ENV{${ProgramFilesX86_NAME}}/Windows Kits/10/bin/x86/"
|
||||
"$ENV{ProgramFiles}/Windows Kits/10/bin/x86/"
|
||||
"$ENV{${ProgramFilesX86_NAME}}/Windows Kits/8.1/bin/x86/"
|
||||
"$ENV{ProgramFiles}/Windows Kits/8.1/bin/x86/"
|
||||
"$ENV{${ProgramFilesX86_NAME}}/Windows Kits/8.0/bin/x86/"
|
||||
"$ENV{ProgramFiles}/Windows Kits/8.0/bin/x86/"
|
||||
)
|
@@ -39,7 +39,7 @@ __all__ = (
|
||||
"is_py",
|
||||
"cmake_advanced_info",
|
||||
"cmake_compiler_defines",
|
||||
"project_name_get",
|
||||
"project_name_get"
|
||||
"init",
|
||||
)
|
||||
|
||||
@@ -84,8 +84,10 @@ def init(cmake_path):
|
||||
|
||||
def source_list(path, filename_check=None):
|
||||
for dirpath, dirnames, filenames in os.walk(path):
|
||||
# skip '.git'
|
||||
dirnames[:] = [d for d in dirnames if not d.startswith(".")]
|
||||
|
||||
# skip '.svn'
|
||||
if dirpath.startswith("."):
|
||||
continue
|
||||
|
||||
for filename in filenames:
|
||||
filepath = join(dirpath, filename)
|
||||
@@ -143,7 +145,7 @@ def cmake_advanced_info():
|
||||
def create_eclipse_project():
|
||||
print("CMAKE_DIR %r" % CMAKE_DIR)
|
||||
if sys.platform == "win32":
|
||||
raise Exception("Error: win32 is not supported")
|
||||
cmd = 'cmake "%s" -G"Eclipse CDT4 - MinGW Makefiles"' % CMAKE_DIR
|
||||
else:
|
||||
if make_exe_basename.startswith(("make", "gmake")):
|
||||
cmd = 'cmake "%s" -G"Eclipse CDT4 - Unix Makefiles"' % CMAKE_DIR
|
||||
@@ -212,12 +214,7 @@ def cmake_advanced_info():
|
||||
|
||||
def cmake_cache_var(var):
|
||||
cache_file = open(join(CMAKE_DIR, "CMakeCache.txt"), encoding='utf-8')
|
||||
lines = [
|
||||
l_strip for l in cache_file
|
||||
for l_strip in (l.strip(),)
|
||||
if l_strip
|
||||
if not l_strip.startswith(("//", "#"))
|
||||
]
|
||||
lines = [l_strip for l in cache_file for l_strip in (l.strip(),) if l_strip if not l_strip.startswith("//") if not l_strip.startswith("#")]
|
||||
cache_file.close()
|
||||
|
||||
for l in lines:
|
||||
|
@@ -23,7 +23,7 @@
|
||||
__all__ = (
|
||||
"build_info",
|
||||
"SOURCE_DIR",
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
import sys
|
||||
|
@@ -1,4 +1,4 @@
|
||||
#!/usr/bin/env python3
|
||||
#!/usr/bin/env python
|
||||
|
||||
# <pep8 compliant>
|
||||
|
||||
|
@@ -2,9 +2,11 @@
|
||||
|
||||
# custom blender vars
|
||||
blender_srcdir=$(dirname $startdir)"/../.."
|
||||
blender_version=$(grep "BLENDER_VERSION\s" $blender_srcdir/source/blender/blenkernel/BKE_blender_version.h | awk '{print $3}')
|
||||
# value may be formatted: 35042:35051M
|
||||
blender_revision=$(svnversion $blender_srcdir | cut -d: -f2 | awk '{print $3}')
|
||||
blender_version=$(grep "BLENDER_VERSION\s" $blender_srcdir/source/blender/blenkernel/BKE_blender.h | awk '{print $3}')
|
||||
blender_version=$(expr $blender_version / 100).$(expr $blender_version % 100) # 256 -> 2.56
|
||||
blender_version_char=$(sed -ne 's/.*BLENDER_VERSION_CHAR.*\([a-z]\)$/\1/p' $blender_srcdir/source/blender/blenkernel/BKE_blender_version.h)
|
||||
blender_version_char=$(sed -ne 's/.*BLENDER_VERSION_CHAR.*\([a-z]\)$/\1/p' $blender_srcdir/source/blender/blenkernel/BKE_blender.h)
|
||||
# blender_subversion=$(grep BLENDER_SUBVERSION $blender_srcdir/source/blender/blenkernel/BKE_blender.h | awk '{print $3}')
|
||||
|
||||
# map the version a -> 1
|
||||
@@ -25,9 +27,7 @@ arch=('i686' 'x86_64')
|
||||
url="www.blender.org"
|
||||
license=('GPL')
|
||||
groups=()
|
||||
depends=('libjpeg' 'libpng' 'openjpeg' 'libtiff' 'openexr' 'python>=3.5'
|
||||
'gettext' 'libxi' 'libxmu' 'mesa' 'freetype2' 'openal' 'sdl'
|
||||
'libsndfile' 'ffmpeg')
|
||||
depends=('libjpeg' 'libpng' 'openjpeg' 'libtiff' 'openexr' 'python>=3.4' 'gettext' 'libxi' 'libxmu' 'mesa' 'freetype2' 'openal' 'sdl' 'libsndfile' 'ffmpeg')
|
||||
makedepends=('cmake' 'git')
|
||||
optdepends=()
|
||||
provides=()
|
||||
|
@@ -6,10 +6,10 @@
|
||||
BASE_DIR="$PWD"
|
||||
|
||||
blender_srcdir=$(dirname -- $0)/../..
|
||||
blender_version=$(grep "BLENDER_VERSION\s" "$blender_srcdir/source/blender/blenkernel/BKE_blender_version.h" | awk '{print $3}')
|
||||
blender_version_char=$(grep "BLENDER_VERSION_CHAR\s" "$blender_srcdir/source/blender/blenkernel/BKE_blender_version.h" | awk '{print $3}')
|
||||
blender_version_cycle=$(grep "BLENDER_VERSION_CYCLE\s" "$blender_srcdir/source/blender/blenkernel/BKE_blender_version.h" | awk '{print $3}')
|
||||
blender_subversion=$(grep "BLENDER_SUBVERSION\s" "$blender_srcdir/source/blender/blenkernel/BKE_blender_version.h" | awk '{print $3}')
|
||||
blender_version=$(grep "BLENDER_VERSION\s" "$blender_srcdir/source/blender/blenkernel/BKE_blender.h" | awk '{print $3}')
|
||||
blender_version_char=$(grep "BLENDER_VERSION_CHAR\s" "$blender_srcdir/source/blender/blenkernel/BKE_blender.h" | awk '{print $3}')
|
||||
blender_version_cycle=$(grep "BLENDER_VERSION_CYCLE\s" "$blender_srcdir/source/blender/blenkernel/BKE_blender.h" | awk '{print $3}')
|
||||
blender_subversion=$(grep "BLENDER_SUBVERSION\s" "$blender_srcdir/source/blender/blenkernel/BKE_blender.h" | awk '{print $3}')
|
||||
|
||||
if [ "$blender_version_cycle" = "release" ] ; then
|
||||
VERSION=$(expr $blender_version / 100).$(expr $blender_version % 100)$blender_version_char
|
||||
|
@@ -187,7 +187,7 @@ The next table describes the information in the file-header.
|
||||
</table>
|
||||
|
||||
<p>
|
||||
<a href="https://en.wikipedia.org/wiki/Endianness">Endianness</a> addresses the way values are ordered in a sequence of bytes(see the <a href="#example-endianess">example</a> below):
|
||||
<a href="http://en.wikipedia.org/wiki/Endianness">Endianness</a> addresses the way values are ordered in a sequence of bytes(see the <a href="#example-endianess">example</a> below):
|
||||
</p>
|
||||
|
||||
<ul>
|
||||
|
@@ -38,7 +38,7 @@ PROJECT_NAME = Blender
|
||||
# could be handy for archiving the generated documentation or if some version
|
||||
# control system is used.
|
||||
|
||||
PROJECT_NUMBER = "V2.79"
|
||||
PROJECT_NUMBER = "V2.7x"
|
||||
|
||||
# Using the PROJECT_BRIEF tag one can provide an optional one line description
|
||||
# for a project that appears at the top of each page and should give viewer a
|
||||
@@ -699,7 +699,7 @@ LAYOUT_FILE =
|
||||
# The CITE_BIB_FILES tag can be used to specify one or more bib files containing
|
||||
# the reference definitions. This must be a list of .bib files. The .bib
|
||||
# extension is automatically appended if omitted. This requires the bibtex tool
|
||||
# to be installed. See also https://en.wikipedia.org/wiki/BibTeX for more info.
|
||||
# to be installed. See also http://en.wikipedia.org/wiki/BibTeX for more info.
|
||||
# For LaTeX the style of the bibliography can be controlled using
|
||||
# LATEX_BIB_STYLE. To use this feature you need bibtex and perl available in the
|
||||
# search path. See also \cite for info how to create references.
|
||||
@@ -1145,7 +1145,7 @@ HTML_EXTRA_FILES =
|
||||
# The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. Doxygen
|
||||
# will adjust the colors in the style sheet and background images according to
|
||||
# this color. Hue is specified as an angle on a colorwheel, see
|
||||
# https://en.wikipedia.org/wiki/Hue for more information. For instance the value
|
||||
# http://en.wikipedia.org/wiki/Hue for more information. For instance the value
|
||||
# 0 represents red, 60 is yellow, 120 is green, 180 is cyan, 240 is blue, 300
|
||||
# purple, and 360 is red again.
|
||||
# Minimum value: 0, maximum value: 359, default value: 220.
|
||||
@@ -1752,7 +1752,7 @@ LATEX_SOURCE_CODE = NO
|
||||
|
||||
# The LATEX_BIB_STYLE tag can be used to specify the style to use for the
|
||||
# bibliography, e.g. plainnat, or ieeetr. See
|
||||
# https://en.wikipedia.org/wiki/BibTeX and \cite for more info.
|
||||
# http://en.wikipedia.org/wiki/BibTeX and \cite for more info.
|
||||
# The default value is: plain.
|
||||
# This tag requires that the tag GENERATE_LATEX is set to YES.
|
||||
|
||||
|
@@ -1,4 +1,4 @@
|
||||
#!/usr/bin/env python3
|
||||
#!/usr/bin/env python
|
||||
|
||||
# ##### BEGIN GPL LICENSE BLOCK #####
|
||||
#
|
||||
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
132
doc/python_api/epy/IDProp.py
Normal file
132
doc/python_api/epy/IDProp.py
Normal file
@@ -0,0 +1,132 @@
|
||||
class IDGroup:
|
||||
"""
|
||||
The IDGroup Type
|
||||
================
|
||||
This type supports both iteration and the []
|
||||
operator to get child ID properties.
|
||||
|
||||
You can also add new properties using the [] operator.
|
||||
For example::
|
||||
|
||||
group['a float!'] = 0.0
|
||||
group['an int!'] = 0
|
||||
group['a string!'] = "hi!"
|
||||
group['an array!'] = [0, 0, 1.0, 0]
|
||||
|
||||
group['a subgroup!] = {"float": 0.0, "an int": 1.0, "an array": [1, 2],
|
||||
"another subgroup": {"a": 0.0, "str": "bleh"}}
|
||||
|
||||
Note that for arrays, the array type defaults to int unless a float is found
|
||||
while scanning the template list; if any floats are found, then the whole
|
||||
array is float. Note that double-precision floating point numbers are used for
|
||||
python-created float ID properties and arrays (though the internal C api does
|
||||
support single-precision floats, and the python code will read them).
|
||||
|
||||
You can also delete properties with the del operator. For example:
|
||||
|
||||
del group['property']
|
||||
|
||||
To get the type of a property, use the type() operator, for example::
|
||||
|
||||
if type(group['bleh']) == str: pass
|
||||
|
||||
To tell if the property is a group or array type, import the Blender.Types module and test
|
||||
against IDGroupType and IDArrayType, like so::
|
||||
|
||||
from Blender.Types import IDGroupType, IDArrayType.
|
||||
|
||||
if type(group['bleghr']) == IDGroupType:
|
||||
(do something)
|
||||
|
||||
@ivar name: The name of the property
|
||||
@type name: string
|
||||
"""
|
||||
|
||||
def pop(item):
|
||||
"""
|
||||
Pop an item from the group property.
|
||||
@type item: string
|
||||
@param item: The item name.
|
||||
@rtype: can be dict, list, int, float or string.
|
||||
@return: The removed property.
|
||||
"""
|
||||
|
||||
def update(updatedict):
|
||||
"""
|
||||
Updates items in the dict, similar to normal python
|
||||
dictionary method .update().
|
||||
@type updatedict: dict
|
||||
@param updatedict: A dict of simple types to derive updated/new IDProperties from.
|
||||
@rtype: None
|
||||
@return: None
|
||||
"""
|
||||
|
||||
def keys():
|
||||
"""
|
||||
Returns a list of the keys in this property group.
|
||||
@rtype: list of strings.
|
||||
@return: a list of the keys in this property group.
|
||||
"""
|
||||
|
||||
def values():
|
||||
"""
|
||||
Returns a list of the values in this property group.
|
||||
|
||||
Note that unless a value is itself a property group or an array, you
|
||||
cannot change it by changing the values in this list, you must change them
|
||||
in the parent property group.
|
||||
|
||||
For example,
|
||||
|
||||
group['some_property'] = new_value
|
||||
|
||||
. . .is correct, while,
|
||||
|
||||
values = group.values()
|
||||
values[0] = new_value
|
||||
|
||||
. . .is wrong.
|
||||
|
||||
@rtype: list of strings.
|
||||
@return: a list of the values in this property group.
|
||||
"""
|
||||
|
||||
def iteritems():
|
||||
"""
|
||||
Implements the python dictionary iteritmes method.
|
||||
|
||||
For example::
|
||||
|
||||
for k, v in group.iteritems():
|
||||
print "Property name: " + k
|
||||
print "Property value: " + str(v)
|
||||
|
||||
@rtype: an iterator that spits out items of the form [key, value]
|
||||
@return: an iterator.
|
||||
"""
|
||||
|
||||
def convert_to_pyobject():
|
||||
"""
|
||||
Converts the entire property group to a purely python form.
|
||||
|
||||
@rtype: dict
|
||||
@return: A python dictionary representing the property group
|
||||
"""
|
||||
|
||||
class IDArray:
|
||||
"""
|
||||
The IDArray Type
|
||||
================
|
||||
|
||||
@ivar type: returns the type of the array, can be either IDP_Int or IDP_Float
|
||||
"""
|
||||
|
||||
def __getitem__(index):
|
||||
pass
|
||||
|
||||
def __setitem__(index, value):
|
||||
pass
|
||||
|
||||
def __len__():
|
||||
pass
|
||||
|
@@ -1,237 +0,0 @@
|
||||
"""
|
||||
Video Capture with DeckLink
|
||||
+++++++++++++++++++++++++++
|
||||
Video frames captured with DeckLink cards have pixel formats that are generally not directly
|
||||
usable by OpenGL, they must be processed by a shader. The three shaders presented here should
|
||||
cover all common video capture cases.
|
||||
|
||||
This file reflects the current video transfer method implemented in the Decklink module:
|
||||
whenever possible the video images are transferred as float texture because this is more
|
||||
compatible with GPUs. Of course, only the pixel formats that have a correspondant GL format
|
||||
can be transferred as float. Look for fg_shaders in this file for an exhaustive list.
|
||||
|
||||
Other pixel formats will be transferred as 32 bits integer red-channel texture but this
|
||||
won't work with certain GPU (Intel GMA); the corresponding shaders are not shown here.
|
||||
However, it should not be necessary to use any of them as the list below covers all practical
|
||||
cases of video capture with all types of Decklink product.
|
||||
|
||||
In other words, only use one of the pixel format below and you will be fine. Note that depending
|
||||
on the video stream, only certain pixel formats will be allowed (others will throw an exception).
|
||||
For example, to capture a PAL video stream, you must use one of the YUV formats.
|
||||
|
||||
To find which pixel format is suitable for a particular video stream, use the 'Media Express'
|
||||
utility that comes with the Decklink software : if you see the video in the 'Log and Capture'
|
||||
Window, you have selected the right pixel format and you can use the same in Blender.
|
||||
|
||||
Notes: * these shaders only decode the RGB channel and set the alpha channel to a fixed
|
||||
value (look for color.a = ). It's up to you to add postprocessing to the color.
|
||||
* these shaders are compatible with 2D and 3D video stream
|
||||
"""
|
||||
import bge
|
||||
from bge import logic
|
||||
from bge import texture as vt
|
||||
|
||||
# The default vertex shader, because we need one
|
||||
#
|
||||
VertexShader = """
|
||||
#version 130
|
||||
void main()
|
||||
{
|
||||
gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
|
||||
gl_TexCoord[0] = gl_MultiTexCoord0;
|
||||
}
|
||||
|
||||
"""
|
||||
|
||||
# For use with RGB video stream: the pixel is directly usable
|
||||
#
|
||||
FragmentShader_R10l = """
|
||||
#version 130
|
||||
uniform sampler2D tex;
|
||||
// stereo = 1.0 if 2D image, =0.5 if 3D (left eye below, right eye above)
|
||||
uniform float stereo;
|
||||
// eye = 0.0 for the left eye, 0.5 for the right eye
|
||||
uniform float eye;
|
||||
|
||||
void main(void)
|
||||
{
|
||||
vec4 color;
|
||||
float tx, ty;
|
||||
tx = gl_TexCoord[0].x;
|
||||
ty = eye+gl_TexCoord[0].y*stereo;
|
||||
color = texture(tex, vec2(tx,ty));
|
||||
color.a = 0.7;
|
||||
gl_FragColor = color;
|
||||
}
|
||||
"""
|
||||
|
||||
# For use with YUV video stream
|
||||
#
|
||||
FragmentShader_2vuy = """
|
||||
#version 130
|
||||
uniform sampler2D tex;
|
||||
// stereo = 1.0 if 2D image, =0.5 if 3D (left eye below, right eye above)
|
||||
uniform float stereo;
|
||||
// eye = 0.0 for the left eye, 0.5 for the right eye
|
||||
uniform float eye;
|
||||
|
||||
void main(void)
|
||||
{
|
||||
vec4 color;
|
||||
float tx, ty, width, Y, Cb, Cr;
|
||||
int px;
|
||||
tx = gl_TexCoord[0].x;
|
||||
ty = eye+gl_TexCoord[0].y*stereo;
|
||||
width = float(textureSize(tex, 0).x);
|
||||
color = texture(tex, vec2(tx, ty));
|
||||
px = int(floor(fract(tx*width)*2.0));
|
||||
switch (px) {
|
||||
case 0:
|
||||
Y = color.g;
|
||||
break;
|
||||
case 1:
|
||||
Y = color.a;
|
||||
break;
|
||||
}
|
||||
Y = (Y - 0.0625) * 1.168949772;
|
||||
Cb = (color.b - 0.0625) * 1.142857143 - 0.5;
|
||||
Cr = (color.r - 0.0625) * 1.142857143 - 0.5;
|
||||
color.r = Y + 1.5748 * Cr;
|
||||
color.g = Y - 0.1873 * Cb - 0.4681 * Cr;
|
||||
color.b = Y + 1.8556 * Cb;
|
||||
color.a = 0.7;
|
||||
gl_FragColor = color;
|
||||
}
|
||||
"""
|
||||
|
||||
# For use with high resolution YUV
|
||||
#
|
||||
FragmentShader_v210 = """
|
||||
#version 130
|
||||
uniform sampler2D tex;
|
||||
// stereo = 1.0 if 2D image, =0.5 if 3D (left eye below, right eye above)
|
||||
uniform float stereo;
|
||||
// eye = 0.0 for the left eye, 0.5 for the right eye
|
||||
uniform float eye;
|
||||
|
||||
void main(void)
|
||||
{
|
||||
vec4 color, color1, color2, color3;
|
||||
int px;
|
||||
float tx, ty, width, sx, dx, bx, Y, Cb, Cr;
|
||||
tx = gl_TexCoord[0].x;
|
||||
ty = eye+gl_TexCoord[0].y*stereo;
|
||||
width = float(textureSize(tex, 0).x);
|
||||
// to sample macro pixels (6 pixels in 4 words)
|
||||
sx = tx*width*0.25+0.01;
|
||||
// index of display pixel in the macro pixel 0..5
|
||||
px = int(floor(fract(sx)*6.0));
|
||||
// increment as we sample the macro pixel
|
||||
dx = 1.0/width;
|
||||
// base x coord of macro pixel
|
||||
bx = (floor(sx)+0.01)*dx*4.0;
|
||||
color = texture(tex, vec2(bx, ty));
|
||||
color1 = texture(tex, vec2(bx+dx, ty));
|
||||
color2 = texture(tex, vec2(bx+dx*2.0, ty));
|
||||
color3 = texture(tex, vec2(bx+dx*3.0, ty));
|
||||
switch (px) {
|
||||
case 0:
|
||||
case 1:
|
||||
Cb = color.b;
|
||||
Cr = color.r;
|
||||
break;
|
||||
case 2:
|
||||
case 3:
|
||||
Cb = color1.g;
|
||||
Cr = color2.b;
|
||||
break;
|
||||
default:
|
||||
Cb = color2.r;
|
||||
Cr = color3.g;
|
||||
break;
|
||||
}
|
||||
switch (px) {
|
||||
case 0:
|
||||
Y = color.g;
|
||||
break;
|
||||
case 1:
|
||||
Y = color1.b;
|
||||
break;
|
||||
case 2:
|
||||
Y = color1.r;
|
||||
break;
|
||||
case 3:
|
||||
Y = color2.g;
|
||||
break;
|
||||
case 4:
|
||||
Y = color3.b;
|
||||
break;
|
||||
default:
|
||||
Y = color3.r;
|
||||
break;
|
||||
}
|
||||
Y = (Y - 0.0625) * 1.168949772;
|
||||
Cb = (Cb - 0.0625) * 1.142857143 - 0.5;
|
||||
Cr = (Cr - 0.0625) * 1.142857143 - 0.5;
|
||||
color.r = Y + 1.5748 * Cr;
|
||||
color.g = Y - 0.1873 * Cb - 0.4681 * Cr;
|
||||
color.b = Y + 1.8556 * Cb;
|
||||
color.a = 0.7;
|
||||
gl_FragColor = color;
|
||||
}
|
||||
"""
|
||||
|
||||
# The exhausitve list of pixel formats that are transferred as float texture
|
||||
# Only use those for greater efficiency and compatiblity.
|
||||
#
|
||||
fg_shaders = {
|
||||
'2vuy' :FragmentShader_2vuy,
|
||||
'8BitYUV' :FragmentShader_2vuy,
|
||||
'v210' :FragmentShader_v210,
|
||||
'10BitYUV' :FragmentShader_v210,
|
||||
'8BitBGRA' :FragmentShader_R10l,
|
||||
'BGRA' :FragmentShader_R10l,
|
||||
'8BitARGB' :FragmentShader_R10l,
|
||||
'10BitRGBXLE':FragmentShader_R10l,
|
||||
'R10l' :FragmentShader_R10l
|
||||
}
|
||||
|
||||
|
||||
#
|
||||
# Helper function to attach a pixel shader to the material that receives the video frame.
|
||||
#
|
||||
|
||||
def config_video(obj, format, pixel, is3D=False, mat=0, card=0):
|
||||
if pixel not in fg_shaders:
|
||||
raise('Unsuported shader')
|
||||
shader = obj.meshes[0].materials[mat].getShader()
|
||||
if shader is not None and not shader.isValid():
|
||||
shader.setSource(VertexShader, fg_shaders[pixel], True)
|
||||
shader.setSampler('tex', 0)
|
||||
shader.setUniformEyef("eye")
|
||||
shader.setUniform1f("stereo", 0.5 if is3D else 1.0)
|
||||
tex = vt.Texture(obj, mat)
|
||||
tex.source = vt.VideoDeckLink(format + "/" + pixel + ("/3D" if is3D else ""), card)
|
||||
print("frame rate: ", tex.source.framerate)
|
||||
tex.source.play()
|
||||
obj["video"] = tex
|
||||
|
||||
#
|
||||
# Attach this function to an object that has a material with texture
|
||||
# and call it once to initialize the object
|
||||
#
|
||||
def init(cont):
|
||||
# config_video(cont.owner, 'HD720p5994', '8BitBGRA')
|
||||
# config_video(cont.owner, 'HD720p5994', '8BitYUV')
|
||||
# config_video(cont.owner, 'pal ', '10BitYUV')
|
||||
config_video(cont.owner, 'pal ', '8BitYUV')
|
||||
|
||||
|
||||
#
|
||||
# To be called on every frame
|
||||
#
|
||||
def play(cont):
|
||||
obj = cont.owner
|
||||
video = obj.get("video")
|
||||
if video is not None:
|
||||
video.refresh(True)
|
@@ -4,7 +4,7 @@ Persistent Handler Example
|
||||
|
||||
By default handlers are freed when loading new files, in some cases you may
|
||||
wan't the handler stay running across multiple files (when the handler is
|
||||
part of an add-on for example).
|
||||
part of an addon for example).
|
||||
|
||||
For this the :data:`bpy.app.handlers.persistent` decorator needs to be used.
|
||||
"""
|
||||
|
@@ -5,7 +5,7 @@ Intro
|
||||
.. warning::
|
||||
|
||||
Most of this object should only be useful if you actually manipulate i18n stuff from Python.
|
||||
If you are a regular add-on, you should only bother about :const:`contexts` member,
|
||||
If you are a regular addon, you should only bother about :const:`contexts` member,
|
||||
and the :func:`register`/:func:`unregister` functions! The :func:`pgettext` family of functions
|
||||
should only be used in rare, specific cases (like e.g. complex "composited" UI strings...).
|
||||
|
||||
@@ -21,73 +21,14 @@ Intro
|
||||
Then, call ``bpy.app.translations.register(__name__, your_dict)`` in your ``register()`` function, and
|
||||
``bpy.app.translations.unregister(__name__)`` in your ``unregister()`` one.
|
||||
|
||||
The ``Manage UI translations`` add-on has several functions to help you collect strings to translate, and
|
||||
The ``Manage UI translations`` addon has several functions to help you collect strings to translate, and
|
||||
generate the needed python code (the translation dictionary), as well as optional intermediary po files
|
||||
if you want some... See
|
||||
`How to Translate Blender <https://wiki.blender.org/index.php/Dev:Doc/Process/Translate_Blender>`_ and
|
||||
`Using i18n in Blender Code <https://wiki.blender.org/index.php/Dev:Source/Interface/Internationalization>`_
|
||||
`How to Translate Blender <http://wiki.blender.org/index.php/Dev:Doc/Process/Translate_Blender>`_ and
|
||||
`Using i18n in Blender Code <http://wiki.blender.org/index.php/Dev:Source/Interface/Internationalization>`_
|
||||
for more info.
|
||||
|
||||
Module References
|
||||
-----------------
|
||||
|
||||
"""
|
||||
|
||||
import bpy
|
||||
|
||||
# This block can be automatically generated by UI translations addon, which also handles conversion with PO format.
|
||||
# See also https://wiki.blender.org/index.php/Dev:Doc/Process/Translate_Blender#Translating_non-official_addons
|
||||
# It can (should) also be put in a different, specific py file.
|
||||
|
||||
# ##### BEGIN AUTOGENERATED I18N SECTION #####
|
||||
# NOTE: You can safely move around this auto-generated block (with the begin/end markers!),
|
||||
# and edit the translations by hand.
|
||||
# Just carefully respect the format of the tuple!
|
||||
|
||||
# Tuple of tuples ((msgctxt, msgid), (sources, gen_comments), (lang, translation, (is_fuzzy, comments)), ...)
|
||||
translations_tuple = (
|
||||
(("*", ""),
|
||||
((), ()),
|
||||
("fr_FR", "Project-Id-Version: Copy Settings 0.1.5 (r0)\nReport-Msgid-Bugs-To: \nPOT-Creation-Date: 2013-04-18 15:27:45.563524\nPO-Revision-Date: 2013-04-18 15:38+0100\nLast-Translator: Bastien Montagne <montagne29@wanadoo.fr>\nLanguage-Team: LANGUAGE <LL@li.org>\nLanguage: __POT__\nMIME-Version: 1.0\nContent-Type: text/plain; charset=UTF-8\nContent-Transfer-Encoding: 8bit\n",
|
||||
(False,
|
||||
("Blender's translation file (po format).",
|
||||
"Copyright (C) 2013 The Blender Foundation.",
|
||||
"This file is distributed under the same license as the Blender package.",
|
||||
"FIRST AUTHOR <EMAIL@ADDRESS>, YEAR."))),
|
||||
),
|
||||
(("Operator", "Render: Copy Settings"),
|
||||
(("bpy.types.SCENE_OT_render_copy_settings",),
|
||||
()),
|
||||
("fr_FR", "Rendu : copier réglages",
|
||||
(False, ())),
|
||||
),
|
||||
(("*", "Copy render settings from current scene to others"),
|
||||
(("bpy.types.SCENE_OT_render_copy_settings",),
|
||||
()),
|
||||
("fr_FR", "Copier les réglages de rendu depuis la scène courante vers d’autres",
|
||||
(False, ())),
|
||||
),
|
||||
# ... etc, all messages from your addon.
|
||||
)
|
||||
|
||||
translations_dict = {}
|
||||
for msg in translations_tuple:
|
||||
key = msg[0]
|
||||
for lang, trans, (is_fuzzy, comments) in msg[2:]:
|
||||
if trans and not is_fuzzy:
|
||||
translations_dict.setdefault(lang, {})[key] = trans
|
||||
|
||||
# ##### END AUTOGENERATED I18N SECTION #####
|
||||
|
||||
# Define remaining addon (operators, UI...) here.
|
||||
|
||||
def register():
|
||||
# Usual operator/UI/etc. registration...
|
||||
|
||||
bpy.app.translations.register(__name__, translations_dict)
|
||||
|
||||
|
||||
def unregister():
|
||||
bpy.app.translations.unregister(__name__)
|
||||
|
||||
# Usual operator/UI/etc. unregistration...
|
||||
|
@@ -1,10 +1,10 @@
|
||||
bl_info = {
|
||||
"name": "Example Add-on Preferences",
|
||||
"name": "Example Addon Preferences",
|
||||
"author": "Your Name Here",
|
||||
"version": (1, 0),
|
||||
"blender": (2, 65, 0),
|
||||
"location": "SpaceBar Search -> Add-on Preferences Example",
|
||||
"description": "Example Add-on",
|
||||
"location": "SpaceBar Search -> Addon Preferences Example",
|
||||
"description": "Example Addon",
|
||||
"warning": "",
|
||||
"wiki_url": "",
|
||||
"tracker_url": "",
|
||||
@@ -18,7 +18,7 @@ from bpy.props import StringProperty, IntProperty, BoolProperty
|
||||
|
||||
|
||||
class ExampleAddonPreferences(AddonPreferences):
|
||||
# this must match the add-on name, use '__package__'
|
||||
# this must match the addon name, use '__package__'
|
||||
# when defining this in a submodule of a python package.
|
||||
bl_idname = __name__
|
||||
|
||||
@@ -37,7 +37,7 @@ class ExampleAddonPreferences(AddonPreferences):
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
layout.label(text="This is a preferences view for our add-on")
|
||||
layout.label(text="This is a preferences view for our addon")
|
||||
layout.prop(self, "filepath")
|
||||
layout.prop(self, "number")
|
||||
layout.prop(self, "boolean")
|
||||
@@ -46,7 +46,7 @@ class ExampleAddonPreferences(AddonPreferences):
|
||||
class OBJECT_OT_addon_prefs_example(Operator):
|
||||
"""Display example preferences"""
|
||||
bl_idname = "object.addon_prefs_example"
|
||||
bl_label = "Add-on Preferences Example"
|
||||
bl_label = "Addon Preferences Example"
|
||||
bl_options = {'REGISTER', 'UNDO'}
|
||||
|
||||
def execute(self, context):
|
||||
|
@@ -2,9 +2,9 @@
|
||||
Extending Menus
|
||||
+++++++++++++++
|
||||
|
||||
When creating menus for add-ons you can't reference menus
|
||||
in Blender's default scripts.
|
||||
Instead, the add-on can add menu items to existing menus.
|
||||
When creating menus for addons you can't reference menus in Blender's default
|
||||
scripts.
|
||||
Instead, the addon can add menu items to existing menus.
|
||||
|
||||
The function menu_draw acts like :class:`Menu.draw`.
|
||||
"""
|
||||
|
@@ -1,81 +0,0 @@
|
||||
"""
|
||||
Extending the Button Context Menu
|
||||
+++++++++++++++++++++++++++++++++
|
||||
|
||||
This example enables you to insert your own menu entry into the common
|
||||
right click menu that you get while hovering over a value field,
|
||||
color, string, etc.
|
||||
|
||||
To make the example work, you have to first select an object
|
||||
then right click on an user interface element (maybe a color in the
|
||||
material properties) and choose *Execute Custom Action*.
|
||||
|
||||
Executing the operator will then print all values.
|
||||
"""
|
||||
|
||||
import bpy
|
||||
from bpy.types import Menu
|
||||
|
||||
|
||||
def dump(obj, text):
|
||||
for attr in dir(obj):
|
||||
print("%r.%s = %s" % (obj, attr, getattr(obj, attr)))
|
||||
|
||||
|
||||
class WM_OT_button_context_test(bpy.types.Operator):
|
||||
"""Right click entry test"""
|
||||
bl_idname = "wm.button_context_test"
|
||||
bl_label = "Run Context Test"
|
||||
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
return context.active_object is not None
|
||||
|
||||
def execute(self, context):
|
||||
value = getattr(context, "button_pointer", None)
|
||||
if value is not None:
|
||||
dump(value, "button_pointer")
|
||||
|
||||
value = getattr(context, "button_prop", None)
|
||||
if value is not None:
|
||||
dump(value, "button_prop")
|
||||
|
||||
value = getattr(context, "button_operator", None)
|
||||
if value is not None:
|
||||
dump(value, "button_operator")
|
||||
|
||||
return {'FINISHED'}
|
||||
|
||||
|
||||
# This class has to be exactly named like that to insert an entry in the right click menu
|
||||
class WM_MT_button_context(Menu):
|
||||
bl_label = "Unused"
|
||||
|
||||
def draw(self, context):
|
||||
pass
|
||||
|
||||
|
||||
def menu_func(self, context):
|
||||
layout = self.layout
|
||||
layout.separator()
|
||||
layout.operator(WM_OT_button_context_test.bl_idname)
|
||||
|
||||
classes = (
|
||||
WM_OT_button_context_test,
|
||||
WM_MT_button_context,
|
||||
)
|
||||
|
||||
|
||||
def register():
|
||||
for cls in classes:
|
||||
bpy.utils.register_class(cls)
|
||||
bpy.types.WM_MT_button_context.append(menu_func)
|
||||
|
||||
|
||||
def unregister():
|
||||
for cls in classes:
|
||||
bpy.utils.unregister_class(cls)
|
||||
bpy.types.WM_MT_button_context.remove(menu_func)
|
||||
|
||||
if __name__ == "__main__":
|
||||
register()
|
@@ -2,14 +2,13 @@
|
||||
Modal Execution
|
||||
+++++++++++++++
|
||||
|
||||
This operator defines a :class:`Operator.modal` function that will keep being
|
||||
run to handle events until it returns ``{'FINISHED'}`` or ``{'CANCELLED'}``.
|
||||
This operator defines a :class:`Operator.modal` function which running,
|
||||
handling events until it returns ``{'FINISHED'}`` or ``{'CANCELLED'}``.
|
||||
|
||||
Modal operators run every time a new event is detected, such as a mouse click
|
||||
or key press. Conversely, when no new events are detected, the modal operator
|
||||
will not run. Modal operators are especially useful for interactive tools, an
|
||||
operator can have its own state where keys toggle options as the operator runs.
|
||||
Grab, Rotate, Scale, and Fly-Mode are examples of modal operators.
|
||||
Grab, Rotate, Scale and Fly-Mode are examples of modal operators.
|
||||
They are especially useful for interactive tools,
|
||||
your operator can have its own state where keys toggle options as the operator
|
||||
runs.
|
||||
|
||||
:class:`Operator.invoke` is used to initialize the operator as being by
|
||||
returning ``{'RUNNING_MODAL'}``, initializing the modal loop.
|
||||
|
@@ -1,38 +0,0 @@
|
||||
"""
|
||||
Enum Search Popup
|
||||
+++++++++++++++++
|
||||
|
||||
You may want to have an operator prompt the user to select an item
|
||||
from a search field, this can be done using :class:`bpy.types.Operator.invoke_search_popup`.
|
||||
"""
|
||||
import bpy
|
||||
from bpy.props import EnumProperty
|
||||
|
||||
|
||||
class SearchEnumOperator(bpy.types.Operator):
|
||||
bl_idname = "object.search_enum_operator"
|
||||
bl_label = "Search Enum Operator"
|
||||
bl_property = "my_search"
|
||||
|
||||
my_search = EnumProperty(
|
||||
name="My Search",
|
||||
items=(
|
||||
('FOO', "Foo", ""),
|
||||
('BAR', "Bar", ""),
|
||||
('BAZ', "Baz", ""),
|
||||
),
|
||||
)
|
||||
|
||||
def execute(self, context):
|
||||
self.report({'INFO'}, "Selected:" + self.my_search)
|
||||
return {'FINISHED'}
|
||||
|
||||
def invoke(self, context, event):
|
||||
context.window_manager.invoke_search_popup(self)
|
||||
return {'RUNNING_MODAL'}
|
||||
|
||||
|
||||
bpy.utils.register_class(SearchEnumOperator)
|
||||
|
||||
# test call
|
||||
bpy.ops.object.search_enum_operator('INVOKE_DEFAULT')
|
@@ -13,7 +13,7 @@ be animated, accessed from the user interface and from python.
|
||||
definitions are not, this means whenever you load blender the class needs
|
||||
to be registered too.
|
||||
|
||||
This is best done by creating an add-on which loads on startup and registers
|
||||
This is best done by creating an addon which loads on startup and registers
|
||||
your properties.
|
||||
|
||||
.. note::
|
||||
|
@@ -49,7 +49,7 @@ vec2d[:] = vec3d[:2]
|
||||
|
||||
|
||||
# Vectors support 'swizzle' operations
|
||||
# See https://en.wikipedia.org/wiki/Swizzling_(computer_graphics)
|
||||
# See http://en.wikipedia.org/wiki/Swizzling_(computer_graphics)
|
||||
vec.xyz = vec.zyx
|
||||
vec.xy = vec4d.zw
|
||||
vec.xyz = vec4d.wzz
|
||||
|
@@ -47,3 +47,4 @@ Module to access application values that remain unchanged during runtime.
|
||||
True if the BGE has been built with physics support.
|
||||
|
||||
:type: bool
|
||||
|
||||
|
@@ -8,11 +8,11 @@ Physics Constraints (bge.constraints)
|
||||
Examples
|
||||
--------
|
||||
|
||||
.. include:: __/examples/bge.constraints.py
|
||||
.. include:: ../examples/bge.constraints.py
|
||||
:start-line: 1
|
||||
:end-line: 4
|
||||
|
||||
.. literalinclude:: __/examples/bge.constraints.py
|
||||
.. literalinclude:: ../examples/bge.constraints.py
|
||||
:lines: 6-
|
||||
|
||||
|
||||
|
@@ -12,53 +12,53 @@ This module holds key constants for the SCA_KeyboardSensor.
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
# Set a connected keyboard sensor to accept F1
|
||||
import bge
|
||||
# Set a connected keyboard sensor to accept F1
|
||||
import bge
|
||||
|
||||
co = bge.logic.getCurrentController()
|
||||
# 'Keyboard' is a keyboard sensor
|
||||
sensor = co.sensors["Keyboard"]
|
||||
sensor.key = bge.events.F1KEY
|
||||
co = bge.logic.getCurrentController()
|
||||
# 'Keyboard' is a keyboard sensor
|
||||
sensor = co.sensors["Keyboard"]
|
||||
sensor.key = bge.events.F1KEY
|
||||
|
||||
code-block:: python
|
||||
.. code-block:: python
|
||||
|
||||
# Do the all keys thing
|
||||
import bge
|
||||
# Do the all keys thing
|
||||
import bge
|
||||
|
||||
co = bge.logic.getCurrentController()
|
||||
# 'Keyboard' is a keyboard sensor
|
||||
sensor = co.sensors["Keyboard"]
|
||||
co = bge.logic.getCurrentController()
|
||||
# 'Keyboard' is a keyboard sensor
|
||||
sensor = co.sensors["Keyboard"]
|
||||
|
||||
for key,status in sensor.events:
|
||||
# key[0] == bge.events.keycode, key[1] = status
|
||||
if status == bge.logic.KX_INPUT_JUST_ACTIVATED:
|
||||
if key == bge.events.WKEY:
|
||||
# Activate Forward!
|
||||
if key == bge.events.SKEY:
|
||||
# Activate Backward!
|
||||
if key == bge.events.AKEY:
|
||||
# Activate Left!
|
||||
if key == bge.events.DKEY:
|
||||
# Activate Right!
|
||||
for key,status in sensor.events:
|
||||
# key[0] == bge.events.keycode, key[1] = status
|
||||
if status == bge.logic.KX_INPUT_JUST_ACTIVATED:
|
||||
if key == bge.events.WKEY:
|
||||
# Activate Forward!
|
||||
if key == bge.events.SKEY:
|
||||
# Activate Backward!
|
||||
if key == bge.events.AKEY:
|
||||
# Activate Left!
|
||||
if key == bge.events.DKEY:
|
||||
# Activate Right!
|
||||
|
||||
code-block:: python
|
||||
.. code-block:: python
|
||||
|
||||
# The all keys thing without a keyboard sensor (but you will
|
||||
# need an always sensor with pulse mode on)
|
||||
import bge
|
||||
# The all keys thing without a keyboard sensor (but you will
|
||||
# need an always sensor with pulse mode on)
|
||||
import bge
|
||||
|
||||
# Just shortening names here
|
||||
keyboard = bge.logic.keyboard
|
||||
JUST_ACTIVATED = bge.logic.KX_INPUT_JUST_ACTIVATED
|
||||
# Just shortening names here
|
||||
keyboard = bge.logic.keyboard
|
||||
JUST_ACTIVATED = bge.logic.KX_INPUT_JUST_ACTIVATED
|
||||
|
||||
if keyboard.events[bge.events.WKEY] == JUST_ACTIVATED:
|
||||
print("Activate Forward!")
|
||||
if keyboard.events[bge.events.SKEY] == JUST_ACTIVATED:
|
||||
print("Activate Backward!")
|
||||
if keyboard.events[bge.events.AKEY] == JUST_ACTIVATED:
|
||||
print("Activate Left!")
|
||||
if keyboard.events[bge.events.DKEY] == JUST_ACTIVATED:
|
||||
print("Activate Right!")
|
||||
if keyboard.events[bge.events.WKEY] == JUST_ACTIVATED:
|
||||
print("Activate Forward!")
|
||||
if keyboard.events[bge.events.SKEY] == JUST_ACTIVATED:
|
||||
print("Activate Backward!")
|
||||
if keyboard.events[bge.events.AKEY] == JUST_ACTIVATED:
|
||||
print("Activate Left!")
|
||||
if keyboard.events[bge.events.DKEY] == JUST_ACTIVATED:
|
||||
print("Activate Right!")
|
||||
|
||||
|
||||
*********
|
||||
|
@@ -378,28 +378,6 @@ General functions
|
||||
|
||||
Render next frame (if Python has control)
|
||||
|
||||
.. function:: setRender(render)
|
||||
|
||||
Sets the global flag that controls the render of the scene.
|
||||
If True, the render is done after the logic frame.
|
||||
If False, the render is skipped and another logic frame starts immediately.
|
||||
|
||||
.. note::
|
||||
|
||||
GPU VSync no longer limits the number of frame per second when render is off,
|
||||
but the *Use Frame Rate* option still regulates the fps. To run as many frames
|
||||
as possible, untick this option (Render Properties, System panel).
|
||||
|
||||
:arg render: the render flag
|
||||
:type render: bool
|
||||
|
||||
.. function:: getRender()
|
||||
|
||||
Get the current value of the global render flag
|
||||
|
||||
:return: The flag value
|
||||
:rtype: bool
|
||||
|
||||
**********************
|
||||
Time related functions
|
||||
**********************
|
||||
|
@@ -90,48 +90,6 @@ Constants
|
||||
|
||||
Right eye being used during stereoscopic rendering.
|
||||
|
||||
.. data:: RAS_OFS_RENDER_BUFFER
|
||||
|
||||
The pixel buffer for offscreen render is a RenderBuffer. Argument to :func:`offScreenCreate`
|
||||
|
||||
.. data:: RAS_OFS_RENDER_TEXTURE
|
||||
|
||||
The pixel buffer for offscreen render is a Texture. Argument to :func:`offScreenCreate`
|
||||
|
||||
|
||||
*****
|
||||
Types
|
||||
*****
|
||||
|
||||
.. class:: RASOffScreen
|
||||
|
||||
An off-screen render buffer object.
|
||||
|
||||
Use :func:`offScreenCreate` to create it.
|
||||
Currently it can only be used in the :class:`bge.texture.ImageRender`
|
||||
constructor to render on a FBO rather than the default viewport.
|
||||
|
||||
.. attribute:: width
|
||||
|
||||
The width in pixel of the FBO
|
||||
|
||||
:type: integer
|
||||
|
||||
.. attribute:: height
|
||||
|
||||
The height in pixel of the FBO
|
||||
|
||||
:type: integer
|
||||
|
||||
.. attribute:: color
|
||||
|
||||
The underlying OpenGL bind code of the texture object that holds
|
||||
the rendered image, 0 if the FBO is using RenderBuffer.
|
||||
The choice between RenderBuffer and Texture is determined
|
||||
by the target argument of :func:`offScreenCreate`.
|
||||
|
||||
:type: integer
|
||||
|
||||
|
||||
*********
|
||||
Functions
|
||||
@@ -404,22 +362,3 @@ Functions
|
||||
Get the current vsync value
|
||||
|
||||
:rtype: One of VSYNC_OFF, VSYNC_ON, VSYNC_ADAPTIVE
|
||||
|
||||
.. function:: offScreenCreate(width,height[,samples=0][,target=bge.render.RAS_OFS_RENDER_BUFFER])
|
||||
|
||||
Create a Off-screen render buffer object.
|
||||
|
||||
:arg width: the width of the buffer in pixels
|
||||
:type width: integer
|
||||
:arg height: the height of the buffer in pixels
|
||||
:type height: integer
|
||||
:arg samples: the number of multisample for anti-aliasing (MSAA), 0 to disable MSAA
|
||||
:type samples: integer
|
||||
:arg target: the pixel storage: :data:`RAS_OFS_RENDER_BUFFER` to render on RenderBuffers (the default),
|
||||
:data:`RAS_OFS_RENDER_TEXTURE` to render on texture.
|
||||
The later is interesting if you want to access the texture directly (see :attr:`RASOffScreen.color`).
|
||||
Otherwise the default is preferable as it's more widely supported by GPUs and more efficient.
|
||||
If the GPU does not support MSAA+Texture (e.g. Intel HD GPU), MSAA will be disabled.
|
||||
:type target: integer
|
||||
:rtype: :class:`RASOffScreen`
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -214,16 +214,6 @@ base class --- :class:`PyObjectPlus`
|
||||
:arg iList: a list (2, 3 or 4 elements) of integer values
|
||||
:type iList: list[integer]
|
||||
|
||||
.. method:: setUniformEyef(name)
|
||||
|
||||
Set a uniform with a float value that reflects the eye being render in stereo mode:
|
||||
0.0 for the left eye, 0.5 for the right eye. In non stereo mode, the value of the uniform
|
||||
is fixed to 0.0. The typical use of this uniform is in stereo mode to sample stereo textures
|
||||
containing the left and right eye images in a top-bottom order.
|
||||
|
||||
:arg name: the uniform name
|
||||
:type name: string
|
||||
|
||||
.. method:: validate()
|
||||
|
||||
Validate the shader object.
|
||||
|
@@ -59,7 +59,7 @@ base class --- :class:`SCA_IActuator`
|
||||
|
||||
.. attribute:: mode
|
||||
|
||||
The operation mode of the actuator. Can be one of :ref:`these constants<action-actuator>`.
|
||||
The operation mode of the actuator. Can be one of :ref:`these constants<shape-action-actuator>`.
|
||||
|
||||
:type: integer
|
||||
|
||||
@@ -68,3 +68,5 @@ base class --- :class:`SCA_IActuator`
|
||||
The name of the property that is set to the current frame number.
|
||||
|
||||
:type: string
|
||||
|
||||
|
||||
|
@@ -405,7 +405,7 @@ base class --- :class:`SCA_IObject`
|
||||
|
||||
.. note::
|
||||
|
||||
This attribute is experimental and may be removed (but probably wont be).
|
||||
This attribute is experemental and may be removed (but probably wont be).
|
||||
|
||||
.. note::
|
||||
|
||||
@@ -419,7 +419,7 @@ base class --- :class:`SCA_IObject`
|
||||
|
||||
.. note::
|
||||
|
||||
This attribute is experimental and may be removed (but probably wont be).
|
||||
This attribute is experemental and may be removed (but probably wont be).
|
||||
|
||||
.. note::
|
||||
|
||||
@@ -453,7 +453,7 @@ base class --- :class:`SCA_IObject`
|
||||
|
||||
.. attribute:: childrenRecursive
|
||||
|
||||
all children of this object including children's children, (read-only).
|
||||
all children of this object including childrens children, (read-only).
|
||||
|
||||
:type: :class:`CListValue` of :class:`KX_GameObject`'s
|
||||
|
||||
@@ -536,7 +536,7 @@ base class --- :class:`SCA_IObject`
|
||||
|
||||
.. method:: getAxisVect(vect)
|
||||
|
||||
Returns the axis vector rotates by the object's worldspace orientation.
|
||||
Returns the axis vector rotates by the objects worldspace orientation.
|
||||
This is the equivalent of multiplying the vector by the orientation matrix.
|
||||
|
||||
:arg vect: a vector to align the axis.
|
||||
@@ -596,7 +596,7 @@ base class --- :class:`SCA_IObject`
|
||||
|
||||
Gets the game object's linear velocity.
|
||||
|
||||
This method returns the game object's velocity through it's center of mass, ie no angular velocity component.
|
||||
This method returns the game object's velocity through it's centre of mass, ie no angular velocity component.
|
||||
|
||||
:arg local:
|
||||
* False: you get the "global" velocity ie: relative to world orientation.
|
||||
@@ -609,7 +609,7 @@ base class --- :class:`SCA_IObject`
|
||||
|
||||
Sets the game object's linear velocity.
|
||||
|
||||
This method sets game object's velocity through it's center of mass,
|
||||
This method sets game object's velocity through it's centre of mass,
|
||||
ie no angular velocity component.
|
||||
|
||||
This requires a dynamic object.
|
||||
@@ -814,7 +814,7 @@ base class --- :class:`SCA_IObject`
|
||||
# do something
|
||||
pass
|
||||
|
||||
The face parameter determines the orientation of the normal.
|
||||
The face paremeter determines the orientation of the normal.
|
||||
|
||||
* 0 => hit normal is always oriented towards the ray origin (as if you casted the ray from outside)
|
||||
* 1 => hit normal is the real face normal (only for mesh object, otherwise face has no effect)
|
||||
@@ -911,7 +911,7 @@ base class --- :class:`SCA_IObject`
|
||||
|
||||
.. note::
|
||||
|
||||
The gameObject argument has an advantage that it can convert from a mesh with modifiers applied (such as the Subdivision Surface modifier).
|
||||
The gameObject argument has an advantage that it can convert from a mesh with modifiers applied (such as subsurf).
|
||||
|
||||
.. warning::
|
||||
|
||||
@@ -919,7 +919,7 @@ base class --- :class:`SCA_IObject`
|
||||
|
||||
.. warning::
|
||||
|
||||
If the object is a part of a compound object it will fail (parent or child)
|
||||
If the object is a part of a combound object it will fail (parent or child)
|
||||
|
||||
.. warning::
|
||||
|
||||
|
@@ -60,37 +60,37 @@ base class --- :class:`KX_GameObject`
|
||||
|
||||
:type: float (read only)
|
||||
|
||||
.. attribute:: shadowFrustumSize
|
||||
..attribute:: shadowFrustumSize
|
||||
|
||||
Size of the frustum used for creating the shadowmap.
|
||||
|
||||
:type: float (read only)
|
||||
|
||||
.. attribute:: shadowBindId
|
||||
..attribute:: shadowBindId
|
||||
|
||||
The OpenGL shadow texture bind number/id.
|
||||
|
||||
:type: int (read only)
|
||||
|
||||
.. attribute:: shadowMapType
|
||||
..attribute:: shadowMapType
|
||||
|
||||
The shadow shadow map type (0 -> Simple; 1 -> Variance)
|
||||
|
||||
:type: int (read only)
|
||||
|
||||
.. attribute:: shadowBias
|
||||
..attribute:: shadowBias
|
||||
|
||||
The shadow buffer sampling bias.
|
||||
|
||||
:type: float (read only)
|
||||
|
||||
.. attribute:: shadowBleedBias
|
||||
..attribute:: shadowBleedBias
|
||||
|
||||
The bias for reducing light-bleed on variance shadow maps.
|
||||
|
||||
:type: float (read only)
|
||||
|
||||
.. attribute:: useShadow
|
||||
..attribute:: useShadow
|
||||
|
||||
Returns True if the light has Shadow option activated, else returns False.
|
||||
|
||||
|
@@ -12,13 +12,13 @@ base class --- :class:`PyObjectPlus`
|
||||
.. attribute:: name
|
||||
|
||||
The name assigned to the joystick by the operating system. (read-only)
|
||||
|
||||
|
||||
:type: string
|
||||
|
||||
.. attribute:: activeButtons
|
||||
|
||||
A list of active button values. (read-only)
|
||||
|
||||
|
||||
:type: list
|
||||
|
||||
.. attribute:: axisValues
|
||||
@@ -27,10 +27,8 @@ base class --- :class:`PyObjectPlus`
|
||||
|
||||
:type: list of ints.
|
||||
|
||||
Each specifying the value of an axis between -1.0 and 1.0
|
||||
depending on how far the axis is pushed, 0 for nothing.
|
||||
The first 2 values are used by most joysticks and gamepads for directional control.
|
||||
3rd and 4th values are only on some joysticks and can be used for arbitary controls.
|
||||
Each specifying the value of an axis between -1.0 and 1.0 depending on how far the axis is pushed, 0 for nothing.
|
||||
The first 2 values are used by most joysticks and gamepads for directional control. 3rd and 4th values are only on some joysticks and can be used for arbitary controls.
|
||||
|
||||
* left:[-1.0, 0.0, ...]
|
||||
* right:[1.0, 0.0, ...]
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -6,13 +6,6 @@ GPU functions (gpu)
|
||||
|
||||
This module provides access to materials GLSL shaders.
|
||||
|
||||
Submodules:
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 1
|
||||
|
||||
gpu.offscreen.rst
|
||||
|
||||
|
||||
Intro
|
||||
=====
|
||||
@@ -31,6 +24,7 @@ and in the game engine.
|
||||
Constants
|
||||
=========
|
||||
|
||||
|
||||
GLSL Data Type
|
||||
--------------
|
||||
|
||||
|
@@ -1,23 +1,19 @@
|
||||
..
|
||||
This document is appended to the auto generated bmesh api doc to avoid clogging up the C files with details.
|
||||
to test this run:
|
||||
./blender.bin -b -noaudio -P doc/python_api/sphinx_doc_gen.py -- \
|
||||
--partial bmesh* ; cd doc/python_api ; sphinx-build sphinx-in sphinx-out ; cd ../../
|
||||
./blender.bin -b -noaudio -P doc/python_api/sphinx_doc_gen.py -- --partial bmesh* ; cd doc/python_api ; sphinx-build sphinx-in sphinx-out ; cd ../../
|
||||
|
||||
|
||||
Submodules:
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 1
|
||||
|
||||
bmesh.ops.rst
|
||||
bmesh.types.rst
|
||||
bmesh.utils.rst
|
||||
bmesh.geometry.rst
|
||||
* :mod:`bmesh.ops`
|
||||
* :mod:`bmesh.types`
|
||||
* :mod:`bmesh.utils`
|
||||
* :mod:`bmesh.geometry`
|
||||
|
||||
|
||||
Introduction
|
||||
------------
|
||||
Intro
|
||||
-----
|
||||
|
||||
This API gives access the blenders internal mesh editing api, featuring geometry connectivity data and
|
||||
access to editing operations such as split, separate, collapse and dissolve.
|
||||
@@ -26,7 +22,7 @@ The features exposed closely follow the C API,
|
||||
giving python access to the functions used by blenders own mesh editing tools.
|
||||
|
||||
For an overview of BMesh data types and how they reference each other see:
|
||||
`BMesh Design Document <https://wiki.blender.org/index.php/Dev:Source/Modeling/BMesh/Design>`_ .
|
||||
`BMesh Design Document <http://wiki.blender.org/index.php/Dev:2.6/Source/Modeling/BMesh/Design>`_ .
|
||||
|
||||
|
||||
.. note::
|
||||
@@ -34,16 +30,17 @@ For an overview of BMesh data types and how they reference each other see:
|
||||
**Disk** and **Radial** data is not exposed by the python api since this is for internal use only.
|
||||
|
||||
|
||||
.. warning:: TODO items are...
|
||||
.. warning::
|
||||
|
||||
TODO items are...
|
||||
|
||||
* add access to BMesh **walkers**
|
||||
* add custom-data manipulation functions add/remove/rename.
|
||||
|
||||
|
||||
Example Script
|
||||
--------------
|
||||
|
||||
.. literalinclude:: __/__/__/release/scripts/templates_py/bmesh_simple.py
|
||||
.. literalinclude:: ../../../release/scripts/templates_py/bmesh_simple.py
|
||||
|
||||
|
||||
Stand-Alone Module
|
||||
@@ -62,9 +59,9 @@ There are 2 ways to access BMesh data, you can create a new BMesh by converting
|
||||
:class:`bpy.types.BlendData.meshes` or by accessing the current edit mode mesh.
|
||||
see: :class:`bmesh.types.BMesh.from_mesh` and :mod:`bmesh.from_edit_mesh` respectively.
|
||||
|
||||
When explicitly converting from mesh data python **owns** the data, that is to say -
|
||||
that the mesh only exists while python holds a reference to it,
|
||||
and the script is responsible for putting it back into a mesh data-block when the edits are done.
|
||||
When explicitly converting from mesh data python **owns** the data, that is to say - that the mesh only exists while
|
||||
python holds a reference to it, and the script is responsible for putting it back into a mesh data-block when the edits
|
||||
are done.
|
||||
|
||||
Note that unlike :mod:`bpy`, a BMesh does not necessarily correspond to data in the currently open blend file,
|
||||
a BMesh can be created, edited and freed without the user ever seeing or having access to it.
|
||||
|
@@ -204,7 +204,7 @@ Lets say we want to access the texture of a brush via Python, to adjust its ``co
|
||||
|
||||
- Start in the default scene and enable 'Sculpt' mode from the 3D-View header.
|
||||
- From the toolbar expand the **Texture** panel and add a new texture.
|
||||
*Notice the texture button its self doesn't have very useful links (you can check the tooltips).*
|
||||
*Notice the texture button its self doesn't have very useful links (you can check the tool-tips).*
|
||||
- The contrast setting isn't exposed in the sculpt toolbar, so view the texture in the properties panel...
|
||||
|
||||
- In the properties button select the Texture context.
|
||||
|
@@ -18,7 +18,7 @@ amongst our own scripts and make it easier to use python scripts from other proj
|
||||
|
||||
Using our style guide for your own scripts makes it easier if you eventually want to contribute them to blender.
|
||||
|
||||
This style guide is known as pep8 and can be found `here <https://www.python.org/dev/peps/pep-0008/>`_
|
||||
This style guide is known as pep8 and can be found `here <http://www.python.org/dev/peps/pep-0008>`_
|
||||
|
||||
A brief listing of pep8 criteria.
|
||||
|
||||
@@ -316,7 +316,7 @@ use to join a list of strings (the list may be temporary). In the following exam
|
||||
|
||||
|
||||
Join is fastest on many strings,
|
||||
`string formatting <https://wiki.blender.org/index.php/Dev:Source/Modeling/BMesh/Design>`__
|
||||
`string formatting <http://docs.python.org/py3k/library/string.html#string-formatting>`__
|
||||
is quite fast too (better for converting data types). String arithmetic is slowest.
|
||||
|
||||
|
||||
|
@@ -1,4 +1,3 @@
|
||||
|
||||
*******
|
||||
Gotchas
|
||||
*******
|
||||
@@ -39,6 +38,7 @@ but some operators are more picky about when they run.
|
||||
In most cases you can figure out what context an operator needs
|
||||
simply be seeing how it's used in Blender and thinking about what it does.
|
||||
|
||||
|
||||
Unfortunately if you're still stuck - the only way to **really** know
|
||||
whats going on is to read the source code for the poll function and see what its checking.
|
||||
|
||||
@@ -82,6 +82,7 @@ it should be reported to the bug tracker.
|
||||
Stale Data
|
||||
==========
|
||||
|
||||
|
||||
No updates after setting values
|
||||
-------------------------------
|
||||
|
||||
@@ -173,8 +174,8 @@ In this situation you can...
|
||||
|
||||
.. _info_gotcha_mesh_faces:
|
||||
|
||||
N-Gons and Tessellation Faces
|
||||
=============================
|
||||
NGons and Tessellation Faces
|
||||
============================
|
||||
|
||||
Since 2.63 NGons are supported, this adds some complexity
|
||||
since in some cases you need to access triangles/quads still (some exporters for example).
|
||||
@@ -508,7 +509,7 @@ Unicode Problems
|
||||
Python supports many different encodings so there is nothing stopping you from
|
||||
writing a script in ``latin1`` or ``iso-8859-15``.
|
||||
|
||||
See `pep-0263 <https://www.python.org/dev/peps/pep-0263/>`_
|
||||
See `pep-0263 <http://www.python.org/dev/peps/pep-0263/>`_
|
||||
|
||||
However this complicates matters for Blender's Python API because ``.blend`` files don't have an explicit encoding.
|
||||
|
||||
@@ -656,7 +657,7 @@ Here are some general hints to avoid running into these problems.
|
||||
.. note::
|
||||
|
||||
To find the line of your script that crashes you can use the ``faulthandler`` module.
|
||||
See the `faulthandler docs <https://docs.python.org/dev/library/faulthandler.html>`_.
|
||||
See `faulthandler docs <http://docs.python.org/dev/library/faulthandler.html>`_.
|
||||
|
||||
While the crash may be in Blenders C/C++ code,
|
||||
this can help a lot to track down the area of the script that causes the crash.
|
||||
|
@@ -5,25 +5,23 @@
|
||||
Python API Overview
|
||||
*******************
|
||||
|
||||
The purpose of this document is to explain how Python and Blender fit together,
|
||||
covering some of the functionality that may not be obvious from reading the API
|
||||
references and example scripts.
|
||||
This document is to give an understanding of how Python and Blender fit together,
|
||||
covering some of the functionality that isn't obvious from reading the API reference and example scripts.
|
||||
|
||||
|
||||
Python in Blender
|
||||
=================
|
||||
|
||||
Blender has an embedded Python interpreter which is loaded when Blender is started and stays
|
||||
active while Blender is running. This interpreter runs scripts to draw the user interface
|
||||
and is used for some of Blender’s internal tools as well.
|
||||
Blender embeds a Python interpreter which is started with Blender and stays active.
|
||||
This interpreter runs scripts to draw the user interface and is used for some of Blender's internal tools too.
|
||||
|
||||
Blender's embedded interpreter provides a typical Python environment, so code from tutorials
|
||||
on how to write Python scripts can also be run with Blender’s interpreter. Blender provides its
|
||||
Python modules, such as :mod:`bpy` and :mod:`mathutils`, to the embedded interpreter so they can
|
||||
be imported into a script and give access to Blender's data, classes, and functions. Scripts that
|
||||
deal with Blender data will need to import the modules to work.
|
||||
This is a typical Python environment so tutorials on how to write Python scripts
|
||||
will work running the scripts in Blender too.
|
||||
Blender provides the :mod:`bpy` module to the Python interpreter.
|
||||
This module can be imported in a script and gives access to Blender data, classes, and functions.
|
||||
Scripts that deal with Blender data will need to import this module.
|
||||
|
||||
Here is a simple example which moves a vertex attached to an object named **Cube**:
|
||||
Here is a simple example of moving a vertex of the object named **Cube**:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
@@ -45,23 +43,22 @@ scene manipulation, automation, defining your own toolset and customization.
|
||||
|
||||
On startup Blender scans the ``scripts/startup/`` directory for Python modules and imports them.
|
||||
The exact location of this directory depends on your installation.
|
||||
See the :ref:`directory layout docs <blender_manual:getting-started_installing-config-directories>`.
|
||||
`See the directory layout docs
|
||||
<https://www.blender.org/manual/getting_started/installing_blender/directorylayout.html>`__
|
||||
|
||||
|
||||
Script Loading
|
||||
==============
|
||||
|
||||
This may seem obvious, but it is important to note the difference between
|
||||
executing a script directly and importing a script as a module.
|
||||
This may seem obvious but it's important to note the difference
|
||||
between executing a script directly or importing it as a module.
|
||||
|
||||
Extending Blender by executing a script directly means the classes that the script
|
||||
defines remain available inside Blender after the script finishes execution.
|
||||
Using scripts this way makes future access to their classes
|
||||
(to unregister them for example) more difficult compared to importing the scripts as modules.
|
||||
When a script is imported as a module, its class instances will remain
|
||||
inside the module and can be accessed later on by importing that module again.
|
||||
Scripts that extend Blender - define classes that exist beyond the scripts execution,
|
||||
this makes future access to these classes (to unregister for example)
|
||||
more difficult than importing as a module where class instance is kept
|
||||
in the module and can be accessed by importing that module later on.
|
||||
|
||||
For this reason it is preferable to avoid directly executing scripts that extend Blender by registering classes.
|
||||
For this reason it's preferable to only use directly execute scripts that don't extend Blender by registering classes.
|
||||
|
||||
|
||||
Here are some ways to run scripts directly in Blender.
|
||||
@@ -80,22 +77,22 @@ To run as modules:
|
||||
- The obvious way, ``import some_module`` command from the text window or interactive console.
|
||||
- Open as a text block and tick "Register" option, this will load with the blend file.
|
||||
- copy into one of the directories ``scripts/startup``, where they will be automatically imported on startup.
|
||||
- define as an add-on, enabling the add-on will load it as a Python module.
|
||||
- define as an addon, enabling the addon will load it as a Python module.
|
||||
|
||||
|
||||
Add-ons
|
||||
-------
|
||||
Addons
|
||||
------
|
||||
|
||||
Some of Blenders functionality is best kept optional,
|
||||
alongside scripts loaded at startup we have add-ons which are kept in their own directory ``scripts/addons``,
|
||||
alongside scripts loaded at startup we have addons which are kept in their own directory ``scripts/addons``,
|
||||
and only load on startup if selected from the user preferences.
|
||||
|
||||
The only difference between add-ons and built-in Python modules is that add-ons must contain a ``bl_info``
|
||||
The only difference between addons and built-in Python modules is that addons must contain a ``bl_info``
|
||||
variable which Blender uses to read metadata such as name, author, category and URL.
|
||||
|
||||
The User Preferences add-on listing uses **bl_info** to display information about each add-on.
|
||||
The user preferences addon listing uses **bl_info** to display information about each addon.
|
||||
|
||||
`See Add-ons <https://wiki.blender.org/index.php/Dev:Py/Scripts/Guidelines/Addons>`__
|
||||
`See Addons <http://wiki.blender.org/index.php/Dev:2.5/Py/Scripts/Guidelines/Addons>`__
|
||||
for details on the ``bl_info`` dictionary.
|
||||
|
||||
|
||||
@@ -217,7 +214,7 @@ A simple Blender/Python module can look like this:
|
||||
bpy.utils.register_class(SimpleOperator)
|
||||
|
||||
def unregister():
|
||||
bpy.utils.unregister_class(SimpleOperator)
|
||||
bpy.utils.unregister_class(SimpleOperator)
|
||||
|
||||
if __name__ == "__main__":
|
||||
register()
|
||||
@@ -226,7 +223,7 @@ These functions usually appear at the bottom of the script containing class regi
|
||||
You can also use them for internal purposes setting up data for your own tools but take care
|
||||
since register won't re-run when a new blend file is loaded.
|
||||
|
||||
The register/unregister calls are used so it's possible to toggle add-ons and reload scripts while Blender runs.
|
||||
The register/unregister calls are used so it's possible to toggle addons and reload scripts while Blender runs.
|
||||
If the register calls were placed in the body of the script, registration would be called on import,
|
||||
meaning there would be no distinction between importing a module or loading its classes into Blender.
|
||||
|
||||
@@ -331,7 +328,7 @@ Say you want to store material settings for a custom engine.
|
||||
.. note::
|
||||
|
||||
*The class must be registered before being used in a property, failing to do so will raise an error:*
|
||||
|
||||
|
||||
``ValueError: bpy_struct "Material" registration error: my_custom_props could not register``
|
||||
|
||||
|
||||
@@ -400,8 +397,8 @@ This works just as well for PropertyGroup subclasses you define yourself.
|
||||
Dynamic Defined-Classes (Advanced)
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
In some cases the specifier for data may not be in Blender, renderman shader definitions
|
||||
for example, and it may be useful to define them as types and remove them on the fly.
|
||||
In some cases the specifier for data may not be in Blender,
|
||||
renderman shader definitions for example and it may be useful to define types and remove them on the fly.
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
@@ -424,7 +421,7 @@ for example, and it may be useful to define them as types and remove them on the
|
||||
This is an alternative syntax for class creation in Python, better suited to constructing classes dynamically.
|
||||
|
||||
|
||||
To call the operators from the previous example:
|
||||
Calling these operators:
|
||||
|
||||
>>> bpy.ops.object.operator_1()
|
||||
Hello World OBJECT_OT_operator_1
|
||||
@@ -433,3 +430,4 @@ To call the operators from the previous example:
|
||||
>>> bpy.ops.object.operator_2()
|
||||
Hello World OBJECT_OT_operator_2
|
||||
{'FINISHED'}
|
||||
|
||||
|
@@ -51,7 +51,8 @@ A quick list of helpful things to know before starting:
|
||||
| ``scripts/startup/bl_operators`` for operators.
|
||||
|
||||
Exact location depends on platform, see:
|
||||
:ref:`Configuration and Data Paths <blender_manual:getting-started_installing-config-directories>`.
|
||||
`Configuration and Data Paths
|
||||
<https://www.blender.org/manual/getting_started/installing_blender/directorylayout.html>`__.
|
||||
|
||||
|
||||
Running Scripts
|
||||
@@ -150,7 +151,7 @@ Data Creation/Removal
|
||||
^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
Those of you familiar with other Python API's may be surprised that
|
||||
new data-blocks in the bpy API can't be created by calling the class:
|
||||
new datablocks in the bpy API can't be created by calling the class:
|
||||
|
||||
>>> bpy.types.Mesh()
|
||||
Traceback (most recent call last):
|
||||
@@ -304,7 +305,7 @@ In Python, this is done by defining a class, which is a subclass of an existing
|
||||
Example Operator
|
||||
----------------
|
||||
|
||||
.. literalinclude:: __/__/__/release/scripts/templates_py/operator_simple.py
|
||||
.. literalinclude:: ../../../release/scripts/templates_py/operator_simple.py
|
||||
|
||||
Once this script runs, ``SimpleOperator`` is registered with Blender
|
||||
and can be called from the operator search popup or added to the toolbar.
|
||||
@@ -335,7 +336,7 @@ Example Panel
|
||||
Panels register themselves as a class, like an operator.
|
||||
Notice the extra ``bl_`` variables used to set the context they display in.
|
||||
|
||||
.. literalinclude:: __/__/__/release/scripts/templates_py/ui_panel_simple.py
|
||||
.. literalinclude:: ../../../release/scripts/templates_py/ui_panel_simple.py
|
||||
|
||||
To run the script:
|
||||
|
||||
@@ -392,11 +393,11 @@ so these are accessed as normal Python types.
|
||||
Internal Types
|
||||
--------------
|
||||
|
||||
Used for Blender data-blocks and collections: :class:`bpy.types.bpy_struct`
|
||||
Used for Blender datablocks and collections: :class:`bpy.types.bpy_struct`
|
||||
|
||||
For data that contains its own attributes groups/meshes/bones/scenes... etc.
|
||||
|
||||
There are 2 main types that wrap Blenders data, one for data-blocks
|
||||
There are 2 main types that wrap Blenders data, one for datablocks
|
||||
(known internally as ``bpy_struct``), another for properties.
|
||||
|
||||
>>> bpy.context.object
|
||||
|
@@ -27,7 +27,7 @@ There are 3 main uses for the terminal, these are:
|
||||
|
||||
.. note::
|
||||
|
||||
For Linux and macOS users this means starting the terminal first, then running Blender from within it.
|
||||
For Linux and OSX users this means starting the terminal first, then running Blender from within it.
|
||||
On Windows the terminal can be enabled from the help menu.
|
||||
|
||||
|
||||
@@ -306,7 +306,7 @@ Advantages include:
|
||||
This is marked advanced because to run Blender as a Python module requires a special build option.
|
||||
|
||||
For instructions on building see
|
||||
`Building Blender as a Python module <https://wiki.blender.org/index.php/User:Ideasman42/BlenderAsPyModule>`_
|
||||
`Building Blender as a Python module <http://wiki.blender.org/index.php/User:Ideasman42/BlenderAsPyModule>`_
|
||||
|
||||
|
||||
Python Safety (Build Option)
|
||||
|
643
doc/python_api/rst/info_tutorial_addon.rst
Normal file
643
doc/python_api/rst/info_tutorial_addon.rst
Normal file
@@ -0,0 +1,643 @@
|
||||
|
||||
Addon Tutorial
|
||||
##############
|
||||
|
||||
************
|
||||
Introduction
|
||||
************
|
||||
|
||||
|
||||
Intended Audience
|
||||
=================
|
||||
|
||||
This tutorial is designed to help technical artists or developers learn to extend Blender.
|
||||
An understanding of the basics of Python is expected for those working through this tutorial.
|
||||
|
||||
|
||||
Prerequisites
|
||||
-------------
|
||||
|
||||
Before going through the tutorial you should...
|
||||
|
||||
- Familiarity with the basics of working in Blender.
|
||||
- Know how to run a script in Blender's text editor (as documented in the quick-start)
|
||||
- Have an understanding of Python primitive types (int, boolean, string, list, tuple, dictionary, and set).
|
||||
- Be familiar with the concept of Python modules.
|
||||
- Basic understanding of classes (object orientation) in Python.
|
||||
|
||||
|
||||
Suggested reading before starting this tutorial.
|
||||
|
||||
- `Dive Into Python <http://getpython3.com/diveintopython3/index.html>`_ sections (1, 2, 3, 4, and 7).
|
||||
- :ref:`Blender API Quickstart <info_quickstart>`
|
||||
to help become familiar with Blender/Python basics.
|
||||
|
||||
|
||||
To best troubleshoot any error message Python prints while writing scripts you run blender with from a terminal,
|
||||
see :ref:`Use The Terminal <use_the_terminal>`.
|
||||
|
||||
Documentation Links
|
||||
===================
|
||||
|
||||
While going through the tutorial you may want to look into our reference documentation.
|
||||
|
||||
- :ref:`Blender API Overview <info_overview>`. -
|
||||
*This document is rather detailed but helpful if you want to know more on a topic.*
|
||||
- :mod:`bpy.context` api reference. -
|
||||
*Handy to have a list of available items your script may operate on.*
|
||||
- :class:`bpy.types.Operator`. -
|
||||
*The following addons define operators, these docs give details and more examples of operators.*
|
||||
|
||||
|
||||
******
|
||||
Addons
|
||||
******
|
||||
|
||||
|
||||
What is an Addon?
|
||||
=================
|
||||
|
||||
An addon is simply a Python module with some additional requirements so Blender can display it in a list with useful
|
||||
information.
|
||||
|
||||
To give an example, here is the simplest possible addon.
|
||||
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
bl_info = {"name": "My Test Addon", "category": "Object"}
|
||||
def register():
|
||||
print("Hello World")
|
||||
def unregister():
|
||||
print("Goodbye World")
|
||||
|
||||
|
||||
- ``bl_info`` is a dictionary containing addon meta-data such as the title, version and author to be displayed in the
|
||||
user preferences addon list.
|
||||
- ``register`` is a function which only runs when enabling the addon, this means the module can be loaded without
|
||||
activating the addon.
|
||||
- ``unregister`` is a function to unload anything setup by ``register``, this is called when the addon is disabled.
|
||||
|
||||
|
||||
|
||||
Notice this addon does not do anything related to Blender, (the :mod:`bpy` module is not imported for example).
|
||||
|
||||
This is a contrived example of an addon that serves to illustrate the point
|
||||
that the base requirements of an addon are simple.
|
||||
|
||||
An addon will typically register operators, panels, menu items etc, but its worth noting that _any_ script can do this,
|
||||
when executed from the text editor or even the interactive console - there is nothing inherently different about an
|
||||
addon that allows it to integrate with Blender, such functionality is just provided by the :mod:`bpy` module for any
|
||||
script to access.
|
||||
|
||||
So an addon is just a way to encapsulate a Python module in a way a user can easily utilize.
|
||||
|
||||
.. note::
|
||||
|
||||
Running this script within the text editor won't print anything,
|
||||
to see the output it must be installed through the user preferences.
|
||||
Messages will be printed when enabling and disabling.
|
||||
|
||||
|
||||
Your First Addon
|
||||
================
|
||||
|
||||
The simplest possible addon above was useful as an example but not much else.
|
||||
This next addon is simple but shows how to integrate a script into Blender using an ``Operator``
|
||||
which is the typical way to define a tool accessed from menus, buttons and keyboard shortcuts.
|
||||
|
||||
For the first example we'll make a script that simply moves all objects in a scene.
|
||||
|
||||
|
||||
Write The Script
|
||||
----------------
|
||||
|
||||
Add the following script to the text editor in Blender.
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
import bpy
|
||||
|
||||
scene = bpy.context.scene
|
||||
for obj in scene.objects:
|
||||
obj.location.x += 1.0
|
||||
|
||||
|
||||
.. image:: run_script.png
|
||||
:width: 924px
|
||||
:align: center
|
||||
:height: 574px
|
||||
:alt: Run Script button
|
||||
|
||||
Click the Run Script button, all objects in the active scene are moved by 1.0 Blender unit.
|
||||
Next we'll make this script into an addon.
|
||||
|
||||
|
||||
Write the Addon (Simple)
|
||||
------------------------
|
||||
|
||||
This addon takes the body of the script above, and adds them to an operator's ``execute()`` function.
|
||||
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
bl_info = {
|
||||
"name": "Move X Axis",
|
||||
"category": "Object",
|
||||
}
|
||||
|
||||
import bpy
|
||||
|
||||
|
||||
class ObjectMoveX(bpy.types.Operator):
|
||||
"""My Object Moving Script""" # blender will use this as a tooltip for menu items and buttons.
|
||||
bl_idname = "object.move_x" # unique identifier for buttons and menu items to reference.
|
||||
bl_label = "Move X by One" # display name in the interface.
|
||||
bl_options = {'REGISTER', 'UNDO'} # enable undo for the operator.
|
||||
|
||||
def execute(self, context): # execute() is called by blender when running the operator.
|
||||
|
||||
# The original script
|
||||
scene = context.scene
|
||||
for obj in scene.objects:
|
||||
obj.location.x += 1.0
|
||||
|
||||
return {'FINISHED'} # this lets blender know the operator finished successfully.
|
||||
|
||||
def register():
|
||||
bpy.utils.register_class(ObjectMoveX)
|
||||
|
||||
|
||||
def unregister():
|
||||
bpy.utils.unregister_class(ObjectMoveX)
|
||||
|
||||
|
||||
# This allows you to run the script directly from blenders text editor
|
||||
# to test the addon without having to install it.
|
||||
if __name__ == "__main__":
|
||||
register()
|
||||
|
||||
|
||||
.. note::
|
||||
|
||||
``bl_info`` is split across multiple lines, this is just a style convention used to more easily add items.
|
||||
|
||||
.. note::
|
||||
|
||||
Rather than using ``bpy.context.scene``, we use the ``context.scene`` argument passed to ``execute()``.
|
||||
In most cases these will be the same however in some cases operators will be passed a custom context
|
||||
so script authors should prefer the ``context`` argument passed to operators.
|
||||
|
||||
To test the script you can copy and paste this into Blender text editor and run it, this will execute the script
|
||||
directly and call register immediately.
|
||||
|
||||
However running the script wont move any objects, for this you need to execute the newly registered operator.
|
||||
|
||||
.. image:: spacebar.png
|
||||
:width: 924px
|
||||
:align: center
|
||||
:height: 574px
|
||||
:alt: Spacebar
|
||||
|
||||
Do this by pressing :kbd:`Spacebar` to bring up the operator search dialog and type in
|
||||
"Move X by One" (the ``bl_label``), then :kbd:`Enter`.
|
||||
|
||||
|
||||
|
||||
The objects should move as before.
|
||||
|
||||
*Keep this addon open in Blender for the next step - Installing.*
|
||||
|
||||
|
||||
Install The Addon
|
||||
-----------------
|
||||
|
||||
Once you have your addon within in Blender's text editor,
|
||||
you will want to be able to install it so it can be enabled in the user preferences to load on startup.
|
||||
|
||||
Even though the addon above is a test, lets go through the steps anyway so you know how to do it for later.
|
||||
|
||||
To install the Blender text as an addon you will first have to save it to disk, take care to obey the naming
|
||||
restrictions that apply to Python modules and end with a ``.py`` extension.
|
||||
|
||||
Once the file is on disk, you can install it as you would for an addon downloaded online.
|
||||
|
||||
Open the user :menuselection:`File -> User Preferences`,
|
||||
Select the *Addon* section, press *Install Addon...* and select the file.
|
||||
|
||||
Now the addon will be listed and you can enable it by pressing the check-box,
|
||||
if you want it to be enabled on restart, press *Save as Default*.
|
||||
|
||||
.. note::
|
||||
|
||||
The destination of the addon depends on your Blender configuration.
|
||||
When installing an addon the source and destination path are printed in the console.
|
||||
You can also find addon path locations by running this in the Python console.
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
import addon_utils
|
||||
print(addon_utils.paths())
|
||||
|
||||
More is written on this topic here:
|
||||
`Directory Layout <https://www.blender.org/manual/getting_started/installing_blender/directorylayout.html>`_
|
||||
|
||||
|
||||
Your Second Addon
|
||||
=================
|
||||
|
||||
For our second addon, we will focus on object instancing - this is - to make linked copies of an object in a
|
||||
similar way to what you may have seen with the array modifier.
|
||||
|
||||
|
||||
Write The Script
|
||||
----------------
|
||||
|
||||
As before, first we will start with a script, develop it, then convert into an addon.
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
import bpy
|
||||
from bpy import context
|
||||
|
||||
# Get the current scene
|
||||
scene = context.scene
|
||||
|
||||
# Get the 3D cursor
|
||||
cursor = scene.cursor_location
|
||||
|
||||
# Get the active object (assume we have one)
|
||||
obj = scene.objects.active
|
||||
|
||||
# Now make a copy of the object
|
||||
obj_new = obj.copy()
|
||||
|
||||
# The object won't automatically get into a new scene
|
||||
scene.objects.link(obj_new)
|
||||
|
||||
# Now we can place the object
|
||||
obj_new.location = cursor
|
||||
|
||||
|
||||
Now try copy this script into Blender and run it on the default cube.
|
||||
Make sure you click to move the 3D cursor before running as the duplicate will appear at the cursor's location.
|
||||
|
||||
|
||||
... go off and test ...
|
||||
|
||||
|
||||
After running, notice that when you go into edit-mode to change the cube - all of the copies change,
|
||||
in Blender this is known as *Linked-Duplicates*.
|
||||
|
||||
|
||||
Next, we're going to do this in a loop, to make an array of objects between the active object and the cursor.
|
||||
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
import bpy
|
||||
from bpy import context
|
||||
|
||||
scene = context.scene
|
||||
cursor = scene.cursor_location
|
||||
obj = scene.objects.active
|
||||
|
||||
# Use a fixed value for now, eventually make this user adjustable
|
||||
total = 10
|
||||
|
||||
# Add 'total' objects into the scene
|
||||
for i in range(total):
|
||||
obj_new = obj.copy()
|
||||
scene.objects.link(obj_new)
|
||||
|
||||
# Now place the object in between the cursor
|
||||
# and the active object based on 'i'
|
||||
factor = i / total
|
||||
obj_new.location = (obj.location * factor) + (cursor * (1.0 - factor))
|
||||
|
||||
|
||||
Try run this script with with the active object and the cursor spaced apart to see the result.
|
||||
|
||||
With this script you'll notice we're doing some math with the object location and cursor, this works because both are
|
||||
3D :class:`mathutils.Vector` instances, a convenient class provided by the :mod:`mathutils` module and
|
||||
allows vectors to be multiplied by numbers and matrices.
|
||||
|
||||
If you are interested in this area, read into :class:`mathutils.Vector` - there are many handy utility functions
|
||||
such as getting the angle between vectors, cross product, dot products
|
||||
as well as more advanced functions in :mod:`mathutils.geometry` such as bezier spline interpolation and
|
||||
ray-triangle intersection.
|
||||
|
||||
For now we'll focus on making this script an addon, but its good to know that this 3D math module is available and
|
||||
can help you with more advanced functionality later on.
|
||||
|
||||
|
||||
Write the Addon
|
||||
---------------
|
||||
|
||||
The first step is to convert the script as-is into an addon.
|
||||
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
bl_info = {
|
||||
"name": "Cursor Array",
|
||||
"category": "Object",
|
||||
}
|
||||
|
||||
import bpy
|
||||
|
||||
|
||||
class ObjectCursorArray(bpy.types.Operator):
|
||||
"""Object Cursor Array"""
|
||||
bl_idname = "object.cursor_array"
|
||||
bl_label = "Cursor Array"
|
||||
bl_options = {'REGISTER', 'UNDO'}
|
||||
|
||||
def execute(self, context):
|
||||
scene = context.scene
|
||||
cursor = scene.cursor_location
|
||||
obj = scene.objects.active
|
||||
|
||||
total = 10
|
||||
|
||||
for i in range(total):
|
||||
obj_new = obj.copy()
|
||||
scene.objects.link(obj_new)
|
||||
|
||||
factor = i / total
|
||||
obj_new.location = (obj.location * factor) + (cursor * (1.0 - factor))
|
||||
|
||||
return {'FINISHED'}
|
||||
|
||||
def register():
|
||||
bpy.utils.register_class(ObjectCursorArray)
|
||||
|
||||
|
||||
def unregister():
|
||||
bpy.utils.unregister_class(ObjectCursorArray)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
register()
|
||||
|
||||
|
||||
Everything here has been covered in the previous steps, you may want to try run the addon still
|
||||
and consider what could be done to make it more useful.
|
||||
|
||||
|
||||
... go off and test ...
|
||||
|
||||
|
||||
The two of the most obvious missing things are - having the total fixed at 10, and having to access the operator from
|
||||
space-bar is not very convenient.
|
||||
|
||||
Both these additions are explained next, with the final script afterwards.
|
||||
|
||||
|
||||
Operator Property
|
||||
^^^^^^^^^^^^^^^^^
|
||||
|
||||
There are a variety of property types that are used for tool settings, common property types include:
|
||||
int, float, vector, color, boolean and string.
|
||||
|
||||
These properties are handled differently to typical Python class attributes
|
||||
because Blender needs to be display them in the interface,
|
||||
store their settings in key-maps and keep settings for re-use.
|
||||
|
||||
While this is handled in a fairly Pythonic way, be mindful that you are in fact defining tool settings that
|
||||
are loaded into Blender and accessed by other parts of Blender, outside of Python.
|
||||
|
||||
|
||||
To get rid of the literal 10 for `total`, we'll us an operator property.
|
||||
Operator properties are defined via bpy.props module, this is added to the class body.
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
# moved assignment from execute() to the body of the class...
|
||||
total = bpy.props.IntProperty(name="Steps", default=2, min=1, max=100)
|
||||
|
||||
# and this is accessed on the class
|
||||
# instance within the execute() function as...
|
||||
self.total
|
||||
|
||||
|
||||
These properties from :mod:`bpy.props` are handled specially by Blender when the class is registered
|
||||
so they display as buttons in the user interface.
|
||||
There are many arguments you can pass to properties to set limits, change the default and display a tooltip.
|
||||
|
||||
.. seealso:: :mod:`bpy.props.IntProperty`
|
||||
|
||||
This document doesn't go into details about using other property types,
|
||||
however the link above includes examples of more advanced property usage.
|
||||
|
||||
|
||||
Menu Item
|
||||
^^^^^^^^^
|
||||
|
||||
Addons can add to the user interface of existing panels, headers and menus defined in Python.
|
||||
|
||||
For this example we'll add to an existing menu.
|
||||
|
||||
.. image:: menu_id.png
|
||||
:width: 334px
|
||||
:align: center
|
||||
:height: 128px
|
||||
:alt: Menu Identifier
|
||||
|
||||
To find the identifier of a menu you can hover your mouse over the menu item and the identifier is displayed.
|
||||
|
||||
The method used for adding a menu item is to append a draw function into an existing class.
|
||||
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
def menu_func(self, context):
|
||||
self.layout.operator(ObjectCursorArray.bl_idname)
|
||||
|
||||
def register():
|
||||
bpy.types.VIEW3D_MT_object.append(menu_func)
|
||||
|
||||
|
||||
For docs on extending menus see: :doc:`bpy.types.Menu`.
|
||||
|
||||
|
||||
Keymap
|
||||
^^^^^^
|
||||
|
||||
In Blender addons have their own key-maps so as not to interfere with Blenders built in key-maps.
|
||||
|
||||
In the example below, a new object-mode :class:`bpy.types.KeyMap` is added,
|
||||
then a :class:`bpy.types.KeyMapItem` is added to the key-map which references our newly added operator,
|
||||
using :kbd:`Ctrl-Shift-Space` as the key shortcut to activate it.
|
||||
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
# store keymaps here to access after registration
|
||||
addon_keymaps = []
|
||||
|
||||
def register():
|
||||
|
||||
# handle the keymap
|
||||
wm = bpy.context.window_manager
|
||||
km = wm.keyconfigs.addon.keymaps.new(name='Object Mode', space_type='EMPTY')
|
||||
|
||||
kmi = km.keymap_items.new(ObjectCursorArray.bl_idname, 'SPACE', 'PRESS', ctrl=True, shift=True)
|
||||
kmi.properties.total = 4
|
||||
|
||||
addon_keymaps.append((km, kmi))
|
||||
|
||||
|
||||
def unregister():
|
||||
|
||||
# handle the keymap
|
||||
for km, kmi in addon_keymaps:
|
||||
km.keymap_items.remove(kmi)
|
||||
addon_keymaps.clear()
|
||||
|
||||
|
||||
Notice how the key-map item can have a different ``total`` setting then the default set by the operator,
|
||||
this allows you to have multiple keys accessing the same operator with different settings.
|
||||
|
||||
|
||||
.. note::
|
||||
|
||||
While :kbd:`Ctrl-Shift-Space` isn't a default Blender key shortcut, its hard to make sure addons won't
|
||||
overwrite each others keymaps, At least take care when assigning keys that they don't
|
||||
conflict with important functionality within Blender.
|
||||
|
||||
For API documentation on the functions listed above, see:
|
||||
:class:`bpy.types.KeyMaps.new`,
|
||||
:class:`bpy.types.KeyMap`,
|
||||
:class:`bpy.types.KeyMapItems.new`,
|
||||
:class:`bpy.types.KeyMapItem`.
|
||||
|
||||
|
||||
Bringing it all together
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
bl_info = {
|
||||
"name": "Cursor Array",
|
||||
"category": "Object",
|
||||
}
|
||||
|
||||
import bpy
|
||||
|
||||
|
||||
class ObjectCursorArray(bpy.types.Operator):
|
||||
"""Object Cursor Array"""
|
||||
bl_idname = "object.cursor_array"
|
||||
bl_label = "Cursor Array"
|
||||
bl_options = {'REGISTER', 'UNDO'}
|
||||
|
||||
total = bpy.props.IntProperty(name="Steps", default=2, min=1, max=100)
|
||||
|
||||
def execute(self, context):
|
||||
scene = context.scene
|
||||
cursor = scene.cursor_location
|
||||
obj = scene.objects.active
|
||||
|
||||
for i in range(self.total):
|
||||
obj_new = obj.copy()
|
||||
scene.objects.link(obj_new)
|
||||
|
||||
factor = i / self.total
|
||||
obj_new.location = (obj.location * factor) + (cursor * (1.0 - factor))
|
||||
|
||||
return {'FINISHED'}
|
||||
|
||||
|
||||
def menu_func(self, context):
|
||||
self.layout.operator(ObjectCursorArray.bl_idname)
|
||||
|
||||
# store keymaps here to access after registration
|
||||
addon_keymaps = []
|
||||
|
||||
|
||||
def register():
|
||||
bpy.utils.register_class(ObjectCursorArray)
|
||||
bpy.types.VIEW3D_MT_object.append(menu_func)
|
||||
|
||||
# handle the keymap
|
||||
wm = bpy.context.window_manager
|
||||
# Note that in background mode (no GUI available), keyconfigs are not available either, so we have to check this
|
||||
# to avoid nasty errors in background case.
|
||||
kc = wm.keyconfigs.addon
|
||||
if kc:
|
||||
km = wm.keyconfigs.addon.keymaps.new(name='Object Mode', space_type='EMPTY')
|
||||
kmi = km.keymap_items.new(ObjectCursorArray.bl_idname, 'SPACE', 'PRESS', ctrl=True, shift=True)
|
||||
kmi.properties.total = 4
|
||||
addon_keymaps.append((km, kmi))
|
||||
|
||||
def unregister():
|
||||
# Note: when unregistering, it's usually good practice to do it in reverse order you registered.
|
||||
# Can avoid strange issues like keymap still referring to operators already unregistered...
|
||||
# handle the keymap
|
||||
for km, kmi in addon_keymaps:
|
||||
km.keymap_items.remove(kmi)
|
||||
addon_keymaps.clear()
|
||||
|
||||
bpy.utils.unregister_class(ObjectCursorArray)
|
||||
bpy.types.VIEW3D_MT_object.remove(menu_func)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
register()
|
||||
|
||||
.. image:: in_menu.png
|
||||
:width: 591px
|
||||
:align: center
|
||||
:height: 649px
|
||||
:alt: In the menu
|
||||
|
||||
Run the script (or save it and add it through the Preferences like before) and it will appear in the menu.
|
||||
|
||||
.. image:: op_prop.png
|
||||
:width: 669px
|
||||
:align: center
|
||||
:height: 644px
|
||||
:alt: Operator Property
|
||||
|
||||
After selecting it from the menu, you can choose how many instance of the cube you want created.
|
||||
|
||||
|
||||
.. note::
|
||||
|
||||
Directly executing the script multiple times will add the menu each time too.
|
||||
While not useful behavior, theres nothing to worry about since addons won't register them selves multiple
|
||||
times when enabled through the user preferences.
|
||||
|
||||
|
||||
Conclusions
|
||||
===========
|
||||
|
||||
Addons can encapsulate certain functionality neatly for writing tools to improve your work-flow or for writing utilities
|
||||
for others to use.
|
||||
|
||||
While there are limits to what Python can do within Blender, there is certainly a lot that can be achieved without
|
||||
having to dive into Blender's C/C++ code.
|
||||
|
||||
The example given in the tutorial is limited, but shows the Blender API used for common tasks that you can expand on
|
||||
to write your own tools.
|
||||
|
||||
|
||||
Further Reading
|
||||
---------------
|
||||
|
||||
Blender comes commented templates which are accessible from the text editor header, if you have specific areas
|
||||
you want to see example code for, this is a good place to start.
|
||||
|
||||
|
||||
Here are some sites you might like to check on after completing this tutorial.
|
||||
|
||||
- :ref:`Blender/Python API Overview <info_overview>` -
|
||||
*For more background details on Blender/Python integration.*
|
||||
- `How to Think Like a Computer Scientist <http://interactivepython.org/courselib/static/thinkcspy/index.html>`_ -
|
||||
*Great info for those who are still learning Python.*
|
||||
- `Blender Development (Wiki) <http://wiki.blender.org/index.php/Dev:Contents>`_ -
|
||||
*Blender Development, general information and helpful links.*
|
||||
- `Blender Artists (Coding Section) <http://blenderartists.org/forum/forumdisplay.php?47-Coding>`_ -
|
||||
*forum where people ask Python development questions*
|
||||
|
@@ -22,7 +22,7 @@
|
||||
# 'bmesh_opdefines.c' in order to avoid having to add a lot of introspection
|
||||
# data access into the api.
|
||||
#
|
||||
# The script is stupid because it makes assumptions about formatting...
|
||||
# The script is stupid becase it makes assumptions about formatting...
|
||||
# that each arg has its own line, that comments above or directly after will be __doc__ etc...
|
||||
#
|
||||
# We may want to replace this script with something else one day but for now its good enough.
|
||||
@@ -57,7 +57,7 @@ Operator Example
|
||||
++++++++++++++++
|
||||
This script shows how operators can be used to model a link of a chain.
|
||||
|
||||
.. literalinclude:: __/examples/bmesh.ops.1.py
|
||||
.. literalinclude:: ../examples/bmesh.ops.1.py
|
||||
"""
|
||||
|
||||
|
||||
|
@@ -27,7 +27,7 @@ output from this tool should be added into "doc/python_api/rst/change_log.rst"
|
||||
blender --background --python doc/python_api/sphinx_changelog_gen.py -- --dump
|
||||
|
||||
# create changelog
|
||||
blender --background --factory-startup --python doc/python_api/sphinx_changelog_gen.py -- \
|
||||
blender --background --python doc/python_api/sphinx_changelog_gen.py -- \
|
||||
--api_from blender_2_63_0.py \
|
||||
--api_to blender_2_64_0.py \
|
||||
--api_out changes.rst
|
||||
@@ -48,8 +48,7 @@ python doc/python_api/sphinx_changelog_gen.py -- \
|
||||
'''
|
||||
{"module.name":
|
||||
{"parent.class":
|
||||
{"basic_type", "member_name":
|
||||
("Name", type, range, length, default, descr, f_args, f_arg_types, f_ret_types)}, ...
|
||||
{"basic_type", "member_name": ("Name", type, range, length, default, descr, f_args, f_arg_types, f_ret_types)}, ...
|
||||
}, ...
|
||||
}
|
||||
'''
|
||||
@@ -100,34 +99,34 @@ def api_dump():
|
||||
prop_range = None
|
||||
|
||||
dump_class[prop_id] = (
|
||||
"prop_rna", # basic_type
|
||||
prop.name, # name
|
||||
prop_type, # type
|
||||
prop_range, # range
|
||||
prop_length, # length
|
||||
prop.default, # default
|
||||
prop.description, # descr
|
||||
Ellipsis, # f_args
|
||||
Ellipsis, # f_arg_types
|
||||
Ellipsis, # f_ret_types
|
||||
)
|
||||
"prop_rna", # basic_type
|
||||
prop.name, # name
|
||||
prop_type, # type
|
||||
prop_range, # range
|
||||
prop_length, # length
|
||||
prop.default, # default
|
||||
prop.description, # descr
|
||||
Ellipsis, # f_args
|
||||
Ellipsis, # f_arg_types
|
||||
Ellipsis, # f_ret_types
|
||||
)
|
||||
del props
|
||||
|
||||
# python props, tricky since we dont know much about them.
|
||||
for prop_id, attr in struct_info.get_py_properties():
|
||||
|
||||
dump_class[prop_id] = (
|
||||
"prop_py", # basic_type
|
||||
Ellipsis, # name
|
||||
Ellipsis, # type
|
||||
Ellipsis, # range
|
||||
Ellipsis, # length
|
||||
Ellipsis, # default
|
||||
attr.__doc__, # descr
|
||||
Ellipsis, # f_args
|
||||
Ellipsis, # f_arg_types
|
||||
Ellipsis, # f_ret_types
|
||||
)
|
||||
"prop_py", # basic_type
|
||||
Ellipsis, # name
|
||||
Ellipsis, # type
|
||||
Ellipsis, # range
|
||||
Ellipsis, # length
|
||||
Ellipsis, # default
|
||||
attr.__doc__, # descr
|
||||
Ellipsis, # f_args
|
||||
Ellipsis, # f_arg_types
|
||||
Ellipsis, # f_ret_types
|
||||
)
|
||||
|
||||
# kludge func -> props
|
||||
funcs = [(func.identifier, func) for func in struct_info.functions]
|
||||
@@ -138,17 +137,17 @@ def api_dump():
|
||||
func_args_type = tuple([prop.type for prop in func.args])
|
||||
|
||||
dump_class[func_id] = (
|
||||
"func_rna", # basic_type
|
||||
Ellipsis, # name
|
||||
Ellipsis, # type
|
||||
Ellipsis, # range
|
||||
Ellipsis, # length
|
||||
Ellipsis, # default
|
||||
func.description, # descr
|
||||
func_args_ids, # f_args
|
||||
func_args_type, # f_arg_types
|
||||
func_ret_types, # f_ret_types
|
||||
)
|
||||
"func_rna", # basic_type
|
||||
Ellipsis, # name
|
||||
Ellipsis, # type
|
||||
Ellipsis, # range
|
||||
Ellipsis, # length
|
||||
Ellipsis, # default
|
||||
func.description, # descr
|
||||
func_args_ids, # f_args
|
||||
func_args_type, # f_arg_types
|
||||
func_ret_types, # f_ret_types
|
||||
)
|
||||
del funcs
|
||||
|
||||
# kludge func -> props
|
||||
@@ -159,17 +158,17 @@ def api_dump():
|
||||
func_args_ids = tuple(inspect.getargspec(attr).args)
|
||||
|
||||
dump_class[func_id] = (
|
||||
"func_py", # basic_type
|
||||
Ellipsis, # name
|
||||
Ellipsis, # type
|
||||
Ellipsis, # range
|
||||
Ellipsis, # length
|
||||
Ellipsis, # default
|
||||
attr.__doc__, # descr
|
||||
func_args_ids, # f_args
|
||||
Ellipsis, # f_arg_types
|
||||
Ellipsis, # f_ret_types
|
||||
)
|
||||
"func_py", # basic_type
|
||||
Ellipsis, # name
|
||||
Ellipsis, # type
|
||||
Ellipsis, # range
|
||||
Ellipsis, # length
|
||||
Ellipsis, # default
|
||||
attr.__doc__, # descr
|
||||
func_args_ids, # f_args
|
||||
Ellipsis, # f_arg_types
|
||||
Ellipsis, # f_ret_types
|
||||
)
|
||||
del funcs
|
||||
|
||||
import pprint
|
||||
@@ -331,25 +330,21 @@ def main():
|
||||
|
||||
# When --help or no args are given, print this help
|
||||
usage_text = "Run blender in background mode with this script: "
|
||||
"blender --background --factory-startup --python %s -- [options]" % os.path.basename(__file__)
|
||||
"blender --background --python %s -- [options]" % os.path.basename(__file__)
|
||||
|
||||
epilog = "Run this before releases"
|
||||
|
||||
parser = argparse.ArgumentParser(description=usage_text, epilog=epilog)
|
||||
|
||||
parser.add_argument(
|
||||
"--dump", dest="dump", action='store_true',
|
||||
help="When set the api will be dumped into blender_version.py")
|
||||
parser.add_argument("--dump", dest="dump", action='store_true',
|
||||
help="When set the api will be dumped into blender_version.py")
|
||||
|
||||
parser.add_argument(
|
||||
"--api_from", dest="api_from", metavar='FILE',
|
||||
help="File to compare from (previous version)")
|
||||
parser.add_argument(
|
||||
"--api_to", dest="api_to", metavar='FILE',
|
||||
help="File to compare from (current)")
|
||||
parser.add_argument(
|
||||
"--api_out", dest="api_out", metavar='FILE',
|
||||
help="Output sphinx changelog")
|
||||
parser.add_argument("--api_from", dest="api_from", metavar='FILE',
|
||||
help="File to compare from (previous version)")
|
||||
parser.add_argument("--api_to", dest="api_to", metavar='FILE',
|
||||
help="File to compare from (current)")
|
||||
parser.add_argument("--api_out", dest="api_out", metavar='FILE',
|
||||
help="Output sphinx changelog")
|
||||
|
||||
args = parser.parse_args(argv) # In this example we wont use the args
|
||||
|
||||
|
@@ -24,18 +24,18 @@ SCRIPT_HELP_MSG = """
|
||||
|
||||
API dump in RST files
|
||||
---------------------
|
||||
Run this script from Blender's root path once you have compiled Blender
|
||||
Run this script from blenders root path once you have compiled blender
|
||||
|
||||
blender --background --factory-startup -noaudio --python doc/python_api/sphinx_doc_gen.py
|
||||
./blender.bin --background -noaudio --python doc/python_api/sphinx_doc_gen.py
|
||||
|
||||
This will generate python files in doc/python_api/sphinx-in/
|
||||
providing ./blender is or links to the blender executable
|
||||
providing ./blender.bin is or links to the blender executable
|
||||
|
||||
To choose sphinx-in directory:
|
||||
blender --background --factory-startup --python doc/python_api/sphinx_doc_gen.py -- --output ../python_api
|
||||
./blender.bin --background --python doc/python_api/sphinx_doc_gen.py -- --output ../python_api
|
||||
|
||||
For quick builds:
|
||||
blender --background --factory-startup --python doc/python_api/sphinx_doc_gen.py -- --partial bmesh.*
|
||||
./blender.bin --background --python doc/python_api/sphinx_doc_gen.py -- --partial bmesh.*
|
||||
|
||||
|
||||
Sphinx: HTML generation
|
||||
@@ -46,6 +46,8 @@ Sphinx: HTML generation
|
||||
cd doc/python_api
|
||||
sphinx-build sphinx-in sphinx-out
|
||||
|
||||
This requires sphinx 1.0.7 to be installed.
|
||||
|
||||
|
||||
Sphinx: PDF generation
|
||||
----------------------
|
||||
@@ -59,14 +61,14 @@ Sphinx: PDF generation
|
||||
"""
|
||||
|
||||
try:
|
||||
import bpy # Blender module
|
||||
import bpy # blender module
|
||||
except ImportError:
|
||||
print("\nERROR: this script must run from inside Blender")
|
||||
print(SCRIPT_HELP_MSG)
|
||||
import sys
|
||||
sys.exit()
|
||||
|
||||
import rna_info # Blender module
|
||||
import rna_info # blender module
|
||||
|
||||
|
||||
def rna_info_BuildRNAInfo_cache():
|
||||
@@ -84,7 +86,7 @@ import shutil
|
||||
import logging
|
||||
|
||||
from platform import platform
|
||||
PLATFORM = platform().split('-')[0].lower() # 'linux', 'darwin', 'windows'
|
||||
PLATFORM = platform().split('-')[0].lower() # 'linux', 'darwin', 'windows'
|
||||
|
||||
SCRIPT_DIR = os.path.abspath(os.path.dirname(__file__))
|
||||
|
||||
@@ -179,13 +181,15 @@ def handle_args():
|
||||
dest="log",
|
||||
default=False,
|
||||
action='store_true',
|
||||
help="Log the output of the api dump and sphinx|latex "
|
||||
"warnings and errors (default=False).\n"
|
||||
"If given, save logs in:\n"
|
||||
"* OUTPUT_DIR/.bpy.log\n"
|
||||
"* OUTPUT_DIR/.sphinx-build.log\n"
|
||||
"* OUTPUT_DIR/.sphinx-build_pdf.log\n"
|
||||
"* OUTPUT_DIR/.latex_make.log",
|
||||
help=(
|
||||
"Log the output of the api dump and sphinx|latex "
|
||||
"warnings and errors (default=False).\n"
|
||||
"If given, save logs in:\n"
|
||||
"* OUTPUT_DIR/.bpy.log\n"
|
||||
"* OUTPUT_DIR/.sphinx-build.log\n"
|
||||
"* OUTPUT_DIR/.sphinx-build_pdf.log\n"
|
||||
"* OUTPUT_DIR/.latex_make.log",
|
||||
),
|
||||
required=False)
|
||||
|
||||
# parse only the args passed after '--'
|
||||
@@ -206,12 +210,12 @@ BPY_LOGGER.setLevel(logging.DEBUG)
|
||||
"""
|
||||
# for quick rebuilds
|
||||
rm -rf /b/doc/python_api/sphinx-* && \
|
||||
./blender -b -noaudio --factory-startup -P doc/python_api/sphinx_doc_gen.py && \
|
||||
./blender.bin -b -noaudio --factory-startup -P doc/python_api/sphinx_doc_gen.py && \
|
||||
sphinx-build doc/python_api/sphinx-in doc/python_api/sphinx-out
|
||||
|
||||
or
|
||||
|
||||
./blender -b -noaudio --factory-startup -P doc/python_api/sphinx_doc_gen.py -- -f -B
|
||||
./blender.bin -b -noaudio --factory-startup -P doc/python_api/sphinx_doc_gen.py -- -f -B
|
||||
"""
|
||||
|
||||
# Switch for quick testing so doc-builds don't take so long
|
||||
@@ -220,12 +224,12 @@ if not ARGS.partial:
|
||||
FILTER_BPY_OPS = None
|
||||
FILTER_BPY_TYPES = None
|
||||
EXCLUDE_INFO_DOCS = False
|
||||
EXCLUDE_MODULES = []
|
||||
EXCLUDE_MODULES = ()
|
||||
|
||||
else:
|
||||
# can manually edit this too:
|
||||
# FILTER_BPY_OPS = ("import.scene", ) # allow
|
||||
# FILTER_BPY_TYPES = ("bpy_struct", "Operator", "ID") # allow
|
||||
#FILTER_BPY_OPS = ("import.scene", ) # allow
|
||||
#FILTER_BPY_TYPES = ("bpy_struct", "Operator", "ID") # allow
|
||||
EXCLUDE_INFO_DOCS = True
|
||||
EXCLUDE_MODULES = [
|
||||
"aud",
|
||||
@@ -258,7 +262,6 @@ else:
|
||||
"bpy_extras",
|
||||
"gpu",
|
||||
"gpu.offscreen",
|
||||
"idprop.types",
|
||||
"mathutils",
|
||||
"mathutils.bvhtree",
|
||||
"mathutils.geometry",
|
||||
@@ -272,7 +275,7 @@ else:
|
||||
"freestyle.shaders",
|
||||
"freestyle.types",
|
||||
"freestyle.utils",
|
||||
]
|
||||
]
|
||||
|
||||
# ------
|
||||
# Filter
|
||||
@@ -298,9 +301,7 @@ else:
|
||||
del m
|
||||
del fnmatch
|
||||
|
||||
BPY_LOGGER.debug(
|
||||
"Partial Doc Build, Skipping: %s\n" %
|
||||
"\n ".join(sorted(EXCLUDE_MODULES)))
|
||||
BPY_LOGGER.debug("Partial Doc Build, Skipping: %s\n" % "\n ".join(sorted(EXCLUDE_MODULES)))
|
||||
|
||||
#
|
||||
# done filtering
|
||||
@@ -310,41 +311,19 @@ try:
|
||||
__import__("aud")
|
||||
except ImportError:
|
||||
BPY_LOGGER.debug("Warning: Built without 'aud' module, docs incomplete...")
|
||||
EXCLUDE_MODULES.append("aud")
|
||||
EXCLUDE_MODULES = list(EXCLUDE_MODULES) + ["aud"]
|
||||
|
||||
try:
|
||||
__import__("freestyle")
|
||||
except ImportError:
|
||||
BPY_LOGGER.debug("Warning: Built without 'freestyle' module, docs incomplete...")
|
||||
EXCLUDE_MODULES.extend([
|
||||
"freestyle",
|
||||
"freestyle.chainingiterators",
|
||||
"freestyle.functions",
|
||||
"freestyle.predicates",
|
||||
"freestyle.shaders",
|
||||
"freestyle.types",
|
||||
"freestyle.utils",
|
||||
])
|
||||
|
||||
# Source files we use, and need to copy to the OUTPUT_DIR
|
||||
# to have working out-of-source builds.
|
||||
# Note that ".." is replaced by "__" in the RST files,
|
||||
# to avoid having to match Blender's source tree.
|
||||
EXTRA_SOURCE_FILES = (
|
||||
"../../../release/scripts/templates_py/bmesh_simple.py",
|
||||
"../../../release/scripts/templates_py/operator_simple.py",
|
||||
"../../../release/scripts/templates_py/ui_panel_simple.py",
|
||||
"../../../release/scripts/templates_py/ui_previews_custom_icon.py",
|
||||
"../examples/bge.constraints.py",
|
||||
"../examples/bge.texture.1.py",
|
||||
"../examples/bge.texture.2.py",
|
||||
"../examples/bge.texture.py",
|
||||
"../examples/bmesh.ops.1.py",
|
||||
"../examples/bpy.app.translations.py",
|
||||
"../static/favicon.ico",
|
||||
"../static/blender_logo.svg",
|
||||
)
|
||||
|
||||
EXCLUDE_MODULES = list(EXCLUDE_MODULES) + ["freestyle",
|
||||
"freestyle.chainingiterators",
|
||||
"freestyle.functions",
|
||||
"freestyle.predicates",
|
||||
"freestyle.shaders",
|
||||
"freestyle.types",
|
||||
"freestyle.utils"]
|
||||
|
||||
# examples
|
||||
EXAMPLES_DIR = os.path.abspath(os.path.join(SCRIPT_DIR, "examples"))
|
||||
@@ -360,57 +339,52 @@ RST_DIR = os.path.abspath(os.path.join(SCRIPT_DIR, "rst"))
|
||||
# extra info, not api reference docs
|
||||
# stored in ./rst/info_*
|
||||
INFO_DOCS = (
|
||||
("info_quickstart.rst",
|
||||
"Blender/Python Quickstart: new to Blender/scripting and want to get your feet wet?"),
|
||||
("info_overview.rst",
|
||||
"Blender/Python API Overview: a more complete explanation of Python integration"),
|
||||
("info_api_reference.rst",
|
||||
"Blender/Python API Reference Usage: examples of how to use the API reference docs"),
|
||||
("info_best_practice.rst",
|
||||
"Best Practice: Conventions to follow for writing good scripts"),
|
||||
("info_tips_and_tricks.rst",
|
||||
"Tips and Tricks: Hints to help you while writing scripts for Blender"),
|
||||
("info_gotcha.rst",
|
||||
"Gotcha's: some of the problems you may come up against when writing scripts"),
|
||||
)
|
||||
("info_quickstart.rst", "Blender/Python Quickstart: new to blender/scripting and want to get your feet wet?"),
|
||||
("info_overview.rst", "Blender/Python API Overview: a more complete explanation of python integration"),
|
||||
("info_tutorial_addon.rst", "Blender/Python Addon Tutorial: a step by step guide on how to write an addon from scratch"),
|
||||
("info_api_reference.rst", "Blender/Python API Reference Usage: examples of how to use the API reference docs"),
|
||||
("info_best_practice.rst", "Best Practice: Conventions to follow for writing good scripts"),
|
||||
("info_tips_and_tricks.rst", "Tips and Tricks: Hints to help you while writing scripts for blender"),
|
||||
("info_gotcha.rst", "Gotcha's: some of the problems you may come up against when writing scripts"),
|
||||
)
|
||||
|
||||
# only support for properties atm.
|
||||
RNA_BLACKLIST = {
|
||||
# XXX messes up PDF!, really a bug but for now just workaround.
|
||||
"UserPreferencesSystem": {"language", }
|
||||
}
|
||||
}
|
||||
|
||||
MODULE_GROUPING = {
|
||||
"bmesh.types": (
|
||||
("Base Mesh Type", '-'),
|
||||
"BMesh",
|
||||
("Mesh Elements", '-'),
|
||||
"BMVert",
|
||||
"BMEdge",
|
||||
"BMFace",
|
||||
"BMLoop",
|
||||
("Sequence Accessors", '-'),
|
||||
"BMElemSeq",
|
||||
"BMVertSeq",
|
||||
"BMEdgeSeq",
|
||||
"BMFaceSeq",
|
||||
"BMLoopSeq",
|
||||
"BMIter",
|
||||
("Selection History", '-'),
|
||||
"BMEditSelSeq",
|
||||
"BMEditSelIter",
|
||||
("Custom-Data Layer Access", '-'),
|
||||
"BMLayerAccessVert",
|
||||
"BMLayerAccessEdge",
|
||||
"BMLayerAccessFace",
|
||||
"BMLayerAccessLoop",
|
||||
"BMLayerCollection",
|
||||
"BMLayerItem",
|
||||
("Custom-Data Layer Types", '-'),
|
||||
"BMLoopUV",
|
||||
"BMDeformVert"
|
||||
)
|
||||
}
|
||||
("Base Mesh Type", '-'),
|
||||
"BMesh",
|
||||
("Mesh Elements", '-'),
|
||||
"BMVert",
|
||||
"BMEdge",
|
||||
"BMFace",
|
||||
"BMLoop",
|
||||
("Sequence Accessors", '-'),
|
||||
"BMElemSeq",
|
||||
"BMVertSeq",
|
||||
"BMEdgeSeq",
|
||||
"BMFaceSeq",
|
||||
"BMLoopSeq",
|
||||
"BMIter",
|
||||
("Selection History", '-'),
|
||||
"BMEditSelSeq",
|
||||
"BMEditSelIter",
|
||||
("Custom-Data Layer Access", '-'),
|
||||
"BMLayerAccessVert",
|
||||
"BMLayerAccessEdge",
|
||||
"BMLayerAccessFace",
|
||||
"BMLayerAccessLoop",
|
||||
"BMLayerCollection",
|
||||
"BMLayerItem",
|
||||
("Custom-Data Layer Types", '-'),
|
||||
"BMLoopUV",
|
||||
"BMDeformVert"
|
||||
)
|
||||
}
|
||||
|
||||
# --------------------configure compile time options----------------------------
|
||||
|
||||
@@ -418,7 +392,7 @@ MODULE_GROUPING = {
|
||||
|
||||
blender_version_strings = [str(v) for v in bpy.app.version]
|
||||
|
||||
# converting bytes to strings, due to T30154
|
||||
# converting bytes to strings, due to #30154
|
||||
BLENDER_REVISION = str(bpy.app.build_hash, 'utf_8')
|
||||
BLENDER_DATE = str(bpy.app.build_date, 'utf_8')
|
||||
|
||||
@@ -427,9 +401,9 @@ if BLENDER_REVISION != "Unknown":
|
||||
BLENDER_VERSION_DOTS += " " + BLENDER_REVISION # '2.62.1 SHA1'
|
||||
|
||||
BLENDER_VERSION_PATH = "_".join(blender_version_strings) # '2_62_1'
|
||||
if bpy.app.version_cycle in {"rc", "release"}:
|
||||
# '2_62a_release'
|
||||
BLENDER_VERSION_PATH = "%s%s_release" % ("_".join(blender_version_strings[:2]), bpy.app.version_char)
|
||||
if bpy.app.version_cycle == "release":
|
||||
BLENDER_VERSION_PATH = "%s%s_release" % ("_".join(blender_version_strings[:2]),
|
||||
bpy.app.version_char) # '2_62_release'
|
||||
|
||||
# --------------------------DOWNLOADABLE FILES----------------------------------
|
||||
|
||||
@@ -486,10 +460,10 @@ MethodDescriptorType = type(dict.get)
|
||||
GetSetDescriptorType = type(int.real)
|
||||
StaticMethodType = type(staticmethod(lambda: None))
|
||||
from types import (
|
||||
MemberDescriptorType,
|
||||
MethodType,
|
||||
FunctionType,
|
||||
)
|
||||
MemberDescriptorType,
|
||||
MethodType,
|
||||
FunctionType,
|
||||
)
|
||||
|
||||
_BPY_STRUCT_FAKE = "bpy_struct"
|
||||
_BPY_PROP_COLLECTION_FAKE = "bpy_prop_collection"
|
||||
@@ -509,7 +483,7 @@ escape_rst.trans = str.maketrans({
|
||||
"|": "\\|",
|
||||
"*": "\\*",
|
||||
"\\": "\\\\",
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
def is_struct_seq(value):
|
||||
@@ -754,7 +728,7 @@ def py_c_func2sphinx(ident, fw, module_name, type_name, identifier, py_func, is_
|
||||
|
||||
def pyprop2sphinx(ident, fw, identifier, py_prop):
|
||||
'''
|
||||
Python property to sphinx
|
||||
python property to sphinx
|
||||
'''
|
||||
# readonly properties use "data" directive, variables use "attribute" directive
|
||||
if py_prop.fset is None:
|
||||
@@ -854,8 +828,7 @@ def pymodule2sphinx(basepath, module_name, module, title):
|
||||
# naughty, we also add getset's into PyStructs, this is not typical py but also not incorrect.
|
||||
|
||||
# type_name is only used for examples and messages
|
||||
# "<class 'bpy.app.handlers'>" --> bpy.app.handlers
|
||||
type_name = str(type(module)).strip("<>").split(" ", 1)[-1][1:-1]
|
||||
type_name = str(type(module)).strip("<>").split(" ", 1)[-1][1:-1] # "<class 'bpy.app.handlers'>" --> bpy.app.handlers
|
||||
if type(descr) == types.GetSetDescriptorType:
|
||||
py_descr2sphinx("", fw, descr, module_name, type_name, key)
|
||||
attribute_set.add(key)
|
||||
@@ -916,8 +889,7 @@ def pymodule2sphinx(basepath, module_name, module, title):
|
||||
for attribute, value, value_type in module_dir_value_type:
|
||||
if value_type == FunctionType:
|
||||
pyfunc2sphinx("", fw, module_name, None, attribute, value, is_class=False)
|
||||
# both the same at the moment but to be future proof
|
||||
elif value_type in {types.BuiltinMethodType, types.BuiltinFunctionType}:
|
||||
elif value_type in {types.BuiltinMethodType, types.BuiltinFunctionType}: # both the same at the moment but to be future proof
|
||||
# note: can't get args from these, so dump the string as is
|
||||
# this means any module used like this must have fully formatted docstrings.
|
||||
py_c_func2sphinx("", fw, module_name, None, attribute, value, is_class=False)
|
||||
@@ -983,7 +955,7 @@ def pymodule2sphinx(basepath, module_name, module, title):
|
||||
if type(descr) == ClassMethodDescriptorType:
|
||||
py_descr2sphinx(" ", fw, descr, module_name, type_name, key)
|
||||
|
||||
# needed for pure Python classes
|
||||
# needed for pure python classes
|
||||
for key, descr in descr_items:
|
||||
if type(descr) == FunctionType:
|
||||
pyfunc2sphinx(" ", fw, module_name, type_name, key, descr, is_class=True)
|
||||
@@ -1006,15 +978,12 @@ def pymodule2sphinx(basepath, module_name, module, title):
|
||||
|
||||
file.close()
|
||||
|
||||
# Changes in Blender will force errors here
|
||||
# Changes in blender will force errors here
|
||||
context_type_map = {
|
||||
"active_base": ("ObjectBase", False),
|
||||
"active_bone": ("EditBone", False),
|
||||
"active_gpencil_frame": ("GreasePencilLayer", True),
|
||||
"active_gpencil_layer": ("GPencilLayer", True),
|
||||
"active_gpencil_brush": ("GPencilSculptBrush", False),
|
||||
"active_gpencil_palette": ("GPencilPalette", True),
|
||||
"active_gpencil_palettecolor": ("GPencilPaletteColor", True),
|
||||
"active_node": ("Node", False),
|
||||
"active_object": ("Object", False),
|
||||
"active_operator": ("Operator", False),
|
||||
@@ -1097,10 +1066,9 @@ def pycontext2sphinx(basepath):
|
||||
fw(title_string("Context Access (bpy.context)", "="))
|
||||
fw(".. module:: bpy.context\n")
|
||||
fw("\n")
|
||||
fw("The context members available depend on the area of Blender which is currently being accessed.\n")
|
||||
fw("The context members available depend on the area of blender which is currently being accessed.\n")
|
||||
fw("\n")
|
||||
fw("Note that all context values are readonly,\n")
|
||||
fw("but may be modified through the data api or by running operators\n\n")
|
||||
fw("Note that all context values are readonly, but may be modified through the data api or by running operators\n\n")
|
||||
|
||||
def write_contex_cls():
|
||||
|
||||
@@ -1123,8 +1091,7 @@ def pycontext2sphinx(basepath):
|
||||
if prop.identifier in struct_blacklist:
|
||||
continue
|
||||
|
||||
type_descr = prop.get_type_description(
|
||||
class_fmt=":class:`bpy.types.%s`", collection_id=_BPY_PROP_COLLECTION_ID)
|
||||
type_descr = prop.get_type_description(class_fmt=":class:`bpy.types.%s`", collection_id=_BPY_PROP_COLLECTION_ID)
|
||||
fw(".. data:: %s\n\n" % prop.identifier)
|
||||
if prop.description:
|
||||
fw(" %s\n\n" % prop.description)
|
||||
@@ -1144,7 +1111,7 @@ def pycontext2sphinx(basepath):
|
||||
del write_contex_cls
|
||||
# end
|
||||
|
||||
# nasty, get strings directly from Blender because there is no other way to get it
|
||||
# nasty, get strings directly from blender because there is no other way to get it
|
||||
import ctypes
|
||||
|
||||
context_strings = (
|
||||
@@ -1180,9 +1147,7 @@ def pycontext2sphinx(basepath):
|
||||
# for member in sorted(unique):
|
||||
# print(' "%s": ("", False),' % member)
|
||||
if len(context_type_map) > len(unique):
|
||||
raise Exception(
|
||||
"Some types are not used: %s" %
|
||||
str([member for member in context_type_map if member not in unique]))
|
||||
raise Exception("Some types are not used: %s" % str([member for member in context_type_map if member not in unique]))
|
||||
else:
|
||||
pass # will have raised an error above
|
||||
|
||||
@@ -1261,11 +1226,11 @@ def pyrna2sphinx(basepath):
|
||||
fw(ident + ":%s%s: %s\n" % (id_type, identifier, type_descr))
|
||||
|
||||
def write_struct(struct):
|
||||
# if not struct.identifier.startswith("Sc") and not struct.identifier.startswith("I"):
|
||||
# return
|
||||
#if not struct.identifier.startswith("Sc") and not struct.identifier.startswith("I"):
|
||||
# return
|
||||
|
||||
# if not struct.identifier == "Object":
|
||||
# return
|
||||
#if not struct.identifier == "Object":
|
||||
# return
|
||||
|
||||
filepath = os.path.join(basepath, "bpy.types.%s.rst" % struct.identifier)
|
||||
file = open(filepath, "w", encoding="utf-8")
|
||||
@@ -1306,11 +1271,7 @@ def pyrna2sphinx(basepath):
|
||||
fw(", ".join((":class:`%s`" % base_id) for base_id in base_ids))
|
||||
fw("\n\n")
|
||||
|
||||
subclass_ids = [
|
||||
s.identifier for s in structs.values()
|
||||
if s.base is struct
|
||||
if not rna_info.rna_id_ignore(s.identifier)
|
||||
]
|
||||
subclass_ids = [s.identifier for s in structs.values() if s.base is struct if not rna_info.rna_id_ignore(s.identifier)]
|
||||
subclass_ids.sort()
|
||||
if subclass_ids:
|
||||
fw("subclasses --- \n" + ", ".join((":class:`%s`" % s) for s in subclass_ids) + "\n\n")
|
||||
@@ -1361,7 +1322,7 @@ def pyrna2sphinx(basepath):
|
||||
|
||||
fw(" :type: %s\n\n" % type_descr)
|
||||
|
||||
# Python attributes
|
||||
# python attributes
|
||||
py_properties = struct.get_py_properties()
|
||||
py_prop = None
|
||||
for identifier, py_prop in py_properties:
|
||||
@@ -1371,8 +1332,7 @@ def pyrna2sphinx(basepath):
|
||||
for func in struct.functions:
|
||||
args_str = ", ".join(prop.get_arg_default(force=False) for prop in func.args)
|
||||
|
||||
fw(" .. %s:: %s(%s)\n\n" %
|
||||
("classmethod" if func.is_classmethod else "method", func.identifier, args_str))
|
||||
fw(" .. %s:: %s(%s)\n\n" % ("classmethod" if func.is_classmethod else "method", func.identifier, args_str))
|
||||
fw(" %s\n\n" % func.description)
|
||||
|
||||
for prop in func.args:
|
||||
@@ -1383,10 +1343,8 @@ def pyrna2sphinx(basepath):
|
||||
elif func.return_values: # multiple return values
|
||||
fw(" :return (%s):\n" % ", ".join(prop.identifier for prop in func.return_values))
|
||||
for prop in func.return_values:
|
||||
# TODO, pyrna_enum2sphinx for multiple return values... actually dont
|
||||
# think we even use this but still!!!
|
||||
type_descr = prop.get_type_description(
|
||||
as_ret=True, class_fmt=":class:`%s`", collection_id=_BPY_PROP_COLLECTION_ID)
|
||||
# TODO, pyrna_enum2sphinx for multiple return values... actually dont think we even use this but still!!!
|
||||
type_descr = prop.get_type_description(as_ret=True, class_fmt=":class:`%s`", collection_id=_BPY_PROP_COLLECTION_ID)
|
||||
descr = prop.description
|
||||
if not descr:
|
||||
descr = prop.name
|
||||
@@ -1399,7 +1357,7 @@ def pyrna2sphinx(basepath):
|
||||
|
||||
fw("\n")
|
||||
|
||||
# Python methods
|
||||
# python methods
|
||||
py_funcs = struct.get_py_functions()
|
||||
py_func = None
|
||||
|
||||
@@ -1422,10 +1380,7 @@ def pyrna2sphinx(basepath):
|
||||
del lines[:]
|
||||
|
||||
if _BPY_STRUCT_FAKE:
|
||||
descr_items = [
|
||||
(key, descr) for key, descr in sorted(bpy.types.Struct.__bases__[0].__dict__.items())
|
||||
if not key.startswith("__")
|
||||
]
|
||||
descr_items = [(key, descr) for key, descr in sorted(bpy.types.Struct.__bases__[0].__dict__.items()) if not key.startswith("__")]
|
||||
|
||||
if _BPY_STRUCT_FAKE:
|
||||
for key, descr in descr_items:
|
||||
@@ -1521,28 +1476,19 @@ def pyrna2sphinx(basepath):
|
||||
fw("\n")
|
||||
|
||||
if use_subclasses:
|
||||
subclass_ids = [
|
||||
s.identifier for s in structs.values()
|
||||
if s.base is None
|
||||
if not rna_info.rna_id_ignore(s.identifier)
|
||||
]
|
||||
subclass_ids = [s.identifier for s in structs.values() if s.base is None if not rna_info.rna_id_ignore(s.identifier)]
|
||||
if subclass_ids:
|
||||
fw("subclasses --- \n" + ", ".join((":class:`%s`" % s) for s in sorted(subclass_ids)) + "\n\n")
|
||||
|
||||
fw(".. class:: %s\n\n" % class_name)
|
||||
fw(" %s\n\n" % descr_str)
|
||||
fw(" .. note::\n\n")
|
||||
fw(" Note that bpy.types.%s is not actually available from within Blender,\n"
|
||||
" it only exists for the purpose of documentation.\n\n" % class_name)
|
||||
fw(" Note that bpy.types.%s is not actually available from within blender, it only exists for the purpose of documentation.\n\n" % class_name)
|
||||
|
||||
descr_items = [
|
||||
(key, descr) for key, descr in sorted(class_value.__dict__.items())
|
||||
if not key.startswith("__")
|
||||
]
|
||||
descr_items = [(key, descr) for key, descr in sorted(class_value.__dict__.items()) if not key.startswith("__")]
|
||||
|
||||
for key, descr in descr_items:
|
||||
# GetSetDescriptorType, GetSetDescriptorType's are not documented yet
|
||||
if type(descr) == MethodDescriptorType:
|
||||
if type(descr) == MethodDescriptorType: # GetSetDescriptorType, GetSetDescriptorType's are not documented yet
|
||||
py_descr2sphinx(" ", fw, descr, "bpy.types", class_name, key)
|
||||
|
||||
for key, descr in descr_items:
|
||||
@@ -1553,21 +1499,17 @@ def pyrna2sphinx(basepath):
|
||||
# write fake classes
|
||||
if _BPY_STRUCT_FAKE:
|
||||
class_value = bpy.types.Struct.__bases__[0]
|
||||
fake_bpy_type(
|
||||
class_value, _BPY_STRUCT_FAKE,
|
||||
"built-in base class for all classes in bpy.types.", use_subclasses=True)
|
||||
fake_bpy_type(class_value, _BPY_STRUCT_FAKE, "built-in base class for all classes in bpy.types.", use_subclasses=True)
|
||||
|
||||
if _BPY_PROP_COLLECTION_FAKE:
|
||||
class_value = bpy.data.objects.__class__
|
||||
fake_bpy_type(
|
||||
class_value, _BPY_PROP_COLLECTION_FAKE,
|
||||
"built-in class used for all collections.", use_subclasses=False)
|
||||
fake_bpy_type(class_value, _BPY_PROP_COLLECTION_FAKE, "built-in class used for all collections.", use_subclasses=False)
|
||||
|
||||
# operators
|
||||
def write_ops():
|
||||
API_BASEURL = "https://developer.blender.org/diffusion/B/browse/master/release/scripts "
|
||||
API_BASEURL_ADDON = "https://developer.blender.org/diffusion/BA"
|
||||
API_BASEURL_ADDON_CONTRIB = "https://developer.blender.org/diffusion/BAC"
|
||||
API_BASEURL = "http://svn.blender.org/svnroot/bf-blender/trunk/blender/release/scripts"
|
||||
API_BASEURL_ADDON = "http://svn.blender.org/svnroot/bf-extensions/trunk/py/scripts"
|
||||
API_BASEURL_ADDON_CONTRIB = "http://svn.blender.org/svnroot/bf-extensions/contrib/py/scripts"
|
||||
|
||||
op_modules = {}
|
||||
for op in ops.values():
|
||||
@@ -1613,8 +1555,10 @@ def pyrna2sphinx(basepath):
|
||||
else:
|
||||
url_base = API_BASEURL
|
||||
|
||||
fw(" :file: `%s\\:%d <%s/%s$%d>`_\n\n" %
|
||||
(location[0], location[1], url_base, location[0], location[1]))
|
||||
fw(" :file: `%s <%s/%s>`_:%d\n\n" % (location[0],
|
||||
url_base,
|
||||
location[0],
|
||||
location[1]))
|
||||
|
||||
file.close()
|
||||
|
||||
@@ -1630,58 +1574,27 @@ def write_sphinx_conf_py(basepath):
|
||||
file = open(filepath, "w", encoding="utf-8")
|
||||
fw = file.write
|
||||
|
||||
fw("import sys, os\n\n")
|
||||
fw("extensions = ['sphinx.ext.intersphinx']\n\n")
|
||||
fw("intersphinx_mapping = {'blender_manual': ('https://docs.blender.org/manual/en/dev/', None)}\n\n")
|
||||
fw("project = 'Blender'\n")
|
||||
# fw("master_doc = 'index'\n")
|
||||
fw("copyright = u'Blender Foundation'\n")
|
||||
fw("version = '%s - API'\n" % BLENDER_VERSION_DOTS)
|
||||
fw("release = '%s - API'\n" % BLENDER_VERSION_DOTS)
|
||||
|
||||
# Quiet file not in table-of-contents warnings.
|
||||
fw("exclude_patterns = [\n")
|
||||
fw(" 'include__bmesh.rst',\n")
|
||||
fw("]\n\n")
|
||||
|
||||
if ARGS.sphinx_theme != 'default':
|
||||
fw("html_theme = '%s'\n" % ARGS.sphinx_theme)
|
||||
|
||||
if ARGS.sphinx_theme == "blender-org":
|
||||
fw("html_theme_path = ['../']\n")
|
||||
# copied with the theme, exclude else we get an error [#28873]
|
||||
fw("html_favicon = 'favicon.ico'\n") # in <theme>/static/
|
||||
|
||||
# not helpful since the source is generated, adds to upload size.
|
||||
fw("html_copy_source = False\n")
|
||||
fw("html_show_sphinx = False\n")
|
||||
fw("html_split_index = True\n")
|
||||
fw("html_extra_path = ['__/static/favicon.ico', '__/static/blender_logo.svg']\n")
|
||||
fw("html_favicon = '__/static/favicon.ico'\n")
|
||||
fw("html_logo = '__/static/blender_logo.svg'\n\n")
|
||||
fw("\n")
|
||||
|
||||
# needed for latex, pdf gen
|
||||
fw("latex_elements = {\n")
|
||||
fw(" 'papersize': 'a4paper',\n")
|
||||
fw("}\n\n")
|
||||
|
||||
fw("latex_documents = [ ('contents', 'contents.tex', 'Blender Index', 'Blender Foundation', 'manual'), ]\n")
|
||||
|
||||
# Workaround for useless links leading to compile errors
|
||||
# See https://github.com/sphinx-doc/sphinx/issues/3866
|
||||
fw(r"""
|
||||
from sphinx.domains.python import PythonDomain
|
||||
|
||||
class PatchedPythonDomain(PythonDomain):
|
||||
def resolve_xref(self, env, fromdocname, builder, typ, target, node, contnode):
|
||||
if 'refspecific' in node:
|
||||
del node['refspecific']
|
||||
return super(PatchedPythonDomain, self).resolve_xref(
|
||||
env, fromdocname, builder, typ, target, node, contnode)
|
||||
|
||||
def setup(sphinx):
|
||||
sphinx.override_domain(PatchedPythonDomain)
|
||||
""")
|
||||
# end workaround
|
||||
|
||||
fw("latex_paper_size = 'a4paper'\n")
|
||||
file.close()
|
||||
|
||||
|
||||
@@ -1702,13 +1615,11 @@ def write_rst_contents(basepath):
|
||||
|
||||
fw(title_string("Blender Documentation Contents", "%", double=True))
|
||||
fw("\n")
|
||||
fw("Welcome, this document is an API reference for Blender %s, built %s.\n" %
|
||||
(BLENDER_VERSION_DOTS, BLENDER_DATE))
|
||||
fw("Welcome, this document is an API reference for Blender %s, built %s.\n" % (BLENDER_VERSION_DOTS, BLENDER_DATE))
|
||||
fw("\n")
|
||||
|
||||
# fw("`A PDF version of this document is also available <%s>`_\n" % BLENDER_PDF_FILENAME)
|
||||
fw("This site can be downloaded for offline use `Download the full Documentation (zipped HTML files) <%s>`_\n" %
|
||||
BLENDER_ZIP_FILENAME)
|
||||
fw("This site can be downloaded for offline use `Download the full Documentation (zipped HTML files) <%s>`_\n" % BLENDER_ZIP_FILENAME)
|
||||
|
||||
fw("\n")
|
||||
|
||||
@@ -1736,10 +1647,12 @@ def write_rst_contents(basepath):
|
||||
"bpy.utils.previews",
|
||||
"bpy.path",
|
||||
"bpy.app",
|
||||
"bpy.app.handlers",
|
||||
"bpy.app.translations",
|
||||
|
||||
# C modules
|
||||
"bpy.props",
|
||||
)
|
||||
)
|
||||
|
||||
for mod in app_modules:
|
||||
if mod not in EXCLUDE_MODULES:
|
||||
@@ -1750,10 +1663,19 @@ def write_rst_contents(basepath):
|
||||
fw(" :maxdepth: 1\n\n")
|
||||
|
||||
standalone_modules = (
|
||||
# submodules are added in parent page
|
||||
"mathutils", "freestyle", "bgl", "blf", "gpu",
|
||||
"aud", "bpy_extras", "idprop.types", "bmesh",
|
||||
)
|
||||
# mathutils
|
||||
"mathutils",
|
||||
"mathutils.geometry",
|
||||
"mathutils.bvhtree", "mathutils.kdtree",
|
||||
"mathutils.interpolate",
|
||||
"mathutils.noise",
|
||||
# misc
|
||||
"freestyle", "bgl", "blf",
|
||||
"gpu", "gpu.offscreen",
|
||||
"aud", "bpy_extras",
|
||||
# bmesh, submodules are in own page
|
||||
"bmesh",
|
||||
)
|
||||
|
||||
for mod in standalone_modules:
|
||||
if mod not in EXCLUDE_MODULES:
|
||||
@@ -1791,8 +1713,7 @@ def write_rst_contents(basepath):
|
||||
fw(" * mesh creation and editing functions\n")
|
||||
fw(" \n")
|
||||
fw(" These parts of the API are relatively stable and are unlikely to change significantly\n")
|
||||
fw(" * data API, access to attributes of Blender data such as mesh verts, material color,\n")
|
||||
fw(" timeline frames and scene objects\n")
|
||||
fw(" * data API, access to attributes of blender data such as mesh verts, material color, timeline frames and scene objects\n")
|
||||
fw(" * user interface functions for defining buttons, creation of menus, headers, panels\n")
|
||||
fw(" * render engine integration\n")
|
||||
fw(" * modules: bgl, mathutils & game engine.\n")
|
||||
@@ -1864,11 +1785,11 @@ def write_rst_data(basepath):
|
||||
fw(title_string("Data Access (bpy.data)", "="))
|
||||
fw(".. module:: bpy\n")
|
||||
fw("\n")
|
||||
fw("This module is used for all Blender/Python access.\n")
|
||||
fw("This module is used for all blender/python access.\n")
|
||||
fw("\n")
|
||||
fw(".. data:: data\n")
|
||||
fw("\n")
|
||||
fw(" Access to Blender's internal data\n")
|
||||
fw(" Access to blenders internal data\n")
|
||||
fw("\n")
|
||||
fw(" :type: :class:`bpy.types.BlendData`\n")
|
||||
fw("\n")
|
||||
@@ -1883,38 +1804,37 @@ def write_rst_importable_modules(basepath):
|
||||
Write the rst files of importable modules
|
||||
'''
|
||||
importable_modules = {
|
||||
# Python_modules
|
||||
"bpy.path": "Path Utilities",
|
||||
"bpy.utils": "Utilities",
|
||||
"bpy_extras": "Extra Utilities",
|
||||
# python_modules
|
||||
"bpy.path" : "Path Utilities",
|
||||
"bpy.utils" : "Utilities",
|
||||
"bpy_extras" : "Extra Utilities",
|
||||
|
||||
# C_modules
|
||||
"aud": "Audio System",
|
||||
"blf": "Font Drawing",
|
||||
"gpu.offscreen": "GPU Off-Screen Buffer",
|
||||
"bmesh": "BMesh Module",
|
||||
"bmesh.types": "BMesh Types",
|
||||
"bmesh.utils": "BMesh Utilities",
|
||||
"bmesh.geometry": "BMesh Geometry Utilities",
|
||||
"bpy.app": "Application Data",
|
||||
"bpy.app.handlers": "Application Handlers",
|
||||
"bpy.app.translations": "Application Translations",
|
||||
"bpy.props": "Property Definitions",
|
||||
"idprop.types": "ID Property Access",
|
||||
"mathutils": "Math Types & Utilities",
|
||||
"mathutils.geometry": "Geometry Utilities",
|
||||
"mathutils.bvhtree": "BVHTree Utilities",
|
||||
"mathutils.kdtree": "KDTree Utilities",
|
||||
"aud" : "Audio System",
|
||||
"blf" : "Font Drawing",
|
||||
"gpu.offscreen" : "GPU Off-Screen Buffer",
|
||||
"bmesh" : "BMesh Module",
|
||||
"bmesh.types" : "BMesh Types",
|
||||
"bmesh.utils" : "BMesh Utilities",
|
||||
"bmesh.geometry" : "BMesh Geometry Utilities",
|
||||
"bpy.app" : "Application Data",
|
||||
"bpy.app.handlers" : "Application Handlers",
|
||||
"bpy.app.translations" : "Application Translations",
|
||||
"bpy.props" : "Property Definitions",
|
||||
"mathutils" : "Math Types & Utilities",
|
||||
"mathutils.geometry" : "Geometry Utilities",
|
||||
"mathutils.bvhtree" : "BVHTree Utilities",
|
||||
"mathutils.kdtree" : "KDTree Utilities",
|
||||
"mathutils.interpolate": "Interpolation Utilities",
|
||||
"mathutils.noise": "Noise Utilities",
|
||||
"freestyle": "Freestyle Module",
|
||||
"freestyle.types": "Freestyle Types",
|
||||
"freestyle.predicates": "Freestyle Predicates",
|
||||
"freestyle.functions": "Freestyle Functions",
|
||||
"freestyle.chainingiterators": "Freestyle Chaining Iterators",
|
||||
"freestyle.shaders": "Freestyle Shaders",
|
||||
"freestyle.utils": "Freestyle Utilities",
|
||||
}
|
||||
"mathutils.noise" : "Noise Utilities",
|
||||
"freestyle" : "Freestyle Module",
|
||||
"freestyle.types" : "Freestyle Types",
|
||||
"freestyle.predicates" : "Freestyle Predicates",
|
||||
"freestyle.functions" : "Freestyle Functions",
|
||||
"freestyle.chainingiterators" : "Freestyle Chaining Iterators",
|
||||
"freestyle.shaders" : "Freestyle Shaders",
|
||||
"freestyle.utils" : "Freestyle Utilities",
|
||||
}
|
||||
for mod_name, mod_descr in importable_modules.items():
|
||||
if mod_name not in EXCLUDE_MODULES:
|
||||
module = __import__(mod_name,
|
||||
@@ -1929,7 +1849,7 @@ def copy_handwritten_rsts(basepath):
|
||||
for info, info_desc in INFO_DOCS:
|
||||
shutil.copy2(os.path.join(RST_DIR, info), basepath)
|
||||
|
||||
# TODO put this docs in Blender's code and use import as per modules above
|
||||
# TODO put this docs in blender's code and use import as per modules above
|
||||
handwritten_modules = [
|
||||
"bge.logic",
|
||||
"bge.render",
|
||||
@@ -1970,21 +1890,6 @@ def copy_handwritten_rsts(basepath):
|
||||
shutil.copy2(os.path.join(RST_DIR, f), basepath)
|
||||
|
||||
|
||||
def copy_handwritten_extra(basepath):
|
||||
for f_src in EXTRA_SOURCE_FILES:
|
||||
if os.sep != "/":
|
||||
f_src = os.sep.join(f_src.split("/"))
|
||||
|
||||
f_dst = f_src.replace("..", "__")
|
||||
|
||||
f_src = os.path.join(RST_DIR, f_src)
|
||||
f_dst = os.path.join(basepath, f_dst)
|
||||
|
||||
os.makedirs(os.path.dirname(f_dst), exist_ok=True)
|
||||
|
||||
shutil.copy2(f_src, f_dst)
|
||||
|
||||
|
||||
def rna2sphinx(basepath):
|
||||
|
||||
try:
|
||||
@@ -2016,48 +1921,35 @@ def rna2sphinx(basepath):
|
||||
# copy the other rsts
|
||||
copy_handwritten_rsts(basepath)
|
||||
|
||||
# copy source files referenced
|
||||
copy_handwritten_extra(basepath)
|
||||
|
||||
|
||||
def align_sphinx_in_to_sphinx_in_tmp(dir_src, dir_dst):
|
||||
def align_sphinx_in_to_sphinx_in_tmp():
|
||||
'''
|
||||
Move changed files from SPHINX_IN_TMP to SPHINX_IN
|
||||
'''
|
||||
import filecmp
|
||||
|
||||
# possible the dir doesn't exist when running recursively
|
||||
os.makedirs(dir_dst, exist_ok=True)
|
||||
|
||||
sphinx_dst_files = set(os.listdir(dir_dst))
|
||||
sphinx_src_files = set(os.listdir(dir_src))
|
||||
sphinx_in_files = set(os.listdir(SPHINX_IN))
|
||||
sphinx_in_tmp_files = set(os.listdir(SPHINX_IN_TMP))
|
||||
|
||||
# remove deprecated files that have been removed
|
||||
for f in sorted(sphinx_dst_files):
|
||||
if f not in sphinx_src_files:
|
||||
for f in sorted(sphinx_in_files):
|
||||
if f not in sphinx_in_tmp_files:
|
||||
BPY_LOGGER.debug("\tdeprecated: %s" % f)
|
||||
f_dst = os.path.join(dir_dst, f)
|
||||
if os.path.isdir(f_dst):
|
||||
shutil.rmtree(f_dst, True)
|
||||
else:
|
||||
os.remove(f_dst)
|
||||
os.remove(os.path.join(SPHINX_IN, f))
|
||||
|
||||
# freshen with new files.
|
||||
for f in sorted(sphinx_src_files):
|
||||
f_src = os.path.join(dir_src, f)
|
||||
f_dst = os.path.join(dir_dst, f)
|
||||
for f in sorted(sphinx_in_tmp_files):
|
||||
f_from = os.path.join(SPHINX_IN_TMP, f)
|
||||
f_to = os.path.join(SPHINX_IN, f)
|
||||
|
||||
if os.path.isdir(f_src):
|
||||
align_sphinx_in_to_sphinx_in_tmp(f_src, f_dst)
|
||||
else:
|
||||
do_copy = True
|
||||
if f in sphinx_dst_files:
|
||||
if filecmp.cmp(f_src, f_dst):
|
||||
do_copy = False
|
||||
do_copy = True
|
||||
if f in sphinx_in_files:
|
||||
if filecmp.cmp(f_from, f_to):
|
||||
do_copy = False
|
||||
|
||||
if do_copy:
|
||||
BPY_LOGGER.debug("\tupdating: %s" % f)
|
||||
shutil.copy(f_src, f_dst)
|
||||
if do_copy:
|
||||
BPY_LOGGER.debug("\tupdating: %s" % f)
|
||||
shutil.copy(f_from, f_to)
|
||||
|
||||
|
||||
def refactor_sphinx_log(sphinx_logfile):
|
||||
@@ -2144,7 +2036,7 @@ def main():
|
||||
shutil.rmtree(SPHINX_OUT_PDF, True)
|
||||
else:
|
||||
# move changed files in SPHINX_IN
|
||||
align_sphinx_in_to_sphinx_in_tmp(SPHINX_IN_TMP, SPHINX_IN)
|
||||
align_sphinx_in_to_sphinx_in_tmp()
|
||||
|
||||
# report which example files weren't used
|
||||
EXAMPLE_SET_UNUSED = EXAMPLE_SET - EXAMPLE_SET_USED
|
||||
|
@@ -3,6 +3,11 @@
|
||||
# bash doc/python_api/sphinx_doc_gen.sh
|
||||
# ssh upload means you need an account on the server
|
||||
|
||||
if [ "$1" == "" ] ; then
|
||||
echo "Expected a single argument for the username on blender.org, aborting"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
# Upload vars
|
||||
|
||||
@@ -17,15 +22,9 @@ if [ -z $BLENDER_BIN ] ; then
|
||||
BLENDER_BIN="./blender.bin"
|
||||
fi
|
||||
|
||||
if [ "$1" == "" ] ; then
|
||||
echo "Expected a single argument for the username on blender.org, skipping upload step!"
|
||||
DO_UPLOAD=false
|
||||
else
|
||||
SSH_USER=$1
|
||||
SSH_HOST=$SSH_USER"@blender.org"
|
||||
SSH_UPLOAD="/data/www/vhosts/www.blender.org/api" # blender_python_api_VERSION, added after
|
||||
fi
|
||||
|
||||
SSH_USER=$1
|
||||
SSH_HOST=$SSH_USER"@blender.org"
|
||||
SSH_UPLOAD="/data/www/vhosts/www.blender.org/api" # blender_python_api_VERSION, added after
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
# Blender Version & Info
|
||||
@@ -34,12 +33,10 @@ fi
|
||||
# "_".join(str(v) for v in bpy.app.version)
|
||||
# custom blender vars
|
||||
blender_srcdir=$(dirname -- $0)/../..
|
||||
blender_version_header="$blender_srcdir/source/blender/blenkernel/BKE_blender_version.h"
|
||||
blender_version=$(grep "BLENDER_VERSION\s" "$blender_version_header" | awk '{print $3}')
|
||||
blender_version_char=$(grep "BLENDER_VERSION_CHAR\s" "$blender_version_header" | awk '{print $3}')
|
||||
blender_version_cycle=$(grep "BLENDER_VERSION_CYCLE\s" "$blender_version_header" | awk '{print $3}')
|
||||
blender_subversion=$(grep "BLENDER_SUBVERSION\s" "$blender_version_header" | awk '{print $3}')
|
||||
unset blender_version_header
|
||||
blender_version=$(grep "BLENDER_VERSION\s" "$blender_srcdir/source/blender/blenkernel/BKE_blender_version.h" | awk '{print $3}')
|
||||
blender_version_char=$(grep "BLENDER_VERSION_CHAR\s" "$blender_srcdir/source/blender/blenkernel/BKE_blender_version.h" | awk '{print $3}')
|
||||
blender_version_cycle=$(grep "BLENDER_VERSION_CYCLE\s" "$blender_srcdir/source/blender/blenkernel/BKE_blender_version.h" | awk '{print $3}')
|
||||
blender_subversion=$(grep "BLENDER_SUBVERSION\s" "$blender_srcdir/source/blender/blenkernel/BKE_blender_version.h" | awk '{print $3}')
|
||||
|
||||
if [ "$blender_version_cycle" = "release" ] ; then
|
||||
BLENDER_VERSION=$(expr $blender_version / 100)_$(expr $blender_version % 100)$blender_version_char"_release"
|
||||
@@ -51,8 +48,6 @@ SSH_UPLOAD_FULL=$SSH_UPLOAD/"blender_python_api_"$BLENDER_VERSION
|
||||
|
||||
SPHINXBASE=doc/python_api
|
||||
|
||||
SPHINX_WORKDIR="$(mktemp --directory --suffix=.sphinx)"
|
||||
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
# Generate reStructuredText (blender/python only)
|
||||
@@ -64,25 +59,23 @@ if $DO_EXE_BLENDER ; then
|
||||
-noaudio \
|
||||
--factory-startup \
|
||||
--python-exit-code 1 \
|
||||
--python $SPHINXBASE/sphinx_doc_gen.py \
|
||||
-- \
|
||||
--output=$SPHINX_WORKDIR
|
||||
--python $SPHINXBASE/sphinx_doc_gen.py
|
||||
|
||||
|
||||
if (($? != 0)) ; then
|
||||
if (($? == 1)) ; then
|
||||
echo "Generating documentation failed, aborting"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
# Generate HTML (sphinx)
|
||||
|
||||
if $DO_OUT_HTML ; then
|
||||
# sphinx-build -n -b html $SPHINX_WORKDIR/sphinx-in $SPHINX_WORKDIR/sphinx-out
|
||||
# sphinx-build -n -b html $SPHINXBASE/sphinx-in $SPHINXBASE/sphinx-out
|
||||
|
||||
# annoying bug in sphinx makes it very slow unless we do this. should report.
|
||||
cd $SPHINX_WORKDIR
|
||||
cd $SPHINXBASE
|
||||
sphinx-build -b html sphinx-in sphinx-out
|
||||
|
||||
# XXX, saves space on upload and zip, should move HTML outside
|
||||
@@ -110,21 +103,20 @@ fi
|
||||
# Generate PDF (sphinx/laytex)
|
||||
|
||||
if $DO_OUT_PDF ; then
|
||||
cd $SPHINX_WORKDIR
|
||||
sphinx-build -n -b latex $SPHINX_WORKDIR/sphinx-in $SPHINX_WORKDIR/sphinx-out
|
||||
make -C $SPHINX_WORKDIR/sphinx-out
|
||||
mv $SPHINX_WORKDIR/sphinx-out/contents.pdf \
|
||||
$SPHINX_WORKDIR/sphinx-out/blender_python_reference_$BLENDER_VERSION.pdf
|
||||
sphinx-build -n -b latex $SPHINXBASE/sphinx-in $SPHINXBASE/sphinx-out
|
||||
make -C $SPHINXBASE/sphinx-out
|
||||
mv $SPHINXBASE/sphinx-out/contents.pdf $SPHINXBASE/sphinx-out/blender_python_reference_$BLENDER_VERSION.pdf
|
||||
fi
|
||||
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
# Upload to blender servers, comment this section for testing
|
||||
|
||||
if $DO_UPLOAD ; then
|
||||
|
||||
cp $SPHINX_WORKDIR/sphinx-out/contents.html $SPHINX_WORKDIR/sphinx-out/index.html
|
||||
cp $SPHINXBASE/sphinx-out/contents.html $SPHINXBASE/sphinx-out/index.html
|
||||
ssh $SSH_USER@blender.org 'rm -rf '$SSH_UPLOAD_FULL'/*'
|
||||
rsync --progress -ave "ssh -p 22" $SPHINX_WORKDIR/sphinx-out/* $SSH_HOST:$SSH_UPLOAD_FULL/
|
||||
rsync --progress -ave "ssh -p 22" $SPHINXBASE/sphinx-out/* $SSH_HOST:$SSH_UPLOAD_FULL/
|
||||
|
||||
## symlink the dir to a static URL
|
||||
#ssh $SSH_USER@blender.org 'rm '$SSH_UPLOAD'/250PythonDoc && ln -s '$SSH_UPLOAD_FULL' '$SSH_UPLOAD'/250PythonDoc'
|
||||
@@ -142,15 +134,11 @@ if $DO_UPLOAD ; then
|
||||
|
||||
if $DO_OUT_PDF ; then
|
||||
# rename so local PDF has matching name.
|
||||
rsync --progress -ave "ssh -p 22" \
|
||||
$SPHINX_WORKDIR/sphinx-out/blender_python_reference_$BLENDER_VERSION.pdf \
|
||||
$SSH_HOST:$SSH_UPLOAD_FULL/blender_python_reference_$BLENDER_VERSION.pdf
|
||||
rsync --progress -ave "ssh -p 22" $SPHINXBASE/sphinx-out/blender_python_reference_$BLENDER_VERSION.pdf $SSH_HOST:$SSH_UPLOAD_FULL/blender_python_reference_$BLENDER_VERSION.pdf
|
||||
fi
|
||||
|
||||
if $DO_OUT_HTML_ZIP ; then
|
||||
rsync --progress -ave "ssh -p 22" \
|
||||
$SPHINX_WORKDIR/blender_python_reference_$BLENDER_VERSION.zip \
|
||||
$SSH_HOST:$SSH_UPLOAD_FULL/blender_python_reference_$BLENDER_VERSION.zip
|
||||
rsync --progress -ave "ssh -p 22" $SPHINXBASE/blender_python_reference_$BLENDER_VERSION.zip $SSH_HOST:$SSH_UPLOAD_FULL/blender_python_reference_$BLENDER_VERSION.zip
|
||||
fi
|
||||
|
||||
fi
|
||||
@@ -161,5 +149,5 @@ fi
|
||||
|
||||
echo ""
|
||||
echo "Finished! view the docs from: "
|
||||
if $DO_OUT_HTML ; then echo " html:" $SPHINX_WORKDIR/sphinx-out/contents.html ; fi
|
||||
if $DO_OUT_PDF ; then echo " pdf:" $SPHINX_WORKDIR/sphinx-out/blender_python_reference_$BLENDER_VERSION.pdf ; fi
|
||||
if $DO_OUT_HTML ; then echo " html:" $SPHINXBASE/sphinx-out/contents.html ; fi
|
||||
if $DO_OUT_PDF ; then echo " pdf:" $SPHINXBASE/sphinx-out/blender_python_reference_$BLENDER_VERSION.pdf ; fi
|
||||
|
@@ -1,192 +0,0 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
# ##### BEGIN GPL LICENSE BLOCK #####
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation; either version 2
|
||||
# of the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software Foundation,
|
||||
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
#
|
||||
# Contributor(s): Bastien Montagne
|
||||
#
|
||||
# ##### END GPL LICENSE BLOCK #####
|
||||
|
||||
# <pep8 compliant>
|
||||
|
||||
"""
|
||||
This is a helper script to generate Blender Python API documentation (using Sphinx), and update server data using rsync.
|
||||
|
||||
You'll need to specify your user login and password, obviously.
|
||||
|
||||
Example usage:
|
||||
|
||||
./sphinx_doc_update.py --mirror ../../../docs/remote_api_backup/ --source ../.. --blender ../../../build_cmake/bin/blender --user foobar --password barfoo
|
||||
|
||||
"""
|
||||
|
||||
import os
|
||||
import shutil
|
||||
import subprocess
|
||||
import sys
|
||||
import tempfile
|
||||
import zipfile
|
||||
|
||||
|
||||
DEFAULT_RSYNC_SERVER = "docs.blender.org"
|
||||
DEFAULT_RSYNC_ROOT = "/api/"
|
||||
DEFAULT_SYMLINK_ROOT = "/data/www/vhosts/docs.blender.org/api"
|
||||
|
||||
|
||||
def argparse_create():
|
||||
import argparse
|
||||
global __doc__
|
||||
|
||||
# When --help or no args are given, print this help
|
||||
usage_text = __doc__
|
||||
|
||||
parser = argparse.ArgumentParser(description=usage_text,
|
||||
formatter_class=argparse.RawDescriptionHelpFormatter)
|
||||
|
||||
parser.add_argument(
|
||||
"--mirror", dest="mirror_dir",
|
||||
metavar='PATH', required=True,
|
||||
help="Path to local rsync mirror of api doc server")
|
||||
parser.add_argument(
|
||||
"--source", dest="source_dir",
|
||||
metavar='PATH', required=True,
|
||||
help="Path to Blender git repository")
|
||||
parser.add_argument(
|
||||
"--blender", dest="blender",
|
||||
metavar='PATH', required=True,
|
||||
help="Path to Blender executable")
|
||||
parser.add_argument(
|
||||
"--rsync-server", dest="rsync_server", default=DEFAULT_RSYNC_SERVER,
|
||||
metavar='RSYNCSERVER', type=str, required=False,
|
||||
help=("rsync server address"))
|
||||
parser.add_argument(
|
||||
"--rsync-root", dest="rsync_root", default=DEFAULT_RSYNC_ROOT,
|
||||
metavar='RSYNCROOT', type=str, required=False,
|
||||
help=("Root path of API doc on rsync server"))
|
||||
parser.add_argument(
|
||||
"--user", dest="user",
|
||||
metavar='USER', type=str, required=True,
|
||||
help=("User to login on rsync server"))
|
||||
parser.add_argument(
|
||||
"--password", dest="password",
|
||||
metavar='PASSWORD', type=str, required=True,
|
||||
help=("Password to login on rsync server"))
|
||||
|
||||
return parser
|
||||
|
||||
|
||||
def main():
|
||||
# ----------
|
||||
# Parse Args
|
||||
|
||||
args = argparse_create().parse_args()
|
||||
|
||||
rsync_base = "rsync://%s@%s:%s" % (args.user, args.rsync_server, args.rsync_root)
|
||||
|
||||
blenver = blenver_zip = ""
|
||||
api_name = ""
|
||||
branch = ""
|
||||
is_release = False
|
||||
|
||||
# I) Update local mirror using rsync.
|
||||
rsync_mirror_cmd = ("rsync", "--delete-after", "-avzz", rsync_base, args.mirror_dir)
|
||||
subprocess.run(rsync_mirror_cmd, env=dict(os.environ, RSYNC_PASSWORD=args.password))
|
||||
|
||||
with tempfile.TemporaryDirectory() as tmp_dir:
|
||||
# II) Generate doc source in temp dir.
|
||||
doc_gen_cmd = (args.blender, "--background", "-noaudio", "--factory-startup", "--python-exit-code", "1",
|
||||
"--python", "%s/doc/python_api/sphinx_doc_gen.py" % args.source_dir, "--",
|
||||
"--output", tmp_dir)
|
||||
subprocess.run(doc_gen_cmd)
|
||||
|
||||
# III) Get Blender version info.
|
||||
getver_file = os.path.join(tmp_dir, "blendver.txt")
|
||||
getver_script = (""
|
||||
"import sys, bpy\n"
|
||||
"with open(sys.argv[-1], 'w') as f:\n"
|
||||
" is_release = bpy.app.version_cycle in {'rc', 'release'}\n"
|
||||
" branch = bpy.app.build_branch.split()[0].decode()\n"
|
||||
" f.write('%d\\n' % is_release)\n"
|
||||
" f.write('%s\\n' % branch)\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"
|
||||
" 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")
|
||||
get_ver_cmd = (args.blender, "--background", "-noaudio", "--factory-startup", "--python-exit-code", "1",
|
||||
"--python-expr", getver_script, "--", getver_file)
|
||||
subprocess.run(get_ver_cmd)
|
||||
with open(getver_file) as f:
|
||||
is_release, branch, blenver, blenver_zip = f.read().split("\n")
|
||||
is_release = bool(int(is_release))
|
||||
os.remove(getver_file)
|
||||
|
||||
# IV) Build doc.
|
||||
curr_dir = os.getcwd()
|
||||
os.chdir(tmp_dir)
|
||||
sphinx_cmd = ("sphinx-build", "-b", "html", "sphinx-in", "sphinx-out")
|
||||
subprocess.run(sphinx_cmd)
|
||||
shutil.rmtree(os.path.join("sphinx-out", ".doctrees"))
|
||||
os.chdir(curr_dir)
|
||||
|
||||
# V) Cleanup existing matching dir in server mirror (if any), and copy new doc.
|
||||
api_name = blenver
|
||||
api_dir = os.path.join(args.mirror_dir, api_name)
|
||||
if os.path.exists(api_dir):
|
||||
shutil.rmtree(api_dir)
|
||||
os.rename(os.path.join(tmp_dir, "sphinx-out"), api_dir)
|
||||
|
||||
# VI) Create zip archive.
|
||||
zip_name = "blender_python_reference_%s" % blenver_zip # We can't use 'release' postfix here...
|
||||
zip_path = os.path.join(args.mirror_dir, zip_name)
|
||||
with zipfile.ZipFile(zip_path, 'w') as zf:
|
||||
for dirname, _, filenames in os.walk(api_dir):
|
||||
for filename in filenames:
|
||||
filepath = os.path.join(dirname, filename)
|
||||
zip_filepath = os.path.join(zip_name, os.path.relpath(filepath, api_dir))
|
||||
zf.write(filepath, arcname=zip_filepath)
|
||||
os.rename(zip_path, os.path.join(api_dir, "%s.zip" % zip_name))
|
||||
|
||||
# VII) Create symlinks and html redirects.
|
||||
os.symlink("./contents.html", os.path.join(api_dir, "index.html"))
|
||||
if is_release:
|
||||
symlink = os.path.join(args.mirror_dir, "current")
|
||||
os.remove(symlink)
|
||||
os.symlink("./%s" % api_name, symlink)
|
||||
with open(os.path.join(args.mirror_dir, "250PythonDoc/index.html"), 'w') as f:
|
||||
f.write("<html><head><title>Redirecting...</title><meta http-equiv=\"REFRESH\""
|
||||
"content=\"0;url=../%s/\"></head><body>Redirecting...</body></html>" % api_name)
|
||||
elif branch == "master":
|
||||
with open(os.path.join(args.mirror_dir, "blender_python_api/index.html"), 'w') as f:
|
||||
f.write("<html><head><title>Redirecting...</title><meta http-equiv=\"REFRESH\""
|
||||
"content=\"0;url=../%s/\"></head><body>Redirecting...</body></html>" % api_name)
|
||||
|
||||
# VIII) Upload (first do a dry-run so user can ensure everything is OK).
|
||||
print("Doc generated in local mirror %s, please check it before uploading "
|
||||
"(hit [Enter] to continue, [Ctrl-C] to exit):" % api_dir)
|
||||
sys.stdin.read(1)
|
||||
|
||||
rsync_mirror_cmd = ("rsync", "--dry-run", "--delete-after", "-avzz", args.mirror_dir, rsync_base)
|
||||
subprocess.run(rsync_mirror_cmd, env=dict(os.environ, RSYNC_PASSWORD=args.password))
|
||||
|
||||
print("Rsync upload simulated, please check every thing is OK (hit [Enter] to continue, [Ctrl-C] to exit):")
|
||||
sys.stdin.read(1)
|
||||
|
||||
rsync_mirror_cmd = ("rsync", "--delete-after", "-avzz", args.mirror_dir, rsync_base)
|
||||
subprocess.run(rsync_mirror_cmd, env=dict(os.environ, RSYNC_PASSWORD=args.password))
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
@@ -1,116 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<svg
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:cc="http://creativecommons.org/ns#"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
id="svg8"
|
||||
version="1.1"
|
||||
viewBox="0 0 55.032989 15.935012"
|
||||
height="60.226818"
|
||||
width="207.9987">
|
||||
<defs
|
||||
id="defs2">
|
||||
<clipPath
|
||||
clipPathUnits="userSpaceOnUse"
|
||||
id="clipPath3020">
|
||||
<path
|
||||
style="stroke-width:1.06666672"
|
||||
d="M 0,0 H 211.2 V 61.866667 H 0 Z"
|
||||
id="path3022" />
|
||||
</clipPath>
|
||||
<clipPath
|
||||
clipPathUnits="userSpaceOnUse"
|
||||
id="clipPath3020-8">
|
||||
<path
|
||||
style="stroke-width:1.06666672"
|
||||
d="M 0,0 H 211.2 V 61.866667 H 0 Z"
|
||||
id="path3022-1" />
|
||||
</clipPath>
|
||||
</defs>
|
||||
<metadata
|
||||
id="metadata5">
|
||||
<rdf:RDF>
|
||||
<cc:Work
|
||||
rdf:about="">
|
||||
<dc:format>image/svg+xml</dc:format>
|
||||
<dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||
<dc:creator>
|
||||
<cc:Agent>
|
||||
<dc:title>Blender Logo</dc:title>
|
||||
</cc:Agent>
|
||||
</dc:creator>
|
||||
<dc:source>https://www.blender.org/about/logo/</dc:source>
|
||||
<cc:license
|
||||
rdf:resource="(c) Blender Foundation" />
|
||||
</cc:Work>
|
||||
</rdf:RDF>
|
||||
</metadata>
|
||||
<g
|
||||
transform="translate(42.023693,-77.734934)"
|
||||
id="layer1">
|
||||
<g
|
||||
transform="matrix(0.26259939,0,0,-0.26259939,-42.237694,93.888967)"
|
||||
id="g3012"
|
||||
style="stroke-width:7.2904439">
|
||||
<g
|
||||
id="g3014"
|
||||
style="stroke-width:7.2904439" />
|
||||
<g
|
||||
id="g3016"
|
||||
style="stroke-width:7.2904439">
|
||||
<g
|
||||
clip-path="url(#clipPath3020-8)"
|
||||
id="g3018"
|
||||
style="stroke-width:7.2904439">
|
||||
<path
|
||||
id="path3024"
|
||||
style="fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:7.77647352"
|
||||
d="m 192.54827,44.510933 c 0,0 -125.158403,0 -128.688003,0 -0.07893,0.06187 -0.1504,0.1344 -0.2272,0.193067 -0.01813,0.0192 -18.9312,14.548267 -19.5008,14.986667 -0.032,0.0256 -0.06507,0.04907 -0.06507,0.04907 -3.029333,2.321067 -7.531733,2.369067 -10.721067,0.133334 -1.9968,-1.396267 -3.194666,-3.508267 -3.285333,-5.792 -0.0021,-0.09173 -0.0064,-0.1824 -0.0064,-0.2752 0,-1.185067 0.314667,-2.3296 0.8832,-3.357867 -5.857067,-0.0053 -11.746133,-0.0128 -11.746133,-0.0128 -4.3936,-0.0021 -8.3648,-2.965333 -9.2725337,-6.8928 C 9.7898667,42.9792 9.7248,42.411733 9.7248,41.8496 c 0,-1.643733 0.546133,-3.236267 1.5808,-4.542933 1.162667,-1.463467 2.842667,-2.448 4.7584,-2.832 C 10.530133,30.2272 5.0016,25.984 4.9973333,25.979733 4.9578667,25.949867 4.9248,25.924267 4.8970667,25.905067 c -2.2176,-1.703467 -3.68,-4.1728 -4.0106667,-6.770134 -0.0490667,-0.381866 -0.0714667,-0.7584 -0.0714667,-1.133866 0,-1.870934 0.5962667,-3.650134 1.7301334,-5.102934 1.3781333,-1.764266 3.4144,-2.884266 5.7322666,-3.147733 2.6549337,-0.3072 5.4495997,0.542933 7.6607997,2.330667 0.01493,0.01173 2.753067,2.256 5.639467,4.6176 1.060267,-2.555734 2.545067,-4.926934 4.465067,-7.0453337 2.4704,-2.7306666 5.473066,-4.8864 8.919466,-6.4128 C 38.5856,1.6352 42.466133,0.82453333 46.501333,0.83413333 50.5376,0.8416 54.417067,1.6629333 58.0352,3.2768 c 3.453867,1.5466667 6.449067,3.7109333 8.910933,6.4352 0.360534,0.4032 0.693334,0.8288 1.0272,1.2544 4.885334,0 124.574937,0 124.574937,0 9.84,0 17.8368,7.5232 17.8368,16.7712 0,9.248 -7.9968,16.773333 -17.8368,16.773333" />
|
||||
<path
|
||||
id="path3026"
|
||||
style="fill:#0d528a;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:7.77647352"
|
||||
d="m 38.538667,28.497067 c 0.113066,2.016 1.101866,3.793066 2.590933,5.0528 1.4624,1.237333 3.428267,1.9936 5.575467,1.9936 2.144,0 4.110933,-0.756267 5.572266,-1.9936 1.490134,-1.259734 2.4768,-3.0368 2.590934,-5.050667 0.113066,-2.0736 -0.718934,-3.997867 -2.181334,-5.425067 C 51.1968,21.6224 49.0784,20.7104 46.705067,20.7104 c -2.3744,0 -4.497067,0.912 -5.9872,2.363733 -1.461334,1.4272 -2.292267,3.351467 -2.1792,5.422934" />
|
||||
<path
|
||||
id="path3028"
|
||||
style="fill:#f5792a;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:7.77647352"
|
||||
d="m 25.536,24.421333 c 0.01387,-0.7904 0.2656,-2.3232 0.6432,-3.521066 C 26.9728,18.3648 28.318933,16.0192 30.193067,13.950933 32.1152,11.8272 34.482133,10.119467 37.216,8.9088 c 2.872533,-1.2736 5.986133,-1.9210667 9.220267,-1.9157333 3.229866,0.00427 6.3424,0.6656 9.216,1.9477333 2.733866,1.2224 5.098666,2.9376 7.018666,5.063467 1.870934,2.074666 3.216,4.424533 4.010667,6.96 0.401067,1.282133 0.6528,2.581333 0.754133,3.886933 0.100267,1.285333 0.0576,2.571733 -0.1248,3.858133 -0.356266,2.507734 -1.223466,4.858667 -2.557866,7.002667 -1.2224,1.970133 -2.7968,3.696 -4.6688,5.147733 l 0.0053,0.0021 -18.8928,14.506666 c -0.016,0.0128 -0.02987,0.02667 -0.048,0.03733 -1.240533,0.952533 -3.3248,0.948266 -4.686933,-0.0053 -1.3792,-0.9632 -1.536,-2.557866 -0.3104,-3.5648 l -0.0043,-0.0043 7.8784,-6.407467 -24.016,-0.02667 c -0.01173,0 -0.0224,0 -0.032,0 -1.985067,-0.0011 -3.893333,-1.303466 -4.269867,-2.9504 -0.389333,-1.6768 0.958934,-3.067733 3.022934,-3.074133 l -0.0021,-0.0075 L 30.900267,39.3888 9.1786667,22.715733 c -0.026667,-0.02133 -0.0576,-0.0416 -0.0832,-0.06293 -2.0490667,-1.568 -2.7104,-4.178133 -1.4197334,-5.828267 1.3088,-1.68 4.0949337,-1.6832 6.1653337,-0.0096 L 25.696,26.516267 c 0,0 -0.173867,-1.3088 -0.16,-2.094934 z M 56,20.034133 c -2.443733,-2.488533 -5.8624,-3.899733 -9.563733,-3.9072 -3.7056,-0.0064 -7.124267,1.393067 -9.568,3.877334 -1.1936,1.210666 -2.0704,2.602666 -2.6112,4.087466 -0.529067,1.457067 -0.736,3.0048 -0.599467,4.5664 0.130133,1.527467 0.583467,2.9824 1.309867,4.3008 0.712533,1.293867 1.6928,2.465067 2.9056,3.454934 2.373333,1.934933 5.396266,2.981333 8.558933,2.9856 3.1648,0.0053 6.1856,-1.0336 8.561067,-2.961067 1.2096,-0.9856 2.190933,-2.151467 2.903466,-3.445333 0.728534,-1.316267 1.179734,-2.765867 1.314134,-4.2976 C 59.344,27.136 59.138133,25.5904 58.609067,24.1312 58.0672,22.6432 57.1936,21.2512 56,20.034133" />
|
||||
<path
|
||||
id="path3030"
|
||||
style="fill:#0d528a;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:7.77647352"
|
||||
d="m 167.96587,28.529067 c 0.1824,2.0352 1.75466,3.325866 4.15786,3.325866 2.4064,0 3.97974,-1.290666 4.16214,-3.325866 z M 176.0384,23.504 c -0.61547,-1.508267 -2.06507,-2.401067 -4.03627,-2.401067 -2.46613,0 -4.12693,1.540267 -4.1952,3.9744 h 14.18347 c 0,0.251734 0,0.462934 0,0.715734 0,6.094933 -3.57653,9.518933 -9.98827,9.518933 -6.22506,0 -9.98826,-3.457067 -9.98826,-8.878933 0,-5.454934 3.82293,-8.9056 9.98826,-8.9056 3.70134,0 6.5696,1.2672 8.33814,3.4976 L 176.0384,23.504" />
|
||||
<path
|
||||
id="path3032"
|
||||
style="fill:#0d528a;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:7.77647352"
|
||||
d="m 105.0336,28.519467 c 0.18667,2.036266 1.76,3.326933 4.16533,3.326933 2.40214,0 3.97547,-1.290667 4.15894,-3.326933 z m 8.07787,-5.025067 c -0.61547,-1.512533 -2.06614,-2.404267 -4.03947,-2.404267 -2.464,0 -4.12907,1.544534 -4.19413,3.9776 h 14.18026 c 0,0.2496 0,0.4608 0,0.712534 0,6.098133 -3.57546,9.524266 -9.98613,9.524266 -6.22933,0 -9.986133,-3.458133 -9.986133,-8.88 0,-5.456 3.821863,-8.906666 9.986133,-8.906666 3.6992,0 6.5696,1.262933 8.34133,3.495466 l -4.30186,2.481067" />
|
||||
<path
|
||||
id="path3034"
|
||||
style="fill:#0d528a;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:7.77647352"
|
||||
d="m 92.701867,38.997333 h 5.114666 v -20.9248 h -5.114666 z" />
|
||||
<path
|
||||
id="path3036"
|
||||
style="fill:#0d528a;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:7.77647352"
|
||||
d="m 120.33067,33.438933 h 5.14453 v -1.245866 c 1.8208,1.9424 4.00747,2.9248 6.47253,2.9248 2.84054,0 4.992,-0.9824 6.1024,-2.653867 0.92587,-1.381333 0.98774,-3.0496 0.98774,-5.239467 v -9.152 h -5.15094 v 8.040534 c 0,3.336533 -0.67093,4.877866 -3.6,4.877866 -2.96106,0 -4.81173,-1.764266 -4.81173,-4.724266 v -8.194134 h -5.14453 v 15.3664" />
|
||||
<path
|
||||
id="path3038"
|
||||
style="fill:#0d528a;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:7.77647352"
|
||||
d="m 155.60107,26.173867 c 0,-2.864 -1.9136,-4.741334 -4.8736,-4.741334 -2.96427,0 -4.87787,1.813334 -4.87787,4.709334 0,2.9376 1.88907,4.750933 4.87787,4.750933 2.96,0 4.8736,-1.8464 4.8736,-4.718933 z m 0,6.568533 c -1.30027,1.393067 -3.1808,2.157867 -5.79734,2.157867 -5.64266,0 -9.49546,-3.479467 -9.49546,-8.6944 0,-5.112534 3.82613,-8.688 9.40266,-8.688 2.5568,0 4.4352,0.645333 5.89014,2.096 v -1.541334 h 5.14666 v 22.2528 l -5.14666,-1.328 V 32.7424" />
|
||||
<path
|
||||
id="path3040"
|
||||
style="fill:#0d528a;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:7.77647352"
|
||||
d="m 81.010133,30.8928 c 2.990934,0 4.871467,-1.813333 4.871467,-4.750933 0,-2.896 -1.9104,-4.709334 -4.871467,-4.709334 -2.958933,0 -4.869333,1.877334 -4.869333,4.741334 0,2.872533 1.9104,4.718933 4.869333,4.718933 z m -4.869333,8.104533 -5.1488,1.328 v -22.2528 h 5.1488 v 1.541334 c 1.448533,-1.450667 3.329067,-2.096 5.886933,-2.096 5.579734,0 9.4016,3.575466 9.4016,8.688 0,5.214933 -3.853866,8.6944 -9.493333,8.6944 -2.621867,0 -4.5024,-0.7648 -5.7952,-2.157867 v 6.254933" />
|
||||
<path
|
||||
id="path3042"
|
||||
style="fill:#0d528a;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:7.77647352"
|
||||
d="m 183.2608,18.072533 v 15.3664 h 5.14667 v -0.9504 c 1.54026,1.857067 3.1712,2.7808 5.0272,2.7808 0.368,0 0.82986,-0.05973 1.44533,-0.1216 V 30.768 c -0.496,0.064 -1.04747,0.064 -1.6352,0.064 -2.992,0 -4.83733,-1.972267 -4.83733,-5.329067 v -7.4304 h -5.14667" />
|
||||
<path
|
||||
id="path3044"
|
||||
style="fill:#0d528a;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:7.77647352"
|
||||
d="m 201.55307,35.252267 h -0.39467 l 0.0139,1.409066 0.0203,0.466134 -0.1056,-0.384 -0.46826,-1.4912 h -0.36054 l -0.45866,1.4912 -0.1152,0.376533 0.0277,-0.458667 0.0139,-1.409066 h -0.38614 v 2.282666 h 0.54187 l 0.57067,-1.8016 0.5568,1.8016 h 0.544 z m -3.12747,0 h -0.39787 V 37.1968 h -0.7328 v 0.338133 h 1.85067 V 37.1968 h -0.72 v -1.944533" />
|
||||
</g>
|
||||
</g>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
Before Width: | Height: | Size: 10 KiB |
13
extern/CMakeLists.txt
vendored
13
extern/CMakeLists.txt
vendored
@@ -29,14 +29,6 @@ add_subdirectory(curve_fit_nd)
|
||||
# Otherwise we get warnings here that we cant fix in external projects
|
||||
remove_strict_flags()
|
||||
|
||||
# Not a strict flag, but noisy for code we don't maintain
|
||||
if(CMAKE_COMPILER_IS_GNUCC)
|
||||
remove_cc_flag(
|
||||
"-Wmisleading-indentation"
|
||||
)
|
||||
endif()
|
||||
|
||||
|
||||
add_subdirectory(rangetree)
|
||||
add_subdirectory(wcwidth)
|
||||
|
||||
@@ -99,15 +91,12 @@ if(WITH_LIBMV)
|
||||
endif()
|
||||
|
||||
if(WITH_LIBMV OR WITH_GTESTS OR (WITH_CYCLES AND WITH_CYCLES_LOGGING))
|
||||
if (NOT WITH_SYSTEM_GFLAGS)
|
||||
add_subdirectory(gflags)
|
||||
endif()
|
||||
add_subdirectory(gflags)
|
||||
add_subdirectory(glog)
|
||||
endif()
|
||||
|
||||
if(WITH_GTESTS)
|
||||
add_subdirectory(gtest)
|
||||
add_subdirectory(gmock)
|
||||
endif()
|
||||
|
||||
if(WITH_SDL AND WITH_SDL_DYNLOAD)
|
||||
|
@@ -77,7 +77,7 @@ namespace std {
|
||||
void resize(size_type new_size)
|
||||
{ resize(new_size, T()); }
|
||||
|
||||
#if defined(_VECTOR_) && (_MSC_VER<1910)
|
||||
#if defined(_VECTOR_)
|
||||
// workaround MSVC std::vector implementation
|
||||
void resize(size_type new_size, const value_type& x)
|
||||
{
|
||||
@@ -110,7 +110,7 @@ namespace std {
|
||||
vector_base::insert(vector_base::end(), new_size - vector_base::size(), x);
|
||||
}
|
||||
#else
|
||||
// either GCC 4.1, MSVC2017 or non-GCC
|
||||
// either GCC 4.1 or non-GCC
|
||||
// default implementation which should always work.
|
||||
void resize(size_type new_size, const value_type& x)
|
||||
{
|
||||
|
6
extern/Eigen3/README.blender
vendored
6
extern/Eigen3/README.blender
vendored
@@ -1,6 +0,0 @@
|
||||
Project: Eigen, template library for linear algebra: matrices, vectors, numerical solvers, and related algorithms
|
||||
URL: http://eigen.tuxfamily.org/index.php?title=Main_Page
|
||||
License: GPLv3+
|
||||
Upstream version: 3.2.7
|
||||
Local modifications:
|
||||
- OpenMP fix for MSVC2015, see http://eigen.tuxfamily.org/bz/show_bug.cgi?id=1131
|
6
extern/binreloc/README.blender
vendored
6
extern/binreloc/README.blender
vendored
@@ -1,6 +0,0 @@
|
||||
Project: AutoPackage
|
||||
URL: http://autopackage.org/docs/binreloc (original, defunct)
|
||||
http://alien.cern.ch/cache/autopackage-1.0/site/docs/binreloc/ (cache)
|
||||
License: Public Domain
|
||||
Upstream version: Unknown (Last Release)
|
||||
Local modifications: None
|
@@ -151,8 +151,8 @@ static btScalar EdgeSeparation(const btBox2dShape* poly1, const btTransform& xf1
|
||||
int index = 0;
|
||||
btScalar minDot = BT_LARGE_FLOAT;
|
||||
|
||||
if( count2 > 0 )
|
||||
index = (int) normal1.minDot( vertices2, count2, minDot);
|
||||
if( count2 > 0 )
|
||||
index = (int) normal1.minDot( vertices2, count2, minDot);
|
||||
|
||||
btVector3 v1 = b2Mul(xf1, vertices1[edge1]);
|
||||
btVector3 v2 = b2Mul(xf2, vertices2[index]);
|
||||
@@ -174,9 +174,9 @@ static btScalar FindMaxSeparation(int* edgeIndex,
|
||||
|
||||
// Find edge normal on poly1 that has the largest projection onto d.
|
||||
int edge = 0;
|
||||
btScalar maxDot;
|
||||
if( count1 > 0 )
|
||||
edge = (int) dLocal1.maxDot( normals1, count1, maxDot);
|
||||
btScalar maxDot;
|
||||
if( count1 > 0 )
|
||||
edge = (int) dLocal1.maxDot( normals1, count1, maxDot);
|
||||
|
||||
// Get the separation for the edge normal.
|
||||
btScalar s = EdgeSeparation(poly1, xf1, edge, poly2, xf2);
|
||||
|
@@ -232,8 +232,8 @@ void btCompoundCollisionAlgorithm::processCollision (const btCollisionObjectWrap
|
||||
m_compoundShapeRevision = compoundShape->getUpdateRevision();
|
||||
}
|
||||
|
||||
if (m_childCollisionAlgorithms.size()==0)
|
||||
return;
|
||||
if (m_childCollisionAlgorithms.size()==0)
|
||||
return;
|
||||
|
||||
const btDbvt* tree = compoundShape->getDynamicAabbTree();
|
||||
//use a dynamic aabb tree to cull potential child-overlaps
|
||||
|
4
extern/carve/README.blender
vendored
4
extern/carve/README.blender
vendored
@@ -1,4 +0,0 @@
|
||||
Project: Carve, CSG library
|
||||
URL: https://code.google.com/archive/p/carve/
|
||||
Upstream version 9a85d733a43d
|
||||
Local modifications: See patches/ folder
|
17
extern/carve/carve-capi.cc
vendored
17
extern/carve/carve-capi.cc
vendored
@@ -568,22 +568,6 @@ void cleanupFaceEdgeAttrsCallback(const MeshSet<3> *left,
|
||||
&descr->orig_face_edge_mapping);
|
||||
}
|
||||
|
||||
void copyVertexAttrsCallback(const carve::mesh::MeshSet<3>::vertex_t *orig_vert,
|
||||
const carve::mesh::MeshSet<3>::vertex_t *new_vert,
|
||||
void *descr_v)
|
||||
{
|
||||
CarveMeshDescr *descr = (CarveMeshDescr *) descr_v;
|
||||
if (!descr->orig_vert_mapping.hasAttribute(orig_vert)) {
|
||||
return;
|
||||
}
|
||||
if (descr->orig_vert_mapping.hasAttribute(new_vert)) {
|
||||
return;
|
||||
}
|
||||
OrigIndex attr = descr->orig_vert_mapping.getAttribute(orig_vert);
|
||||
descr->orig_vert_mapping.setAttribute(new_vert, attr);
|
||||
descr->orig_vert_mapping.removeAttribute(orig_vert);
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
CarveMeshDescr *carve_addMesh(struct ImportMeshData *import_data,
|
||||
@@ -767,7 +751,6 @@ bool carve_performBooleanOperation(CarveMeshDescr *left_mesh,
|
||||
// done properly. The only way to make such situations working is to
|
||||
// union intersecting meshes of the same operand.
|
||||
carve_unionIntersections(&csg, &left, &right,
|
||||
copyVertexAttrsCallback,
|
||||
cleanupFaceEdgeAttrsCallback,
|
||||
(void *) output_descr);
|
||||
|
||||
|
99
extern/carve/carve-util.cc
vendored
99
extern/carve/carve-util.cc
vendored
@@ -141,11 +141,6 @@ void carve_getRescaleMinMax(const MeshSet<3> *left,
|
||||
|
||||
namespace {
|
||||
|
||||
struct UnionIntersectionContext {
|
||||
VertexAttrsCallback vertex_attr_callback;
|
||||
void *user_data;
|
||||
};
|
||||
|
||||
void copyMeshes(const std::vector<MeshSet<3>::mesh_t*> &meshes,
|
||||
std::vector<MeshSet<3>::mesh_t*> *new_meshes)
|
||||
{
|
||||
@@ -159,73 +154,24 @@ void copyMeshes(const std::vector<MeshSet<3>::mesh_t*> &meshes,
|
||||
}
|
||||
}
|
||||
|
||||
struct NewMeshMapping {
|
||||
std::map<const MeshSet<3>::edge_t*, MeshSet<3>::vertex_t*> orig_edge_vert;
|
||||
};
|
||||
|
||||
void prepareNewMeshMapping(const std::vector<MeshSet<3>::mesh_t*> &meshes,
|
||||
NewMeshMapping *mapping)
|
||||
{
|
||||
for (size_t m = 0; m < meshes.size(); ++m) {
|
||||
MeshSet<3>::mesh_t *mesh = meshes[m];
|
||||
for (size_t f = 0; f < mesh->faces.size(); ++f) {
|
||||
MeshSet<3>::face_t *face = mesh->faces[f];
|
||||
MeshSet<3>::edge_t *edge = face->edge;
|
||||
do {
|
||||
mapping->orig_edge_vert[edge] = edge->vert;
|
||||
edge = edge->next;
|
||||
} while (edge != face->edge);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void runNewMeshSetHooks(UnionIntersectionContext *ctx,
|
||||
NewMeshMapping *mapping,
|
||||
MeshSet<3> *mesh_set)
|
||||
{
|
||||
for (size_t m = 0; m < mesh_set->meshes.size(); ++m) {
|
||||
MeshSet<3>::mesh_t *mesh = mesh_set->meshes[m];
|
||||
for (size_t f = 0; f < mesh->faces.size(); ++f) {
|
||||
MeshSet<3>::face_t *face = mesh->faces[f];
|
||||
MeshSet<3>::edge_t *edge = face->edge;
|
||||
do {
|
||||
const MeshSet<3>::vertex_t *orig_vert = mapping->orig_edge_vert[edge];
|
||||
const MeshSet<3>::vertex_t *new_vert = edge->vert;
|
||||
ctx->vertex_attr_callback(orig_vert, new_vert, ctx->user_data);
|
||||
edge = edge->next;
|
||||
} while (edge != face->edge);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
MeshSet<3> *newMeshSetFromMeshesWithAttrs(
|
||||
UnionIntersectionContext *ctx,
|
||||
std::vector<MeshSet<3>::mesh_t*> &meshes)
|
||||
{
|
||||
NewMeshMapping mapping;
|
||||
prepareNewMeshMapping(meshes, &mapping);
|
||||
MeshSet<3> *mesh_set = new MeshSet<3>(meshes);
|
||||
runNewMeshSetHooks(ctx, &mapping, mesh_set);
|
||||
return mesh_set;
|
||||
}
|
||||
|
||||
|
||||
MeshSet<3> *meshSetFromMeshes(UnionIntersectionContext *ctx,
|
||||
const std::vector<MeshSet<3>::mesh_t*> &meshes)
|
||||
MeshSet<3> *meshSetFromMeshes(const std::vector<MeshSet<3>::mesh_t*> &meshes)
|
||||
{
|
||||
std::vector<MeshSet<3>::mesh_t*> new_meshes;
|
||||
|
||||
copyMeshes(meshes, &new_meshes);
|
||||
return newMeshSetFromMeshesWithAttrs(ctx, new_meshes);
|
||||
|
||||
return new MeshSet<3>(new_meshes);
|
||||
}
|
||||
|
||||
MeshSet<3> *meshSetFromTwoMeshes(UnionIntersectionContext *ctx,
|
||||
const std::vector<MeshSet<3>::mesh_t*> &left_meshes,
|
||||
MeshSet<3> *meshSetFromTwoMeshes(const std::vector<MeshSet<3>::mesh_t*> &left_meshes,
|
||||
const std::vector<MeshSet<3>::mesh_t*> &right_meshes)
|
||||
{
|
||||
std::vector<MeshSet<3>::mesh_t*> new_meshes;
|
||||
|
||||
copyMeshes(left_meshes, &new_meshes);
|
||||
copyMeshes(right_meshes, &new_meshes);
|
||||
return newMeshSetFromMeshesWithAttrs(ctx, new_meshes);
|
||||
|
||||
return new MeshSet<3>(new_meshes);
|
||||
}
|
||||
|
||||
bool checkEdgeFaceIntersections_do(Intersections &intersections,
|
||||
@@ -403,8 +349,7 @@ void getIntersectedOperandMeshes(std::vector<MeshSet<3>::mesh_t*> *meshes,
|
||||
}
|
||||
}
|
||||
|
||||
MeshSet<3> *getIntersectedOperand(UnionIntersectionContext *ctx,
|
||||
std::vector<MeshSet<3>::mesh_t*> *meshes,
|
||||
MeshSet<3> *getIntersectedOperand(std::vector<MeshSet<3>::mesh_t*> *meshes,
|
||||
const MeshSet<3>::aabb_t &otherAABB,
|
||||
RTreeCache *rtree_cache,
|
||||
IntersectCache *intersect_cache)
|
||||
@@ -415,14 +360,13 @@ MeshSet<3> *getIntersectedOperand(UnionIntersectionContext *ctx,
|
||||
if (operandMeshes.size() == 0)
|
||||
return NULL;
|
||||
|
||||
return meshSetFromMeshes(ctx, operandMeshes);
|
||||
return meshSetFromMeshes(operandMeshes);
|
||||
}
|
||||
|
||||
MeshSet<3> *unionIntersectingMeshes(carve::csg::CSG *csg,
|
||||
MeshSet<3> *poly,
|
||||
const MeshSet<3> *other_poly,
|
||||
const MeshSet<3>::aabb_t &otherAABB,
|
||||
VertexAttrsCallback vertex_attr_callback,
|
||||
UnionIntersectionsCallback callback,
|
||||
void *user_data)
|
||||
{
|
||||
@@ -436,12 +380,7 @@ MeshSet<3> *unionIntersectingMeshes(carve::csg::CSG *csg,
|
||||
RTreeCache rtree_cache;
|
||||
IntersectCache intersect_cache;
|
||||
|
||||
UnionIntersectionContext ctx;
|
||||
ctx.vertex_attr_callback = vertex_attr_callback;
|
||||
ctx.user_data = user_data;
|
||||
|
||||
MeshSet<3> *left = getIntersectedOperand(&ctx,
|
||||
&orig_meshes,
|
||||
MeshSet<3> *left = getIntersectedOperand(&orig_meshes,
|
||||
otherAABB,
|
||||
&rtree_cache,
|
||||
&intersect_cache);
|
||||
@@ -452,8 +391,7 @@ MeshSet<3> *unionIntersectingMeshes(carve::csg::CSG *csg,
|
||||
}
|
||||
|
||||
while (orig_meshes.size()) {
|
||||
MeshSet<3> *right = getIntersectedOperand(&ctx,
|
||||
&orig_meshes,
|
||||
MeshSet<3> *right = getIntersectedOperand(&orig_meshes,
|
||||
otherAABB,
|
||||
&rtree_cache,
|
||||
&intersect_cache);
|
||||
@@ -484,9 +422,7 @@ MeshSet<3> *unionIntersectingMeshes(carve::csg::CSG *csg,
|
||||
catch (carve::exception e) {
|
||||
std::cerr << "CSG failed, exception " << e.str() << std::endl;
|
||||
|
||||
MeshSet<3> *result = meshSetFromTwoMeshes(&ctx,
|
||||
left->meshes,
|
||||
right->meshes);
|
||||
MeshSet<3> *result = meshSetFromTwoMeshes(left->meshes, right->meshes);
|
||||
|
||||
callback(result, other_poly, user_data);
|
||||
|
||||
@@ -512,9 +448,7 @@ MeshSet<3> *unionIntersectingMeshes(carve::csg::CSG *csg,
|
||||
|
||||
// Append all meshes which doesn't have intersection with another operand as-is.
|
||||
if (orig_meshes.size()) {
|
||||
MeshSet<3> *result = meshSetFromTwoMeshes(&ctx,
|
||||
left->meshes,
|
||||
orig_meshes);
|
||||
MeshSet<3> *result = meshSetFromTwoMeshes(left->meshes, orig_meshes);
|
||||
|
||||
delete left;
|
||||
left = result;
|
||||
@@ -530,7 +464,6 @@ MeshSet<3> *unionIntersectingMeshes(carve::csg::CSG *csg,
|
||||
void carve_unionIntersections(carve::csg::CSG *csg,
|
||||
MeshSet<3> **left_r,
|
||||
MeshSet<3> **right_r,
|
||||
VertexAttrsCallback vertex_attr_callback,
|
||||
UnionIntersectionsCallback callback,
|
||||
void *user_data)
|
||||
{
|
||||
@@ -544,9 +477,9 @@ void carve_unionIntersections(carve::csg::CSG *csg,
|
||||
MeshSet<3>::aabb_t rightAABB = right->getAABB();;
|
||||
|
||||
left = unionIntersectingMeshes(csg, left, right, rightAABB,
|
||||
vertex_attr_callback, callback, user_data);
|
||||
callback, user_data);
|
||||
right = unionIntersectingMeshes(csg, right, left, leftAABB,
|
||||
vertex_attr_callback, callback, user_data);
|
||||
callback, user_data);
|
||||
|
||||
if (left != *left_r) {
|
||||
delete *left_r;
|
||||
|
12
extern/carve/carve-util.h
vendored
12
extern/carve/carve-util.h
vendored
@@ -70,10 +70,6 @@ void carve_getRescaleMinMax(const carve::mesh::MeshSet<3> *left,
|
||||
carve::geom3d::Vector *min,
|
||||
carve::geom3d::Vector *max);
|
||||
|
||||
typedef void (*VertexAttrsCallback) (const carve::mesh::MeshSet<3>::vertex_t *orig_vert,
|
||||
const carve::mesh::MeshSet<3>::vertex_t *new_vert,
|
||||
void *userdata);
|
||||
|
||||
typedef void (*UnionIntersectionsCallback) (const carve::mesh::MeshSet<3> *left,
|
||||
const carve::mesh::MeshSet<3> *right,
|
||||
void *userdata);
|
||||
@@ -81,7 +77,6 @@ typedef void (*UnionIntersectionsCallback) (const carve::mesh::MeshSet<3> *left,
|
||||
void carve_unionIntersections(carve::csg::CSG *csg,
|
||||
carve::mesh::MeshSet<3> **left_r,
|
||||
carve::mesh::MeshSet<3> **right_r,
|
||||
VertexAttrsCallback vertex_attr_callback,
|
||||
UnionIntersectionsCallback callback,
|
||||
void *user_data);
|
||||
|
||||
@@ -153,13 +148,6 @@ namespace carve {
|
||||
void setAttribute(const meshset_t::vertex_t *v, const attr_t &attr) {
|
||||
attrs[v] = attr;
|
||||
}
|
||||
|
||||
void removeAttribute(const meshset_t::vertex_t *v) {
|
||||
typename attrmap_t::iterator it = attrs.find(v);
|
||||
if (it != attrs.end()) {
|
||||
attrs.erase(it);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
template<typename attr_t>
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user