diff --git a/.gitignore b/.gitignore index a8d338edf7..14928e0e84 100644 --- a/.gitignore +++ b/.gitignore @@ -47,4 +47,4 @@ examples/wsperf/wsperf .sconsign.dblite -release/ \ No newline at end of file +build/ \ No newline at end of file diff --git a/SConstruct b/SConstruct index f17d9d9d2e..1dbf72d0dc 100644 --- a/SConstruct +++ b/SConstruct @@ -63,15 +63,12 @@ elif env['PLATFORM'] == 'posix': #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': @@ -80,51 +77,30 @@ 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) diff --git a/examples/echo_server/SConscript b/examples/echo_server/SConscript new file mode 100644 index 0000000000..f65aa91ab2 --- /dev/null +++ b/examples/echo_server/SConscript @@ -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') diff --git a/examples/wsperf/SConscript b/examples/wsperf/SConscript new file mode 100644 index 0000000000..7bc172397c --- /dev/null +++ b/examples/wsperf/SConscript @@ -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') diff --git a/src/SConscript b/src/SConscript new file mode 100644 index 0000000000..00fcfea756 --- /dev/null +++ b/src/SConscript @@ -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')