Add CMake support:

cmake support in rippled. Currently supports:

 * unity/nounity debug/release
 * running protobuf
 * sanitizer builds
 * optional release build with assert turned on
 * `target` variable to easily set compiler/debug/unity
    (i.e. -Dtarget=gcc.debug.nounity)
 * gcc/clang/visual studio/xcode
 * linux/mac/win
 * gcc 4 ABI, when needed
 * ninja builds
 * check openssl for acceptably recent release
 * static builds

TBD:
 * jemalloc support
 * count

Notes:
 * Use the -G"Visual Studio 14 2015 Win64" generator on Windows. Without
   this a 32-bit project will be created. There is no way to set the
   generator or force a 64-bit build in CMakeLists.txt (setting
   CMAKE_GENERATOR_PLATFORM won't work). The best solution may be to
   wrap cmake with a script.

 * It is not possible to generate a visual studio project on linux or
   mac. The visual studio generator is only available on windows.

 * The visual studio project can be _either_ unity or
   non-unity (selected at generation time).  It does not appear possible
   to disable compilation based on configuration.

 * Language is _much_ worse than python, poor documentation and "quirky"
   language support (for example, generator expressions can only be used
   in limited contexts and seem to work differently based on
   context (set_property can set multiple values, add_compile_options
   can not/or is buggy)

 * Could not call out to `sed` because cmake messed with the regular
   expression before calling the external command. I did not see a way
   around this.

 * Makefile generators want to be single target. It wants a separate
   directory for each target type. I saw some mentions on the web for
   ways around this bug haven't look into it. The visual studio project
   does support debug/release configurations in the same project (but
   not unity/non-unity).
This commit is contained in:
seelabs
2016-06-28 17:14:29 -04:00
committed by Nik Bougalis
parent b343b0468a
commit 3b58e36621
7 changed files with 837 additions and 92 deletions

View File

@@ -73,7 +73,6 @@
#include <ripple/rpc/Context.h>
#include <ripple/rpc/RPCHandler.h>
#include <ripple/shamap/Family.h>
#include <ripple/unity/git_id.h>
#include <ripple/websocket/MakeServer.h>
#include <ripple/crypto/csprng.h>
#include <ripple/beast/asio/io_latency_probe.h>
@@ -807,7 +806,7 @@ public:
void onStart () override
{
JLOG(m_journal.info())
<< "Application starting. Build is " << gitCommitID();
<< "Application starting. Version is " << BuildInfo::getVersionString();
m_sweepTimer.setExpiration (10);
m_entropyTimer.setRecurringExpiration (300);

View File

@@ -1,32 +0,0 @@
//------------------------------------------------------------------------------
/*
This file is part of rippled: https://github.com/ripple/rippled
Copyright (c) 2012, 2013 Ripple Labs Inc.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
//==============================================================================
#include <ripple/unity/git_id.h>
namespace ripple {
std::string gitCommitID() {
#if defined(GIT_COMMIT_ID)
return GIT_COMMIT_ID;
#else
return std::string();
#endif
}
}

View File

@@ -1,32 +0,0 @@
//------------------------------------------------------------------------------
/*
This file is part of rippled: https://github.com/ripple/rippled
Copyright (c) 2012, 2013 Ripple Labs Inc.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
//==============================================================================
#ifndef RIPPLE_UNITY_GIT_ID_H_INCLUDED
#define RIPPLE_UNITY_GIT_ID_H_INCLUDED
#include <string>
namespace ripple {
/** Get the git commit id from the git repo from which this was compiled. */
std::string gitCommitID();
}
#endif