From 8453c6805f417437fb7e9e63b81ecfbec0ed994e Mon Sep 17 00:00:00 2001
From: ralfulrich <ralf.ulrich@kit.edu>
Date: Tue, 7 Aug 2018 12:49:01 +0200
Subject: [PATCH] added doxygen output

---
 CMakeLists.txt                                |  8 +++++-
 Documentation/CMakeLists.txt                  |  4 +++
 Documentation/Doxygen/CMakeLists.txt          | 26 +++++++++++++++++++
 Documentation/Doxygen/Doxyfile.in             | 25 ++++++++++++++++++
 Documentation/Examples/CMakeLists.txt         | 10 +++++++
 .../Examples}/geometry_example.cc             |  8 +++---
 .../Examples}/logger_example.cc               |  1 +
 Main/CMakeLists.txt                           |  8 ------
 Processes/CMakeLists.txt                      |  1 +
 9 files changed, 78 insertions(+), 13 deletions(-)
 create mode 100644 Documentation/CMakeLists.txt
 create mode 100644 Documentation/Doxygen/CMakeLists.txt
 create mode 100644 Documentation/Doxygen/Doxyfile.in
 create mode 100644 Documentation/Examples/CMakeLists.txt
 rename {Main => Documentation/Examples}/geometry_example.cc (76%)
 rename {Main => Documentation/Examples}/logger_example.cc (95%)
 create mode 100644 Processes/CMakeLists.txt

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 9e9f9407..162150af 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -2,10 +2,16 @@ cmake_minimum_required (VERSION 3.4.3)
 
 set (CMAKE_CXX_STANDARD 14)
 
-project (CORSIKA VERSION 8.0.0.0 DESCRIPTION "CORSIKA C++ project")
+project (corsika VERSION 8.0.0 DESCRIPTION "CORSIKA C++ project")
+
+#add_custom_target (corsika_pre_build)
+#add_custom_command (TARGET corsika_pre_build PRE_BUILD COMMAND "${PROJECT_SOURCE_DIR}/pre_compile.py")
 
 find_package (Boost 1.40 COMPONENTS program_options REQUIRED)
 find_package (Eigen3 3.3 REQUIRED)
 
+add_subdirectory (Documentation)
 add_subdirectory (Framework)
+#add_subdirectory (Processes)
 add_subdirectory (Main)
+
diff --git a/Documentation/CMakeLists.txt b/Documentation/CMakeLists.txt
new file mode 100644
index 00000000..194c7be4
--- /dev/null
+++ b/Documentation/CMakeLists.txt
@@ -0,0 +1,4 @@
+
+add_subdirectory (Doxygen)
+add_subdirectory (Examples)
+
diff --git a/Documentation/Doxygen/CMakeLists.txt b/Documentation/Doxygen/CMakeLists.txt
new file mode 100644
index 00000000..c045db8f
--- /dev/null
+++ b/Documentation/Doxygen/CMakeLists.txt
@@ -0,0 +1,26 @@
+
+find_package (Doxygen REQUIRED dot OPTIONAL_COMPONENTS mscgen dia)
+
+if (DOXYGEN_FOUND)
+  set (DOXYGEN_IN ${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.in)
+  set (DOXYGEN_OUT ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile)
+  set (DOXYGEN_GENERATE_HTML YES)
+  set (DOXYGEN_GENERATE_MAN YES)
+  configure_file (${DOXYGEN_IN} ${DOXYGEN_OUT} @ONLY)
+  message ("Start doxygen with \"make doxygen\"")
+  
+  # note the option ALL which allows to build the docs together with the application
+  add_custom_target (doxygen # ALL
+    COMMAND ${DOXYGEN_EXECUTABLE} ${DOXYGEN_OUT}
+    WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
+    COMMENT "Generating API documentation with Doxygen"
+    VERBATIM)
+
+  install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/html DESTINATION share/doc OPTIONAL)
+         
+else (DOXYGEN_FOUND)
+  
+  message ("Doxygen need to be installed to generate the doxygen documentation")
+  
+endif (DOXYGEN_FOUND)
+
diff --git a/Documentation/Doxygen/Doxyfile.in b/Documentation/Doxygen/Doxyfile.in
new file mode 100644
index 00000000..400b6f2e
--- /dev/null
+++ b/Documentation/Doxygen/Doxyfile.in
@@ -0,0 +1,25 @@
+PROJECT_NAME           = CORSIKA8
+
+OUTPUT_DIRECTORY       = @CMAKE_CURRENT_BINARY_DIR@/
+INPUT                  = @CMAKE_CURRENT_SOURCE_DIR@/../.. 
+
+GENERATE_HTML          = YES
+GENERATE_LATEX         = NO
+
+FILE_PATTERNS          = *.cc *.h
+RECURSIVE              = YES
+
+SOURCE_BROWSER         = YES
+# INLINE_SOURCES
+
+CLASS_DIAGRAMS         = YES
+HAVE_DOT               = YES
+CLASS_GRAPH            = YES
+UML_LOOK               = YES
+TEMPLATE_RELATIONS     = YES
+INCLUDE_GRAPH          = YES
+GRAPHICAL_HIERARCHY    = YES
+DIRECTORY_GRAPH        = YES
+GENERATE_LEGEND        = YES
+
+SEARCHENGINE           = YES
diff --git a/Documentation/Examples/CMakeLists.txt b/Documentation/Examples/CMakeLists.txt
new file mode 100644
index 00000000..7045e5e0
--- /dev/null
+++ b/Documentation/Examples/CMakeLists.txt
@@ -0,0 +1,10 @@
+
+
+add_executable (geometry_example geometry_example.cc)
+target_link_libraries (geometry_example CORSIKAgeometry CORSIKAunits)
+install (TARGETS geometry_example DESTINATION share/examples)
+
+
+add_executable (logger_example logger_example.cc)
+target_link_libraries (logger_example CORSIKAunits CORSIKAlogging)
+install (TARGETS logger_example DESTINATION share/examples)
diff --git a/Main/geometry_example.cc b/Documentation/Examples/geometry_example.cc
similarity index 76%
rename from Main/geometry_example.cc
rename to Documentation/Examples/geometry_example.cc
index f0bd11f8..d045decb 100644
--- a/Main/geometry_example.cc
+++ b/Documentation/Examples/geometry_example.cc
@@ -28,14 +28,14 @@ int main()
     auto const diff = p2 - p1;
     auto const norm = diff.squaredNorm();
     
-    std::cout << diff.getComponents() << std::endl;
-    std::cout << norm << std::endl;
+    std::cout << "p2-p1 components: " << diff.getComponents() << std::endl;
+    std::cout << "p2-p1 norm^2: " << norm << std::endl;
     
     Sphere s(p1, 10_m);
-    std::cout << s.isInside(p2) << std::endl;    
+    std::cout << "p1 inside s:  " << s.isInside(p2) << std::endl;    
     
     Sphere s2(p1, 3_um);
-    std::cout << s2.isInside(p2) << std::endl;    
+    std::cout << "p1 inside s2: " << s2.isInside(p2) << std::endl;    
     
     return EXIT_SUCCESS;
 }
diff --git a/Main/logger_example.cc b/Documentation/Examples/logger_example.cc
similarity index 95%
rename from Main/logger_example.cc
rename to Documentation/Examples/logger_example.cc
index 622c68e4..5455f7d5 100644
--- a/Main/logger_example.cc
+++ b/Documentation/Examples/logger_example.cc
@@ -11,6 +11,7 @@ int
 main()
 {
   {
+    cout << "writing to \"another.log\"" << endl;
     ofstream logfile("another.log");
     typedef Sink<ofstream, StdBuffer> SinkFile;
     SinkFile sink(logfile, StdBuffer(10000));
diff --git a/Main/CMakeLists.txt b/Main/CMakeLists.txt
index 8698a20e..139597f9 100644
--- a/Main/CMakeLists.txt
+++ b/Main/CMakeLists.txt
@@ -1,10 +1,2 @@
 
 
-add_executable (geometry_example geometry_example.cc)
-target_link_libraries (geometry_example CORSIKAgeometry CORSIKAunits)
-install (TARGETS geometry_example DESTINATION bin)
-
-
-add_executable (logger_example logger_example.cc)
-target_link_libraries (logger_example CORSIKAunits CORSIKAlogging)
-install (TARGETS logger_example DESTINATION bin)
diff --git a/Processes/CMakeLists.txt b/Processes/CMakeLists.txt
new file mode 100644
index 00000000..f1e2ce31
--- /dev/null
+++ b/Processes/CMakeLists.txt
@@ -0,0 +1 @@
+add_subdirectory (NullModel)
-- 
GitLab