build: make precompiled headers more useful
This can reduce the compilation time of a release
build (without tests) by more than 40%
Refs: #5212
Change-Id: I977aff0c0c7becbfee8a8b55605b81d0c014829b
diff --git a/tools/nfdc/available-commands.cpp b/tools/nfdc/available-commands.cpp
deleted file mode 100644
index 6df761a..0000000
--- a/tools/nfdc/available-commands.cpp
+++ /dev/null
@@ -1,45 +0,0 @@
-/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/*
- * Copyright (c) 2014-2022, Regents of the University of California,
- * Arizona Board of Regents,
- * Colorado State University,
- * University Pierre & Marie Curie, Sorbonne University,
- * Washington University in St. Louis,
- * Beijing Institute of Technology,
- * The University of Memphis.
- *
- * This file is part of NFD (Named Data Networking Forwarding Daemon).
- * See AUTHORS.md for complete list of NFD authors and contributors.
- *
- * NFD is free software: you can redistribute it and/or modify it under the terms
- * of the GNU General Public License as published by the Free Software Foundation,
- * either version 3 of the License, or (at your option) any later version.
- *
- * NFD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
- * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * NFD, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include "available-commands.hpp"
-#include "cs-module.hpp"
-#include "face-module.hpp"
-#include "rib-module.hpp"
-#include "status.hpp"
-#include "strategy-choice-module.hpp"
-
-namespace nfd::tools::nfdc {
-
-void
-registerCommands(CommandParser& parser)
-{
- registerStatusCommands(parser);
- FaceModule::registerCommands(parser);
- RibModule::registerCommands(parser);
- CsModule::registerCommands(parser);
- StrategyChoiceModule::registerCommands(parser);
-}
-
-} // namespace nfd::tools::nfdc
diff --git a/tools/nfdc/command-definition.cpp b/tools/nfdc/command-definition.cpp
index 08952fd..c98197e 100644
--- a/tools/nfdc/command-definition.cpp
+++ b/tools/nfdc/command-definition.cpp
@@ -26,6 +26,7 @@
#include "command-definition.hpp"
#include "status-report.hpp"
+#include <boost/lexical_cast.hpp>
#include <ndn-cxx/util/logger.hpp>
namespace nfd::tools::nfdc {
diff --git a/tools/nfdc/command-parser.cpp b/tools/nfdc/command-parser.cpp
index 19bb5a2..2dff2ff 100644
--- a/tools/nfdc/command-parser.cpp
+++ b/tools/nfdc/command-parser.cpp
@@ -24,7 +24,12 @@
*/
#include "command-parser.hpp"
-#include "format-helpers.hpp"
+
+#include "cs-module.hpp"
+#include "face-module.hpp"
+#include "rib-module.hpp"
+#include "status.hpp"
+#include "strategy-choice-module.hpp"
#include <ndn-cxx/util/logger.hpp>
@@ -127,4 +132,14 @@
return {def.getNoun(), def.getVerb(), def.parse(tokens, nConsumed), i->second->execute};
}
+void
+registerCommands(CommandParser& parser)
+{
+ registerStatusCommands(parser);
+ FaceModule::registerCommands(parser);
+ RibModule::registerCommands(parser);
+ CsModule::registerCommands(parser);
+ StrategyChoiceModule::registerCommands(parser);
+}
+
} // namespace nfd::tools::nfdc
diff --git a/tools/nfdc/command-parser.hpp b/tools/nfdc/command-parser.hpp
index e0849b0..52ba292 100644
--- a/tools/nfdc/command-parser.hpp
+++ b/tools/nfdc/command-parser.hpp
@@ -123,6 +123,9 @@
std::vector<CommandContainer::const_iterator> m_commandOrder;
};
+void
+registerCommands(CommandParser& parser);
+
} // namespace nfd::tools::nfdc
#endif // NFD_TOOLS_NFDC_COMMAND_PARSER_HPP
diff --git a/tools/nfdc/face-module.cpp b/tools/nfdc/face-module.cpp
index 08409f7..4d9d3a2 100644
--- a/tools/nfdc/face-module.cpp
+++ b/tools/nfdc/face-module.cpp
@@ -27,6 +27,8 @@
#include "canonizer.hpp"
#include "find-face.hpp"
+#include <boost/lexical_cast/try_lexical_convert.hpp>
+
namespace nfd::tools::nfdc {
void
diff --git a/tools/nfdc/main.cpp b/tools/nfdc/main.cpp
index 78da697..b89a3f9 100644
--- a/tools/nfdc/main.cpp
+++ b/tools/nfdc/main.cpp
@@ -23,10 +23,11 @@
* NFD, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "available-commands.hpp"
-#include "core/version.hpp"
+#include "command-parser.hpp"
#include "help.hpp"
+#include "core/version.hpp"
+
#include <boost/tokenizer.hpp>
#include <fstream>
#include <iostream>
diff --git a/tools/nfdc/available-commands.hpp b/tools/nfdc/nfdc-pch.hpp
similarity index 82%
rename from tools/nfdc/available-commands.hpp
rename to tools/nfdc/nfdc-pch.hpp
index ad6525c..b2e789d 100644
--- a/tools/nfdc/available-commands.hpp
+++ b/tools/nfdc/nfdc-pch.hpp
@@ -23,16 +23,13 @@
* NFD, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef NFD_TOOLS_NFDC_AVAILABLE_COMMANDS_HPP
-#define NFD_TOOLS_NFDC_AVAILABLE_COMMANDS_HPP
+#ifndef NFD_TOOLS_NFDC_NFDC_PCH_HPP
+#define NFD_TOOLS_NFDC_NFDC_PCH_HPP
-#include "command-parser.hpp"
+#include "core/common.hpp"
-namespace nfd::tools::nfdc {
+#include <ndn-cxx/mgmt/nfd/controller.hpp>
+#include <ndn-cxx/security/validator-null.hpp>
+#include <ndn-cxx/util/logger.hpp>
-void
-registerCommands(CommandParser& parser);
-
-} // namespace nfd::tools::nfdc
-
-#endif // NFD_TOOLS_NFDC_AVAILABLE_COMMANDS_HPP
+#endif // NFD_TOOLS_NFDC_NFDC_PCH_HPP