Cycles: Post-reintegration tweaks to ensure things do compile

This commit contains all the tweaks which were missing in initial patch
re-integration from the standalone Cycles repository.

This commit also contains an utility cmake macro to help linking targets
with different libraries for release/debug builds, the name currently is

  target_link_libraries_decoupled

it gets a target and list of libraries and makes sure debug builds are
using libraries with "_d" suffix.

After all this changes it'll hopefully be easier to interchange patches
between blender and standalone repositories, because they're now quite
identical.
This commit is contained in:
Sergey Sharybin
2015-01-01 01:01:31 +05:00
parent b8fc4fe5aa
commit e9596e5def
8 changed files with 34 additions and 8 deletions

View File

@@ -118,6 +118,19 @@ macro(target_link_libraries_debug TARGET LIBS)
unset(_LIB)
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/
# use it instead of include_directories()
macro(blender_include_dirs

View File

@@ -179,10 +179,11 @@ include_directories(
${PUGIXML_INCLUDE_DIR}
)
# TODO(sergey): Adjust so standalone repository is also happy.
include_directories(
../atomic
)
if(CYCLES_STANDALONE_REPOSITORY)
include_directories(../third_party/atomic)
else()
include_directories(../atomic)
endif()
# Warnings
if(CMAKE_COMPILER_IS_GNUCXX)

View File

@@ -65,7 +65,7 @@ if env['WITH_BF_CYCLES_DEBUG']:
if env['WITH_BF_CYCLES_LOGGING']:
defs.append('WITH_CYCLES_LOGGING')
defs.append('GOOGLE_GLOG_DLL_DECL=')
defs.append('GFLAGS_NAMESPACE=gflags')
defs.append('CYCLES_GFLAGS_NAMESPACE=gflags')
if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc', 'win64-mingw'):
incs.append('#extern/libmv/third_party/glog/src/windows')
incs.append('#extern/libmv/third_party/gflags')

View File

@@ -45,6 +45,7 @@ if(CYCLES_STANDALONE_REPOSITORY)
endif()
else()
list(APPEND LIBRARIES bf_intern_glew_mx)
list(APPEND LIBRARIES extern_glog)
endif()
if(WITH_CYCLES_STANDALONE AND WITH_CYCLES_STANDALONE_GUI)

View File

@@ -136,5 +136,6 @@ else()
set(GLOG_INCLUDE_DIRS ${CMAKE_SOURCE_DIR}/extern/libmv/third_party/glog/src)
set(GFLAGS_INCLUDE_DIRS ${CMAKE_SOURCE_DIR}/extern/libmv/third_party/gflags)
endif()
set(GFLAGS_NAMESPACE gflags)
set(GFLAGS_NAMESPACE "gflags")
set(LLVM_LIBRARIES ${LLVM_LIBRARY})
endif()

View File

@@ -50,7 +50,7 @@ if env['WITH_BF_CYCLES_DEBUG']:
if env['WITH_BF_CYCLES_LOGGING']:
defs.append('WITH_CYCLES_LOGGING')
defs.append('GOOGLE_GLOG_DLL_DECL=')
defs.append('GFLAGS_NAMESPACE=gflags')
defs.append('CYCLES_GFLAGS_NAMESPACE=gflags')
if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc', 'win64-mingw'):
incs.append('#extern/libmv/third_party/glog/src/windows')
incs.append('#extern/libmv/third_party/gflags')

View File

@@ -21,6 +21,10 @@ set(SRC
util_transform.cpp
)
if(NOT CYCLES_STANDALONE_REPOSITORY)
add_definitions(-DWITH_GLEW_MX)
endif()
if(WITH_CYCLES_STANDALONE AND WITH_CYCLES_STANDALONE_GUI)
list(APPEND SRC
util_view.cpp

View File

@@ -20,6 +20,12 @@
/* OpenGL header includes, used everywhere we use OpenGL, to deal with
* platform differences in one central place. */
#include "glew-mx.h"
#ifdef WITH_GLEW_MX
# include "glew-mx.h"
#else
# include <GL/glew.h>
# define mxCreateContext() glewInit()
# define mxMakeCurrentContext(x) (x)
#endif
#endif /* __UTIL_OPENGL_H__ */