mirror of
https://github.com/XRPLF/rippled.git
synced 2026-04-29 15:37:57 +00:00
Merge pull request #81 from oberstet/policy-refactor2
Various build things
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@@ -47,4 +47,4 @@ examples/wsperf/wsperf
|
||||
|
||||
.sconsign.dblite
|
||||
|
||||
release/
|
||||
build/
|
||||
89
SConstruct
89
SConstruct
@@ -44,78 +44,63 @@ def boostlibs(libnames):
|
||||
libs.append(lib)
|
||||
return libs
|
||||
|
||||
|
||||
if env['PLATFORM'].startswith('win'):
|
||||
env.Append(CPPDEFINES = ['WIN32', 'NDEBUG', '_CONSOLE', '_WEBSOCKETPP_CPP11_FRIEND_'])
|
||||
env.Append(CPPDEFINES = ['WIN32',
|
||||
'NDEBUG',
|
||||
'WIN32_LEAN_AND_MEAN',
|
||||
'_WIN32_WINNT=0x0600',
|
||||
'_CONSOLE',
|
||||
'_WEBSOCKETPP_CPP11_FRIEND_'])
|
||||
arch_flags = '/arch:SSE2'
|
||||
opt_flags = '/Ox /Oi /fp:fast'
|
||||
warn_flags = '/W3 /wd4996 /wd4995 /wd4355'
|
||||
env['CCFLAGS'] = '%s /EHsc /GR /GS- /MD /nologo %s %s' % (warn_flags, arch_flags, opt_flags)
|
||||
env['LINKFLAGS'] = '/INCREMENTAL:NO /MANIFEST /NOLOGO /OPT:REF /OPT:ICF /MACHINE:X86'
|
||||
elif env['PLATFORM'] == 'posix':
|
||||
env.Append(CPPDEFINES = ['NDEBUG'])
|
||||
env.Append(CCFLAGS = ['-Wall', '-fno-strict-aliasing'])
|
||||
env.Append(CCFLAGS = ['-O3', '-fomit-frame-pointer', '-march=core2'])
|
||||
#env['LINKFLAGS'] = ''
|
||||
|
||||
|
||||
env.VariantDir("release/", "src/");
|
||||
|
||||
if env['PLATFORM'].startswith('win'):
|
||||
lib_path = env['BOOST_LIBS']
|
||||
env['LIBPATH'] = env['BOOST_LIBS']
|
||||
else:
|
||||
lib_path = ['/usr/lib',
|
||||
'/usr/local/lib',
|
||||
env['BOOST_LIBS'],
|
||||
'#/release']
|
||||
env['LIBPATH'] = ['/usr/lib',
|
||||
'/usr/local/lib',
|
||||
env['BOOST_LIBS']]
|
||||
|
||||
platform_libs = []
|
||||
if env['PLATFORM'] == 'posix':
|
||||
platform_libs = ['pthread', 'rt']
|
||||
platform_libs = ['pthread', 'rt']
|
||||
elif env['PLATFORM'].startswith('win'):
|
||||
# Win/VC++ supports autolinking. nothing to do.
|
||||
pass
|
||||
|
||||
#### END OF GLOBAL CONF ########################################################
|
||||
|
||||
## WebSocket++ library
|
||||
##
|
||||
lib_sources = ["base64/base64.cpp",
|
||||
"md5/md5.c",
|
||||
"messages/data.cpp",
|
||||
"network_utilities.cpp",
|
||||
"processors/hybi_header.cpp",
|
||||
"sha1/sha1.cpp",
|
||||
"uri.cpp"]
|
||||
releasedir = 'build/release/'
|
||||
debugdir = 'build/debug/'
|
||||
builddir = releasedir
|
||||
|
||||
static_lib = env.StaticLibrary(target = 'release/websocketpp',
|
||||
source = lib_sources,
|
||||
srcdir = "release")
|
||||
#shared_lib=env.SharedLibrary(target = 'release/websocketpp', source = lib_sources, srcdir="release",LIBS=['boost_regex'],LIBPATH=lib_path)
|
||||
Export('env')
|
||||
Export('platform_libs')
|
||||
Export('boostlibs')
|
||||
|
||||
## END OF CONFIG !!
|
||||
|
||||
## TARGETS:
|
||||
|
||||
static_lib, shared_lib = SConscript('src/SConscript',
|
||||
variant_dir = builddir + 'websocketpp',
|
||||
duplicate = 0)
|
||||
|
||||
wslib = static_lib
|
||||
Export('wslib')
|
||||
|
||||
## Echo Server
|
||||
##
|
||||
env.VariantDir("#/release/echo_server", "examples/echo_server")
|
||||
env.Program(target = "#/release/echo_server/echo_server",
|
||||
srcdir = "#/release/echo_server/",
|
||||
source = ["echo_server.cpp"],
|
||||
LIBS = [wslib, platform_libs] + boostlibs(['system',
|
||||
'date_time',
|
||||
'regex',
|
||||
'thread']),
|
||||
LIBPATH = lib_path)
|
||||
wsperf = SConscript('#/examples/wsperf/SConscript',
|
||||
variant_dir = builddir + 'wsperf',
|
||||
duplicate = 0)
|
||||
|
||||
## wsperf
|
||||
##
|
||||
env.VariantDir("#/release/wsperf", "examples/wsperf")
|
||||
env.Program(target = "#/release/wsperf/wsperf",
|
||||
srcdir = "#/release/wsperf/",
|
||||
source = ["wsperf.cpp",
|
||||
"request.cpp",
|
||||
"case.cpp",
|
||||
"generic.cpp"],
|
||||
LIBS = [wslib, platform_libs] + boostlibs(['system',
|
||||
'date_time',
|
||||
'regex',
|
||||
'thread',
|
||||
'random',
|
||||
'chrono',
|
||||
'program_options']),
|
||||
LIBPATH = lib_path)
|
||||
echo_server = SConscript('#/examples/echo_server/SConscript',
|
||||
variant_dir = builddir + 'echo_server',
|
||||
duplicate = 0)
|
||||
|
||||
20
examples/echo_server/SConscript
Normal file
20
examples/echo_server/SConscript
Normal file
@@ -0,0 +1,20 @@
|
||||
## echo_server
|
||||
##
|
||||
|
||||
Import('env')
|
||||
Import('boostlibs')
|
||||
Import('wslib')
|
||||
Import('platform_libs')
|
||||
|
||||
localenv = env.Clone ()
|
||||
|
||||
sources = ["echo_server.cpp"]
|
||||
|
||||
LIBS = [wslib, platform_libs] + boostlibs(['system',
|
||||
'date_time',
|
||||
'regex',
|
||||
'thread'])
|
||||
|
||||
prg = localenv.Program('echo_server', sources, LIBS = LIBS)
|
||||
|
||||
Return('prg')
|
||||
26
examples/wsperf/SConscript
Normal file
26
examples/wsperf/SConscript
Normal file
@@ -0,0 +1,26 @@
|
||||
## wsperf
|
||||
##
|
||||
|
||||
Import('env')
|
||||
Import('boostlibs')
|
||||
Import('wslib')
|
||||
Import('platform_libs')
|
||||
|
||||
localenv = env.Clone ()
|
||||
|
||||
sources = ["wsperf.cpp",
|
||||
"request.cpp",
|
||||
"case.cpp",
|
||||
"generic.cpp"]
|
||||
|
||||
LIBS = [wslib, platform_libs] + boostlibs(['system',
|
||||
'date_time',
|
||||
'regex',
|
||||
'thread',
|
||||
'random',
|
||||
'chrono',
|
||||
'program_options'])
|
||||
|
||||
prg = localenv.Program('wsperf', sources, LIBS = LIBS)
|
||||
|
||||
Return('prg')
|
||||
@@ -23,4 +23,4 @@
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
*/
|
||||
|
||||
@@ -316,4 +316,4 @@ typedef boost::shared_ptr<case_handler> case_handler_ptr;
|
||||
|
||||
} // namespace wsperf
|
||||
|
||||
#endif // WSPERF_CASE_HPP
|
||||
#endif // WSPERF_CASE_HPP
|
||||
|
||||
@@ -23,4 +23,4 @@
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
*/
|
||||
|
||||
@@ -158,4 +158,4 @@ private:
|
||||
|
||||
} // namespace wsperf
|
||||
|
||||
#endif // WSPERF_CASE_GENERIC_HPP
|
||||
#endif // WSPERF_CASE_GENERIC_HPP
|
||||
|
||||
@@ -23,4 +23,4 @@
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
*/
|
||||
|
||||
@@ -188,11 +188,4 @@ void process_requests(request_coordinator* coordinator) {
|
||||
|
||||
} // namespace wsperf
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // WSPERF_REQUEST_HPP
|
||||
#endif // WSPERF_REQUEST_HPP
|
||||
|
||||
19
src/SConscript
Normal file
19
src/SConscript
Normal file
@@ -0,0 +1,19 @@
|
||||
## websocket++ library
|
||||
##
|
||||
|
||||
Import('env')
|
||||
|
||||
localenv = env.Clone ()
|
||||
|
||||
sources = ["base64/base64.cpp",
|
||||
"md5/md5.c",
|
||||
"messages/data.cpp",
|
||||
"network_utilities.cpp",
|
||||
"processors/hybi_header.cpp",
|
||||
"sha1/sha1.cpp",
|
||||
"uri.cpp"]
|
||||
|
||||
static_lib = localenv.StaticLibrary('websocketpp', sources)
|
||||
shared_lib = None # localenv.SharedLibrary('websocketpp', sources)
|
||||
|
||||
Return('static_lib', 'shared_lib')
|
||||
@@ -348,7 +348,7 @@ public:
|
||||
boost::asio::async_read(
|
||||
socket_type::get_socket(),
|
||||
m_buf,
|
||||
boost::asio::transfer_at_least(m_processor->get_bytes_needed()),
|
||||
boost::asio::transfer_at_least(static_cast<size_t>(m_processor->get_bytes_needed())),
|
||||
boost::bind(
|
||||
&type::handle_read_frame,
|
||||
type::shared_from_this(),
|
||||
|
||||
@@ -58,7 +58,7 @@ uint64_t data::process_payload(std::istream& input,uint64_t size) {
|
||||
|
||||
if (new_size > m_payload.capacity()) {
|
||||
m_payload.reserve(std::max<size_t>(
|
||||
new_size, static_cast<size_t>(2*m_payload.capacity())
|
||||
static_cast<size_t>(new_size), static_cast<size_t>(2*m_payload.capacity())
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
@@ -28,22 +28,19 @@
|
||||
#ifndef WEBSOCKETPP_ROLE_CLIENT_HPP
|
||||
#define WEBSOCKETPP_ROLE_CLIENT_HPP
|
||||
|
||||
#include "../endpoint.hpp"
|
||||
#include "../uri.hpp"
|
||||
#include "../shared_const_buffer.hpp"
|
||||
|
||||
#ifndef __STDC_LIMIT_MACROS
|
||||
#define __STDC_LIMIT_MACROS
|
||||
#endif
|
||||
#include <stdint.h>
|
||||
#include <limits>
|
||||
#include <iostream>
|
||||
|
||||
#include <boost/cstdint.hpp>
|
||||
#include <boost/asio.hpp>
|
||||
#include <boost/bind.hpp>
|
||||
#include <boost/shared_ptr.hpp>
|
||||
#include <boost/random.hpp>
|
||||
#include <boost/random/random_device.hpp>
|
||||
|
||||
#include <iostream>
|
||||
#include "../endpoint.hpp"
|
||||
#include "../uri.hpp"
|
||||
#include "../shared_const_buffer.hpp"
|
||||
|
||||
#ifdef _MSC_VER
|
||||
// Disable "warning C4355: 'this' : used in base member initializer list".
|
||||
@@ -209,8 +206,8 @@ public:
|
||||
client (boost::asio::io_service& m)
|
||||
: m_endpoint(static_cast< endpoint_type& >(*this)),
|
||||
m_io_service(m),
|
||||
m_gen(m_rng,boost::random::uniform_int_distribution<>(INT32_MIN,
|
||||
INT32_MAX)) {}
|
||||
m_gen(m_rng,boost::random::uniform_int_distribution<>(std::numeric_limits<int32_t>::min(),
|
||||
std::numeric_limits<int32_t>::max())) {}
|
||||
|
||||
connection_ptr connect(const std::string& u);
|
||||
|
||||
@@ -537,4 +534,8 @@ void client<endpoint>::connection<connection_type>::log_open_result() {
|
||||
} // namespace role
|
||||
} // namespace websocketpp
|
||||
|
||||
#ifdef _MSC_VER
|
||||
# pragma warning(pop)
|
||||
#endif
|
||||
|
||||
#endif // WEBSOCKETPP_ROLE_CLIENT_HPP
|
||||
|
||||
@@ -650,4 +650,8 @@ void server<endpoint>::connection<connection_type>::log_open_result() {
|
||||
} // namespace role
|
||||
} // namespace websocketpp
|
||||
|
||||
#ifdef _MSC_VER
|
||||
# pragma warning(pop)
|
||||
#endif
|
||||
|
||||
#endif // WEBSOCKETPP_ROLE_SERVER_HPP
|
||||
|
||||
@@ -317,4 +317,4 @@ uint16_t uri::get_port_from_string(const std::string& port) const {
|
||||
}
|
||||
|
||||
return t_port;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -65,7 +65,7 @@
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions>_WEBSOCKETPP_CPP11_FRIEND_;WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>$(BOOSTROOT);..;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
<BufferSecurityCheck>false</BufferSecurityCheck>
|
||||
|
||||
Reference in New Issue
Block a user