Compare commits

..

78 Commits

Author SHA1 Message Date
Severin
1254e98a48 Merge branch 'master' into ime 2014-12-04 20:48:11 +01:00
Severin
151f2467a4 IME: Add Missing #ifdef WITH_INPUT_IMEs 2014-12-04 20:32:10 +01:00
Severin
6919ea1726 IME: Fix Crash on Escape Cancel 2014-12-04 20:12:49 +01:00
Severin
b64b18f8ac IME: Refactor Underline Drawing Code
* ED_text_draw_underline is now UI_text_draw_underline and is used for all
IDE appearances
* usual minor cleanup
2014-12-04 19:12:05 +01:00
Severin
36fc98cb0b IME: Various fixes + usual cleanup 2014-12-02 01:24:16 +01:00
Severin
36652982dd Merge branch 'master' into ime 2014-12-01 17:35:11 +01:00
Severin
a54d863a93 IME: Fix IME not ending composition after region change
+ adding some asserts
2014-12-01 17:20:13 +01:00
Severin
cce89d04ee Merge branch 'master' into ime 2014-12-01 15:25:05 +01:00
Severin
d399927749 IME: Deduplicate wmImeData + minor cleanup
* deduplicate use of wmImeData
* add missing "ifdef WITH_INPUT_IME"s
* usual minor cleanup
2014-12-01 15:12:24 +01:00
Severin
80496abbf4 Minor cleanup
Adressing some of the inline comments from @sergey and @campbellbarton
2014-11-30 20:06:29 +01:00
Severin
b2a5b96ff4 Merge branch 'master' into ime 2014-11-30 16:28:02 +01:00
Severin
4fc691f619 Merge branch 'master' into ime 2014-11-26 00:47:09 +01:00
Severin
316bae9fe8 General Review Changes
Main changes:
* avoid using MEM_mallocN on every redraw
* continue implementation of WITH_INPUT_IME CMake flag
* whitespace and code style cleanups
2014-11-26 00:34:24 +01:00
Severin
3e5962656a Merge remote-tracking branch 'origin/master' into ime
Conflicts:
	source/blender/editors/space_node/node_add.c
	source/blender/editors/space_text/text_draw.c
	source/blender/editors/space_view3d/view3d_edit.c
2014-11-24 22:22:48 +01:00
Severin
1087b9236f Merge branch master into input_method_editor 2014-11-24 00:41:32 +01:00
Severin
a677da8638 Finish support for CMake flag WITH_INPUT_IME
Note: implementation not finished, needs a bit cleanup
2014-11-24 00:41:32 +01:00
Severin
b5cf3cd415 Cleanup: Moar whitespace cleanup, plus remove missed printf
Hope that was the last cleanup commit for now :/
2014-11-24 00:41:31 +01:00
Severin
f65879fd51 Add missing files 2014-11-24 00:41:31 +01:00
Severin
ff27b12904 Cleanup: Whitespace, Comments, etc.
It may be a bit early to do such cleanups, there are more important things
to do first, but those things are extremely time consuming and I wanted to
get rid of them first ;)
2014-11-24 00:41:30 +01:00
Severin
30654e186f set up ime branch 2014-11-24 00:41:30 +01:00
Severin
60a035c52a set up ime branch 2014-11-24 00:41:29 +01:00
fde03ec578 Minor edits to T42649 fix
- only modify paths for newly loaded images
- don't attempt to read from library paths
2014-11-24 00:34:00 +01:00
0f159b7306 Fix BLI_Bitmap - was not usable in BKE area (strict compile flags). 2014-11-24 00:34:00 +01:00
98beae0c11 Fix freestyle compile.
Do not know why this shows up now, probably a recent tweak in BLI_utildefines.h or so...
2014-11-24 00:33:59 +01:00
julianeisel
b68166355a Fix T42649: Use Relative Paths for Node Editor & 3D View Images
Images are now added with relative paths to the Node Editor and the 3D View.
2014-11-24 00:33:59 +01:00
2bf7215130 Refactor: BLI_path_util (part 2)
Use BKE_appdir/tempdir naming prefix for functions extracted from BLI_path_util
2014-11-24 00:33:58 +01:00
14502a3557 Refactor: BLI_path_util (split out app directory access)
This module is intended for path manipulation functions
but had utility functions added to access various directories.
2014-11-24 00:33:58 +01:00
e0283f8b6c Cleanup: warnings 2014-11-24 00:33:57 +01:00
fffc35c34a Cycles UI: Several fixes for recent additions...
* Alpha Property was removed (Fix T42690)
* Some tweaks to make the panel look better again.
* Use abreviated form "Multiple Importance" everywhere, for consistency.
2014-11-24 00:33:56 +01:00
8299602f1f Math Lib: add constant: M_SQRT1_3 1/sqrt(3) 2014-11-24 00:33:56 +01:00
3d6b912293 Fix T42688: python crash: bpy.context.scene.update().
`ED_render_scene_update()` should ensure it does have some WM to work on...
2014-11-24 00:33:55 +01:00
4a55637a0d Bugfix T42549: Grease pencil layers are not scene-specific for "full copy scenes" 2014-11-24 00:33:54 +01:00
4135458c3d Fix for previous commit
gpencil_data_duplicate() was being used for gp drawing undo buffers, where using an
exact copy is exactly what we want/need. Instead, the code here now has an additional
arg for determining whether a direct copy is warranted or not.
2014-11-24 00:33:54 +01:00
c3eab0e2f4 Bugfix: Duplicating Grease Pencil datablocks wasn't doing so in a safe way
Grease Pencil data (bGPdata) is now a datablock, so it isn't safe to use
MEM_dupallocN() for copying new instances of these anymore.
2014-11-24 00:33:53 +01:00
9901eed588 Fix leftover f postfix from C code. 2014-11-24 00:33:53 +01:00
48b3a09c41 Text Editor: incorrect clipping at bottom
Patch T42637 by @donfabio
2014-11-24 00:33:52 +01:00
ea671a6e87 fix T42676 replaced windows specific include by BLI_utildefines.h 2014-11-24 00:30:39 +01:00
a36778ab8e BMesh: check for loop side-of-loop & side-of-edge 2014-11-24 00:30:38 +01:00
b4337e870e Cleanup: typo 2014-11-24 00:30:37 +01:00
ed01da08fd Cycles: support for specular color in solid shading mode, available in
the material panel.

Patch by Phillipp Oeser (D62) with some minor modifications, thanks!
2014-11-24 00:30:37 +01:00
e2855b81a4 Bugfix T42048: Keyframes missing when animating particle system blend texture parameters
Textures attached to particle systems are now get their animation data listed
under the particle systems they are attached to now. This is the most convenient
and direct way that these can get included
2014-11-24 00:30:36 +01:00
6650436d4a CMake: disable OSL if its not found 2014-11-24 00:30:36 +01:00
e2e69f6011 Bugfix T41527: Animations of world texture properties invisible in anim editors
Was caused by a typo - "items" was used in place of "tmp_items", causing animation
in the texture to get ignored if nothing else was present
2014-11-24 00:30:35 +01:00
6147ad3596 Bugfix T42648: Invert Selection operator is not working for animation channels
The wrong selection mode was being used/passed to operators.
2014-11-24 00:30:35 +01:00
b0ea6aecb3 Fix T42421: HDR reader could easily read past buffer (truncated HDR files e.g.) and segfault.
Now readers get an 'mem_eof' guard pointer, and they abort in case they try to go past it.
2014-11-24 00:30:34 +01:00
a7536dfac5 Task scheduler: Add an option to limit number of threads per pool
This way we can have scheduler capable of scheduling tasks on all the CPUs
but in the same time we can limit tasks like baking (in the future) to use
no more than given number of threads.
2014-11-24 00:30:34 +01:00
d472651713 Compsitor: White space cleanup 2014-11-24 00:30:33 +01:00
808c6e383b Cleanup: ints/shorts -> bool. 2014-11-24 00:30:33 +01:00
70dee80a8b Fix T42622, environment texture GLSL result different from rendering.
Also included mirror ball shader, which was missing.
2014-11-24 00:30:32 +01:00
77447f0401 Fix T42639, editcurve flags not getting restored on undo.
Error here could be reproduced by tweaking curve properties such as
2d-3d or fill type and undoing.
2014-11-24 00:30:32 +01:00
157e6ef22d Fix T42662 hide unselected does not reveal selected.
Not sure if this is a bugfix exactly but should help the gooseberry team
with their workflow.
2014-11-24 00:30:31 +01:00
78b91eb23f Fix T42660 snapping not working nicely on graph editor.
Basically, get the grid increments and reuse them when snapping. System
is slightly crappy here, we should calculate those factors only once,
but leaving as todo for later.
2014-11-24 00:30:31 +01:00
c6b2422db0 Fix color tweaking in vertex painting not getting an undo push (would
cause color reset between strokes)
2014-11-24 00:30:30 +01:00
d6931a6ce6 Fix T42647, vertex and weight painting mode do not display solid shaded
when VBOs is off.
2014-11-24 00:30:29 +01:00
d5e0613d6e SCons: Proper solution for local symbols map
Configuration used to override the link flags, it better restore them
once the configuration is done.
2014-11-24 00:30:29 +01:00
6a6336ce77 Fix T42638: Roll angle inconsistent flip in edit mode.
Basically, `angle_compat_rad()` was completely broken -
example of result it could produce:

| new angle | compat angle |    result
| -0.000000 |   3.141593   | -> 3.141593

... Where 0.0 (or 2 * PI) would be expected!
2014-11-24 00:30:28 +01:00
e0b960a77e Cycles: Remove dynamic library helper files
They were only needed for CUDA wrangler. Since we've switched to CUEW
this utility functions are no longer needed.
2014-11-24 00:30:28 +01:00
7bd15aa347 Cycles: Fix typo on graphiz graph dumper 2014-11-24 00:30:27 +01:00
bbe68ddf7e Bugfix T42661: shortcut "." and "," for changing pivot center don't work on Graph Editor 2014-11-24 00:30:27 +01:00
339147666a SCons: Remove duplicate PLATFORM_LINKFLAGS from makesdna and makesrna
Hopefully it'll fix "anonymous version tag cannot be combined with other version"
compilation error.
2014-11-24 00:30:26 +01:00
716642379f mathutils.kdtree: fix docstrings 2014-11-24 00:30:26 +01:00
b6192bfa3b Cleanup: Remove SD_BSDF_GLOSSY flag, unused. 2014-11-24 00:30:25 +01:00
15a212ee06 Cleanup: #define -> enums. 2014-11-24 00:30:25 +01:00
d813f70382 Switch to SDL2 on OSX 2014-11-24 00:30:24 +01:00
3e5de9dc3f Fix: Shift-H now works in main graph editor area too
In the process, I've removed the old operator (ANIM_OT_channels_visibility_set)
and folded that option in with the hide operator, to make this consistent
with how this is done in the 3D view and other parts of Blender.
2014-11-24 00:30:23 +01:00
656b868db9 Tweaks to hide/reveal hotkeys for Graph Editor
Now the hotkeys here work in line with what's done for other parts of Blender
* H = Hide selected
* Shift-H = Hide unselected  (i.e. old VKEY behaviour)
* Alt-H = Reveal all
2014-11-24 00:30:23 +01:00
aee3d19082 Cleanup: name hide/reveal, like rest of operators 2014-11-24 00:30:22 +01:00
56d4aed17d Graph Editor: H/Shift-H now hide and unhide selected curves (Gooseberry Request)
Revised the tools for managing which FCurves are visible in the Graph Editor
curves area. Now, there are the following tools in place:
* V (channels region only) = Hide all curves except those in selected channels  [OLD]

* H       = Hide all selected curves  [NEW]
* Shift-H = Show all previously hidden curves [NEW]

I've removed the old operator to toggle visibility status of selected curves,
as it doesn't seem that useful anymore.
2014-11-24 00:30:22 +01:00
c6acfdf2a0 Refactor: Move part of vgroup handling code from ED_mesh/object_vgroup.c to BKE_object_deform.
Along with some minor cleanup and simplifications.

Reviewers: campbellbarton

Subscribers: sergey

Differential Revision: https://developer.blender.org/D903
2014-11-24 00:30:21 +01:00
Severin
baccf32076 Merge branch 'master' of git.blender.org:blender into input_method_editor 2014-11-18 23:12:09 +01:00
Severin
e42f974ae6 Finish support for CMake flag WITH_INPUT_IME
Note: implementation not finished, needs a bit cleanup
2014-11-18 20:05:05 +01:00
Severin
122ad8ac6d Cleanup: Moar whitespace cleanup, plus remove missed printf
Hope that was the last cleanup commit for now :/
2014-11-18 15:57:03 +01:00
Severin
f086c5a1ea CMake: add WITH_INPUT_IME option + various fixes/cleanup
*note:* implementation of WITH_INPUT_IME is only halfway finished, you'll
get build errors if you disable it
2014-11-18 01:44:12 +01:00
Severin
c4b7440bc0 Cleanup: Whitespace before comments
Missed that in rB23c7716bbbdef99
2014-11-18 00:02:47 +01:00
Severin
7d281401fd Add missing files 2014-11-17 23:57:27 +01:00
Severin
23c7716bbb Cleanup: Whitespace, Comments, etc.
It may be a bit early to do such cleanups, there are more important things
to do first, but those things are extremely time consuming and I wanted to
get rid of them first ;)
2014-11-17 23:28:59 +01:00
Severin
98f0333110 Cleanup: Use *win instead of *window (moar consistent) 2014-11-17 18:30:01 +01:00
Severin
7907014ed7 set up ime branch 2014-11-17 18:18:11 +01:00
2076 changed files with 43530 additions and 103162 deletions

View File

@@ -200,8 +200,7 @@ mark_as_advanced(WITH_PYTHON_SECURITY) # some distributions see this as a secur
set(WITH_PYTHON_SECURITY ON CACHE BOOL "ON" FORCE) # temp force on. set(WITH_PYTHON_SECURITY ON CACHE BOOL "ON" FORCE) # temp force on.
option(WITH_PYTHON_SAFETY "Enable internal API error checking to track invalid data to prevent crash on access (at the expense of some effeciency, only enable for development)." OFF) option(WITH_PYTHON_SAFETY "Enable internal API error checking to track invalid data to prevent crash on access (at the expense of some effeciency, only enable for development)." OFF)
mark_as_advanced(WITH_PYTHON_SAFETY) option(WITH_PYTHON_MODULE "Enable building as a python module which runs without a user interface, like running regular blender in background mode (experimental, only enable for development)" OFF)
option(WITH_PYTHON_MODULE "Enable building as a python module which runs without a user interface, like running regular blender in background mode (experimental, only enable for development), installs to PYTHON_SITE_PACKAGES (or CMAKE_INSTALL_PREFIX if WITH_INSTALL_PORTABLE is enabled)." OFF)
if(APPLE) if(APPLE)
option(WITH_PYTHON_FRAMEWORK "Enable building using the Python available in the framework (OSX only)" OFF) option(WITH_PYTHON_FRAMEWORK "Enable building using the Python available in the framework (OSX only)" OFF)
endif() endif()
@@ -261,10 +260,6 @@ endif()
# (unix defaults to System OpenJPEG On) # (unix defaults to System OpenJPEG On)
option(WITH_SYSTEM_OPENJPEG "Use the operating systems OpenJPEG library" OFF) option(WITH_SYSTEM_OPENJPEG "Use the operating systems OpenJPEG library" OFF)
if(UNIX AND NOT APPLE)
option(WITH_SYSTEM_EIGEN3 "Use the systems Eigen3 library" OFF)
endif()
# Modifiers # Modifiers
option(WITH_MOD_FLUID "Enable Elbeem Modifier (Fluid Simulation)" ON) option(WITH_MOD_FLUID "Enable Elbeem Modifier (Fluid Simulation)" ON)
@@ -313,9 +308,6 @@ endif()
# Compression # Compression
option(WITH_LZO "Enable fast LZO compression (used for pointcache)" ON) option(WITH_LZO "Enable fast LZO compression (used for pointcache)" ON)
option(WITH_LZMA "Enable best LZMA compression, (used for pointcache)" ON) option(WITH_LZMA "Enable best LZMA compression, (used for pointcache)" ON)
if(UNIX AND NOT APPLE)
option(WITH_SYSTEM_LZO "Use the system LZO library" OFF)
endif()
# Camera/motion tracking # Camera/motion tracking
option(WITH_LIBMV "Enable libmv structure from motion library" ON) option(WITH_LIBMV "Enable libmv structure from motion library" ON)
@@ -327,7 +319,7 @@ option(WITH_FREESTYLE "Enable Freestyle (advanced edges rendering)" ON)
# Misc # Misc
if (WIN32) if (WIN32)
option(WITH_INPUT_IME "Enable Input Method Editor (IME) for complex Asian character input" ON) option(WITH_INPUT_IME "Enable Input Method Editor (IME)" ON)
endif() endif()
option(WITH_INPUT_NDOF "Enable NDOF input devices (SpaceNavigator and friends)" ${_init_INPUT_NDOF}) option(WITH_INPUT_NDOF "Enable NDOF input devices (SpaceNavigator and friends)" ${_init_INPUT_NDOF})
option(WITH_RAYOPTIMIZATION "Enable use of SIMD (SSE) optimizations for the raytracer" ON) option(WITH_RAYOPTIMIZATION "Enable use of SIMD (SSE) optimizations for the raytracer" ON)
@@ -377,7 +369,7 @@ endif()
mark_as_advanced(LLVM_STATIC) mark_as_advanced(LLVM_STATIC)
# disable for now, but plan to support on all platforms eventually # disable for now, but plan to support on all platforms eventually
option(WITH_MEM_JEMALLOC "Enable malloc replacement (http://www.canonware.com/jemalloc)" ON) option(WITH_MEM_JEMALLOC "Enable malloc replacement (http://www.canonware.com/jemalloc)" OFF)
mark_as_advanced(WITH_MEM_JEMALLOC) mark_as_advanced(WITH_MEM_JEMALLOC)
# currently only used for BLI_mempool # currently only used for BLI_mempool
@@ -411,7 +403,6 @@ option(WITH_GL_EGL "Use the EGL OpenGL system library instead of th
option(WITH_GL_PROFILE_COMPAT "Support using the OpenGL 'compatibility' profile. (deprecated)" ON ) option(WITH_GL_PROFILE_COMPAT "Support using the OpenGL 'compatibility' profile. (deprecated)" ON )
option(WITH_GL_PROFILE_CORE "Support using the OpenGL 3.2+ 'core' profile." OFF) option(WITH_GL_PROFILE_CORE "Support using the OpenGL 3.2+ 'core' profile." OFF)
option(WITH_GL_PROFILE_ES20 "Support using OpenGL ES 2.0. (thru either EGL or the AGL/WGL/XGL 'es20' profile)" OFF) option(WITH_GL_PROFILE_ES20 "Support using OpenGL ES 2.0. (thru either EGL or the AGL/WGL/XGL 'es20' profile)" OFF)
option(WITH_GPU_DEBUG "Create a debug OpenGL context (allows inserting custom messages and getting notifications for bad GL use)" OFF)
mark_as_advanced( mark_as_advanced(
WITH_GLEW_MX WITH_GLEW_MX
@@ -420,7 +411,6 @@ mark_as_advanced(
WITH_GL_PROFILE_COMPAT WITH_GL_PROFILE_COMPAT
WITH_GL_PROFILE_CORE WITH_GL_PROFILE_CORE
WITH_GL_PROFILE_ES20 WITH_GL_PROFILE_ES20
WITH_GPU_DEBUG
) )
if(WITH_GL_PROFILE_COMPAT) if(WITH_GL_PROFILE_COMPAT)
@@ -444,10 +434,6 @@ if(MSVC)
set(CPACK_INSTALL_PREFIX ${CMAKE_GENERIC_PROGRAM_FILES}/${}) set(CPACK_INSTALL_PREFIX ${CMAKE_GENERIC_PROGRAM_FILES}/${})
endif() endif()
# Experimental support of C++11
option(WITH_CPP11 "Build with C++11 standard enabled, for development use only!" OFF)
mark_as_advanced(WITH_CPP11)
# avoid using again # avoid using again
option_defaults_clear() option_defaults_clear()
@@ -674,7 +660,6 @@ if(WITH_GHOST_SDL OR WITH_HEADLESS)
set(WITH_X11_XINPUT OFF) set(WITH_X11_XINPUT OFF)
set(WITH_X11_XF86VMODE OFF) set(WITH_X11_XF86VMODE OFF)
set(WITH_GHOST_XDND OFF) set(WITH_GHOST_XDND OFF)
set(WITH_INPUT_IME OFF)
endif() endif()
if(WITH_CPU_SSE) if(WITH_CPU_SSE)
@@ -809,21 +794,6 @@ if(UNIX AND NOT APPLE)
find_package_wrapper(ZLIB REQUIRED) find_package_wrapper(ZLIB REQUIRED)
find_package_wrapper(Freetype 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) if(WITH_PYTHON)
# No way to set py34. remove for now. # No way to set py34. remove for now.
# find_package(PythonLibs) # find_package(PythonLibs)
@@ -868,21 +838,17 @@ if(UNIX AND NOT APPLE)
if(WITH_SDL) if(WITH_SDL)
if(WITH_SDL_DYNLOAD) if(WITH_SDL_DYNLOAD)
set(SDLMAIN_LIBRARY)
set(SDL_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/extern/sdlew/include/SDL2") set(SDL_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/extern/sdlew/include/SDL2")
set(SDL_LIBRARY) set(SDL_LIBRARY)
else() set(SDL_LIBRARY_TEMP)
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() else()
find_package_wrapper(SDL) find_package_wrapper(SDL)
endif()
mark_as_advanced( mark_as_advanced(
SDLMAIN_LIBRARY
SDL_INCLUDE_DIR SDL_INCLUDE_DIR
SDL_LIBRARY SDL_LIBRARY
SDL_LIBRARY_TEMP
) )
# unset(SDLMAIN_LIBRARY CACHE) # unset(SDLMAIN_LIBRARY CACHE)
if(NOT SDL_FOUND) if(NOT SDL_FOUND)
@@ -960,24 +926,6 @@ if(UNIX AND NOT APPLE)
endif() endif()
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_BOOST) if(WITH_BOOST)
# uses in build instructions to override include and library variables # uses in build instructions to override include and library variables
if(NOT BOOST_CUSTOM) if(NOT BOOST_CUSTOM)
@@ -986,12 +934,6 @@ if(UNIX AND NOT APPLE)
endif() endif()
set(Boost_USE_MULTITHREADED ON) set(Boost_USE_MULTITHREADED ON)
set(__boost_packages filesystem regex system thread date_time) set(__boost_packages filesystem regex system 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) if(WITH_INTERNATIONAL)
list(APPEND __boost_packages locale) list(APPEND __boost_packages locale)
endif() endif()
@@ -1021,12 +963,6 @@ if(UNIX AND NOT APPLE)
if(WITH_OPENIMAGEIO) if(WITH_OPENIMAGEIO)
find_package_wrapper(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_LIBRARIES ${OPENIMAGEIO_LIBRARIES} ${PNG_LIBRARIES} ${JPEG_LIBRARIES} ${ZLIB_LIBRARIES} ${BOOST_LIBRARIES})
set(OPENIMAGEIO_LIBPATH) # TODO, remove and reference the absolute path everywhere set(OPENIMAGEIO_LIBPATH) # TODO, remove and reference the absolute path everywhere
@@ -1060,18 +996,18 @@ if(UNIX AND NOT APPLE)
# XXX Maybe most of this section should go into an llvm module? # XXX Maybe most of this section should go into an llvm module?
if(WITH_LLVM) if(WITH_LLVM)
# Set llvm version if not specified
if(LLVM_ROOT_DIR) if(NOT LLVM_VERSION)
if(NOT DEFINED LLVM_VERSION) set(LLVM_VERSION "3.0")
find_program(LLVM_CONFIG llvm-config-${LLVM_VERSION} HINTS ${LLVM_ROOT_DIR}/bin NO_CMAKE_PATH)
endif() endif()
if(LLVM_DIRECTORY)
find_program(LLVM_CONFIG llvm-config-${LLVM_VERSION} HINTS ${LLVM_DIRECTORY}/bin NO_CMAKE_PATH)
if(NOT LLVM_CONFIG) if(NOT LLVM_CONFIG)
find_program(LLVM_CONFIG llvm-config HINTS ${LLVM_ROOT_DIR}/bin NO_CMAKE_PATH) find_program(LLVM_CONFIG llvm-config HINTS ${LLVM_DIRECTORY}/bin NO_CMAKE_PATH)
endif() endif()
else() else()
if(NOT DEFINED LLVM_VERSION)
find_program(LLVM_CONFIG llvm-config-${LLVM_VERSION}) find_program(LLVM_CONFIG llvm-config-${LLVM_VERSION})
endif()
if(NOT LLVM_CONFIG) if(NOT LLVM_CONFIG)
find_program(LLVM_CONFIG llvm-config) find_program(LLVM_CONFIG llvm-config)
endif() endif()
@@ -1083,11 +1019,11 @@ if(UNIX AND NOT APPLE)
OUTPUT_STRIP_TRAILING_WHITESPACE) OUTPUT_STRIP_TRAILING_WHITESPACE)
set(LLVM_VERSION ${LLVM_VERSION} CACHE STRING "Version of LLVM to use") set(LLVM_VERSION ${LLVM_VERSION} CACHE STRING "Version of LLVM to use")
endif() endif()
if(NOT DEFINED LLVM_ROOT_DIR) if(NOT DEFINED LLVM_DIRECTORY)
execute_process(COMMAND ${LLVM_CONFIG} --prefix execute_process(COMMAND ${LLVM_CONFIG} --prefix
OUTPUT_VARIABLE LLVM_ROOT_DIR OUTPUT_VARIABLE LLVM_DIRECTORY
OUTPUT_STRIP_TRAILING_WHITESPACE) OUTPUT_STRIP_TRAILING_WHITESPACE)
set(LLVM_ROOT_DIR ${LLVM_ROOT_DIR} CACHE PATH "Path to the LLVM installation") set(LLVM_DIRECTORY ${LLVM_DIRECTORY} CACHE PATH "Path to the LLVM installation")
endif() endif()
if(NOT DEFINED LLVM_LIBPATH) if(NOT DEFINED LLVM_LIBPATH)
execute_process(COMMAND ${LLVM_CONFIG} --libdir execute_process(COMMAND ${LLVM_CONFIG} --libdir
@@ -1108,7 +1044,7 @@ if(UNIX AND NOT APPLE)
endif() endif()
if(LLVM_LIBRARY AND LLVM_ROOT_DIR AND LLVM_LIBPATH) if(LLVM_LIBRARY AND LLVM_DIRECTORY AND LLVM_LIBPATH)
if(LLVM_STATIC) if(LLVM_STATIC)
# if static LLVM libraries were requested, use llvm-config to generate # if static LLVM libraries were requested, use llvm-config to generate
# the list of what libraries we need, and substitute that in the right # the list of what libraries we need, and substitute that in the right
@@ -1129,13 +1065,33 @@ if(UNIX AND NOT APPLE)
set(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -Wl,--version-script=${CMAKE_SOURCE_DIR}/source/creator/blender.map") set(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -Wl,--version-script=${CMAKE_SOURCE_DIR}/source/creator/blender.map")
endif() endif()
if(WITH_CYCLES_OSL)
set(CYCLES_OSL ${LIBDIR}/osl CACHE PATH "Path to OpenShadingLanguage installation")
message(STATUS "CYCLES_OSL = ${CYCLES_OSL}")
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)
# Note: --whole-archive is needed to force loading of all symbols in liboslexec,
# otherwise LLVM is missing the osl_allocate_closure_component function
list(APPEND OSL_LIBRARIES ${OSL_LIB_COMP} -Wl,--whole-archive ${OSL_LIB_EXEC} -Wl,--no-whole-archive ${OSL_LIB_QUERY})
find_path(OSL_INCLUDES OSL/oslclosure.h PATHS ${CYCLES_OSL}/include)
find_program(OSL_COMPILER NAMES oslc PATHS ${CYCLES_OSL}/bin)
if(OSL_INCLUDES AND OSL_LIBRARIES AND OSL_COMPILER)
set(OSL_FOUND TRUE)
else()
message(STATUS "OSL not found")
set(WITH_CYCLES_OSL OFF)
endif()
endif()
# OpenSuse needs lutil, ArchLinux not, for now keep, can avoid by using --as-needed # OpenSuse needs lutil, ArchLinux not, for now keep, can avoid by using --as-needed
list(APPEND PLATFORM_LINKLIBS -lutil -lc -lm) list(APPEND PLATFORM_LINKLIBS -lutil -lc -lm)
find_package(Threads REQUIRED) find_package(Threads REQUIRED)
list(APPEND PLATFORM_LINKLIBS ${CMAKE_THREAD_LIBS_INIT}) list(APPEND PLATFORM_LINKLIBS ${CMAKE_THREAD_LIBS_INIT})
# used by other platforms
set(PTHREADS_LIBRARIES ${CMAKE_THREAD_LIBS_INIT})
if(CMAKE_DL_LIBS) if(CMAKE_DL_LIBS)
list(APPEND PLATFORM_LINKLIBS ${CMAKE_DL_LIBS}) list(APPEND PLATFORM_LINKLIBS ${CMAKE_DL_LIBS})
@@ -1196,11 +1152,7 @@ elseif(WIN32)
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_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") 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) list(APPEND PLATFORM_LINKLIBS ws2_32 vfw32 winmm kernel32 user32 gdi32 comdlg32 advapi32 shfolder shell32 ole32 oleaut32 uuid psapi imm32)
if(WITH_INPUT_IME)
list(APPEND PLATFORM_LINKLIBS imm32)
endif()
add_definitions( add_definitions(
-D_CRT_NONSTDC_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE
@@ -1285,8 +1237,8 @@ elseif(WIN32)
find_package(png) find_package(png)
if(NOT PNG_FOUND) if(NOT PNG_FOUND)
message(WARNING "Using HARDCODED libpng locations")
set(PNG_PNG_INCLUDE_DIR ${LIBDIR}/png/include) set(PNG_PNG_INCLUDE_DIR ${LIBDIR}/png/include)
message(WARNING "Using HARDCODED libpng locations")
set(PNG_LIBRARIES libpng) set(PNG_LIBRARIES libpng)
set(PNG "${LIBDIR}/png") set(PNG "${LIBDIR}/png")
set(PNG_INCLUDE_DIRS "${PNG}/include") set(PNG_INCLUDE_DIRS "${PNG}/include")
@@ -1379,13 +1331,13 @@ elseif(WIN32)
set(OPENEXR_INCLUDE_DIRS ${OPENEXR}/include/OpenEXR) set(OPENEXR_INCLUDE_DIRS ${OPENEXR}/include/OpenEXR)
set(OPENEXR_LIBPATH ${OPENEXR}/lib) set(OPENEXR_LIBPATH ${OPENEXR}/lib)
set(OPENEXR_LIBRARIES set(OPENEXR_LIBRARIES
${OPENEXR_LIBPATH}/Iex-2_2.lib ${OPENEXR_LIBPATH}/Iex-2_1.lib
${OPENEXR_LIBPATH}/Half.lib ${OPENEXR_LIBPATH}/Half.lib
${OPENEXR_LIBPATH}/IlmImf-2_2.lib ${OPENEXR_LIBPATH}/IlmImf-2_1.lib
${OPENEXR_LIBPATH}/Imath-2_2.lib ${OPENEXR_LIBPATH}/Imath-2_1.lib
${OPENEXR_LIBPATH}/IlmThread-2_2.lib ${OPENEXR_LIBPATH}/IlmThread-2_1.lib
) )
endif() endif(NOT OPENEXR_FOUND)
endif() endif()
if(WITH_IMAGE_TIFF) if(WITH_IMAGE_TIFF)
@@ -1425,10 +1377,10 @@ elseif(WIN32)
if(WITH_BOOST) if(WITH_BOOST)
if(WITH_CYCLES_OSL) if(WITH_CYCLES_OSL)
set(boost_extra_libs wave) set(boost_extra_libs wave)
endif() endif(WITH_CYCLES_OSL)
if(WITH_INTERNATIONAL) if(WITH_INTERNATIONAL)
list(APPEND boost_extra_libs locale) list(APPEND boost_extra_libs locale)
endif() endif(WITH_INTERNATIONAL)
set(Boost_USE_STATIC_RUNTIME ON) # prefix lib set(Boost_USE_STATIC_RUNTIME ON) # prefix lib
set(Boost_USE_MULTITHREADED ON) # suffix -mt set(Boost_USE_MULTITHREADED ON) # suffix -mt
set(Boost_USE_STATIC_LIBS ON) # suffix -s set(Boost_USE_STATIC_LIBS ON) # suffix -s
@@ -1481,21 +1433,20 @@ elseif(WIN32)
set(OPENIMAGEIO_LIBPATH ${OPENIMAGEIO}/lib) set(OPENIMAGEIO_LIBPATH ${OPENIMAGEIO}/lib)
set(OPENIMAGEIO_DEFINITIONS "-DUSE_TBB=0") set(OPENIMAGEIO_DEFINITIONS "-DUSE_TBB=0")
set(OPENCOLORIO_DEFINITIONS "-DOCIO_STATIC_BUILD") set(OPENCOLORIO_DEFINITIONS "-DOCIO_STATIC_BUILD")
set(OPENIMAGEIO_IDIFF "${OPENIMAGEIO}/bin/idiff.exe")
add_definitions(-DOIIO_STATIC_BUILD) add_definitions(-DOIIO_STATIC_BUILD)
endif() endif()
if(WITH_LLVM) if(WITH_LLVM)
set(LLVM_ROOT_DIR ${LIBDIR}/llvm CACHE PATH "Path to the LLVM installation") set(LLVM_DIRECTORY ${LIBDIR}/llvm CACHE PATH "Path to the LLVM installation")
file(GLOB LLVM_LIBRARY_OPTIMIZED ${LLVM_ROOT_DIR}/lib/*.lib) file(GLOB LLVM_LIBRARY_OPTIMIZED ${LLVM_DIRECTORY}/lib/*.lib)
if(EXISTS ${LLVM_ROOT_DIR}/debug/lib) if(EXISTS ${LLVM_DIRECTORY}/debug/lib)
foreach(LLVM_OPTIMIZED_LIB ${LLVM_LIBRARY_OPTIMIZED}) foreach(LLVM_OPTIMIZED_LIB ${LLVM_LIBRARY_OPTIMIZED})
get_filename_component(LIBNAME ${LLVM_OPTIMIZED_LIB} ABSOLUTE) get_filename_component(LIBNAME ${LLVM_OPTIMIZED_LIB} ABSOLUTE)
list(APPEND LLVM_LIBS optimized ${LIBNAME}) list(APPEND LLVM_LIBS optimized ${LIBNAME})
endforeach(LLVM_OPTIMIZED_LIB) endforeach(LLVM_OPTIMIZED_LIB)
file(GLOB LLVM_LIBRARY_DEBUG ${LLVM_ROOT_DIR}/debug/lib/*.lib) file(GLOB LLVM_LIBRARY_DEBUG ${LLVM_DIRECTORY}/debug/lib/*.lib)
foreach(LLVM_DEBUG_LIB ${LLVM_LIBRARY_DEBUG}) foreach(LLVM_DEBUG_LIB ${LLVM_LIBRARY_DEBUG})
get_filename_component(LIBNAME ${LLVM_DEBUG_LIB} ABSOLUTE) get_filename_component(LIBNAME ${LLVM_DEBUG_LIB} ABSOLUTE)
@@ -1530,13 +1481,6 @@ elseif(WIN32)
) )
endif() endif()
if(WITH_SDL)
set(SDL ${LIBDIR}/sdl)
set(SDL_INCLUDE_DIR ${SDL}/include)
set(SDL_LIBRARY SDL2)
set(SDL_LIBPATH ${SDL}/lib)
endif()
# used in many places so include globally, like OpenGL # used in many places so include globally, like OpenGL
blender_include_dirs_sys("${PTHREADS_INCLUDE_DIRS}") blender_include_dirs_sys("${PTHREADS_INCLUDE_DIRS}")
@@ -1554,12 +1498,7 @@ elseif(WIN32)
if(WITH_MINGW64) if(WITH_MINGW64)
message(STATUS "Compiling for 64 bit with MinGW-w64.") message(STATUS "Compiling for 64 bit with MinGW-w64.")
execute_process(COMMAND ${CMAKE_C_COMPILER} -dumpversion OUTPUT_VARIABLE GCC_VERSION)
if(GCC_VERSION VERSION_GREATER 4.9 OR GCC_VERSION VERSION_EQUAL 4.9)
set(LIBDIR ${CMAKE_SOURCE_DIR}/../lib/mingw64_gcc49)
else()
set(LIBDIR ${CMAKE_SOURCE_DIR}/../lib/mingw64) set(LIBDIR ${CMAKE_SOURCE_DIR}/../lib/mingw64)
endif()
else() else()
message(STATUS "Compiling for 32 bit with MinGW-w32.") message(STATUS "Compiling for 32 bit with MinGW-w32.")
set(LIBDIR ${CMAKE_SOURCE_DIR}/../lib/mingw32) set(LIBDIR ${CMAKE_SOURCE_DIR}/../lib/mingw32)
@@ -1569,12 +1508,7 @@ elseif(WIN32)
endif() endif()
endif() endif()
list(APPEND PLATFORM_LINKLIBS -lshell32 -lshfolder -lgdi32 -lmsvcrt -lwinmm -lmingw32 -lm -lws2_32 -lz -lstdc++ -lole32 -luuid -lwsock32 -lpsapi -ldbghelp) list(APPEND PLATFORM_LINKLIBS -lshell32 -lshfolder -lgdi32 -lmsvcrt -lwinmm -lmingw32 -lm -lws2_32 -lz -lstdc++ -lole32 -luuid -lwsock32 -lpsapi -limm32)
if(WITH_INPUT_IME)
list(APPEND PLATFORM_LINKLIBS -limm32)
endif()
set(PLATFORM_CFLAGS "-pipe -funsigned-char -fno-strict-aliasing") set(PLATFORM_CFLAGS "-pipe -funsigned-char -fno-strict-aliasing")
if(WITH_MINGW64) if(WITH_MINGW64)
@@ -1728,12 +1662,11 @@ elseif(WIN32)
set(OPENIMAGEIO_LIBRARIES OpenImageIO) set(OPENIMAGEIO_LIBRARIES OpenImageIO)
set(OPENIMAGEIO_LIBPATH ${OPENIMAGEIO}/lib) set(OPENIMAGEIO_LIBPATH ${OPENIMAGEIO}/lib)
set(OPENIMAGEIO_DEFINITIONS "") set(OPENIMAGEIO_DEFINITIONS "")
set(OPENIMAGEIO_IDIFF "${OPENIMAGEIO}/bin/idiff.exe")
endif() endif()
if(WITH_LLVM) if(WITH_LLVM)
set(LLVM_ROOT_DIR ${LIBDIR}/llvm CACHE PATH "Path to the LLVM installation") set(LLVM_DIRECTORY ${LIBDIR}/llvm CACHE PATH "Path to the LLVM installation")
set(LLVM_LIBPATH ${LLVM_ROOT_DIR}/lib) set(LLVM_LIBPATH ${LLVM_DIRECTORY}/lib)
# Explicitly set llvm lib order. # Explicitly set llvm lib order.
#---- WARNING ON GCC ORDER OF LIBS IS IMPORTANT, DO NOT CHANGE! --------- #---- WARNING ON GCC ORDER OF LIBS IS IMPORTANT, DO NOT CHANGE! ---------
set(LLVM_LIBRARY LLVMSelectionDAG LLVMCodeGen LLVMScalarOpts LLVMAnalysis LLVMArchive set(LLVM_LIBRARY LLVMSelectionDAG LLVMCodeGen LLVMScalarOpts LLVMAnalysis LLVMArchive
@@ -1766,13 +1699,6 @@ elseif(WIN32)
set(OPENCOLORIO_DEFINITIONS) set(OPENCOLORIO_DEFINITIONS)
endif() endif()
if(WITH_SDL)
set(SDL ${LIBDIR}/sdl)
set(SDL_INCLUDE_DIR ${SDL}/include)
set(SDL_LIBRARY SDL)
set(SDL_LIBPATH ${SDL}/lib)
endif()
set(PLATFORM_LINKFLAGS "-Xlinker --stack=2097152") set(PLATFORM_LINKFLAGS "-Xlinker --stack=2097152")
## DISABLE - causes linking errors ## DISABLE - causes linking errors
@@ -1804,6 +1730,13 @@ elseif(WIN32)
set(SNDFILE_LIBPATH ${SNDFILE}/lib) # TODO, deprecate set(SNDFILE_LIBPATH ${SNDFILE}/lib) # TODO, deprecate
endif() endif()
if(WITH_SDL)
set(SDL ${LIBDIR}/sdl)
set(SDL_INCLUDE_DIR ${SDL}/include)
set(SDL_LIBRARY SDL2)
set(SDL_LIBPATH ${SDL}/lib)
endif()
if(WITH_RAYOPTIMIZATION AND SUPPORT_SSE_BUILD) if(WITH_RAYOPTIMIZATION AND SUPPORT_SSE_BUILD)
add_definitions(-D__SSE__ -D__MMX__) add_definitions(-D__SSE__ -D__MMX__)
endif() endif()
@@ -1818,10 +1751,10 @@ elseif(WIN32)
find_library(OSL_LIB_COMP_DEBUG NAMES oslcomp_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) 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}) 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_path(OSL_INCLUDES OSL/oslclosure.h PATHS ${CYCLES_OSL}/include)
find_program(OSL_COMPILER NAMES oslc PATHS ${CYCLES_OSL}/bin) find_program(OSL_COMPILER NAMES oslc PATHS ${CYCLES_OSL}/bin)
if(OSL_INCLUDE_DIR AND OSL_LIBRARIES AND OSL_COMPILER) if(OSL_INCLUDES AND OSL_LIBRARIES AND OSL_COMPILER)
set(OSL_FOUND TRUE) set(OSL_FOUND TRUE)
else() else()
message(STATUS "OSL not found") message(STATUS "OSL not found")
@@ -2057,7 +1990,6 @@ elseif(APPLE)
set(OPENIMAGEIO_LIBRARIES ${OPENIMAGEIO}/lib/libOpenImageIO.a ${PNG_LIBRARIES} ${JPEG_LIBRARIES} ${TIFF_LIBRARY} ${OPENEXR_LIBRARIES} ${ZLIB_LIBRARIES}) set(OPENIMAGEIO_LIBRARIES ${OPENIMAGEIO}/lib/libOpenImageIO.a ${PNG_LIBRARIES} ${JPEG_LIBRARIES} ${TIFF_LIBRARY} ${OPENEXR_LIBRARIES} ${ZLIB_LIBRARIES})
set(OPENIMAGEIO_LIBPATH ${OPENIMAGEIO}/lib ${JPEG_LIBPATH} ${PNG_LIBPATH} ${TIFF_LIBPATH} ${OPENEXR_LIBPATH} ${ZLIB_LIBPATH}) set(OPENIMAGEIO_LIBPATH ${OPENIMAGEIO}/lib ${JPEG_LIBPATH} ${PNG_LIBPATH} ${TIFF_LIBPATH} ${OPENEXR_LIBPATH} ${ZLIB_LIBPATH})
set(OPENIMAGEIO_DEFINITIONS "-DOIIO_STATIC_BUILD") set(OPENIMAGEIO_DEFINITIONS "-DOIIO_STATIC_BUILD")
set(OPENIMAGEIO_IDIFF "${LIBDIR}/openimageio/bin/idiff")
endif() endif()
if(WITH_OPENCOLORIO) if(WITH_OPENCOLORIO)
@@ -2068,10 +2000,10 @@ elseif(APPLE)
endif() endif()
if(WITH_LLVM) if(WITH_LLVM)
set(LLVM_ROOT_DIR ${LIBDIR}/llvm CACHE PATH "Path to the LLVM installation") set(LLVM_DIRECTORY ${LIBDIR}/llvm CACHE PATH "Path to the LLVM installation")
set(LLVM_VERSION "3.4" CACHE STRING "Version of LLVM to use") set(LLVM_VERSION "3.4" CACHE STRING "Version of LLVM to use")
if(EXISTS "${LLVM_ROOT_DIR}/bin/llvm-config") if(EXISTS "${LLVM_DIRECTORY}/bin/llvm-config")
set(LLVM_CONFIG "${LLVM_ROOT_DIR}/bin/llvm-config") set(LLVM_CONFIG "${LLVM_DIRECTORY}/bin/llvm-config")
else() else()
set(LLVM_CONFIG llvm-config) set(LLVM_CONFIG llvm-config)
endif() endif()
@@ -2079,7 +2011,7 @@ elseif(APPLE)
OUTPUT_VARIABLE LLVM_VERSION OUTPUT_VARIABLE LLVM_VERSION
OUTPUT_STRIP_TRAILING_WHITESPACE) OUTPUT_STRIP_TRAILING_WHITESPACE)
execute_process(COMMAND ${LLVM_CONFIG} --prefix execute_process(COMMAND ${LLVM_CONFIG} --prefix
OUTPUT_VARIABLE LLVM_ROOT_DIR OUTPUT_VARIABLE LLVM_DIRECTORY
OUTPUT_STRIP_TRAILING_WHITESPACE) OUTPUT_STRIP_TRAILING_WHITESPACE)
execute_process(COMMAND ${LLVM_CONFIG} --libdir execute_process(COMMAND ${LLVM_CONFIG} --libdir
OUTPUT_VARIABLE LLVM_LIBPATH OUTPUT_VARIABLE LLVM_LIBPATH
@@ -2088,7 +2020,7 @@ elseif(APPLE)
NAMES LLVMAnalysis # first of a whole bunch of libs to get NAMES LLVMAnalysis # first of a whole bunch of libs to get
PATHS ${LLVM_LIBPATH}) PATHS ${LLVM_LIBPATH})
if(LLVM_LIBRARY AND LLVM_ROOT_DIR AND LLVM_LIBPATH) if(LLVM_LIBRARY AND LLVM_DIRECTORY AND LLVM_LIBPATH)
if(LLVM_STATIC) if(LLVM_STATIC)
# if static LLVM libraries were requested, use llvm-config to generate # if static LLVM libraries were requested, use llvm-config to generate
# the list of what libraries we need, and substitute that in the right # the list of what libraries we need, and substitute that in the right
@@ -2113,10 +2045,10 @@ elseif(APPLE)
find_library(OSL_LIB_QUERY NAMES oslquery PATHS ${CYCLES_OSL}/lib) find_library(OSL_LIB_QUERY NAMES oslquery PATHS ${CYCLES_OSL}/lib)
# WARNING! depends on correct order of OSL libs linking # WARNING! depends on correct order of OSL libs linking
list(APPEND OSL_LIBRARIES ${OSL_LIB_COMP} -force_load ${OSL_LIB_EXEC} ${OSL_LIB_QUERY}) 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_path(OSL_INCLUDES OSL/oslclosure.h PATHS ${CYCLES_OSL}/include)
find_program(OSL_COMPILER NAMES oslc PATHS ${CYCLES_OSL}/bin) find_program(OSL_COMPILER NAMES oslc PATHS ${CYCLES_OSL}/bin)
if(OSL_INCLUDE_DIR AND OSL_LIBRARIES AND OSL_COMPILER) if(OSL_INCLUDES AND OSL_LIBRARIES AND OSL_COMPILER)
set(OSL_FOUND TRUE) set(OSL_FOUND TRUE)
else() else()
message(STATUS "OSL not found") message(STATUS "OSL not found")
@@ -2259,9 +2191,6 @@ if(WITH_IMAGE_REDCODE)
set(REDCODE_INC ${REDCODE}) set(REDCODE_INC ${REDCODE})
endif() endif()
if(NOT WITH_SYSTEM_EIGEN3)
set(EIGEN3_INCLUDE_DIRS ${CMAKE_SOURCE_DIR}/extern/Eigen3)
endif()
#----------------------------------------------------------------------------- #-----------------------------------------------------------------------------
# Configure OpenGL. # Configure OpenGL.
@@ -2383,10 +2312,6 @@ if(WITH_GL_EGL)
list(APPEND GL_DEFINITIONS -DWITH_EGL) list(APPEND GL_DEFINITIONS -DWITH_EGL)
endif() endif()
if(WITH_GPU_DEBUG)
list(APPEND GL_DEFINITIONS -DWITH_GPU_DEBUG)
endif()
#----------------------------------------------------------------------------- #-----------------------------------------------------------------------------
# Configure OpenMP. # Configure OpenMP.
if(WITH_OPENMP) if(WITH_OPENMP)
@@ -2550,15 +2475,6 @@ if(CMAKE_COMPILER_IS_GNUCC)
ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_MISSING_INCLUDE_DIRS -Wmissing-include-dirs) ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_MISSING_INCLUDE_DIRS -Wmissing-include-dirs)
ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_NO_DIV_BY_ZERO -Wno-div-by-zero) ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_NO_DIV_BY_ZERO -Wno-div-by-zero)
ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_TYPE_LIMITS -Wtype-limits) ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_TYPE_LIMITS -Wtype-limits)
ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_ERROR_RETURN_TYPE -Werror=return-type)
ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_ERROR_DECLARATION_AFTER_STATEMENT -Werror=declaration-after-statement)
ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_ERROR_IMPLICIT_FUNCTION_DECLARATION -Werror=implicit-function-declaration)
ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_NO_CHAR_SUBSCRIPTS -Wno-char-subscripts)
ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_NO_UNKNOWN_PRAGMAS -Wno-unknown-pragmas)
ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_POINTER_ARITH -Wpointer-arith)
ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_UNUSED_PARAMETER -Wunused-parameter)
ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_WRITE_STRINGS -Wwrite-strings)
ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_UNDEF -Wundef)
# gcc 4.2 gives annoying warnings on every file with this # gcc 4.2 gives annoying warnings on every file with this
if(NOT "${CMAKE_C_COMPILER_VERSION}" VERSION_LESS "4.3") if(NOT "${CMAKE_C_COMPILER_VERSION}" VERSION_LESS "4.3")
@@ -2692,16 +2608,6 @@ if(WITH_PYTHON)
endif() endif()
endif() endif()
if(WITH_CPP11)
if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID MATCHES "Clang")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
elseif(MSVC12)
# Nothing special is needed, C++11 features are available by default.
else()
message(FATAL_ERROR "Compiler ${CMAKE_C_COMPILER_ID} is not supported for C++11 build yet")
endif()
endif()
# Include warnings first, so its possible to disable them with user defined flags # Include warnings first, so its possible to disable them with user defined flags
# eg: -Wno-uninitialized # eg: -Wno-uninitialized
set(CMAKE_C_FLAGS "${C_WARNINGS} ${CMAKE_C_FLAGS} ${PLATFORM_CFLAGS}") set(CMAKE_C_FLAGS "${C_WARNINGS} ${CMAKE_C_FLAGS} ${PLATFORM_CFLAGS}")
@@ -2714,12 +2620,12 @@ mark_as_advanced(
OSL_COMPILER OSL_COMPILER
OSL_LIB_COMP OSL_LIB_COMP
OSL_LIB_QUERY OSL_LIB_QUERY
OSL_INCLUDE_DIR OSL_INCLUDES
) )
mark_as_advanced( mark_as_advanced(
LLVM_CONFIG LLVM_CONFIG
LLVM_ROOT_DIR LLVM_DIRECTORY
LLVM_LIBRARY LLVM_LIBRARY
LLVM_VERSION LLVM_VERSION
) )
@@ -2888,7 +2794,6 @@ if(FIRST_RUN)
info_cfg_option(WITH_GL_PROFILE_COMPAT) info_cfg_option(WITH_GL_PROFILE_COMPAT)
info_cfg_option(WITH_GL_PROFILE_CORE) info_cfg_option(WITH_GL_PROFILE_CORE)
info_cfg_option(WITH_GL_PROFILE_ES20) info_cfg_option(WITH_GL_PROFILE_ES20)
info_cfg_option(WITH_GPU_DEBUG)
if(WIN32) if(WIN32)
info_cfg_option(WITH_GL_ANGLE) info_cfg_option(WITH_GL_ANGLE)
endif() endif()

View File

@@ -65,7 +65,7 @@ ifneq "$(findstring cycles, $(MAKECMDGOALS))" ""
BUILD_CMAKE_ARGS:=$(BUILD_CMAKE_ARGS) -C"$(BLENDER_DIR)/build_files/cmake/config/cycles_standalone.cmake" BUILD_CMAKE_ARGS:=$(BUILD_CMAKE_ARGS) -C"$(BLENDER_DIR)/build_files/cmake/config/cycles_standalone.cmake"
endif endif
ifneq "$(findstring headless, $(MAKECMDGOALS))" "" ifneq "$(findstring headless, $(MAKECMDGOALS))" ""
BUILD_DIR:=$(BUILD_DIR)_headless BUILD_DIR:=$(BUILD_DIR)_bpy
BUILD_CMAKE_ARGS:=$(BUILD_CMAKE_ARGS) -C"$(BLENDER_DIR)/build_files/cmake/config/blender_headless.cmake" BUILD_CMAKE_ARGS:=$(BUILD_CMAKE_ARGS) -C"$(BLENDER_DIR)/build_files/cmake/config/blender_headless.cmake"
endif endif
ifneq "$(findstring bpy, $(MAKECMDGOALS))" "" ifneq "$(findstring bpy, $(MAKECMDGOALS))" ""
@@ -113,7 +113,7 @@ endif
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
# Build Blender # Build Blender
all: FORCE all:
@echo @echo
@echo Configuring Blender ... @echo Configuring Blender ...
@@ -142,13 +142,13 @@ bpy: all
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
# Configuration (save some cd'ing around) # Configuration (save some cd'ing around)
config: FORCE config:
$(CMAKE_CONFIG_TOOL) "$(BUILD_DIR)" $(CMAKE_CONFIG_TOOL) "$(BUILD_DIR)"
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
# Help for build targets # Help for build targets
help: FORCE help:
@echo "" @echo ""
@echo "Convenience targets provided for building blender, (multiple at once can be used)" @echo "Convenience targets provided for building blender, (multiple at once can be used)"
@echo " * debug - build a debug binary" @echo " * debug - build a debug binary"
@@ -214,13 +214,13 @@ help: FORCE
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
# Packages # Packages
# #
package_debian: FORCE package_debian:
cd build_files/package_spec ; DEB_BUILD_OPTIONS="parallel=$(NPROCS)" sh ./build_debian.sh cd build_files/package_spec ; DEB_BUILD_OPTIONS="parallel=$(NPROCS)" sh ./build_debian.sh
package_pacman: FORCE package_pacman:
cd build_files/package_spec/pacman ; MAKEFLAGS="-j$(NPROCS)" makepkg cd build_files/package_spec/pacman ; MAKEFLAGS="-j$(NPROCS)" makepkg --asroot
package_archive: FORCE package_archive:
make -C "$(BUILD_DIR)" -s package_archive make -C "$(BUILD_DIR)" -s package_archive
@echo archive in "$(BUILD_DIR)/release" @echo archive in "$(BUILD_DIR)/release"
@@ -228,24 +228,24 @@ package_archive: FORCE
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
# Tests # Tests
# #
test: FORCE test:
cd $(BUILD_DIR) ; ctest . --output-on-failure cd $(BUILD_DIR) ; ctest . --output-on-failure
# run pep8 check check on scripts we distribute. # run pep8 check check on scripts we distribute.
test_pep8: FORCE test_pep8:
python3 tests/python/pep8.py > test_pep8.log 2>&1 python3 tests/python/pep8.py > test_pep8.log 2>&1
@echo "written: test_pep8.log" @echo "written: test_pep8.log"
# run some checks on our cmakefiles. # run some checks on our cmakefiles.
test_cmake: FORCE test_cmake:
python3 build_files/cmake/cmake_consistency_check.py > test_cmake_consistency.log 2>&1 python3 build_files/cmake/cmake_consistency_check.py > test_cmake_consistency.log 2>&1
@echo "written: test_cmake_consistency.log" @echo "written: test_cmake_consistency.log"
# run deprecation tests, see if we have anything to remove. # run deprecation tests, see if we have anything to remove.
test_deprecated: FORCE test_deprecated:
python3 tests/check_deprecated.py python3 tests/check_deprecated.py
test_style_c: FORCE test_style_c:
# run our own checks on C/C++ style # run our own checks on C/C++ style
PYTHONIOENCODING=utf_8 python3 \ PYTHONIOENCODING=utf_8 python3 \
"$(BLENDER_DIR)/source/tools/check_source/check_style_c.py" \ "$(BLENDER_DIR)/source/tools/check_source/check_style_c.py" \
@@ -253,7 +253,7 @@ test_style_c: FORCE
"$(BLENDER_DIR)/source/creator" \ "$(BLENDER_DIR)/source/creator" \
--no-length-check --no-length-check
test_style_c_qtc: FORCE test_style_c_qtc:
# run our own checks on C/C++ style # run our own checks on C/C++ style
USE_QTC_TASK=1 \ USE_QTC_TASK=1 \
PYTHONIOENCODING=utf_8 python3 \ PYTHONIOENCODING=utf_8 python3 \
@@ -266,7 +266,7 @@ test_style_c_qtc: FORCE
@echo "written: test_style.tasks" @echo "written: test_style.tasks"
test_style_osl: FORCE test_style_osl:
# run our own checks on C/C++ style # run our own checks on C/C++ style
PYTHONIOENCODING=utf_8 python3 \ PYTHONIOENCODING=utf_8 python3 \
"$(BLENDER_DIR)/source/tools/check_source/check_style_c.py" \ "$(BLENDER_DIR)/source/tools/check_source/check_style_c.py" \
@@ -274,7 +274,7 @@ test_style_osl: FORCE
"$(BLENDER_DIR)/release/scripts/templates_osl" "$(BLENDER_DIR)/release/scripts/templates_osl"
test_style_osl_qtc: FORCE test_style_osl_qtc:
# run our own checks on C/C++ style # run our own checks on C/C++ style
USE_QTC_TASK=1 \ USE_QTC_TASK=1 \
PYTHONIOENCODING=utf_8 python3 \ PYTHONIOENCODING=utf_8 python3 \
@@ -289,13 +289,13 @@ test_style_osl_qtc: FORCE
# Project Files # Project Files
# #
project_qtcreator: FORCE project_qtcreator:
python3 build_files/cmake/cmake_qtcreator_project.py "$(BUILD_DIR)" python3 build_files/cmake/cmake_qtcreator_project.py "$(BUILD_DIR)"
project_netbeans: FORCE project_netbeans:
python3 build_files/cmake/cmake_netbeans_project.py "$(BUILD_DIR)" python3 build_files/cmake/cmake_netbeans_project.py "$(BUILD_DIR)"
project_eclipse: FORCE project_eclipse:
cmake -G"Eclipse CDT4 - Unix Makefiles" -H"$(BLENDER_DIR)" -B"$(BUILD_DIR)" cmake -G"Eclipse CDT4 - Unix Makefiles" -H"$(BLENDER_DIR)" -B"$(BUILD_DIR)"
@@ -303,40 +303,40 @@ project_eclipse: FORCE
# Static Checking # Static Checking
# #
check_cppcheck: FORCE check_cppcheck:
$(CMAKE_CONFIG) $(CMAKE_CONFIG)
cd "$(BUILD_DIR)" ; \ cd "$(BUILD_DIR)" ; \
python3 "$(BLENDER_DIR)/build_files/cmake/cmake_static_check_cppcheck.py" 2> \ python3 "$(BLENDER_DIR)/build_files/cmake/cmake_static_check_cppcheck.py" 2> \
"$(BLENDER_DIR)/check_cppcheck.txt" "$(BLENDER_DIR)/check_cppcheck.txt"
@echo "written: check_cppcheck.txt" @echo "written: check_cppcheck.txt"
check_clang_array: FORCE check_clang_array:
$(CMAKE_CONFIG) $(CMAKE_CONFIG)
cd "$(BUILD_DIR)" ; \ cd "$(BUILD_DIR)" ; \
python3 "$(BLENDER_DIR)/build_files/cmake/cmake_static_check_clang_array.py" python3 "$(BLENDER_DIR)/build_files/cmake/cmake_static_check_clang_array.py"
check_splint: FORCE check_splint:
$(CMAKE_CONFIG) $(CMAKE_CONFIG)
cd "$(BUILD_DIR)" ; \ cd "$(BUILD_DIR)" ; \
python3 "$(BLENDER_DIR)/build_files/cmake/cmake_static_check_splint.py" python3 "$(BLENDER_DIR)/build_files/cmake/cmake_static_check_splint.py"
check_sparse: FORCE check_sparse:
$(CMAKE_CONFIG) $(CMAKE_CONFIG)
cd "$(BUILD_DIR)" ; \ cd "$(BUILD_DIR)" ; \
python3 "$(BLENDER_DIR)/build_files/cmake/cmake_static_check_sparse.py" python3 "$(BLENDER_DIR)/build_files/cmake/cmake_static_check_sparse.py"
check_smatch: FORCE check_smatch:
$(CMAKE_CONFIG) $(CMAKE_CONFIG)
cd "$(BUILD_DIR)" ; \ cd "$(BUILD_DIR)" ; \
python3 "$(BLENDER_DIR)/build_files/cmake/cmake_static_check_smatch.py" python3 "$(BLENDER_DIR)/build_files/cmake/cmake_static_check_smatch.py"
check_spelling_py: FORCE check_spelling_py:
cd "$(BUILD_DIR)" ; \ cd "$(BUILD_DIR)" ; \
PYTHONIOENCODING=utf_8 python3 \ PYTHONIOENCODING=utf_8 python3 \
"$(BLENDER_DIR)/source/tools/check_source/check_spelling.py" \ "$(BLENDER_DIR)/source/tools/check_source/check_spelling.py" \
"$(BLENDER_DIR)/release/scripts" "$(BLENDER_DIR)/release/scripts"
check_spelling_c: FORCE check_spelling_c:
cd "$(BUILD_DIR)" ; \ cd "$(BUILD_DIR)" ; \
PYTHONIOENCODING=utf_8 python3 \ PYTHONIOENCODING=utf_8 python3 \
"$(BLENDER_DIR)/source/tools/check_source/check_spelling.py" \ "$(BLENDER_DIR)/source/tools/check_source/check_spelling.py" \
@@ -345,7 +345,7 @@ check_spelling_c: FORCE
"$(BLENDER_DIR)/intern/guardedalloc" \ "$(BLENDER_DIR)/intern/guardedalloc" \
"$(BLENDER_DIR)/intern/ghost" \ "$(BLENDER_DIR)/intern/ghost" \
check_spelling_c_qtc: FORCE check_spelling_c_qtc:
cd "$(BUILD_DIR)" ; USE_QTC_TASK=1 \ cd "$(BUILD_DIR)" ; USE_QTC_TASK=1 \
PYTHONIOENCODING=utf_8 python3 \ PYTHONIOENCODING=utf_8 python3 \
"$(BLENDER_DIR)/source/tools/check_source/check_spelling.py" \ "$(BLENDER_DIR)/source/tools/check_source/check_spelling.py" \
@@ -356,13 +356,13 @@ check_spelling_c_qtc: FORCE
> \ > \
"$(BLENDER_DIR)/check_spelling_c.tasks" "$(BLENDER_DIR)/check_spelling_c.tasks"
check_spelling_osl: FORCE check_spelling_osl:
cd "$(BUILD_DIR)" ;\ cd "$(BUILD_DIR)" ;\
PYTHONIOENCODING=utf_8 python3 \ PYTHONIOENCODING=utf_8 python3 \
"$(BLENDER_DIR)/source/tools/check_source/check_spelling.py" \ "$(BLENDER_DIR)/source/tools/check_source/check_spelling.py" \
"$(BLENDER_DIR)/intern/cycles/kernel/shaders" "$(BLENDER_DIR)/intern/cycles/kernel/shaders"
check_descriptions: FORCE check_descriptions:
"$(BUILD_DIR)/bin/blender" --background -noaudio --factory-startup --python \ "$(BUILD_DIR)/bin/blender" --background -noaudio --factory-startup --python \
"$(BLENDER_DIR)/source/tools/check_source/check_descriptions.py" "$(BLENDER_DIR)/source/tools/check_source/check_descriptions.py"
@@ -370,14 +370,14 @@ check_descriptions: FORCE
# Utilities # Utilities
# #
tgz: FORCE tgz:
./build_files/utils/build_tgz.sh ./build_files/utils/build_tgz.sh
icons: FORCE icons:
"$(BLENDER_DIR)/release/datafiles/blender_icons_update.py" "$(BLENDER_DIR)/release/datafiles/blender_icons_update.py"
"$(BLENDER_DIR)/release/datafiles/prvicons_update.py" "$(BLENDER_DIR)/release/datafiles/prvicons_update.py"
update: FORCE update:
if [ -d "../lib" ]; then \ if [ -d "../lib" ]; then \
svn update ../lib/* ; \ svn update ../lib/* ; \
fi fi
@@ -390,23 +390,23 @@ update: FORCE
# #
# Simple version of ./doc/python_api/sphinx_doc_gen.sh with no PDF generation. # Simple version of ./doc/python_api/sphinx_doc_gen.sh with no PDF generation.
doc_py: FORCE doc_py:
"$(BUILD_DIR)/bin/blender" --background -noaudio --factory-startup --python doc/python_api/sphinx_doc_gen.py "$(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 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'" @echo "docs written into: '$(BLENDER_DIR)/doc/python_api/sphinx-out/contents.html'"
doc_doxy: FORCE doc_doxy:
cd doc/doxygen; doxygen Doxyfile cd doc/doxygen; doxygen Doxyfile
@echo "docs written into: '$(BLENDER_DIR)/doc/doxygen/html/index.html'" @echo "docs written into: '$(BLENDER_DIR)/doc/doxygen/html/index.html'"
doc_dna: FORCE doc_dna:
"$(BUILD_DIR)/bin/blender" --background -noaudio --factory-startup --python doc/blender_file_format/BlendFileDnaExporter_25.py "$(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'" @echo "docs written into: '$(BLENDER_DIR)/doc/blender_file_format/dna.html'"
doc_man: FORCE doc_man:
python3 doc/manpage/blender.1.py "$(BUILD_DIR)/bin/blender" python3 doc/manpage/blender.1.py "$(BUILD_DIR)/bin/blender"
help_features: FORCE help_features:
@python3 -c \ @python3 -c \
"import re; \ "import re; \
print('\n'.join([ \ print('\n'.join([ \
@@ -417,9 +417,7 @@ help_features: FORCE
if w.startswith('WITH_')]))" | uniq if w.startswith('WITH_')]))" | uniq
clean: FORCE clean:
$(MAKE) -C "$(BUILD_DIR)" clean $(MAKE) -C "$(BUILD_DIR)" clean
.PHONY: all .PHONY: all
FORCE:

View File

@@ -266,7 +266,6 @@ if 'blenderlite' in B.targets:
target_env_defs['WITH_BF_BOOLEAN'] = False target_env_defs['WITH_BF_BOOLEAN'] = False
target_env_defs['WITH_BF_REMESH'] = False target_env_defs['WITH_BF_REMESH'] = False
target_env_defs['WITH_BF_PYTHON'] = False target_env_defs['WITH_BF_PYTHON'] = False
target_env_defs['WITH_BF_IME'] = False
target_env_defs['WITH_BF_3DMOUSE'] = False target_env_defs['WITH_BF_3DMOUSE'] = False
target_env_defs['WITH_BF_LIBMV'] = False target_env_defs['WITH_BF_LIBMV'] = False
target_env_defs['WITH_BF_FREESTYLE'] = False target_env_defs['WITH_BF_FREESTYLE'] = False
@@ -480,13 +479,6 @@ if env['WITH_BF_OPENMP'] == 1:
else: else:
env.Append(CCFLAGS=['-fopenmp']) env.Append(CCFLAGS=['-fopenmp'])
if env['WITH_BF_CPP11']:
if env['OURPLATFORM'] in ('win32-vc', 'win64-vc'):
# Nothing special is needed, C++11 features are available by default.
pass
else:
env['CXXFLAGS'].append('-std=c++11')
#check for additional debug libnames #check for additional debug libnames
if env.has_key('BF_DEBUG_LIBS'): if env.has_key('BF_DEBUG_LIBS'):
@@ -768,15 +760,6 @@ if B.targets != ['cudakernels']:
data_to_c_simple("source/blender/gpu/shaders/gpu_shader_vertex_world.glsl") data_to_c_simple("source/blender/gpu/shaders/gpu_shader_vertex_world.glsl")
data_to_c_simple("source/blender/gpu/shaders/gpu_shader_vsm_store_frag.glsl") data_to_c_simple("source/blender/gpu/shaders/gpu_shader_vsm_store_frag.glsl")
data_to_c_simple("source/blender/gpu/shaders/gpu_shader_vsm_store_vert.glsl") data_to_c_simple("source/blender/gpu/shaders/gpu_shader_vsm_store_vert.glsl")
data_to_c_simple("source/blender/gpu/shaders/gpu_shader_fx_ssao_frag.glsl")
data_to_c_simple("source/blender/gpu/shaders/gpu_shader_fx_dof_frag.glsl")
data_to_c_simple("source/blender/gpu/shaders/gpu_shader_fx_dof_vert.glsl")
data_to_c_simple("source/blender/gpu/shaders/gpu_shader_fx_dof_hq_frag.glsl")
data_to_c_simple("source/blender/gpu/shaders/gpu_shader_fx_dof_hq_vert.glsl")
data_to_c_simple("source/blender/gpu/shaders/gpu_shader_fx_dof_hq_geo.glsl")
data_to_c_simple("source/blender/gpu/shaders/gpu_shader_fx_lib.glsl")
data_to_c_simple("source/blender/gpu/shaders/gpu_shader_fx_depth_resolve.glsl")
data_to_c_simple("source/blender/gpu/shaders/gpu_shader_fx_vert.glsl")
data_to_c_simple("intern/opencolorio/gpu_shader_display_transform.glsl") data_to_c_simple("intern/opencolorio/gpu_shader_display_transform.glsl")
# --- blender --- # --- blender ---
@@ -871,7 +854,8 @@ B.init_lib_dict()
##### END SETUP ########## ##### END SETUP ##########
## Auto-configuration run-time tests if B.targets != ['cudakernels']:
# Put all auto configuration run-time tests here
from FindSharedPtr import FindSharedPtr from FindSharedPtr import FindSharedPtr
from FindUnorderedMap import FindUnorderedMap from FindUnorderedMap import FindUnorderedMap
@@ -879,11 +863,8 @@ from FindUnorderedMap import FindUnorderedMap
conf = Configure(env) conf = Configure(env)
old_linkflags = conf.env['LINKFLAGS'] old_linkflags = conf.env['LINKFLAGS']
conf.env.Append(LINKFLAGS=env['PLATFORM_LINKFLAGS']) conf.env.Append(LINKFLAGS=env['PLATFORM_LINKFLAGS'])
# Put all tests here
FindSharedPtr(conf) FindSharedPtr(conf)
FindUnorderedMap(conf) FindUnorderedMap(conf)
conf.env['LINKFLAGS'] = old_linkflags conf.env['LINKFLAGS'] = old_linkflags
env = conf.Finish() env = conf.Finish()
@@ -1028,7 +1009,6 @@ if env['OURPLATFORM']!='darwin':
source.append('intern/cycles/util/util_color.h') source.append('intern/cycles/util/util_color.h')
source.append('intern/cycles/util/util_half.h') source.append('intern/cycles/util/util_half.h')
source.append('intern/cycles/util/util_math.h') source.append('intern/cycles/util/util_math.h')
source.append('intern/cycles/util/util_math_fast.h')
source.append('intern/cycles/util/util_transform.h') source.append('intern/cycles/util/util_transform.h')
source.append('intern/cycles/util/util_types.h') source.append('intern/cycles/util/util_types.h')
scriptinstall.append(env.Install(dir=dir,source=source)) scriptinstall.append(env.Install(dir=dir,source=source))
@@ -1179,37 +1159,9 @@ if env['OURPLATFORM']=='linuxcross':
textlist = [] textlist = []
texttargetlist = [] texttargetlist = []
for tp, tn, tf in os.walk('release/text'): for tp, tn, tf in os.walk('release/text'):
tf.remove("readme.html")
for f in tf: for f in tf:
textlist.append(tp+os.sep+f) textlist.append(tp+os.sep+f)
def readme_version_patch():
readme_src = "release/text/readme.html"
readme_dst = os.path.abspath(os.path.normpath(os.path.join(env['BF_BUILDDIR'], "readme.html")))
if not os.path.exists(readme_dst) or (os.path.getmtime(readme_dst) < os.path.getmtime(readme_src)):
f = open(readme_src, "r")
data = f.read()
f.close()
data = data.replace("BLENDER_VERSION", VERSION)
f = open(readme_dst, "w")
f.write(data)
f.close()
textlist.append(readme_dst)
readme_version_patch()
del readme_version_patch
'''Command(
"release/text/readme.html"
)
Command("file.out", "file.in", Copy(env['BF_INSTALLDIR'], "release/text/readme.html"))
'''
# Font licenses # Font licenses
textlist.append('release/datafiles/LICENSE-bfont.ttf.txt') textlist.append('release/datafiles/LICENSE-bfont.ttf.txt')
if env['WITH_BF_INTERNATIONAL']: if env['WITH_BF_INTERNATIONAL']:
@@ -1255,6 +1207,7 @@ if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'win64-vc', 'linuxcross'):
if env['WITH_BF_OPENAL']: if env['WITH_BF_OPENAL']:
dllsources.append('${LCGDIR}/openal/lib/OpenAL32.dll') dllsources.append('${LCGDIR}/openal/lib/OpenAL32.dll')
dllsources.append('${LCGDIR}/openal/lib/wrap_oal.dll')
if env['WITH_BF_SNDFILE']: if env['WITH_BF_SNDFILE']:
dllsources.append('${LCGDIR}/sndfile/lib/libsndfile-1.dll') dllsources.append('${LCGDIR}/sndfile/lib/libsndfile-1.dll')

View File

@@ -209,14 +209,14 @@ OCIO_VERSION_MIN="1.0"
OCIO_FORCE_REBUILD=false OCIO_FORCE_REBUILD=false
OCIO_SKIP=false OCIO_SKIP=false
OPENEXR_VERSION="2.2.0" OPENEXR_VERSION="2.1.0"
OPENEXR_VERSION_MIN="2.0.1" OPENEXR_VERSION_MIN="2.0.1"
ILMBASE_VERSION="2.2.0" ILMBASE_VERSION="2.1.0"
OPENEXR_FORCE_REBUILD=false OPENEXR_FORCE_REBUILD=false
OPENEXR_SKIP=false OPENEXR_SKIP=false
_with_built_openexr=false _with_built_openexr=false
OIIO_VERSION="1.4.16" OIIO_VERSION="1.4.11"
OIIO_VERSION_MIN="1.4.0" OIIO_VERSION_MIN="1.4.0"
OIIO_FORCE_REBUILD=false OIIO_FORCE_REBUILD=false
OIIO_SKIP=false OIIO_SKIP=false
@@ -228,7 +228,7 @@ LLVM_FORCE_REBUILD=false
LLVM_SKIP=false LLVM_SKIP=false
# OSL needs to be compiled for now! # OSL needs to be compiled for now!
OSL_VERSION="1.5.11" OSL_VERSION="1.5.0"
OSL_VERSION_MIN=$OSL_VERSION OSL_VERSION_MIN=$OSL_VERSION
OSL_FORCE_REBUILD=false OSL_FORCE_REBUILD=false
OSL_SKIP=false OSL_SKIP=false
@@ -485,29 +485,25 @@ BOOST_SOURCE=( "http://sourceforge.net/projects/boost/files/boost/$BOOST_VERSION
OCIO_SOURCE=( "https://github.com/imageworks/OpenColorIO/tarball/v$OCIO_VERSION" ) OCIO_SOURCE=( "https://github.com/imageworks/OpenColorIO/tarball/v$OCIO_VERSION" )
OPENEXR_USE_REPO=false #OPENEXR_SOURCE=( "http://download.savannah.nongnu.org/releases/openexr/openexr-$OPENEXR_VERSION.tar.gz" )
OPENEXR_SOURCE=( "http://download.savannah.nongnu.org/releases/openexr/openexr-$OPENEXR_VERSION.tar.gz" ) OPENEXR_SOURCE=( "https://github.com/mont29/openexr.git" )
OPENEXR_SOURCE_REPO=( "https://github.com/mont29/openexr.git" ) OPENEXR_REPO_UID="2787aa1cf652d244ed45ae124eb1553f6cff11ee"
OPENEXR_SOURCE_REPO_UID="2787aa1cf652d244ed45ae124eb1553f6cff11ee"
ILMBASE_SOURCE=( "http://download.savannah.nongnu.org/releases/openexr/ilmbase-$ILMBASE_VERSION.tar.gz" ) ILMBASE_SOURCE=( "http://download.savannah.nongnu.org/releases/openexr/ilmbase-$ILMBASE_VERSION.tar.gz" )
OIIO_USE_REPO=false #OIIO_SOURCE=( "https://github.com/OpenImageIO/oiio/archive/Release-$OIIO_VERSION.tar.gz" )
OIIO_SOURCE=( "https://github.com/OpenImageIO/oiio/archive/Release-$OIIO_VERSION.tar.gz" ) OIIO_SOURCE=( "https://github.com/OpenImageIO/oiio.git" )
OIIO_SOURCE_REPO=( "https://github.com/OpenImageIO/oiio.git" ) OIIO_REPO_UID="c9e67275a0b248ead96152f6d2221cc0c0f278a4"
OIIO_SOURCE_REPO_UID="c9e67275a0b248ead96152f6d2221cc0c0f278a4"
LLVM_SOURCE=( "http://llvm.org/releases/$LLVM_VERSION/llvm-$LLVM_VERSION.src.tar.gz" ) LLVM_SOURCE=( "http://llvm.org/releases/$LLVM_VERSION/llvm-$LLVM_VERSION.src.tar.gz" )
LLVM_CLANG_SOURCE=( "http://llvm.org/releases/$LLVM_VERSION/clang-$LLVM_VERSION.src.tar.gz" "http://llvm.org/releases/$LLVM_VERSION/cfe-$LLVM_VERSION.src.tar.gz" ) LLVM_CLANG_SOURCE=( "http://llvm.org/releases/$LLVM_VERSION/clang-$LLVM_VERSION.src.tar.gz" "http://llvm.org/releases/$LLVM_VERSION/cfe-$LLVM_VERSION.src.tar.gz" )
OSL_USE_REPO=true #OSL_SOURCE=( "https://github.com/imageworks/OpenShadingLanguage/archive/Release-$OSL_VERSION.tar.gz" )
#~ OSL_SOURCE=( "https://github.com/imageworks/OpenShadingLanguage/archive/Release-$OSL_VERSION.tar.gz" ) #OSL_SOURCE=( "https://github.com/imageworks/OpenShadingLanguage.git" )
OSL_SOURCE=( "https://github.com/Nazg-Gul/OpenShadingLanguage/archive/Release-1.5.11.tar.gz" ) #OSL_SOURCE=( "https://github.com/mont29/OpenShadingLanguage.git" )
#~ OSL_SOURCE_REPO=( "https://github.com/imageworks/OpenShadingLanguage.git" ) #OSL_REPO_UID="85179714e1bc69cd25ecb6bb711c1a156685d395"
#~ OSL_SOURCE_REPO=( "https://github.com/mont29/OpenShadingLanguage.git" ) #OSL_REPO_BRANCH="master"
#~ OSL_SOURCE_REPO_UID="85179714e1bc69cd25ecb6bb711c1a156685d395" OSL_SOURCE=( "https://github.com/Nazg-Gul/OpenShadingLanguage.git" )
#~ OSL_SOURCE_REPO_BRANCH="master" OSL_REPO_UID="22ee5ea298fd215430dfbd160b5aefd507f06db0"
OSL_SOURCE_REPO=( "https://github.com/Nazg-Gul/OpenShadingLanguage.git" ) OSL_REPO_BRANCH="blender-fixes"
OSL_SOURCE_REPO_UID="22ee5ea298fd215430dfbd160b5aefd507f06db0"
OSL_SOURCE_REPO_BRANCH="blender-fixes"
OPENCOLLADA_SOURCE=( "https://github.com/KhronosGroup/OpenCOLLADA.git" ) OPENCOLLADA_SOURCE=( "https://github.com/KhronosGroup/OpenCOLLADA.git" )
OPENCOLLADA_REPO_UID="18da7f4109a8eafaa290a33f5550501cc4c8bae8" OPENCOLLADA_REPO_UID="18da7f4109a8eafaa290a33f5550501cc4c8bae8"
@@ -983,7 +979,7 @@ clean_ILMBASE() {
compile_ILMBASE() { compile_ILMBASE() {
# To be changed each time we make edits that would modify the compiled result! # To be changed each time we make edits that would modify the compiled result!
ilmbase_magic=10 ilmbase_magic=9
_init_ilmbase _init_ilmbase
# Clean install if needed! # Clean install if needed!
@@ -1007,7 +1003,8 @@ compile_ILMBASE() {
download ILMBASE_SOURCE[@] $_src.tar.gz download ILMBASE_SOURCE[@] $_src.tar.gz
INFO "Unpacking ILMBase-$ILMBASE_VERSION" INFO "Unpacking ILMBase-$ILMBASE_VERSION"
tar -C $SRC --transform "s,(.*/?)ilmbase-[^/]*(.*),\1ILMBase-$ILMBASE_VERSION\2,x" -xf $_src.tar.gz tar -C $SRC --transform "s,(.*/?)ilmbase-[^/]*(.*),\1ILMBase-$ILMBASE_VERSION\2,x" \
-xf $_src.tar.gz
fi fi
@@ -1023,7 +1020,6 @@ compile_ILMBASE() {
cmake_d="$cmake_d -D CMAKE_PREFIX_PATH=$_inst" cmake_d="$cmake_d -D CMAKE_PREFIX_PATH=$_inst"
cmake_d="$cmake_d -D CMAKE_INSTALL_PREFIX=$_inst" cmake_d="$cmake_d -D CMAKE_INSTALL_PREFIX=$_inst"
cmake_d="$cmake_d -D BUILD_SHARED_LIBS=ON" cmake_d="$cmake_d -D BUILD_SHARED_LIBS=ON"
cmake_d="$cmake_d -D NAMESPACE_VERSIONING=OFF" # VERY IMPORTANT!!!
if file /bin/cp | grep -q '32-bit'; then if file /bin/cp | grep -q '32-bit'; then
cflags="-fPIC -m32 -march=i686" cflags="-fPIC -m32 -march=i686"
@@ -1096,28 +1092,24 @@ compile_OPENEXR() {
INFO "Downloading OpenEXR-$OPENEXR_VERSION" INFO "Downloading OpenEXR-$OPENEXR_VERSION"
mkdir -p $SRC mkdir -p $SRC
if [ $OPENEXR_USE_REPO == true ]; then # download OPENEXR_SOURCE[@] $_src.tar.gz
git clone ${OPENEXR_SOURCE_REPO[0]} $_src
else # INFO "Unpacking OpenEXR-$OPENEXR_VERSION"
download OPENEXR_SOURCE[@] $_src.tar.gz # tar -C $SRC --transform "s,(.*/?)openexr[^/]*(.*),\1OpenEXR-$OPENEXR_VERSION\2,x" \
INFO "Unpacking OpenEXR-$OPENEXR_VERSION" # -xf $_src.tar.gz
tar -C $SRC --transform "s,(.*/?)openexr[^/]*(.*),\1OpenEXR-$OPENEXR_VERSION\2,x" -xf $_src.tar.gz
fi git clone ${OPENEXR_SOURCE[0]} $_src
fi fi
cd $_src cd $_src
if [ $OPENEXR_USE_REPO == true ]; then
# XXX For now, always update from latest repo... # XXX For now, always update from latest repo...
git pull origin master git pull origin master
# Stick to same rev as windows' libs... # Stick to same rev as windows' libs...
git checkout $OPENEXR_SOURCE_REPO_UID git checkout $OPENEXR_REPO_UID
git reset --hard git reset --hard
oiio_src_path="../OpenEXR"
else
oiio_src_path=".."
fi
# Always refresh the whole build! # Always refresh the whole build!
if [ -d build ]; then if [ -d build ]; then
@@ -1131,7 +1123,6 @@ compile_OPENEXR() {
cmake_d="$cmake_d -D CMAKE_INSTALL_PREFIX=$_inst" cmake_d="$cmake_d -D CMAKE_INSTALL_PREFIX=$_inst"
cmake_d="$cmake_d -D ILMBASE_PACKAGE_PREFIX=$_ilmbase_inst" cmake_d="$cmake_d -D ILMBASE_PACKAGE_PREFIX=$_ilmbase_inst"
cmake_d="$cmake_d -D BUILD_SHARED_LIBS=ON" cmake_d="$cmake_d -D BUILD_SHARED_LIBS=ON"
cmake_d="$cmake_d -D NAMESPACE_VERSIONING=OFF" # VERY IMPORTANT!!!
if file /bin/cp | grep -q '32-bit'; then if file /bin/cp | grep -q '32-bit'; then
cflags="-fPIC -m32 -march=i686" cflags="-fPIC -m32 -march=i686"
@@ -1139,7 +1130,7 @@ compile_OPENEXR() {
cflags="-fPIC" cflags="-fPIC"
fi fi
cmake $cmake_d -D CMAKE_CXX_FLAGS="$cflags" -D CMAKE_EXE_LINKER_FLAGS="-lgcc_s -lgcc" $oiio_src_path cmake $cmake_d -D CMAKE_CXX_FLAGS="$cflags" -D CMAKE_EXE_LINKER_FLAGS="-lgcc_s -lgcc" ../OpenEXR
make -j$THREADS && make install make -j$THREADS && make install
@@ -1203,25 +1194,24 @@ compile_OIIO() {
if [ ! -d $_src ]; then if [ ! -d $_src ]; then
mkdir -p $SRC mkdir -p $SRC
#download OIIO_SOURCE[@] "$_src.tar.gz"
#
#INFO "Unpacking OpenImageIO-$OIIO_VERSION"
#tar -C $SRC --transform "s,(.*/?)oiio-Release-[^/]*(.*),\1OpenImageIO-$OIIO_VERSION\2,x" \
#-xf $_src.tar.gz
git clone ${OIIO_SOURCE[0]} $_src
if [ $OIIO_USE_REPO == true ]; then
git clone ${OIIO_SOURCE_REPO[0]} $_src
else
download OIIO_SOURCE[@] "$_src.tar.gz"
INFO "Unpacking OpenImageIO-$OIIO_VERSION"
tar -C $SRC --transform "s,(.*/?)oiio-Release-[^/]*(.*),\1OpenImageIO-$OIIO_VERSION\2,x" -xf $_src.tar.gz
fi
fi fi
cd $_src cd $_src
if [ $OIIO_USE_REPO == true ]; then
# XXX For now, always update from latest repo... # XXX For now, always update from latest repo...
git pull origin master git pull origin master
# Stick to same rev as windows' libs... # Stick to same rev as windows' libs...
git checkout $OIIO_SOURCE_REPO_UID git checkout $OIIO_REPO_UID
git reset --hard git reset --hard
fi
# Always refresh the whole build! # Always refresh the whole build!
if [ -d build ]; then if [ -d build ]; then
@@ -1243,7 +1233,6 @@ compile_OIIO() {
if [ $_with_built_openexr == true ]; then if [ $_with_built_openexr == true ]; then
cmake_d="$cmake_d -D ILMBASE_HOME=$INST/openexr" cmake_d="$cmake_d -D ILMBASE_HOME=$INST/openexr"
cmake_d="$cmake_d -D OPENEXR_HOME=$INST/openexr" cmake_d="$cmake_d -D OPENEXR_HOME=$INST/openexr"
INFO "ILMBASE_HOME=$INST/openexr"
fi fi
# Optional tests and cmd tools # Optional tests and cmd tools
@@ -1420,15 +1409,15 @@ clean_OSL() {
compile_OSL() { compile_OSL() {
# To be changed each time we make edits that would modify the compiled result! # To be changed each time we make edits that would modify the compiled result!
osl_magic=17 osl_magic=16
_init_osl _init_osl
# Clean install if needed! # Clean install if needed!
magic_compile_check osl-$OSL_VERSION $osl_magic magic_compile_check osl-$OSL_VERSION $osl_magic
#~ if [ $? -eq 1 -o $OSL_FORCE_REBUILD == true ]; then if [ $? -eq 1 -o $OSL_FORCE_REBUILD == true ]; then
#~ rm -Rf $_src # XXX Radical, but not easy to change remote repo fully automatically rm -Rf $_src # XXX Radical, but not easy to change remote repo fully automatically
#~ clean_OSL clean_OSL
#~ fi fi
if [ ! -d $_inst ]; then if [ ! -d $_inst ]; then
INFO "Building OpenShadingLanguage-$OSL_VERSION" INFO "Building OpenShadingLanguage-$OSL_VERSION"
@@ -1438,26 +1427,26 @@ compile_OSL() {
if [ ! -d $_src ]; then if [ ! -d $_src ]; then
mkdir -p $SRC mkdir -p $SRC
if [ $OSL_USE_REPO == true ]; then #download OSL_SOURCE[@] "$_src.tar.gz"
git clone ${OSL_SOURCE_REPO[0]} $_src
else #INFO "Unpacking OpenShadingLanguage-$OSL_VERSION"
download OSL_SOURCE[@] "$_src.tar.gz" #tar -C $SRC --transform "s,(.*/?)OpenShadingLanguage-[^/]*(.*),\1OpenShadingLanguage-$OSL_VERSION\2,x" \
INFO "Unpacking OpenShadingLanguage-$OSL_VERSION" #-xf $_src.tar.gz
tar -C $SRC --transform "s,(.*/?)OpenShadingLanguage-[^/]*(.*),\1OpenShadingLanguage-$OSL_VERSION\2,x" \
-xf $_src.tar.gz git clone ${OSL_SOURCE[0]} $_src
fi
fi fi
cd $_src cd $_src
if [ $OSL_USE_REPO == true ]; then git remote set-url origin ${OSL_SOURCE[0]}
git remote set-url origin ${OSL_SOURCE_REPO[0]}
# XXX For now, always update from latest repo... # XXX For now, always update from latest repo...
git pull --no-edit -X theirs origin $OSL_SOURCE_REPO_BRANCH git pull --no-edit -X theirs origin $OSL_GIT_BRANCH
# Stick to same rev as windows' libs... # Stick to same rev as windows' libs...
git checkout $OSL_SOURCE_REPO_UID git checkout $OSL_REPO_UID
git reset --hard git reset --hard
fi
# Always refresh the whole build! # Always refresh the whole build!
if [ -d build ]; then if [ -d build ]; then
@@ -1472,14 +1461,11 @@ compile_OSL() {
cmake_d="$cmake_d -D STOP_ON_WARNING=OFF" cmake_d="$cmake_d -D STOP_ON_WARNING=OFF"
cmake_d="$cmake_d -D BUILDSTATIC=OFF" cmake_d="$cmake_d -D BUILDSTATIC=OFF"
#~ cmake_d="$cmake_d -D ILMBASE_VERSION=$ILMBASE_VERSION" cmake_d="$cmake_d -D ILMBASE_VERSION=$ILMBASE_VERSION"
if [ $_with_built_openexr == true ]; then if [ $_with_built_openexr == true ]; then
INFO "ILMBASE_HOME=$INST/openexr" INFO "ILMBASE_HOME=$INST/openexr"
cmake_d="$cmake_d -D ILMBASE_HOME=$INST/openexr" cmake_d="$cmake_d -D ILMBASE_HOME=$INST/openexr"
# XXX Temp workaround... sigh, ILMBase really messed the things up by defining their custom names ON by default :(
cmake_d="$cmake_d -D ILMBASE_CUSTOM=ON"
cmake_d="$cmake_d -D ILMBASE_CUSTOM_LIBRARIES='Half;Iex;Imath;IlmThread'"
fi fi
if [ -d $INST/boost ]; then if [ -d $INST/boost ]; then
@@ -1493,7 +1479,7 @@ compile_OSL() {
if [ ! -z $LLVM_VERSION_FOUND ]; then if [ ! -z $LLVM_VERSION_FOUND ]; then
cmake_d="$cmake_d -D LLVM_VERSION=$LLVM_VERSION_FOUND" cmake_d="$cmake_d -D LLVM_VERSION=$LLVM_VERSION_FOUND"
if [ -d $INST/llvm ]; then if [ -d $INST/llvm ]; then
cmake_d="$cmake_d -D LLVM_ROOT_DIR=$INST/llvm" cmake_d="$cmake_d -D LLVM_DIRECTORY=$INST/llvm"
cmake_d="$cmake_d -D LLVM_STATIC=ON" cmake_d="$cmake_d -D LLVM_STATIC=ON"
fi fi
fi fi
@@ -1992,7 +1978,7 @@ install_DEB() {
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
install_packages_DEB libboost-locale$boost_version-dev libboost-filesystem$boost_version-dev \ install_packages_DEB libboost-locale$boost_version-dev libboost-filesystem$boost_version-dev \
libboost-regex$boost_version-dev libboost-system$boost_version-dev \ libboost-regex$boost_version-dev libboost-system$boost_version-dev \
libboost-thread$boost_version-dev libboost-wave$boost_version-dev libboost-thread$boost_version-dev
clean_Boost clean_Boost
else else
compile_Boost compile_Boost
@@ -2997,7 +2983,7 @@ print_info() {
_buildargs="$_buildargs $_1" _buildargs="$_buildargs $_1"
fi fi
if [ -d $INST/llvm ]; then if [ -d $INST/llvm ]; then
_1="-D LLVM_ROOT_DIR=$INST/llvm" _1="-D LLVM_DIRECTORY=$INST/llvm"
_2="-D LLVM_STATIC=ON" _2="-D LLVM_STATIC=ON"
PRINT " $_1" PRINT " $_1"
PRINT " $_2" PRINT " $_2"
@@ -3053,10 +3039,10 @@ print_info() {
PRINT "BF_OPENEXR = '$INST/openexr'" PRINT "BF_OPENEXR = '$INST/openexr'"
_ilm_libs_ext="" _ilm_libs_ext=""
#~ version_ge $OPENEXR_VERSION "2.1.0" version_ge $OPENEXR_VERSION "2.1.0"
#~ if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
#~ _ilm_libs_ext=`echo $OPENEXR_VERSION | sed -r 's/([0-9]+)\.([0-9]+).*/-\1_\2/'` _ilm_libs_ext=`echo $OPENEXR_VERSION | sed -r 's/([0-9]+)\.([0-9]+).*/-\1_\2/'`
#~ fi fi
PRINT "BF_OPENEXR_LIB = 'Half IlmImf$_ilm_libs_ext Iex$_ilm_libs_ext Imath$_ilm_libs_ext '" PRINT "BF_OPENEXR_LIB = 'Half IlmImf$_ilm_libs_ext Iex$_ilm_libs_ext Imath$_ilm_libs_ext '"
# BF_OPENEXR_LIB does not work, things like '-lIlmImf-2_1' do not suit ld. # BF_OPENEXR_LIB does not work, things like '-lIlmImf-2_1' do not suit ld.
# For now, hack around!!! # For now, hack around!!!

View File

@@ -124,15 +124,13 @@ BF_OIIO_INC = '${BF_OIIO}/include'
BF_OIIO_LIB_STATIC = '${BF_OIIO_LIBPATH}/libOpenImageIO.a ${BF_OPENEXR}/lib/libIlmImf.a ${BF_JPEG}/lib/libjpeg.a' BF_OIIO_LIB_STATIC = '${BF_OIIO_LIBPATH}/libOpenImageIO.a ${BF_OPENEXR}/lib/libIlmImf.a ${BF_JPEG}/lib/libjpeg.a'
BF_OIIO_LIBPATH = '${BF_OIIO}/lib' BF_OIIO_LIBPATH = '${BF_OIIO}/lib'
BF_IS_NEW_OSL = False
WITH_BF_CYCLES_OSL = True WITH_BF_CYCLES_OSL = True
WITH_BF_STATICOSL = BF_IS_NEW_OSL WITH_BF_STATICOSL = False
BF_OSL = '/opt/lib/osl' BF_OSL = '/opt/lib/osl'
BF_OSL_INC = '${BF_OSL}/include' BF_OSL_INC = '${BF_OSL}/include'
# note oslexec would passed via program linkflags, which is needed to # note oslexec would passed via program linkflags, which is needed to
# make llvm happy with osl_allocate_closure_component # make llvm happy with osl_allocate_closure_component
BF_OSL_LIB = 'oslcomp oslexec oslquery' BF_OSL_LIB = 'oslcomp oslexec oslquery'
BF_OSL_LIB_STATIC = '${BF_OSL}/lib/liboslcomp.a ${BF_OSL}/lib/liboslexec.a ${BF_OSL}/lib/liboslquery.a'
BF_OSL_LIBPATH = '${BF_OSL}/lib' BF_OSL_LIBPATH = '${BF_OSL}/lib'
BF_OSL_COMPILER = '${BF_OSL}/bin/oslc' BF_OSL_COMPILER = '${BF_OSL}/bin/oslc'
@@ -159,8 +157,6 @@ BF_BOOST_INC = '${BF_BOOST}/include'
BF_BOOST_LIB_STATIC = '${BF_BOOST_LIBPATH}/libboost_filesystem.a ${BF_BOOST_LIBPATH}/libboost_date_time.a ' + \ BF_BOOST_LIB_STATIC = '${BF_BOOST_LIBPATH}/libboost_filesystem.a ${BF_BOOST_LIBPATH}/libboost_date_time.a ' + \
'${BF_BOOST_LIBPATH}/libboost_regex.a ${BF_BOOST_LIBPATH}/libboost_locale.a ${BF_BOOST_LIBPATH}/libboost_system.a \ '${BF_BOOST_LIBPATH}/libboost_regex.a ${BF_BOOST_LIBPATH}/libboost_locale.a ${BF_BOOST_LIBPATH}/libboost_system.a \
${BF_BOOST_LIBPATH}/libboost_thread.a' ${BF_BOOST_LIBPATH}/libboost_thread.a'
if BF_IS_NEW_OSL:
BF_BOOST_LIB_STATIC += ' ${BF_BOOST_LIBPATH}/libboost_wave.a'
BF_BOOST_LIBPATH = '${BF_BOOST}/lib' BF_BOOST_LIBPATH = '${BF_BOOST}/lib'
# Ocean Simulation # Ocean Simulation
@@ -170,7 +166,4 @@ WITH_BF_OCEANSIM = True
BF_DEBUG = False BF_DEBUG = False
REL_CCFLAGS = ['-DNDEBUG', '-O2', '-msse', '-msse2'] # C & C++ REL_CCFLAGS = ['-DNDEBUG', '-O2', '-msse', '-msse2'] # C & C++
PLATFORM_LINKFLAGS = ['-lrt'] PLATFORM_LINKFLAGS = ['-lrt']
if BF_IS_NEW_OSL:
BF_PROGRAM_LINKFLAGS = ['-Wl,--version-script=source/creator/blender.map']
else:
BF_PROGRAM_LINKFLAGS = ['-Wl,--whole-archive', '-loslexec', '-Wl,--no-whole-archive', '-Wl,--version-script=source/creator/blender.map'] BF_PROGRAM_LINKFLAGS = ['-Wl,--whole-archive', '-loslexec', '-Wl,--no-whole-archive', '-Wl,--version-script=source/creator/blender.map']

View File

@@ -124,15 +124,13 @@ BF_OIIO_INC = '${BF_OIIO}/include'
BF_OIIO_LIB_STATIC = '${BF_OIIO_LIBPATH}/libOpenImageIO.a ${BF_OPENEXR}/lib/libIlmImf.a ${BF_JPEG}/lib/libjpeg.a' BF_OIIO_LIB_STATIC = '${BF_OIIO_LIBPATH}/libOpenImageIO.a ${BF_OPENEXR}/lib/libIlmImf.a ${BF_JPEG}/lib/libjpeg.a'
BF_OIIO_LIBPATH = '${BF_OIIO}/lib' BF_OIIO_LIBPATH = '${BF_OIIO}/lib'
BF_IS_NEW_OSL = False
WITH_BF_CYCLES_OSL = True WITH_BF_CYCLES_OSL = True
WITH_BF_STATICOSL = BF_IS_NEW_OSL WITH_BF_STATICOSL = False
BF_OSL = '/opt/lib/osl' BF_OSL = '/opt/lib/osl'
BF_OSL_INC = '${BF_OSL}/include' BF_OSL_INC = '${BF_OSL}/include'
# note oslexec would passed via program linkflags, which is needed to # note oslexec would passed via program linkflags, which is needed to
# make llvm happy with osl_allocate_closure_component # make llvm happy with osl_allocate_closure_component
BF_OSL_LIB = 'oslcomp oslexec oslquery' BF_OSL_LIB = 'oslcomp oslexec oslquery'
BF_OSL_LIB_STATIC = '${BF_OSL}/lib/liboslcomp.a ${BF_OSL}/lib/liboslexec.a ${BF_OSL}/lib/liboslquery.a'
BF_OSL_LIBPATH = '${BF_OSL}/lib' BF_OSL_LIBPATH = '${BF_OSL}/lib'
BF_OSL_COMPILER = '${BF_OSL}/bin/oslc' BF_OSL_COMPILER = '${BF_OSL}/bin/oslc'
@@ -159,8 +157,6 @@ BF_BOOST_INC = '${BF_BOOST}/include'
BF_BOOST_LIB_STATIC = '${BF_BOOST_LIBPATH}/libboost_filesystem.a ${BF_BOOST_LIBPATH}/libboost_date_time.a ' + \ BF_BOOST_LIB_STATIC = '${BF_BOOST_LIBPATH}/libboost_filesystem.a ${BF_BOOST_LIBPATH}/libboost_date_time.a ' + \
'${BF_BOOST_LIBPATH}/libboost_regex.a ${BF_BOOST_LIBPATH}/libboost_locale.a ${BF_BOOST_LIBPATH}/libboost_system.a \ '${BF_BOOST_LIBPATH}/libboost_regex.a ${BF_BOOST_LIBPATH}/libboost_locale.a ${BF_BOOST_LIBPATH}/libboost_system.a \
${BF_BOOST_LIBPATH}/libboost_thread.a' ${BF_BOOST_LIBPATH}/libboost_thread.a'
if BF_IS_NEW_OSL:
BF_BOOST_LIB_STATIC += ' ${BF_BOOST_LIBPATH}/libboost_wave.a'
BF_BOOST_LIBPATH = '${BF_BOOST}/lib' BF_BOOST_LIBPATH = '${BF_BOOST}/lib'
# Ocean Simulation # Ocean Simulation
@@ -170,7 +166,4 @@ WITH_BF_OCEANSIM = True
BF_DEBUG = False BF_DEBUG = False
REL_CCFLAGS = ['-DNDEBUG', '-O2', '-msse', '-msse2'] # C & C++ REL_CCFLAGS = ['-DNDEBUG', '-O2', '-msse', '-msse2'] # C & C++
PLATFORM_LINKFLAGS = ['-lrt'] PLATFORM_LINKFLAGS = ['-lrt']
if BF_IS_NEW_OSL:
BF_PROGRAM_LINKFLAGS = ['-Wl,--version-script=source/creator/blender.map']
else:
BF_PROGRAM_LINKFLAGS = ['-Wl,--whole-archive', '-loslexec', '-Wl,--no-whole-archive', '-Wl,--version-script=source/creator/blender.map'] BF_PROGRAM_LINKFLAGS = ['-Wl,--whole-archive', '-loslexec', '-Wl,--no-whole-archive', '-Wl,--version-script=source/creator/blender.map']

View File

@@ -1,6 +1,5 @@
CC = "../lib/darwin-9.x.universal/clang-omp-3.5/bin/clang"
CXX = "../lib/darwin-9.x.universal/clang-omp-3.5/bin/clang++"
MACOSX_ARCHITECTURE = 'x86_64' # valid archs: ppc, i386, ppc64, x86_64 MACOSX_ARCHITECTURE = 'x86_64' # valid archs: ppc, i386, ppc64, x86_64
WITH_BF_CYCLES_CUDA_BINARIES = True WITH_BF_CYCLES_CUDA_BINARIES = True

View File

@@ -17,7 +17,6 @@ modification time, we hack the class a bit in order to have such functionaliity
from buildbot.status.web.base import DirectoryLister from buildbot.status.web.base import DirectoryLister
def get_files_and_directories(self, directory): def get_files_and_directories(self, directory):
from twisted.web.static import (getTypeAndEncoding, from twisted.web.static import (getTypeAndEncoding,
formatFileSize) formatFileSize)
@@ -98,7 +97,6 @@ all_repositories = {
r'https://svn.blender.org/svnroot/bf-blender/': 'lib svn', r'https://svn.blender.org/svnroot/bf-blender/': 'lib svn',
} }
def codebaseGenerator(chdict): def codebaseGenerator(chdict):
return all_repositories[chdict['repository']] return all_repositories[chdict['repository']]
@@ -114,7 +112,6 @@ from buildbot.schedulers import timed, forcesched
c['schedulers'] = [] c['schedulers'] = []
def schedule_force_build(name): def schedule_force_build(name):
c['schedulers'].append(forcesched.ForceScheduler(name='force ' + name, c['schedulers'].append(forcesched.ForceScheduler(name='force ' + name,
builderNames=[name], builderNames=[name],
@@ -146,7 +143,7 @@ def schedule_build(name, hour, minute=0):
"blender-addons": {"repository": "", "branch": "master"}, "blender-addons": {"repository": "", "branch": "master"},
"blender-addons-contrib": {"repository": "", "branch": "master"}, "blender-addons-contrib": {"repository": "", "branch": "master"},
"scons": {"repository": "", "branch": "master"}, "scons": {"repository": "", "branch": "master"},
"lib svn": {"repository": "", "branch": "trunk"}}, "lib svn": {"repository": "", "branch": "master"}},
branch=current_branch, branch=current_branch,
builderNames=[name], builderNames=[name],
hour=hour, hour=hour,

View File

@@ -37,7 +37,6 @@ def strip_extension(filename):
return filename return filename
# extract platform from package name # extract platform from package name
def get_platform(filename): def get_platform(filename):
# name is blender-version-platform.extension. we want to get the # name is blender-version-platform.extension. we want to get the
@@ -65,7 +64,6 @@ def get_platform(filename):
return '-'.join(platform_tokens) return '-'.join(platform_tokens)
def get_branch(filename): def get_branch(filename):
tokens = filename.split("-") tokens = filename.split("-")
branch = "" branch = ""
@@ -95,7 +93,7 @@ if not os.path.exists(filename):
try: try:
z = zipfile.ZipFile(filename, "r") z = zipfile.ZipFile(filename, "r")
except Exception as ex: except Exception, ex:
sys.stderr.write('Failed to open zip file: %s\n' % str(ex)) sys.stderr.write('Failed to open zip file: %s\n' % str(ex))
sys.exit(1) sys.exit(1)
@@ -131,7 +129,7 @@ try:
zf.close() zf.close()
z.close() z.close()
except Exception as ex: except Exception, ex:
sys.stderr.write('Failed to unzip package: %s\n' % str(ex)) sys.stderr.write('Failed to unzip package: %s\n' % str(ex))
sys.exit(1) sys.exit(1)
@@ -141,6 +139,6 @@ try:
if get_platform(f) == platform and get_branch(f) == branch: if get_platform(f) == platform and get_branch(f) == branch:
if f != packagename: if f != packagename:
os.remove(os.path.join(directory, f)) os.remove(os.path.join(directory, f))
except Exception as ex: except Exception, ex:
sys.stderr.write('Failed to remove old packages: %s\n' % str(ex)) sys.stderr.write('Failed to remove old packages: %s\n' % str(ex))
sys.exit(1) sys.exit(1)

View File

@@ -116,7 +116,7 @@ if builder.find('scons') != -1:
retcode = subprocess.call([python_bin, 'scons/scons.py'] + scons_options) retcode = subprocess.call([python_bin, 'scons/scons.py'] + scons_options)
sys.exit(retcode) sys.exit(retcode)
else: else:
# CMake #cmake
if 'win' in builder: if 'win' in builder:
files = [f for f in os.listdir('.') if os.path.isfile(f) and f.endswith('.zip')] files = [f for f in os.listdir('.') if os.path.isfile(f) and f.endswith('.zip')]
for f in files: for f in files:
@@ -133,7 +133,7 @@ else:
z.write("{}.zip".format(builder)) z.write("{}.zip".format(builder))
z.close() z.close()
sys.exit(retcode) sys.exit(retcode)
except Exception as ex: except Exception, ex:
sys.stderr.write('Create buildbot_upload.zip failed' + str(ex) + '\n') sys.stderr.write('Create buildbot_upload.zip failed' + str(ex) + '\n')
sys.exit(1) sys.exit(1)
@@ -149,7 +149,7 @@ if os.path.exists(release_dir):
# create release package # create release package
try: try:
subprocess.call(['make', 'package_archive']) subprocess.call(['make', 'package_archive'])
except Exception as ex: except Exception, ex:
sys.stderr.write('Make package release failed' + str(ex) + '\n') sys.stderr.write('Make package release failed' + str(ex) + '\n')
sys.exit(1) sys.exit(1)
@@ -180,6 +180,6 @@ try:
z = zipfile.ZipFile(upload_zip, "w", compression=zipfile.ZIP_STORED) z = zipfile.ZipFile(upload_zip, "w", compression=zipfile.ZIP_STORED)
z.write(filepath, arcname=file) z.write(filepath, arcname=file)
z.close() z.close()
except Exception as ex: except Exception, ex:
sys.stderr.write('Create buildbot_upload.zip failed' + str(ex) + '\n') sys.stderr.write('Create buildbot_upload.zip failed' + str(ex) + '\n')
sys.exit(1) sys.exit(1)

View File

@@ -1,56 +0,0 @@
# - Find Eigen3 library
# Find the native Eigen3 includes and library
# This module defines
# EIGEN3_INCLUDE_DIRS, where to find spnav.h, Set when
# EIGEN3_INCLUDE_DIR is found.
# EIGEN3_ROOT_DIR, The base directory to search for Eigen3.
# This can also be an environment variable.
# EIGEN3_FOUND, If false, do not try to use Eigen3.
#
#=============================================================================
# Copyright 2015 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 EIGEN3_ROOT_DIR was defined in the environment, use it.
IF(NOT EIGEN3_ROOT_DIR AND NOT $ENV{EIGEN3_ROOT_DIR} STREQUAL "")
SET(EIGEN3_ROOT_DIR $ENV{EIGEN3_ROOT_DIR})
ENDIF()
SET(_eigen3_SEARCH_DIRS
${EIGEN3_ROOT_DIR}
/usr/local
/sw # Fink
/opt/local # DarwinPorts
/opt/csw # Blastwave
)
FIND_PATH(EIGEN3_INCLUDE_DIR
NAMES
# header has no '.h' suffix
Eigen/Eigen
HINTS
${_eigen3_SEARCH_DIRS}
PATH_SUFFIXES
include/eigen3
)
# handle the QUIETLY and REQUIRED arguments and set EIGEN3_FOUND to TRUE if
# all listed variables are TRUE
INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(Eigen3 DEFAULT_MSG
EIGEN3_INCLUDE_DIR)
IF(EIGEN3_FOUND)
SET(EIGEN3_INCLUDE_DIRS ${EIGEN3_INCLUDE_DIR})
ENDIF(EIGEN3_FOUND)
MARK_AS_ADVANCED(
EIGEN3_INCLUDE_DIR
)

View File

@@ -33,7 +33,6 @@ SET(_jemalloc_SEARCH_DIRS
/sw # Fink /sw # Fink
/opt/local # DarwinPorts /opt/local # DarwinPorts
/opt/csw # Blastwave /opt/csw # Blastwave
/opt/lib/jemalloc
) )
FIND_PATH(JEMALLOC_INCLUDE_DIR FIND_PATH(JEMALLOC_INCLUDE_DIR

View File

@@ -1,68 +0,0 @@
# - Find LZO library
# Find the native LZO includes and library
# This module defines
# LZO_INCLUDE_DIRS, where to find lzo1x.h, Set when
# LZO_INCLUDE_DIR is found.
# LZO_LIBRARIES, libraries to link against to use LZO.
# LZO_ROOT_DIR, The base directory to search for LZO.
# This can also be an environment variable.
# LZO_FOUND, If false, do not try to use LZO.
#
# also defined, but not for general use are
# LZO_LIBRARY, where to find the LZO library.
#=============================================================================
# Copyright 2015 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 LZO_ROOT_DIR was defined in the environment, use it.
IF(NOT LZO_ROOT_DIR AND NOT $ENV{LZO_ROOT_DIR} STREQUAL "")
SET(LZO_ROOT_DIR $ENV{LZO_ROOT_DIR})
ENDIF()
SET(_lzo_SEARCH_DIRS
${LZO_ROOT_DIR}
/usr/local
/sw # Fink
/opt/local # DarwinPorts
/opt/csw # Blastwave
)
FIND_PATH(LZO_INCLUDE_DIR lzo/lzo1x.h
HINTS
${_lzo_SEARCH_DIRS}
PATH_SUFFIXES
include
)
FIND_LIBRARY(LZO_LIBRARY
NAMES
lzo2
HINTS
${_lzo_SEARCH_DIRS}
PATH_SUFFIXES
lib64 lib
)
# handle the QUIETLY and REQUIRED arguments and set LZO_FOUND to TRUE if
# all listed variables are TRUE
INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(LZO DEFAULT_MSG
LZO_LIBRARY LZO_INCLUDE_DIR)
IF(LZO_FOUND)
SET(LZO_LIBRARIES ${LZO_LIBRARY})
SET(LZO_INCLUDE_DIRS ${LZO_INCLUDE_DIR})
ENDIF(LZO_FOUND)
MARK_AS_ADVANCED(
LZO_INCLUDE_DIR
LZO_LIBRARY
)

View File

@@ -51,7 +51,6 @@ SET(_openexr_SEARCH_DIRS
/sw # Fink /sw # Fink
/opt/local # DarwinPorts /opt/local # DarwinPorts
/opt/csw # Blastwave /opt/csw # Blastwave
/opt/lib/openexr
) )
FIND_PATH(OPENEXR_INCLUDE_DIR FIND_PATH(OPENEXR_INCLUDE_DIR

View File

@@ -71,7 +71,6 @@ ENDIF()
MARK_AS_ADVANCED( MARK_AS_ADVANCED(
OPENGLES_EGL_INCLUDE_DIR OPENGLES_EGL_INCLUDE_DIR
OPENGLES_EGL_LIBRARY OPENGLES_EGL_LIBRARY
OPENGLES_LIBRARY
OPENGLES_INCLUDE_DIR OPENGLES_INCLUDE_DIR
) )

View File

@@ -7,8 +7,6 @@
# OPENIMAGEIO_ROOT_DIR, The base directory to search for OpenImageIO. # OPENIMAGEIO_ROOT_DIR, The base directory to search for OpenImageIO.
# This can also be an environment variable. # This can also be an environment variable.
# OPENIMAGEIO_FOUND, If false, do not try to use OpenImageIO. # OPENIMAGEIO_FOUND, If false, do not try to use OpenImageIO.
# OPENIMAGEIO_PUGIXML_FOUND, Indicates whether OIIO has biltin PuguXML parser.
# OPENIMAGEIO_IDIFF, full path to idiff application if found.
# #
# also defined, but not for general use are # also defined, but not for general use are
# OPENIMAGEIO_LIBRARY, where to find the OpenImageIO library. # OPENIMAGEIO_LIBRARY, where to find the OpenImageIO library.
@@ -56,14 +54,6 @@ FIND_LIBRARY(OPENIMAGEIO_LIBRARY
lib64 lib lib64 lib
) )
FIND_FILE(OPENIMAGEIO_IDIFF
NAMES
idiff
${OPENIMAGEIO_ROOT_DIR}
PATH_SUFFIXES
bin
)
# handle the QUIETLY and REQUIRED arguments and set OPENIMAGEIO_FOUND to TRUE if # handle the QUIETLY and REQUIRED arguments and set OPENIMAGEIO_FOUND to TRUE if
# all listed variables are TRUE # all listed variables are TRUE
INCLUDE(FindPackageHandleStandardArgs) INCLUDE(FindPackageHandleStandardArgs)
@@ -73,17 +63,11 @@ FIND_PACKAGE_HANDLE_STANDARD_ARGS(OpenImageIO DEFAULT_MSG
IF(OPENIMAGEIO_FOUND) IF(OPENIMAGEIO_FOUND)
SET(OPENIMAGEIO_LIBRARIES ${OPENIMAGEIO_LIBRARY}) SET(OPENIMAGEIO_LIBRARIES ${OPENIMAGEIO_LIBRARY})
SET(OPENIMAGEIO_INCLUDE_DIRS ${OPENIMAGEIO_INCLUDE_DIR}) SET(OPENIMAGEIO_INCLUDE_DIRS ${OPENIMAGEIO_INCLUDE_DIR})
IF(EXISTS ${OPENIMAGEIO_INCLUDE_DIR}/OpenImageIO/pugixml.hpp) ENDIF(OPENIMAGEIO_FOUND)
SET(OPENIMAGEIO_PUGIXML_FOUND TRUE)
ENDIF()
ELSE()
SET(OPENIMAGEIO_PUGIXML_FOUND FALSE)
ENDIF()
MARK_AS_ADVANCED( MARK_AS_ADVANCED(
OPENIMAGEIO_INCLUDE_DIR OPENIMAGEIO_INCLUDE_DIR
OPENIMAGEIO_LIBRARY OPENIMAGEIO_LIBRARY
OPENIMAGEIO_IDIFF
) )
UNSET(_openimageio_SEARCH_DIRS) UNSET(_openimageio_SEARCH_DIRS)

View File

@@ -1,98 +0,0 @@
# - Find OpenShadingLanguage library
# Find the native OpenShadingLanguage includes and library
# This module defines
# OSL_INCLUDE_DIRS, where to find OSL headers, Set when
# OSL_INCLUDE_DIR is found.
# OSL_LIBRARIES, libraries to link against to use OSL.
# OSL_ROOT_DIR, the base directory to search for OSL.
# This can also be an environment variable.
# OSL_COMPILER, full path to OSL script compiler.
# OSL_FOUND, if false, do not try to use OSL.
# OSL_LIBRARY_VERSION_MAJOR, OSL_LIBRARY_VERSION_MINOR, the major
# and minor versions of OSL library if found.
#
#=============================================================================
# Copyright 2014 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 OSL_ROOT_DIR was defined in the environment, use it.
IF(NOT OSL_ROOT_DIR AND NOT $ENV{OSL_ROOT_DIR} STREQUAL "")
SET(OSL_ROOT_DIR $ENV{OSL_ROOT_DIR})
ENDIF()
SET(_osl_FIND_COMPONENTS
oslcomp
oslexec
oslquery
)
SET(_osl_SEARCH_DIRS
${OSL_ROOT_DIR}
/usr/local
/sw # Fink
/opt/local # DarwinPorts
/opt/csw # Blastwave
/opt/lib/osl
)
FIND_PATH(OSL_INCLUDE_DIR
NAMES
OSL/oslversion.h
HINTS
${_osl_SEARCH_DIRS}
PATH_SUFFIXES
include
)
SET(_osl_LIBRARIES)
FOREACH(COMPONENT ${_osl_FIND_COMPONENTS})
STRING(TOUPPER ${COMPONENT} UPPERCOMPONENT)
FIND_LIBRARY(OSL_${UPPERCOMPONENT}_LIBRARY
NAMES
${COMPONENT}
HINTS
${_osl_SEARCH_DIRS}
PATH_SUFFIXES
lib64 lib
)
LIST(APPEND _osl_LIBRARIES "${OSL_${UPPERCOMPONENT}_LIBRARY}")
ENDFOREACH()
FIND_PROGRAM(OSL_COMPILER oslc
HINTS ${_osl_SEARCH_DIRS}
PATH_SUFFIXES bin)
# handle the QUIETLY and REQUIRED arguments and set OSL_FOUND to TRUE if
# all listed variables are TRUE
INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(OSL DEFAULT_MSG _osl_LIBRARIES OSL_INCLUDE_DIR OSL_COMPILER)
IF(OSL_FOUND)
SET(OSL_LIBRARIES ${_osl_LIBRARIES})
SET(OSL_INCLUDE_DIRS ${OSL_INCLUDE_DIR})
FILE(STRINGS "${OSL_INCLUDE_DIR}/OSL/oslversion.h" OSL_LIBRARY_VERSION_MAJOR
REGEX "^[ \t]*#define[ \t]+OSL_LIBRARY_VERSION_MAJOR[ \t]+[0-9]+.*$")
FILE(STRINGS "${OSL_INCLUDE_DIR}/OSL/oslversion.h" OSL_LIBRARY_VERSION_MINOR
REGEX "^[ \t]*#define[ \t]+OSL_LIBRARY_VERSION_MINOR[ \t]+[0-9]+.*$")
STRING(REGEX REPLACE ".*#define[ \t]+OSL_LIBRARY_VERSION_MAJOR[ \t]+([.0-9]+).*"
"\\1" OSL_LIBRARY_VERSION_MAJOR ${OSL_LIBRARY_VERSION_MAJOR})
STRING(REGEX REPLACE ".*#define[ \t]+OSL_LIBRARY_VERSION_MINOR[ \t]+([.0-9]+).*"
"\\1" OSL_LIBRARY_VERSION_MINOR ${OSL_LIBRARY_VERSION_MINOR})
ENDIF(OSL_FOUND)
MARK_AS_ADVANCED(
OSL_INCLUDE_DIR
)
FOREACH(COMPONENT ${_osl_FIND_COMPONENTS})
STRING(TOUPPER ${COMPONENT} UPPERCOMPONENT)
MARK_AS_ADVANCED(OSL_${UPPERCOMPONENT}_LIBRARY)
ENDFOREACH()

View File

@@ -40,6 +40,7 @@ FIND_PATH(PCRE_INCLUDE_DIR pcre.h
${_pcre_SEARCH_DIRS} ${_pcre_SEARCH_DIRS}
PATH_SUFFIXES PATH_SUFFIXES
include include
include
) )
FIND_LIBRARY(PCRE_LIBRARY FIND_LIBRARY(PCRE_LIBRARY

View File

@@ -1,73 +0,0 @@
# - Find PugiXML library
# Find the native PugiXML includes and library
# This module defines
# PUGIXML_INCLUDE_DIRS, where to find pugixml.hpp, Set when
# PugiXML is found.
# PUGIXML_LIBRARIES, libraries to link against to use PugiiXML.
# PUGIXML_ROOT_DIR, The base directory to search for PugiXML.
# This can also be an environment variable.
# PUGIXML_FOUND, If false, do not try to use PugiXML.
#
# also defined, but not for general use are
# PUGIXML_LIBRARY, where to find the PugiXML library.
#=============================================================================
# Copyright 2014 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 PUGIXML_ROOT_DIR was defined in the environment, use it.
IF(NOT PUGIXML_ROOT_DIR AND NOT $ENV{PUGIXML_ROOT_DIR} STREQUAL "")
SET(PUGIXML_ROOT_DIR $ENV{PUGIXML_ROOT_DIR})
ENDIF()
SET(_pugixml_SEARCH_DIRS
${PUGIXML_ROOT_DIR}
/usr/local
/sw # Fink
/opt/local # DarwinPorts
/opt/csw # Blastwave
/opt/lib/oiio
)
FIND_PATH(PUGIXML_INCLUDE_DIR
NAMES
pugixml.hpp
HINTS
${_pugixml_SEARCH_DIRS}
PATH_SUFFIXES
include
)
FIND_LIBRARY(PUGIXML_LIBRARY
NAMES
pugixml
HINTS
${_pugixml_SEARCH_DIRS}
PATH_SUFFIXES
lib64 lib
)
# handle the QUIETLY and REQUIRED arguments and set PUGIXML_FOUND to TRUE if
# all listed variables are TRUE
INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(PUGIXML DEFAULT_MSG
PUGIXML_LIBRARY PUGIXML_INCLUDE_DIR)
IF(PUGIXML_FOUND)
SET(PUGIXML_LIBRARIES ${PUGIXML_LIBRARY})
SET(PUGIXML_INCLUDE_DIRS ${PUGIXML_INCLUDE_DIR})
ELSE()
SET(PUGIXML_PUGIXML_FOUND FALSE)
ENDIF()
MARK_AS_ADVANCED(
PUGIXML_INCLUDE_DIR
PUGIXML_LIBRARY
)

View File

@@ -14,7 +14,6 @@
# PYTHON_INCLUDE_CONFIG_DIRS # PYTHON_INCLUDE_CONFIG_DIRS
# PYTHON_LIBRARIES # PYTHON_LIBRARIES
# PYTHON_LIBPATH, Used for installation # PYTHON_LIBPATH, Used for installation
# PYTHON_SITE_PACKAGES, Used for installation (as a Python module)
# PYTHON_LINKFLAGS # PYTHON_LINKFLAGS
# PYTHON_ROOT_DIR, The base directory to search for Python. # PYTHON_ROOT_DIR, The base directory to search for Python.
# This can also be an environment variable. # This can also be an environment variable.
@@ -188,15 +187,6 @@ IF(PYTHONLIBSUNIX_FOUND)
SET(PYTHON_INCLUDE_DIRS ${PYTHON_INCLUDE_DIR} ${PYTHON_INCLUDE_CONFIG_DIR}) SET(PYTHON_INCLUDE_DIRS ${PYTHON_INCLUDE_DIR} ${PYTHON_INCLUDE_CONFIG_DIR})
SET(PYTHON_LIBRARIES ${PYTHON_LIBRARY}) SET(PYTHON_LIBRARIES ${PYTHON_LIBRARY})
FIND_FILE(PYTHON_SITE_PACKAGES
NAMES
# debian specific
dist-packages
site-packages
HINTS
${PYTHON_LIBPATH}/python${PYTHON_VERSION}
)
# we need this for installation # we need this for installation
# XXX No more valid with debian-like py3.4 packages... # XXX No more valid with debian-like py3.4 packages...
# GET_FILENAME_COMPONENT(PYTHON_LIBPATH ${PYTHON_LIBRARY} PATH) # GET_FILENAME_COMPONENT(PYTHON_LIBPATH ${PYTHON_LIBRARY} PATH)
@@ -210,5 +200,4 @@ MARK_AS_ADVANCED(
PYTHON_INCLUDE_CONFIG_DIR PYTHON_INCLUDE_CONFIG_DIR
PYTHON_LIBRARY PYTHON_LIBRARY
PYTHON_LIBPATH PYTHON_LIBPATH
PYTHON_SITE_PACKAGES
) )

View File

@@ -1,72 +0,0 @@
# - Find SDL library
# Find the native SDL includes and library
# This module defines
# SDL2_INCLUDE_DIRS, where to find SDL.h, Set when SDL2_INCLUDE_DIR is found.
# SDL2_LIBRARIES, libraries to link against to use SDL.
# SDL2_ROOT_DIR, The base directory to search for SDL.
# This can also be an environment variable.
# SDL2_FOUND, If false, do not try to use SDL.
#
# also defined, but not for general use are
# SDL2_LIBRARY, where to find the SDL library.
#=============================================================================
# Copyright 2015 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 SDL2_ROOT_DIR was defined in the environment, use it.
IF(NOT SDL2_ROOT_DIR AND NOT $ENV{SDL2_ROOT_DIR} STREQUAL "")
SET(SDL2_ROOT_DIR $ENV{SDL2_ROOT_DIR})
ENDIF()
SET(_sdl2_SEARCH_DIRS
${SDL2_ROOT_DIR}
~/Library/Frameworks
/Library/Frameworks
/usr/local
/usr
/sw # Fink
/opt/local # DarwinPorts
/opt/csw # Blastwave
)
FIND_PATH(SDL2_INCLUDE_DIR
NAMES
SDL.h
HINTS
${_sdl2_SEARCH_DIRS}
PATH_SUFFIXES
include/SDL2 include
)
FIND_LIBRARY(SDL2_LIBRARY
NAMES
SDL2
HINTS
${_sdl2_SEARCH_DIRS}
PATH_SUFFIXES
lib64 lib
)
# handle the QUIETLY and REQUIRED arguments and set SDL2_FOUND to TRUE if
# all listed variables are TRUE
INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(SDL2 DEFAULT_MSG
SDL2_LIBRARY SDL2_INCLUDE_DIR)
IF(SDL2_FOUND)
SET(SDL2_LIBRARIES ${SDL2_LIBRARY})
SET(SDL2_INCLUDE_DIRS ${SDL2_INCLUDE_DIR})
ENDIF(SDL2_FOUND)
MARK_AS_ADVANCED(
SDL2_INCLUDE_DIR
SDL2_LIBRARY
)

View File

@@ -32,8 +32,6 @@ macro(BLENDER_SRC_GTEST NAME SRC EXTRA_LIBS)
bf_testing_main bf_testing_main
bf_intern_guardedalloc bf_intern_guardedalloc
extern_gtest extern_gtest
# needed for glog
${PTHREADS_LIBRARIES}
extern_glog) extern_glog)
set_target_properties(${NAME}_test PROPERTIES set_target_properties(${NAME}_test PROPERTIES
RUNTIME_OUTPUT_DIRECTORY "${TESTS_OUTPUT_DIR}" RUNTIME_OUTPUT_DIRECTORY "${TESTS_OUTPUT_DIR}"

View File

@@ -60,8 +60,7 @@ if(EXISTS ${SOURCE_DIR}/.git)
execute_process(COMMAND git log HEAD..@{u} execute_process(COMMAND git log HEAD..@{u}
WORKING_DIRECTORY ${SOURCE_DIR} WORKING_DIRECTORY ${SOURCE_DIR}
OUTPUT_VARIABLE _git_below_check OUTPUT_VARIABLE _git_below_check
OUTPUT_STRIP_TRAILING_WHITESPACE OUTPUT_STRIP_TRAILING_WHITESPACE)
ERROR_QUIET)
if(NOT _git_below_check STREQUAL "") if(NOT _git_below_check STREQUAL "")
# If there're commits between HEAD and upstream this means # If there're commits between HEAD and upstream this means
# that we're reset-ed to older revision. Use it's hash then. # that we're reset-ed to older revision. Use it's hash then.

View File

@@ -187,8 +187,6 @@ def cmake_get_src(f):
pass pass
elif new_file.endswith(".osl"): # open shading language elif new_file.endswith(".osl"): # open shading language
pass pass
elif new_file.endswith(".glsl"):
pass
else: else:
raise Exception("unknown file type - not c or h %s -> %s" % (f, new_file)) raise Exception("unknown file type - not c or h %s -> %s" % (f, new_file))
@@ -307,7 +305,7 @@ if UTF8_CHECK:
try: try:
for l in open(f, "r", encoding="utf8"): for l in open(f, "r", encoding="utf8"):
i += 1 i += 1
except UnicodeDecodeError: except:
print("Non utf8: %s:%d" % (f, i)) print("Non utf8: %s:%d" % (f, i))
if i > 1: if i > 1:
traceback.print_exc() traceback.print_exc()

View File

@@ -29,8 +29,7 @@ Example linux usage
Windows not supported so far Windows not supported so far
""" """
from project_info import ( from project_info import (SIMPLE_PROJECTFILE,
SIMPLE_PROJECTFILE,
SOURCE_DIR, SOURCE_DIR,
CMAKE_DIR, CMAKE_DIR,
PROJECT_DIR, PROJECT_DIR,

View File

@@ -22,16 +22,15 @@
# <pep8 compliant> # <pep8 compliant>
r""" """
Example Linux usage:
python ~/blender-git/blender/build_files/cmake/cmake_qtcreator_project.py ~/blender-git/cmake
Example Win32 usage: Example Win32 usage:
c:\Python32\python.exe c:\blender_dev\blender\build_files\cmake\cmake_qtcreator_project.py c:\blender_dev\cmake_build c:\Python32\python.exe c:\blender_dev\blender\build_files\cmake\cmake_qtcreator_project.py c:\blender_dev\cmake_build
example linux usage
python .~/blender-git/blender/build_files/cmake/cmake_qtcreator_project.py ~/blender-git/cmake
""" """
from project_info import ( from project_info import (SIMPLE_PROJECTFILE,
SIMPLE_PROJECTFILE,
SOURCE_DIR, SOURCE_DIR,
# CMAKE_DIR, # CMAKE_DIR,
PROJECT_DIR, PROJECT_DIR,
@@ -64,19 +63,18 @@ def create_qtc_project_main():
if SIMPLE_PROJECTFILE: if SIMPLE_PROJECTFILE:
# --- qtcreator specific, simple format # --- qtcreator specific, simple format
PROJECT_NAME = "Blender" PROJECT_NAME = "Blender"
FILE_NAME = PROJECT_NAME.lower() with open(os.path.join(PROJECT_DIR, "%s.files" % PROJECT_NAME), 'w') as f:
with open(os.path.join(PROJECT_DIR, "%s.files" % FILE_NAME), 'w') as f:
f.write("\n".join(files_rel)) f.write("\n".join(files_rel))
with open(os.path.join(PROJECT_DIR, "%s.includes" % FILE_NAME), 'w') as f: with open(os.path.join(PROJECT_DIR, "%s.includes" % PROJECT_NAME), 'w') as f:
f.write("\n".join(sorted(list(set(os.path.dirname(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) qtc_prj = os.path.join(PROJECT_DIR, "%s.creator" % PROJECT_NAME)
with open(qtc_prj, 'w') as f: with open(qtc_prj, 'w') as f:
f.write("[General]\n") f.write("[General]\n")
qtc_cfg = os.path.join(PROJECT_DIR, "%s.config" % FILE_NAME) qtc_cfg = os.path.join(PROJECT_DIR, "%s.config" % PROJECT_NAME)
if not os.path.exists(qtc_cfg): if not os.path.exists(qtc_cfg):
with open(qtc_cfg, 'w') as f: with open(qtc_cfg, 'w') as f:
f.write("// ADD PREDEFINED MACROS HERE!\n") f.write("// ADD PREDEFINED MACROS HERE!\n")

View File

@@ -118,19 +118,6 @@ macro(target_link_libraries_debug TARGET LIBS)
unset(_LIB) unset(_LIB)
endmacro() endmacro()
macro(target_link_libraries_decoupled target libraries_var)
if(NOT MSVC)
target_link_libraries(${target} ${${libraries_var}})
else()
# For MSVC we link to different libraries depending whether
# release or debug target is being built.
file_list_suffix(_libraries_debug "${${libraries_var}}" "_d")
target_link_libraries_debug(${target} "${_libraries_debug}")
target_link_libraries_optimized(${target} "${${libraries_var}}")
unset(_libraries_debug)
endif()
endmacro()
# Nicer makefiles with -I/1/foo/ instead of -I/1/2/3/../../foo/ # Nicer makefiles with -I/1/foo/ instead of -I/1/2/3/../../foo/
# use it instead of include_directories() # use it instead of include_directories()
macro(blender_include_dirs macro(blender_include_dirs
@@ -296,13 +283,8 @@ macro(setup_liblinks
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${PLATFORM_LINKFLAGS}") set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${PLATFORM_LINKFLAGS}")
set(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} ${PLATFORM_LINKFLAGS_DEBUG}") set(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} ${PLATFORM_LINKFLAGS_DEBUG}")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${PLATFORM_LINKFLAGS}")
set(CMAKE_SHARED_LINKER_FLAGS_DEBUG "${CMAKE_SHARED_LINKER_FLAGS_DEBUG} ${PLATFORM_LINKFLAGS_DEBUG}")
set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} ${PLATFORM_LINKFLAGS}")
set(CMAKE_MODULE_LINKER_FLAGS_DEBUG "${CMAKE_MODULE_LINKER_FLAGS_DEBUG} ${PLATFORM_LINKFLAGS_DEBUG}")
target_link_libraries(${target} target_link_libraries(${target}
${BLENDER_GL_LIBRARIES}
${PNG_LIBRARIES} ${PNG_LIBRARIES}
${ZLIB_LIBRARIES} ${ZLIB_LIBRARIES}
${FREETYPE_LIBRARY}) ${FREETYPE_LIBRARY})
@@ -321,9 +303,6 @@ macro(setup_liblinks
endif() endif()
endif() endif()
if(WITH_LZO AND WITH_SYSTEM_LZO)
target_link_libraries(${target} ${LZO_LIBRARIES})
endif()
if(WITH_SYSTEM_GLEW) if(WITH_SYSTEM_GLEW)
target_link_libraries(${target} ${BLENDER_GLEW_LIBRARIES}) target_link_libraries(${target} ${BLENDER_GLEW_LIBRARIES})
endif() endif()
@@ -357,9 +336,6 @@ macro(setup_liblinks
if(WITH_OPENCOLORIO) if(WITH_OPENCOLORIO)
target_link_libraries(${target} ${OPENCOLORIO_LIBRARIES}) target_link_libraries(${target} ${OPENCOLORIO_LIBRARIES})
endif() endif()
if(WITH_CYCLES_OSL)
target_link_libraries(${target} ${OSL_LIBRARIES})
endif()
if(WITH_BOOST) if(WITH_BOOST)
target_link_libraries(${target} ${BOOST_LIBRARIES}) target_link_libraries(${target} ${BOOST_LIBRARIES})
if(Boost_USE_STATIC_LIBS AND Boost_USE_ICU) if(Boost_USE_STATIC_LIBS AND Boost_USE_ICU)
@@ -381,6 +357,14 @@ macro(setup_liblinks
target_link_libraries(${target} ${OPENJPEG_LIBRARIES}) target_link_libraries(${target} ${OPENJPEG_LIBRARIES})
endif() endif()
if(WITH_CODEC_FFMPEG) if(WITH_CODEC_FFMPEG)
# Strange! Without this ffmpeg gives linking errors (on linux),
# even though it's linked above.
# XXX: Does FFMPEG depend on GLU?
if(WITH_GLU)
target_link_libraries(${target} ${OPENGL_glu_LIBRARY})
endif()
target_link_libraries(${target} ${FFMPEG_LIBRARIES}) target_link_libraries(${target} ${FFMPEG_LIBRARIES})
endif() endif()
if(WITH_OPENCOLLADA) if(WITH_OPENCOLLADA)
@@ -418,6 +402,9 @@ macro(setup_liblinks
if(WITH_MOD_CLOTH_ELTOPO) if(WITH_MOD_CLOTH_ELTOPO)
target_link_libraries(${target} ${LAPACK_LIBRARIES}) target_link_libraries(${target} ${LAPACK_LIBRARIES})
endif() endif()
if(WITH_CYCLES_OSL)
target_link_libraries(${target} ${OSL_LIBRARIES})
endif()
if(WITH_LLVM) if(WITH_LLVM)
target_link_libraries(${target} ${LLVM_LIBRARY}) target_link_libraries(${target} ${LLVM_LIBRARY})
endif() endif()
@@ -425,17 +412,13 @@ macro(setup_liblinks
target_link_libraries(${target} ${PTHREADS_LIBRARIES}) target_link_libraries(${target} ${PTHREADS_LIBRARIES})
endif() endif()
target_link_libraries(${target} ${PLATFORM_LINKLIBS} ${CMAKE_DL_LIBS})
# We put CLEW and CUEW here because OPENSUBDIV_LIBRARIES dpeends on them.. # We put CLEW and CUEW here because OPENSUBDIV_LIBRARIES dpeends on them..
if(WITH_CYCLES OR WITH_COMPOSITOR OR WITH_OPENSUBDIV) if(WITH_CYCLES OR WITH_COMPOSITOR OR WITH_OPENSUBDIV)
target_link_libraries(${target} "extern_clew") target_link_libraries(${target} "extern_clew")
target_link_libraries(${target} "extern_cuew") target_link_libraries(${target} "extern_cuew")
endif() endif()
#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})
endmacro() endmacro()
macro(SETUP_BLENDER_SORTED_LIBS) macro(SETUP_BLENDER_SORTED_LIBS)
@@ -517,7 +500,6 @@ macro(SETUP_BLENDER_SORTED_LIBS)
bf_modifiers bf_modifiers
bf_bmesh bf_bmesh
bf_blenkernel bf_blenkernel
bf_physics
bf_nodes bf_nodes
bf_rna bf_rna
bf_gpu bf_gpu
@@ -542,6 +524,7 @@ macro(SETUP_BLENDER_SORTED_LIBS)
ge_phys_dummy ge_phys_dummy
ge_phys_bullet ge_phys_bullet
bf_intern_smoke bf_intern_smoke
extern_minilzo
extern_lzma extern_lzma
extern_colamd extern_colamd
ge_logic_ketsji ge_logic_ketsji
@@ -595,10 +578,6 @@ macro(SETUP_BLENDER_SORTED_LIBS)
list(APPEND BLENDER_SORTED_LIBS extern_eltopo) list(APPEND BLENDER_SORTED_LIBS extern_eltopo)
endif() endif()
if(NOT WITH_SYSTEM_LZO)
list(APPEND BLENDER_SORTED_LIBS extern_minilzo)
endif()
if(NOT WITH_SYSTEM_GLEW) if(NOT WITH_SYSTEM_GLEW)
list(APPEND BLENDER_SORTED_LIBS ${BLENDER_GLEW_LIBRARIES}) list(APPEND BLENDER_SORTED_LIBS ${BLENDER_GLEW_LIBRARIES})
endif() endif()
@@ -931,7 +910,6 @@ macro(remove_strict_flags)
remove_cc_flag("-Wstrict-prototypes") remove_cc_flag("-Wstrict-prototypes")
remove_cc_flag("-Wmissing-prototypes") remove_cc_flag("-Wmissing-prototypes")
remove_cc_flag("-Wunused-parameter") remove_cc_flag("-Wunused-parameter")
remove_cc_flag("-Wunused-macros")
remove_cc_flag("-Wwrite-strings") remove_cc_flag("-Wwrite-strings")
remove_cc_flag("-Wredundant-decls") remove_cc_flag("-Wredundant-decls")
remove_cc_flag("-Wundef") remove_cc_flag("-Wundef")
@@ -961,20 +939,6 @@ macro(remove_strict_flags)
endmacro() endmacro()
macro(remove_extra_strict_flags)
if(CMAKE_COMPILER_IS_GNUCC)
remove_cc_flag("-Wunused-parameter")
endif()
if(CMAKE_C_COMPILER_ID MATCHES "Clang")
remove_cc_flag("-Wunused-parameter")
endif()
if(MSVC)
# TODO
endif()
endmacro()
# note, we can only append flags on a single file so we need to negate the options. # note, we can only append flags on a single file so we need to negate the options.
# at the moment we cant shut up ffmpeg deprecations, so use this, but will # at the moment we cant shut up ffmpeg deprecations, so use this, but will
# probably add more removals here. # probably add more removals here.
@@ -1036,15 +1000,6 @@ macro(ADD_CHECK_CXX_COMPILER_FLAG
endmacro() endmacro()
function(get_blender_version) function(get_blender_version)
# extracts header vars and defines them in the parent scope:
#
# - BLENDER_VERSION (major.minor)
# - BLENDER_VERSION_MAJOR
# - BLENDER_VERSION_MINOR
# - BLENDER_SUBVERSION (used for internal versioning mainly)
# - BLENDER_VERSION_CHAR (a, b, c, ...or empty string)
# - BLENDER_VERSION_CYCLE (alpha, beta, rc, release)
# So cmake depends on BKE_blender.h, beware of inf-loops! # So cmake depends on BKE_blender.h, beware of inf-loops!
CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/source/blender/blenkernel/BKE_blender.h CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/source/blender/blenkernel/BKE_blender.h
${CMAKE_BINARY_DIR}/source/blender/blenkernel/BKE_blender.h.done) ${CMAKE_BINARY_DIR}/source/blender/blenkernel/BKE_blender.h.done)
@@ -1077,28 +1032,25 @@ function(get_blender_version)
message(FATAL_ERROR "Version parsing failed for BLENDER_VERSION_CYCLE") message(FATAL_ERROR "Version parsing failed for BLENDER_VERSION_CYCLE")
endif() endif()
math(EXPR _out_version_major "${_out_version} / 100") math(EXPR BLENDER_VERSION_MAJOR "${_out_version} / 100")
math(EXPR _out_version_minor "${_out_version} % 100") math(EXPR BLENDER_VERSION_MINOR "${_out_version} % 100")
set(BLENDER_VERSION "${BLENDER_VERSION_MAJOR}.${BLENDER_VERSION_MINOR}" PARENT_SCOPE)
set(BLENDER_SUBVERSION ${_out_subversion} PARENT_SCOPE)
set(BLENDER_VERSION_CHAR ${_out_version_char} PARENT_SCOPE)
set(BLENDER_VERSION_CYCLE ${_out_version_cycle} PARENT_SCOPE)
# for packaging, alpha to numbers # for packaging, alpha to numbers
string(COMPARE EQUAL "${_out_version_char}" "" _out_version_char_empty) string(COMPARE EQUAL "${BLENDER_VERSION_CHAR}" "" _out_version_char_empty)
if(${_out_version_char_empty}) if(${_out_version_char_empty})
set(_out_version_char_index "0") set(BLENDER_VERSION_CHAR_INDEX "0" PARENT_SCOPE)
else() else()
set(_char_ls a b c d e f g h i j k l m n o p q r s t u v w x y z) set(_char_ls a b c d e f g h i j k l m n o p q r s t u v w x y z)
list(FIND _char_ls ${_out_version_char} _out_version_char_index) list(FIND _char_ls ${BLENDER_VERSION_CHAR} _out_version_char_index)
math(EXPR _out_version_char_index "${_out_version_char_index} + 1") math(EXPR BLENDER_VERSION_CHAR_INDEX "${_out_version_char_index} + 1" PARENT_SCOPE)
endif() endif()
# output vars # message(STATUS "Version (Internal): ${BLENDER_VERSION}.${BLENDER_SUBVERSION}, Version (external): ${BLENDER_VERSION}${BLENDER_VERSION_CHAR}-${BLENDER_VERSION_CYCLE}")
set(BLENDER_VERSION "${_out_version_major}.${_out_version_minor}" PARENT_SCOPE)
set(BLENDER_VERSION_MAJOR "${_out_version_major}" PARENT_SCOPE)
set(BLENDER_VERSION_MINOR "${_out_version_minor}" PARENT_SCOPE)
set(BLENDER_SUBVERSION "${_out_subversion}" PARENT_SCOPE)
set(BLENDER_VERSION_CHAR "${_out_version_char}" PARENT_SCOPE)
set(BLENDER_VERSION_CHAR_INDEX "${_out_version_char_index}" PARENT_SCOPE)
set(BLENDER_VERSION_CYCLE "${_out_version_cycle}" PARENT_SCOPE)
endfunction() endfunction()

View File

@@ -27,8 +27,7 @@ if(EXISTS ${CMAKE_SOURCE_DIR}/.git/)
execute_process(COMMAND git rev-parse --short @{u} execute_process(COMMAND git rev-parse --short @{u}
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
OUTPUT_VARIABLE MY_WC_HASH OUTPUT_VARIABLE MY_WC_HASH
OUTPUT_STRIP_TRAILING_WHITESPACE OUTPUT_STRIP_TRAILING_WHITESPACE)
ERROR_QUIET)
endif() endif()
endif() endif()
set(BUILD_REV ${MY_WC_HASH}) set(BUILD_REV ${MY_WC_HASH})

View File

@@ -1,4 +1,4 @@
#!/usr/bin/env python #!/usr/bin/python
# <pep8 compliant> # <pep8 compliant>

View File

@@ -144,7 +144,7 @@ BF_REDCODE_LIB = ''
BF_REDCODE_INC = '${BF_REDCODE}/../' #C files request "libredcode/format.h" which is in "#extern/libredcode/format.h", stupid but compiles for now. BF_REDCODE_INC = '${BF_REDCODE}/../' #C files request "libredcode/format.h" which is in "#extern/libredcode/format.h", stupid but compiles for now.
BF_REDCODE_LIBPATH='${BF_REDCODE}/lib' BF_REDCODE_LIBPATH='${BF_REDCODE}/lib'
# Mesa Libs should go here if you're using them as well.... # Mesa Libs should go here if your using them as well....
WITH_BF_STATICOPENGL = False WITH_BF_STATICOPENGL = False
BF_OPENGL = '/usr' BF_OPENGL = '/usr'
BF_OPENGL_INC = '${BF_OPENGL}/include' BF_OPENGL_INC = '${BF_OPENGL}/include'

View File

@@ -170,8 +170,6 @@ BF_BOOST_LIBPATH = '${BF_BOOST}/lib'
WITH_BF_RAYOPTIMIZATION = True WITH_BF_RAYOPTIMIZATION = True
BF_RAYOPTIMIZATION_SSE_FLAGS = ['-msse'] BF_RAYOPTIMIZATION_SSE_FLAGS = ['-msse']
WITH_BF_IME = True
WITH_BF_OPENMP = True WITH_BF_OPENMP = True
#CUDA #CUDA
@@ -198,10 +196,7 @@ C_WARN = ['-Wno-char-subscripts', '-Wdeclaration-after-statement', '-Wstrict-pro
CC_WARN = [ '-Wall' ] CC_WARN = [ '-Wall' ]
LLIBS = ['-lshell32', '-lshfolder', '-lgdi32', '-lmsvcrt', '-lwinmm', '-lmingw32', '-lm', '-lws2_32', '-lz', '-lstdc++','-lole32','-luuid', '-lwsock32', '-lpsapi', '-ldbghelp'] LLIBS = ['-lshell32', '-lshfolder', '-lgdi32', '-lmsvcrt', '-lwinmm', '-lmingw32', '-lm', '-lws2_32', '-lz', '-lstdc++','-lole32','-luuid', '-lwsock32', '-lpsapi', '-limm32']
if WITH_BF_IME:
LLIBS.append('-limm32')
PLATFORM_LINKFLAGS = ['-Xlinker', '--stack=2097152'] PLATFORM_LINKFLAGS = ['-Xlinker', '--stack=2097152']

View File

@@ -33,7 +33,7 @@ WITH_BF_PYTHON_INSTALL_NUMPY = True
WITH_BF_OPENAL = True WITH_BF_OPENAL = True
BF_OPENAL = LIBDIR + '/openal' BF_OPENAL = LIBDIR + '/openal'
BF_OPENAL_INC = '${BF_OPENAL}/include ' BF_OPENAL_INC = '${BF_OPENAL}/include '
BF_OPENAL_LIB = 'OpenAL32' BF_OPENAL_LIB = 'wrap_oal'
BF_OPENAL_LIBPATH = '${BF_OPENAL}/lib' BF_OPENAL_LIBPATH = '${BF_OPENAL}/lib'
WITH_BF_ICONV = True WITH_BF_ICONV = True
@@ -69,7 +69,7 @@ WITH_BF_OPENEXR = True
WITH_BF_STATICOPENEXR = False WITH_BF_STATICOPENEXR = False
BF_OPENEXR = LIBDIR + '/openexr' BF_OPENEXR = LIBDIR + '/openexr'
BF_OPENEXR_INC = '${BF_OPENEXR}/include ${BF_OPENEXR}/include/OpenEXR ' BF_OPENEXR_INC = '${BF_OPENEXR}/include ${BF_OPENEXR}/include/OpenEXR '
BF_OPENEXR_LIB = ' Iex-2_2 Half IlmImf-2_2 Imath-2_2 IlmThread-2_2 ' BF_OPENEXR_LIB = ' Iex-2_1 Half IlmImf-2_1 Imath-2_1 IlmThread-2_1 '
BF_OPENEXR_LIBPATH = '${BF_OPENEXR}/lib' BF_OPENEXR_LIBPATH = '${BF_OPENEXR}/lib'
BF_OPENEXR_LIB_STATIC = '${BF_OPENEXR}/lib/libHalf.a ${BF_OPENEXR}/lib/libIlmImf.a ${BF_OPENEXR}/lib/libIex.a ${BF_OPENEXR}/lib/libImath.a ${BF_OPENEXR}/lib/libIlmThread.a' BF_OPENEXR_LIB_STATIC = '${BF_OPENEXR}/lib/libHalf.a ${BF_OPENEXR}/lib/libIlmImf.a ${BF_OPENEXR}/lib/libIex.a ${BF_OPENEXR}/lib/libImath.a ${BF_OPENEXR}/lib/libIlmThread.a'
@@ -151,8 +151,6 @@ BF_OPENCOLLADA_INC = '${BF_OPENCOLLADA}/include/opencollada'
BF_OPENCOLLADA_LIB = 'OpenCOLLADAStreamWriter OpenCOLLADASaxFrameworkLoader OpenCOLLADAFramework OpenCOLLADABaseUtils GeneratedSaxParser MathMLSolver xml pcre buffer ftoa' BF_OPENCOLLADA_LIB = 'OpenCOLLADAStreamWriter OpenCOLLADASaxFrameworkLoader OpenCOLLADAFramework OpenCOLLADABaseUtils GeneratedSaxParser MathMLSolver xml pcre buffer ftoa'
BF_OPENCOLLADA_LIBPATH = '${BF_OPENCOLLADA}/lib/opencollada' BF_OPENCOLLADA_LIBPATH = '${BF_OPENCOLLADA}/lib/opencollada'
WITH_BF_IME = True
WITH_BF_3DMOUSE = True WITH_BF_3DMOUSE = True
WITH_BF_OPENMP = True WITH_BF_OPENMP = True
@@ -237,10 +235,7 @@ C_WARN = []
CC_WARN = [] CC_WARN = []
CXX_WARN = [] CXX_WARN = []
LLIBS = ['ws2_32', 'vfw32', 'winmm', 'kernel32', 'user32', 'gdi32', 'comdlg32', 'advapi32', 'shfolder', 'shell32', 'ole32', 'oleaut32', 'uuid', 'psapi', 'Dbghelp'] LLIBS = ['ws2_32', 'vfw32', 'winmm', 'kernel32', 'user32', 'gdi32', 'comdlg32', 'advapi32', 'shfolder', 'shell32', 'ole32', 'oleaut32', 'uuid', 'psapi', 'imm32']
if WITH_BF_IME:
LLIBS.append('imm32')
PLATFORM_LINKFLAGS = ['/SUBSYSTEM:CONSOLE','/MACHINE:IX86','/STACK:2097152','/INCREMENTAL:NO', '/LARGEADDRESSAWARE', '/NODEFAULTLIB:msvcrt.lib', '/NODEFAULTLIB:msvcmrt.lib', '/NODEFAULTLIB:msvcurt.lib', '/NODEFAULTLIB:msvcrtd.lib'] PLATFORM_LINKFLAGS = ['/SUBSYSTEM:CONSOLE','/MACHINE:IX86','/STACK:2097152','/INCREMENTAL:NO', '/LARGEADDRESSAWARE', '/NODEFAULTLIB:msvcrt.lib', '/NODEFAULTLIB:msvcmrt.lib', '/NODEFAULTLIB:msvcurt.lib', '/NODEFAULTLIB:msvcrtd.lib']

View File

@@ -169,8 +169,6 @@ BF_BOOST_LIBPATH = '${BF_BOOST}/lib'
WITH_BF_RAYOPTIMIZATION = True WITH_BF_RAYOPTIMIZATION = True
BF_RAYOPTIMIZATION_SSE_FLAGS = ['-mmmx', '-msse', '-msse2'] BF_RAYOPTIMIZATION_SSE_FLAGS = ['-mmmx', '-msse', '-msse2']
WITH_BF_IME = True
WITH_BF_OPENMP = True WITH_BF_OPENMP = True
#Freestyle #Freestyle
@@ -188,15 +186,11 @@ REL_CFLAGS = []
REL_CXXFLAGS = [] REL_CXXFLAGS = []
REL_CCFLAGS = ['-O2', '-ftree-vectorize'] REL_CCFLAGS = ['-O2', '-ftree-vectorize']
# NOTE: C_WARN seems to get ignored - at least -Wno-char-subscripts doesn't work!
C_WARN = ['-Wno-char-subscripts', '-Wdeclaration-after-statement', '-Wstrict-prototypes'] C_WARN = ['-Wno-char-subscripts', '-Wdeclaration-after-statement', '-Wstrict-prototypes']
CC_WARN = [ '-Wall', '-Wno-char-subscripts' ] CC_WARN = [ '-Wall' ]
LLIBS = ['-lshell32', '-lshfolder', '-lgdi32', '-lmsvcrt', '-lwinmm', '-lmingw32', '-lm', '-lws2_32', '-lz', '-lstdc++','-lole32','-luuid', '-lwsock32', '-lpsapi', '-lpthread', '-ldbghelp'] LLIBS = ['-lshell32', '-lshfolder', '-lgdi32', '-lmsvcrt', '-lwinmm', '-lmingw32', '-lm', '-lws2_32', '-lz', '-lstdc++','-lole32','-luuid', '-lwsock32', '-lpsapi', '-lpthread', '-limm32']
if WITH_BF_IME:
LLIBS.append('-limm32')
PLATFORM_LINKFLAGS = ['-Xlinker', '--stack=2097152'] PLATFORM_LINKFLAGS = ['-Xlinker', '--stack=2097152']

View File

@@ -34,7 +34,7 @@ WITH_BF_PYTHON_INSTALL_NUMPY = True
WITH_BF_OPENAL = True WITH_BF_OPENAL = True
BF_OPENAL = LIBDIR + '/openal' BF_OPENAL = LIBDIR + '/openal'
BF_OPENAL_INC = '${BF_OPENAL}/include ' BF_OPENAL_INC = '${BF_OPENAL}/include '
BF_OPENAL_LIB = 'OpenAL32' BF_OPENAL_LIB = 'wrap_oal'
BF_OPENAL_LIBPATH = '${BF_OPENAL}/lib' BF_OPENAL_LIBPATH = '${BF_OPENAL}/lib'
WITH_BF_SNDFILE = True WITH_BF_SNDFILE = True
@@ -66,7 +66,7 @@ WITH_BF_OPENEXR = True
WITH_BF_STATICOPENEXR = False WITH_BF_STATICOPENEXR = False
BF_OPENEXR = LIBDIR + '/openexr' BF_OPENEXR = LIBDIR + '/openexr'
BF_OPENEXR_INC = '${BF_OPENEXR}/include ${BF_OPENEXR}/include/OpenEXR ' BF_OPENEXR_INC = '${BF_OPENEXR}/include ${BF_OPENEXR}/include/OpenEXR '
BF_OPENEXR_LIB = ' Iex-2_2 Half IlmImf-2_2 Imath-2_2 IlmThread-2_2 ' BF_OPENEXR_LIB = ' Iex-2_1 Half IlmImf-2_1 Imath-2_1 IlmThread-2_1 '
BF_OPENEXR_LIBPATH = '${BF_OPENEXR}/lib' BF_OPENEXR_LIBPATH = '${BF_OPENEXR}/lib'
BF_OPENEXR_LIB_STATIC = '${BF_OPENEXR}/lib/libHalf.a ${BF_OPENEXR}/lib/libIlmImf.a ${BF_OPENEXR}/lib/libIex.a ${BF_OPENEXR}/lib/libImath.a ${BF_OPENEXR}/lib/libIlmThread.a' BF_OPENEXR_LIB_STATIC = '${BF_OPENEXR}/lib/libHalf.a ${BF_OPENEXR}/lib/libIlmImf.a ${BF_OPENEXR}/lib/libIex.a ${BF_OPENEXR}/lib/libImath.a ${BF_OPENEXR}/lib/libIlmThread.a'
@@ -154,8 +154,6 @@ BF_OPENCOLLADA_INC = '${BF_OPENCOLLADA}/include/opencollada'
BF_OPENCOLLADA_LIB = 'OpenCOLLADAStreamWriter OpenCOLLADASaxFrameworkLoader OpenCOLLADAFramework OpenCOLLADABaseUtils GeneratedSaxParser MathMLSolver xml pcre buffer ftoa' BF_OPENCOLLADA_LIB = 'OpenCOLLADAStreamWriter OpenCOLLADASaxFrameworkLoader OpenCOLLADAFramework OpenCOLLADABaseUtils GeneratedSaxParser MathMLSolver xml pcre buffer ftoa'
BF_OPENCOLLADA_LIBPATH = '${BF_OPENCOLLADA}/lib/opencollada' BF_OPENCOLLADA_LIBPATH = '${BF_OPENCOLLADA}/lib/opencollada'
WITH_BF_IME = True
WITH_BF_3DMOUSE = True WITH_BF_3DMOUSE = True
WITH_BF_OPENMP = True WITH_BF_OPENMP = True
@@ -244,10 +242,7 @@ C_WARN = []
CC_WARN = [] CC_WARN = []
CXX_WARN = [] CXX_WARN = []
LLIBS = ['ws2_32', 'vfw32', 'winmm', 'kernel32', 'user32', 'gdi32', 'comdlg32', 'advapi32', 'shfolder', 'shell32', 'ole32', 'oleaut32', 'uuid', 'psapi', 'Dbghelp'] LLIBS = ['ws2_32', 'vfw32', 'winmm', 'kernel32', 'user32', 'gdi32', 'comdlg32', 'advapi32', 'shfolder', 'shell32', 'ole32', 'oleaut32', 'uuid', 'psapi', 'imm32']
if WITH_BF_IME:
LLIBS.append('imm32')
PLATFORM_LINKFLAGS = ['/SUBSYSTEM:CONSOLE','/MACHINE:X64','/STACK:2097152','/OPT:NOREF','/INCREMENTAL:NO', '/NODEFAULTLIB:msvcrt.lib', '/NODEFAULTLIB:msvcmrt.lib', '/NODEFAULTLIB:msvcurt.lib', '/NODEFAULTLIB:msvcrtd.lib'] PLATFORM_LINKFLAGS = ['/SUBSYSTEM:CONSOLE','/MACHINE:X64','/STACK:2097152','/OPT:NOREF','/INCREMENTAL:NO', '/NODEFAULTLIB:msvcrt.lib', '/NODEFAULTLIB:msvcmrt.lib', '/NODEFAULTLIB:msvcurt.lib', '/NODEFAULTLIB:msvcrtd.lib']

22
build_files/scons/tools/Blender.py Normal file → Executable file
View File

@@ -216,16 +216,16 @@ def setup_staticlibs(lenv):
if lenv['WITH_BF_STATICOCIO']: if lenv['WITH_BF_STATICOCIO']:
statlibs += Split(lenv['BF_OCIO_LIB_STATIC']) statlibs += Split(lenv['BF_OCIO_LIB_STATIC'])
if lenv['WITH_BF_CYCLES_OSL']:
libincs += Split(lenv['BF_OSL_LIBPATH'])
if lenv['WITH_BF_STATICOSL']:
statlibs += Split(lenv['BF_OSL_LIB_STATIC'])
if lenv['WITH_BF_BOOST']: if lenv['WITH_BF_BOOST']:
libincs += Split(lenv['BF_BOOST_LIBPATH']) libincs += Split(lenv['BF_BOOST_LIBPATH'])
if lenv['WITH_BF_STATICBOOST']: if lenv['WITH_BF_STATICBOOST']:
statlibs += Split(lenv['BF_BOOST_LIB_STATIC']) statlibs += Split(lenv['BF_BOOST_LIB_STATIC'])
if lenv['WITH_BF_CYCLES_OSL']:
libincs += Split(lenv['BF_OSL_LIBPATH'])
if lenv['WITH_BF_STATICOSL']:
statlibs += Split(lenv['BF_OSL_LIB_STATIC'])
if lenv['WITH_BF_LLVM']: if lenv['WITH_BF_LLVM']:
libincs += Split(lenv['BF_LLVM_LIBPATH']) libincs += Split(lenv['BF_LLVM_LIBPATH'])
if lenv['WITH_BF_STATICLLVM']: if lenv['WITH_BF_STATICLLVM']:
@@ -326,15 +326,15 @@ def setup_syslibs(lenv):
if not lenv['WITH_BF_STATIC3DMOUSE']: if not lenv['WITH_BF_STATIC3DMOUSE']:
syslibs += Split(lenv['BF_3DMOUSE_LIB']) syslibs += Split(lenv['BF_3DMOUSE_LIB'])
if lenv['WITH_BF_CYCLES_OSL'] and not lenv['WITH_BF_STATICOSL']:
syslibs += Split(lenv['BF_OSL_LIB'])
if lenv['WITH_BF_BOOST'] and not lenv['WITH_BF_STATICBOOST']: if lenv['WITH_BF_BOOST'] and not lenv['WITH_BF_STATICBOOST']:
syslibs += Split(lenv['BF_BOOST_LIB']) syslibs += Split(lenv['BF_BOOST_LIB'])
if lenv['WITH_BF_INTERNATIONAL']: if lenv['WITH_BF_INTERNATIONAL']:
syslibs += Split(lenv['BF_BOOST_LIB_INTERNATIONAL']) syslibs += Split(lenv['BF_BOOST_LIB_INTERNATIONAL'])
if lenv['WITH_BF_CYCLES_OSL'] and not lenv['WITH_BF_STATICOSL']:
syslibs += Split(lenv['BF_OSL_LIB'])
if lenv['WITH_BF_LLVM'] and not lenv['WITH_BF_STATICLLVM']: if lenv['WITH_BF_LLVM'] and not lenv['WITH_BF_STATICLLVM']:
syslibs += Split(lenv['BF_LLVM_LIB']) syslibs += Split(lenv['BF_LLVM_LIB'])
@@ -441,7 +441,7 @@ def buildinfo(lenv, build_type):
no_upstream = False no_upstream = False
try : try :
build_hash = btools.get_command_output(['git', 'rev-parse', '--short', '@{u}'], stderr=subprocess.STDOUT).strip() build_hash = btools.get_command_output(['git', 'rev-parse', '--short', '@{u}']).strip()
except subprocess.CalledProcessError: except subprocess.CalledProcessError:
# assume branch has no upstream configured # assume branch has no upstream configured
build_hash = btools.get_command_output(['git', 'rev-parse', '--short', 'HEAD']).strip() build_hash = btools.get_command_output(['git', 'rev-parse', '--short', 'HEAD']).strip()
@@ -654,7 +654,7 @@ def WinPyBundle(target=None, source=None, env=None):
# Extract Numpy # Extract Numpy
if env['WITH_BF_PYTHON_INSTALL_NUMPY']: if env['WITH_BF_PYTHON_INSTALL_NUMPY']:
py_tar = env.subst(env['LCGDIR']).lstrip("#") py_tar = env.subst(env['LCGDIR']).lstrip("#")
py_tar += '/release/python' + env['BF_PYTHON_VERSION'].replace('.','') + '_numpy_1.9.tar.gz' py_tar += '/release/python' + env['BF_PYTHON_VERSION'].replace('.','') + '_numpy_1.8.tar.gz'
py_target = env.subst(env['BF_INSTALLDIR']).lstrip("#") py_target = env.subst(env['BF_INSTALLDIR']).lstrip("#")
py_target = os.path.join(py_target, VERSION, 'python', 'lib', 'site-packages') py_target = os.path.join(py_target, VERSION, 'python', 'lib', 'site-packages')
@@ -762,7 +762,7 @@ def AppIt(target=None, source=None, env=None):
commands.getoutput(cmd) commands.getoutput(cmd)
cmd = 'cp -R %s/kernel/*.h %s/kernel/*.cl %s/kernel/*.cu %s/kernel/' % (croot, croot, croot, cinstalldir) cmd = 'cp -R %s/kernel/*.h %s/kernel/*.cl %s/kernel/*.cu %s/kernel/' % (croot, croot, croot, cinstalldir)
commands.getoutput(cmd) commands.getoutput(cmd)
cmd = 'cp -R %s/kernel/svm %s/kernel/closure %s/kernel/geom %s/util/util_color.h %s/util/util_half.h %s/util/util_math.h %s/util/util_math_fast.h %s/util/util_transform.h %s/util/util_types.h %s/kernel/' % (croot, croot, croot, croot, croot, croot, croot, croot, croot, cinstalldir) cmd = 'cp -R %s/kernel/svm %s/kernel/closure %s/kernel/geom %s/util/util_color.h %s/util/util_half.h %s/util/util_math.h %s/util/util_transform.h %s/util/util_types.h %s/kernel/' % (croot, croot, croot, croot, croot, croot, croot, croot, cinstalldir)
commands.getoutput(cmd) commands.getoutput(cmd)
cmd = 'cp -R %s/../intern/cycles/kernel/*.cubin %s/lib/' % (builddir, cinstalldir) cmd = 'cp -R %s/../intern/cycles/kernel/*.cubin %s/lib/' % (builddir, cinstalldir)
commands.getoutput(cmd) commands.getoutput(cmd)

View File

@@ -174,7 +174,6 @@ def validate_arguments(args, bc):
'WITH_BF_CXX_GUARDEDALLOC', 'WITH_BF_CXX_GUARDEDALLOC',
'WITH_BF_JEMALLOC', 'WITH_BF_STATICJEMALLOC', 'BF_JEMALLOC', 'BF_JEMALLOC_INC', 'BF_JEMALLOC_LIBPATH', 'BF_JEMALLOC_LIB', 'BF_JEMALLOC_LIB_STATIC', 'WITH_BF_JEMALLOC', 'WITH_BF_STATICJEMALLOC', 'BF_JEMALLOC', 'BF_JEMALLOC_INC', 'BF_JEMALLOC_LIBPATH', 'BF_JEMALLOC_LIB', 'BF_JEMALLOC_LIB_STATIC',
'BUILDBOT_BRANCH', 'BUILDBOT_BRANCH',
'WITH_BF_IME',
'WITH_BF_3DMOUSE', 'WITH_BF_STATIC3DMOUSE', 'BF_3DMOUSE', 'BF_3DMOUSE_INC', 'BF_3DMOUSE_LIB', 'BF_3DMOUSE_LIBPATH', 'BF_3DMOUSE_LIB_STATIC', 'WITH_BF_3DMOUSE', 'WITH_BF_STATIC3DMOUSE', 'BF_3DMOUSE', 'BF_3DMOUSE_INC', 'BF_3DMOUSE_LIB', 'BF_3DMOUSE_LIBPATH', 'BF_3DMOUSE_LIB_STATIC',
'WITH_BF_CYCLES', 'WITH_BF_CYCLES_CUDA_BINARIES', 'BF_CYCLES_CUDA_NVCC', 'BF_CYCLES_CUDA_NVCC', 'WITH_BF_CYCLES_CUDA_THREADED_COMPILE', 'BF_CYCLES_CUDA_ENV', 'WITH_BF_CYCLES', 'WITH_BF_CYCLES_CUDA_BINARIES', 'BF_CYCLES_CUDA_NVCC', 'BF_CYCLES_CUDA_NVCC', 'WITH_BF_CYCLES_CUDA_THREADED_COMPILE', 'BF_CYCLES_CUDA_ENV',
'WITH_BF_OIIO', 'WITH_BF_STATICOIIO', 'BF_OIIO', 'BF_OIIO_INC', 'BF_OIIO_LIB', 'BF_OIIO_LIB_STATIC', 'BF_OIIO_LIBPATH', 'WITH_BF_OIIO', 'WITH_BF_STATICOIIO', 'BF_OIIO', 'BF_OIIO_INC', 'BF_OIIO_LIB', 'BF_OIIO_LIB_STATIC', 'BF_OIIO_LIBPATH',
@@ -198,8 +197,7 @@ def validate_arguments(args, bc):
'C_WARN', 'CC_WARN', 'CXX_WARN', 'C_WARN', 'CC_WARN', 'CXX_WARN',
'LLIBS', 'PLATFORM_LINKFLAGS', 'MACOSX_ARCHITECTURE', 'MACOSX_SDK', 'XCODE_CUR_VER', 'C_COMPILER_ID', 'LLIBS', 'PLATFORM_LINKFLAGS', 'MACOSX_ARCHITECTURE', 'MACOSX_SDK', 'XCODE_CUR_VER', 'C_COMPILER_ID',
'BF_CYCLES_CUDA_BINARIES_ARCH', 'BF_PROGRAM_LINKFLAGS', 'MACOSX_DEPLOYMENT_TARGET', 'BF_CYCLES_CUDA_BINARIES_ARCH', 'BF_PROGRAM_LINKFLAGS', 'MACOSX_DEPLOYMENT_TARGET',
'WITH_BF_CYCLES_DEBUG', 'WITH_BF_CYCLES_LOGGING', 'WITH_BF_CYCLES_DEBUG', 'WITH_BF_CYCLES_LOGGING'
'WITH_BF_CPP11'
] ]
@@ -509,8 +507,6 @@ def read_opts(env, cfg, args):
(BoolVariable('WITH_BF_PLAYER', 'Build blenderplayer if true', False)), (BoolVariable('WITH_BF_PLAYER', 'Build blenderplayer if true', False)),
(BoolVariable('WITH_BF_NOBLENDER', 'Do not build blender if true', False)), (BoolVariable('WITH_BF_NOBLENDER', 'Do not build blender if true', False)),
(BoolVariable('WITH_BF_IME', 'Enable Input Method Editor (IME) for complex Asian character input', False)),
(BoolVariable('WITH_BF_3DMOUSE', 'Build blender with support of 3D mouses', False)), (BoolVariable('WITH_BF_3DMOUSE', 'Build blender with support of 3D mouses', False)),
(BoolVariable('WITH_BF_STATIC3DMOUSE', 'Staticly link to 3d mouse library', False)), (BoolVariable('WITH_BF_STATIC3DMOUSE', 'Staticly link to 3d mouse library', False)),
('BF_3DMOUSE', '3d mouse library base path', ''), ('BF_3DMOUSE', '3d mouse library base path', ''),
@@ -654,9 +650,7 @@ def read_opts(env, cfg, args):
('BF_LLVM_LIBPATH', 'LLVM library path', ''), ('BF_LLVM_LIBPATH', 'LLVM library path', ''),
('BF_LLVM_LIB_STATIC', 'LLVM static library', ''), ('BF_LLVM_LIB_STATIC', 'LLVM static library', ''),
('BF_PROGRAM_LINKFLAGS', 'Link flags applied only to final binaries (blender and blenderplayer, not makesrna/makesdna)', ''), ('BF_PROGRAM_LINKFLAGS', 'Link flags applied only to final binaries (blender and blenderplayer, not makesrna/makesdna)', '')
(BoolVariable('WITH_BF_CPP11', '"Build with C++11 standard enabled, for development use only!', False)),
) # end of opts.AddOptions() ) # end of opts.AddOptions()
return localopts return localopts

View File

@@ -25,16 +25,7 @@ TARBALL="blender-$VERSION.tar.gz"
cd "$blender_srcdir" cd "$blender_srcdir"
# not so nice, but works # not so nice, but works
FILTER_FILES_PY=\ FILTER_FILES_PY="import os, sys; [print(l[:-1]) for l in sys.stdin.readlines() if os.path.isfile(l[:-1])]"
"import os, sys; "\
"[print(l[:-1]) for l in sys.stdin.readlines() "\
"if os.path.isfile(l[:-1]) "\
"if os.path.basename(l[:-1]) not in {"\
"'.gitignore', "\
"'.gitmodules', "\
"'.arcconfig', "\
"}"\
"]"
# Build master list # Build master list
echo -n "Building manifest of files: \"$BASE_DIR/$MANIFEST\" ..." echo -n "Building manifest of files: \"$BASE_DIR/$MANIFEST\" ..."

View File

@@ -35,14 +35,13 @@
defaults. defaults.
Much of the actual functionality can be found in the python scripts Much of the actual functionality can be found in the python scripts
in the directory $BLENDERHOME/build_files/scons/tools, with in the directory $BLENDERHOME/tools, with Blender.py defining the
Blender.py defining the bulk of the functionality. btools.py has some bulk of the functionality. btools.py has some helper functions, and
helper functions, and bcolors.py is for the terminal bcolors.py is for the terminal colors. mstoolkit.py and crossmingw.py
colors. mstoolkit.py and crossmingw.py are modules which set up SCons are modules which set up SCons for the MS VC++ 2003 toolkit and
for the MS VC++ 2003 toolkit and the cross-compile toolset for the cross-compile toolset for compiling Windows binaries on Linux
compiling Windows binaries on Linux respectively. Note: the respectively. Note: the cross-compile doesn't work yet for Blender,
cross-compile doesn't work yet for Blender, but is added in but is added in preparation for having it work in the distant future.
preparation for having it work in the distant future.
BlenderEnvironment BlenderEnvironment
------------------ ------------------

View File

@@ -29,9 +29,9 @@
a scons-local installation, which can be found in the scons/ subdirectory. a scons-local installation, which can be found in the scons/ subdirectory.
This document uses the scons-local installation for its examples. This document uses the scons-local installation for its examples.
For build instructions, including dependencies, consult the appropriate Check from the page
section for your platform at http://www.blender.org/development/building-blender/getting-dependencies/
http://wiki.blender.org/index.php/Dev:Doc/Building_Blender. Note that for that you have all dependencies needed for building Blender. Note that for
windows many of these dependencies already come in the lib/windows module windows many of these dependencies already come in the lib/windows module
from CVS. from CVS.
@@ -53,13 +53,12 @@
from the command-line is given, then all libraries and binaries to from the command-line is given, then all libraries and binaries to
build are configured. build are configured.
The build uses BF_BUILDDIR to build into and BF_INSTALLDIR to finally copy The build uses BF_BUILDDIR to build into and BF_INSTALLDIR to
all needed files to get a proper setup. The BF_DOCDIR is used to generate finally copy all needed files to get a proper setup. The BF_DOCDIR is
Blender Python documentation files to. These variables have default values used to generate Blender Python documentation files to. These
for every platform in variables have default values for every platform in
$BLENDERHOME/build_files/scons/config/(platform)-config.py. See the next $BLENDERHOME/config/(platform)-config.py. After the build successfully
section of this document for how to customize these paths. After the build completes, you can find everything you need in BF_INSTALLDIR.
successfully completes, you can find everything you need in BF_INSTALLDIR.
If you want to create the installer package of Blender on Windows you'll If you want to create the installer package of Blender on Windows you'll
need to install nullsoft scriptable install system from http://nsis.sf.net. need to install nullsoft scriptable install system from http://nsis.sf.net.
@@ -73,8 +72,8 @@
--------------------- ---------------------
The default values for your platform can be found in the directory The default values for your platform can be found in the directory
$BLENDERHOME/build_files/scons/config. Your platform specific defaults are $BLENDERHOME/config. Your platform specific defaults are in
in (platform)-config.py, where platform is one of: (platform)-config.py, where platform is one of:
- linux, for machines running Linux - linux, for machines running Linux
- win32-vc, for Windows machines, compiling with a Microsoft compiler - win32-vc, for Windows machines, compiling with a Microsoft compiler
@@ -82,13 +81,12 @@
- darwin, for OS X machines - darwin, for OS X machines
(TBD: add cygwin, solaris and freebsd support) (TBD: add cygwin, solaris and freebsd support)
These files you will normally not change. If you need to override a These files you will normally not change. If you need to override
default value, make a file called $BLENDERHOME/user-config.py, and copy a default value, make a file called $BLENDERHOME/user-config.py, and copy
settings from the build_files/scons/config/(platform)-config.py that you settings from the config/(platform)-config.py that you want to change. Don't
want to change. Don't copy the entire file (unless explicitly stated in copy the entire file (unless explicitely stated in the configuration file),
the configuration file), because you may not get updated options you don't because you may not get updated options you don't change yourself, which may
change yourself, which may result in build errors. You should NEVER have result in build errors.
to modify $BLENDERHOME/build_files/scons/config/(platform)-config.py.
You can use BF_CONFIG argument to override the default user-config.py You can use BF_CONFIG argument to override the default user-config.py
check. This is just like the user-config.py, but just with another name: check. This is just like the user-config.py, but just with another name:
@@ -115,6 +113,11 @@
(unless you have overridden any of them in your (unless you have overridden any of them in your
$BLENDERHOME/user-config.py). $BLENDERHOME/user-config.py).
NOTE: The best way to avoid confusion is the
copy $BLENDERHOME/config/(platform)-config.py to
$BLENDERHOME/user-config.py. You should NEVER have to modify
$BLENDERHOME/config/(platform)-config.py
Configuring the output Configuring the output
---------------------- ----------------------

View File

@@ -34,7 +34,7 @@ PROJECT_NAME = Blender
# This could be handy for archiving the generated documentation or # This could be handy for archiving the generated documentation or
# if some version control system is used. # if some version control system is used.
PROJECT_NUMBER = "V2.7x" PROJECT_NUMBER = "V2.6x"
# Using the PROJECT_BRIEF tag one can provide an optional one line description # 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 # for a project that appears at the top of each page and should give viewer

View File

@@ -7,7 +7,7 @@
* These pages document the source code of blender. * These pages document the source code of blender.
* *
* \subsection implinks Important Links * \subsection implinks Important Links
* - <a href="http://developer.blender.org">developer.blender.org</a> with bug tracker * - <a href="http://projects.blender.org">projects.blender.org</a> with <a href="http://projects.blender.org/tracker/index.php?group_id=9&atid=498">bug tracker</a>
* - <a href="http://wiki.blender.org/index.php/Dev:Contents">Development documents</a> on our wiki. * - <a href="http://wiki.blender.org/index.php/Dev:Contents">Development documents</a> on our wiki.
* *
* \subsection blother Other * \subsection blother Other

View File

@@ -1,4 +1,4 @@
#!/usr/bin/env python #!/usr/bin/python
# ##### BEGIN GPL LICENSE BLOCK ##### # ##### BEGIN GPL LICENSE BLOCK #####
# #

View File

@@ -7,7 +7,7 @@ A mix-in parent class can be used to share common properties and
import bpy import bpy
class View3DPanel: class View3DPanel():
bl_space_type = 'VIEW_3D' bl_space_type = 'VIEW_3D'
bl_region_type = 'TOOLS' bl_region_type = 'TOOLS'

View File

@@ -21,12 +21,3 @@ print(quat_out)
print("%.2f, %.2f, %.2f" % tuple(math.degrees(a) for a in quat_out.to_euler())) print("%.2f, %.2f, %.2f" % tuple(math.degrees(a) for a in quat_out.to_euler()))
print("(%.2f, %.2f, %.2f), %.2f" % (quat_out.axis[:] + print("(%.2f, %.2f, %.2f), %.2f" % (quat_out.axis[:] +
(math.degrees(quat_out.angle), ))) (math.degrees(quat_out.angle), )))
# multiple rotations can be interpolated using the exponential map
quat_c = mathutils.Quaternion((1.0, 0.0, 0.0), math.radians(15.0))
exp_avg = (quat_a.to_exponential_map() +
quat_b.to_exponential_map() +
quat_c.to_exponential_map()) / 3.0
quat_avg = mathutils.Quaternion(exp_avg)
print("Average rotation:")
print(quat_avg)

View File

@@ -18,16 +18,16 @@ matrix = mathutils.Matrix()
# Comparison operators can be done on Vector classes: # Comparison operators can be done on Vector classes:
# (In)equality operators == and != test component values, e.g. 1,2,3 != 3,2,1 # greater and less then test vector length.
vec_a == vec_b
vec_a != vec_b
# Ordering operators >, >=, > and <= test vector length.
vec_a > vec_b vec_a > vec_b
vec_a >= vec_b vec_a >= vec_b
vec_a < vec_b vec_a < vec_b
vec_a <= vec_b vec_a <= vec_b
# ==, != test vector values e.g. 1,2,3 != 3,2,1 even if they are the same length
vec_a == vec_b
vec_a != vec_b
# Math can be performed on Vector classes # Math can be performed on Vector classes
vec_a + vec_b vec_a + vec_b

View File

@@ -8,13 +8,9 @@ Intro
.. module:: bge.render .. module:: bge.render
Example of using a :class:`bge.types.SCA_MouseSensor`, and two :class:`bge.types.KX_ObjectActuator` to implement MouseLook:
.. note::
This can also be achieved with the :class:`bge.types.KX_MouseActuator`.
.. code-block:: python .. code-block:: python
# Example Uses an L{SCA_MouseSensor}, and two L{KX_ObjectActuator}s to implement MouseLook::
# To use a mouse movement sensor "Mouse" and a # To use a mouse movement sensor "Mouse" and a
# motion actuator to mouse look: # motion actuator to mouse look:
import bge import bge
@@ -79,15 +75,6 @@ Constants
Enables adaptive vsync if supported. Adaptive vsync enables vsync if the framerate is above the monitors refresh rate. Otherwise, vsync is diabled if the framerate is too low. Enables adaptive vsync if supported. Adaptive vsync enables vsync if the framerate is above the monitors refresh rate. Otherwise, vsync is diabled if the framerate is too low.
.. data:: LEFT_EYE
Left eye being used during stereoscopic rendering.
.. data:: RIGHT_EYE
Right eye being used during stereoscopic rendering.
********* *********
Functions Functions
********* *********
@@ -125,19 +112,17 @@ Functions
.. function:: makeScreenshot(filename) .. function:: makeScreenshot(filename)
Writes an image file with the current displayed frame. Writes a screenshot to the given filename.
The image is written to *'filename'*. The path may be absolute (eg. "/home/foo/image") or relative when started with If filename starts with // the image will be saved relative to the current directory.
"//" (eg. "//image"). Note that absolute paths are not portable between platforms. If the filename contains # it will be replaced with the frame number.
If the filename contains a "#", it will be replaced by an incremental index so that screenshots can be taken multiple
times without overwriting the previous ones (eg. "image-#").
Settings for the image are taken from the render settings (file format and respective settings, gamma and colospace The standalone player saves .png files. It does not support color space conversion
conversion, etc). The image resolution matches the framebuffer, meaning, the window size and aspect ratio. or gamma correction.
When running from the standalone player, instead of the embedded player, only PNG files are supported. Additional
color conversions are also not supported. When run from Blender, makeScreenshot supports all Blender image file formats like PNG, TGA, Jpeg and OpenEXR.
Gamma, Colorspace conversion and Jpeg compression are taken from the Render settings panels.
:arg filename: path and name of the file to write
:type filename: string :type filename: string
@@ -163,11 +148,47 @@ Functions
.. function:: setBackgroundColor(rgba) .. function:: setBackgroundColor(rgba)
Sets the window background color. (Deprecated: use KX_WorldInfo.background_color) Sets the window background color.
:type rgba: list [r, g, b, a] :type rgba: list [r, g, b, a]
.. function:: setMistColor(rgb)
Sets the mist color.
:type rgb: list [r, g, b]
.. function:: setAmbientColor(rgb)
Sets the color of ambient light.
:type rgb: list [r, g, b]
.. function:: setMistStart(start)
Sets the mist start value. Objects further away than start will have mist applied to them.
:type start: float
.. function:: setMistEnd(end)
Sets the mist end value. Objects further away from this will be colored solid with
the color set by setMistColor().
:type end: float
.. function:: disableMist()
Disables mist.
.. note:: Set any of the mist properties to enable mist.
.. function:: setEyeSeparation(eyesep) .. function:: setEyeSeparation(eyesep)
Sets the eye separation for stereo mode. Usually Focal Length/30 provides a confortable value. Sets the eye separation for stereo mode. Usually Focal Length/30 provides a confortable value.
@@ -196,15 +217,6 @@ Functions
:rtype: float :rtype: float
.. function:: getStereoEye()
Gets the current stereoscopy eye being rendered.
This function is mainly used in a :class:`bge.types.KX_Scene.pre_draw` callback
function to customize the camera projection matrices for each
stereoscopic eye.
:rtype: LEFT_EYE, RIGHT_EYE
.. function:: setMaterialMode(mode) .. function:: setMaterialMode(mode)
Set the material mode to use for OpenGL rendering. Set the material mode to use for OpenGL rendering.

View File

@@ -37,7 +37,7 @@ base class --- :class:`PyObjectPlus`
The speed and direction the character is traveling in using world coordinates. This should be used instead of applyMovement() to properly move the character. The speed and direction the character is traveling in using world coordinates. This should be used instead of applyMovement() to properly move the character.
:type: Vector((x, y, z)) :type: list [x, y, z]
.. method:: jump() .. method:: jump()

View File

@@ -78,33 +78,6 @@ base class --- :class:`SCA_IObject`
The object must have a physics controller for the mass to be applied, otherwise the mass value will be returned as 0.0. The object must have a physics controller for the mass to be applied, otherwise the mass value will be returned as 0.0.
.. attribute:: isSuspendDynamics
The object's dynamic state (read-only).
:type: boolean
.. attribute:: linearDamping
The object's linear damping, also known as translational damping. Can be set simultaneously with angular damping using the :py:meth:`setDamping` method.
:type: float between 0 and 1 inclusive.
.. note::
The object must have a physics controller for the linear damping to be applied, otherwise the value will be returned as 0.0.
.. attribute:: angularDamping
The object's angular damping, also known as rotationation damping. Can be set simultaneously with linear damping using the :py:meth:`setDamping` method.
:type: float between 0 and 1 inclusive.
.. note::
The object must have a physics controller for the angular damping to be applied, otherwise the value will be returned as 0.0.
.. attribute:: linVelocityMin .. attribute:: linVelocityMin
Enforces the object keeps moving at a minimum velocity. Enforces the object keeps moving at a minimum velocity.
@@ -141,7 +114,7 @@ base class --- :class:`SCA_IObject`
the object's inertia vector in local coordinates. Read only. the object's inertia vector in local coordinates. Read only.
:type: Vector((ix, iy, iz)) :type: list [ix, iy, iz]
.. attribute:: parent .. attribute:: parent
@@ -151,58 +124,21 @@ base class --- :class:`SCA_IObject`
.. attribute:: groupMembers .. attribute:: groupMembers
Returns the list of group members if the object is a group object (dupli group instance), otherwise None is returned. Returns the list of group members if the object is a group object, otherwise None is returned.
:type: :class:`CListValue` of :class:`KX_GameObject` or None :type: :class:`CListValue` of :class:`KX_GameObject` or None
.. attribute:: groupObject .. attribute:: groupObject
Returns the group object (dupli group instance) that the object belongs to or None if the object is not part of a group. Returns the group object that the object belongs to or None if the object is not part of a group.
:type: :class:`KX_GameObject` or None :type: :class:`KX_GameObject` or None
.. attribute:: collisionCallbacks .. attribute:: collisionCallbacks
A list of functions to be called when a collision occurs. A list of callables to be run when a collision occurs.
:type: list of functions and/or methods :type: list
Callbacks should either accept one argument `(object)`, or three
arguments `(object, point, normal)`. For simplicity, per
colliding object only the first collision point is reported.
.. code-block:: python
# Function form
def callback_three(object, point, normal):
print('Hit by %r at %s with normal %s' % (object.name, point, normal))
def callback_one(object):
print('Hit by %r' % object.name)
def register_callback(controller):
controller.owner.collisionCallbacks.append(callback_three)
controller.owner.collisionCallbacks.append(callback_one)
# Method form
class YourGameEntity(bge.types.KX_GameObject):
def __init__(self, old_owner):
self.collisionCallbacks.append(self.on_collision_three)
self.collisionCallbacks.append(self.on_collision_one)
def on_collision_three(self, object, point, normal):
print('Hit by %r at %s with normal %s' % (object.name, point, normal))
def on_collision_one(self, object):
print('Hit by %r' % object.name)
.. note::
For backward compatibility, a callback with variable number of
arguments (using `*args`) will be passed only the `object`
argument. Only when there is more than one fixed argument (not
counting `self` for methods) will the three-argument form be
used.
.. attribute:: scene .. attribute:: scene
@@ -439,12 +375,6 @@ base class --- :class:`SCA_IObject`
:type: boolean :type: boolean
.. attribute:: currentLodLevel
The index of the level of detail (LOD) currently used by this object (read-only).
:type: int
.. method:: endObject() .. method:: endObject()
Delete this object, can be used in place of the EndObject Actuator. Delete this object, can be used in place of the EndObject Actuator.
@@ -566,7 +496,7 @@ base class --- :class:`SCA_IObject`
* True: you get the "local" velocity ie: relative to object orientation. * True: you get the "local" velocity ie: relative to object orientation.
:type local: boolean :type local: boolean
:return: the object's linear velocity. :return: the object's linear velocity.
:rtype: Vector((vx, vy, vz)) :rtype: list [vx, vy, vz]
.. method:: setLinearVelocity(velocity, local=False) .. method:: setLinearVelocity(velocity, local=False)
@@ -593,7 +523,7 @@ base class --- :class:`SCA_IObject`
* True: you get the "local" velocity ie: relative to object orientation. * True: you get the "local" velocity ie: relative to object orientation.
:type local: boolean :type local: boolean
:return: the object's angular velocity. :return: the object's angular velocity.
:rtype: Vector((vx, vy, vz)) :rtype: list [vx, vy, vz]
.. method:: setAngularVelocity(velocity, local=False) .. method:: setAngularVelocity(velocity, local=False)
@@ -617,7 +547,7 @@ base class --- :class:`SCA_IObject`
:arg point: optional point to return the velocity for, in local coordinates. :arg point: optional point to return the velocity for, in local coordinates.
:type point: 3D Vector :type point: 3D Vector
:return: the velocity at the specified point. :return: the velocity at the specified point.
:rtype: Vector((vx, vy, vz)) :rtype: list [vx, vy, vz]
.. method:: getReactionForce() .. method:: getReactionForce()
@@ -627,7 +557,7 @@ base class --- :class:`SCA_IObject`
This also includes impulses, eg from collisions. This also includes impulses, eg from collisions.
:return: the reaction force of this object. :return: the reaction force of this object.
:rtype: Vector((fx, fy, fz)) :rtype: list [fx, fy, fz]
.. note:: .. note::
@@ -650,15 +580,6 @@ base class --- :class:`SCA_IObject`
* True: you get the "local" impulse ie: relative to local coordinates with object orientation. * True: you get the "local" impulse ie: relative to local coordinates with object orientation.
:type local: boolean :type local: boolean
.. method:: setDamping(linear_damping, angular_damping)
Sets both the :py:attr:`linearDamping` and :py:attr:`angularDamping` simultaneously. This is more efficient than setting both properties individually.
:arg linear_damping: Linear ("translational") damping factor.
:type linear_damping: float ∈ [0, 1]
:arg angular_damping: Angular ("rotational") damping factor.
:type angular_damping: float ∈ [0, 1]
.. method:: suspendDynamics() .. method:: suspendDynamics()
Suspends physics for this object. Suspends physics for this object.

View File

@@ -15,7 +15,7 @@ base class --- :class:`SCA_IActuator`
The force applied by the actuator. The force applied by the actuator.
:type: Vector((x, y, z)) :type: list [x, y, z]
.. attribute:: useLocalForce .. attribute:: useLocalForce
@@ -27,7 +27,7 @@ base class --- :class:`SCA_IActuator`
The torque applied by the actuator. The torque applied by the actuator.
:type: Vector((x, y, z)) :type: list [x, y, z]
.. attribute:: useLocalTorque .. attribute:: useLocalTorque
@@ -39,7 +39,7 @@ base class --- :class:`SCA_IActuator`
The displacement vector applied by the actuator. The displacement vector applied by the actuator.
:type: Vector((x, y, z)) :type: list [x, y, z]
.. attribute:: useLocalDLoc .. attribute:: useLocalDLoc
@@ -51,7 +51,7 @@ base class --- :class:`SCA_IActuator`
The angular displacement vector applied by the actuator The angular displacement vector applied by the actuator
:type: Vector((x, y, z)) :type: list [x, y, z]
.. note:: .. note::
@@ -67,7 +67,7 @@ base class --- :class:`SCA_IActuator`
The linear velocity applied by the actuator. The linear velocity applied by the actuator.
:type: Vector((x, y, z)) :type: list [x, y, z]
.. attribute:: useLocalLinV .. attribute:: useLocalLinV
@@ -83,7 +83,7 @@ base class --- :class:`SCA_IActuator`
The angular velocity applied by the actuator. The angular velocity applied by the actuator.
:type: Vector((x, y, z)) :type: list [x, y, z]
.. attribute:: useLocalAngV .. attribute:: useLocalAngV

View File

@@ -83,12 +83,6 @@ base class --- :class:`PyObjectPlus`
This can be set directly from python to avoid using the :class:`KX_SceneActuator`. This can be set directly from python to avoid using the :class:`KX_SceneActuator`.
.. attribute:: world
The current active world, (read-only).
:type: :class:`KX_WorldInfo`
.. attribute:: suspended .. attribute:: suspended
True if the scene is suspended, (read-only). True if the scene is suspended, (read-only).
@@ -129,7 +123,7 @@ base class --- :class:`PyObjectPlus`
The scene gravity using the world x, y and z axis. The scene gravity using the world x, y and z axis.
:type: Vector((gx, gy, gz)) :type: list [fx, fy, fz]
.. method:: addObject(object, other, time=0) .. method:: addObject(object, other, time=0)

View File

@@ -11,25 +11,22 @@ base class --- :class:`PyObjectPlus`
TODO - description TODO - description
.. method:: addWheel(wheel, attachPos, downDir, axleDir, suspensionRestLength, wheelRadius, hasSteering) .. method:: addWheel(wheel, attachPos, attachDir, axleDir, suspensionRestLength, wheelRadius, hasSteering)
Add a wheel to the vehicle Add a wheel to the vehicle
:arg wheel: The object to use as a wheel. :arg wheel: The object to use as a wheel.
:type wheel: :class:`KX_GameObject` or a :class:`KX_GameObject` name :type wheel: :class:`KX_GameObject` or a KX_GameObject name
:arg attachPos: The position to attach the wheel, relative to the chassis object center. :arg attachPos: The position that this wheel will attach to.
:type attachPos: vector of 3 floats :type attachPos: vector of 3 floats
:arg downDir: The direction vector pointing down to where the vehicle should collide with the floor. :arg attachDir: The direction this wheel points.
:type downDir: vector of 3 floats :type attachDir: vector of 3 floats
:arg axleDir: The axis the wheel rotates around, relative to the chassis. :arg axleDir: The direction of this wheels axle.
:type axleDir: vector of 3 floats :type axleDir: vector of 3 floats
:arg suspensionRestLength: The length of the suspension when no forces are being applied. :arg suspensionRestLength: TODO - Description
:type suspensionRestLength: float :type suspensionRestLength: float
:arg wheelRadius: The radius of the wheel (half the diameter). :arg wheelRadius: The size of the wheel.
:type wheelRadius: float :type wheelRadius: float
:arg hasSteering: True if the wheel should turn with steering, typically used in front wheels.
:type hasSteering: boolean
.. method:: applyBraking(force, wheelIndex) .. method:: applyBraking(force, wheelIndex)
@@ -41,7 +38,6 @@ base class --- :class:`PyObjectPlus`
:arg wheelIndex: index of the wheel where the force needs to be applied :arg wheelIndex: index of the wheel where the force needs to be applied
:type wheelIndex: integer :type wheelIndex: integer
.. method:: applyEngineForce(force, wheelIndex) .. method:: applyEngineForce(force, wheelIndex)
Apply an engine force to the specified wheel Apply an engine force to the specified wheel
@@ -52,7 +48,6 @@ base class --- :class:`PyObjectPlus`
:arg wheelIndex: index of the wheel where the force needs to be applied :arg wheelIndex: index of the wheel where the force needs to be applied
:type wheelIndex: integer :type wheelIndex: integer
.. method:: getConstraintId() .. method:: getConstraintId()
Get the constraint ID Get the constraint ID

View File

@@ -17,25 +17,25 @@ base class --- :class:`SCA_IObject`
The position of the vertex. The position of the vertex.
:type: Vector((x, y, z)) :type: list [x, y, z]
.. attribute:: UV .. attribute:: UV
The texture coordinates of the vertex. The texture coordinates of the vertex.
:type: Vector((u, v)) :type: list [u, v]
.. attribute:: normal .. attribute:: normal
The normal of the vertex. The normal of the vertex.
:type: Vector((nx, ny, nz)) :type: list [nx, ny, nz]
.. attribute:: color .. attribute:: color
The color of the vertex. The color of the vertex.
:type: Vector((r, g, b, a)) :type: list [r, g, b, a]
Black = [0.0, 0.0, 0.0, 1.0], White = [1.0, 1.0, 1.0, 1.0] Black = [0.0, 0.0, 0.0, 1.0], White = [1.0, 1.0, 1.0, 1.0]
@@ -110,13 +110,13 @@ base class --- :class:`SCA_IObject`
Gets the position of this vertex. Gets the position of this vertex.
:return: this vertexes position in local coordinates. :return: this vertexes position in local coordinates.
:rtype: Vector((x, y, z)) :rtype: list [x, y, z]
.. method:: setXYZ(pos) .. method:: setXYZ(pos)
Sets the position of this vertex. Sets the position of this vertex.
:type: Vector((x, y, z)) :type: list [x, y, z]
:arg pos: the new position for this vertex in local coordinates. :arg pos: the new position for this vertex in local coordinates.
@@ -125,26 +125,26 @@ base class --- :class:`SCA_IObject`
Gets the UV (texture) coordinates of this vertex. Gets the UV (texture) coordinates of this vertex.
:return: this vertexes UV (texture) coordinates. :return: this vertexes UV (texture) coordinates.
:rtype: Vector((u, v)) :rtype: list [u, v]
.. method:: setUV(uv) .. method:: setUV(uv)
Sets the UV (texture) coordinates of this vertex. Sets the UV (texture) coordinates of this vertex.
:type: Vector((u, v)) :type: list [u, v]
.. method:: getUV2() .. method:: getUV2()
Gets the 2nd UV (texture) coordinates of this vertex. Gets the 2nd UV (texture) coordinates of this vertex.
:return: this vertexes UV (texture) coordinates. :return: this vertexes UV (texture) coordinates.
:rtype: Vector((u, v)) :rtype: list [u, v]
.. method:: setUV2(uv, unit) .. method:: setUV2(uv, unit)
Sets the 2nd UV (texture) coordinates of this vertex. Sets the 2nd UV (texture) coordinates of this vertex.
:type: Vector((u, v)) :type: list [u, v]
:arg unit: optional argument, FLAT==1, SECOND_UV==2, defaults to SECOND_UV :arg unit: optional argument, FLAT==1, SECOND_UV==2, defaults to SECOND_UV
:arg unit: integer :arg unit: integer
@@ -197,7 +197,7 @@ base class --- :class:`SCA_IObject`
Gets the normal vector of this vertex. Gets the normal vector of this vertex.
:return: normalized normal vector. :return: normalized normal vector.
:rtype: Vector((nx, ny, nz)) :rtype: list [nx, ny, nz]
.. method:: setNormal(normal) .. method:: setNormal(normal)

View File

@@ -1,87 +0,0 @@
KX_WordlInfo(PyObjectPlus)
=============================
.. module:: bge.types
base class --- :class:`PyObjectPlus`
.. class:: KX_WorldInfo(PyObjectPlus)
A wolrd object.
.. code-block:: python
# Set the mist color to red.
import bge
sce = bge.logic.getCurrentScene()
sce.world.mist_color = [1.0, 0.0, 0.0]
*********
Constants
*********
.. data:: KX_MIST_QUADRATIC
Type of quadratic attenuation used to fade mist.
.. data:: KX_MIST_LINEAR
Type of linear attenuation used to fade mist.
.. data:: KX_MIST_INV_QUADRATIC
Type of inverse quadratic attenuation used to fade mist.
**********
Attributes
**********
.. attribute:: mist_enable
Return the state of the mist.
:type: bool
.. attribute:: mist_start
The mist start point.
:type: float
.. attribute:: mist_distance
The mist distance fom the start point to reach 100% mist.
:type: float
.. attribute:: mist_intensity
The mist intensity.
:type: float
.. attribute:: mist_type
The type of mist - must be KX_MIST_QUADRATIC, KX_MIST_LINEAR or KX_MIST_INV_QUADRATIC
.. attribute:: mist_color
The color of the mist. Black = [0.0, 0.0, 0.0], White = [1.0, 1.0, 1.0].
Mist and background color sould always set to the same color.
:type: :class:`mathutils.Vector`
.. attribute:: background_color
The color of the background. Black = [0.0, 0.0, 0.0], White = [1.0, 1.0, 1.0].
Mist and background color sould always set to the same color.
:type: :class:`mathutils.Vector`
.. attribute:: ambient_color
The color of the ambient light. Black = [0.0, 0.0, 0.0], White = [1.0, 1.0, 1.0].
:type: :class:`mathutils.Vector`

View File

@@ -25,7 +25,7 @@ base class --- :class:`PyObjectPlus`
The normalized x and y position of the mouse cursor. The normalized x and y position of the mouse cursor.
:type: tuple (x, y) :type: list [x, y]
.. attribute:: visible .. attribute:: visible

View File

@@ -8,17 +8,19 @@ This module wraps OpenGL constants and functions, making them available from
within Blender Python. within Blender Python.
The complete list can be retrieved from the module itself, by listing its The complete list can be retrieved from the module itself, by listing its
contents: dir(bgl). A simple search on the web can point to more contents: dir(bgl). A simple search on the net can point to more
than enough material to teach OpenGL programming, from books to many than enough material to teach OpenGL programming, from books to many
collections of tutorials. collections of tutorials.
Here is a comprehensive `list of books <http://www.opengl.org/documentation/books/>`_ (non free). The `arcsynthesis tutorials <http://www.arcsynthesis.org/gltut/>`_ is one of the best resources to learn modern OpenGL and `g-truc <http://www.g-truc.net/post-tech-content-sample.html>`_ offers a set of extensive examples, including advanced features. The "red book": "I{OpenGL Programming Guide: The Official Guide to Learning
OpenGL}" and the online NeHe tutorials are two of the best resources.
.. note:: .. note::
You can use the :class:`Image` type to load and set textures. You can use the :class:`Image` type to load and set textures.
See :class:`Image.gl_load` and :class:`Image.gl_load`, See :class:`Image.gl_load` and :class:`Image.gl_load`,
for example. for example.
`OpenGL.org <http://www.opengl.org>`_
`NeHe GameDev <http://nehe.gamedev.net>`_
.. function:: glAccum(op, value): .. function:: glAccum(op, value):

View File

@@ -11,22 +11,32 @@ This API is generally stable but some areas are still being added and improved.
The Blender/Python API can do the following: The Blender/Python API can do the following:
- Edit any data the user interface can (Scenes, Meshes, Particles etc.) * Edit any data the user interface can (Scenes, Meshes, Particles etc.)
- Modify user preferences, keymaps and themes
- Run tools with own settings * Modify user preferences, keymaps and themes
- Create user interface elements such as menus, headers and panels
- Create new tools * Run tools with own settings
- Create interactive tools
- Create new rendering engines that integrate with Blender * Create user interface elements such as menus, headers and panels
- Define new settings in existing Blender data
- Draw in the 3D view using OpenGL commands from Python * Create new tools
* Create interactive tools
* Create new rendering engines that integrate with Blender
* Define new settings in existing Blender data
* Draw in the 3D view using OpenGL commands from Python
The Blender/Python API **can't** (yet)... The Blender/Python API **can't** (yet)...
- Create new space types. * Create new space types.
- Assign custom properties to every type.
- Define callbacks or listeners to be notified when data is changed. * Assign custom properties to every type.
* Define callbacks or listeners to be notified when data is changed.
Before Starting Before Starting
@@ -37,21 +47,23 @@ This document isn't intended to fully cover each topic. Rather, its purpose is t
A quick list of helpful things to know before starting: A quick list of helpful things to know before starting:
- Blender uses Python 3.x; some online documentation still assumes 2.x. * Blender uses Python 3.x; some 3rd party extensions are not available yet.
- The interactive console is great for testing one-liners, It also has autocompletion so you can inspect the API quickly.
- Button tool tips show Python attributes and operator names.
- Right clicking on buttons and menu items directly links to API documentation.
- For more examples, the text menu has a templates section where some example operators can be found.
- To examine further scripts distributed with Blender, see:
| ``~/.blender/scripts/startup/bl_ui`` for the user interface, * The interactive console is great for testing one-liners, It also has autocompletion so you can inspect the api quickly.
| ``~/.blender/scripts/startup/bl_op`` for operators.
* Button tool tips show Python attributes and operator names.
* Right clicking on buttons and menu items directly links to API documentation.
* For more examples, the text menu has a templates section where some example operators can be found.
* To examine further scripts distributed with Blender, see ``~/.blender/scripts/startup/bl_ui`` for the user interface and ``~/.blender/scripts/startup/bl_op`` for operators.
Running Scripts Running Scripts
--------------- ---------------
The two most common ways to execute Python scripts are using the built-in text editor or entering commands in the Python console. The two most common ways to execute python scripts are using the built-in text editor or entering commands in the python console.
Both the **Text Editor** and **Python Console** are space types you can select from the view header. Both the **Text Editor** and **Python Console** are space types you can select from the view header.
@@ -70,7 +82,7 @@ Key Concepts
Data Access Data Access
----------- -----------
Accessing DataBlocks Accessing datablocks
^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^
Python accesses Blender's data in the same way as the animation system and user interface; this implies that any setting that can be changed via a button can also be changed from Python. Python accesses Blender's data in the same way as the animation system and user interface; this implies that any setting that can be changed via a button can also be changed from Python.
@@ -104,7 +116,7 @@ Unlike Python's dictionaries, both methods are acceptable; however, the index of
bpy.data.objects["Cube"] bpy.data.objects["Cube"]
Accessing Attributes Accessing attributes
^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^
Once you have a data block, such as a material, object, groups etc., its attributes can be accessed much like you would change a setting using the graphical interface. In fact, the tooltip for each button also displays the Python attribute which can help in finding what settings to change in a script. Once you have a data block, such as a material, object, groups etc., its attributes can be accessed much like you would change a setting using the graphical interface. In fact, the tooltip for each button also displays the Python attribute which can help in finding what settings to change in a script.
@@ -132,7 +144,7 @@ Example of a data path that can be quickly found via the console:
Data Creation/Removal Data Creation/Removal
^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^
Those of you familiar with other Python API's may be surprised that new datablocks in the bpy API can't be created by calling the class: Those of you familiar with other python api's may be surprised that new datablocks in the bpy api can't be created by calling the class:
>>> bpy.types.Mesh() >>> bpy.types.Mesh()
Traceback (most recent call last): Traceback (most recent call last):
@@ -141,9 +153,9 @@ Those of you familiar with other Python API's may be surprised that new databloc
This is an intentional part of the API design. This is an intentional part of the API design.
The Blender/Python API can't create Blender data that exists outside the main Blender database (accessed through :mod:`bpy.data`), because this data is managed by Blender (save/load/undo/append... etc). The blender/python api can't create blender data that exists outside the main blender database (accessed through bpy.data), because this data is managed by blender (save/load/undo/append... etc).
Data is added and removed via methods on the collections in :mod:`bpy.data`, eg: Data is added and removed via methods on the collections in bpy.data, eg:
>>> mesh = bpy.data.meshes.new(name="MyMesh") >>> mesh = bpy.data.meshes.new(name="MyMesh")
>>> print(mesh) >>> print(mesh)
@@ -155,8 +167,7 @@ Data is added and removed via methods on the collections in :mod:`bpy.data`, eg:
Custom Properties Custom Properties
^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^
Python can access properties on any datablock that has an ID (data that can be linked in and accessed from :mod:`bpy.data`. Python can access properties on any datablock that has an ID (data that can be linked in and accessed from :mod:`bpy.data`. When assigning a property, you can make up your own names, these will be created when needed or overwritten if they exist.
When assigning a property, you can make up your own names, these will be created when needed or overwritten if they exist.
This data is saved with the blend file and copied with objects. This data is saved with the blend file and copied with objects.
@@ -169,7 +180,7 @@ Example:
if "SomeProp" in bpy.context.object: if "SomeProp" in bpy.context.object:
print("Property found") print("Property found")
# Use the get function like a Python dictionary # Use the get function like a python dictionary
# which can have a fallback value. # which can have a fallback value.
value = bpy.data.scenes["Scene"].get("test_prop", "fallback value") value = bpy.data.scenes["Scene"].get("test_prop", "fallback value")
@@ -182,9 +193,11 @@ Example:
Note that these properties can only be assigned basic Python types. Note that these properties can only be assigned basic Python types.
- int, float, string * int, float, string
- array of ints/floats
- dictionary (only string keys are supported, values must be basic types too) * array of ints/floats
* dictionary (only string keys are supported, values must be basic types too)
These properties are valid outside of Python. They can be animated by curves or used in driver paths. These properties are valid outside of Python. They can be animated by curves or used in driver paths.
@@ -192,8 +205,7 @@ These properties are valid outside of Python. They can be animated by curves or
Context Context
------- -------
While it's useful to be able to access data directly by name or as a list, it's more common to operate on the user's selection. While it's useful to be able to access data directly by name or as a list, it's more common to operate on the user's selection. The context is always available from '''bpy.context''' and can be used to get the active object, scene, tool settings along with many other attributes.
The context is always available from ``bpy.context`` and can be used to get the active object, scene, tool settings along with many other attributes.
Common-use cases: Common-use cases:
@@ -208,10 +220,9 @@ So ``bpy.context.object = obj`` will raise an error.
But ``bpy.context.scene.objects.active = obj`` will work as expected. But ``bpy.context.scene.objects.active = obj`` will work as expected.
The context attributes change depending on where they are accessed. The context attributes change depending on where they are accessed. The 3D view has different context members than the console, so take care when accessing context attributes that the user state is known.
The 3D view has different context members than the console, so take care when accessing context attributes that the user state is known.
See :mod:`bpy.context` API reference. See :mod:`bpy.context` API reference
Operators (Tools) Operators (Tools)
@@ -230,17 +241,16 @@ Examples:
.. note:: .. note::
The menu item: :menuselection:`Help --> Operator Cheat Sheet` gives a list of all operators and their default values in Python syntax, along with the generated docs. The menu item: Help -> Operator Cheat Sheet" gives a list of all operators and their default values in Python syntax, along with the generated docs. This is a good way to get an overview of all blender's operators.
This is a good way to get an overview of all Blender's operators.
Operator Poll() Operator Poll()
^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^
Many operators have a "poll" function which may check that the mouse is in a valid area or that the object is in the correct mode (Edit Mode, Weight Paint etc). Many operators have a "poll" function which may check that the mouse is in a valid area or that the object is in the correct mode (Edit Mode, Weight Paint etc).
When an operator's poll function fails within Python, an exception is raised. When an operator's poll function fails within python, an exception is raised.
For example, calling ``bpy.ops.view3d.render_border()`` from the console raises the following error: For example, calling bpy.ops.view3d.render_border() from the console raises the following error:
.. code-block:: python .. code-block:: python
@@ -261,10 +271,13 @@ Integration
Python scripts can integrate with Blender in the following ways: Python scripts can integrate with Blender in the following ways:
- By defining a rendering engine. * By defining a rendering engine.
- By defining operators.
- By defining menus, headers and panels. * By defining operators.
- By inserting new buttons into existing menus, headers and panels
* By defining menus, headers and panels.
* By inserting new buttons into existing menus, headers and panels
In Python, this is done by defining a class, which is a subclass of an existing type. In Python, this is done by defining a class, which is a subclass of an existing type.
@@ -279,17 +292,24 @@ Once this script runs, ``SimpleOperator`` is registered with Blender and can be
To run the script: To run the script:
#. Highlight the above code then press :kbd:`Ctrl-C` to copy it. #. Highlight the above code then press Ctrl+C to copy it.
#. Start Blender #. Start Blender
#. Press :kbd:`Ctrl-Right` twice to change to the Scripting layout.
#. Press Ctrl+Right twice to change to the Scripting layout.
#. Click the button labeled ``New`` and the confirmation pop up in order to create a new text block. #. Click the button labeled ``New`` and the confirmation pop up in order to create a new text block.
#. Press :kbd:`Ctrl-V` to paste the code into the text panel (the upper left frame).
#. Press Ctrl+V to paste the code into the text panel (the upper left frame).
#. Click on the button **Run Script**. #. Click on the button **Run Script**.
#. Move your mouse into the 3D view, press spacebar for the operator search menu, and type "Simple". #. Move your mouse into the 3D view, press spacebar for the operator search menu, and type "Simple".
#. Click on the "Simple Operator" item found in search. #. Click on the "Simple Operator" item found in search.
.. seealso:: The class members with the ``bl_`` prefix are documented in the API .. seealso:: The class members with the **bl_** prefix are documented in the API
reference :class:`bpy.types.Operator` reference :class:`bpy.types.Operator`
.. note:: The output from the ``main`` function is sent to the terminal; in order to see this, be sure to :ref:`use the terminal <use_the_terminal>`. .. note:: The output from the ``main`` function is sent to the terminal; in order to see this, be sure to :ref:`use the terminal <use_the_terminal>`.
@@ -297,25 +317,33 @@ To run the script:
Example Panel Example Panel
------------- -------------
Panels register themselves as a class, like an operator. Notice the extra ``bl_`` variables used to set the context they display in. 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: To run the script:
#. Highlight the above code then press :kbd:`Ctrl-C` to copy it #. Highlight the above code then press Ctrl+C to copy it
#. Start Blender #. Start Blender
#. Press :kbd:`Ctrl-Right` twice to change to the Scripting layout
#. Press Ctrl+Right twice to change to the Scripting layout
#. Click the button labeled ``New`` and the confirmation pop up in order to create a new text block. #. Click the button labeled ``New`` and the confirmation pop up in order to create a new text block.
#. Press :kbd:`Ctrl-V` to paste the code into the text panel (the upper left frame)
#. Press Ctrl+V to paste the code into the text panel (the upper left frame)
#. Click on the button **Run Script**. #. Click on the button **Run Script**.
To view the results: To view the results:
#. Select the the default cube. #. Select the the default cube.
#. Click on the Object properties icon in the buttons panel (far right; appears as a tiny cube). #. Click on the Object properties icon in the buttons panel (far right; appears as a tiny cube).
#. Scroll down to see a panel named **Hello World Panel**. #. Scroll down to see a panel named **Hello World Panel**.
#. Changing the object name also updates **Hello World Panel's** Name: field. #. Changing the object name also updates **Hello World Panel's** Name: field.
Note the row distribution and the label and properties that are available through the code. Note the row distribution and the label and properties that are available through the code.
@@ -334,14 +362,16 @@ Blender's Python API can be split up into 3 categories.
Native Types Native Types
------------ ------------
In simple cases returning a number or a string as a custom type would be cumbersome, so these are accessed as normal Python types. In simple cases returning a number or a string as a custom type would be cumbersome, so these are accessed as normal python types.
- Blender float/int/boolean -> float/int/boolean * blender float/int/boolean -> float/int/boolean
- Blender enumerator -> string
* blender enumerator -> string
>>> C.object.rotation_mode = 'AXIS_ANGLE' >>> C.object.rotation_mode = 'AXIS_ANGLE'
- Blender enumerator (multiple) -> set of strings
* blender enumerator (multiple) -> set of strings
.. code-block:: python .. code-block:: python
@@ -359,7 +389,7 @@ Used for Blender datablocks and collections: :class:`bpy.types.bpy_struct`
For data that contains its own attributes groups/meshes/bones/scenes... etc. For data that contains its own attributes groups/meshes/bones/scenes... etc.
There are 2 main types that wrap Blenders data, one for datablocks (known internally as ``bpy_struct``), another for properties. There are 2 main types that wrap Blenders data, one for datablocks (known internally as bpy_struct), another for properties.
>>> bpy.context.object >>> bpy.context.object
bpy.data.objects['Cube'] bpy.data.objects['Cube']

View File

@@ -19,17 +19,21 @@ Prerequisites
Before going through the tutorial you should... Before going through the tutorial you should...
- Familiarity with the basics of working in Blender. * 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). * Know how to run a script in Blender's text editor (as documented in the quick-start)
- Be familiar with the concept of Python modules.
- Basic understanding of classes (object orientation) in Python. * 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. Suggested reading before starting this tutorial.
- `Dive Into Python <http://getpython3.com/diveintopython3/index.html>`_ sections (1, 2, 3, 4, and 7). * `Dive Into Python <http://getpython3.com/diveintopython3/index.html>`_ sections (1, 2, 3, 4, and 7).
- :ref:`Blender API Quickstart <info_quickstart>` * :ref:`Blender API Quickstart <info_quickstart>`
to help become familiar with Blender/Python basics. to help become familiar with Blender/Python basics.
@@ -41,11 +45,13 @@ Documentation Links
While going through the tutorial you may want to look into our reference documentation. While going through the tutorial you may want to look into our reference documentation.
- :ref:`Blender API Overview <info_overview>`. - * :ref:`Blender API Overview <info_overview>`. -
*This document is rather detailed but helpful if you want to know more on a topic.* *This document is rather detailed but helpful if you want to know more on a topic.*
- :mod:`bpy.context` api reference. -
* :mod:`bpy.context` api reference. -
*Handy to have a list of available items your script may operate on.* *Handy to have a list of available items your script may operate on.*
- :class:`bpy.types.Operator`. -
* :class:`bpy.types.Operator`. -
*The following addons define operators, these docs give details and more examples of operators.* *The following addons define operators, these docs give details and more examples of operators.*
@@ -72,11 +78,11 @@ To give an example, here is the simplest possible addon.
print("Goodbye World") print("Goodbye World")
- ``bl_info`` is a dictionary containing addon meta-data such as the title, version and author to be displayed in the * ``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. user preferences addon list.
- ``register`` is a function which only runs when enabling the addon, this means the module can be loaded without * ``register`` is a function which only runs when enabling the addon, this means the module can be loaded without
activating the addon. activating the addon.
- ``unregister`` is a function to unload anything setup by ``register``, this is called when the addon is disabled. * ``unregister`` is a function to unload anything setup by ``register``, this is called when the addon is disabled.
@@ -178,16 +184,13 @@ This addon takes the body of the script above, and adds them to an operator's ``
register() register()
.. note:: .. note:: ``bl_info`` is split across multiple lines, this is just a style convention used to more easily add items.
``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()``.
.. 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 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. 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 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. directly and call register immediately.
@@ -199,8 +202,8 @@ However running the script wont move any objects, for this you need to execute t
:height: 574px :height: 574px
:alt: Spacebar :alt: Spacebar
Do this by pressing :kbd:`Spacebar` to bring up the operator search dialog and type in Do this by pressing ``SpaceBar`` to bring up the operator search dialog and type in "Move X by One" (the ``bl_label``),
"Move X by One" (the ``bl_label``), then :kbd:`Enter`. then press ``Enter``.
@@ -211,8 +214,8 @@ The objects should move as before.
Install The Addon Install The Addon
----------------- -----------------
Once you have your addon within in Blender's text editor, 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
you will want to be able to install it so it can be enabled in the user preferences to load on startup. 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. Even though the addon above is a test, lets go through the steps anyway so you know how to do it for later.
@@ -630,12 +633,15 @@ 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. Here are some sites you might like to check on after completing this tutorial.
- :ref:`Blender/Python API Overview <info_overview>` - * :ref:`Blender/Python API Overview <info_overview>` -
*For more background details on Blender/Python integration.* *For more background details on Blender/Python integration.*
- `How to Think Like a Computer Scientist <http://interactivepython.org/courselib/static/thinkcspy/index.html>`_ -
* `How to Think Like a Computer Scientist <http://interactivepython.org/courselib/static/thinkcspy/index.html>`_ -
*Great info for those who are still learning Python.* *Great info for those who are still learning Python.*
- `Blender Development (Wiki) <http://wiki.blender.org/index.php/Dev:Contents>`_ -
* `Blender Development (Wiki) <http://wiki.blender.org/index.php/Dev:Contents>`_ -
*Blender Development, general information and helpful links.* *Blender Development, general information and helpful links.*
- `Blender Artists (Coding Section) <http://blenderartists.org/forum/forumdisplay.php?47-Coding>`_ -
* `Blender Artists (Coding Section) <http://blenderartists.org/forum/forumdisplay.php?47-Coding>`_ -
*forum where people ask Python development questions* *forum where people ask Python development questions*

View File

@@ -316,7 +316,7 @@ def main():
try: try:
import argparse import argparse
except ImportError: except:
print("Old Blender, just dumping") print("Old Blender, just dumping")
api_dump() api_dump()
return return

View File

@@ -937,16 +937,10 @@ def pymodule2sphinx(basepath, module_name, module, title):
fw(title_string(heading, heading_char)) fw(title_string(heading, heading_char))
# May need to be its own function # May need to be its own function
fw(".. class:: %s\n\n" % type_name)
if value.__doc__: if value.__doc__:
if value.__doc__.startswith(".. class::"):
fw(value.__doc__)
else:
fw(".. class:: %s\n\n" % type_name)
write_indented_lines(" ", fw, value.__doc__, False) write_indented_lines(" ", fw, value.__doc__, False)
else:
fw(".. class:: %s\n\n" % type_name)
fw("\n") fw("\n")
write_example_ref(" ", fw, module_name + "." + type_name) write_example_ref(" ", fw, module_name + "." + type_name)
descr_items = [(key, descr) for key, descr in sorted(value.__dict__.items()) if not key.startswith("__")] descr_items = [(key, descr) for key, descr in sorted(value.__dict__.items()) if not key.startswith("__")]
@@ -977,12 +971,10 @@ def pymodule2sphinx(basepath, module_name, module, title):
context_type_map = { context_type_map = {
"active_base": ("ObjectBase", False), "active_base": ("ObjectBase", False),
"active_bone": ("EditBone", False), "active_bone": ("EditBone", False),
"active_gpencil_frame": ("GreasePencilLayer", True),
"active_gpencil_layer": ("GPencilLayer", True),
"active_node": ("Node", False),
"active_object": ("Object", False), "active_object": ("Object", False),
"active_operator": ("Operator", False), "active_operator": ("Operator", False),
"active_pose_bone": ("PoseBone", False), "active_pose_bone": ("PoseBone", False),
"active_node": ("Node", False),
"armature": ("Armature", False), "armature": ("Armature", False),
"bone": ("Bone", False), "bone": ("Bone", False),
"brush": ("Brush", False), "brush": ("Brush", False),
@@ -998,11 +990,7 @@ context_type_map = {
"edit_object": ("Object", False), "edit_object": ("Object", False),
"edit_text": ("Text", False), "edit_text": ("Text", False),
"editable_bones": ("EditBone", True), "editable_bones": ("EditBone", True),
"editable_gpencil_layers": ("GPencilLayer", True),
"editable_gpencil_strokes": ("GPencilStroke", True),
"fluid": ("FluidSimulationModifier", False), "fluid": ("FluidSimulationModifier", False),
"gpencil_data": ("GreasePencel", False),
"gpencil_data_owner": ("ID", False),
"image_paint_object": ("Object", False), "image_paint_object": ("Object", False),
"lamp": ("Lamp", False), "lamp": ("Lamp", False),
"lattice": ("Lattice", False), "lattice": ("Lattice", False),
@@ -1042,7 +1030,6 @@ context_type_map = {
"vertex_paint_object": ("Object", False), "vertex_paint_object": ("Object", False),
"visible_bases": ("ObjectBase", True), "visible_bases": ("ObjectBase", True),
"visible_bones": ("EditBone", True), "visible_bones": ("EditBone", True),
"visible_gpencil_layers": ("GPencilLayer", True),
"visible_objects": ("Object", True), "visible_objects": ("Object", True),
"visible_pose_bones": ("PoseBone", True), "visible_pose_bones": ("PoseBone", True),
"weight_paint_object": ("Object", False), "weight_paint_object": ("Object", False),

View File

@@ -26,14 +26,11 @@
# Otherwise we get warnings here that we cant fix in external projects # Otherwise we get warnings here that we cant fix in external projects
remove_strict_flags() remove_strict_flags()
add_subdirectory(colamd)
add_subdirectory(rangetree) add_subdirectory(rangetree)
add_subdirectory(wcwidth) add_subdirectory(wcwidth)
add_subdirectory(libmv) add_subdirectory(libmv)
if(WITH_OPENNL)
add_subdirectory(colamd)
endif()
if(WITH_BULLET) if(WITH_BULLET)
if(NOT WITH_SYSTEM_BULLET) if(NOT WITH_SYSTEM_BULLET)
add_subdirectory(bullet2) add_subdirectory(bullet2)
@@ -69,7 +66,7 @@ if(WITH_IMAGE_REDCODE)
add_subdirectory(libredcode) add_subdirectory(libredcode)
endif() endif()
if(WITH_LZO AND NOT WITH_SYSTEM_LZO) if(WITH_LZO)
add_subdirectory(lzo) add_subdirectory(lzo)
endif() endif()

View File

@@ -6,8 +6,3 @@ Erwin
Apply patches/convex_hull.patch to add access to the convex hull Apply patches/convex_hull.patch to add access to the convex hull
operation, used in the BMesh convex hull operator. operation, used in the BMesh convex hull operator.
Documentation is available at:
http://code.google.com/p/bullet/source/browse/trunk/Bullet_User_Manual.pdf
and:
https://github.com/bulletphysics/bullet3/tree/master/docs

View File

View File

View File

@@ -105,6 +105,8 @@ blender_add_lib(extern_carve "\${SRC}" "\${INC}" "\${INC_SYS}")
EOF EOF
cat > SConscript << EOF cat > SConscript << EOF
#!/usr/bin/python
# NOTE: This file is automatically generated by bundle.sh script # NOTE: This file is automatically generated by bundle.sh script
# If you're doing changes in this file, please update template # If you're doing changes in this file, please update template
# in that script too # in that script too

View File

@@ -37,42 +37,13 @@ set(SRC
libmv-capi.h libmv-capi.h
) )
if(WITH_LIBMV OR WITH_GTESTS OR (WITH_CYCLES AND WITH_CYCLES_LOGGING)) if(WITH_LIBMV)
list(APPEND INC
third_party/gflags
third_party/gflags/gflags
third_party/glog/src
third_party/ceres/include
third_party/ceres/config
../../intern/guardedalloc
)
list(APPEND INC_SYS
${EIGEN3_INCLUDE_DIRS}
${PNG_INCLUDE_DIRS}
${ZLIB_INCLUDE_DIRS}
)
if(WIN32)
list(APPEND INC
third_party/glog/src/windows
)
if(NOT MINGW)
list(APPEND INC
third_party/msinttypes
)
endif()
endif()
add_definitions( add_definitions(
-DWITH_LIBMV_GUARDED_ALLOC -DWITH_LIBMV_GUARDED_ALLOC
-DGOOGLE_GLOG_DLL_DECL= -DGOOGLE_GLOG_DLL_DECL=
-DLIBMV_NO_FAST_DETECTOR= -DLIBMV_NO_FAST_DETECTOR=
) )
endif()
if(WITH_LIBMV)
TEST_SHARED_PTR_SUPPORT() TEST_SHARED_PTR_SUPPORT()
if(SHARED_PTR_FOUND) if(SHARED_PTR_FOUND)
if(SHARED_PTR_TR1_MEMORY_HEADER) if(SHARED_PTR_TR1_MEMORY_HEADER)
@@ -85,6 +56,20 @@ if(WITH_LIBMV)
message(FATAL_ERROR "Unable to find shared_ptr.") message(FATAL_ERROR "Unable to find shared_ptr.")
endif() endif()
list(APPEND INC
third_party/gflags
third_party/glog/src
third_party/ceres/include
third_party/ceres/config
../../intern/guardedalloc
)
list(APPEND INC_SYS
../Eigen3
${PNG_INCLUDE_DIRS}
${ZLIB_INCLUDE_DIRS}
)
list(APPEND SRC list(APPEND SRC
intern/autotrack.cc intern/autotrack.cc
intern/camera_intrinsics.cc intern/camera_intrinsics.cc
@@ -217,6 +202,17 @@ if(WITH_LIBMV)
third_party/msinttypes/stdint.h third_party/msinttypes/stdint.h
) )
if(WIN32)
list(APPEND INC
third_party/glog/src/windows
)
if(NOT MINGW)
list(APPEND INC
third_party/msinttypes
)
endif()
endif()
if(WITH_GTESTS) if(WITH_GTESTS)
blender_add_lib(libmv_test_dataset "./libmv/multiview/test_data_sets.cc" "" "") blender_add_lib(libmv_test_dataset "./libmv/multiview/test_data_sets.cc" "" "")
@@ -266,7 +262,7 @@ if(WITH_LIBMV)
endif() endif()
# make GLog a separate target, so it can be used for gtest as well. # make GLog a separate target, so it can be used for gtest as well.
if(WITH_LIBMV OR WITH_GTESTS OR (WITH_CYCLES AND WITH_CYCLES_LOGGING)) if(WITH_LIBMV OR WITH_GTESTS OR WITH_CYCLES_LOGGING)
# We compile GLog together with GFlag so we don't worry about # We compile GLog together with GFlag so we don't worry about
# adding extra lib to linker. # adding extra lib to linker.
set(GLOG_SRC set(GLOG_SRC
@@ -307,9 +303,6 @@ if(WITH_LIBMV OR WITH_GTESTS OR (WITH_CYCLES AND WITH_CYCLES_LOGGING))
third_party/glog/src/windows/glog/log_severity.h third_party/glog/src/windows/glog/log_severity.h
third_party/glog/src/windows/port.h third_party/glog/src/windows/port.h
third_party/glog/src/windows/config.h third_party/glog/src/windows/config.h
third_party/gflags/windows_port.cc
third_party/gflags/windows_port.h
) )
else() else()
list(APPEND GLOG_SRC list(APPEND GLOG_SRC
@@ -345,5 +338,13 @@ if(WITH_LIBMV OR WITH_GTESTS OR (WITH_CYCLES AND WITH_CYCLES_LOGGING))
) )
endif() endif()
blender_add_lib(extern_glog "${GLOG_SRC}" "${INC}" "${INC_SYS}") set(GLOG_INC
third_party/gflags
third_party/glog/src
)
set(GLOG_INC_SYS
)
blender_add_lib(extern_glog "${GLOG_SRC}" "${GLOG_INC}" "${GLOG_INC_SYS}")
endif() endif()

View File

@@ -1,42 +1,3 @@
commit 7d6020d2ec42c6cb2749bc891186b4880d26d40b
Author: Sergey Sharybin <sergey.vfx@gmail.com>
Date: Wed Dec 31 15:32:07 2014 +0500
Update GLog to latest upstream revision 143
Mainly to solve compilation error with demangle.cc.
commit 5dc746700eaf85cb674f0fb73ff3c1b49a7f6315
Author: Sergey Sharybin <sergey.vfx@gmail.com>
Date: Fri Dec 12 14:59:55 2014 +0500
Update GFlags to latest release 2.1.1
Main purpose of this (andsome of upcoming) update is to check if the
upstream sources are useable without any modifications for us. And if
not, then we'll need to consider moving some changes into upstream.
This commit contains an one-to-one copy of the upstream GFlags library
and also changes namespace usage since it's changed in the upstream.
commit 6fe6d75f7e90e161b44643b953f058a3829a5247
Author: Sergey Sharybin <sergey.vfx@gmail.com>
Date: Sat Nov 1 02:53:36 2014 +0500
Libmv: Code cleanup, mixed class/struct in declaration/definition
commit d2a5f7953812d2d09765431b59c6c4ac72faf35b
Author: Sergey Sharybin <sergey.vfx@gmail.com>
Date: Thu Oct 30 23:13:53 2014 +0500
Libmv: Support disabled color channels in tracking settings
This was never ported to a new tracking pipeline and now it's done using
FrameAccessor::Transform routines. Quite striaghtforward, but i've changed
order of grayscale conversion in blender side with call of transform callback.
This way it's much easier to perform rescaling in libmv side.
commit d976e034cdf74b34860e0632d7b29713f47c5756 commit d976e034cdf74b34860e0632d7b29713f47c5756
Author: Keir Mierle <mierle@gmail.com> Author: Keir Mierle <mierle@gmail.com>
Date: Sat Aug 23 00:38:01 2014 -0700 Date: Sat Aug 23 00:38:01 2014 -0700
@@ -705,3 +666,37 @@ Author: Sergey Sharybin <sergey.vfx@gmail.com>
Date: Tue Feb 18 19:38:22 2014 +0600 Date: Tue Feb 18 19:38:22 2014 +0600
Remove .orig file which was added by accident Remove .orig file which was added by accident
commit 62597e3cf0f266a2fefec415c89759e502793e06
Author: Sergey Sharybin <sergey.vfx@gmail.com>
Date: Thu Jan 2 16:02:08 2014 +0600
Upgrade glog to latest svn r139
The intention of this upgrade is to get rid of custom patches
we've been having to support compilation on different platforms
and compilers.
commit 2452d5d42b390c7ab853e6fe60e58bdd7a01a004
Author: Sergey Sharybin <sergey.vfx@gmail.com>
Date: Tue Feb 18 18:46:08 2014 +0600
Tweak Ceres CMake to detect uninstall target properly on Windows
commit 98a281d58ce2301f3dd239a97a448e53f48d0258
Author: Sergey Sharybin <sergey.vfx@gmail.com>
Date: Fri Feb 14 00:36:44 2014 +0600
Fix order of third party libs compilation and options used by them
WITH_FAST_DETECTOR was defined too late and third_party folder
didn't see this option.
commit 4962bccd643ec0f2aed3035170d5f20e8f6efc85
Author: Sergey Sharybin <sergey.vfx@gmail.com>
Date: Thu Feb 13 23:55:03 2014 +0600
Disable Ceres unit tests and examples by default
Actually we're to switch to external Ceres rather than
bundled one, would make life much easier actually.

View File

@@ -12,22 +12,6 @@ Import('env')
defs = [] defs = []
incs = '.' incs = '.'
if env['WITH_BF_LIBMV'] or (env['WITH_BF_CYCLES'] and env['WITH_BF_CYCLES_LOGGING']):
defs.append('GOOGLE_GLOG_DLL_DECL=')
defs.append('WITH_LIBMV_GUARDED_ALLOC')
defs.append('LIBMV_NO_FAST_DETECTOR')
incs += ' ../Eigen3 third_party/gflags third_party/gflags/gflags third_party/glog/src third_party/ceres/include third_party/ceres/config ../../intern/guardedalloc'
incs += ' ' + env['BF_PNG_INC']
incs += ' ' + env['BF_ZLIB_INC']
if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc', 'win64-mingw'):
incs += ' ./third_party/glog/src/windows ./third_party/glog/src/windows/glog'
if env['OURPLATFORM'] in ('win32-vc', 'win64-vc'):
incs += ' ./third_party/msinttypes'
else:
incs += ' ./third_party/glog/src'
if env['WITH_BF_LIBMV']: if env['WITH_BF_LIBMV']:
if not env['WITH_SHARED_PTR_SUPPORT']: if not env['WITH_SHARED_PTR_SUPPORT']:
print("-- Unable to find shared_ptr which is required for compilation.") print("-- Unable to find shared_ptr which is required for compilation.")
@@ -38,6 +22,10 @@ if env['WITH_BF_LIBMV']:
if env['SHARED_PTR_NAMESPACE'] == 'std::tr1': if env['SHARED_PTR_NAMESPACE'] == 'std::tr1':
defs.append('CERES_TR1_SHARED_PTR') defs.append('CERES_TR1_SHARED_PTR')
defs.append('GOOGLE_GLOG_DLL_DECL=')
defs.append('WITH_LIBMV_GUARDED_ALLOC')
defs.append('LIBMV_NO_FAST_DETECTOR')
src = env.Glob('intern/*.cc') src = env.Glob('intern/*.cc')
src.remove('intern' + os.sep + 'stub.cc') src.remove('intern' + os.sep + 'stub.cc')
src += env.Glob('libmv/autotrack/*.cc') src += env.Glob('libmv/autotrack/*.cc')
@@ -47,6 +35,19 @@ if env['WITH_BF_LIBMV']:
src += env.Glob('libmv/numeric/*.cc') src += env.Glob('libmv/numeric/*.cc')
src += env.Glob('libmv/simple_pipeline/*.cc') src += env.Glob('libmv/simple_pipeline/*.cc')
src += env.Glob('libmv/tracking/*.cc') src += env.Glob('libmv/tracking/*.cc')
src += env.Glob('third_party/gflags/*.cc')
incs += ' ../Eigen3 third_party/gflags third_party/glog/src third_party/ceres/include third_party/ceres/config ../../intern/guardedalloc'
incs += ' ' + env['BF_PNG_INC']
incs += ' ' + env['BF_ZLIB_INC']
if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc', 'win64-mingw'):
incs += ' ./third_party/glog/src/windows ./third_party/glog/src/windows/glog'
if env['OURPLATFORM'] in ('win32-vc', 'win64-vc'):
incs += ' ./third_party/msinttypes'
else:
incs += ' ./third_party/glog/src'
else: else:
src = env.Glob("intern/stub.cc") src = env.Glob("intern/stub.cc")
@@ -56,12 +57,10 @@ env.BlenderLib(libname = 'extern_libmv', sources=src, includes=Split(incs), defi
if env['WITH_BF_LIBMV'] or (env['WITH_BF_CYCLES'] and env['WITH_BF_CYCLES_LOGGING']): if env['WITH_BF_LIBMV'] or (env['WITH_BF_CYCLES'] and env['WITH_BF_CYCLES_LOGGING']):
glog_src = [] glog_src = []
glog_src += env.Glob("third_party/gflags/*.cc")
if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc', 'win64-mingw'): if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc', 'win64-mingw'):
glog_src += ['./third_party/glog/src/logging.cc', './third_party/glog/src/raw_logging.cc', './third_party/glog/src/utilities.cc', './third_party/glog/src/vlog_is_on.cc'] glog_src += ['./third_party/glog/src/logging.cc', './third_party/glog/src/raw_logging.cc', './third_party/glog/src/utilities.cc', './third_party/glog/src/vlog_is_on.cc']
glog_src += ['./third_party/glog/src/windows/port.cc'] glog_src += ['./third_party/glog/src/windows/port.cc']
else: else:
glog_src.remove('third_party/gflags/windows_port.cc')
glog_src += env.Glob("third_party/glog/src/*.cc") glog_src += env.Glob("third_party/glog/src/*.cc")
env.BlenderLib(libname = 'extern_glog', sources=glog_src, includes=Split(incs), defines=defs, libtype=['extern', 'player'], priority=[20,137]) env.BlenderLib(libname = 'extern_glog', sources=glog_src, includes=Split(incs), defines=defs, libtype=['extern', 'player'], priority=[20,137])

109
extern/libmv/bundle.sh vendored
View File

@@ -75,7 +75,7 @@ for x in $src_dir $src_third_dir; do
fi fi
fi fi
if test `echo $x | grep -c "windows\|gflags" ` -eq 0; then if test `echo $x | grep -c windows ` -eq 0; then
if [ -z "$src" ]; then if [ -z "$src" ]; then
src=$t src=$t
else else
@@ -130,42 +130,13 @@ set(SRC
libmv-capi.h libmv-capi.h
) )
if(WITH_LIBMV OR WITH_GTESTS OR (WITH_CYCLES AND WITH_CYCLES_LOGGING)) if(WITH_LIBMV)
list(APPEND INC
third_party/gflags
third_party/gflags/gflags
third_party/glog/src
third_party/ceres/include
third_party/ceres/config
../../intern/guardedalloc
)
list(APPEND INC_SYS
\${EIGEN3_INCLUDE_DIRS}
\${PNG_INCLUDE_DIRS}
\${ZLIB_INCLUDE_DIRS}
)
if(WIN32)
list(APPEND INC
third_party/glog/src/windows
)
if(NOT MINGW)
list(APPEND INC
third_party/msinttypes
)
endif()
endif()
add_definitions( add_definitions(
-DWITH_LIBMV_GUARDED_ALLOC -DWITH_LIBMV_GUARDED_ALLOC
-DGOOGLE_GLOG_DLL_DECL= -DGOOGLE_GLOG_DLL_DECL=
-DLIBMV_NO_FAST_DETECTOR= -DLIBMV_NO_FAST_DETECTOR=
) )
endif()
if(WITH_LIBMV)
TEST_SHARED_PTR_SUPPORT() TEST_SHARED_PTR_SUPPORT()
if(SHARED_PTR_FOUND) if(SHARED_PTR_FOUND)
if(SHARED_PTR_TR1_MEMORY_HEADER) if(SHARED_PTR_TR1_MEMORY_HEADER)
@@ -178,6 +149,20 @@ if(WITH_LIBMV)
message(FATAL_ERROR "Unable to find shared_ptr.") message(FATAL_ERROR "Unable to find shared_ptr.")
endif() endif()
list(APPEND INC
third_party/gflags
third_party/glog/src
third_party/ceres/include
third_party/ceres/config
../../intern/guardedalloc
)
list(APPEND INC_SYS
../Eigen3
\${PNG_INCLUDE_DIRS}
\${ZLIB_INCLUDE_DIRS}
)
list(APPEND SRC list(APPEND SRC
intern/autotrack.cc intern/autotrack.cc
intern/camera_intrinsics.cc intern/camera_intrinsics.cc
@@ -209,6 +194,17 @@ ${headers}
${third_headers} ${third_headers}
) )
if(WIN32)
list(APPEND INC
third_party/glog/src/windows
)
if(NOT MINGW)
list(APPEND INC
third_party/msinttypes
)
endif()
endif()
if(WITH_GTESTS) if(WITH_GTESTS)
blender_add_lib(libmv_test_dataset "./libmv/multiview/test_data_sets.cc" "${INC}" "${INC_SYS}") blender_add_lib(libmv_test_dataset "./libmv/multiview/test_data_sets.cc" "${INC}" "${INC_SYS}")
@@ -228,7 +224,7 @@ if(WITH_LIBMV)
endif() endif()
# make GLog a separate target, so it can be used for gtest as well. # make GLog a separate target, so it can be used for gtest as well.
if(WITH_LIBMV OR WITH_GTESTS OR (WITH_CYCLES AND WITH_CYCLES_LOGGING)) if(WITH_LIBMV OR WITH_GTESTS OR WITH_CYCLES_LOGGING)
# We compile GLog together with GFlag so we don't worry about # We compile GLog together with GFlag so we don't worry about
# adding extra lib to linker. # adding extra lib to linker.
set(GLOG_SRC set(GLOG_SRC
@@ -262,9 +258,6 @@ ${third_gflags_headers}
third_party/glog/src/windows/glog/log_severity.h third_party/glog/src/windows/glog/log_severity.h
third_party/glog/src/windows/port.h third_party/glog/src/windows/port.h
third_party/glog/src/windows/config.h third_party/glog/src/windows/config.h
third_party/gflags/windows_port.cc
third_party/gflags/windows_port.h
) )
else() else()
list(APPEND GLOG_SRC list(APPEND GLOG_SRC
@@ -274,11 +267,21 @@ ${third_glog_headers}
) )
endif() endif()
blender_add_lib(extern_glog "\${GLOG_SRC}" "\${INC}" "\${INC_SYS}") set(GLOG_INC
third_party/gflags
third_party/glog/src
)
set(GLOG_INC_SYS
)
blender_add_lib(extern_glog "\${GLOG_SRC}" "\${GLOG_INC}" "\${GLOG_INC_SYS}")
endif() endif()
EOF EOF
cat > SConscript << EOF cat > SConscript << EOF
#!/usr/bin/python
# NOTE: This file is automatically generated by bundle.sh script # NOTE: This file is automatically generated by bundle.sh script
# If you're doing changes in this file, please update template # If you're doing changes in this file, please update template
# in that script too # in that script too
@@ -291,22 +294,6 @@ Import('env')
defs = [] defs = []
incs = '.' incs = '.'
if env['WITH_BF_LIBMV'] or (env['WITH_BF_CYCLES'] and env['WITH_BF_CYCLES_LOGGING']):
defs.append('GOOGLE_GLOG_DLL_DECL=')
defs.append('WITH_LIBMV_GUARDED_ALLOC')
defs.append('LIBMV_NO_FAST_DETECTOR')
incs += ' ../Eigen3 third_party/gflags third_party/gflags/gflags third_party/glog/src third_party/ceres/include third_party/ceres/config ../../intern/guardedalloc'
incs += ' ' + env['BF_PNG_INC']
incs += ' ' + env['BF_ZLIB_INC']
if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc', 'win64-mingw'):
incs += ' ./third_party/glog/src/windows ./third_party/glog/src/windows/glog'
if env['OURPLATFORM'] in ('win32-vc', 'win64-vc'):
incs += ' ./third_party/msinttypes'
else:
incs += ' ./third_party/glog/src'
if env['WITH_BF_LIBMV']: if env['WITH_BF_LIBMV']:
if not env['WITH_SHARED_PTR_SUPPORT']: if not env['WITH_SHARED_PTR_SUPPORT']:
print("-- Unable to find shared_ptr which is required for compilation.") print("-- Unable to find shared_ptr which is required for compilation.")
@@ -317,9 +304,25 @@ if env['WITH_BF_LIBMV']:
if env['SHARED_PTR_NAMESPACE'] == 'std::tr1': if env['SHARED_PTR_NAMESPACE'] == 'std::tr1':
defs.append('CERES_TR1_SHARED_PTR') defs.append('CERES_TR1_SHARED_PTR')
defs.append('GOOGLE_GLOG_DLL_DECL=')
defs.append('WITH_LIBMV_GUARDED_ALLOC')
defs.append('LIBMV_NO_FAST_DETECTOR')
src = env.Glob('intern/*.cc') src = env.Glob('intern/*.cc')
src.remove('intern' + os.sep + 'stub.cc') src.remove('intern' + os.sep + 'stub.cc')
$src $src
incs += ' ../Eigen3 third_party/gflags third_party/glog/src third_party/ceres/include third_party/ceres/config ../../intern/guardedalloc'
incs += ' ' + env['BF_PNG_INC']
incs += ' ' + env['BF_ZLIB_INC']
if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc', 'win64-mingw'):
incs += ' ./third_party/glog/src/windows ./third_party/glog/src/windows/glog'
if env['OURPLATFORM'] in ('win32-vc', 'win64-vc'):
incs += ' ./third_party/msinttypes'
${win_src}
else:
incs += ' ./third_party/glog/src'
else: else:
src = env.Glob("intern/stub.cc") src = env.Glob("intern/stub.cc")
@@ -329,12 +332,10 @@ env.BlenderLib(libname = 'extern_libmv', sources=src, includes=Split(incs), defi
if env['WITH_BF_LIBMV'] or (env['WITH_BF_CYCLES'] and env['WITH_BF_CYCLES_LOGGING']): if env['WITH_BF_LIBMV'] or (env['WITH_BF_CYCLES'] and env['WITH_BF_CYCLES_LOGGING']):
glog_src = [] glog_src = []
glog_src += env.Glob("third_party/gflags/*.cc")
if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc', 'win64-mingw'): if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc', 'win64-mingw'):
glog_src += ['./third_party/glog/src/logging.cc', './third_party/glog/src/raw_logging.cc', './third_party/glog/src/utilities.cc', './third_party/glog/src/vlog_is_on.cc'] glog_src += ['./third_party/glog/src/logging.cc', './third_party/glog/src/raw_logging.cc', './third_party/glog/src/utilities.cc', './third_party/glog/src/vlog_is_on.cc']
glog_src += ['./third_party/glog/src/windows/port.cc'] glog_src += ['./third_party/glog/src/windows/port.cc']
else: else:
glog_src.remove('third_party/gflags/windows_port.cc')
glog_src += env.Glob("third_party/glog/src/*.cc") glog_src += env.Glob("third_party/glog/src/*.cc")
env.BlenderLib(libname = 'extern_glog', sources=glog_src, includes=Split(incs), defines=defs, libtype=['extern', 'player'], priority=[20,137]) env.BlenderLib(libname = 'extern_glog', sources=glog_src, includes=Split(incs), defines=defs, libtype=['extern', 'player'], priority=[20,137])

View File

@@ -133,10 +133,10 @@ libmv/tracking/track_region.cc
libmv/tracking/track_region.h libmv/tracking/track_region.h
libmv/tracking/trklt_region_tracker.cc libmv/tracking/trklt_region_tracker.cc
libmv/tracking/trklt_region_tracker.h libmv/tracking/trklt_region_tracker.h
third_party/gflags/AUTHORS.txt third_party/gflags/AUTHORS
third_party/gflags/ChangeLog.txt third_party/gflags/ChangeLog
third_party/gflags/config.h third_party/gflags/config.h
third_party/gflags/COPYING.txt third_party/gflags/COPYING
third_party/gflags/gflags.cc third_party/gflags/gflags.cc
third_party/gflags/gflags_completions.cc third_party/gflags/gflags_completions.cc
third_party/gflags/gflags/gflags_completions.h third_party/gflags/gflags/gflags_completions.h
@@ -144,11 +144,9 @@ third_party/gflags/gflags/gflags_declare.h
third_party/gflags/gflags/gflags.h third_party/gflags/gflags/gflags.h
third_party/gflags/gflags_reporting.cc third_party/gflags/gflags_reporting.cc
third_party/gflags/mutex.h third_party/gflags/mutex.h
third_party/gflags/NEWS.txt third_party/gflags/NEWS
third_party/gflags/README.libmv third_party/gflags/README.libmv
third_party/gflags/util.h third_party/gflags/util.h
third_party/gflags/windows_port.cc
third_party/gflags/windows_port.h
third_party/glog/AUTHORS third_party/glog/AUTHORS
third_party/glog/ChangeLog third_party/glog/ChangeLog
third_party/glog/COPYING third_party/glog/COPYING

View File

@@ -35,21 +35,21 @@ void libmv_initLogging(const char* argv0) {
google::GLOG_FATAL); google::GLOG_FATAL);
google::InitGoogleLogging(argv0); google::InitGoogleLogging(argv0);
gflags::SetCommandLineOption("logtostderr", "1"); google::SetCommandLineOption("logtostderr", "1");
gflags::SetCommandLineOption("v", "0"); google::SetCommandLineOption("v", "0");
gflags::SetCommandLineOption("stderrthreshold", severity_fatal); google::SetCommandLineOption("stderrthreshold", severity_fatal);
gflags::SetCommandLineOption("minloglevel", severity_fatal); google::SetCommandLineOption("minloglevel", severity_fatal);
} }
void libmv_startDebugLogging(void) { void libmv_startDebugLogging(void) {
gflags::SetCommandLineOption("logtostderr", "1"); google::SetCommandLineOption("logtostderr", "1");
gflags::SetCommandLineOption("v", "2"); google::SetCommandLineOption("v", "2");
gflags::SetCommandLineOption("stderrthreshold", "1"); google::SetCommandLineOption("stderrthreshold", "1");
gflags::SetCommandLineOption("minloglevel", "0"); google::SetCommandLineOption("minloglevel", "0");
} }
void libmv_setLoggingVerbosity(int verbosity) { void libmv_setLoggingVerbosity(int verbosity) {
char val[10]; char val[10];
snprintf(val, sizeof(val), "%d", verbosity); snprintf(val, sizeof(val), "%d", verbosity);
gflags::SetCommandLineOption("v", val); google::SetCommandLineOption("v", val);
} }

View File

@@ -154,7 +154,6 @@ bool AutoTrack::TrackMarker(Marker* tracked_marker,
frame_accessor_, frame_accessor_,
&tracked_image); &tracked_image);
if (!tracked_key) { if (!tracked_key) {
frame_accessor_->ReleaseImage(reference_key);
LG << "Couldn't get frame for tracked marker: " << tracked_marker; LG << "Couldn't get frame for tracked marker: " << tracked_marker;
return false; return false;
} }

View File

@@ -179,12 +179,8 @@ void GetNormalizedPoints(const Mat &original_points,
class HomographySymmetricGeometricCostFunctor { class HomographySymmetricGeometricCostFunctor {
public: public:
HomographySymmetricGeometricCostFunctor(const Vec2 &x, HomographySymmetricGeometricCostFunctor(const Vec2 &x,
const Vec2 &y) { const Vec2 &y)
xx_ = x(0); : x_(x), y_(y) { }
xy_ = x(1);
yx_ = y(0);
yy_ = y(1);
}
template<typename T> template<typename T>
bool operator()(const T *homography_parameters, T *residuals) const { bool operator()(const T *homography_parameters, T *residuals) const {
@@ -193,8 +189,8 @@ class HomographySymmetricGeometricCostFunctor {
Mat3 H(homography_parameters); Mat3 H(homography_parameters);
Vec3 x(T(xx_), T(xy_), T(1.0)); Vec3 x(T(x_(0)), T(x_(1)), T(1.0));
Vec3 y(T(yx_), T(yy_), T(1.0)); Vec3 y(T(y_(0)), T(y_(1)), T(1.0));
Vec3 H_x = H * x; Vec3 H_x = H * x;
Vec3 Hinv_y = H.inverse() * y; Vec3 Hinv_y = H.inverse() * y;
@@ -203,19 +199,18 @@ class HomographySymmetricGeometricCostFunctor {
Hinv_y /= Hinv_y(2); Hinv_y /= Hinv_y(2);
// This is a forward error. // This is a forward error.
residuals[0] = H_x(0) - T(yx_); residuals[0] = H_x(0) - T(y_(0));
residuals[1] = H_x(1) - T(yy_); residuals[1] = H_x(1) - T(y_(1));
// This is a backward error. // This is a backward error.
residuals[2] = Hinv_y(0) - T(xx_); residuals[2] = Hinv_y(0) - T(x_(0));
residuals[3] = Hinv_y(1) - T(xy_); residuals[3] = Hinv_y(1) - T(x_(1));
return true; return true;
} }
// TODO(sergey): Think of better naming. const Vec2 x_;
double xx_, xy_; const Vec2 y_;
double yx_, yy_;
}; };
// Termination checking callback used for homography estimation. // Termination checking callback used for homography estimation.

View File

@@ -36,7 +36,7 @@ set(INC
) )
set(INC_SYS set(INC_SYS
${EIGEN3_INCLUDE_DIRS} ../../../Eigen3
) )
set(SRC set(SRC

View File

@@ -129,7 +129,7 @@ set(INC
) )
set(INC_SYS set(INC_SYS
${EIGEN3_INCLUDE_DIRS} ../../../Eigen3
) )
set(SRC set(SRC
@@ -201,7 +201,7 @@ blender_add_lib(extern_ceres "\${SRC}" "\${INC}" "\${INC_SYS}")
EOF EOF
cat > SConscript << EOF cat > SConscript << EOF
#!/usr/bin/env python #!/usr/bin/python
# NOTE: This file is automatically generated by bundle.sh script # NOTE: This file is automatically generated by bundle.sh script
# If you're doing changes in this file, please update template # If you're doing changes in this file, please update template

View File

@@ -0,0 +1,195 @@
Wed Jan 25 15:09:14 2012 Google Inc. <google-gflags@googlegroups.com>
* gflags: version 2.0
* Changed the 'official' gflags email in setup.py/etc
* Renamed google-gflags.sln to gflags.sln
* Changed copyright text to reflect Google's relinquished ownership
Tue Dec 20 19:48:57 2011 Google Inc. <opensource@google.com>
* google-gflags: version 1.7
* Add CommandLineFlagInfo::flag_ptr pointing to current storage (musji)
* PORTING: flush after writing to stderr, needed on cygwin
* PORTING: Clean up the GFLAGS_DLL_DECL stuff better
* Fix a bug in StringPrintf() that affected large strings (csilvers)
* Die at configure-time when g++ isn't installed
Fri Jul 29 19:05:21 2011 Google Inc. <opensource@google.com>
* google-gflags: version 1.6
* BUGFIX: Fix a bug where we were leaving out a required $(top_srcdir)
* Fix definition of clstring (jyrki)
* Split up flag declares into its own file (jyrki)
* Add --version support (csilvers)
* Update the README for gflags with static libs
* Update acx_pthread.m4 for nostdlib
* Change ReparseCommandLineFlags to return void (csilvers)
* Some doc typofixes and example augmentation (various)
Mon Jan 24 16:11:35 2011 Google Inc. <opensource@google.com>
* google-gflags: version 1.5
* Better reporting of current vs default value (handler)
* Add API for cleaning up of memory at program-exit (jmarantz)
* Fix macros to work inside namespaces (csilvers)
* Use our own string typedef in case string is redefined (csilvers)
* Updated to autoconf 2.65
Wed Oct 13 17:40:12 2010 Google Inc. <opensource@google.com>
* google-gflags: version 1.4
* Add a check to prevent passing 0 to DEFINE_string (jorg)
* Reduce compile (.o) size (jyrki)
* Some small changes to quiet debug compiles (alexk)
* PORTING: better support static linking on windows (csilvers)
* DOCUMENTATION: change default values, use validators, etc.
* Update the NEWS file to be non-empty
* Add pkg-config (.pc) files for libgflags and libgflags_nothreads
Mon Jan 4 18:09:30 2010 Google Inc. <opensource@google.com>
* google-gflags: version 1.3
* PORTABILITY: can now build and run tests under MSVC (csilvers)
* Remove the python gflags code, which is now its own package (tansell)
* Clarify that "last flag wins" in the docs (csilvers)
* Comment danger of using GetAllFlags in validators (wojtekm)
* PORTABILITY: Some fixes necessary for c++0x (mboerger)
* Makefile fix: $(srcdir) -> $(top_srcdir) in one place (csilvres)
* INSTALL: autotools to autoconf v2.64 + automake v1.11 (csilvers)
Thu Sep 10 12:53:04 2009 Google Inc. <opensource@google.com>
* google-gflags: version 1.2
* PORTABILITY: can now build and run tests under mingw (csilvers)
* Using a string arg for a bool flag is a compile-time error (rbayardo)
* Add --helpxml to gflags.py (salcianu)
* Protect against a hypothetical global d'tor mutex problem (csilvers)
* BUGFIX: can now define a flag after 'using namespace google' (hamaji)
Tue Apr 14 12:35:25 2009 Google Inc. <opensource@google.com>
* google-gflags: version 1.1
* Add both foo and nofoo for boolean flags, with --undefok (andychu)
* Better document how validators work (wojtekm)
* Improve binary-detection for bash-completion (mtamsky)
* Python: Add a concept of "key flags", used with --help (salcianu)
* Python: Robustify flag_values (salcianu)
* Python: Add a new DEFINE_bool alias (keir, andrewliu)
* Python: Do module introspection based on module name (dsturtevant)
* Fix autoconf a bit better, especially on windows and solaris (ajenjo)
* BUG FIX: gflags_nothreads was linking against the wrong lib (ajenjo)
* BUG FIX: threads-detection failed on FreeBSD; replace it (ajenjo)
* PORTABILITY: Quiet an internal compiler error with SUSE 10 (csilvers)
* PORTABILITY: Update deb.sh for more recenty debuilds (csilvers)
* PORTABILITY: #include more headers to satify new gcc's (csilvers)
* INSTALL: Updated to autoconf 2.61 and libtool 1.5.26 (csilvers)
Fri Oct 3 15:16:46 2008 Google Inc. <opensource@google.com>
* google-gflags: version 1.0
* Add a missing newline to an error string (bcmills)
* (otherwise exactly the same as gflags 1.0rc2)
Thu Sep 18 12:58:05 2008 Google Inc. <opensource@google.com>
* google-gflags: version 1.0rc2
* Report current flag values in --helpxml (hdn)
* Fix compilation troubles with gcc 4.3.3 (simonb)
* BUG FIX: I was missing a std:: in DECLARE_string (csilvers)
* BUG FIX: Clarify in docs how to specify --bool flags (csilvers)
* BUG FIX: Fix --helpshort for source files not in a subdir (csilvers)
* BUG FIX: Fix python unittest for 64-bit builds (bcmills)
Tue Aug 19 16:15:48 2008
* google-gflags: version 1.0rc1
* Move #include files from google/ to gflags/ (csilvers)
* Small optimizations to reduce binary (library) size (jyrki)
* BUGFIX: forgot a std:: in one of the .h files (csilvers)
* Speed up locking by making sure calls are inlined (ajenjo)
* 64-BIT COMPATIBILITY: Use %PRId64 instead of %lld (csilvers)
* PORTABILITY: fix Makefile to work with Cygwin (ajenjo)
* PORTABILITY: fix code to compile under Visual Studio (ajenjo)
* PORTABILITY: fix code to compile under Solaris 10 with CC (csilvers)
Mon Jul 21 23:01:38 2008 Google Inc. <opensource@google.com>
* google-gflags: version 0.9
* Add the ability to validate a command-line flag (csilvers)
* Add completion support for commandline flags in bash (daven)
* Add -W compile flags to Makefile, when using gcc (csilvers)
* Allow helpstring to be NULL (cristianoc)
* Improved documentation of classes in the .cc file (csilvers)
* Fix python bug with AppendFlagValues + shortnames (jjtswan)
* Use bool instead of int for boolean flags in gflags.py (bcmills)
* Simplify the way we declare flags, now more foolproof (csilvers)
* Better error messages when bool flags collide (colohan)
* Only evaluate DEFINE_foo macro args once (csilvers)
Wed Mar 26 15:20:18 2008 Google Inc. <opensource@google.com>
* google-gflags: version 0.8
* Export DescribeOneFlag() in the API
* Add support for automatic line wrapping at 80 cols for gflags.py
* Bugfix: do not treat an isolated "-" the same as an isolated "--"
* Update rpm spec to point to Google Code rather than sourceforge (!)
* Improve documentation (including documenting thread-safety)
* Improve #include hygiene
* Improve testing
Thu Oct 18 11:33:20 2007 Google Inc. <opensource@google.com>
* google-gflags: version 0.7
* Deal even more correctly with libpthread not linked in (csilvers)
* Add STRIP_LOG, an improved DO_NOT_SHOW_COMMANDLINE_HELP (sioffe)
* Be more accurate printing default flag values in --help (dsturtevant)
* Reduce .o file size a bit by using shorter namespace names (jeff)
* Use relative install path, so 'setup.py --home' works (csilvers)
* Notice when a boolean flag has a non-boolean default (bnmouli)
* Broaden --helpshort to match foo-main.cc and foo_main.cc (hendrie)
* Fix "no modules match" message for --helpshort, etc (hendrie)
Wed Aug 15 07:35:51 2007 Google Inc. <opensource@google.com>
* google-gflags: version 0.6
* Deal correctly with case that libpthread is not linked in (csilvers)
* Update Makefile/tests so we pass "make distcheck" (csilvers)
* Document and test that last assignment to a flag wins (wan)
Tue Jun 12 15:23:42 2007 Google Inc. <opensource@google.com>
* google-gflags: version 0.5
* Include all m4 macros in the distribution (csilvers)
* Python: Fix broken data_files field in setup.py (sidlon)
* Python: better string serliaizing and unparsing (abo, csimmons)
* Fix checks for NaN and inf to work with Mac OS X (csilvers)
Thu Apr 19 15:15:07 2007 Google Inc. <opensource@google.com>
* google-gflags: version 0.4
* Remove is_default from GetCommandLineFlagInfo (csilvers)
* Portability fixes: includes, strtoll, gcc4.3 errors (csilvers)
* A few doc typo cleanups (csilvers)
Wed Mar 28 12:15:56 2007 Google Inc. <opensource@google.com>
* google-gflags: version 0.3
* python portability fix: use popen instead of subprocess (csilvers)
* Add is_default to CommandLineFlagInfo (pchien)
* Make docs a bit prettier (csilvers)
* Actually include the python files in the distribution! :-/ (csilvers)
Mon Jan 22 15:33:06 2007 Google Inc. <opensource@google.com>
* google-gflags: version 0.2
* added support for python commandlineflags, as well as c++
* gflags2man, a script to turn flags into a man page (dchristian)
Wed Dec 13 12:37:19 2006 Google Inc. <opensource@google.com>
* google-gflags: initial release:
The gflags package contains a library that implements commandline
flags processing. As such it's a replacement for getopt(). It
has increased flexibility, including built-in support for C++
types like string, and the ability to define flags in the source
file in which they're used.

View File

@@ -1,208 +0,0 @@
* Sun Mar 20 2014 - Andreas Schuh <google-gflags@googlegroups.com>
- gflags: version 2.1.1
- Fixed issue 77: GFLAGS_IS_A_DLL expands to empty string in gflags_declare.h
- Fixed issue 79: GFLAGS_NAMESPACE not expanded to actual namespace in gflags_declare.h
- Fixed issue 80: Allow include path to differ from GFLAGS_NAMESPACE
* Thu Mar 20 2014 - Andreas Schuh <google-gflags@googlegroups.com>
- gflags: version 2.1.0
- Build system configuration using CMake instead of autotools
- CPack packaging support for Debian/Ubuntu, Red Hat, and Mac OS X
- Fixed issue 54: Fix "invalid suffix on literal" (C++11)
- Fixed issue 57: Use _strdup instead of strdup on Windows
- Fixed issue 62: Change all preprocessor include guards to start with GFLAGS_
- Fixed issue 64: Add DEFINE_validator macro
- Fixed issue 73: Warnings in Visual Studio 2010 and unable to compile unit test
* Wed Jan 25 2012 - Google Inc. <google-gflags@googlegroups.com>
- gflags: version 2.0
- Changed the 'official' gflags email in setup.py/etc
- Renamed google-gflags.sln to gflags.sln
- Changed copyright text to reflect Google's relinquished ownership
* Tue Dec 20 2011 - Google Inc. <opensource@google.com>
- google-gflags: version 1.7
- Add CommandLineFlagInfo::flag_ptr pointing to current storage (musji)
- PORTING: flush after writing to stderr, needed on cygwin
- PORTING: Clean up the GFLAGS_DLL_DECL stuff better
- Fix a bug in StringPrintf() that affected large strings (csilvers)
- Die at configure-time when g++ isn't installed
* Fri Jul 29 2011 - Google Inc. <opensource@google.com>
- google-gflags: version 1.6
- BUGFIX: Fix a bug where we were leaving out a required $(top_srcdir)
- Fix definition of clstring (jyrki)
- Split up flag declares into its own file (jyrki)
- Add --version support (csilvers)
- Update the README for gflags with static libs
- Update acx_pthread.m4 for nostdlib
- Change ReparseCommandLineFlags to return void (csilvers)
- Some doc typofixes and example augmentation (various)
* Mon Jan 24 2011 - Google Inc. <opensource@google.com>
- google-gflags: version 1.5
- Better reporting of current vs default value (handler)
- Add API for cleaning up of memory at program-exit (jmarantz)
- Fix macros to work inside namespaces (csilvers)
- Use our own string typedef in case string is redefined (csilvers)
- Updated to autoconf 2.65
* Wed Oct 13 2010 - Google Inc. <opensource@google.com>
- google-gflags: version 1.4
- Add a check to prevent passing 0 to DEFINE_string (jorg)
- Reduce compile (.o) size (jyrki)
- Some small changes to quiet debug compiles (alexk)
- PORTING: better support static linking on windows (csilvers)
- DOCUMENTATION: change default values, use validators, etc.
- Update the NEWS file to be non-empty
- Add pkg-config (.pc) files for libgflags and libgflags_nothreads
* Mon Jan 4 2010 - Google Inc. <opensource@google.com>
- google-gflags: version 1.3
- PORTABILITY: can now build and run tests under MSVC (csilvers)
- Remove the python gflags code, which is now its own package (tansell)
- Clarify that "last flag wins" in the docs (csilvers)
- Comment danger of using GetAllFlags in validators (wojtekm)
- PORTABILITY: Some fixes necessary for c++0x (mboerger)
- Makefile fix: $(srcdir) -> $(top_srcdir) in one place (csilvres)
- INSTALL: autotools to autoconf v2.64 + automake v1.11 (csilvers)
* Thu Sep 10 2009 - Google Inc. <opensource@google.com>
- google-gflags: version 1.2
- PORTABILITY: can now build and run tests under mingw (csilvers)
- Using a string arg for a bool flag is a compile-time error (rbayardo)
- Add --helpxml to gflags.py (salcianu)
- Protect against a hypothetical global d'tor mutex problem (csilvers)
- BUGFIX: can now define a flag after 'using namespace google' (hamaji)
* Tue Apr 14 2009 - Google Inc. <opensource@google.com>
- google-gflags: version 1.1
- Add both foo and nofoo for boolean flags, with --undefok (andychu)
- Better document how validators work (wojtekm)
- Improve binary-detection for bash-completion (mtamsky)
- Python: Add a concept of "key flags", used with --help (salcianu)
- Python: Robustify flag_values (salcianu)
- Python: Add a new DEFINE_bool alias (keir, andrewliu)
- Python: Do module introspection based on module name (dsturtevant)
- Fix autoconf a bit better, especially on windows and solaris (ajenjo)
- BUG FIX: gflags_nothreads was linking against the wrong lib (ajenjo)
- BUG FIX: threads-detection failed on FreeBSD; replace it (ajenjo)
- PORTABILITY: Quiet an internal compiler error with SUSE 10 (csilvers)
- PORTABILITY: Update deb.sh for more recenty debuilds (csilvers)
- PORTABILITY: #include more headers to satify new gcc's (csilvers)
- INSTALL: Updated to autoconf 2.61 and libtool 1.5.26 (csilvers)
* Fri Oct 3 2008 - Google Inc. <opensource@google.com>
- google-gflags: version 1.0
- Add a missing newline to an error string (bcmills)
- (otherwise exactly the same as gflags 1.0rc2)
* Thu Sep 18 2008 - Google Inc. <opensource@google.com>
- google-gflags: version 1.0rc2
- Report current flag values in --helpxml (hdn)
- Fix compilation troubles with gcc 4.3.3 (simonb)
- BUG FIX: I was missing a std:: in DECLARE_string (csilvers)
- BUG FIX: Clarify in docs how to specify --bool flags (csilvers)
- BUG FIX: Fix --helpshort for source files not in a subdir (csilvers)
- BUG FIX: Fix python unittest for 64-bit builds (bcmills)
* Tue Aug 19 2008 - Google Inc. <opensource@google.com>
- google-gflags: version 1.0rc1
- Move #include files from google/ to gflags/ (csilvers)
- Small optimizations to reduce binary (library) size (jyrki)
- BUGFIX: forgot a std:: in one of the .h files (csilvers)
- Speed up locking by making sure calls are inlined (ajenjo)
- 64-BIT COMPATIBILITY: Use %PRId64 instead of %lld (csilvers)
- PORTABILITY: fix Makefile to work with Cygwin (ajenjo)
- PORTABILITY: fix code to compile under Visual Studio (ajenjo)
- PORTABILITY: fix code to compile under Solaris 10 with CC (csilvers)
* Mon Jul 21 2008 - Google Inc. <opensource@google.com>
- google-gflags: version 0.9
- Add the ability to validate a command-line flag (csilvers)
- Add completion support for commandline flags in bash (daven)
- Add -W compile flags to Makefile, when using gcc (csilvers)
- Allow helpstring to be NULL (cristianoc)
- Improved documentation of classes in the .cc file (csilvers)
- Fix python bug with AppendFlagValues + shortnames (jjtswan)
- Use bool instead of int for boolean flags in gflags.py (bcmills)
- Simplify the way we declare flags, now more foolproof (csilvers)
- Better error messages when bool flags collide (colohan)
- Only evaluate DEFINE_foo macro args once (csilvers)
* Wed Mar 26 2008 - Google Inc. <opensource@google.com>
- google-gflags: version 0.8
- Export DescribeOneFlag() in the API
- Add support for automatic line wrapping at 80 cols for gflags.py
- Bugfix: do not treat an isolated "-" the same as an isolated "--"
- Update rpm spec to point to Google Code rather than sourceforge (!)
- Improve documentation (including documenting thread-safety)
- Improve #include hygiene
- Improve testing
* Thu Oct 18 2007 - Google Inc. <opensource@google.com>
- google-gflags: version 0.7
- Deal even more correctly with libpthread not linked in (csilvers)
- Add STRIP_LOG, an improved DO_NOT_SHOW_COMMANDLINE_HELP (sioffe)
- Be more accurate printing default flag values in --help (dsturtevant)
- Reduce .o file size a bit by using shorter namespace names (jeff)
- Use relative install path, so 'setup.py --home' works (csilvers)
- Notice when a boolean flag has a non-boolean default (bnmouli)
- Broaden --helpshort to match foo-main.cc and foo_main.cc (hendrie)
- Fix "no modules match" message for --helpshort, etc (hendrie)
* Wed Aug 15 2007 - Google Inc. <opensource@google.com>
- google-gflags: version 0.6
- Deal correctly with case that libpthread is not linked in (csilvers)
- Update Makefile/tests so we pass "make distcheck" (csilvers)
- Document and test that last assignment to a flag wins (wan)
* Tue Jun 12 2007 - Google Inc. <opensource@google.com>
- google-gflags: version 0.5
- Include all m4 macros in the distribution (csilvers)
- Python: Fix broken data_files field in setup.py (sidlon)
- Python: better string serliaizing and unparsing (abo, csimmons)
- Fix checks for NaN and inf to work with Mac OS X (csilvers)
* Thu Apr 19 2007 - Google Inc. <opensource@google.com>
- google-gflags: version 0.4
- Remove is_default from GetCommandLineFlagInfo (csilvers)
- Portability fixes: includes, strtoll, gcc4.3 errors (csilvers)
- A few doc typo cleanups (csilvers)
* Wed Mar 28 2007 - Google Inc. <opensource@google.com>
- google-gflags: version 0.3
- python portability fix: use popen instead of subprocess (csilvers)
- Add is_default to CommandLineFlagInfo (pchien)
- Make docs a bit prettier (csilvers)
- Actually include the python files in the distribution! :-/ (csilvers)
* Mon Jan 22 2007 - Google Inc. <opensource@google.com>
- google-gflags: version 0.2
- added support for python commandlineflags, as well as c++
- gflags2man, a script to turn flags into a man page (dchristian)
* Wed Dec 13 2006 - Google Inc. <opensource@google.com>
- google-gflags: version 0.1

View File

@@ -1,86 +1,4 @@
=== 30 March 2014 === == 25 January 2012 ==
I've just released gflags 2.1.1.
This release fixes a few bugs in the configuration of gflags_declare.h
and adds a separate GFLAGS_INCLUDE_DIR CMake variable to the build configuration.
Setting GFLAGS_NAMESPACE to "google" no longer changes also the include
path of the public header files. This allows the use of the library with
other Google projects such as glog which still use the deprecated "google"
namespace for the gflags library, but include it as "gflags/gflags.h".
=== 20 March 2014 ===
I've just released gflags 2.1.
The major changes are the use of CMake for the build configuration instead
of the autotools and packaging support through CPack. The default namespace
of all C++ symbols is now "gflags" instead of "google". This can be
configured via the GFLAGS_NAMESPACE variable.
This release compiles with all major compilers without warnings and passed
the unit tests on Ubuntu 12.04, Windows 7 (Visual Studio 2008 and 2010,
Cygwin, MinGW), and Mac OS X (Xcode 5.1).
The SVN repository on Google Code is now frozen and replaced by a Git
repository such that it can be used as Git submodule by projects. The main
hosting of this project remains at Google Code. Thanks to the distributed
character of Git, I can push (and pull) changes from both GitHub and Google Code
in order to keep the two public repositories in sync.
When fixing an issue for a pull request through either of these hosting
platforms, please reference the issue number as
[https://code.google.com/p/support/wiki/IssueTracker#Integration_with_version_control described here].
For the further development, I am following the
[http://nvie.com/posts/a-successful-git-branching-model/ Git branching model]
with feature branch names prefixed by "feature/" and bugfix branch names
prefixed by "bugfix/", respectively.
Binary and source [https://github.com/schuhschuh/gflags/releases packages] are available on GitHub.
=== 14 January 2013 ===
The migration of the build system to CMake is almost complete.
What remains to be done is rewriting the tests in Python such they can be
executed on non-Unix platforms and splitting them up into separate CTest tests.
Though merging these changes into the master branch yet remains to be done,
it is recommended to already start using the
[https://github.com/schuhschuh/gflags/tree/cmake-migration cmake-migration] branch.
=== 20 April 2013 ===
More than a year has past since I (Andreas) took over the maintenance for
`gflags`. Only few minor changes have been made since then, much to my regret.
To get more involved and stimulate participation in the further
development of the library, I moved the project source code today to
[https://github.com/schuhschuh/gflags GitHub].
I believe that the strengths of [http://git-scm.com/ Git] will allow for better community collaboration
as well as ease the integration of changes made by others. I encourage everyone
who would like to contribute to send me pull requests.
Git's lightweight feature branches will also provide the right tool for more
radical changes which should only be merged back into the master branch
after these are complete and implement the desired behavior.
The SVN repository remains accessible at Google Code and I will keep the
master branch of the Git repository hosted at GitHub and the trunk of the
Subversion repository synchronized. Initially, I was going to simply switch the
Google Code project to Git, but in this case the SVN repository would be
frozen and force everyone who would like the latest development changes to
use Git as well. Therefore I decided to host the public Git repository at GitHub
instead.
Please continue to report any issues with gflags on Google Code. The GitHub project will
only be used to host the Git repository.
One major change of the project structure I have in mind for the next weeks
is the migration from autotools to [http://www.cmake.org/ CMake].
Check out the (unstable!)
[https://github.com/schuhschuh/gflags/tree/cmake-migration cmake-migration]
branch on GitHub for details.
=== 25 January 2012 ===
I've just released gflags 2.0. I've just released gflags 2.0.

View File

@@ -1,18 +1,16 @@
Project: Google Flags Project: Google Flags
URL: http://code.google.com/p/google-gflags/ URL: http://code.google.com/p/google-gflags/
License: New BSD License: New BSD
Upstream version: 2.1.1 Upstream version: 2.0
Local modifications: Local modifications:
- Flattened the tree and only included files needed for libmv. - Flattened the tree and only included files needed for libmv. This involved
changing some of the includes to point to the current directory instead of a
nested gflags directory.
- config.h was originally generated on linux machine with some - Added a poor-man's version of upstream's port.cc/h to make gflags compile on
further tweaks: windows. This isn't sufficient but is a stopgap for now.
* OS_WINDOWS need to be conditinally defined from inside #ifdef WIN32 - Added -fPIC flag, so shared libraries from Ceres could be linked against static glog
* Same applies yo HAVE_SHLWAPI_H
* Disabeld HAVE_FNMATCH_H
- Removed attribute(unused) from FlagSaver.
TODO(keir): Import and use gflags for Windows from upstream. TODO(keir): Import and use gflags for Windows from upstream.

View File

@@ -1,117 +1,101 @@
/* Generated from config.h.in during build configuration using CMake. */ /* src/config.h. Generated from config.h.in by configure. */
/* src/config.h.in. Generated from configure.ac by autoheader. */
// Note: This header file is only used internally. It is not part of public interface! /* Always the empty-string on non-windows systems. On windows, should be
"__declspec(dllexport)". This way, when we compile the dll, we export our
functions/classes. It's safe to define this here because config.h is only
used internally, to compile the DLL, and every DLL source file #includes
"config.h" before anything else. */
#define GFLAGS_DLL_DECL /**/
// --------------------------------------------------------------------------- /* Namespace for Google classes */
// System checks #define GOOGLE_NAMESPACE ::google
// Define if you build this library for a MS Windows OS. /* Define to 1 if you have the <dlfcn.h> header file. */
#ifdef WIN32 #define HAVE_DLFCN_H 1
# define OS_WINDOWS
#endif
// Define if you have the <stdint.h> header file. /* Define to 1 if you have the <fnmatch.h> header file. */
#define HAVE_STDINT_H /* #ubdef HAVE_FNMATCH_H 1 */
// Define if you have the <sys/types.h> header file. /* Define to 1 if you have the <inttypes.h> header file. */
#define HAVE_SYS_TYPES_H #define HAVE_INTTYPES_H 1
// Define if you have the <inttypes.h> header file. /* Define to 1 if you have the <memory.h> header file. */
#define HAVE_INTTYPES_H #define HAVE_MEMORY_H 1
// Define if you have the <sys/stat.h> header file. /* define if the compiler implements namespaces */
#define HAVE_SYS_STAT_H #define HAVE_NAMESPACES 1
// Define if you have the <unistd.h> header file. /* Define if you have POSIX threads libraries and header files. */
#define HAVE_UNISTD_H #define HAVE_PTHREAD 1
// Define if you have the <fnmatch.h> header file. /* Define to 1 if you have the <stdint.h> header file. */
/* #undef HAVE_FNMATCH_H */ #define HAVE_STDINT_H 1
// Define if you have the <shlwapi.h> header file (Windows 2000/XP). /* Define to 1 if you have the <stdlib.h> header file. */
#undef HAVE_SHLWAPI_H #define HAVE_STDLIB_H 1
// Define if you have the strtoll function. /* Define to 1 if you have the <strings.h> header file. */
#define HAVE_STRTOLL #define HAVE_STRINGS_H 1
// Define if you have the strtoq function. /* Define to 1 if you have the <string.h> header file. */
/* #undef HAVE_STRTOQ */ #define HAVE_STRING_H 1
// Define if you have the <pthread.h> header file. /* Define to 1 if you have the `strtoll' function. */
#define HAVE_PTHREAD #define HAVE_STRTOLL 1
// Define if your pthread library defines the type pthread_rwlock_t /* Define to 1 if you have the `strtoq' function. */
#define HAVE_RWLOCK #define HAVE_STRTOQ 1
// gcc requires this to get PRId64, etc. /* Define to 1 if you have the <sys/stat.h> header file. */
#if defined(HAVE_INTTYPES_H) && !defined(__STDC_FORMAT_MACROS) #define HAVE_SYS_STAT_H 1
# define __STDC_FORMAT_MACROS 1
#endif
// --------------------------------------------------------------------------- /* Define to 1 if you have the <sys/types.h> header file. */
// Package information #define HAVE_SYS_TYPES_H 1
// Name of package. /* Define to 1 if you have the <unistd.h> header file. */
#define PACKAGE gflags #define HAVE_UNISTD_H 1
// Define to the full name of this package. /* define if your compiler has __attribute__ */
#define PACKAGE_NAME gflags #define HAVE___ATTRIBUTE__ 1
// Define to the full name and version of this package. /* Define to the sub-directory in which libtool stores uninstalled libraries.
#define PACKAGE_STRING gflags 2.1.1 */
#define LT_OBJDIR ".libs/"
// Define to the one symbol short name of this package. /* Name of package */
#define PACKAGE_TARNAME gflags-2.1.1 #define PACKAGE "gflags"
// Define to the version of this package. /* Define to the address where bug reports for this package should be sent. */
#define PACKAGE_VERSION 2.1.1 #define PACKAGE_BUGREPORT "google-gflags@googlegroups.com"
// Version number of package. /* Define to the full name of this package. */
#define VERSION PACKAGE_VERSION #define PACKAGE_NAME "gflags"
// Define to the address where bug reports for this package should be sent. /* Define to the full name and version of this package. */
#define PACKAGE_BUGREPORT https://code.google.com/p/gflags/issues/ #define PACKAGE_STRING "gflags 2.0"
// Namespace of gflags library symbols. /* Define to the one symbol short name of this package. */
#define GFLAGS_NAMESPACE gflags #define PACKAGE_TARNAME "gflags"
// --------------------------------------------------------------------------- /* Define to the version of this package. */
// Path separator #define PACKAGE_VERSION "2.0"
#ifndef PATH_SEPARATOR
# ifdef OS_WINDOWS
# define PATH_SEPARATOR '\\'
# else
# define PATH_SEPARATOR '/'
# endif
#endif
// --------------------------------------------------------------------------- /* Define to necessary symbol if this constant uses a non-standard name on
// Windows your system. */
/* #undef PTHREAD_CREATE_JOINABLE */
// Whether gflags library is a DLL. /* Define to 1 if you have the ANSI C header files. */
#ifndef GFLAGS_IS_A_DLL #define STDC_HEADERS 1
# define GFLAGS_IS_A_DLL 0
#endif
// Always export symbols when compiling a shared library as this file is only /* the namespace where STL code like vector<> is defined */
// included by internal modules when building the gflags library itself. #define STL_NAMESPACE std
// The gflags_declare.h header file will set it to import these symbols otherwise.
#ifndef GFLAGS_DLL_DECL
# if GFLAGS_IS_A_DLL && defined(_MSC_VER)
# define GFLAGS_DLL_DECL __declspec(dllexport)
# else
# define GFLAGS_DLL_DECL
# endif
#endif
// Flags defined by the gflags library itself must be exported
#ifndef GFLAGS_DLL_DEFINE_FLAG
# define GFLAGS_DLL_DEFINE_FLAG GFLAGS_DLL_DECL
#endif
#ifdef OS_WINDOWS /* Version number of package */
// The unittests import the symbols of the shared gflags library #define VERSION "2.0"
# if GFLAGS_IS_A_DLL && defined(_MSC_VER)
# define GFLAGS_DLL_DECL_FOR_UNITTESTS __declspec(dllimport) /* Stops putting the code inside the Google namespace */
# endif #define _END_GOOGLE_NAMESPACE_ }
# include "windows_port.h"
#endif /* Puts following code inside the Google namespace */
#define _START_GOOGLE_NAMESPACE_ namespace google {

View File

@@ -87,16 +87,18 @@
// other hand, hooks into CommandLineFlagParser. Other API functions // other hand, hooks into CommandLineFlagParser. Other API functions
// are, similarly, mostly hooks into the functionality described above. // are, similarly, mostly hooks into the functionality described above.
// This comes first to ensure we define __STDC_FORMAT_MACROS in time.
#include "config.h" #include "config.h"
#include "gflags.h" #if defined(HAVE_INTTYPES_H) && !defined(__STDC_FORMAT_MACROS)
# define __STDC_FORMAT_MACROS 1 // gcc requires this to get PRId64, etc.
#endif
#include "gflags/gflags.h"
#include <assert.h> #include <assert.h>
#include <ctype.h> #include <ctype.h>
#include <errno.h> #include <errno.h>
#if defined(HAVE_FNMATCH_H) #ifdef HAVE_FNMATCH_H
# include <fnmatch.h> # include <fnmatch.h>
#elif defined(HAVE_SHLWAPI_H)
# include <shlwapi.h>
#endif #endif
#include <stdarg.h> // For va_list and related operations #include <stdarg.h> // For va_list and related operations
#include <stdio.h> #include <stdio.h>
@@ -107,23 +109,31 @@
#include <string> #include <string>
#include <utility> // for pair<> #include <utility> // for pair<>
#include <vector> #include <vector>
#include "mutex.h" #include "mutex.h"
#include "util.h" #include "util.h"
#ifndef PATH_SEPARATOR
#define PATH_SEPARATOR '/'
#endif
// Special flags, type 1: the 'recursive' flags. They set another flag's val. // Special flags, type 1: the 'recursive' flags. They set another flag's val.
DEFINE_string(flagfile, "", "load flags from file"); DEFINE_string(flagfile, "",
DEFINE_string(fromenv, "", "set flags from the environment" "load flags from file");
DEFINE_string(fromenv, "",
"set flags from the environment"
" [use 'export FLAGS_flag1=value']"); " [use 'export FLAGS_flag1=value']");
DEFINE_string(tryfromenv, "", "set flags from the environment if present"); DEFINE_string(tryfromenv, "",
"set flags from the environment if present");
// Special flags, type 2: the 'parsing' flags. They modify how we parse. // Special flags, type 2: the 'parsing' flags. They modify how we parse.
DEFINE_string(undefok, "", "comma-separated list of flag names that it is okay to specify " DEFINE_string(undefok, "",
"comma-separated list of flag names that it is okay to specify "
"on the command line even if the program does not define a flag " "on the command line even if the program does not define a flag "
"with that name. IMPORTANT: flags in this list that have " "with that name. IMPORTANT: flags in this list that have "
"arguments MUST use the flag=value format"); "arguments MUST use the flag=value format");
namespace GFLAGS_NAMESPACE { _START_GOOGLE_NAMESPACE_
using std::map; using std::map;
using std::pair; using std::pair;
@@ -196,7 +206,7 @@ class FlagValue {
private: private:
friend class CommandLineFlag; // for many things, including Validate() friend class CommandLineFlag; // for many things, including Validate()
friend class GFLAGS_NAMESPACE::FlagSaverImpl; // calls New() friend class GOOGLE_NAMESPACE::FlagSaverImpl; // calls New()
friend class FlagRegistry; // checks value_buffer_ for flags_by_ptr_ map friend class FlagRegistry; // checks value_buffer_ for flags_by_ptr_ map
template <typename T> friend T GetFromEnv(const char*, const char*, T); template <typename T> friend T GetFromEnv(const char*, const char*, T);
friend bool TryParseLocked(const CommandLineFlag*, FlagValue*, friend bool TryParseLocked(const CommandLineFlag*, FlagValue*,
@@ -396,7 +406,8 @@ const char* FlagValue::TypeName() const {
assert(false); assert(false);
return ""; return "";
} }
// Directly indexing the strings in the 'types' string, each of them is 7 bytes long. // Directly indexing the strigns in the 'types' string, each of them
// is 7 bytes long.
return &types[type_ * 7]; return &types[type_ * 7];
} }
@@ -493,7 +504,7 @@ class CommandLineFlag {
private: private:
// for SetFlagLocked() and setting flags_by_ptr_ // for SetFlagLocked() and setting flags_by_ptr_
friend class FlagRegistry; friend class FlagRegistry;
friend class GFLAGS_NAMESPACE::FlagSaverImpl; // for cloning the values friend class GOOGLE_NAMESPACE::FlagSaverImpl; // for cloning the values
// set validate_fn // set validate_fn
friend bool AddFlagValidator(const void*, ValidateFnProto); friend bool AddFlagValidator(const void*, ValidateFnProto);
@@ -660,9 +671,9 @@ class FlagRegistry {
static FlagRegistry* GlobalRegistry(); // returns a singleton registry static FlagRegistry* GlobalRegistry(); // returns a singleton registry
private: private:
friend class GFLAGS_NAMESPACE::FlagSaverImpl; // reads all the flags in order to copy them friend class GOOGLE_NAMESPACE::FlagSaverImpl; // reads all the flags in order to copy them
friend class CommandLineFlagParser; // for ValidateAllFlags friend class CommandLineFlagParser; // for ValidateAllFlags
friend void GFLAGS_NAMESPACE::GetAllFlags(vector<CommandLineFlagInfo>*); friend void GOOGLE_NAMESPACE::GetAllFlags(vector<CommandLineFlagInfo>*);
// The map from name to flag, for FindFlagLocked(). // The map from name to flag, for FindFlagLocked().
typedef map<const char*, CommandLineFlag*, StringCmp> FlagMap; typedef map<const char*, CommandLineFlag*, StringCmp> FlagMap;
@@ -992,8 +1003,8 @@ static string ReadFileIntoString(const char* filename) {
const int kBufSize = 8092; const int kBufSize = 8092;
char buffer[kBufSize]; char buffer[kBufSize];
string s; string s;
FILE* fp; FILE* fp = fopen(filename, "r");
if ((errno = SafeFOpen(&fp, filename, "r")) != 0) PFATAL(filename); if (!fp) PFATAL(filename);
size_t n; size_t n;
while ( (n=fread(buffer, 1, kBufSize, fp)) > 0 ) { while ( (n=fread(buffer, 1, kBufSize, fp)) > 0 ) {
if (ferror(fp)) PFATAL(filename); if (ferror(fp)) PFATAL(filename);
@@ -1137,8 +1148,8 @@ string CommandLineFlagParser::ProcessFromenvLocked(const string& flagval,
} }
const string envname = string("FLAGS_") + string(flagname); const string envname = string("FLAGS_") + string(flagname);
string envval; const char* envval = getenv(envname.c_str());
if (!SafeGetEnv(envname.c_str(), envval)) { if (!envval) {
if (errors_are_fatal) { if (errors_are_fatal) {
error_flags_[flagname] = (string(kError) + envname + error_flags_[flagname] = (string(kError) + envname +
" not found in environment\n"); " not found in environment\n");
@@ -1147,14 +1158,15 @@ string CommandLineFlagParser::ProcessFromenvLocked(const string& flagval,
} }
// Avoid infinite recursion. // Avoid infinite recursion.
if (envval == "fromenv" || envval == "tryfromenv") { if ((strcmp(envval, "fromenv") == 0) ||
(strcmp(envval, "tryfromenv") == 0)) {
error_flags_[flagname] = error_flags_[flagname] =
StringPrintf("%sinfinite recursion on environment flag '%s'\n", StringPrintf("%sinfinite recursion on environment flag '%s'\n",
kError, envval.c_str()); kError, envval);
continue; continue;
} }
msg += ProcessSingleOptionLocked(flag, envval.c_str(), set_mode); msg += ProcessSingleOptionLocked(flag, envval, set_mode);
} }
return msg; return msg;
} }
@@ -1306,12 +1318,13 @@ string CommandLineFlagParser::ProcessOptionsFromStringLocked(
// We try matching both against the full argv0 and basename(argv0) // We try matching both against the full argv0 and basename(argv0)
if (glob == ProgramInvocationName() // small optimization if (glob == ProgramInvocationName() // small optimization
|| glob == ProgramInvocationShortName() || glob == ProgramInvocationShortName()
#if defined(HAVE_FNMATCH_H) #ifdef HAVE_FNMATCH_H
|| fnmatch(glob.c_str(), ProgramInvocationName(), FNM_PATHNAME) == 0 || fnmatch(glob.c_str(),
|| fnmatch(glob.c_str(), ProgramInvocationShortName(), FNM_PATHNAME) == 0 ProgramInvocationName(),
#elif defined(HAVE_SHLWAPI_H) FNM_PATHNAME) == 0
|| PathMatchSpec(glob.c_str(), ProgramInvocationName()) || fnmatch(glob.c_str(),
|| PathMatchSpec(glob.c_str(), ProgramInvocationShortName()) ProgramInvocationShortName(),
FNM_PATHNAME) == 0
#endif #endif
) { ) {
flags_are_relevant = true; flags_are_relevant = true;
@@ -1333,15 +1346,14 @@ string CommandLineFlagParser::ProcessOptionsFromStringLocked(
template<typename T> template<typename T>
T GetFromEnv(const char *varname, const char* type, T dflt) { T GetFromEnv(const char *varname, const char* type, T dflt) {
std::string valstr; const char* const valstr = getenv(varname);
if (SafeGetEnv(varname, valstr)) { if (!valstr)
return dflt;
FlagValue ifv(new T, type, true); FlagValue ifv(new T, type, true);
if (!ifv.ParseFrom(valstr.c_str())) { if (!ifv.ParseFrom(valstr))
ReportError(DIE, "ERROR: error parsing env variable '%s' with value '%s'\n", ReportError(DIE, "ERROR: error parsing env variable '%s' with value '%s'\n",
varname, valstr.c_str()); varname, valstr);
}
return OTHER_VALUE_AS(ifv, T); return OTHER_VALUE_AS(ifv, T);
} else return dflt;
} }
bool AddFlagValidator(const void* flag_ptr, ValidateFnProto validate_fn_proto) { bool AddFlagValidator(const void* flag_ptr, ValidateFnProto validate_fn_proto) {
@@ -1753,8 +1765,8 @@ bool ReadFlagsFromString(const string& flagfilecontents,
// TODO(csilvers): nix prog_name in favor of ProgramInvocationShortName() // TODO(csilvers): nix prog_name in favor of ProgramInvocationShortName()
bool AppendFlagsIntoFile(const string& filename, const char *prog_name) { bool AppendFlagsIntoFile(const string& filename, const char *prog_name) {
FILE *fp; FILE *fp = fopen(filename.c_str(), "a");
if (SafeFOpen(&fp, filename.c_str(), "a") != 0) { if (!fp) {
return false; return false;
} }
@@ -1812,18 +1824,10 @@ uint64 Uint64FromEnv(const char *v, uint64 dflt) {
double DoubleFromEnv(const char *v, double dflt) { double DoubleFromEnv(const char *v, double dflt) {
return GetFromEnv(v, "double", dflt); return GetFromEnv(v, "double", dflt);
} }
#ifdef _MSC_VER
# pragma warning(push)
# pragma warning(disable: 4996) // ignore getenv security warning
#endif
const char *StringFromEnv(const char *varname, const char *dflt) { const char *StringFromEnv(const char *varname, const char *dflt) {
const char* const val = getenv(varname); const char* const val = getenv(varname);
return val ? val : dflt; return val ? val : dflt;
} }
#ifdef _MSC_VER
# pragma warning(pop)
#endif
// -------------------------------------------------------------------- // --------------------------------------------------------------------
@@ -1953,5 +1957,4 @@ void ShutDownCommandLineFlags() {
FlagRegistry::DeleteGlobalRegistry(); FlagRegistry::DeleteGlobalRegistry();
} }
_END_GOOGLE_NAMESPACE_
} // namespace GFLAGS_NAMESPACE

View File

@@ -75,26 +75,21 @@
// other thread is writing to the variable or calling non-const // other thread is writing to the variable or calling non-const
// methods of this class. // methods of this class.
#ifndef GFLAGS_GFLAGS_H_ #ifndef BASE_COMMANDLINEFLAGS_H_
#define GFLAGS_GFLAGS_H_ #define BASE_COMMANDLINEFLAGS_H_
#include <string> #include <string>
#include <vector> #include <vector>
#include "gflags_declare.h" // IWYU pragma: export #include "gflags_declare.h" // IWYU pragma: export
namespace google {
//
// We always want to export variables defined in user code // NOTE: all functions below MUST have an explicit 'extern' before
#ifndef GFLAGS_DLL_DEFINE_FLAG // them. Our automated opensourcing tools use this as a signal to do
# if 0 && defined(_MSC_VER) // appropriate munging for windows, which needs to add GFLAGS_DLL_DECL.
# define GFLAGS_DLL_DEFINE_FLAG __declspec(dllexport) //
# else #define GFLAGS_DLL_DECL /* rewritten to be non-empty in windows dir */
# define GFLAGS_DLL_DEFINE_FLAG #define GFLAGS_DLL_DEFINE_FLAG /* rewritten to be non-empty in windows dir */
# endif
#endif
namespace gflags {
// -------------------------------------------------------------------- // --------------------------------------------------------------------
@@ -126,17 +121,19 @@ namespace gflags {
// Returns true if successfully registered, false if not (because the // Returns true if successfully registered, false if not (because the
// first argument doesn't point to a command-line flag, or because a // first argument doesn't point to a command-line flag, or because a
// validator is already registered for this flag). // validator is already registered for this flag).
extern GFLAGS_DLL_DECL bool RegisterFlagValidator(const bool* flag, bool (*validate_fn)(const char*, bool)); extern bool RegisterFlagValidator(const bool* flag,
extern GFLAGS_DLL_DECL bool RegisterFlagValidator(const int32* flag, bool (*validate_fn)(const char*, int32)); bool (*validate_fn)(const char*, bool));
extern GFLAGS_DLL_DECL bool RegisterFlagValidator(const int64* flag, bool (*validate_fn)(const char*, int64)); extern bool RegisterFlagValidator(const int32* flag,
extern GFLAGS_DLL_DECL bool RegisterFlagValidator(const uint64* flag, bool (*validate_fn)(const char*, uint64)); bool (*validate_fn)(const char*, int32));
extern GFLAGS_DLL_DECL bool RegisterFlagValidator(const double* flag, bool (*validate_fn)(const char*, double)); extern bool RegisterFlagValidator(const int64* flag,
extern GFLAGS_DLL_DECL bool RegisterFlagValidator(const std::string* flag, bool (*validate_fn)(const char*, const std::string&)); bool (*validate_fn)(const char*, int64));
extern bool RegisterFlagValidator(const uint64* flag,
// Convenience macro for the registration of a flag validator bool (*validate_fn)(const char*, uint64));
#define DEFINE_validator(name, validator) \ extern bool RegisterFlagValidator(const double* flag,
static const bool name##_validator_registered = \ bool (*validate_fn)(const char*, double));
gflags::RegisterFlagValidator(&FLAGS_##name, validator) extern bool RegisterFlagValidator(const std::string* flag,
bool (*validate_fn)(const char*,
const std::string&));
// -------------------------------------------------------------------- // --------------------------------------------------------------------
@@ -149,9 +146,8 @@ extern GFLAGS_DLL_DECL bool RegisterFlagValidator(const std::string* flag, bool
// In addition to accessing flags, you can also access argv[0] (the program // In addition to accessing flags, you can also access argv[0] (the program
// name) and argv (the entire commandline), which we sock away a copy of. // name) and argv (the entire commandline), which we sock away a copy of.
// These variables are static, so you should only set them once. // These variables are static, so you should only set them once.
//
// No need to export this data only structure from DLL, avoiding VS warning 4251. struct GFLAGS_DLL_DECL CommandLineFlagInfo {
struct CommandLineFlagInfo {
std::string name; // the name of the flag std::string name; // the name of the flag
std::string type; // the type of the flag: int32, etc std::string type; // the type of the flag: int32, etc
std::string description; // the "help text" associated with the flag std::string description; // the "help text" associated with the flag
@@ -170,34 +166,34 @@ struct CommandLineFlagInfo {
// call validators during ParseAllFlags. // call validators during ParseAllFlags.
// Also make sure then to uncomment the corresponding unit test in // Also make sure then to uncomment the corresponding unit test in
// gflags_unittest.sh // gflags_unittest.sh
extern GFLAGS_DLL_DECL void GetAllFlags(std::vector<CommandLineFlagInfo>* OUTPUT); extern void GetAllFlags(std::vector<CommandLineFlagInfo>* OUTPUT);
// These two are actually defined in gflags_reporting.cc. // These two are actually defined in gflags_reporting.cc.
extern GFLAGS_DLL_DECL void ShowUsageWithFlags(const char *argv0); // what --help does extern void ShowUsageWithFlags(const char *argv0); // what --help does
extern GFLAGS_DLL_DECL void ShowUsageWithFlagsRestrict(const char *argv0, const char *restrict); extern void ShowUsageWithFlagsRestrict(const char *argv0, const char *restrict);
// Create a descriptive string for a flag. // Create a descriptive string for a flag.
// Goes to some trouble to make pretty line breaks. // Goes to some trouble to make pretty line breaks.
extern GFLAGS_DLL_DECL std::string DescribeOneFlag(const CommandLineFlagInfo& flag); extern std::string DescribeOneFlag(const CommandLineFlagInfo& flag);
// Thread-hostile; meant to be called before any threads are spawned. // Thread-hostile; meant to be called before any threads are spawned.
extern GFLAGS_DLL_DECL void SetArgv(int argc, const char** argv); extern void SetArgv(int argc, const char** argv);
// The following functions are thread-safe as long as SetArgv() is // The following functions are thread-safe as long as SetArgv() is
// only called before any threads start. // only called before any threads start.
extern GFLAGS_DLL_DECL const std::vector<std::string>& GetArgvs(); extern const std::vector<std::string>& GetArgvs();
extern GFLAGS_DLL_DECL const char* GetArgv(); // all of argv as a string extern const char* GetArgv(); // all of argv as a string
extern GFLAGS_DLL_DECL const char* GetArgv0(); // only argv0 extern const char* GetArgv0(); // only argv0
extern GFLAGS_DLL_DECL uint32 GetArgvSum(); // simple checksum of argv extern uint32 GetArgvSum(); // simple checksum of argv
extern GFLAGS_DLL_DECL const char* ProgramInvocationName(); // argv0, or "UNKNOWN" if not set extern const char* ProgramInvocationName(); // argv0, or "UNKNOWN" if not set
extern GFLAGS_DLL_DECL const char* ProgramInvocationShortName(); // basename(argv0) extern const char* ProgramInvocationShortName(); // basename(argv0)
// ProgramUsage() is thread-safe as long as SetUsageMessage() is only // ProgramUsage() is thread-safe as long as SetUsageMessage() is only
// called before any threads start. // called before any threads start.
extern GFLAGS_DLL_DECL const char* ProgramUsage(); // string set by SetUsageMessage() extern const char* ProgramUsage(); // string set by SetUsageMessage()
// VersionString() is thread-safe as long as SetVersionString() is only // VersionString() is thread-safe as long as SetVersionString() is only
// called before any threads start. // called before any threads start.
extern GFLAGS_DLL_DECL const char* VersionString(); // string set by SetVersionString() extern const char* VersionString(); // string set by SetVersionString()
@@ -211,16 +207,17 @@ extern GFLAGS_DLL_DECL const char* VersionString(); // string set
// Return true iff the flagname was found. // Return true iff the flagname was found.
// OUTPUT is set to the flag's value, or unchanged if we return false. // OUTPUT is set to the flag's value, or unchanged if we return false.
extern GFLAGS_DLL_DECL bool GetCommandLineOption(const char* name, std::string* OUTPUT); extern bool GetCommandLineOption(const char* name, std::string* OUTPUT);
// Return true iff the flagname was found. OUTPUT is set to the flag's // Return true iff the flagname was found. OUTPUT is set to the flag's
// CommandLineFlagInfo or unchanged if we return false. // CommandLineFlagInfo or unchanged if we return false.
extern GFLAGS_DLL_DECL bool GetCommandLineFlagInfo(const char* name, CommandLineFlagInfo* OUTPUT); extern bool GetCommandLineFlagInfo(const char* name,
CommandLineFlagInfo* OUTPUT);
// Return the CommandLineFlagInfo of the flagname. exit() if name not found. // Return the CommandLineFlagInfo of the flagname. exit() if name not found.
// Example usage, to check if a flag's value is currently the default value: // Example usage, to check if a flag's value is currently the default value:
// if (GetCommandLineFlagInfoOrDie("foo").is_default) ... // if (GetCommandLineFlagInfoOrDie("foo").is_default) ...
extern GFLAGS_DLL_DECL CommandLineFlagInfo GetCommandLineFlagInfoOrDie(const char* name); extern CommandLineFlagInfo GetCommandLineFlagInfoOrDie(const char* name);
enum GFLAGS_DLL_DECL FlagSettingMode { enum GFLAGS_DLL_DECL FlagSettingMode {
// update the flag's value (can call this multiple times). // update the flag's value (can call this multiple times).
@@ -242,8 +239,9 @@ enum GFLAGS_DLL_DECL FlagSettingMode {
// non-empty else. // non-empty else.
// SetCommandLineOption uses set_mode == SET_FLAGS_VALUE (the common case) // SetCommandLineOption uses set_mode == SET_FLAGS_VALUE (the common case)
extern GFLAGS_DLL_DECL std::string SetCommandLineOption (const char* name, const char* value); extern std::string SetCommandLineOption(const char* name, const char* value);
extern GFLAGS_DLL_DECL std::string SetCommandLineOptionWithMode(const char* name, const char* value, FlagSettingMode set_mode); extern std::string SetCommandLineOptionWithMode(const char* name, const char* value,
FlagSettingMode set_mode);
// -------------------------------------------------------------------- // --------------------------------------------------------------------
@@ -264,8 +262,8 @@ extern GFLAGS_DLL_DECL std::string SetCommandLineOptionWithMode(const char* name
// // without worrying about restoring the FLAG values. // // without worrying about restoring the FLAG values.
// } // }
// //
// Note: This class is marked with GFLAGS_ATTRIBUTE_UNUSED because all // Note: This class is marked with ATTRIBUTE_UNUSED because all the
// the work is done in the constructor and destructor, so in the standard // work is done in the constructor and destructor, so in the standard
// usage example above, the compiler would complain that it's an // usage example above, the compiler would complain that it's an
// unused variable. // unused variable.
// //
@@ -284,23 +282,27 @@ class GFLAGS_DLL_DECL FlagSaver {
FlagSaver(const FlagSaver&); // no copying! FlagSaver(const FlagSaver&); // no copying!
void operator=(const FlagSaver&); void operator=(const FlagSaver&);
}; }
#ifndef _MSC_VER
__attribute__ ((unused))
#endif
;
// -------------------------------------------------------------------- // --------------------------------------------------------------------
// Some deprecated or hopefully-soon-to-be-deprecated functions. // Some deprecated or hopefully-soon-to-be-deprecated functions.
// This is often used for logging. TODO(csilvers): figure out a better way // This is often used for logging. TODO(csilvers): figure out a better way
extern GFLAGS_DLL_DECL std::string CommandlineFlagsIntoString(); extern std::string CommandlineFlagsIntoString();
// Usually where this is used, a FlagSaver should be used instead. // Usually where this is used, a FlagSaver should be used instead.
extern GFLAGS_DLL_DECL extern bool ReadFlagsFromString(const std::string& flagfilecontents,
bool ReadFlagsFromString(const std::string& flagfilecontents,
const char* prog_name, const char* prog_name,
bool errors_are_fatal); // uses SET_FLAGS_VALUE bool errors_are_fatal); // uses SET_FLAGS_VALUE
// These let you manually implement --flagfile functionality. // These let you manually implement --flagfile functionality.
// DEPRECATED. // DEPRECATED.
extern GFLAGS_DLL_DECL bool AppendFlagsIntoFile(const std::string& filename, const char* prog_name); extern bool AppendFlagsIntoFile(const std::string& filename, const char* prog_name);
extern GFLAGS_DLL_DECL bool ReadFromFlagsFile(const std::string& filename, const char* prog_name, bool errors_are_fatal); // uses SET_FLAGS_VALUE extern bool ReadFromFlagsFile(const std::string& filename, const char* prog_name,
bool errors_are_fatal); // uses SET_FLAGS_VALUE
// -------------------------------------------------------------------- // --------------------------------------------------------------------
@@ -311,12 +313,12 @@ extern GFLAGS_DLL_DECL bool ReadFromFlagsFile(const std::string& filename, const
// Otherwise, return the value. NOTE: for booleans, for true use // Otherwise, return the value. NOTE: for booleans, for true use
// 't' or 'T' or 'true' or '1', for false 'f' or 'F' or 'false' or '0'. // 't' or 'T' or 'true' or '1', for false 'f' or 'F' or 'false' or '0'.
extern GFLAGS_DLL_DECL bool BoolFromEnv(const char *varname, bool defval); extern bool BoolFromEnv(const char *varname, bool defval);
extern GFLAGS_DLL_DECL int32 Int32FromEnv(const char *varname, int32 defval); extern int32 Int32FromEnv(const char *varname, int32 defval);
extern GFLAGS_DLL_DECL int64 Int64FromEnv(const char *varname, int64 defval); extern int64 Int64FromEnv(const char *varname, int64 defval);
extern GFLAGS_DLL_DECL uint64 Uint64FromEnv(const char *varname, uint64 defval); extern uint64 Uint64FromEnv(const char *varname, uint64 defval);
extern GFLAGS_DLL_DECL double DoubleFromEnv(const char *varname, double defval); extern double DoubleFromEnv(const char *varname, double defval);
extern GFLAGS_DLL_DECL const char *StringFromEnv(const char *varname, const char *defval); extern const char *StringFromEnv(const char *varname, const char *defval);
// -------------------------------------------------------------------- // --------------------------------------------------------------------
@@ -328,12 +330,12 @@ extern GFLAGS_DLL_DECL const char *StringFromEnv(const char *varname, const char
// SetUsageMessage(usage); // SetUsageMessage(usage);
// Do not include commandline flags in the usage: we do that for you! // Do not include commandline flags in the usage: we do that for you!
// Thread-hostile; meant to be called before any threads are spawned. // Thread-hostile; meant to be called before any threads are spawned.
extern GFLAGS_DLL_DECL void SetUsageMessage(const std::string& usage); extern void SetUsageMessage(const std::string& usage);
// Sets the version string, which is emitted with --version. // Sets the version string, which is emitted with --version.
// For instance: SetVersionString("1.3"); // For instance: SetVersionString("1.3");
// Thread-hostile; meant to be called before any threads are spawned. // Thread-hostile; meant to be called before any threads are spawned.
extern GFLAGS_DLL_DECL void SetVersionString(const std::string& version); extern void SetVersionString(const std::string& version);
// Looks for flags in argv and parses them. Rearranges argv to put // Looks for flags in argv and parses them. Rearranges argv to put
@@ -343,7 +345,7 @@ extern GFLAGS_DLL_DECL void SetVersionString(const std::string& version);
// of the first non-flag argument. // of the first non-flag argument.
// See top-of-file for more details on this function. // See top-of-file for more details on this function.
#ifndef SWIG // In swig, use ParseCommandLineFlagsScript() instead. #ifndef SWIG // In swig, use ParseCommandLineFlagsScript() instead.
extern GFLAGS_DLL_DECL uint32 ParseCommandLineFlags(int *argc, char*** argv, bool remove_flags); extern uint32 ParseCommandLineFlags(int *argc, char*** argv, bool remove_flags);
#endif #endif
@@ -357,18 +359,18 @@ extern GFLAGS_DLL_DECL uint32 ParseCommandLineFlags(int *argc, char*** argv, boo
// defined more than once in the command line or flag file, the last // defined more than once in the command line or flag file, the last
// definition is used. Returns the index (into argv) of the first // definition is used. Returns the index (into argv) of the first
// non-flag argument. (If remove_flags is true, will always return 1.) // non-flag argument. (If remove_flags is true, will always return 1.)
extern GFLAGS_DLL_DECL uint32 ParseCommandLineNonHelpFlags(int *argc, char*** argv, bool remove_flags); extern uint32 ParseCommandLineNonHelpFlags(int *argc, char*** argv,
bool remove_flags);
// This is actually defined in gflags_reporting.cc. // This is actually defined in gflags_reporting.cc.
// This function is misnamed (it also handles --version, etc.), but // This function is misnamed (it also handles --version, etc.), but
// it's too late to change that now. :-( // it's too late to change that now. :-(
extern GFLAGS_DLL_DECL void HandleCommandLineHelpFlags(); // in gflags_reporting.cc extern void HandleCommandLineHelpFlags(); // in gflags_reporting.cc
// Allow command line reparsing. Disables the error normally // Allow command line reparsing. Disables the error normally
// generated when an unknown flag is found, since it may be found in a // generated when an unknown flag is found, since it may be found in a
// later parse. Thread-hostile; meant to be called before any threads // later parse. Thread-hostile; meant to be called before any threads
// are spawned. // are spawned.
extern GFLAGS_DLL_DECL void AllowCommandLineReparsing(); extern void AllowCommandLineReparsing();
// Reparse the flags that have not yet been recognized. Only flags // Reparse the flags that have not yet been recognized. Only flags
// registered since the last parse will be recognized. Any flag value // registered since the last parse will be recognized. Any flag value
@@ -376,7 +378,7 @@ extern GFLAGS_DLL_DECL void AllowCommandLineReparsing();
// separate command line argument that follows the flag argument. // separate command line argument that follows the flag argument.
// Intended for handling flags from dynamically loaded libraries, // Intended for handling flags from dynamically loaded libraries,
// since their flags are not registered until they are loaded. // since their flags are not registered until they are loaded.
extern GFLAGS_DLL_DECL void ReparseCommandLineNonHelpFlags(); extern void ReparseCommandLineNonHelpFlags();
// Clean up memory allocated by flags. This is only needed to reduce // Clean up memory allocated by flags. This is only needed to reduce
// the quantity of "potentially leaked" reports emitted by memory // the quantity of "potentially leaked" reports emitted by memory
@@ -387,7 +389,7 @@ extern GFLAGS_DLL_DECL void ReparseCommandLineNonHelpFlags();
// called will have unexpected consequences. This is not safe to run // called will have unexpected consequences. This is not safe to run
// when multiple threads might be running: the function is // when multiple threads might be running: the function is
// thread-hostile. // thread-hostile.
extern GFLAGS_DLL_DECL void ShutDownCommandLineFlags(); extern void ShutDownCommandLineFlags();
// -------------------------------------------------------------------- // --------------------------------------------------------------------
@@ -418,7 +420,7 @@ extern GFLAGS_DLL_DECL void ShutDownCommandLineFlags();
// directly. The idea is that DEFINE puts the flag in the weird // directly. The idea is that DEFINE puts the flag in the weird
// namespace, and DECLARE imports the flag from there into the current // namespace, and DECLARE imports the flag from there into the current
// namespace. The net result is to force people to use DECLARE to get // namespace. The net result is to force people to use DECLARE to get
// access to a flag, rather than saying "extern GFLAGS_DLL_DECL bool FLAGS_whatever;" // access to a flag, rather than saying "extern bool FLAGS_whatever;"
// or some such instead. We want this so we can put extra // or some such instead. We want this so we can put extra
// functionality (like sanity-checking) in DECLARE if we want, and // functionality (like sanity-checking) in DECLARE if we want, and
// make sure it is picked up everywhere. // make sure it is picked up everywhere.
@@ -439,18 +441,16 @@ class GFLAGS_DLL_DECL FlagRegisterer {
// binary file. This can reduce the size of the resulting binary // binary file. This can reduce the size of the resulting binary
// somewhat, and may also be useful for security reasons. // somewhat, and may also be useful for security reasons.
extern GFLAGS_DLL_DECL const char kStrippedFlagHelp[]; extern const char kStrippedFlagHelp[];
} // namespace gflags
}
#ifndef SWIG // In swig, ignore the main flag declarations #ifndef SWIG // In swig, ignore the main flag declarations
#if defined(STRIP_FLAG_HELP) && STRIP_FLAG_HELP > 0 #if defined(STRIP_FLAG_HELP) && STRIP_FLAG_HELP > 0
// Need this construct to avoid the 'defined but not used' warning. // Need this construct to avoid the 'defined but not used' warning.
#define MAYBE_STRIPPED_HELP(txt) \ #define MAYBE_STRIPPED_HELP(txt) \
(false ? (txt) : gflags::kStrippedFlagHelp) (false ? (txt) : ::google::kStrippedFlagHelp)
#else #else
#define MAYBE_STRIPPED_HELP(txt) txt #define MAYBE_STRIPPED_HELP(txt) txt
#endif #endif
@@ -472,7 +472,7 @@ extern GFLAGS_DLL_DECL const char kStrippedFlagHelp[];
/* We always want to export defined variables, dll or no */ \ /* We always want to export defined variables, dll or no */ \
GFLAGS_DLL_DEFINE_FLAG type FLAGS_##name = FLAGS_nono##name; \ GFLAGS_DLL_DEFINE_FLAG type FLAGS_##name = FLAGS_nono##name; \
type FLAGS_no##name = FLAGS_nono##name; \ type FLAGS_no##name = FLAGS_nono##name; \
static gflags::FlagRegisterer o_##name( \ static ::google::FlagRegisterer o_##name( \
#name, #type, MAYBE_STRIPPED_HELP(help), __FILE__, \ #name, #type, MAYBE_STRIPPED_HELP(help), __FILE__, \
&FLAGS_##name, &FLAGS_no##name); \ &FLAGS_##name, &FLAGS_no##name); \
} \ } \
@@ -505,15 +505,15 @@ GFLAGS_DLL_DECL bool IsBoolFlag(bool from);
DEFINE_VARIABLE(bool, B, name, val, txt) DEFINE_VARIABLE(bool, B, name, val, txt)
#define DEFINE_int32(name, val, txt) \ #define DEFINE_int32(name, val, txt) \
DEFINE_VARIABLE(gflags::int32, I, \ DEFINE_VARIABLE(::google::int32, I, \
name, val, txt) name, val, txt)
#define DEFINE_int64(name, val, txt) \ #define DEFINE_int64(name, val, txt) \
DEFINE_VARIABLE(gflags::int64, I64, \ DEFINE_VARIABLE(::google::int64, I64, \
name, val, txt) name, val, txt)
#define DEFINE_uint64(name,val, txt) \ #define DEFINE_uint64(name,val, txt) \
DEFINE_VARIABLE(gflags::uint64, U64, \ DEFINE_VARIABLE(::google::uint64, U64, \
name, val, txt) name, val, txt)
#define DEFINE_double(name, val, txt) \ #define DEFINE_double(name, val, txt) \
@@ -554,7 +554,7 @@ inline clstring* dont_pass0toDEFINE_string(char *stringspot,
clstring* const FLAGS_no##name = ::fLS:: \ clstring* const FLAGS_no##name = ::fLS:: \
dont_pass0toDEFINE_string(s_##name[0].s, \ dont_pass0toDEFINE_string(s_##name[0].s, \
val); \ val); \
static gflags::FlagRegisterer o_##name( \ static ::google::FlagRegisterer o_##name( \
#name, "string", MAYBE_STRIPPED_HELP(txt), __FILE__, \ #name, "string", MAYBE_STRIPPED_HELP(txt), __FILE__, \
s_##name[0].s, new (s_##name[1].s) clstring(*FLAGS_no##name)); \ s_##name[0].s, new (s_##name[1].s) clstring(*FLAGS_no##name)); \
extern GFLAGS_DLL_DEFINE_FLAG clstring& FLAGS_##name; \ extern GFLAGS_DLL_DEFINE_FLAG clstring& FLAGS_##name; \
@@ -565,4 +565,4 @@ inline clstring* dont_pass0toDEFINE_string(char *stringspot,
#endif // SWIG #endif // SWIG
#endif // GFLAGS_GFLAGS_H_ #endif // BASE_COMMANDLINEFLAGS_H_

View File

@@ -109,13 +109,22 @@ $ complete -o bashdefault -o default -o nospace -C \
// produce the expected completion output. // produce the expected completion output.
#ifndef GFLAGS_COMPLETIONS_H_ #ifndef BASE_COMMANDLINEFLAGS_COMPLETIONS_H_
#define GFLAGS_COMPLETIONS_H_ #define BASE_COMMANDLINEFLAGS_COMPLETIONS_H_
namespace gflags { // Annoying stuff for windows -- makes sure clients can import these functions
//
// NOTE: all functions below MUST have an explicit 'extern' before
// them. Our automated opensourcing tools use this as a signal to do
// appropriate munging for windows, which needs to add GFLAGS_DLL_DECL.
//
#define GFLAGS_DLL_DECL /* rewritten to be non-empty in windows dir */
namespace google {
extern void HandleCommandLineCompletions(void); extern void HandleCommandLineCompletions(void);
} }
#endif // GFLAGS_COMPLETIONS_H_ #endif // BASE_COMMANDLINEFLAGS_COMPLETIONS_H_

View File

@@ -34,54 +34,32 @@
// This is the file that should be included by any file which declares // This is the file that should be included by any file which declares
// command line flag. // command line flag.
#ifndef GFLAGS_DECLARE_H_ #ifndef BASE_COMMANDLINEFLAGS_DECLARE_H_
#define GFLAGS_DECLARE_H_ #define BASE_COMMANDLINEFLAGS_DECLARE_H_
// ---------------------------------------------------------------------------
// Windows DLL import/export.
// We always want to import the symbols of the gflags library
#ifndef GFLAGS_DLL_DECL
# if 0 && defined(_MSC_VER)
# define GFLAGS_DLL_DECL __declspec(dllimport)
# else
# define GFLAGS_DLL_DECL
# endif
#endif
// We always want to import variables declared in user code
#ifndef GFLAGS_DLL_DECLARE_FLAG
# if 0 && defined(_MSC_VER)
# define GFLAGS_DLL_DECLARE_FLAG __declspec(dllimport)
# else
# define GFLAGS_DLL_DECLARE_FLAG
# endif
#endif
// ---------------------------------------------------------------------------
// Flag types
#include <string> #include <string>
#if 1 #if 1
# include <stdint.h> // the normal place uint32_t is defined #include <stdint.h> // the normal place uint16_t is defined
#elif 1 #endif
# include <sys/types.h> // the normal place u_int32_t is defined #if 1
#elif 1 #include <sys/types.h> // the normal place u_int16_t is defined
# include <inttypes.h> // a third place for uint32_t or u_int32_t #endif
#if 1
#include <inttypes.h> // a third place for uint16_t or u_int16_t
#endif #endif
namespace gflags { namespace google {
#if defined(__GNUC__) || defined(__MINGW32__) // the C99 format
#if 1 // C99
typedef int32_t int32; typedef int32_t int32;
typedef uint32_t uint32; typedef uint32_t uint32;
typedef int64_t int64; typedef int64_t int64;
typedef uint64_t uint64; typedef uint64_t uint64;
#elif 0 // BSD #elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__) // the BSD format
typedef int32_t int32; typedef int32_t int32;
typedef u_int32_t uint32; typedef u_int32_t uint32;
typedef int64_t int64; typedef int64_t int64;
typedef u_int64_t uint64; typedef u_int64_t uint64;
#elif 0 // Windows #elif defined(_MSC_VER) // the windows (vc7) format
typedef __int32 int32; typedef __int32 int32;
typedef unsigned __int32 uint32; typedef unsigned __int32 uint32;
typedef __int64 int64; typedef __int64 int64;
@@ -89,9 +67,10 @@ typedef unsigned __int64 uint64;
#else #else
#error Do not know how to define a 32-bit integer quantity on your system #error Do not know how to define a 32-bit integer quantity on your system
#endif #endif
}
} // namespace gflags
#define GFLAGS_DLL_DECLARE_FLAG /* rewritten to be non-empty in windows dir */
namespace fLS { namespace fLS {
@@ -101,8 +80,7 @@ namespace fLS {
// included). Save the current meaning now and use it in the macros. // included). Save the current meaning now and use it in the macros.
typedef std::string clstring; typedef std::string clstring;
} // namespace fLS }
#define DECLARE_VARIABLE(type, shorttype, name) \ #define DECLARE_VARIABLE(type, shorttype, name) \
/* We always want to import declared variables, dll or no */ \ /* We always want to import declared variables, dll or no */ \
@@ -113,24 +91,22 @@ typedef std::string clstring;
DECLARE_VARIABLE(bool, B, name) DECLARE_VARIABLE(bool, B, name)
#define DECLARE_int32(name) \ #define DECLARE_int32(name) \
DECLARE_VARIABLE(::gflags::int32, I, name) DECLARE_VARIABLE(::google::int32, I, name)
#define DECLARE_int64(name) \ #define DECLARE_int64(name) \
DECLARE_VARIABLE(::gflags::int64, I64, name) DECLARE_VARIABLE(::google::int64, I64, name)
#define DECLARE_uint64(name) \ #define DECLARE_uint64(name) \
DECLARE_VARIABLE(::gflags::uint64, U64, name) DECLARE_VARIABLE(::google::uint64, U64, name)
#define DECLARE_double(name) \ #define DECLARE_double(name) \
DECLARE_VARIABLE(double, D, name) DECLARE_VARIABLE(double, D, name)
#define DECLARE_string(name) \ #define DECLARE_string(name) \
/* We always want to import declared variables, dll or no */ \
namespace fLS { \ namespace fLS { \
using ::fLS::clstring; \ using ::fLS::clstring; \
extern GFLAGS_DLL_DECLARE_FLAG ::fLS::clstring& FLAGS_##name; \ extern GFLAGS_DLL_DECLARE_FLAG ::fLS::clstring& FLAGS_##name; \
} \ } \
using fLS::FLAGS_##name using fLS::FLAGS_##name
#endif // BASE_COMMANDLINEFLAGS_DECLARE_H_
#endif // GFLAGS_DECLARE_H_

View File

@@ -48,7 +48,6 @@
#include "config.h" #include "config.h"
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> // for strlen #include <string.h> // for strlen
@@ -58,13 +57,17 @@
#include <utility> #include <utility>
#include <vector> #include <vector>
#include "gflags.h" #include "gflags/gflags_completions.h"
#include "gflags/gflags.h"
#include "util.h" #include "util.h"
using std::set; using std::set;
using std::string; using std::string;
using std::vector; using std::vector;
#ifndef PATH_SEPARATOR
#define PATH_SEPARATOR '/'
#endif
DEFINE_string(tab_completion_word, "", DEFINE_string(tab_completion_word, "",
"If non-empty, HandleCommandLineCompletions() will hijack the " "If non-empty, HandleCommandLineCompletions() will hijack the "
@@ -73,9 +76,7 @@ DEFINE_string(tab_completion_word, "",
DEFINE_int32(tab_completion_columns, 80, DEFINE_int32(tab_completion_columns, 80,
"Number of columns to use in output for tab completion"); "Number of columns to use in output for tab completion");
_START_GOOGLE_NAMESPACE_
namespace GFLAGS_NAMESPACE {
namespace { namespace {
// Function prototypes and Type forward declarations. Code may be // Function prototypes and Type forward declarations. Code may be
@@ -765,5 +766,4 @@ void HandleCommandLineCompletions(void) {
gflags_exitfunc(0); gflags_exitfunc(0);
} }
_END_GOOGLE_NAMESPACE_
} // namespace GFLAGS_NAMESPACE

View File

@@ -48,32 +48,40 @@
// called after all flag-values have been assigned, that is, after // called after all flag-values have been assigned, that is, after
// parsing the command-line. // parsing the command-line.
#include "config.h"
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include <ctype.h> #include <ctype.h>
#include <assert.h> #include <assert.h>
#include <string> #include <string>
#include <vector> #include <vector>
#include "gflags/gflags.h"
#include "config.h" #include "gflags/gflags_completions.h"
#include "gflags.h"
#include "gflags_completions.h"
#include "util.h" #include "util.h"
#ifndef PATH_SEPARATOR
#define PATH_SEPARATOR '/'
#endif
// The 'reporting' flags. They all call gflags_exitfunc(). // The 'reporting' flags. They all call gflags_exitfunc().
DEFINE_bool (help, false, "show help on all flags [tip: all flags can have two dashes]"); DEFINE_bool(help, false,
DEFINE_bool (helpfull, false, "show help on all flags -- same as -help"); "show help on all flags [tip: all flags can have two dashes]");
DEFINE_bool (helpshort, false, "show help on only the main module for this program"); DEFINE_bool(helpfull, false,
DEFINE_string(helpon, "", "show help on the modules named by this flag value"); "show help on all flags -- same as -help");
DEFINE_string(helpmatch, "", "show help on modules whose name contains the specified substr"); DEFINE_bool(helpshort, false,
DEFINE_bool (helppackage, false, "show help on all modules in the main package"); "show help on only the main module for this program");
DEFINE_bool (helpxml, false, "produce an xml version of help"); DEFINE_string(helpon, "",
DEFINE_bool (version, false, "show version and build info and exit"); "show help on the modules named by this flag value");
DEFINE_string(helpmatch, "",
"show help on modules whose name contains the specified substr");
namespace GFLAGS_NAMESPACE { DEFINE_bool(helppackage, false,
"show help on all modules in the main package");
DEFINE_bool(helpxml, false,
"produce an xml version of help");
DEFINE_bool(version, false,
"show version and build info and exit");
_START_GOOGLE_NAMESPACE_
using std::string; using std::string;
using std::vector; using std::vector;
@@ -246,7 +254,7 @@ static bool FileMatchesSubstring(const string& filename,
// the string to be at the beginning of a directory component. // the string to be at the beginning of a directory component.
// That should match the first directory component as well, so // That should match the first directory component as well, so
// we allow '/foo' to match a filename of 'foo'. // we allow '/foo' to match a filename of 'foo'.
if (!target->empty() && (*target)[0] == PATH_SEPARATOR && if (!target->empty() && (*target)[0] == '/' &&
strncmp(filename.c_str(), target->c_str() + 1, strncmp(filename.c_str(), target->c_str() + 1,
strlen(target->c_str() + 1)) == 0) strlen(target->c_str() + 1)) == 0)
return true; return true;
@@ -352,8 +360,7 @@ static void ShowVersion() {
static void AppendPrognameStrings(vector<string>* substrings, static void AppendPrognameStrings(vector<string>* substrings,
const char* progname) { const char* progname) {
string r(""); string r("/");
r += PATH_SEPARATOR;
r += progname; r += progname;
substrings->push_back(r + "."); substrings->push_back(r + ".");
substrings->push_back(r + "-main."); substrings->push_back(r + "-main.");
@@ -388,7 +395,7 @@ void HandleCommandLineHelpFlags() {
gflags_exitfunc(1); gflags_exitfunc(1);
} else if (!FLAGS_helpon.empty()) { } else if (!FLAGS_helpon.empty()) {
string restrict = PATH_SEPARATOR + FLAGS_helpon + "."; string restrict = "/" + FLAGS_helpon + ".";
ShowUsageWithFlagsRestrict(progname, restrict.c_str()); ShowUsageWithFlagsRestrict(progname, restrict.c_str());
gflags_exitfunc(1); gflags_exitfunc(1);
@@ -410,7 +417,7 @@ void HandleCommandLineHelpFlags() {
++flag) { ++flag) {
if (!FileMatchesSubstring(flag->filename, substrings)) if (!FileMatchesSubstring(flag->filename, substrings))
continue; continue;
const string package = Dirname(flag->filename) + PATH_SEPARATOR; const string package = Dirname(flag->filename) + "/";
if (package != last_package) { if (package != last_package) {
ShowUsageWithFlagsRestrict(progname, package.c_str()); ShowUsageWithFlagsRestrict(progname, package.c_str());
VLOG(7) << "Found package: " << package; VLOG(7) << "Found package: " << package;
@@ -437,5 +444,4 @@ void HandleCommandLineHelpFlags() {
} }
} }
_END_GOOGLE_NAMESPACE_
} // namespace GFLAGS_NAMESPACE

View File

@@ -32,6 +32,11 @@
// A simple mutex wrapper, supporting locks and read-write locks. // A simple mutex wrapper, supporting locks and read-write locks.
// You should assume the locks are *not* re-entrant. // You should assume the locks are *not* re-entrant.
// //
// To use: you should define the following macros in your configure.ac:
// ACX_PTHREAD
// AC_RWLOCK
// The latter is defined in ../autoconf.
//
// This class is meant to be internal-only and should be wrapped by an // This class is meant to be internal-only and should be wrapped by an
// internal namespace. Before you use this module, please give the // internal namespace. Before you use this module, please give the
// name of your internal namespace for this module. Or, if you want // name of your internal namespace for this module. Or, if you want
@@ -103,14 +108,14 @@
// weird to a Mutex's memory after it is destroyed, but for a // weird to a Mutex's memory after it is destroyed, but for a
// static global variable, that's pretty safe. // static global variable, that's pretty safe.
#ifndef GFLAGS_MUTEX_H_ #ifndef GOOGLE_MUTEX_H_
#define GFLAGS_MUTEX_H_ #define GOOGLE_MUTEX_H_
#include "gflags_declare.h" // to figure out pthreads support #include "config.h" // to figure out pthreads support
#if defined(NO_THREADS) #if defined(NO_THREADS)
typedef int MutexType; // to keep a lock-count typedef int MutexType; // to keep a lock-count
#elif defined(OS_WINDOWS) #elif defined(_WIN32) || defined(__CYGWIN32__) || defined(__CYGWIN64__)
# ifndef WIN32_LEAN_AND_MEAN # ifndef WIN32_LEAN_AND_MEAN
# define WIN32_LEAN_AND_MEAN // We only need minimal includes # define WIN32_LEAN_AND_MEAN // We only need minimal includes
# endif # endif
@@ -227,7 +232,7 @@ bool Mutex::TryLock() { if (mutex_) return false; Lock(); return true; }
void Mutex::ReaderLock() { assert(++mutex_ > 0); } void Mutex::ReaderLock() { assert(++mutex_ > 0); }
void Mutex::ReaderUnlock() { assert(mutex_-- > 0); } void Mutex::ReaderUnlock() { assert(mutex_-- > 0); }
#elif defined(OS_WINDOWS) #elif defined(_WIN32) || defined(__CYGWIN32__) || defined(__CYGWIN64__)
Mutex::Mutex() : destroy_(true) { Mutex::Mutex() : destroy_(true) {
InitializeCriticalSection(&mutex_); InitializeCriticalSection(&mutex_);
@@ -348,4 +353,4 @@ using namespace MUTEX_NAMESPACE;
#undef MUTEX_NAMESPACE #undef MUTEX_NAMESPACE
#endif /* #define GFLAGS_MUTEX_H__ */ #endif /* #define GOOGLE_MUTEX_H__ */

View File

@@ -34,10 +34,8 @@
#ifndef GFLAGS_UTIL_H_ #ifndef GFLAGS_UTIL_H_
#define GFLAGS_UTIL_H_ #define GFLAGS_UTIL_H_
#include "config.h"
#include <assert.h> #include <assert.h>
#include <config.h> #include "config.h"
#ifdef HAVE_INTTYPES_H #ifdef HAVE_INTTYPES_H
# include <inttypes.h> # include <inttypes.h>
#endif #endif
@@ -46,33 +44,30 @@
#include <stdio.h> #include <stdio.h>
#include <iostream> #include <iostream>
#include <string> #include <string>
#include <errno.h>
#ifdef HAVE_SYS_STAT_H #ifdef HAVE_SYS_STAT_H
# include <sys/stat.h> // for mkdir # include <sys/stat.h>
#endif #endif // for mkdir()
namespace GFLAGS_NAMESPACE {
_START_GOOGLE_NAMESPACE_
// This is used for unittests for death-testing. It is defined in gflags.cc. // This is used for unittests for death-testing. It is defined in gflags.cc.
extern GFLAGS_DLL_DECL void (*gflags_exitfunc)(int); extern GFLAGS_DLL_DECL void (*gflags_exitfunc)(int);
// Work properly if either strtoll or strtoq is on this system. // Work properly if either strtoll or strtoq is on this system
#if defined(strtoll) || defined(HAVE_STRTOLL) #ifdef HAVE_STRTOLL
# define strto64 strtoll # define strto64 strtoll
# define strtou64 strtoull # define strtou64 strtoull
#elif defined(HAVE_STRTOQ) #elif HAVE_STRTOQ
# define strto64 strtoq # define strto64 strtoq
# define strtou64 strtouq # define strtou64 strtouq
// Neither strtoll nor strtoq are defined. I hope strtol works!
#else #else
// Neither strtoll nor strtoq are defined. I hope strtol works!
# define strto64 strtol # define strto64 strtol
# define strtou64 strtoul # define strtou64 strtoul
#endif #endif
// If we have inttypes.h, it will have defined PRId32/etc for us. // If we have inttypes.h, it will have defined PRId32/etc for us. If
// If not, take our best guess. // not, take our best guess.
#ifndef PRId32 #ifndef PRId32
# define PRId32 "d" # define PRId32 "d"
#endif #endif
@@ -235,36 +230,37 @@ class Test {};
#if defined(__MINGW32__) #if defined(__MINGW32__)
#include <io.h> #include <io.h>
inline void MakeTmpdir(std::string* path) { inline void MakeTmpdir(std::string* path) {
if (!path->empty()) {
path->append("/gflags_unittest_testdir");
int err = mkdir(path->c_str());
if (err == 0 || errno == EEXIST) return;
}
// I had trouble creating a directory in /tmp from mingw // I had trouble creating a directory in /tmp from mingw
*path = "./gflags_unittest"; *path = "./gflags_unittest_testdir";
mkdir(path->c_str()); mkdir(path->c_str()); // mingw has a weird one-arg mkdir
} }
#elif defined(_MSC_VER) #elif defined(_MSC_VER)
#include <direct.h> #include <direct.h>
#include <windows.h>
inline void MakeTmpdir(std::string* path) { inline void MakeTmpdir(std::string* path) {
if (!path->empty()) {
int err = _mkdir(path->c_str());
if (err == 0 || errno == EEXIST) return;
}
char tmppath_buffer[1024]; char tmppath_buffer[1024];
int tmppath_len = GetTempPathA(sizeof(tmppath_buffer), tmppath_buffer); int tmppath_len = GetTempPathA(sizeof(tmppath_buffer), tmppath_buffer);
assert(tmppath_len > 0 && tmppath_len < sizeof(tmppath_buffer)); assert(tmppath_len > 0 && tmppath_len < sizeof(tmppath_buffer));
assert(tmppath_buffer[tmppath_len - 1] == '\\'); // API guarantees it assert(tmppath_buffer[tmppath_len - 1] == '\\'); // API guarantees it
*path = std::string(tmppath_buffer) + "gflags_unittest"; *path = std::string(tmppath_buffer) + "gflags_unittest_testdir";
_mkdir(path->c_str()); _mkdir(path->c_str());
} }
// Windows is missing random bits like strcasecmp, strtoll, strtoull, and
// snprintf in the usual locations. Put them somewhere sensible.
//
// TODO(keir): Get the upstream Windows port and use that instead.
#define snprintf _snprintf
#undef strtoint64
#define strtoint64 _strtoi64
#undef strtouint64
#define strtouint64 _strtoui64
#define strcasecmp _stricmp
#define va_copy(dst, src) ((dst) = (src))
#define strto64 _strtoi64
#define strtou64 _strtoui64
#else #else
inline void MakeTmpdir(std::string* path) { inline void MakeTmpdir(std::string* path) {
if (!path->empty()) { mkdir(path->c_str(), 0755);
int err = mkdir(path->c_str(), 0755);
if (err == 0 || errno == EEXIST) return;
}
mkdir("/tmp/gflags_unittest", 0755);
} }
#endif #endif
@@ -282,7 +278,7 @@ inline void InternalStringPrintf(std::string* output, const char* format,
int bytes_written = vsnprintf(space, sizeof(space), format, backup_ap); int bytes_written = vsnprintf(space, sizeof(space), format, backup_ap);
va_end(backup_ap); va_end(backup_ap);
if ((bytes_written >= 0) && (static_cast<size_t>(bytes_written) < sizeof(space))) { if ((bytes_written >= 0) && (bytes_written < sizeof(space))) {
output->append(space, bytes_written); output->append(space, bytes_written);
return; return;
} }
@@ -338,36 +334,6 @@ inline std::string StringPrintf(const char* format, ...) {
return output; return output;
} }
inline bool SafeGetEnv(const char *varname, std::string &valstr) _END_GOOGLE_NAMESPACE_
{
#if defined(_MSC_VER) && _MSC_VER >= 1400
char *val;
size_t sz;
if (_dupenv_s(&val, &sz, varname) != 0 || !val) return false;
valstr = val;
free(val);
#else
const char * const val = getenv(varname);
if (!val) return false;
valstr = val;
#endif
return true;
}
inline int SafeFOpen(FILE **fp, const char* fname, const char *mode)
{
#if defined(_MSC_VER) && _MSC_VER >= 1400
return fopen_s(fp, fname, mode);
#else
assert(fp != NULL);
*fp = fopen(fname, mode);
// errno only guaranteed to be set on failure
return ((*fp == NULL) ? errno : 0);
#endif
}
} // namespace GFLAGS_NAMESPACE
#endif // GFLAGS_UTIL_H_ #endif // GFLAGS_UTIL_H_

View File

@@ -1,71 +0,0 @@
/* Copyright (c) 2009, Google Inc.
* All rights reserved.
*
* 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: Craig Silverstein
*/
#ifndef _WIN32
# error You should only be including windows/port.cc in a windows environment!
#endif
#include <string.h> // for strlen(), memset(), memcmp()
#include <assert.h>
#include <stdarg.h> // for va_list, va_start, va_end
#include <windows.h>
#include "windows_port.h"
// These call the windows _vsnprintf, but always NUL-terminate.
#if !defined(__MINGW32__) && !defined(__MINGW64__) /* mingw already defines */
#ifdef _MSC_VER
# pragma warning(push)
# pragma warning(disable: 4996) // ignore _vsnprintf security warning
#endif
int safe_vsnprintf(char *str, size_t size, const char *format, va_list ap) {
if (size == 0) // not even room for a \0?
return -1; // not what C99 says to do, but what windows does
str[size-1] = '\0';
return _vsnprintf(str, size-1, format, ap);
}
#ifdef _MSC_VER
# pragma warning(pop)
#endif
int snprintf(char *str, size_t size, const char *format, ...) {
int r;
va_list ap;
va_start(ap, format);
r = vsnprintf(str, size, format, ap);
va_end(ap);
return r;
}
#endif /* #if !defined(__MINGW32__) && !defined(__MINGW64__) */

View File

@@ -1,127 +0,0 @@
/* Copyright (c) 2009, Google Inc.
* All rights reserved.
*
* 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: Craig Silverstein
*
* These are some portability typedefs and defines to make it a bit
* easier to compile this code under VC++.
*
* Several of these are taken from glib:
* http://developer.gnome.org/doc/API/glib/glib-windows-compatability-functions.html
*/
#ifndef GFLAGS_WINDOWS_PORT_H_
#define GFLAGS_WINDOWS_PORT_H_
#include "config.h"
// This must be defined before the windows.h is included.
// It's needed for mutex.h, to give access to the TryLock method.
# if !defined(_WIN32_WINNT) && !(defined( __MINGW32__) || defined(__MINGW64__))
# define _WIN32_WINNT 0x0400
# endif
// We always want minimal includes
#ifndef WIN32_LEAN_AND_MEAN
# define WIN32_LEAN_AND_MEAN
#endif
#include <windows.h>
#include <direct.h> /* for mkdir */
#include <stdlib.h> /* for _putenv, getenv */
#include <stdio.h> /* need this to override stdio's snprintf, also defines _unlink used by unit tests */
#include <stdarg.h> /* util.h uses va_copy */
#include <string.h> /* for _stricmp and _strdup */
/* We can't just use _vsnprintf and _snprintf as drop-in-replacements,
* because they don't always NUL-terminate. :-( We also can't use the
* name vsnprintf, since windows defines that (but not snprintf (!)).
*/
#if !defined(__MINGW32__) && !defined(__MINGW64__) /* mingw already defines */
extern GFLAGS_DLL_DECL int snprintf(char *str, size_t size,
const char *format, ...);
extern int GFLAGS_DLL_DECL safe_vsnprintf(char *str, size_t size,
const char *format, va_list ap);
#define vsnprintf(str, size, format, ap) safe_vsnprintf(str, size, format, ap)
#define va_copy(dst, src) (dst) = (src)
#endif /* #if !defined(__MINGW32__) && !defined(__MINGW64__) */
#ifdef _MSC_VER
# pragma warning(push)
# pragma warning(disable: 4996) // ignore getenv security warning
#endif
inline void setenv(const char* name, const char* value, int) {
// In windows, it's impossible to set a variable to the empty string.
// We handle this by setting it to "0" and the NUL-ing out the \0.
// That is, we putenv("FOO=0") and then find out where in memory the
// putenv wrote "FOO=0", and change it in-place to "FOO=\0".
// c.f. http://svn.apache.org/viewvc/stdcxx/trunk/tests/src/environ.cpp?r1=611451&r2=637508&pathrev=637508
static const char* const kFakeZero = "0";
if (*value == '\0')
value = kFakeZero;
// Apparently the semantics of putenv() is that the input
// must live forever, so we leak memory here. :-(
const size_t nameval_len = strlen(name) + 1 + strlen(value) + 1;
char* nameval = reinterpret_cast<char*>(malloc(nameval_len));
snprintf(nameval, nameval_len, "%s=%s", name, value);
_putenv(nameval);
if (value == kFakeZero) {
nameval[nameval_len - 2] = '\0'; // works when putenv() makes no copy
if (*getenv(name) != '\0')
*getenv(name) = '\0'; // works when putenv() copies nameval
}
}
#ifdef _MSC_VER
# pragma warning(pop)
#endif
#define strcasecmp _stricmp
#if defined(_MSC_VER) && _MSC_VER >= 1400
#define strdup _strdup
#define unlink _unlink
#endif
#define PRId32 "d"
#define PRIu32 "u"
#define PRId64 "I64d"
#define PRIu64 "I64u"
#if !defined(__MINGW32__) && !defined(__MINGW64__)
#define strtoq _strtoi64
#define strtouq _strtoui64
#define strtoll _strtoi64
#define strtoull _strtoui64
#define atoll _atoi64
#endif
#ifndef PATH_MAX
#define PATH_MAX 1024
#endif
#endif /* GFLAGS_WINDOWS_PORT_H_ */

View File

@@ -1,7 +1,7 @@
Project: Google Logging Project: Google Logging
URL: http://code.google.com/p/google-glog/ URL: http://code.google.com/p/google-glog/
License: New BSD License: New BSD
Upstream version: 0.3.3, r143 Upstream version: 0.3.3, r139
Local modifications: Local modifications:
* Added per-platform config.h files so no configuration-time * Added per-platform config.h files so no configuration-time
checks for functions and so are needed. checks for functions and so are needed.

View File

@@ -167,7 +167,7 @@ static size_t StrLen(const char *str) {
// Returns true if "str" has at least "n" characters remaining. // Returns true if "str" has at least "n" characters remaining.
static bool AtLeastNumCharsRemaining(const char *str, int n) { static bool AtLeastNumCharsRemaining(const char *str, int n) {
for (int i = 0; i < n; ++i) { for (int i = 0; i < n; ++i) {
if (str[i] == '\0') { if (str == '\0') {
return false; return false;
} }
} }
@@ -223,6 +223,9 @@ static bool ParseTwoCharToken(State *state, const char *two_char_token) {
// Returns true and advances "mangled_cur" if we find any character in // Returns true and advances "mangled_cur" if we find any character in
// "char_class" at "mangled_cur" position. // "char_class" at "mangled_cur" position.
static bool ParseCharClass(State *state, const char *char_class) { static bool ParseCharClass(State *state, const char *char_class) {
if (state->mangled_cur == '\0') {
return false;
}
const char *p = char_class; const char *p = char_class;
for (; *p != '\0'; ++p) { for (; *p != '\0'; ++p) {
if (state->mangled_cur[0] == *p) { if (state->mangled_cur[0] == *p) {

View File

@@ -31,7 +31,6 @@
#include "utilities.h" #include "utilities.h"
#include <algorithm>
#include <assert.h> #include <assert.h>
#include <iomanip> #include <iomanip>
#include <string> #include <string>
@@ -182,10 +181,6 @@ GLOG_DEFINE_string(log_backtrace_at, "",
#define PATH_SEPARATOR '/' #define PATH_SEPARATOR '/'
#ifndef HAVE_PREAD #ifndef HAVE_PREAD
#if defined(OS_WINDOWS)
#include <BaseTsd.h>
#define ssize_t SSIZE_T
#endif
static ssize_t pread(int fd, void* buf, size_t count, off_t offset) { static ssize_t pread(int fd, void* buf, size_t count, off_t offset) {
off_t orig_offset = lseek(fd, 0, SEEK_CUR); off_t orig_offset = lseek(fd, 0, SEEK_CUR);
if (orig_offset == (off_t)-1) if (orig_offset == (off_t)-1)

View File

@@ -45,12 +45,6 @@
// some functions which are not guaranteed to be so, such as memchr() // some functions which are not guaranteed to be so, such as memchr()
// and memmove(). We assume they are async-signal-safe. // and memmove(). We assume they are async-signal-safe.
// //
// Additional header can be specified by the GLOG_BUILD_CONFIG_INCLUDE
// macro to add platform specific defines (e.g. OS_OPENBSD).
#ifdef GLOG_BUILD_CONFIG_INCLUDE
#include GLOG_BUILD_CONFIG_INCLUDE
#endif // GLOG_BUILD_CONFIG_INCLUDE
#include "utilities.h" #include "utilities.h"
@@ -80,13 +74,6 @@ void InstallSymbolizeCallback(SymbolizeCallback callback) {
g_symbolize_callback = callback; g_symbolize_callback = callback;
} }
static SymbolizeOpenObjectFileCallback g_symbolize_open_object_file_callback =
NULL;
void InstallSymbolizeOpenObjectFileCallback(
SymbolizeOpenObjectFileCallback callback) {
g_symbolize_open_object_file_callback = callback;
}
// This function wraps the Demangle function to provide an interface // This function wraps the Demangle function to provide an interface
// where the input symbol is demangled in-place. // where the input symbol is demangled in-place.
// To keep stack consumption low, we would like this function to not // To keep stack consumption low, we would like this function to not
@@ -108,14 +95,11 @@ _END_GOOGLE_NAMESPACE_
#if defined(__ELF__) #if defined(__ELF__)
#include <dlfcn.h> #include <dlfcn.h>
#if defined(OS_OPENBSD)
#include <sys/exec_elf.h>
#else
#include <elf.h> #include <elf.h>
#endif
#include <errno.h> #include <errno.h>
#include <fcntl.h> #include <fcntl.h>
#include <limits.h> #include <limits.h>
#include <link.h> // For ElfW() macro.
#include <stdint.h> #include <stdint.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
@@ -139,7 +123,7 @@ _START_GOOGLE_NAMESPACE_
// success, return the number of bytes read. Otherwise, return -1. // success, return the number of bytes read. Otherwise, return -1.
static ssize_t ReadPersistent(const int fd, void *buf, const size_t count) { static ssize_t ReadPersistent(const int fd, void *buf, const size_t count) {
SAFE_ASSERT(fd >= 0); SAFE_ASSERT(fd >= 0);
SAFE_ASSERT(count <= std::numeric_limits<ssize_t>::max()); SAFE_ASSERT(count >= 0 && count <= std::numeric_limits<ssize_t>::max());
char *buf0 = reinterpret_cast<char *>(buf); char *buf0 = reinterpret_cast<char *>(buf);
ssize_t num_bytes = 0; ssize_t num_bytes = 0;
while (num_bytes < count) { while (num_bytes < count) {
@@ -342,8 +326,10 @@ static bool GetSymbolFromObjectFile(const int fd, uint64_t pc,
ElfW(Shdr) symtab, strtab; ElfW(Shdr) symtab, strtab;
// Consult a regular symbol table first. // Consult a regular symbol table first.
if (GetSectionHeaderByType(fd, elf_header.e_shnum, elf_header.e_shoff, if (!GetSectionHeaderByType(fd, elf_header.e_shnum, elf_header.e_shoff,
SHT_SYMTAB, &symtab)) { SHT_SYMTAB, &symtab)) {
return false;
}
if (!ReadFromOffsetExact(fd, &strtab, sizeof(strtab), elf_header.e_shoff + if (!ReadFromOffsetExact(fd, &strtab, sizeof(strtab), elf_header.e_shoff +
symtab.sh_link * sizeof(symtab))) { symtab.sh_link * sizeof(symtab))) {
return false; return false;
@@ -352,11 +338,12 @@ static bool GetSymbolFromObjectFile(const int fd, uint64_t pc,
&strtab, &symtab)) { &strtab, &symtab)) {
return true; // Found the symbol in a regular symbol table. return true; // Found the symbol in a regular symbol table.
} }
}
// If the symbol is not found, then consult a dynamic symbol table. // If the symbol is not found, then consult a dynamic symbol table.
if (GetSectionHeaderByType(fd, elf_header.e_shnum, elf_header.e_shoff, if (!GetSectionHeaderByType(fd, elf_header.e_shnum, elf_header.e_shoff,
SHT_DYNSYM, &symtab)) { SHT_DYNSYM, &symtab)) {
return false;
}
if (!ReadFromOffsetExact(fd, &strtab, sizeof(strtab), elf_header.e_shoff + if (!ReadFromOffsetExact(fd, &strtab, sizeof(strtab), elf_header.e_shoff +
symtab.sh_link * sizeof(symtab))) { symtab.sh_link * sizeof(symtab))) {
return false; return false;
@@ -365,7 +352,6 @@ static bool GetSymbolFromObjectFile(const int fd, uint64_t pc,
&strtab, &symtab)) { &strtab, &symtab)) {
return true; // Found the symbol in a dynamic symbol table. return true; // Found the symbol in a dynamic symbol table.
} }
}
return false; return false;
} }
@@ -495,20 +481,13 @@ static char *GetHex(const char *start, const char *end, uint64_t *hex) {
return const_cast<char *>(p); return const_cast<char *>(p);
} }
// Searches for the object file (from /proc/self/maps) that contains // Search for the object file (from /proc/self/maps) that contains
// the specified pc. If found, sets |start_address| to the start address // the specified pc. If found, open this file and return the file handle,
// of where this object file is mapped in memory, sets the module base // and also set start_address to the start address of where this object
// address into |base_address|, copies the object file name into // file is mapped to in memory. Otherwise, return -1.
// |out_file_name|, and attempts to open the object file. If the object
// file is opened successfully, returns the file descriptor. Otherwise,
// returns -1. |out_file_name_size| is the size of the file name buffer
// (including the null-terminator).
static ATTRIBUTE_NOINLINE int static ATTRIBUTE_NOINLINE int
OpenObjectFileContainingPcAndGetStartAddress(uint64_t pc, OpenObjectFileContainingPcAndGetStartAddress(uint64_t pc,
uint64_t &start_address, uint64_t &start_address) {
uint64_t &base_address,
char *out_file_name,
int out_file_name_size) {
int object_fd; int object_fd;
// Open /proc/self/maps. // Open /proc/self/maps.
@@ -522,10 +501,8 @@ OpenObjectFileContainingPcAndGetStartAddress(uint64_t pc,
// Iterate over maps and look for the map containing the pc. Then // Iterate over maps and look for the map containing the pc. Then
// look into the symbol tables inside. // look into the symbol tables inside.
char buf[1024]; // Big enough for line of sane /proc/self/maps char buf[1024]; // Big enough for line of sane /proc/self/maps
int num_maps = 0;
LineReader reader(wrapped_maps_fd.get(), buf, sizeof(buf)); LineReader reader(wrapped_maps_fd.get(), buf, sizeof(buf));
while (true) { while (true) {
num_maps++;
const char *cursor; const char *cursor;
const char *eol; const char *eol;
if (!reader.ReadLine(&cursor, &eol)) { // EOF or malformed line. if (!reader.ReadLine(&cursor, &eol)) { // EOF or malformed line.
@@ -575,35 +552,14 @@ OpenObjectFileContainingPcAndGetStartAddress(uint64_t pc,
} }
++cursor; // Skip ' '. ++cursor; // Skip ' '.
// Read file offset. // Skip to file name. "cursor" now points to file offset. We need to
uint64_t file_offset; // skip at least three spaces for file offset, dev, and inode.
cursor = GetHex(cursor, eol, &file_offset);
if (cursor == eol || *cursor != ' ') {
return -1; // Malformed line.
}
++cursor; // Skip ' '.
// Don't subtract 'start_address' from the first entry:
// * If a binary is compiled w/o -pie, then the first entry in
// process maps is likely the binary itself (all dynamic libs
// are mapped higher in address space). For such a binary,
// instruction offset in binary coincides with the actual
// instruction address in virtual memory (as code section
// is mapped to a fixed memory range).
// * If a binary is compiled with -pie, all the modules are
// mapped high at address space (in particular, higher than
// shadow memory of the tool), so the module can't be the
// first entry.
base_address = ((num_maps == 1) ? 0U : start_address) - file_offset;
// Skip to file name. "cursor" now points to dev. We need to
// skip at least two spaces for dev and inode.
int num_spaces = 0; int num_spaces = 0;
while (cursor < eol) { while (cursor < eol) {
if (*cursor == ' ') { if (*cursor == ' ') {
++num_spaces; ++num_spaces;
} else if (num_spaces >= 2) { } else if (num_spaces >= 3) {
// The first non-space character after skipping two spaces // The first non-space character after skipping three spaces
// is the beginning of the file name. // is the beginning of the file name.
break; break;
} }
@@ -616,105 +572,12 @@ OpenObjectFileContainingPcAndGetStartAddress(uint64_t pc,
// Finally, "cursor" now points to file name of our interest. // Finally, "cursor" now points to file name of our interest.
NO_INTR(object_fd = open(cursor, O_RDONLY)); NO_INTR(object_fd = open(cursor, O_RDONLY));
if (object_fd < 0) { if (object_fd < 0) {
// Failed to open object file. Copy the object file name to
// |out_file_name|.
strncpy(out_file_name, cursor, out_file_name_size);
// Making sure |out_file_name| is always null-terminated.
out_file_name[out_file_name_size - 1] = '\0';
return -1; return -1;
} }
return object_fd; return object_fd;
} }
} }
// POSIX doesn't define any async-signal safe function for converting
// an integer to ASCII. We'll have to define our own version.
// itoa_r() converts a (signed) integer to ASCII. It returns "buf", if the
// conversion was successful or NULL otherwise. It never writes more than "sz"
// bytes. Output will be truncated as needed, and a NUL character is always
// appended.
// NOTE: code from sandbox/linux/seccomp-bpf/demo.cc.
char *itoa_r(intptr_t i, char *buf, size_t sz, int base, size_t padding) {
// Make sure we can write at least one NUL byte.
size_t n = 1;
if (n > sz)
return NULL;
if (base < 2 || base > 16) {
buf[0] = '\000';
return NULL;
}
char *start = buf;
uintptr_t j = i;
// Handle negative numbers (only for base 10).
if (i < 0 && base == 10) {
j = -i;
// Make sure we can write the '-' character.
if (++n > sz) {
buf[0] = '\000';
return NULL;
}
*start++ = '-';
}
// Loop until we have converted the entire number. Output at least one
// character (i.e. '0').
char *ptr = start;
do {
// Make sure there is still enough space left in our output buffer.
if (++n > sz) {
buf[0] = '\000';
return NULL;
}
// Output the next digit.
*ptr++ = "0123456789abcdef"[j % base];
j /= base;
if (padding > 0)
padding--;
} while (j > 0 || padding > 0);
// Terminate the output with a NUL character.
*ptr = '\000';
// Conversion to ASCII actually resulted in the digits being in reverse
// order. We can't easily generate them in forward order, as we can't tell
// the number of characters needed until we are done converting.
// So, now, we reverse the string (except for the possible "-" sign).
while (--ptr > start) {
char ch = *ptr;
*ptr = *start;
*start++ = ch;
}
return buf;
}
// Safely appends string |source| to string |dest|. Never writes past the
// buffer size |dest_size| and guarantees that |dest| is null-terminated.
void SafeAppendString(const char* source, char* dest, int dest_size) {
int dest_string_length = strlen(dest);
SAFE_ASSERT(dest_string_length < dest_size);
dest += dest_string_length;
dest_size -= dest_string_length;
strncpy(dest, source, dest_size);
// Making sure |dest| is always null-terminated.
dest[dest_size - 1] = '\0';
}
// Converts a 64-bit value into a hex string, and safely appends it to |dest|.
// Never writes past the buffer size |dest_size| and guarantees that |dest| is
// null-terminated.
void SafeAppendHexNumber(uint64_t value, char* dest, int dest_size) {
// 64-bit numbers in hex can have up to 16 digits.
char buf[17] = {'\0'};
SafeAppendString(itoa_r(value, buf, sizeof(buf), 16, 0), dest, dest_size);
}
// The implementation of our symbolization routine. If it // The implementation of our symbolization routine. If it
// successfully finds the symbol containing "pc" and obtains the // successfully finds the symbol containing "pc" and obtains the
// symbol name, returns true and write the symbol name to "out". // symbol name, returns true and write the symbol name to "out".
@@ -727,40 +590,10 @@ static ATTRIBUTE_NOINLINE bool SymbolizeAndDemangle(void *pc, char *out,
int out_size) { int out_size) {
uint64_t pc0 = reinterpret_cast<uintptr_t>(pc); uint64_t pc0 = reinterpret_cast<uintptr_t>(pc);
uint64_t start_address = 0; uint64_t start_address = 0;
uint64_t base_address = 0;
int object_fd = -1;
if (out_size < 1) { int object_fd = OpenObjectFileContainingPcAndGetStartAddress(pc0,
return false; start_address);
} if (object_fd == -1) {
out[0] = '\0';
SafeAppendString("(", out, out_size);
if (g_symbolize_open_object_file_callback) {
object_fd = g_symbolize_open_object_file_callback(pc0, start_address,
base_address, out + 1,
out_size - 1);
} else {
object_fd = OpenObjectFileContainingPcAndGetStartAddress(pc0, start_address,
base_address,
out + 1,
out_size - 1);
}
// Check whether a file name was returned.
if (object_fd < 0) {
if (out[1]) {
// The object file containing PC was determined successfully however the
// object file was not opened successfully. This is still considered
// success because the object file name and offset are known and tools
// like asan_symbolize.py can be used for the symbolization.
out[out_size - 1] = '\0'; // Making sure |out| is always null-terminated.
SafeAppendString("+0x", out, out_size);
SafeAppendHexNumber(pc0 - base_address, out, out_size);
SafeAppendString(")", out, out_size);
return true;
}
// Failed to determine the object file containing PC. Bail out.
return false; return false;
} }
FileDescriptor wrapped_object_fd(object_fd); FileDescriptor wrapped_object_fd(object_fd);

View File

@@ -60,26 +60,9 @@
#ifdef HAVE_SYMBOLIZE #ifdef HAVE_SYMBOLIZE
#if defined(__ELF__) // defined by gcc #if defined(__ELF__) // defined by gcc on Linux
#if defined(__OpenBSD__)
#include <sys/exec_elf.h>
#else
#include <elf.h> #include <elf.h>
#endif
#if !defined(ANDROID)
#include <link.h> // For ElfW() macro. #include <link.h> // For ElfW() macro.
#endif
// For systems where SIZEOF_VOID_P is not defined, determine it
// based on __LP64__ (defined by gcc on 64-bit systems)
#if !defined(SIZEOF_VOID_P)
# if defined(__LP64__)
# define SIZEOF_VOID_P 8
# else
# define SIZEOF_VOID_P 4
# endif
#endif
// If there is no ElfW macro, let's define it by ourself. // If there is no ElfW macro, let's define it by ourself.
#ifndef ElfW #ifndef ElfW
@@ -105,10 +88,6 @@ _END_GOOGLE_NAMESPACE_
_START_GOOGLE_NAMESPACE_ _START_GOOGLE_NAMESPACE_
// Restrictions on the callbacks that follow:
// - The callbacks must not use heaps but only use stacks.
// - The callbacks must be async-signal-safe.
// Installs a callback function, which will be called right before a symbol name // Installs a callback function, which will be called right before a symbol name
// is printed. The callback is intended to be used for showing a file name and a // is printed. The callback is intended to be used for showing a file name and a
// line number preceding a symbol name. // line number preceding a symbol name.
@@ -120,24 +99,6 @@ typedef int (*SymbolizeCallback)(int fd, void *pc, char *out, size_t out_size,
uint64 relocation); uint64 relocation);
void InstallSymbolizeCallback(SymbolizeCallback callback); void InstallSymbolizeCallback(SymbolizeCallback callback);
// Installs a callback function, which will be called instead of
// OpenObjectFileContainingPcAndGetStartAddress. The callback is expected
// to searches for the object file (from /proc/self/maps) that contains
// the specified pc. If found, sets |start_address| to the start address
// of where this object file is mapped in memory, sets the module base
// address into |base_address|, copies the object file name into
// |out_file_name|, and attempts to open the object file. If the object
// file is opened successfully, returns the file descriptor. Otherwise,
// returns -1. |out_file_name_size| is the size of the file name buffer
// (including the null-terminator).
typedef int (*SymbolizeOpenObjectFileCallback)(uint64_t pc,
uint64_t &start_address,
uint64_t &base_address,
char *out_file_name,
int out_file_name_size);
void InstallSymbolizeOpenObjectFileCallback(
SymbolizeOpenObjectFileCallback callback);
_END_GOOGLE_NAMESPACE_ _END_GOOGLE_NAMESPACE_
#endif #endif

View File

@@ -23,8 +23,6 @@
# #
# ***** END GPL LICENSE BLOCK ***** # ***** END GPL LICENSE BLOCK *****
remove_strict_flags()
set(INC set(INC
) )

View File

@@ -565,20 +565,16 @@ int sdlewInit(void) {
/* Library paths. */ /* Library paths. */
#ifdef _WIN32 #ifdef _WIN32
/* Expected in c:/windows/system or similar, no path needed. */ /* Expected in c:/windows/system or similar, no path needed. */
const char *paths[] = {"SDL2.dll", NULL}; const char *path = "SDL2.dll";
#elif defined(__APPLE__) #elif defined(__APPLE__)
/* Default installation path. */ /* Default installation path. */
const char *paths[] = {"/usr/local/cuda/lib/libSDL2.dylib", NULL}; const char *path = "/usr/local/cuda/lib/libSDL2.dylib";
#else #else
const char *paths[] = {"libSDL2.so", const char *path = "libSDL2.so";
"libSDL2-2.0.so.0",
"libSDL.so",
NULL};
#endif #endif
static int initialized = 0; static int initialized = 0;
static int result = 0; static int result = 0;
int a, error; int error;
SDL_version version;
if (initialized) { if (initialized) {
return result; return result;
@@ -593,9 +589,7 @@ int sdlewInit(void) {
} }
/* Load library. */ /* Load library. */
for (a = 0; paths[a] != NULL && lib == NULL; ++a) { lib = dynamic_library_open(path);
lib = dynamic_library_open(paths[a]);
}
if (lib == NULL) { if (lib == NULL) {
result = SDLEW_ERROR_OPEN_FAILED; result = SDLEW_ERROR_OPEN_FAILED;
@@ -1095,18 +1089,7 @@ int sdlewInit(void) {
SDL_LIBRARY_FIND(SDL_HasClipboardText); SDL_LIBRARY_FIND(SDL_HasClipboardText);
SDL_LIBRARY_FIND(SDL_GetWindowWMInfo); SDL_LIBRARY_FIND(SDL_GetWindowWMInfo);
if (SDL_GetVersion == NULL) {
result = SDLEW_ERROR_VERSION;
}
else {
SDL_GetVersion(&version);
if(version.major < 2) {
result = SDLEW_ERROR_VERSION;
}
else {
result = SDLEW_SUCCESS; result = SDLEW_SUCCESS;
}
}
return result; return result;
} }

View File

@@ -19,8 +19,6 @@
# #
# ***** END LGPL LICENSE BLOCK ***** # ***** END LGPL LICENSE BLOCK *****
remove_extra_strict_flags()
set(INC set(INC
. .
FX FX

View File

@@ -276,9 +276,9 @@ bool AUD_OpenALDevice::AUD_OpenALHandle::seek(float position)
alGetSourcei(m_source, AL_SOURCE_STATE, &info); alGetSourcei(m_source, AL_SOURCE_STATE, &info);
// we need to stop playing sounds as well to clear the buffers if(info != AL_PLAYING)
// this might cause clicks, but fixes a bug regarding position determination {
if(info == AL_PAUSED || info == AL_PLAYING) if(info == AL_PAUSED)
alSourceStop(m_source); alSourceStop(m_source);
alSourcei(m_source, AL_BUFFER, 0); alSourcei(m_source, AL_BUFFER, 0);
@@ -319,6 +319,7 @@ bool AUD_OpenALDevice::AUD_OpenALHandle::seek(float position)
alSourceRewind(m_source); alSourceRewind(m_source);
} }
}
if(m_status == AUD_STATUS_STOPPED) if(m_status == AUD_STATUS_STOPPED)
m_status = AUD_STATUS_PAUSED; m_status = AUD_STATUS_PAUSED;
@@ -342,14 +343,9 @@ float AUD_OpenALDevice::AUD_OpenALHandle::getPosition()
if(!m_isBuffered) if(!m_isBuffered)
{ {
int queued;
// this usually always returns CYCLE_BUFFERS
alGetSourcei(m_source, AL_BUFFERS_QUEUED, &queued);
AUD_Specs specs = m_reader->getSpecs(); AUD_Specs specs = m_reader->getSpecs();
position += (m_reader->getPosition() - m_device->m_buffersize * position += (m_reader->getPosition() - m_device->m_buffersize *
queued) / (float)specs.rate; CYCLE_BUFFERS) / (float)specs.rate;
} }
return position; return position;

Some files were not shown because too many files have changed in this diff Show More