summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorTobias Hunger <tobias.hunger@qt.io>2016-09-09 08:01:45 (GMT)
committerBrad King <brad.king@kitware.com>2016-09-26 18:33:12 (GMT)
commit890432672bc9fe91365e5e5305285ab193e9060a (patch)
tree8df978e8e6a678ccd53940915d699decbd94da74 /Source
parent0a8ad6700eb7f54961271b3ee7b41add61eb0be5 (diff)
downloadCMake-890432672bc9fe91365e5e5305285ab193e9060a.zip
CMake-890432672bc9fe91365e5e5305285ab193e9060a.tar.gz
CMake-890432672bc9fe91365e5e5305285ab193e9060a.tar.bz2
server-mode: Add command to compute the build system
Diffstat (limited to 'Source')
-rw-r--r--Source/cmServerDictionary.h1
-rw-r--r--Source/cmServerProtocol.cxx23
-rw-r--r--Source/cmServerProtocol.h4
3 files changed, 27 insertions, 1 deletions
diff --git a/Source/cmServerDictionary.h b/Source/cmServerDictionary.h
index b78a1f4..fc1b44d 100644
--- a/Source/cmServerDictionary.h
+++ b/Source/cmServerDictionary.h
@@ -16,6 +16,7 @@
// Vocabulary:
+static const std::string kCOMPUTE_TYPE = "compute";
static const std::string kCONFIGURE_TYPE = "configure";
static const std::string kERROR_TYPE = "error";
static const std::string kGLOBAL_SETTINGS_TYPE = "globalSettings";
diff --git a/Source/cmServerProtocol.cxx b/Source/cmServerProtocol.cxx
index 06f5177..134edf3 100644
--- a/Source/cmServerProtocol.cxx
+++ b/Source/cmServerProtocol.cxx
@@ -280,6 +280,9 @@ const cmServerResponse cmServerProtocol1_0::Process(
{
assert(this->m_State >= STATE_ACTIVE);
+ if (request.Type == kCOMPUTE_TYPE) {
+ return this->ProcessCompute(request);
+ }
if (request.Type == kCONFIGURE_TYPE) {
return this->ProcessConfigure(request);
}
@@ -298,6 +301,26 @@ bool cmServerProtocol1_0::IsExperimental() const
return true;
}
+cmServerResponse cmServerProtocol1_0::ProcessCompute(
+ const cmServerRequest& request)
+{
+ if (this->m_State > STATE_CONFIGURED) {
+ return request.ReportError("This build system was already generated.");
+ }
+ if (this->m_State < STATE_CONFIGURED) {
+ return request.ReportError("This project was not configured yet.");
+ }
+
+ cmake* cm = this->CMakeInstance();
+ int ret = cm->Generate();
+
+ if (ret < 0) {
+ return request.ReportError("Failed to compute build system.");
+ }
+ m_State = STATE_COMPUTED;
+ return request.Reply(Json::Value());
+}
+
cmServerResponse cmServerProtocol1_0::ProcessConfigure(
const cmServerRequest& request)
{
diff --git a/Source/cmServerProtocol.h b/Source/cmServerProtocol.h
index c0148a4..e772eca 100644
--- a/Source/cmServerProtocol.h
+++ b/Source/cmServerProtocol.h
@@ -118,6 +118,7 @@ private:
std::string* errorMessage) override;
// Handle requests:
+ cmServerResponse ProcessCompute(const cmServerRequest& request);
cmServerResponse ProcessConfigure(const cmServerRequest& request);
cmServerResponse ProcessGlobalSettings(const cmServerRequest& request);
cmServerResponse ProcessSetGlobalSettings(const cmServerRequest& request);
@@ -126,7 +127,8 @@ private:
{
STATE_INACTIVE,
STATE_ACTIVE,
- STATE_CONFIGURED
+ STATE_CONFIGURED,
+ STATE_COMPUTED
};
State m_State = STATE_INACTIVE;
};