Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Corryvreckan
Corryvreckan
Commits
870cf284
Commit
870cf284
authored
Oct 09, 2017
by
Simon Spannagel
Browse files
Automatize addition of generator functions to algorithms
parent
bd46b0ec
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/algorithms/CMakeLists.txt
View file @
870cf284
...
...
@@ -24,6 +24,14 @@ MACRO(corryvreckan_algorithm name)
# Add the current directory as include directory
TARGET_INCLUDE_DIRECTORIES
(
${
LIBNAME
}
PRIVATE
${
CMAKE_CURRENT_SOURCE_DIR
}
)
# Set the special header flags and add the special dynamic implementation file
TARGET_COMPILE_DEFINITIONS
(
${
LIBNAME
}
PRIVATE CORRYVRECKAN_ALGORITHM_NAME=
${
name
}
)
TARGET_COMPILE_DEFINITIONS
(
${
LIBNAME
}
PRIVATE CORRYVRECKAN_ALGORITHM_HEADER=
"
${
name
}
.h"
)
TARGET_SOURCES
(
${
LIBNAME
}
PRIVATE
"
${
PROJECT_SOURCE_DIR
}
/src/core/dynamic_algorithm_impl.cpp"
)
SET_PROPERTY
(
SOURCE
"
${
PROJECT_SOURCE_DIR
}
/src/core/dynamic_algorithm_impl.cpp"
APPEND PROPERTY OBJECT_DEPENDS
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/
${
name
}
.h"
)
SET_PROPERTY
(
SOURCE
"
${
PROJECT_SOURCE_DIR
}
/src/core/Algorithm.C"
APPEND PROPERTY OBJECT_DEPENDS
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/
${
name
}
.h"
)
# Link the standard allpix libraries
TARGET_LINK_LIBRARIES
(
${
LIBNAME
}
${
CORRYVRECKAN_LIBRARIES
}
${
CORRYVRECKAN_DEPS_LIBRARIES
}
)
...
...
src/core/dynamic_algorithm_impl.cpp
0 → 100644
View file @
870cf284
/**
* @file
* @brief Special file automatically included in the algorithm for the dynamic loading
*
* Needs the following names to be defined by the build system
* - CORRYVRECKAN_ALGORITHM_NAME: name of the module
* - CORRYVRECKAN_ALGORITHM_HEADER: name of the header defining the module
*
* @copyright Copyright (c) 2017 CERN and the Allpix Squared authors.
* This software is distributed under the terms of the MIT License, copied verbatim in the file "LICENSE.md".
* In applying this license, CERN does not waive the privileges and immunities granted to it by virtue of its status as an
* Intergovernmental Organization or submit itself to any jurisdiction.
*/
#ifndef CORRYVRECKAN_ALGORITHM_NAME
#error "This header should only be automatically included during the build"
#endif
#include <memory>
#include <utility>
#include "core/config/Configuration.hpp"
#include "core/utils/log.h"
#include CORRYVRECKAN_ALGORITHM_HEADER
namespace
corryvreckan
{
extern
"C"
{
Algorithm
*
corryvreckan_module_generator
(
Configuration
config
,
Clipboard
*
clipboard
);
Algorithm
*
corryvreckan_module_generator
(
Configuration
config
,
Clipboard
*
clipboard
)
{
auto
algorithm
=
new
CORRYVRECKAN_ALGORITHM_NAME
(
std
::
move
(
config
),
clipboard
);
// NOLINT
return
static_cast
<
Algorithm
*>
(
algorithm
);
}
}
}
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment