Skip to content

Commit 3fff0af

Browse files
authored
Merge pull request #1194 from emailweixu/glog_gflags
Compile glog with WITH_GFLAGS=ON
2 parents d7ee239 + 7ff8c8e commit 3fff0af

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

cmake/external/glog.cmake

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
# Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve.
2-
#
2+
#
33
# Licensed under the Apache License, Version 2.0 (the "License");
44
# you may not use this file except in compliance with the License.
55
# You may obtain a copy of the License at
6-
#
6+
#
77
# http://www.apache.org/licenses/LICENSE-2.0
8-
#
8+
#
99
# Unless required by applicable law or agreed to in writing, software
1010
# distributed under the License is distributed on an "AS IS" BASIS,
1111
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -29,12 +29,13 @@ INCLUDE_DIRECTORIES(${GLOG_INCLUDE_DIR})
2929
ExternalProject_Add(
3030
glog
3131
${EXTERNAL_PROJECT_LOG_ARGS}
32+
DEPENDS gflags
3233
GIT_REPOSITORY "https://github.com/google/glog.git"
3334
PREFIX ${GLOG_SOURCES_DIR}
3435
UPDATE_COMMAND ""
3536
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${GLOG_INSTALL_DIR}
3637
CMAKE_ARGS -DCMAKE_POSITION_INDEPENDENT_CODE=ON
37-
CMAKE_ARGS -DWITH_GFLAGS=OFF
38+
CMAKE_ARGS -DWITH_GFLAGS=ON
3839
CMAKE_ARGS -DBUILD_TESTING=OFF
3940
)
4041

paddle/utils/Util.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,20 +144,20 @@ void runInitFunctions() {
144144
}
145145

146146
void initMain(int argc, char** argv) {
147-
initializeLogging(argc, argv);
148147
installLayerStackTracer();
149148
std::string line;
150149
for (int i = 0; i < argc; ++i) {
151150
line += argv[i];
152151
line += ' ';
153152
}
154-
LOG(INFO) << "commandline: " << line;
155153

156154
#ifndef GFLAGS_GFLAGS_H_
157155
namespace gflags = google;
158156
#endif
159157

160158
gflags::ParseCommandLineFlags(&argc, &argv, true);
159+
initializeLogging(argc, argv);
160+
LOG(INFO) << "commandline: " << line;
161161
CHECK_EQ(argc, 1) << "Unknown commandline argument: " << argv[1];
162162

163163
installProfilerSwitch();

0 commit comments

Comments
 (0)