IAP GITLAB

Skip to content
Snippets Groups Projects
Commit 56859348 authored by ralfulrich's avatar ralfulrich
Browse files

started to copy header files to namesapce directories in build dir

parent 3f643125
No related branches found
No related tags found
No related merge requests found
Showing
with 257 additions and 100 deletions
cmake_minimum_required (VERSION 3.4.3)
project (corsika VERSION 8.0.0 DESCRIPTION "CORSIKA C++ project" LANGUAGES CXX)
project (
corsika
VERSION 8.0.0
DESCRIPTION "CORSIKA C++ project"
LANGUAGES CXX
)
# ignore many irrelevant Up-to-date messages during install
set (CMAKE_INSTALL_MESSAGE LAZY)
# directory for local cmake modules
set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/CMakeModules)
include (CorsikaUtilities) # a few cmake function
# --std=c++14
set (CMAKE_CXX_STANDARD 17)
enable_testing ()
set (CTEST_OUTPUT_ON_FAILURE 1)
# testing coverage
include(CodeCoverage)
#set(COVERAGE_LCOV_EXCLUDES 'Documentation/*')
#setup_target_for_coverage(${PROJECT_NAME}_coverage ${PROJECT_TEST_NAME} coverage)
SETUP_TARGET_FOR_COVERAGE_GCOVR_HTML(
NAME corsika_coverage
EXECUTABLE ctest
#-j ${PROCESSOR_COUNT}
# DEPENDENCIES corsika
)
# unit testing coverage, does not work yet
#include (CodeCoverage)
##set(COVERAGE_LCOV_EXCLUDES 'Documentation/*')
##setup_target_for_coverage(${PROJECT_NAME}_coverage ${PROJECT_TEST_NAME} coverage)
#SETUP_TARGET_FOR_COVERAGE_GCOVR_HTML (
# NAME corsika_coverage
# EXECUTABLE ctest
# #-j ${PROCESSOR_COUNT}
# # DEPENDENCIES corsika
# )
#add_custom_target (corsika_pre_build)
#add_custom_command (TARGET corsika_pre_build PRE_BUILD COMMAND "${PROJECT_SOURCE_DIR}/pre_compile.py")
......
#
# takes a list of input files and prepends a path
#
function (CORSIKA_PREPEND_PATH return prefix)
set (listVar "")
foreach (f ${ARGN})
list (APPEND listVar "${prefix}/${f}")
endforeach (f)
set (${return} "${listVar}" PARENT_SCOPE)
endfunction (CORSIKA_PREPEND_PATH)
#
# use: CORSIKA_COPY_HEADERS_TO_NAMESPACE theLib theNamesapce header1.h header2.h ...
#
# creates a dependence of theLib on the presence of all listed header files in the
# build-directory include/theNamespace directory
#
# if needed, create symbolic links from the source files to this build-directory location
#
function (CORSIKA_COPY_HEADERS_TO_NAMESPACE for_library in_namespace)
CORSIKA_PREPEND_PATH (HEADERS_BUILD "${PROJECT_BINARY_DIR}/include/${in_namespace}" ${ARGN})
foreach (HEADER ${ARGN})
add_custom_command (
OUTPUT ${PROJECT_BINARY_DIR}/include/${in_namespace}/${HEADER}
COMMAND ${CMAKE_COMMAND} -E make_directory ${PROJECT_BINARY_DIR}/include/${in_namespace}
COMMAND ${CMAKE_COMMAND} -E create_symlink ${CMAKE_CURRENT_SOURCE_DIR}/${HEADER} ${PROJECT_BINARY_DIR}/include/${in_namespace}/${HEADER}
COMMENT "Generate link: ${PROJECT_BINARY_DIR}/include/${in_namespace}/${HEADER}"
# VERBATIM
)
endforeach (HEADER)
# main target for this library, depends on header files in build area
add_custom_target (
${for_library}_BUILD
DEPENDS ${HEADERS_BUILD}
)
add_dependencies (${for_library} ${for_library}_BUILD)
endfunction (CORSIKA_COPY_HEADERS_TO_NAMESPACE)
#include <Geometry/Vector.h>
#include <Geometry/Sphere.h>
#include <Geometry/Point.h>
#include <Geometry/CoordinateSystem.h>
#include <fwk/Vector.h>
#include <fwk/Sphere.h>
#include <fwk/Point.h>
#include <fwk/CoordinateSystem.h>
#include <Units/PhysicalUnits.h>
#include <iostream>
......@@ -12,6 +12,8 @@ using namespace phys::units;
using namespace phys::units::io; // support stream << unit
using namespace phys::units::literals; // support unit literals like 5_m;
using namespace fwk;
int main()
{
// define the root coordinate system
......
#include <Units/PhysicalUnits.h>
#include <Geometry/Vector.h>
#include <Geometry/CoordinateSystem.h>
#include <Geometry/Point.h>
#include <Geometry/Helix.h>
#include <fwk/Vector.h>
#include <fwk/CoordinateSystem.h>
#include <fwk/Point.h>
#include <fwk/Helix.h>
#include <cstdlib>
#include <iostream>
#include <array>
......@@ -15,12 +15,12 @@ int main()
{
CoordinateSystem root;
Point const r0(root, {0_m, 0_m, 0_m});
fwk::Point const r0(root, {0_m, 0_m, 0_m});
auto const omegaC = 2 * M_PI * 1_Hz;
Vector<speed_d> vPar(root, {0_m / second, 0_m / second, 10_cm / second});
Vector<speed_d> vPerp(root, {1_m / second, 0_m / second, 0_m / second});
fwk::Vector<speed_d> vPar(root, {0_m / second, 0_m / second, 10_cm / second});
fwk::Vector<speed_d> vPerp(root, {1_m / second, 0_m / second, 0_m / second});
Helix h(r0, omegaC, vPar, vPerp);
fwk::Helix h(r0, omegaC, vPar, vPerp);
auto constexpr t0 = 0_s;
auto constexpr t1 = 1_s;
......
#include <Logging/Logger.h>
#include <fwk/Logger.h>
#include <string>
#include <iostream>
......@@ -14,10 +14,10 @@ main()
{
cout << "writing to \"another.log\"" << endl;
ofstream logfile("another.log");
logger::sink::SinkStream unbuffered_sink(logfile);
logger::sink::BufferedSinkStream sink(logfile, logger::sink::StdBuffer(10000));
logger::Logger<logger::MessageOn, logger::sink::BufferedSinkStream> info("\033[32m", "info", sink);
logger::Logger<logger::MessageOn, logger::sink::BufferedSinkStream> err("\033[31m", "error", sink);
fwk::sink::SinkStream unbuffered_sink(logfile);
fwk::sink::BufferedSinkStream sink(logfile, fwk::sink::StdBuffer(10000));
fwk::Logger<fwk::MessageOn, fwk::sink::BufferedSinkStream> info("\033[32m", "info", sink);
fwk::Logger<fwk::MessageOn, fwk::sink::BufferedSinkStream> err("\033[31m", "error", sink);
//logger<ostream,messageconst,StdBuffer> info(std::cout, StdBuffer(10000));
/*
......@@ -33,8 +33,8 @@ main()
}
{
logger::sink::NoSink off;
logger::Logger<logger::MessageOff> info("", "", off);
fwk::sink::NoSink off;
fwk::Logger<fwk::MessageOff> info("", "", off);
for (int i=0; i<100000; ++i) {
LOG(info, "irgendwas", string("and more"), boost::format("error: %i message: %s. done."), i, "stupido", "a-number:", 8.99, "ENDE" );
......
#include <ParticleStack/StackOne.h>
//#include <corsika/StackOne.h>
#include <iostream>
#include <iomanip>
......
......@@ -4,8 +4,9 @@ namespace cascade;
template<typename Sequence, typename Trajectory>
void
Cascade::Cascade()
{
Cascade::Cascade() {
kkk;
kk;
}
......
#ifndef _include_BASEVECTOR_H_
#define _include_BASEVECTOR_H_
#include <Geometry/QuantityVector.h>
#include <Geometry/CoordinateSystem.h>
#include <fwk/QuantityVector.h>
#include <fwk/CoordinateSystem.h>
namespace fwk {
/*!
* Common base class for Vector and Point. Currently it does basically nothing.
......@@ -22,4 +24,6 @@ public:
}
};
} // end namesapce
#endif
set (GEOMETRY_SOURCES CoordinateSystem.cc)
set (GEOMETRY_HEADERS Vector.h Point.h Sphere.h CoordinateSystem.h Helix.h)
set (
GEOMETRY_SOURCES
CoordinateSystem.cc
)
set (
GEOMETRY_HEADERS
Vector.h
Point.h
Sphere.h
CoordinateSystem.h
Helix.h
BaseVector.h
QuantityVector.h
)
set (
GEOMETRY_NAMESPACE
fwk
)
add_library (CORSIKAgeometry STATIC ${GEOMETRY_SOURCES})
CORSIKA_COPY_HEADERS_TO_NAMESPACE (CORSIKAgeometry ${GEOMETRY_NAMESPACE} ${GEOMETRY_HEADERS})
set_target_properties (CORSIKAgeometry PROPERTIES VERSION ${PROJECT_VERSION})
set_target_properties (CORSIKAgeometry PROPERTIES SOVERSION 1)
set_target_properties (
CORSIKAgeometry
PROPERTIES
VERSION ${PROJECT_VERSION}
SOVERSION 1
PUBLIC_HEADER "${GEOMETRY_HEADERS}"
)
set_target_properties (CORSIKAgeometry PROPERTIES PUBLIC_HEADER "${GEOMETRY_HEADERS}")
# target dependencies on other libraries (also header only)
target_link_libraries (CORSIKAgeometry CORSIKAunits)
# target dependencies on other libraries (also the header onlys)
target_link_libraries (
CORSIKAgeometry
CORSIKAunits
)
target_include_directories (CORSIKAgeometry PRIVATE ${EIGEN3_INCLUDE_DIR})
target_include_directories (CORSIKAgeometry INTERFACE ${EIGEN3_INCLUDE_DIR})
target_include_directories (CORSIKAgeometry INTERFACE $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/Framework>
$<INSTALL_INTERFACE:include/Framework>
)
target_include_directories (
CORSIKAgeometry
PRIVATE ${EIGEN3_INCLUDE_DIR}
INTERFACE ${EIGEN3_INCLUDE_DIR}
$<BUILD_INTERFACE:${PROJECT_BINARY_DIR}/include>
$<INSTALL_INTERFACE:include/include>
)
install (TARGETS CORSIKAgeometry
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
PUBLIC_HEADER DESTINATION include/Geometry)
install (
TARGETS CORSIKAgeometry
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
PUBLIC_HEADER DESTINATION include/${GEOMETRY_NAMESPACE}
)
# code testing
# --------------------
# code unit testing
add_executable (testGeometry testGeometry.cc)
target_link_libraries (testGeometry CORSIKAgeometry CORSIKAunits CORSIKAthirdparty) # for catch2
add_test (NAME testGeometry COMMAND testGeometry -o report.xml -r junit)
target_link_libraries (
testGeometry
CORSIKAgeometry
CORSIKAunits
CORSIKAthirdparty # for catch2
)
add_test (NAME testGeometry COMMAND testGeometry)
#ifndef _include_HELIX_H_
#define _include_HELIX_H_
#include <Geometry/Vector.h>
#include <Geometry/Point.h>
#include <fwk/Vector.h>
#include <fwk/Point.h>
#include <Units/PhysicalUnits.h>
#include <cmath>
namespace fwk {
class Helix // TODO: inherit from to-be-implemented "Trajectory"
{
using SpeedVec = Vector<Speed::dimension_type>;
......@@ -38,4 +40,6 @@ public:
}
};
} // end namesapce
#endif
#ifndef _include_LINETRAJECTORY_H
#define _include_LINETRAJECTORY_H
#include <Framework/Geometry/Point.h>
#include <Framework/Geometry/Vector.h>
#include <fwk/Point.h>
#include <fwk/Vector.h>
#include <Units/PhysicalUnits.h>
namesapce fwk {
class LineTrajectory // TODO: inherit from Trajectory
{
using SpeedVec = Vector<Speed::dimension_type>;
......@@ -23,4 +25,6 @@ class LineTrajectory // TODO: inherit from Trajectory
}
};
} // end namesapce
#endif
#ifndef _include_POINT_H_
#define _include_POINT_H_
#include <Geometry/BaseVector.h>
#include <Geometry/QuantityVector.h>
#include <Geometry/Vector.h>
#include <fwk/BaseVector.h>
#include <fwk/QuantityVector.h>
#include <fwk/Vector.h>
#include <Units/PhysicalUnits.h>
/*!
* A Point represents a point in position space. It is defined by its
* coordinates with respect to some CoordinateSystem.
*/
class Point : public BaseVector<phys::units::length_d>
{
public:
Point(CoordinateSystem const& pCS, QuantityVector<phys::units::length_d> pQVector) :
BaseVector<phys::units::length_d>(pCS, pQVector)
{
}
Point(CoordinateSystem const& cs, Length x, Length y, Length z) :
namespace fwk {
/*!
* A Point represents a point in position space. It is defined by its
* coordinates with respect to some CoordinateSystem.
*/
class Point : public BaseVector<phys::units::length_d>
{
public:
Point(CoordinateSystem const& pCS, QuantityVector<phys::units::length_d> pQVector) :
BaseVector<phys::units::length_d>(pCS, pQVector)
{
}
Point(CoordinateSystem const& cs, Length x, Length y, Length z) :
BaseVector<phys::units::length_d>(cs, {x, y, z})
{
}
......@@ -65,4 +68,6 @@ public:
}
};
} // end namespace
#endif
#ifndef _include_SPHERE_H_
#define _include_SPHERE_H_
#include <Geometry/Point.h>
#include <fwk/Point.h>
#include <Units/PhysicalUnits.h>
namespace fwk {
class Sphere
{
Point center;
......@@ -23,4 +25,6 @@ public:
};
}// end namespace
#endif
#ifndef _include_VECTOR_H_
#define _include_VECTOR_H_
#include <Geometry/BaseVector.h>
#include <Geometry/QuantityVector.h>
#include <fwk/BaseVector.h>
#include <fwk/QuantityVector.h>
#include <Units/PhysicalUnits.h>
/*!
......@@ -15,8 +15,10 @@
* part only and invariant under translations.
*/
template <typename dim>
class Vector : public BaseVector<dim>
namespace fwk {
template <typename dim>
class Vector : public BaseVector<dim>
{
using Quantity = phys::units::quantity<dim, double>;
......@@ -200,4 +202,6 @@ public:
};
} // end namespace
#endif
#ifndef _include_BufferedSink_h_
#define _include_BufferedSink_h_
namespace logger {
namespace fwk {
namespace sink {
......
add_library (CORSIKAlogging INTERFACE)
target_include_directories (CORSIKAlogging INTERFACE ${PROJECT_SOURCE_DIR}/Framework)
# namespace of library -> location of header files
set (
CORSIKAlogging_NAMESPACE
fwk
)
# header files of this library
set (
CORSIKAlogging_HEADERS
Logger.h
Sink.h
MessageOn.h
MessageOff.h
NoSink.h
Sink.h
BufferedSink.h
)
CORSIKA_COPY_HEADERS_TO_NAMESPACE (CORSIKAlogging ${CORSIKAlogging_NAMESPACE} ${CORSIKAlogging_HEADERS})
# include directive for upstream code
target_include_directories (
CORSIKAlogging
INTERFACE
$<BUILD_INTERFACE:${PROJECT_BINARY_DIR}/include>
$<INSTALL_INTERFACE:include/>
)
# install library
install (
FILES ${CORSIKAlogging_HEADERS}
DESTINATION include/${CORSIKAlogging_NAMESPACE}
)
target_include_directories (CORSIKAlogging INTERFACE $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/Framework>
$<INSTALL_INTERFACE:include/Framework>
)
# ----------------
# code unit testing
add_executable (
testLogging
testLogging.cc
)
install (FILES Logger.h Sink.h MessageOn.h MessageOff.h NoSink.h Sink.h BufferedSink.h
DESTINATION include/Logging)
target_link_libraries (
testLogging
CORSIKAlogging
CORSIKAthirdparty # for catch2
)
# code testing
add_executable (testLogging testLogging.cc)
target_link_libraries (testLogging CORSIKAlogging CORSIKAthirdparty) # for catch2
add_test (NAME testLogging COMMAND testLogging -o report.xml -r junit)
add_test (
NAME testLogging
COMMAND testLogging
)
/**
@File Logger.h
*/
#ifndef _include_logger_h_
#define _include_logger_h_
......@@ -8,11 +12,11 @@
#include <boost/format.hpp>
#include <Logging/MessageOn.h>
#include <Logging/MessageOff.h>
#include <Logging/Sink.h>
#include <Logging/NoSink.h>
#include <Logging/BufferedSink.h>
#include <fwk/MessageOn.h>
#include <fwk/MessageOff.h>
#include <fwk/Sink.h>
#include <fwk/NoSink.h>
#include <fwk/BufferedSink.h>
using namespace std;
......@@ -22,7 +26,7 @@ using namespace boost;
Everything around logfile generation and text output.
*/
namespace logger {
namespace fwk {
/**
Defines one stream to accept messages, and to wrote those into
......
#ifndef _include_MessageOff_h_
#define _include_MessageOff_h_
namespace logger {
namespace fwk {
/**
Helper class to ignore all arguments to MessagesOn::Message and
......
......@@ -2,7 +2,7 @@
#define _include_MessageOn_h_
namespace logger {
namespace fwk {
/**
Helper class to convert all input arguments of MessageOn::Message
......
#ifndef _include_NoSink_h_
#define _include_NoSink_h_
namespace logger {
namespace fwk {
namespace sink {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment