mirror of
https://github.com/FairRootGroup/FairMQ.git
synced 2025-10-17 10:31:46 +00:00
FairMQ Examples cleanup
- Rename Tutorial3 MQ files for uniform naming. - Add search for dylib in FindDDS.cmake (OSX). - Add more detail to the DDS example readme. - MQ Example 3 (DDS): choose network interface via command line option. - Give FairMQ examples their own CMakeLists.txt for clarity. - Remove C++11 checks in Tutorial3 from the code (they are now in CMake). - Add Serializer for device properties (FairMQDevice::ListProperties()).
This commit is contained in:
committed by
Mohammad Al-Turany
parent
a75486f3ec
commit
19afacb504
79
fairmq/examples/1-sampler-sink/CMakeLists.txt
Normal file
79
fairmq/examples/1-sampler-sink/CMakeLists.txt
Normal file
@@ -0,0 +1,79 @@
|
||||
################################################################################
|
||||
# Copyright (C) 2014 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH #
|
||||
# #
|
||||
# This software is distributed under the terms of the #
|
||||
# GNU Lesser General Public Licence version 3 (LGPL) version 3, #
|
||||
# copied verbatim in the file "LICENSE" #
|
||||
################################################################################
|
||||
|
||||
configure_file(${CMAKE_SOURCE_DIR}/fairmq/examples/1-sampler-sink/ex1-sampler-sink.json ${CMAKE_BINARY_DIR}/bin/config/ex1-sampler-sink.json)
|
||||
|
||||
Set(INCLUDE_DIRECTORIES
|
||||
${CMAKE_SOURCE_DIR}/fairmq
|
||||
${CMAKE_SOURCE_DIR}/fairmq/devices
|
||||
${CMAKE_SOURCE_DIR}/fairmq/tools
|
||||
${CMAKE_SOURCE_DIR}/fairmq/options
|
||||
${CMAKE_SOURCE_DIR}/fairmq/examples/1-sampler-sink
|
||||
${CMAKE_CURRENT_BINARY_DIR}
|
||||
)
|
||||
|
||||
Set(SYSTEM_INCLUDE_DIRECTORIES
|
||||
${Boost_INCLUDE_DIR}
|
||||
)
|
||||
|
||||
If(NANOMSG_FOUND)
|
||||
Set(INCLUDE_DIRECTORIES
|
||||
${INCLUDE_DIRECTORIES}
|
||||
${CMAKE_SOURCE_DIR}/fairmq/nanomsg
|
||||
)
|
||||
Else(NANOMSG_FOUND)
|
||||
Set(INCLUDE_DIRECTORIES
|
||||
${INCLUDE_DIRECTORIES}
|
||||
${CMAKE_SOURCE_DIR}/fairmq/zeromq
|
||||
)
|
||||
EndIf(NANOMSG_FOUND)
|
||||
|
||||
Include_Directories(${INCLUDE_DIRECTORIES})
|
||||
Include_Directories(SYSTEM ${SYSTEM_INCLUDE_DIRECTORIES})
|
||||
|
||||
Set(LINK_DIRECTORIES
|
||||
${Boost_LIBRARY_DIRS}
|
||||
)
|
||||
|
||||
Link_Directories(${LINK_DIRECTORIES})
|
||||
|
||||
Set(SRCS
|
||||
"FairMQExample1Sampler.cxx"
|
||||
"FairMQExample1Sink.cxx"
|
||||
)
|
||||
|
||||
Set(DEPENDENCIES
|
||||
${DEPENDENCIES}
|
||||
FairMQ
|
||||
)
|
||||
|
||||
Set(LIBRARY_NAME FairMQExample1)
|
||||
|
||||
GENERATE_LIBRARY()
|
||||
|
||||
Set(Exe_Names
|
||||
ex1-sampler
|
||||
ex1-sink
|
||||
)
|
||||
|
||||
Set(Exe_Source
|
||||
runExample1Sampler.cxx
|
||||
runExample1Sink.cxx
|
||||
)
|
||||
|
||||
list(LENGTH Exe_Names _length)
|
||||
math(EXPR _length ${_length}-1)
|
||||
|
||||
ForEach(_file RANGE 0 ${_length})
|
||||
list(GET Exe_Names ${_file} _name)
|
||||
list(GET Exe_Source ${_file} _src)
|
||||
set(EXE_NAME ${_name})
|
||||
set(SRCS ${_src})
|
||||
set(DEPENDENCIES FairMQExample1)
|
||||
GENERATE_EXECUTABLE()
|
||||
EndForEach(_file RANGE 0 ${_length})
|
@@ -15,7 +15,6 @@
|
||||
#include <memory> // unique_ptr
|
||||
|
||||
#include <boost/thread.hpp>
|
||||
#include <boost/bind.hpp>
|
||||
|
||||
#include "FairMQExample1Sampler.h"
|
||||
#include "FairMQLogger.h"
|
||||
|
@@ -12,9 +12,6 @@
|
||||
* @author A. Rybalchenko
|
||||
*/
|
||||
|
||||
#include <boost/thread.hpp>
|
||||
#include <boost/bind.hpp>
|
||||
|
||||
#include "FairMQExample1Sink.h"
|
||||
#include "FairMQLogger.h"
|
||||
|
||||
|
@@ -5,4 +5,4 @@ A simple topology of two devices - **Sampler** and **Sink**. **Sampler** sends d
|
||||
|
||||
`runExample1Sampler.cxx` and `runExample1Sink.cxx` configure and run the devices in their main function.
|
||||
|
||||
The executables take two required command line parameters: `--id` and `--config-json-file`. The value of `--id` should be a unique identifier and the value for `-config-json-file` a path to a config file. The config file for this example is `ex1-sampler-sink.json` and it contains configuration for the communication channels of the devices. The mapping between a specific device and the configuration (which can contain multiple devices) is done based on the **id**.
|
||||
The executables take two required command line parameters: `--id` and `--config-json-file`. The value of `--id` should be a unique identifier and the value for `--config-json-file` a path to a config file. The config file for this example is `ex1-sampler-sink.json` and it contains configuration for the communication channels of the devices. The mapping between a specific device and the configuration (which can contain multiple devices) is done based on the **id**.
|
||||
|
82
fairmq/examples/2-sampler-processor-sink/CMakeLists.txt
Normal file
82
fairmq/examples/2-sampler-processor-sink/CMakeLists.txt
Normal file
@@ -0,0 +1,82 @@
|
||||
################################################################################
|
||||
# Copyright (C) 2014 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH #
|
||||
# #
|
||||
# This software is distributed under the terms of the #
|
||||
# GNU Lesser General Public Licence version 3 (LGPL) version 3, #
|
||||
# copied verbatim in the file "LICENSE" #
|
||||
################################################################################
|
||||
|
||||
configure_file(${CMAKE_SOURCE_DIR}/fairmq/examples/2-sampler-processor-sink/ex2-sampler-processor-sink.json ${CMAKE_BINARY_DIR}/bin/config/ex2-sampler-processor-sink.json)
|
||||
|
||||
Set(INCLUDE_DIRECTORIES
|
||||
${CMAKE_SOURCE_DIR}/fairmq
|
||||
${CMAKE_SOURCE_DIR}/fairmq/devices
|
||||
${CMAKE_SOURCE_DIR}/fairmq/tools
|
||||
${CMAKE_SOURCE_DIR}/fairmq/options
|
||||
${CMAKE_SOURCE_DIR}/fairmq/examples/2-sampler-processor-sink
|
||||
${CMAKE_CURRENT_BINARY_DIR}
|
||||
)
|
||||
|
||||
Set(SYSTEM_INCLUDE_DIRECTORIES
|
||||
${Boost_INCLUDE_DIR}
|
||||
)
|
||||
|
||||
If(NANOMSG_FOUND)
|
||||
Set(INCLUDE_DIRECTORIES
|
||||
${INCLUDE_DIRECTORIES}
|
||||
${CMAKE_SOURCE_DIR}/fairmq/nanomsg
|
||||
)
|
||||
Else(NANOMSG_FOUND)
|
||||
Set(INCLUDE_DIRECTORIES
|
||||
${INCLUDE_DIRECTORIES}
|
||||
${CMAKE_SOURCE_DIR}/fairmq/zeromq
|
||||
)
|
||||
EndIf(NANOMSG_FOUND)
|
||||
|
||||
Include_Directories(${INCLUDE_DIRECTORIES})
|
||||
Include_Directories(SYSTEM ${SYSTEM_INCLUDE_DIRECTORIES})
|
||||
|
||||
Set(LINK_DIRECTORIES
|
||||
${Boost_LIBRARY_DIRS}
|
||||
)
|
||||
|
||||
Link_Directories(${LINK_DIRECTORIES})
|
||||
|
||||
Set(SRCS
|
||||
"FairMQExample2Sampler.cxx"
|
||||
"FairMQExample2Processor.cxx"
|
||||
"FairMQExample2Sink.cxx"
|
||||
)
|
||||
|
||||
Set(DEPENDENCIES
|
||||
${DEPENDENCIES}
|
||||
FairMQ
|
||||
)
|
||||
|
||||
Set(LIBRARY_NAME FairMQExample2)
|
||||
|
||||
GENERATE_LIBRARY()
|
||||
|
||||
Set(Exe_Names
|
||||
ex2-sampler
|
||||
ex2-processor
|
||||
ex2-sink
|
||||
)
|
||||
|
||||
Set(Exe_Source
|
||||
runExample2Sampler.cxx
|
||||
runExample2Processor.cxx
|
||||
runExample2Sink.cxx
|
||||
)
|
||||
|
||||
list(LENGTH Exe_Names _length)
|
||||
math(EXPR _length ${_length}-1)
|
||||
|
||||
ForEach(_file RANGE 0 ${_length})
|
||||
list(GET Exe_Names ${_file} _name)
|
||||
list(GET Exe_Source ${_file} _src)
|
||||
Set(EXE_NAME ${_name})
|
||||
Set(SRCS ${_src})
|
||||
Set(DEPENDENCIES FairMQExample2)
|
||||
GENERATE_EXECUTABLE()
|
||||
EndForEach(_file RANGE 0 ${_length})
|
93
fairmq/examples/3-dds/CMakeLists.txt
Normal file
93
fairmq/examples/3-dds/CMakeLists.txt
Normal file
@@ -0,0 +1,93 @@
|
||||
################################################################################
|
||||
# Copyright (C) 2014 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH #
|
||||
# #
|
||||
# This software is distributed under the terms of the #
|
||||
# GNU Lesser General Public Licence version 3 (LGPL) version 3, #
|
||||
# copied verbatim in the file "LICENSE" #
|
||||
################################################################################
|
||||
|
||||
configure_file(${CMAKE_SOURCE_DIR}/fairmq/examples/3-dds/ex3-devices.json ${CMAKE_BINARY_DIR}/bin/config/ex3-devices.json)
|
||||
configure_file(${CMAKE_SOURCE_DIR}/fairmq/examples/3-dds/ex3-dds-topology.xml ${CMAKE_BINARY_DIR}/bin/config/ex3-dds-topology.xml)
|
||||
configure_file(${CMAKE_SOURCE_DIR}/fairmq/examples/3-dds/ex3-dds-hosts.cfg ${CMAKE_BINARY_DIR}/bin/config/ex3-dds-hosts.cfg COPYONLY)
|
||||
|
||||
add_definitions(-DENABLE_DDS)
|
||||
|
||||
Set(INCLUDE_DIRECTORIES
|
||||
${CMAKE_SOURCE_DIR}/fairmq
|
||||
${CMAKE_SOURCE_DIR}/fairmq/devices
|
||||
${CMAKE_SOURCE_DIR}/fairmq/tools
|
||||
${CMAKE_SOURCE_DIR}/fairmq/options
|
||||
${CMAKE_SOURCE_DIR}/fairmq/examples/3-dds
|
||||
${CMAKE_CURRENT_BINARY_DIR}
|
||||
)
|
||||
|
||||
Set(SYSTEM_INCLUDE_DIRECTORIES
|
||||
${SYSTEM_INCLUDE_DIRECTORIES}
|
||||
${DDS_INCLUDE_DIR}
|
||||
)
|
||||
|
||||
If(NANOMSG_FOUND)
|
||||
Set(INCLUDE_DIRECTORIES
|
||||
${INCLUDE_DIRECTORIES}
|
||||
${CMAKE_SOURCE_DIR}/fairmq/nanomsg
|
||||
)
|
||||
Else(NANOMSG_FOUND)
|
||||
Set(INCLUDE_DIRECTORIES
|
||||
${INCLUDE_DIRECTORIES}
|
||||
${CMAKE_SOURCE_DIR}/fairmq/zeromq
|
||||
)
|
||||
EndIf(NANOMSG_FOUND)
|
||||
|
||||
Include_Directories(${INCLUDE_DIRECTORIES})
|
||||
Include_Directories(SYSTEM ${SYSTEM_INCLUDE_DIRECTORIES})
|
||||
|
||||
Set(LINK_DIRECTORIES
|
||||
${LINK_DIRECTORIES}
|
||||
${Boost_LIBRARY_DIRS}
|
||||
${DDS_LIBRARY_DIR}
|
||||
)
|
||||
|
||||
Link_Directories(${LINK_DIRECTORIES})
|
||||
|
||||
Set(SRCS
|
||||
${SRCS}
|
||||
"FairMQExample3Sampler.cxx"
|
||||
"FairMQExample3Processor.cxx"
|
||||
"FairMQExample3Sink.cxx"
|
||||
)
|
||||
|
||||
Set(DEPENDENCIES
|
||||
${DEPENDENCIES}
|
||||
FairMQ
|
||||
dds-key-value-lib
|
||||
)
|
||||
|
||||
set(LIBRARY_NAME FairMQExample3)
|
||||
|
||||
GENERATE_LIBRARY()
|
||||
|
||||
Set(Exe_Names
|
||||
${Exe_Names}
|
||||
ex3-sampler-dds
|
||||
ex3-processor-dds
|
||||
ex3-sink-dds
|
||||
)
|
||||
|
||||
Set(Exe_Source
|
||||
${Exe_Source}
|
||||
runExample3Sampler.cxx
|
||||
runExample3Processor.cxx
|
||||
runExample3Sink.cxx
|
||||
)
|
||||
|
||||
list(LENGTH Exe_Names _length)
|
||||
math(EXPR _length ${_length}-1)
|
||||
|
||||
ForEach(_file RANGE 0 ${_length})
|
||||
list(GET Exe_Names ${_file} _name)
|
||||
list(GET Exe_Source ${_file} _src)
|
||||
set(EXE_NAME ${_name})
|
||||
set(SRCS ${_src})
|
||||
set(DEPENDENCIES FairMQExample3)
|
||||
GENERATE_EXECUTABLE()
|
||||
EndForEach(_file RANGE 0 ${_length})
|
@@ -3,6 +3,12 @@ Example 3: DDS
|
||||
|
||||
This example demonstrates usage of the Dynamic Deployment System ([DDS](http://dds.gsi.de/)) to dynamically deploy and configure a topology of devices. The topology is similar to those of Example 2, but now it can be easily distributed on different computing nodes without the need for manual reconfiguration of the devices.
|
||||
|
||||
This example is compiled only if the DDS is found by CMake. Custom DDS installation location can be given to CMake like this:
|
||||
|
||||
```bash
|
||||
cmake -DDDS_PATH="/path/to/dds/install/dir/" ..
|
||||
```
|
||||
|
||||
The description below outlines the minimal steps needed to run the example with DDS. For more details please refer to DDS documentation on [DDS Website](http://dds.gsi.de/).
|
||||
|
||||
##### 1. The devices that bind their sockets need to advertise their bound addresses to DDS by writing a property.
|
||||
@@ -56,9 +62,9 @@ After this step each device will have the necessary connection information.
|
||||
|
||||
We run this example on the local machine for simplicity. The file below defines one worker `wn0` with 12 DDS Agents (thus able to accept 12 tasks). The parameters for each worker node are:
|
||||
- user-chosen worker ID (must be unique)
|
||||
- a host name with or without a login, in a form: login@host.fqdn
|
||||
- a host name with or without a login, in a form: login@host.fqdn (password-less SSH access to these hosts must be possible)
|
||||
- additional SSH params (can be empty)
|
||||
- a remote working directory
|
||||
- a remote working directory (most exist on the worker nodes)
|
||||
- number of DDS Agents for this worker
|
||||
|
||||
```bash
|
||||
|
@@ -46,11 +46,11 @@ int main(int argc, char** argv)
|
||||
{
|
||||
int ddsTaskIndex = 0;
|
||||
|
||||
options_description samplerOptions("Processor options");
|
||||
samplerOptions.add_options()
|
||||
("index", value<int>(&ddsTaskIndex)->default_value(0), "Store DDS task index");
|
||||
options_description processorOptions("Processor options");
|
||||
processorOptions.add_options()
|
||||
("index", value<int>(&ddsTaskIndex)->default_value(0), "DDS task index");
|
||||
|
||||
config.AddToCmdLineOptions(samplerOptions);
|
||||
config.AddToCmdLineOptions(processorOptions);
|
||||
|
||||
if (config.ParseAll(argc, argv))
|
||||
{
|
||||
|
@@ -45,11 +45,13 @@ int main(int argc, char** argv)
|
||||
|
||||
try
|
||||
{
|
||||
std::string text;
|
||||
std::string text; // text to be sent for processing.
|
||||
std::string interfaceName; // name of the network interface to use for communication.
|
||||
|
||||
options_description samplerOptions("Sampler options");
|
||||
samplerOptions.add_options()
|
||||
("text", value<std::string>(&text)->default_value("Hello"), "Text to send out");
|
||||
("text", value<std::string>(&text)->default_value("Hello"), "Text to send out")
|
||||
("network-interface", value<std::string>(&interfaceName)->default_value("eth0"), "Name of the network interface to use (e.g. eth0, ib0, wlan0, en0...)");
|
||||
|
||||
config.AddToCmdLineOptions(samplerOptions);
|
||||
|
||||
@@ -83,22 +85,14 @@ int main(int argc, char** argv)
|
||||
FairMQ::tools::getHostIPs(IPs);
|
||||
stringstream ss;
|
||||
// Check if ib0 (infiniband) interface is available, otherwise try eth0 or wlan0.
|
||||
if (IPs.count("ib0"))
|
||||
if (IPs.count(interfaceName))
|
||||
{
|
||||
ss << "tcp://" << IPs["ib0"] << ":1";
|
||||
}
|
||||
else if (IPs.count("eth0"))
|
||||
{
|
||||
ss << "tcp://" << IPs["eth0"] << ":1";
|
||||
}
|
||||
else if (IPs.count("wlan0"))
|
||||
{
|
||||
ss << "tcp://" << IPs["wlan0"] << ":1";
|
||||
ss << "tcp://" << IPs[interfaceName] << ":1";
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG(INFO) << ss.str();
|
||||
LOG(ERROR) << "Could not find ib0, eth0 or wlan0";
|
||||
LOG(ERROR) << "Could not find provided network interface: \"" << interfaceName << "\"!, exiting.";
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
string initialOutputAddress = ss.str();
|
||||
|
@@ -45,6 +45,14 @@ int main(int argc, char** argv)
|
||||
|
||||
try
|
||||
{
|
||||
std::string interfaceName; // name of the network interface to use for communication.
|
||||
|
||||
options_description sinkOptions("Sink options");
|
||||
sinkOptions.add_options()
|
||||
("network-interface", value<std::string>(&interfaceName)->default_value("eth0"), "Name of the network interface to use (e.g. eth0, ib0, wlan0, en0...)");
|
||||
|
||||
config.AddToCmdLineOptions(sinkOptions);
|
||||
|
||||
if (config.ParseAll(argc, argv))
|
||||
{
|
||||
return 0;
|
||||
@@ -74,22 +82,14 @@ int main(int argc, char** argv)
|
||||
FairMQ::tools::getHostIPs(IPs);
|
||||
stringstream ss;
|
||||
// Check if ib0 (infiniband) interface is available, otherwise try eth0 or wlan0.
|
||||
if (IPs.count("ib0"))
|
||||
if (IPs.count(interfaceName))
|
||||
{
|
||||
ss << "tcp://" << IPs["ib0"] << ":1";
|
||||
}
|
||||
else if (IPs.count("eth0"))
|
||||
{
|
||||
ss << "tcp://" << IPs["eth0"] << ":1";
|
||||
}
|
||||
else if (IPs.count("wlan0"))
|
||||
{
|
||||
ss << "tcp://" << IPs["wlan0"] << ":1";
|
||||
ss << "tcp://" << IPs[interfaceName] << ":1";
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG(INFO) << ss.str();
|
||||
LOG(ERROR) << "Could not find ib0, eth0 or wlan0";
|
||||
LOG(ERROR) << "Could not find provided network interface: \"" << interfaceName << "\"!, exiting.";
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
string initialInputAddress = ss.str();
|
||||
|
79
fairmq/examples/4-copypush/CMakeLists.txt
Normal file
79
fairmq/examples/4-copypush/CMakeLists.txt
Normal file
@@ -0,0 +1,79 @@
|
||||
################################################################################
|
||||
# Copyright (C) 2014 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH #
|
||||
# #
|
||||
# This software is distributed under the terms of the #
|
||||
# GNU Lesser General Public Licence version 3 (LGPL) version 3, #
|
||||
# copied verbatim in the file "LICENSE" #
|
||||
################################################################################
|
||||
|
||||
configure_file(${CMAKE_SOURCE_DIR}/fairmq/examples/4-copypush/ex4-copypush.json ${CMAKE_BINARY_DIR}/bin/config/ex4-copypush.json)
|
||||
|
||||
Set(INCLUDE_DIRECTORIES
|
||||
${CMAKE_SOURCE_DIR}/fairmq
|
||||
${CMAKE_SOURCE_DIR}/fairmq/devices
|
||||
${CMAKE_SOURCE_DIR}/fairmq/tools
|
||||
${CMAKE_SOURCE_DIR}/fairmq/options
|
||||
${CMAKE_SOURCE_DIR}/fairmq/examples/4-copypush
|
||||
${CMAKE_CURRENT_BINARY_DIR}
|
||||
)
|
||||
|
||||
Set(SYSTEM_INCLUDE_DIRECTORIES
|
||||
${Boost_INCLUDE_DIR}
|
||||
)
|
||||
|
||||
If(NANOMSG_FOUND)
|
||||
Set(INCLUDE_DIRECTORIES
|
||||
${INCLUDE_DIRECTORIES}
|
||||
${CMAKE_SOURCE_DIR}/fairmq/nanomsg
|
||||
)
|
||||
Else(NANOMSG_FOUND)
|
||||
Set(INCLUDE_DIRECTORIES
|
||||
${INCLUDE_DIRECTORIES}
|
||||
${CMAKE_SOURCE_DIR}/fairmq/zeromq
|
||||
)
|
||||
EndIf(NANOMSG_FOUND)
|
||||
|
||||
Include_Directories(${INCLUDE_DIRECTORIES})
|
||||
Include_Directories(SYSTEM ${SYSTEM_INCLUDE_DIRECTORIES})
|
||||
|
||||
Set(LINK_DIRECTORIES
|
||||
${Boost_LIBRARY_DIRS}
|
||||
)
|
||||
|
||||
Link_Directories(${LINK_DIRECTORIES})
|
||||
|
||||
Set(SRCS
|
||||
"FairMQExample4Sampler.cxx"
|
||||
"FairMQExample4Sink.cxx"
|
||||
)
|
||||
|
||||
Set(DEPENDENCIES
|
||||
${DEPENDENCIES}
|
||||
FairMQ
|
||||
)
|
||||
|
||||
Set(LIBRARY_NAME FairMQExample4)
|
||||
|
||||
GENERATE_LIBRARY()
|
||||
|
||||
Set(Exe_Names
|
||||
ex4-sampler
|
||||
ex4-sink
|
||||
)
|
||||
|
||||
Set(Exe_Source
|
||||
runExample4Sampler.cxx
|
||||
runExample4Sink.cxx
|
||||
)
|
||||
|
||||
list(LENGTH Exe_Names _length)
|
||||
math(EXPR _length ${_length}-1)
|
||||
|
||||
ForEach(_file RANGE 0 ${_length})
|
||||
list(GET Exe_Names ${_file} _name)
|
||||
list(GET Exe_Source ${_file} _src)
|
||||
Set(EXE_NAME ${_name})
|
||||
Set(SRCS ${_src})
|
||||
Set(DEPENDENCIES FairMQExample4)
|
||||
GENERATE_EXECUTABLE()
|
||||
EndForEach(_file RANGE 0 ${_length})
|
77
fairmq/examples/5-req-rep/CMakeLists.txt
Normal file
77
fairmq/examples/5-req-rep/CMakeLists.txt
Normal file
@@ -0,0 +1,77 @@
|
||||
################################################################################
|
||||
# Copyright (C) 2014 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH #
|
||||
# #
|
||||
# This software is distributed under the terms of the #
|
||||
# GNU Lesser General Public Licence version 3 (LGPL) version 3, #
|
||||
# copied verbatim in the file "LICENSE" #
|
||||
################################################################################
|
||||
|
||||
Set(INCLUDE_DIRECTORIES
|
||||
${CMAKE_SOURCE_DIR}/fairmq
|
||||
${CMAKE_SOURCE_DIR}/fairmq/devices
|
||||
${CMAKE_SOURCE_DIR}/fairmq/tools
|
||||
${CMAKE_SOURCE_DIR}/fairmq/options
|
||||
${CMAKE_SOURCE_DIR}/fairmq/examples/5-req-rep
|
||||
${CMAKE_CURRENT_BINARY_DIR}
|
||||
)
|
||||
|
||||
Set(SYSTEM_INCLUDE_DIRECTORIES
|
||||
${Boost_INCLUDE_DIR}
|
||||
)
|
||||
|
||||
If(NANOMSG_FOUND)
|
||||
Set(INCLUDE_DIRECTORIES
|
||||
${INCLUDE_DIRECTORIES}
|
||||
${CMAKE_SOURCE_DIR}/fairmq/nanomsg
|
||||
)
|
||||
Else(NANOMSG_FOUND)
|
||||
Set(INCLUDE_DIRECTORIES
|
||||
${INCLUDE_DIRECTORIES}
|
||||
${CMAKE_SOURCE_DIR}/fairmq/zeromq
|
||||
)
|
||||
EndIf(NANOMSG_FOUND)
|
||||
|
||||
Include_Directories(${INCLUDE_DIRECTORIES})
|
||||
Include_Directories(SYSTEM ${SYSTEM_INCLUDE_DIRECTORIES})
|
||||
|
||||
Set(LINK_DIRECTORIES
|
||||
${Boost_LIBRARY_DIRS}
|
||||
)
|
||||
|
||||
Link_Directories(${LINK_DIRECTORIES})
|
||||
|
||||
set(SRCS
|
||||
"FairMQExample5Client.cxx"
|
||||
"FairMQExample5Server.cxx"
|
||||
)
|
||||
|
||||
set(DEPENDENCIES
|
||||
${DEPENDENCIES}
|
||||
FairMQ
|
||||
)
|
||||
|
||||
set(LIBRARY_NAME FairMQExample5)
|
||||
|
||||
GENERATE_LIBRARY()
|
||||
|
||||
set(Exe_Names
|
||||
ex5-client
|
||||
ex5-server
|
||||
)
|
||||
|
||||
set(Exe_Source
|
||||
runExample5Client.cxx
|
||||
runExample5Server.cxx
|
||||
)
|
||||
|
||||
list(LENGTH Exe_Names _length)
|
||||
math(EXPR _length ${_length}-1)
|
||||
|
||||
ForEach(_file RANGE 0 ${_length})
|
||||
list(GET Exe_Names ${_file} _name)
|
||||
list(GET Exe_Source ${_file} _src)
|
||||
set(EXE_NAME ${_name})
|
||||
set(SRCS ${_src})
|
||||
set(DEPENDENCIES FairMQExample5)
|
||||
GENERATE_EXECUTABLE()
|
||||
EndForEach(_file RANGE 0 ${_length})
|
Reference in New Issue
Block a user