diff options
Diffstat (limited to 'Documentation/SwiftenDevelopersGuide')
6 files changed, 37 insertions, 9 deletions
diff --git a/Documentation/SwiftenDevelopersGuide/Examples/EchoBot/.gitignore b/Documentation/SwiftenDevelopersGuide/Examples/EchoBot/.gitignore index 91c939b..aca6fe1 100644 --- a/Documentation/SwiftenDevelopersGuide/Examples/EchoBot/.gitignore +++ b/Documentation/SwiftenDevelopersGuide/Examples/EchoBot/.gitignore @@ -3,2 +3,3 @@ EchoBot? *.h.xml EchoComponent +Swiften.cpp diff --git a/Documentation/SwiftenDevelopersGuide/Examples/EchoBot/EchoBot2.cpp b/Documentation/SwiftenDevelopersGuide/Examples/EchoBot/EchoBot2.cpp index deeb852..8b81489 100644 --- a/Documentation/SwiftenDevelopersGuide/Examples/EchoBot/EchoBot2.cpp +++ b/Documentation/SwiftenDevelopersGuide/Examples/EchoBot/EchoBot2.cpp @@ -13,5 +13,5 @@ using namespace Swift; using namespace boost; -Client* client; +static Client* client; void handleConnected(); diff --git a/Documentation/SwiftenDevelopersGuide/Examples/EchoBot/EchoComponent.cpp b/Documentation/SwiftenDevelopersGuide/Examples/EchoBot/EchoComponent.cpp index 397bc21..a6e6ca0 100644 --- a/Documentation/SwiftenDevelopersGuide/Examples/EchoBot/EchoComponent.cpp +++ b/Documentation/SwiftenDevelopersGuide/Examples/EchoBot/EchoComponent.cpp @@ -1,4 +1,4 @@ /* - * Copyright (c) 2010 Remko Tronçon + * Copyright (c) 2010-2013 Remko Tronçon * Licensed under the GNU General Public License v3. * See Documentation/Licenses/GPLv3.txt for more information. @@ -15,7 +15,6 @@ using namespace boost; class EchoComponent { public: - EchoComponent(EventLoop* eventLoop, NetworkFactories* networkFactories) : jid("echo.wonderland.lit") { - component = new Component(eventLoop, networkFactories, - jid, "EchoSecret"); + EchoComponent(NetworkFactories* networkFactories) : jid("echo.wonderland.lit") { + component = new Component(jid, "EchoSecret", networkFactories); component->onConnected.connect(bind(&EchoComponent::handleConnected, this)); component->onMessageReceived.connect( @@ -63,5 +62,5 @@ int main(int, char**) { BoostNetworkFactories networkFactories(&eventLoop); - EchoComponent bot(&eventLoop, &networkFactories); + EchoComponent bot(&networkFactories); eventLoop.run(); diff --git a/Documentation/SwiftenDevelopersGuide/Examples/EchoBot/SConscript b/Documentation/SwiftenDevelopersGuide/Examples/EchoBot/SConscript index c6349bd..5d27b70 100644 --- a/Documentation/SwiftenDevelopersGuide/Examples/EchoBot/SConscript +++ b/Documentation/SwiftenDevelopersGuide/Examples/EchoBot/SConscript @@ -2,6 +2,13 @@ Import("env") example_env = env.Clone() -example_env.MergeFlags(example_env["SWIFTEN_FLAGS"]) -example_env.MergeFlags(example_env["SWIFTEN_DEP_FLAGS"]) +example_env.UseFlags(example_env["SWIFTEN_FLAGS"]) +example_env.UseFlags(example_env["SWIFTEN_DEP_FLAGS"]) + +# Precompile Swiften header +# This is useful to slightly speed up compilation. +# if example_env["PLATFORM"] == "win32": +# example_env.WriteVal("Swiften.cpp", example_env.Value("#include <Swiften/Swiften.h>\n")) +# example_env["PCH"] = example_env.PCH("Swiften.cpp")[0] +# example_env["PCHSTOP"] = "Swiften/Swiften.h" for i in range(1,7) : @@ -15,4 +22,8 @@ if env["PLATFORM"] == "win32" : if int(env["MSVS_VERSION"].split(".")[0]) >= 10 : cpp0x = True +elif env["PLATFORM"] == "hpux" : + pass +elif env["PLATFORM"] == "sunos" : + pass else : if env["CCVERSION"].split(".") >= ["4", "5", "0"] : diff --git a/Documentation/SwiftenDevelopersGuide/SConscript b/Documentation/SwiftenDevelopersGuide/SConscript index c50641f..ba0eb0b 100644 --- a/Documentation/SwiftenDevelopersGuide/SConscript +++ b/Documentation/SwiftenDevelopersGuide/SConscript @@ -35,5 +35,7 @@ def generateDocBookCode(env, target, source) : calloutLines.append("<callout arearefs=\"%(cobID)s\" id=\"%(coID)s\"><para>%(text)s</para></callout>" % {"cobID": cobID, "coID": coID, "text": m.group(1)}) newProgramLines.append(line) - callouts = "<calloutlist>" + "\n".join(calloutLines) + "</calloutlist>" if len(calloutLines) > 0 else "" + callouts = "" + if len(calloutLines) > 0 : + callouts = "<calloutlist>" + "\n".join(calloutLines) + "</calloutlist>" return ("\n".join(newProgramLines), callouts) diff --git a/Documentation/SwiftenDevelopersGuide/Swiften Developers Guide.xml b/Documentation/SwiftenDevelopersGuide/Swiften Developers Guide.xml index fae79e4..345d049 100644 --- a/Documentation/SwiftenDevelopersGuide/Swiften Developers Guide.xml +++ b/Documentation/SwiftenDevelopersGuide/Swiften Developers Guide.xml @@ -118,4 +118,19 @@ list of C(++) compiler flags. </para> + + <para> + An example of setting up a build of a Swiften application using SCons is shown + in <xref linkend="Example-SCons"/>. + </para> + + <example id="Example-SCons"> + <title><literal>SConstruct</literal> file to build Swiften application with SCons</title> + <programlisting> +env = Environment() +env["SWIFTEN_CONFIG"] = "/path/to/swiften-config" +env.MergeFlags(env.subst("!$SWIFTEN_CONFIG --cflags --libs")) +env.Program("EchoBot.cpp") + </programlisting> + </example> </sect1> |