forked from bartvdbraak/blender
Glog/gflags: Reduce amount of local modifications
With better directory layout and more proper include statements we can avoid several local modifications, such as changing config.h for Windows Glog and the ones related on pass-through statements in logging headers in Glog. This commit also makes unused functions not-a-warning for external code.
This commit is contained in:
parent
60712d12eb
commit
ab48e6355d
@ -1294,7 +1294,7 @@ if(WITH_LIBMV OR WITH_GTESTS OR (WITH_CYCLES AND WITH_CYCLES_LOGGING))
|
||||
if(WIN32)
|
||||
set(GLOG_INCLUDE_DIRS ${CMAKE_SOURCE_DIR}/extern/glog/src/windows)
|
||||
else()
|
||||
set(GLOG_INCLUDE_DIRS ${CMAKE_SOURCE_DIR}/extern/glog/src)
|
||||
set(GLOG_INCLUDE_DIRS ${CMAKE_SOURCE_DIR}/extern/glog/include)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
@ -1431,6 +1431,7 @@ if(CMAKE_COMPILER_IS_GNUCC)
|
||||
# flags to undo strict flags
|
||||
ADD_CHECK_C_COMPILER_FLAG(CC_REMOVE_STRICT_FLAGS C_WARN_NO_DEPRECATED_DECLARATIONS -Wno-deprecated-declarations)
|
||||
ADD_CHECK_C_COMPILER_FLAG(CC_REMOVE_STRICT_FLAGS C_WARN_NO_UNUSED_PARAMETER -Wno-unused-parameter)
|
||||
ADD_CHECK_C_COMPILER_FLAG(CC_REMOVE_STRICT_FLAGS C_WARN_NO_UNUSED_FUNCTION -Wno-unused-function)
|
||||
|
||||
if(CMAKE_COMPILER_IS_GNUCC AND (NOT "${CMAKE_C_COMPILER_VERSION}" VERSION_LESS "7.0"))
|
||||
ADD_CHECK_C_COMPILER_FLAG(CC_REMOVE_STRICT_FLAGS C_WARN_NO_IMPLICIT_FALLTHROUGH -Wno-implicit-fallthrough)
|
||||
|
12
extern/ceres/CMakeLists.txt
vendored
12
extern/ceres/CMakeLists.txt
vendored
@ -36,6 +36,8 @@ set(INC
|
||||
|
||||
set(INC_SYS
|
||||
${EIGEN3_INCLUDE_DIRS}
|
||||
${GFLAGS_INCLUDE_DIRS}
|
||||
${GLOG_INCLUDE_DIRS}
|
||||
)
|
||||
|
||||
set(SRC
|
||||
@ -303,16 +305,6 @@ else()
|
||||
add_definitions(-DCERES_RESTRICT_SCHUR_SPECIALIZATION)
|
||||
endif()
|
||||
|
||||
if(WIN32)
|
||||
list(APPEND INC
|
||||
../glog/src/windows
|
||||
)
|
||||
else()
|
||||
list(APPEND INC
|
||||
../glog/src
|
||||
)
|
||||
endif()
|
||||
|
||||
add_definitions(${GFLAGS_DEFINES})
|
||||
add_definitions(${GLOG_DEFINES})
|
||||
add_definitions(${CERES_DEFINES})
|
||||
|
12
extern/ceres/bundle.sh
vendored
12
extern/ceres/bundle.sh
vendored
@ -129,6 +129,8 @@ set(INC
|
||||
|
||||
set(INC_SYS
|
||||
\${EIGEN3_INCLUDE_DIRS}
|
||||
\${GFLAGS_INCLUDE_DIRS}
|
||||
\${GLOG_INCLUDE_DIRS}
|
||||
)
|
||||
|
||||
set(SRC
|
||||
@ -145,16 +147,6 @@ else()
|
||||
add_definitions(-DCERES_RESTRICT_SCHUR_SPECIALIZATION)
|
||||
endif()
|
||||
|
||||
if(WIN32)
|
||||
list(APPEND INC
|
||||
../glog/src/windows
|
||||
)
|
||||
else()
|
||||
list(APPEND INC
|
||||
../glog/src
|
||||
)
|
||||
endif()
|
||||
|
||||
add_definitions(\${GFLAGS_DEFINES})
|
||||
add_definitions(\${GLOG_DEFINES})
|
||||
add_definitions(\${CERES_DEFINES})
|
||||
|
5
extern/gflags/README.blender
vendored
5
extern/gflags/README.blender
vendored
@ -17,10 +17,5 @@ Local modifications:
|
||||
- Applied some modifications from fork https://github.com/Nazg-Gul/gflags.git
|
||||
(see https://github.com/gflags/gflags/pull/129)
|
||||
|
||||
- Made `google::{anonymous}::FlagValue::ValueSize() const` inlined, so it does
|
||||
not trigger strict compiler warning.
|
||||
|
||||
- Did the same for CommandLineFlagParser::ValidateFlags().
|
||||
|
||||
- Ifdef-ed __attribute((unused)) in gflags.h.
|
||||
This file is compile-time configurable in upstream, so can not avoid change here.
|
||||
|
6
extern/gflags/src/gflags.cc
vendored
6
extern/gflags/src/gflags.cc
vendored
@ -225,7 +225,7 @@ class FlagValue {
|
||||
bool Equal(const FlagValue& x) const;
|
||||
FlagValue* New() const; // creates a new one with default value
|
||||
void CopyFrom(const FlagValue& x);
|
||||
inline int ValueSize() const;
|
||||
int ValueSize() const;
|
||||
|
||||
// Calls the given validate-fn on value_buffer_, and returns
|
||||
// whatever it returns. But first casts validate_fn_proto to a
|
||||
@ -485,7 +485,7 @@ void FlagValue::CopyFrom(const FlagValue& x) {
|
||||
}
|
||||
}
|
||||
|
||||
inline int FlagValue::ValueSize() const {
|
||||
int FlagValue::ValueSize() const {
|
||||
if (type_ > FV_MAX_INDEX) {
|
||||
assert(false); // unknown type
|
||||
return 0;
|
||||
@ -1257,7 +1257,7 @@ void CommandLineFlagParser::ValidateFlags(bool all) {
|
||||
}
|
||||
}
|
||||
|
||||
inline void CommandLineFlagParser::ValidateAllFlags() {
|
||||
void CommandLineFlagParser::ValidateAllFlags() {
|
||||
ValidateFlags(true);
|
||||
}
|
||||
|
||||
|
2
extern/gflags/src/gflags_completions.cc
vendored
2
extern/gflags/src/gflags_completions.cc
vendored
@ -55,8 +55,6 @@
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
#include "gflags_completions.h"
|
||||
|
||||
#include "config.h"
|
||||
#include "gflags/gflags.h"
|
||||
#include "gflags/gflags_completions.h"
|
||||
|
14
extern/glog/CMakeLists.txt
vendored
14
extern/glog/CMakeLists.txt
vendored
@ -23,6 +23,7 @@
|
||||
# ***** END GPL LICENSE BLOCK *****
|
||||
|
||||
set(INC
|
||||
src
|
||||
../gflags/src
|
||||
)
|
||||
|
||||
@ -70,24 +71,23 @@ if(WIN32)
|
||||
|
||||
list(APPEND INC
|
||||
src/windows
|
||||
src
|
||||
)
|
||||
else()
|
||||
list(APPEND INC
|
||||
src
|
||||
include
|
||||
)
|
||||
|
||||
list(APPEND SRC
|
||||
src/demangle.cc
|
||||
src/signalhandler.cc
|
||||
src/symbolize.cc
|
||||
|
||||
src/demangle.h
|
||||
src/glog/logging.h
|
||||
src/glog/log_severity.h
|
||||
src/glog/raw_logging.h
|
||||
src/glog/vlog_is_on.h
|
||||
src/symbolize.h
|
||||
|
||||
include/glog/logging.h
|
||||
include/glog/log_severity.h
|
||||
include/glog/raw_logging.h
|
||||
include/glog/vlog_is_on.h
|
||||
)
|
||||
endif()
|
||||
|
||||
|
2
extern/glog/README.blender
vendored
2
extern/glog/README.blender
vendored
@ -5,3 +5,5 @@ Upstream version: 0.3.5, a6a166db069
|
||||
Local modifications:
|
||||
* Added per-platform config.h files so no configuration-time
|
||||
checks for functions and so are needed.
|
||||
* Added special definitions of HAVE_SNPRINTF and HAVE_LIB_GFLAGS
|
||||
in Windows' specific config.h.
|
||||
|
@ -33,11 +33,6 @@
|
||||
// Pretty much everybody needs to #include this file so that they can
|
||||
// log various happenings.
|
||||
//
|
||||
|
||||
#ifdef WIN32
|
||||
# include "windows/glog/logging.h"
|
||||
#else // WIN32
|
||||
|
||||
#ifndef _LOGGING_H_
|
||||
#define _LOGGING_H_
|
||||
|
||||
@ -1628,5 +1623,3 @@ GOOGLE_GLOG_DLL_DECL void InstallFailureWriter(
|
||||
}
|
||||
|
||||
#endif // _LOGGING_H_
|
||||
|
||||
#endif // WIN32
|
@ -33,10 +33,6 @@
|
||||
// acquire any locks, and can therefore be used by low-level memory
|
||||
// allocation and synchronization code.
|
||||
|
||||
#ifdef WIN32
|
||||
# include "windows/glog/raw_logging.h"
|
||||
#else // WIN32
|
||||
|
||||
#ifndef BASE_RAW_LOGGING_H_
|
||||
#define BASE_RAW_LOGGING_H_
|
||||
|
||||
@ -187,5 +183,3 @@ GOOGLE_GLOG_DLL_DECL void RawLog__SetLastTime(const struct tm& t, int usecs);
|
||||
}
|
||||
|
||||
#endif // BASE_RAW_LOGGING_H_
|
||||
|
||||
#endif // WIN32
|
@ -44,10 +44,6 @@
|
||||
// - GLOG_STL_LOGGING_FOR_EXT_SLIST - <ext/slist>
|
||||
//
|
||||
|
||||
#ifdef WIN32
|
||||
# include "windows/glog/stl_logging.h"
|
||||
#else // WIN32
|
||||
|
||||
#ifndef UTIL_GTL_STL_LOGGING_INL_H_
|
||||
#define UTIL_GTL_STL_LOGGING_INL_H_
|
||||
|
||||
@ -222,5 +218,3 @@ inline void PrintSequence(std::ostream& out, Iter begin, Iter end) {
|
||||
namespace std { using ::operator<<; }
|
||||
|
||||
#endif // UTIL_GTL_STL_LOGGING_INL_H_
|
||||
|
||||
#endif // WIN32
|
2
extern/glog/src/windows/glog/logging.h
vendored
2
extern/glog/src/windows/glog/logging.h
vendored
@ -86,7 +86,7 @@
|
||||
#include <inttypes.h> // a third place for uint16_t or u_int16_t
|
||||
#endif
|
||||
|
||||
#if 1
|
||||
#if 0
|
||||
#include <gflags/gflags.h>
|
||||
#endif
|
||||
|
||||
|
@ -18,6 +18,7 @@
|
||||
#define __UTIL_LOGGING_H__
|
||||
|
||||
#if defined(WITH_CYCLES_LOGGING) && !defined(__KERNEL_GPU__)
|
||||
# include <gflags/gflags.h>
|
||||
# include <glog/logging.h>
|
||||
#endif
|
||||
|
||||
|
@ -45,7 +45,7 @@ if(WITH_LIBMV)
|
||||
|
||||
list(APPEND INC
|
||||
${GFLAGS_INCLUDE_DIRS}
|
||||
../../extern/glog/src
|
||||
${GLOG_INCLUDE_DIRS}
|
||||
../../extern/ceres/include
|
||||
../../extern/ceres/config
|
||||
../guardedalloc
|
||||
|
@ -124,7 +124,7 @@ if(WITH_LIBMV)
|
||||
|
||||
list(APPEND INC
|
||||
\${GFLAGS_INCLUDE_DIRS}
|
||||
../../extern/glog/src
|
||||
\${GLOG_INCLUDE_DIRS}
|
||||
../../extern/ceres/include
|
||||
../../extern/ceres/config
|
||||
../guardedalloc
|
||||
|
Loading…
Reference in New Issue
Block a user